ocearo-ui 0.1.22 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/404.html +1 -1
- package/README.fr.md +141 -157
- package/README.md +137 -157
- package/__next.__PAGE__.txt +19 -5
- package/__next._full.txt +12 -12
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/0-c2-u5p6bxzo.js +1 -0
- package/_next/static/chunks/0h2qsuyze9ds1.js +1 -0
- package/_next/static/chunks/0iqdztntvxh3c.js +119 -0
- package/_next/static/chunks/0iztd835j5p1n.js +700 -0
- package/_next/static/chunks/{2nxsyowmuwpjy.js → 0jfox92up1jvy.js} +1 -1
- package/_next/static/chunks/0jpa5m78l0ib0.js +1 -0
- package/_next/static/chunks/0kpstejrka-7k.js +1 -0
- package/_next/static/chunks/0m7wbuocx-b4_.js +9 -0
- package/_next/static/chunks/0n95joti2n2py.js +3 -0
- package/_next/static/chunks/0ohleay4roayh.js +353 -0
- package/_next/static/chunks/0on1skx9l54-9.js +1 -0
- package/_next/static/chunks/0voiofm58khqd.js +1 -0
- package/_next/static/chunks/0w_skktmh3e48.js +1 -0
- package/_next/static/chunks/0y-dctk-kmqss.js +1 -0
- package/_next/static/chunks/0zwc9m4qgtwle.js +1 -0
- package/_next/static/chunks/11awvgcou7v4r.js +1 -0
- package/_next/static/chunks/144mjqdrx42lq.js +1 -0
- package/_next/static/chunks/15imr2-f_8n-x.js +1 -0
- package/_next/static/chunks/18_i6mf6hb_c7.js +1 -0
- package/_next/static/chunks/1d81m3g9jqkob.js +1 -0
- package/_next/static/chunks/1ed7ayfg19cjb.js +1 -0
- package/_next/static/chunks/1epya-yh2wvj2.js +1 -0
- package/_next/static/chunks/1exvcc71cgr4t.js +446 -0
- package/_next/static/chunks/1g8fbzv0hu0i2.js +1 -0
- package/_next/static/chunks/1gq4t2dyr7rq3.js +1 -0
- package/_next/static/chunks/1gt2hhqk1821k.js +9 -0
- package/_next/static/chunks/1l-jew0-1-3eq.js +30 -0
- package/_next/static/chunks/1pa1cfmfts0i9.js +1 -0
- package/_next/static/chunks/1ptj3mv8b_tzs.js +1 -0
- package/_next/static/chunks/1w1xks0hp_tlr.js +346 -0
- package/_next/static/chunks/1xekc18cyi4sx.js +1 -0
- package/_next/static/chunks/1y35unwvy8p98.js +1 -0
- package/_next/static/chunks/1zm03hw2ylxw8.js +1 -0
- package/_next/static/chunks/2aq8orcir5h03.js +1 -0
- package/_next/static/chunks/2dvwb-mfasp68.js +1 -0
- package/_next/static/chunks/2fdpvhx4oo81h.js +1 -0
- package/_next/static/chunks/2g-xpe7xnropn.js +409 -0
- package/_next/static/chunks/2kmptoy43h0mx.js +1 -0
- package/_next/static/chunks/2kwn4iymxaom3.js +1 -0
- package/_next/static/chunks/2n86yq1wz1yx7.js +1 -0
- package/_next/static/chunks/2rebcvig176xk.js +564 -0
- package/_next/static/chunks/2ryo_bbmt6t74.css +3 -0
- package/_next/static/chunks/2s6w3x5jnc2tg.js +1 -0
- package/_next/static/chunks/2w44atvyp9o_w.js +1 -0
- package/_next/static/chunks/2w71oj1brox5z.js +1 -0
- package/_next/static/chunks/2wayx8t5r5fi9.js +1 -0
- package/_next/static/chunks/3--qzv1u6c7_7.js +1 -0
- package/_next/static/chunks/32yn_fc-es66m.js +22 -0
- package/_next/static/chunks/34wvn5zw0a69w.js +1 -0
- package/_next/static/chunks/37t6vg8fb1-z8.js +1 -0
- package/_next/static/chunks/3nm7o0eq5abhg.js +1 -0
- package/_next/static/chunks/3p9ziqn6r35qf.js +1 -0
- package/_next/static/chunks/3q8o52_juxmdp.js +1 -0
- package/_next/static/chunks/3s6nzrbk-8mnv.js +31 -0
- package/_next/static/chunks/3td9mnhvcj9cq.js +1 -0
- package/_next/static/chunks/3wwn1rti8oc_r.js +1 -0
- package/_next/static/chunks/3zqx8h9yg5-ch.js +1 -0
- package/_next/static/chunks/turbopack-1h111qg8l92rw.js +1 -0
- package/_not-found/__next._full.txt +13 -13
- package/_not-found/__next._not-found.__PAGE__.txt +19 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +13 -13
- package/apple-touch-icon.png +0 -0
- package/boats/boats.json +40 -5
- package/favicon-96x96.png +0 -0
- package/favicon.ico +0 -0
- package/favicon.svg +1 -3
- package/icons/favicon-16x16.png +0 -0
- package/icons/favicon-32x32.png +0 -0
- package/icons/favicon-48x48.png +0 -0
- package/icons/icon-192x192.png +0 -0
- package/icons/icon-512x512.png +0 -0
- package/icons/ocearo.webp +0 -0
- package/index.html +1 -1
- package/index.txt +12 -12
- package/manifest.json +2 -3
- package/package.json +15 -14
- package/settings/__next._full.txt +15 -15
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +22 -5
- package/settings.html +1 -1
- package/settings.txt +15 -15
- package/__next._head.txt +0 -6
- package/__next._index.txt +0 -5
- package/_next/static/chunks/0-z15txb4-uhu.js +0 -409
- package/_next/static/chunks/009rlietvsaq2.js +0 -1
- package/_next/static/chunks/070stlm97b9a2.js +0 -1
- package/_next/static/chunks/0abo2oxxw3hpi.js +0 -1
- package/_next/static/chunks/0jzbiie0nzar2.js +0 -1
- package/_next/static/chunks/0kinaai2rvd43.js +0 -9
- package/_next/static/chunks/0l9s4rhr00adq.js +0 -1
- package/_next/static/chunks/0qj7yy4f6sk8y.js +0 -455
- package/_next/static/chunks/0ri_um14-5x7u.js +0 -1
- package/_next/static/chunks/0uvr7xkt_5uno.js +0 -1
- package/_next/static/chunks/0yf1ifg_o1bq6.js +0 -1
- package/_next/static/chunks/0zbzk2ob0li1n.js +0 -1
- package/_next/static/chunks/0zjxnzbxh76mt.js +0 -1
- package/_next/static/chunks/17ma1x64d-211.js +0 -1
- package/_next/static/chunks/19xb2y6sgfnza.js +0 -1
- package/_next/static/chunks/1bz0tcmhjmjgh.js +0 -1
- package/_next/static/chunks/1d4h-sglyo8ft.js +0 -1
- package/_next/static/chunks/1gizigk3w6q7j.js +0 -31
- package/_next/static/chunks/1ptwltjb3h6jf.js +0 -4
- package/_next/static/chunks/1q572rz5m8mb-.js +0 -1
- package/_next/static/chunks/1rkf8qtk5-48h.js +0 -1
- package/_next/static/chunks/1sq_733weprvs.js +0 -1
- package/_next/static/chunks/26e1o1as-77nq.js +0 -172
- package/_next/static/chunks/27hn45pv56pv7.js +0 -393
- package/_next/static/chunks/28y-j215vt42m.js +0 -1
- package/_next/static/chunks/2a0yjir_3mk1m.js +0 -1
- package/_next/static/chunks/2atijj_pkc4uc.js +0 -2
- package/_next/static/chunks/2ccpehidlaq88.js +0 -1
- package/_next/static/chunks/2fy4q1c5l3tpj.js +0 -1
- package/_next/static/chunks/2lvvt2f1l5sfu.js +0 -1
- package/_next/static/chunks/2lw7kypuhij1_.css +0 -3
- package/_next/static/chunks/2nd5amcst4lhp.js +0 -1
- package/_next/static/chunks/2pwmb4pkqygy_.js +0 -1
- package/_next/static/chunks/2q_83f24jeg0e.js +0 -1
- package/_next/static/chunks/2rsdqsatgq9ta.js +0 -1
- package/_next/static/chunks/2udirievybq_j.js +0 -1
- package/_next/static/chunks/2urimbxg5bqv3.js +0 -1
- package/_next/static/chunks/32cbrrsp-x35l.js +0 -1
- package/_next/static/chunks/36ra6xjie0dsv.js +0 -9
- package/_next/static/chunks/3iuz3f0429awx.js +0 -1
- package/_next/static/chunks/3jh1u-s3k0bkk.js +0 -1
- package/_next/static/chunks/3jupxlga7r_do.js +0 -1
- package/_next/static/chunks/3m57lnggu30tr.js +0 -243
- package/_next/static/chunks/3myql5zu0rstt.js +0 -425
- package/_next/static/chunks/3rhgquok36e79.js +0 -1
- package/_next/static/chunks/42dfiu6iby3fq.js +0 -1
- package/_next/static/chunks/43ps2cu5ahf8n.js +0 -3
- package/_next/static/chunks/turbopack-0pirmko-w-775.js +0 -1
- package/_not-found/__next._head.txt +0 -6
- package/_not-found/__next._index.txt +0 -5
- package/_not-found/__next._not-found.txt +0 -5
- package/boats/ais/ais-30.glb +0 -0
- package/boats/ais/ais-31.glb +0 -0
- package/boats/ais/ais-35.glb +0 -0
- package/boats/ais/ais-36.glb +0 -0
- package/boats/ais/ais-37.glb +0 -0
- package/boats/ais/ais-40.glb +0 -0
- package/boats/ais/ais-50.glb +0 -0
- package/boats/ais/ais-60.glb +0 -0
- package/boats/ais/ais-70.glb +0 -0
- package/boats/ais/ais-80.glb +0 -0
- package/settings/__next._head.txt +0 -6
- package/settings/__next._index.txt +0 -5
- package/settings/__next.settings.txt +0 -5
- /package/_next/static/{sct9rcMTcCyBLHTxQQ75- → 01VWnAYjs9QwBnnMyWbQF}/_buildManifest.js +0 -0
- /package/_next/static/{sct9rcMTcCyBLHTxQQ75- → 01VWnAYjs9QwBnnMyWbQF}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{sct9rcMTcCyBLHTxQQ75- → 01VWnAYjs9QwBnnMyWbQF}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,66326,78140,20840,16196,98392,8066,34297,e=>{"use strict";let t,r;var a=e.i(47167),n=e.i(43476),i=e.i(71645);e.i(67561);var o=e.i(46991),s=e.i(85709),l=e.i(83402),u=e.i(31067),h=e.i(46457),c=e.i(27543),d=e.i(21359),f=e.i(93282),p=e.i(90072);let m=function(e){let t=new Map,r=new Map,a=e.clone();return function e(t,r,a){a(t,r);for(let n=0;n<t.children.length;n++)e(t.children[n],r.children[n],a)}(e,a,function(e,a){t.set(a,e),r.set(e,a)}),a.traverse(function(e){if(!e.isSkinnedMesh)return;let a=t.get(e),n=a.skeleton.bones;e.skeleton=a.skeleton.clone(),e.bindMatrix.copy(a.bindMatrix),e.skeleton.bones=n.map(function(e){return r.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),a},g=i.forwardRef(({isChild:e=!1,object:t,children:r,deep:a,castShadow:n,receiveShadow:o,inject:s,keys:l,...h},c)=>{let d={keys:l,deep:a,inject:s,castShadow:n,receiveShadow:o};if(Array.isArray(t=i.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return m(t)}return t},[t,e])))return i.createElement("group",(0,u.default)({},h,{ref:c}),t.map(e=>i.createElement(g,(0,u.default)({key:e.uuid,object:e},d))),r);let{children:f,...A}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:a,castShadow:n,receiveShadow:o}){let s={};for(let r of t)s[r]=e[r];return r&&(s.geometry&&"materialsOnly"!==r&&(s.geometry=s.geometry.clone()),s.material&&"geometriesOnly"!==r&&(s.material=s.material.clone())),a&&(s="function"==typeof a?{...s,children:a(e)}:i.isValidElement(a)?{...s,children:a}:{...s,...a}),e instanceof p.Mesh&&(n&&(s.castShadow=!0),o&&(s.receiveShadow=!0)),s}(t,d),v=t.type[0].toLowerCase()+t.type.slice(1);return i.createElement(v,(0,u.default)({},A,h,{ref:c}),t.children.map(e=>"Bone"===e.type?i.createElement("primitive",(0,u.default)({key:e.uuid,object:e},d)):i.createElement(g,(0,u.default)({key:e.uuid,object:e},d,{isChild:!0}))),r,f)}),A=null,v="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function B(e=!0,t=!0,r){return a=>{r&&r(a),e&&(A||(A=new c.DRACOLoader),A.setDecoderPath("string"==typeof e?e:v),a.setDRACOLoader(A)),t&&a.setMeshoptDecoder("function"==typeof d.MeshoptDecoder?(0,d.MeshoptDecoder)():d.MeshoptDecoder)}}let y=(e,t,r,a)=>(0,f.useLoader)(h.GLTFLoader,e,B(t,r,a));y.preload=(e,t,r,a)=>f.useLoader.preload(h.GLTFLoader,e,B(t,r,a)),y.clear=e=>f.useLoader.clear(h.GLTFLoader,e),y.setDecoderPath=e=>{v=e},e.s(["useGLTF",0,y],78140);var C=e.i(95393);let b=class{draftDepth;draftDepthRatio;draftPosition;draftPositionRatio;forceAngleRad;girth;mastAngleRad;sag;chordMastTop;chordTackLevel;mastWidth;#e=[];#t=[];constructor(e,t,r,a=1){this.chordMastTop=t,this.chordTackLevel=e,this.mastWidth=r;const n=(e,t=1)=>new p.Vector2(t*e**2,2*t*e),i=1.001+.95*(a-1)/10,o=(i-.001)/1e3;let s=n(.001);const l=n(i).clone().sub(s).angle();let u=new p.Vector2(0,0);for(let e=.001;e<=i;e+=o){let t=n(e);t.sub(s),t.rotateAround(u,-l),this.#e.push(t)}this.calcShape(1-.25*(a-1)/10)}calcShape(e=1){this.#t=[];let t=this.chordTackLevel/(this.#e[this.#e.length-1].x-this.#e[0].x);for(let r of this.#e){let a=r.clone().multiplyScalar(t);1!==e&&(a.y*=e),this.#t.push(a)}let r=new p.Vector2(0,0);for(let e of this.#t)e.y>r.y&&(r=e);this.draftDepth=r.y,this.draftPosition=r.x,this.girth=0;let a=null;for(let e of this.#t)null!==a&&(this.girth+=e.distanceTo(a)),a=e;this.sag=this.chordTackLevel-this.girth,this.entryAngleRad=this.#t[1].clone().sub(this.#t[0]).angle(),this.exitAngleRad=this.#t[this.#t.length-1].clone().sub(this.#t[this.#t.length-2]).angle()-2*Math.PI,this.mastAngleRad=this.calcMastAngle(),this.forceAngleRad=(this.entryAngleRad+this.exitAngleRad)/2,this.draftDepthRatio=this.draftDepth/this.chordTackLevel,this.draftPositionRatio=this.draftPosition/this.chordTackLevel}calcMastAngle(){let e=0,t=null,r=this.mastWidth*this.chordTackLevel/this.chordMastTop;for(let a of this.#t){if(null!==t&&(e+=a.distanceTo(t))>=r)return a.angle();t=a}return NaN}getVerticesAngles(e,t,r=null){let a=(this.girth-t)/(e-1),n=0,i=0,o=[],s=null;for(let l of this.#t){if(null!==s&&(((i+=l.distanceTo(s))>=n*a+t||r&&i>r)&&(n++,o.push(l.angle())),n>=e))break;s=l}return o}pointAtGirthDistance(e){let t=0,r=null;for(let a of this.#t)if(null!==r&&(t+=a.distanceTo(r)),r=a,t>=e)return r.clone()}};var M=e.i(83646),x=e.i(5941);let w=Math.floor(20),E=Math.ceil(160),F={maxMastRotation:Math.PI/2,maxChordRotationPerSailLevel:Math.PI/3*2},T=({windParams:e={speed:5,hellman:.27},boatParams:t={mastrotation:0,heading:130,speed:5},sailParams:r={mastArea:0,sailArea:0,cunningham:1,angleOfAttack:20},reefLevel:a=0,mainCamber:o=1})=>{let l=(0,s.useSignalKPath)("environment.wind.angleApparent",0),u=(0,s.useSignalKPath)("environment.wind.speedApparent",0),h=(0,i.useRef)(),c=(0,i.useRef)(null),d=(0,i.useRef)(0),f=(0,i.useRef)(null),m=(0,i.useRef)(null),g=(0,i.useRef)(),A=(0,i.useRef)({}),{accent:v,scene:{sail:B}}=(0,M.default)(),y=(0,i.useMemo)(()=>{let e=new p.Group,t=new p.ConeGeometry(.08,.15,12),r=new p.MeshBasicMaterial({color:new p.Color(v),opacity:.3,transparent:!0,depthWrite:!1}),a=new p.Mesh(t,r);return a.position.set(0,-.075,0),e.add(a),e},[v]);(0,i.useEffect)(()=>{let e=new p.Group,t={};for(let r=0;r<8;r+=.5){let a=y.clone();a.position.set(0,r,0),t[2*r]=a,e.add(a)}return e.position.set(0,0,0),g.current&&g.current.add(e),A.current=t,()=>{e.clear()}},[y]);let{geometry:C,sailClipWidthPerLevel:T}=(0,i.useMemo)(()=>{let e=new p.BufferGeometry,t=[],r=[],a=[];for(let e=0;e<=E;e++){let n,i,o=Math.min(50*e,8e3);o<900?(n=3600,i=3800+-200*o/900):i=n=3600-3210*(o-900)/7100+600*Math.sin((o-900)/7100*Math.PI);let s=0;for(let e=0;e<w;e++){let a=n/(w-1),l=a*e-i,u=a;l>.1&&(u=l>a?0:a-l),t.push(0===e?0:(s+u)/1e3,o/1e3,0),s=0===e?0:s+u,r.push(.35,.38,.42)}a.push(i===n?null:i)}let n=[];for(let e=0;e<E;e++)for(let t=1;t<w;t++){let r=e*w+t;n.push(r-1,r,r+w-1,r,r+w,r+w-1)}return e.setAttribute("position",new p.Float32BufferAttribute(t,3)),e.setAttribute("color",new p.Float32BufferAttribute(r,3)),e.setIndex(n),e.computeVertexNormals(),{geometry:e,sailClipWidthPerLevel:a}},[]);return(0,i.useEffect)(()=>{if(!h.current)return;((e,t)=>{let r=A.current;if(!r)return console.error("apparentWindField is not initialized.");for(let o=0;o<8;o+=.5){var a,n,i;let s=(a=e,n=o,i=t,Number.isFinite(a)&&Number.isFinite(n)&&Number.isFinite(i)?a/1.9438444924574*Math.pow(Math.max(n,0)/10,i)*1.9438444924574:0),l=r[2*o];if(!l){console.warn(`Apparent wind field cone at height ${o} is not defined.`);continue}l.scale.set(.1*s,s,.1*s),l.rotation.set(0,-Math.PI,Math.PI/2)}})(u,e.hellman);let n=h.current.geometry,i=n.attributes.position.array;r.cunningham!==f.current&&(m.current=new b(3600,390,200,r.cunningham),f.current=r.cunningham),c.current||(c.current=n.clone());let o=8e3*(0,x.getReefHeightFactor)(a),s=n.attributes.color,g=s.array,v=l;for(;v<0;)v+=2*Math.PI;for(;v>=2*Math.PI;)v-=2*Math.PI;let B=v>Math.PI?-1:1,y=v;y>Math.PI&&(y=2*Math.PI-y);let C=p.MathUtils.degToRad(r.angleOfAttack),M=m.current.mastAngleRad;y<.01&&(C=0);let S=Math.min(y-C+M,F.maxMastRotation),I=new p.Vector3(0,1,0),R=null;for(let e=0;e<=E;e++){let t=y-C;t<0?t=0:t>Math.PI/2&&(t=Math.PI/2);let r=t-S;R&&r-R>F.maxChordRotationPerSailLevel&&(r=R+F.maxChordRotationPerSailLevel),R=r;let a=T[e],n=m.current.getVerticesAngles(w,200,a);for(let t=0;t<w;t++){let a=(e*w+t)*3,s=(e*w+t)*3,l=new p.Vector3(c.current.attributes.position.array[a],c.current.attributes.position.array[a+1],c.current.attributes.position.array[a+2]);if(50*e>o){l.y=o/1e3,l.x=0,l.z=0,i[a]=l.x,i[a+1]=l.y,i[a+2]=l.z,g[s]=.2,g[s+1]=.2,g[s+2]=.2;continue}if(g[s]=.35,g[s+1]=.38,g[s+2]=.42,0===t){i[a]=l.x,i[a+1]=l.y,i[a+2]=l.z;continue}l.applyAxisAngle(I,-(r+n[t])*B),i[a]=l.x,i[a+1]=l.y,i[a+2]=l.z}}n.attributes.position.needsUpdate=!0,s.needsUpdate=!0;let G={...t,mastrotation:S*B};h.current&&h.current.rotateY(d.current-G.mastrotation),d.current=G.mastrotation},[u,l,e.hellman,r.cunningham,r.angleOfAttack,t,T,a,o]),(0,n.jsxs)("mesh",{ref:h,position:[0,2,-1],rotation:[0,-Math.PI/2,0],children:[(0,n.jsx)("bufferGeometry",{...C}),(0,n.jsx)("group",{ref:g}),(0,n.jsx)("meshBasicMaterial",{vertexColors:!0,color:B,transparent:!0,opacity:.4,side:p.DoubleSide,depthWrite:!1})]})},S=new p.Vector3(0,.7,-6.2),I=new p.Vector3(0,10,-1.05),R=new p.Vector3(0,.9,-2),G=({jibCar:e=.5,camber:t=.8,twist:r=0})=>{let{scene:{sail:a}}=(0,M.default)(),o=(0,s.useSignalKPath)("environment.wind.angleApparent",0),l=(0,s.useSignalKPath)("environment.wind.speedApparent",0),u=(0,i.useRef)(),h=(0,i.useRef)(null),c=(0,i.useMemo)(()=>{let e=new p.BufferGeometry,t=[],r=[];for(let e=0;e<=30;e++){let a=e/30,n=S.x+(I.x-S.x)*a,i=S.y+(I.y-S.y)*a,o=S.z+(I.z-S.z)*a,s=R.x+(I.x-R.x)*a,l=R.y+(I.y-R.y)*a,u=R.z+(I.z-R.z)*a;for(let e=0;e<=8;e++){let a=e/8;t.push(n+(s-n)*a,i+(l-i)*a,o+(u-o)*a),r.push(.35,.38,.42)}}let a=[];for(let e=0;e<30;e++)for(let t=0;t<8;t++){let r=9*e+t,n=r+9;a.push(r,r+1,n),a.push(r+1,n+1,n)}return e.setAttribute("position",new p.Float32BufferAttribute(t,3)),e.setAttribute("color",new p.Float32BufferAttribute(r,3)),e.setIndex(a),e.computeVertexNormals(),e},[]);return(0,i.useEffect)(()=>{if(!u.current)return;let a=u.current.geometry,n=a.attributes.position,i=n.array;h.current||(h.current=new Float32Array(i));let s=h.current,l=o;for(;l<0;)l+=2*Math.PI;for(;l>=2*Math.PI;)l-=2*Math.PI;let c=l>Math.PI?-1:1,d=l;d>Math.PI&&(d=2*Math.PI-d);let f=Math.max(0,Math.min(Math.PI/2,.6*d-.3*e));for(let e=0;e<=30;e++){let a=e/30,n=S.x+(I.x-S.x)*a,o=S.z+(I.z-S.z)*a,l=(f+r*a)*c,u=.8*t*(1-.7*a);for(let t=0;t<=8;t++){let r=(9*e+t)*3,a=t/8,h=s[r],d=s[r+1],f=s[r+2],p=(h+=Math.sin(a*Math.PI)*u*c)-n,m=f-o,g=Math.cos(l),A=Math.sin(l);h=n+p*g-m*A,f=o+p*A+m*g,i[r]=h,i[r+1]=d,i[r+2]=f}}n.needsUpdate=!0,a.computeVertexNormals()},[o,l,e,t,r]),(0,n.jsxs)("mesh",{ref:u,children:[(0,n.jsx)("bufferGeometry",{...c}),(0,n.jsx)("meshBasicMaterial",{vertexColors:!0,color:a,transparent:!0,opacity:.4,side:p.DoubleSide,depthWrite:!1})]})},D=`
|
|
2
|
+
void main() {
|
|
3
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
4
|
+
}
|
|
5
|
+
`,U=`
|
|
6
|
+
uniform float tension;
|
|
7
|
+
uniform vec3 green;
|
|
8
|
+
uniform vec3 orange;
|
|
9
|
+
uniform vec3 red;
|
|
10
|
+
|
|
11
|
+
void main() {
|
|
12
|
+
|
|
13
|
+
vec3 color;
|
|
14
|
+
if (tension <= 0.5) {
|
|
15
|
+
color = mix(green, orange, tension * 2.0);
|
|
16
|
+
} else {
|
|
17
|
+
color = mix(orange, red, (tension - 0.5) * 2.0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
gl_FragColor = vec4(color, 0.85);
|
|
21
|
+
}
|
|
22
|
+
`,_={mainSheet:{label:"Mainsheet",points:[[0,2,1.2],[0,.9,2.5]]},jibSheet:{label:"Jib Sheet",points:[[0,.9,-2],[.8,.9,.5]]},vang:{label:"Vang",points:[[0,1.8,0],[0,.9,-.8]]},cunningham:{label:"Cunningham",points:[[0,2,-.8],[0,.9,-.8]]}},k=({points:e,tension:t})=>{let r=(0,i.useRef)(),{scene:a}=(0,M.default)(),o=(0,i.useMemo)(()=>new p.ShaderMaterial({uniforms:{tension:{value:.5},green:{value:new p.Color},orange:{value:new p.Color},red:{value:new p.Color}},vertexShader:D,fragmentShader:U,transparent:!0,depthWrite:!1}),[]),s=(0,i.useMemo)(()=>{let t=new p.BufferGeometry,r=new Float32Array(3*e.length);for(let t=0;t<e.length;t++)r[3*t]=e[t][0],r[3*t+1]=e[t][1],r[3*t+2]=e[t][2];return t.setAttribute("position",new p.BufferAttribute(r,3)),t},[e]);return(0,i.useEffect)(()=>{o&&(o.uniforms.tension.value=t)},[t,o]),(0,i.useEffect)(()=>{o.uniforms.green.value.set(a.wakeGood),o.uniforms.orange.value.set(a.wakeFair),o.uniforms.red.value.set(a.wakeBad)},[a,o]),(0,n.jsx)("line",{ref:r,geometry:s,material:o})},P=({tensions:e={}})=>(0,n.jsx)("group",{children:Object.entries(_).map(([t,r])=>(0,n.jsx)(k,{points:r.points,tension:e[t]||0},t))});var L=e.i(18638);let O={backstay:{points:[[0,10,-1.05],[0,.9,3.5]]},vang:{points:[[0,2,.6],[0,.9,-.3]]},cunningham:{points:[[0,3,-1],[0,2,-1]]},outhaul:{points:[[0,2,1.6],[0,2,2.6]]}},H=({points:e,tension:t})=>{let r=(0,i.useRef)(),a=(0,i.useMemo)(()=>{let t=new p.BufferGeometry,r=new Float32Array(3*e.length);for(let t=0;t<e.length;t++)r[3*t]=e[t][0],r[3*t+1]=e[t][1],r[3*t+2]=e[t][2];return t.setAttribute("position",new p.BufferAttribute(r,3)),t},[e]),o=(0,M.default)(),s=(0,i.useMemo)(()=>(0,L.tintForTheme)(o,function(e){let t=Math.max(0,Math.min(1,e));if(t<=.25)return new p.Color(t/.25,1,0);if(t<=.5)return new p.Color(1,1-(t-.25)/.25*.35,0);if(t<=.75)return new p.Color(1,.65-(t-.5)/.25*.65,0);let r=(t-.75)/.25;return new p.Color(1-.3*r,0,.8*r)}(t)),[t,o]);return(0,i.useEffect)(()=>{r.current&&r.current.color.copy(s)},[s]),(0,n.jsx)("line",{geometry:a,children:(0,n.jsx)("lineBasicMaterial",{ref:r,color:s,transparent:!0,opacity:.9,depthWrite:!1,linewidth:2})})},j=()=>{let e=(0,s.useSignalKPath)("environment.wind.angleApparent",0),t=(0,s.useSignalKPath)("environment.wind.speedApparent",0),r=(0,i.useMemo)(()=>(function(e,t){let r=e;for(;r<0;)r+=2*Math.PI;for(;r>=2*Math.PI;)r-=2*Math.PI;let a=r>Math.PI?2*Math.PI-r:r,n=Math.max(0,1-a/Math.PI),i=Math.min(1,Math.abs(t)/15);return{backstay:Math.min(1,n*i*.9+.05),vang:Math.min(1,Math.sin(a)*i*.85+.05),cunningham:Math.min(1,n*i*.8),outhaul:Math.min(1,n*i*.75+.05)}})(e,t),[e,t]);return(0,n.jsx)("group",{children:Object.entries(O).map(([e,t])=>(0,n.jsx)(H,{points:t.points,tension:r[e]||0},e))})};var J=e.i(77291);let N=i.forwardRef(function({children:e,follow:t=!0,lockX:r=!1,lockY:a=!1,lockZ:n=!1,...o},s){let l=i.useRef(null),h=i.useRef(null),c=new p.Quaternion;return(0,C.useFrame)(({camera:e})=>{if(!t||!h.current)return;let i=l.current.rotation.clone();h.current.updateMatrix(),h.current.updateWorldMatrix(!1,!1),h.current.getWorldQuaternion(c),e.getWorldQuaternion(l.current.quaternion).premultiply(c.invert()),r&&(l.current.rotation.x=i.x),a&&(l.current.rotation.y=i.y),n&&(l.current.rotation.z=i.z)}),i.useImperativeHandle(s,()=>h.current,[]),i.createElement("group",(0,u.default)({ref:h},o),i.createElement("group",{ref:l},e))});e.s(["Billboard",0,N],20840);var K=e.i(43216),W=p;function V(){var e=Object.create(null);function t(e,t){var r=void 0;self.troikaDefine=function(e){return r=e};var a=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+t+"\n)"],{type:"application/javascript"}));try{importScripts(a)}catch(e){console.error(e)}return URL.revokeObjectURL(a),delete self.troikaDefine,r}self.addEventListener("message",function(r){var a=r.data,n=a.messageId,i=a.action,o=a.data;try{"registerModule"===i&&function r(a,n){var i=a.id,o=a.name,s=a.dependencies;void 0===s&&(s=[]);var l=a.init;void 0===l&&(l=function(){});var u=a.getTransferables;if(void 0===u&&(u=null),!e[i])try{s=s.map(function(t){return t&&t.isWorkerModule&&(r(t,function(e){if(e instanceof Error)throw e}),t=e[t.id].value),t}),l=t("<"+o+">.init",l),u&&(u=t("<"+o+">.getTransferables",u));var h=null;"function"==typeof l?h=l.apply(void 0,s):console.error("worker module init function failed to rehydrate"),e[i]={id:i,value:h,getTransferables:u},n(h)}catch(e){e&&e.noLog||console.error(e),n(e)}}(o,function(e){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:{isCallable:"function"==typeof e}})}),"callModule"===i&&function(t,r){var a,n=t.id,i=t.args;e[n]&&"function"==typeof e[n].value||r(Error("Worker module "+n+": not found or its 'init' did not return a function"));try{var o=(a=e[n]).value.apply(a,i);o&&"function"==typeof o.then?o.then(s,function(e){return r(e instanceof Error?e:Error(""+e))}):s(o)}catch(e){r(e)}function s(t){try{var a=e[n].getTransferables&&e[n].getTransferables(t);a&&Array.isArray(a)&&a.length||(a=void 0),r(t,a)}catch(e){console.error(e),r(e)}}}(o,function(e,t){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:e},t||void 0)})}catch(e){postMessage({messageId:n,success:!1,error:e.stack})}})}var X=function(){var e=!1;if("u">typeof window&&void 0!==window.document)try{new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"}))).terminate(),e=!0}catch(e){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+e.message+"]")}return X=function(){return e},e},Q=0,z=0,Y=!1,Z=Object.create(null),q=Object.create(null),$=Object.create(null);function ee(e){if((!e||"function"!=typeof e.init)&&!Y)throw Error("requires `options.init` function");var t,r=e.dependencies,a=e.init,n=e.getTransferables,i=e.workerId,o=((t=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t._getInitResult().then(function(t){if("function"==typeof t)return t.apply(void 0,e);throw Error("Worker module function was called but `init` did not return a callable function")})})._getInitResult=function(){var r=e.dependencies,a=e.init,n=Promise.all(r=Array.isArray(r)?r.map(function(e){return e&&(e=e.onMainThread||e)._getInitResult&&(e=e._getInitResult()),e}):[]).then(function(e){return a.apply(null,e)});return t._getInitResult=function(){return n},n},t);null==i&&(i="#default");var s="workerModule"+ ++Q,l=e.name||s,u=null;function h(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(!X())return o.apply(void 0,e);if(!u){u=er(i,"registerModule",h.workerModuleData);var r=function(){u=null,q[i].delete(r)};(q[i]||(q[i]=new Set)).add(r)}return u.then(function(t){if(t.isCallable)return er(i,"callModule",{id:s,args:e});throw Error("Worker module function was called but `init` did not return a callable function")})}return r=r&&r.map(function(e){return"function"!=typeof e||e.workerModuleData||(Y=!0,e=ee({workerId:i,name:"<"+l+"> function dependency: "+e.name,init:"function(){return (\n"+et(e)+"\n)}"}),Y=!1),e&&e.workerModuleData&&(e=e.workerModuleData),e}),h.workerModuleData={isWorkerModule:!0,id:s,name:l,dependencies:r,init:et(a),getTransferables:n&&et(n)},h.onMainThread=o,h}function et(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function er(e,t,r){return new Promise(function(a,n){var i=++z;$[i]=function(e){e.success?a(e.result):n(Error("Error in worker "+t+" call: "+e.error))},(function(e){var t=Z[e];if(!t){var r=et(V);(t=Z[e]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+e.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,a=$[r];if(!a)throw Error("WorkerModule response with empty or unknown messageId");delete $[r],a(t)}}return t})(e).postMessage({messageId:i,action:t,data:r})})}function ea(){return function(e){function t(e,t){for(var r,a,n,i,o,s=/([MLQCZ])([^MLQCZ]*)/g;r=s.exec(e);){var l=r[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(e){return parseFloat(e)});switch(r[1]){case"M":i=a=l[0],o=n=l[1];break;case"L":(l[0]!==i||l[1]!==o)&&t("L",i,o,i=l[0],o=l[1]);break;case"Q":t("Q",i,o,i=l[2],o=l[3],l[0],l[1]);break;case"C":t("C",i,o,i=l[4],o=l[5],l[0],l[1],l[2],l[3]);break;case"Z":(i!==a||o!==n)&&t("L",i,o,a,n)}}}function r(e,r,a){void 0===a&&(a=16);var n={x:0,y:0};t(e,function(e,t,i,o,s,l,u,h,c){switch(e){case"L":r(t,i,o,s);break;case"Q":for(var d=t,f=i,p=1;p<a;p++)!function(e,t,r,a,n,i,o,s){var l=1-o;s.x=l*l*e+2*l*o*r+o*o*n,s.y=l*l*t+2*l*o*a+o*o*i}(t,i,l,u,o,s,p/(a-1),n),r(d,f,n.x,n.y),d=n.x,f=n.y;break;case"C":for(var m=t,g=i,A=1;A<a;A++)!function(e,t,r,a,n,i,o,s,l,u){var h=1-l;u.x=h*h*h*e+3*h*h*l*r+3*h*l*l*n+l*l*l*o,u.y=h*h*h*t+3*h*h*l*a+3*h*l*l*i+l*l*l*s}(t,i,l,u,h,c,o,s,A/(a-1),n),r(m,g,n.x,n.y),m=n.x,g=n.y}})}var a="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",n=new WeakMap,i={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function o(e,t){var r=e.getContext?e.getContext("webgl",i):e,a=n.get(r);if(!a){var o="u">typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext,s={},l={},u={},h=-1,c=[];function d(e){var t=s[e];if(!t&&!(t=s[e]=r.getExtension(e)))throw Error(e+" not supported");return t}function f(e,t){var a=r.createShader(t);return r.shaderSource(a,e),r.compileShader(a),a}function p(){s={},l={},u={},h=-1,c.length=0}r.canvas.addEventListener("webglcontextlost",function(e){p(),e.preventDefault()},!1),n.set(r,a={gl:r,isWebGL2:o,getExtension:d,withProgram:function(e,t,a,n){if(!l[e]){var i={},s={},u=r.createProgram();r.attachShader(u,f(t,r.VERTEX_SHADER)),r.attachShader(u,f(a,r.FRAGMENT_SHADER)),r.linkProgram(u),l[e]={program:u,transaction:function(e){r.useProgram(u),e({setUniform:function(e,t){for(var a=[],n=arguments.length-2;n-- >0;)a[n]=arguments[n+2];var i=s[t]||(s[t]=r.getUniformLocation(u,t));r["uniform"+e].apply(r,[i].concat(a))},setAttribute:function(e,t,a,n,s){var l=i[e];l||(l=i[e]={buf:r.createBuffer(),loc:r.getAttribLocation(u,e),data:null}),r.bindBuffer(r.ARRAY_BUFFER,l.buf),r.vertexAttribPointer(l.loc,t,r.FLOAT,!1,0,0),r.enableVertexAttribArray(l.loc),o?r.vertexAttribDivisor(l.loc,n):d("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(l.loc,n),s!==l.data&&(r.bufferData(r.ARRAY_BUFFER,s,a),l.data=s)}})}}}l[e].transaction(n)},withTexture:function(e,t){h++;try{r.activeTexture(r.TEXTURE0+h);var a=u[e];a||(a=u[e]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)),r.bindTexture(r.TEXTURE_2D,a),t(a,h)}finally{h--}},withTextureFramebuffer:function(e,t,a){var n=r.createFramebuffer();c.push(n),r.bindFramebuffer(r.FRAMEBUFFER,n),r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);try{a(n)}finally{r.deleteFramebuffer(n),r.bindFramebuffer(r.FRAMEBUFFER,c[--c.length-1]||null)}},handleContextLoss:p})}t(a)}function s(e,t,r,n,i,s,l,u){void 0===l&&(l=15),void 0===u&&(u=null),o(e,function(e){var o=e.gl,h=e.withProgram;(0,e.withTexture)("copy",function(e,c){o.texImage2D(o.TEXTURE_2D,0,o.RGBA,i,s,0,o.RGBA,o.UNSIGNED_BYTE,t),h("copy",a,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",function(e){var t=e.setUniform;(0,e.setAttribute)("aUV",2,o.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),t("1i","image",c),o.bindFramebuffer(o.FRAMEBUFFER,u||null),o.disable(o.BLEND),o.colorMask(8&l,4&l,2&l,1&l),o.viewport(r,n,i,s),o.scissor(r,n,i,s),o.drawArrays(o.TRIANGLES,0,3)})})})}var l=Object.freeze({__proto__:null,withWebGLContext:o,renderImageData:s,resizeWebGLCanvasWithoutClearing:function(e,t,r){var a=e.width,n=e.height;o(e,function(i){var o=i.gl,l=new Uint8Array(a*n*4);o.readPixels(0,0,a,n,o.RGBA,o.UNSIGNED_BYTE,l),e.width=t,e.height=r,s(o,l,0,0,a,n)})}});function u(e,t,a,n,i,o){void 0===o&&(o=1);var s=new Uint8Array(e*t),l=n[2]-n[0],u=n[3]-n[1],h=[];r(a,function(e,t,r,a){h.push({x1:e,y1:t,x2:r,y2:a,minX:Math.min(e,r),minY:Math.min(t,a),maxX:Math.max(e,r),maxY:Math.max(t,a)})}),h.sort(function(e,t){return e.maxX-t.maxX});for(var c=0;c<e;c++)for(var d=0;d<t;d++){var f=function(e,t){for(var r=1/0,a=1/0,n=h.length;n--;){var i=h[n];if(i.maxX+a<=e)break;if(e+a>i.minX&&t-a<i.maxY&&t+a>i.minY){var o=function(e,t,r,a,n,i){var o=n-r,s=i-a,l=o*o+s*s,u=l?Math.max(0,Math.min(1,((e-r)*o+(t-a)*s)/l)):0,h=e-(r+u*o),c=t-(a+u*s);return h*h+c*c}(e,t,i.x1,i.y1,i.x2,i.y2);o<r&&(a=Math.sqrt(r=o))}}return function(e,t){for(var r=0,a=h.length;a--;){var n=h[a];if(n.maxX<=e)break;n.y1>t!=n.y2>t&&e<(n.x2-n.x1)*(t-n.y1)/(n.y2-n.y1)+n.x1&&(r+=n.y1<n.y2?1:-1)}return 0!==r}(e,t)&&(a=-a),a}(n[0]+l*(c+.5)/e,n[1]+u*(d+.5)/t),p=Math.pow(1-Math.abs(f)/i,o)/2;f<0&&(p=1-p),p=Math.max(0,Math.min(255,Math.round(255*p))),s[d*e+c]=p}return s}function h(e,t,r,a,n,i,o,s,l,u){void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0),c(e,t,r,a,n,i,o,null,s,l,u)}function c(e,t,r,a,n,i,o,l,h,c,d){void 0===i&&(i=1),void 0===h&&(h=0),void 0===c&&(c=0),void 0===d&&(d=0);for(var f=u(e,t,r,a,n,i),p=new Uint8Array(4*f.length),m=0;m<f.length;m++)p[4*m+d]=f[m];s(o,p,h,c,e,t,1<<3-d,l)}var d=Object.freeze({__proto__:null,generate:u,generateIntoCanvas:h,generateIntoFramebuffer:c}),f=new Float32Array([0,0,2,0,0,2]),p=null,m=!1,g={},A=new WeakMap;function v(e){if(!m&&!b(e))throw Error("WebGL generation not supported")}function B(e,t,r,a,n,i,s){if(void 0===i&&(i=1),void 0===s&&(s=null),!s&&!(s=p)){var l="function"==typeof OffscreenCanvas?new OffscreenCanvas(1,1):"u">typeof document?document.createElement("canvas"):null;if(!l)throw Error("OffscreenCanvas or DOM canvas not supported");s=p=l.getContext("webgl",{depth:!1})}v(s);var u=new Uint8Array(e*t*4);o(s,function(o){var s=o.gl,l=o.withTexture,h=o.withTextureFramebuffer;l("readable",function(o,l){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),h(o,l,function(o){C(e,t,r,a,n,i,s,o,0,0,0),s.readPixels(0,0,e,t,s.RGBA,s.UNSIGNED_BYTE,u)})})});for(var h=new Uint8Array(e*t),c=0,d=0;c<u.length;c+=4)h[d++]=u[c];return h}function y(e,t,r,a,n,i,o,s,l,u){void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0),C(e,t,r,a,n,i,o,null,s,l,u)}function C(e,t,n,i,s,l,u,h,c,d,p){void 0===l&&(l=1),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),v(u);var m=[];r(n,function(e,t,r,a){m.push(e,t,r,a)}),m=new Float32Array(m),o(u,function(r){var n=r.gl,o=r.isWebGL2,u=r.getExtension,g=r.withProgram,A=r.withTexture,v=r.withTextureFramebuffer,B=r.handleContextLoss;if(A("rawDistances",function(r,A){(e!==r._lastWidth||t!==r._lastHeight)&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r._lastWidth=e,r._lastHeight=t,0,n.RGBA,n.UNSIGNED_BYTE,null),g("main","precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}","precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",function(a){var h=a.setAttribute,c=a.setUniform,d=!o&&u("ANGLE_instanced_arrays"),p=!o&&u("EXT_blend_minmax");h("aUV",2,n.STATIC_DRAW,0,f),h("aLineSegment",4,n.DYNAMIC_DRAW,1,m),c.apply(void 0,["4f","uGlyphBounds"].concat(i)),c("1f","uMaxDistance",s),c("1f","uExponent",l),v(r,A,function(r){n.enable(n.BLEND),n.colorMask(!0,!0,!0,!0),n.viewport(0,0,e,t),n.scissor(0,0,e,t),n.blendFunc(n.ONE,n.ONE),n.blendEquationSeparate(n.FUNC_ADD,o?n.MAX:p.MAX_EXT),n.clear(n.COLOR_BUFFER_BIT),o?n.drawArraysInstanced(n.TRIANGLES,0,3,m.length/4):d.drawArraysInstancedANGLE(n.TRIANGLES,0,3,m.length/4)})}),g("post",a,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",function(r){r.setAttribute("aUV",2,n.STATIC_DRAW,0,f),r.setUniform("1i","tex",A),n.bindFramebuffer(n.FRAMEBUFFER,h),n.disable(n.BLEND),n.colorMask(0===p,1===p,2===p,3===p),n.viewport(c,d,e,t),n.scissor(c,d,e,t),n.drawArrays(n.TRIANGLES,0,3)})}),n.isContextLost())throw B(),Error("webgl context lost")})}function b(e){var t=e&&e!==p?e.canvas||e:g,r=A.get(t);if(void 0===r){m=!0;var a=null;try{var n=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],i=B(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,e);(r=i&&n.length===i.length&&i.every(function(e,t){return e===n[t]}))||(a="bad trial run results",console.info(n,i))}catch(e){r=!1,a=e.message}a&&console.warn("WebGL SDF generation not supported:",a),m=!1,A.set(t,r)}return r}var M=Object.freeze({__proto__:null,generate:B,generateIntoCanvas:y,generateIntoFramebuffer:C,isSupported:b});return e.forEachPathCommand=t,e.generate=function(e,t,r,a,n,i){void 0===n&&(n=Math.max(a[2]-a[0],a[3]-a[1])/2),void 0===i&&(i=1);try{return B.apply(M,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),u.apply(d,arguments)}},e.generateIntoCanvas=function(e,t,r,a,n,i,o,s,l,u){void 0===n&&(n=Math.max(a[2]-a[0],a[3]-a[1])/2),void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0);try{return y.apply(M,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),h.apply(d,arguments)}},e.javascript=d,e.pathToLineSegments=r,e.webgl=M,e.webglUtils=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}var en=e.i(8560);let ei=/\bvoid\s+main\s*\(\s*\)\s*{/g;function eo(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){let r=en.ShaderChunk[t];return r?eo(r):e})}let es=[];for(let e=0;e<256;e++)es[e]=(e<16?"0":"")+e.toString(16);let el=Object.assign||function(){let e=arguments[0];for(let t=1,r=arguments.length;t<r;t++){let r=arguments[t];if(r)for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},eu=Date.now(),eh=new WeakMap,ec=new Map,ed=1e10;function ef(e,t,r,a,n){return(a||n||r)&&(e=e.replace(ei,`
|
|
23
|
+
${r}
|
|
24
|
+
void troikaOrigMain${t}() {`)+`
|
|
25
|
+
void main() {
|
|
26
|
+
${a}
|
|
27
|
+
troikaOrigMain${t}();
|
|
28
|
+
${n}
|
|
29
|
+
}`),e}function ep(e,t){return"uniforms"===e?void 0:"function"==typeof t?t.toString():t}let em=0,eg=new Map;p.DoubleSide,p.Mesh;let eA=ee({name:"Typr Font Parser",dependencies:[function(){var e,t,r;return"u"<typeof window&&(self.window=self),(e={},(t={parse:function(e){var r=t._bin,a=new Uint8Array(e);if("ttcf"==r.readASCII(a,0,4)){var n=4;r.readUshort(a,n),n+=2,r.readUshort(a,n),n+=2;var i=r.readUint(a,n);n+=4;for(var o=[],s=0;s<i;s++){var l=r.readUint(a,n);n+=4,o.push(t._readFont(a,l))}return o}return[t._readFont(a,0)]},_readFont:function(e,r){var a=t._bin,n=r;a.readFixed(e,r),r+=4;var i=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2;for(var o=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],s={_data:e,_offset:n},l={},u=0;u<i;u++){var h=a.readASCII(e,r,4);r+=4,a.readUint(e,r),r+=4;var c=a.readUint(e,r);r+=4;var d=a.readUint(e,r);r+=4,l[h]={offset:c,length:d}}for(u=0;u<o.length;u++){var f=o[u];l[f]&&(s[f.trim()]=t[f.trim()].parse(e,l[f].offset,l[f].length,s))}return s},_tabOffset:function(e,r,a){for(var n=t._bin,i=n.readUshort(e,a+4),o=a+12,s=0;s<i;s++){var l=n.readASCII(e,o,4);o+=4,n.readUint(e,o),o+=4;var u=n.readUint(e,o);if(o+=4,n.readUint(e,o),o+=4,l==r)return u}return 0}})._bin={readFixed:function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<8|e[t+3])/65540},readF2dot14:function(e,r){return t._bin.readShort(e,r)/16384},readInt:function(e,r){return t._bin._view(e).getInt32(r)},readInt8:function(e,r){return t._bin._view(e).getInt8(r)},readShort:function(e,r){return t._bin._view(e).getInt16(r)},readUshort:function(e,r){return t._bin._view(e).getUint16(r)},readUshorts:function(e,r,a){for(var n=[],i=0;i<a;i++)n.push(t._bin.readUshort(e,r+2*i));return n},readUint:function(e,r){return t._bin._view(e).getUint32(r)},readUint64:function(e,r){return 0x100000000*t._bin.readUint(e,r)+t._bin.readUint(e,r+4)},readASCII:function(e,t,r){for(var a="",n=0;n<r;n++)a+=String.fromCharCode(e[t+n]);return a},readUnicode:function(e,t,r){for(var a="",n=0;n<r;n++)a+=String.fromCharCode(e[t++]<<8|e[t++]);return a},_tdec:"u">typeof window&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,r,a){var n=t._bin._tdec;return n&&0==r&&a==e.length?n.decode(e):t._bin.readASCII(e,r,a)},readBytes:function(e,t,r){for(var a=[],n=0;n<r;n++)a.push(e[t+n]);return a},readASCIIArray:function(e,t,r){for(var a=[],n=0;n<r;n++)a.push(String.fromCharCode(e[t+n]));return a},_view:function(e){return e._dataView||(e._dataView=e.buffer?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(new Uint8Array(e).buffer))}},t._lctf={},t._lctf.parse=function(e,r,a,n,i){var o=t._bin,s={},l=r;o.readFixed(e,r),r+=4;var u=o.readUshort(e,r);r+=2;var h=o.readUshort(e,r);r+=2;var c=o.readUshort(e,r);return r+=2,s.scriptList=t._lctf.readScriptList(e,l+u),s.featureList=t._lctf.readFeatureList(e,l+h),s.lookupList=t._lctf.readLookupList(e,l+c,i),s},t._lctf.readLookupList=function(e,r,a){var n=t._bin,i=r,o=[],s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var u=n.readUshort(e,r);r+=2;var h=t._lctf.readLookupTable(e,i+u,a);o.push(h)}return o},t._lctf.readLookupTable=function(e,r,a){var n=t._bin,i=r,o={tabs:[]};o.ltype=n.readUshort(e,r),r+=2,o.flag=n.readUshort(e,r),r+=2;var s=n.readUshort(e,r);r+=2;for(var l=o.ltype,u=0;u<s;u++){var h=n.readUshort(e,r);r+=2;var c=a(e,l,i+h,o);o.tabs.push(c)}return o},t._lctf.numOfOnes=function(e){for(var t=0,r=0;r<32;r++)0!=(e>>>r&1)&&t++;return t},t._lctf.readClassDef=function(e,r){var a=t._bin,n=[],i=a.readUshort(e,r);if(r+=2,1==i){var o=a.readUshort(e,r);r+=2;var s=a.readUshort(e,r);r+=2;for(var l=0;l<s;l++)n.push(o+l),n.push(o+l),n.push(a.readUshort(e,r)),r+=2}if(2==i){var u=a.readUshort(e,r);for(r+=2,l=0;l<u;l++)n.push(a.readUshort(e,r)),r+=2,n.push(a.readUshort(e,r)),r+=2,n.push(a.readUshort(e,r)),r+=2}return n},t._lctf.getInterval=function(e,t){for(var r=0;r<e.length;r+=3){var a=e[r],n=e[r+1];if(e[r+2],a<=t&&t<=n)return r}return -1},t._lctf.readCoverage=function(e,r){var a=t._bin,n={};n.fmt=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);return r+=2,1==n.fmt&&(n.tab=a.readUshorts(e,r,i)),2==n.fmt&&(n.tab=a.readUshorts(e,r,3*i)),n},t._lctf.coverageIndex=function(e,r){var a=e.tab;if(1==e.fmt)return a.indexOf(r);if(2==e.fmt){var n=t._lctf.getInterval(a,r);if(-1!=n)return a[n+2]+(r-a[n])}return -1},t._lctf.readFeatureList=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readASCII(e,r,4);r+=4;var u=a.readUshort(e,r);r+=2;var h=t._lctf.readFeatureTable(e,n+u);h.tag=l.trim(),i.push(h)}return i},t._lctf.readFeatureTable=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2,o>0&&(i.featureParams=n+o);var s=a.readUshort(e,r);r+=2,i.tab=[];for(var l=0;l<s;l++)i.tab.push(a.readUshort(e,r+2*l));return i},t._lctf.readScriptList=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readASCII(e,r,4);r+=4;var u=a.readUshort(e,r);r+=2,i[l.trim()]=t._lctf.readScriptTable(e,n+u)}return i},t._lctf.readScriptTable=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2,o>0&&(i.default=t._lctf.readLangSysTable(e,n+o));var s=a.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var u=a.readASCII(e,r,4);r+=4;var h=a.readUshort(e,r);r+=2,i[u.trim()]=t._lctf.readLangSysTable(e,n+h)}return i},t._lctf.readLangSysTable=function(e,r){var a=t._bin,n={};a.readUshort(e,r),r+=2,n.reqFeature=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);return r+=2,n.features=a.readUshorts(e,r,i),n},t.CFF={},t.CFF.parse=function(e,r,a){var n=t._bin;(e=new Uint8Array(e.buffer,r,a))[r=0],e[++r],e[++r],e[++r],r++;var i=[];r=t.CFF.readIndex(e,r,i);for(var o=[],s=0;s<i.length-1;s++)o.push(n.readASCII(e,r+i[s],i[s+1]-i[s]));r+=i[i.length-1];var l=[];r=t.CFF.readIndex(e,r,l);var u=[];for(s=0;s<l.length-1;s++)u.push(t.CFF.readDict(e,r+l[s],r+l[s+1]));r+=l[l.length-1];var h=u[0],c=[];r=t.CFF.readIndex(e,r,c);var d=[];for(s=0;s<c.length-1;s++)d.push(n.readASCII(e,r+c[s],c[s+1]-c[s]));if(r+=c[c.length-1],t.CFF.readSubrs(e,r,h),h.CharStrings){r=h.CharStrings,c=[],r=t.CFF.readIndex(e,r,c);var f=[];for(s=0;s<c.length-1;s++)f.push(n.readBytes(e,r+c[s],c[s+1]-c[s]));h.CharStrings=f}if(h.ROS){r=h.FDArray;var p=[];for(r=t.CFF.readIndex(e,r,p),h.FDArray=[],s=0;s<p.length-1;s++){var m=t.CFF.readDict(e,r+p[s],r+p[s+1]);t.CFF._readFDict(e,m,d),h.FDArray.push(m)}r+=p[p.length-1],r=h.FDSelect,h.FDSelect=[];var g=e[r];if(r++,3!=g)throw g;var A=n.readUshort(e,r);for(r+=2,s=0;s<A+1;s++)h.FDSelect.push(n.readUshort(e,r),e[r+2]),r+=3}return h.Encoding&&(h.Encoding=t.CFF.readEncoding(e,h.Encoding,h.CharStrings.length)),h.charset&&(h.charset=t.CFF.readCharset(e,h.charset,h.CharStrings.length)),t.CFF._readFDict(e,h,d),h},t.CFF._readFDict=function(e,r,a){var n;for(var i in r.Private&&(n=r.Private[1],r.Private=t.CFF.readDict(e,n,n+r.Private[0]),r.Private.Subrs&&t.CFF.readSubrs(e,n+r.Private.Subrs,r.Private)),r)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(i)&&(r[i]=a[r[i]-426+35])},t.CFF.readSubrs=function(e,r,a){var n=t._bin,i=[];r=t.CFF.readIndex(e,r,i);var o=i.length;a.Bias=o<1240?107:o<33900?1131:32768,a.Subrs=[];for(var s=0;s<i.length-1;s++)a.Subrs.push(n.readBytes(e,r+i[s],i[s+1]-i[s]))},t.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],t.CFF.glyphByUnicode=function(e,t){for(var r=0;r<e.charset.length;r++)if(e.charset[r]==t)return r;return -1},t.CFF.glyphBySE=function(e,r){return r<0||r>255?-1:t.CFF.glyphByUnicode(e,t.CFF.tableSE[r])},t.CFF.readEncoding=function(e,r,a){t._bin;var n=[".notdef"],i=e[r];if(r++,0!=i)throw"error: unknown encoding format: "+i;var o=e[r];r++;for(var s=0;s<o;s++)n.push(e[r+s]);return n},t.CFF.readCharset=function(e,r,a){var n=t._bin,i=[".notdef"],o=e[r];if(r++,0==o)for(var s=0;s<a;s++){var l=n.readUshort(e,r);r+=2,i.push(l)}else{if(1!=o&&2!=o)throw"error: format: "+o;for(;i.length<a;){l=n.readUshort(e,r),r+=2;var u=0;for(1==o?(u=e[r],r++):(u=n.readUshort(e,r),r+=2),s=0;s<=u;s++)i.push(l),l++}}return i},t.CFF.readIndex=function(e,r,a){var n=t._bin,i=n.readUshort(e,r)+1,o=e[r+=2];if(r++,1==o)for(var s=0;s<i;s++)a.push(e[r+s]);else if(2==o)for(s=0;s<i;s++)a.push(n.readUshort(e,r+2*s));else if(3==o)for(s=0;s<i;s++)a.push(0xffffff&n.readUint(e,r+3*s-1));else if(1!=i)throw"unsupported offset size: "+o+", count: "+i;return(r+=i*o)-1},t.CFF.getCharString=function(e,r,a){var n=t._bin,i=e[r],o=e[r+1];e[r+2],e[r+3],e[r+4];var s=1,l=null,u=null;i<=20&&(l=i,s=1),12==i&&(l=100*i+o,s=2),21<=i&&i<=27&&(l=i,s=1),28==i&&(u=n.readShort(e,r+1),s=3),29<=i&&i<=31&&(l=i,s=1),32<=i&&i<=246&&(u=i-139,s=1),247<=i&&i<=250&&(u=256*(i-247)+o+108,s=2),251<=i&&i<=254&&(u=-(256*(i-251))-o-108,s=2),255==i&&(u=n.readInt(e,r+1)/65535,s=5),a.val=null!=u?u:"o"+l,a.size=s},t.CFF.readCharString=function(e,r,a){for(var n=r+a,i=t._bin,o=[];r<n;){var s=e[r],l=e[r+1];e[r+2],e[r+3],e[r+4];var u=1,h=null,c=null;s<=20&&(h=s,u=1),12==s&&(h=100*s+l,u=2),19!=s&&20!=s||(h=s,u=2),21<=s&&s<=27&&(h=s,u=1),28==s&&(c=i.readShort(e,r+1),u=3),29<=s&&s<=31&&(h=s,u=1),32<=s&&s<=246&&(c=s-139,u=1),247<=s&&s<=250&&(c=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(c=-(256*(s-251))-l-108,u=2),255==s&&(c=i.readInt(e,r+1)/65535,u=5),o.push(null!=c?c:"o"+h),r+=u}return o},t.CFF.readDict=function(e,r,a){for(var n=t._bin,i={},o=[];r<a;){var s=e[r],l=e[r+1];e[r+2],e[r+3],e[r+4];var u=1,h=null,c=null;if(28==s&&(c=n.readShort(e,r+1),u=3),29==s&&(c=n.readInt(e,r+1),u=5),32<=s&&s<=246&&(c=s-139,u=1),247<=s&&s<=250&&(c=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(c=-(256*(s-251))-l-108,u=2),255==s)throw c=n.readInt(e,r+1)/65535,u=5,"unknown number";if(30==s){var d=[];for(u=1;;){var f=e[r+u];u++;var p=f>>4,m=15&f;if(15!=p&&d.push(p),15!=m&&d.push(m),15==m)break}for(var g="",A=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],v=0;v<d.length;v++)g+=A[d[v]];c=parseFloat(g)}s<=21&&(h=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],u=1,12==s)&&(h=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][l],u=2),null!=h?(i[h]=1==o.length?o[0]:o,o=[]):o.push(c),r+=u}return i},t.cmap={},t.cmap.parse=function(e,r,a){e=new Uint8Array(e.buffer,r,a),r=0;var n=t._bin,i={};n.readUshort(e,r),r+=2;var o=n.readUshort(e,r);r+=2;var s=[];i.tables=[];for(var l=0;l<o;l++){var u=n.readUshort(e,r);r+=2;var h=n.readUshort(e,r);r+=2;var c=n.readUint(e,r);r+=4;var d="p"+u+"e"+h,f=s.indexOf(c);if(-1==f){f=i.tables.length,s.push(c);var p,m=n.readUshort(e,c);0==m?p=t.cmap.parse0(e,c):4==m?p=t.cmap.parse4(e,c):6==m?p=t.cmap.parse6(e,c):12==m?p=t.cmap.parse12(e,c):console.debug("unknown format: "+m,u,h,c),i.tables.push(p)}if(null!=i[d])throw"multiple tables for one platform+encoding";i[d]=f}return i},t.cmap.parse0=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2,n.map=[];for(var o=0;o<i-6;o++)n.map.push(e[r+o]);return n},t.cmap.parse4=function(e,r){var a=t._bin,n=r,i={};i.format=a.readUshort(e,r),r+=2;var o=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2;var s=a.readUshort(e,r);r+=2;var l=s/2;i.searchRange=a.readUshort(e,r),r+=2,i.entrySelector=a.readUshort(e,r),r+=2,i.rangeShift=a.readUshort(e,r),r+=2,i.endCount=a.readUshorts(e,r,l),r+=2*l,r+=2,i.startCount=a.readUshorts(e,r,l),r+=2*l,i.idDelta=[];for(var u=0;u<l;u++)i.idDelta.push(a.readShort(e,r)),r+=2;for(i.idRangeOffset=a.readUshorts(e,r,l),r+=2*l,i.glyphIdArray=[];r<n+o;)i.glyphIdArray.push(a.readUshort(e,r)),r+=2;return i},t.cmap.parse6=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,n.firstCode=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2,n.glyphIdArray=[];for(var o=0;o<i;o++)n.glyphIdArray.push(a.readUshort(e,r)),r+=2;return n},t.cmap.parse12=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2,r+=2,a.readUint(e,r),r+=4,a.readUint(e,r),r+=4;var i=a.readUint(e,r);r+=4,n.groups=[];for(var o=0;o<i;o++){var s=r+12*o,l=a.readUint(e,s+0),u=a.readUint(e,s+4),h=a.readUint(e,s+8);n.groups.push([l,u,h])}return n},t.glyf={},t.glyf.parse=function(e,t,r,a){for(var n=[],i=0;i<a.maxp.numGlyphs;i++)n.push(null);return n},t.glyf._parseGlyf=function(e,r){var a,n=t._bin,i=e._data,o=t._tabOffset(i,"glyf",e._offset)+e.loca[r];if(e.loca[r]==e.loca[r+1])return null;var s={};if(s.noc=n.readShort(i,o),o+=2,s.xMin=n.readShort(i,o),o+=2,s.yMin=n.readShort(i,o),o+=2,s.xMax=n.readShort(i,o),o+=2,s.yMax=n.readShort(i,o),o+=2,s.xMin>=s.xMax||s.yMin>=s.yMax)return null;if(s.noc>0){s.endPts=[];for(var l=0;l<s.noc;l++)s.endPts.push(n.readUshort(i,o)),o+=2;var u=n.readUshort(i,o);if(o+=2,i.length-o<u)return null;s.instructions=n.readBytes(i,o,u),o+=u;var h=s.endPts[s.noc-1]+1;for(s.flags=[],l=0;l<h;l++){var c=i[o];if(o++,s.flags.push(c),0!=(8&c)){var d=i[o];o++;for(var f=0;f<d;f++)s.flags.push(c),l++}}for(s.xs=[],l=0;l<h;l++){var p=0!=(2&s.flags[l]),m=0!=(16&s.flags[l]);p?(s.xs.push(m?i[o]:-i[o]),o++):m?s.xs.push(0):(s.xs.push(n.readShort(i,o)),o+=2)}for(s.ys=[],l=0;l<h;l++)p=0!=(4&s.flags[l]),m=0!=(32&s.flags[l]),p?(s.ys.push(m?i[o]:-i[o]),o++):m?s.ys.push(0):(s.ys.push(n.readShort(i,o)),o+=2);var g=0,A=0;for(l=0;l<h;l++)g+=s.xs[l],A+=s.ys[l],s.xs[l]=g,s.ys[l]=A}else{s.parts=[];do{a=n.readUshort(i,o),o+=2;var v={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(s.parts.push(v),v.glyphIndex=n.readUshort(i,o),o+=2,1&a){var B=n.readShort(i,o);o+=2;var y=n.readShort(i,o);o+=2}else B=n.readInt8(i,o),o++,y=n.readInt8(i,o),o++;2&a?(v.m.tx=B,v.m.ty=y):(v.p1=B,v.p2=y),8&a?(v.m.a=v.m.d=n.readF2dot14(i,o),o+=2):64&a?(v.m.a=n.readF2dot14(i,o),o+=2,v.m.d=n.readF2dot14(i,o),o+=2):128&a&&(v.m.a=n.readF2dot14(i,o),o+=2,v.m.b=n.readF2dot14(i,o),o+=2,v.m.c=n.readF2dot14(i,o),o+=2,v.m.d=n.readF2dot14(i,o),o+=2)}while(32&a)if(256&a){var C=n.readUshort(i,o);for(o+=2,s.instr=[],l=0;l<C;l++)s.instr.push(i[o]),o++}}return s},t.GDEF={},t.GDEF.parse=function(e,r,a,n){var i=r;r+=4;var o=t._bin.readUshort(e,r);return{glyphClassDef:0===o?null:t._lctf.readClassDef(e,i+o)}},t.GPOS={},t.GPOS.parse=function(e,r,a,n){return t._lctf.parse(e,r,a,n,t.GPOS.subt)},t.GPOS.subt=function(e,r,a,n){var i=t._bin,o=a,s={};if(s.fmt=i.readUshort(e,a),a+=2,1==r||2==r||3==r||7==r||8==r&&s.fmt<=2){var l=i.readUshort(e,a);a+=2,s.coverage=t._lctf.readCoverage(e,l+o)}if(1==r&&1==s.fmt){var u=i.readUshort(e,a);a+=2,0!=u&&(s.pos=t.GPOS.readValueRecord(e,a,u))}else if(2==r&&s.fmt>=1&&s.fmt<=2){u=i.readUshort(e,a),a+=2;var h=i.readUshort(e,a);a+=2;var c=t._lctf.numOfOnes(u),d=t._lctf.numOfOnes(h);if(1==s.fmt){s.pairsets=[];var f=i.readUshort(e,a);a+=2;for(var p=0;p<f;p++){var m=o+i.readUshort(e,a);a+=2;var g=i.readUshort(e,m);m+=2;for(var A=[],v=0;v<g;v++){var B=i.readUshort(e,m);m+=2,0!=u&&(w=t.GPOS.readValueRecord(e,m,u),m+=2*c),0!=h&&(E=t.GPOS.readValueRecord(e,m,h),m+=2*d),A.push({gid2:B,val1:w,val2:E})}s.pairsets.push(A)}}if(2==s.fmt){var y=i.readUshort(e,a);a+=2;var C=i.readUshort(e,a);a+=2;var b=i.readUshort(e,a);a+=2;var M=i.readUshort(e,a);for(a+=2,s.classDef1=t._lctf.readClassDef(e,o+y),s.classDef2=t._lctf.readClassDef(e,o+C),s.matrix=[],p=0;p<b;p++){var x=[];for(v=0;v<M;v++){var w=null,E=null;0!=u&&(w=t.GPOS.readValueRecord(e,a,u),a+=2*c),0!=h&&(E=t.GPOS.readValueRecord(e,a,h),a+=2*d),x.push({val1:w,val2:E})}s.matrix.push(x)}}}else if(4==r&&1==s.fmt)s.markCoverage=t._lctf.readCoverage(e,i.readUshort(e,a)+o),s.baseCoverage=t._lctf.readCoverage(e,i.readUshort(e,a+2)+o),s.markClassCount=i.readUshort(e,a+4),s.markArray=t.GPOS.readMarkArray(e,i.readUshort(e,a+6)+o),s.baseArray=t.GPOS.readBaseArray(e,i.readUshort(e,a+8)+o,s.markClassCount);else if(6==r&&1==s.fmt)s.mark1Coverage=t._lctf.readCoverage(e,i.readUshort(e,a)+o),s.mark2Coverage=t._lctf.readCoverage(e,i.readUshort(e,a+2)+o),s.markClassCount=i.readUshort(e,a+4),s.mark1Array=t.GPOS.readMarkArray(e,i.readUshort(e,a+6)+o),s.mark2Array=t.GPOS.readBaseArray(e,i.readUshort(e,a+8)+o,s.markClassCount);else{if(9==r&&1==s.fmt){var F=i.readUshort(e,a);a+=2;var T=i.readUint(e,a);if(a+=4,9==n.ltype)n.ltype=F;else if(n.ltype!=F)throw"invalid extension substitution";return t.GPOS.subt(e,n.ltype,o+T)}console.debug("unsupported GPOS table LookupType",r,"format",s.fmt)}return s},t.GPOS.readValueRecord=function(e,r,a){var n=t._bin,i=[];return i.push(1&a?n.readShort(e,r):0),r+=1&a?2:0,i.push(2&a?n.readShort(e,r):0),r+=2&a?2:0,i.push(4&a?n.readShort(e,r):0),r+=4&a?2:0,i.push(8&a?n.readShort(e,r):0),r+=8&a?2:0,i},t.GPOS.readBaseArray=function(e,r,a){var n=t._bin,i=[],o=r,s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++){for(var u=[],h=0;h<a;h++)u.push(t.GPOS.readAnchorRecord(e,o+n.readUshort(e,r))),r+=2;i.push(u)}return i},t.GPOS.readMarkArray=function(e,r){var a=t._bin,n=[],i=r,o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=t.GPOS.readAnchorRecord(e,a.readUshort(e,r+2)+i);l.markClass=a.readUshort(e,r),n.push(l),r+=4}return n},t.GPOS.readAnchorRecord=function(e,r){var a=t._bin,n={};return n.fmt=a.readUshort(e,r),n.x=a.readShort(e,r+2),n.y=a.readShort(e,r+4),n},t.GSUB={},t.GSUB.parse=function(e,r,a,n){return t._lctf.parse(e,r,a,n,t.GSUB.subt)},t.GSUB.subt=function(e,r,a,n){var i=t._bin,o=a,s={};if(s.fmt=i.readUshort(e,a),a+=2,1!=r&&2!=r&&4!=r&&5!=r&&6!=r)return null;if(1==r||2==r||4==r||5==r&&s.fmt<=2||6==r&&s.fmt<=2){var l=i.readUshort(e,a);a+=2,s.coverage=t._lctf.readCoverage(e,o+l)}if(1==r&&s.fmt>=1&&s.fmt<=2){if(1==s.fmt)s.delta=i.readShort(e,a),a+=2;else if(2==s.fmt){var u=i.readUshort(e,a);a+=2,s.newg=i.readUshorts(e,a,u),a+=2*s.newg.length}}else if(2==r&&1==s.fmt){u=i.readUshort(e,a),a+=2,s.seqs=[];for(var h=0;h<u;h++){var c=i.readUshort(e,a)+o;a+=2;var d=i.readUshort(e,c);s.seqs.push(i.readUshorts(e,c+2,d))}}else if(4==r)for(s.vals=[],u=i.readUshort(e,a),a+=2,h=0;h<u;h++){var f=i.readUshort(e,a);a+=2,s.vals.push(t.GSUB.readLigatureSet(e,o+f))}else if(5==r&&2==s.fmt){if(2==s.fmt){var p=i.readUshort(e,a);a+=2,s.cDef=t._lctf.readClassDef(e,o+p),s.scset=[];var m=i.readUshort(e,a);for(a+=2,h=0;h<m;h++){var g=i.readUshort(e,a);a+=2,s.scset.push(0==g?null:t.GSUB.readSubClassSet(e,o+g))}}}else if(6==r&&3==s.fmt){if(3==s.fmt){for(h=0;h<3;h++){u=i.readUshort(e,a),a+=2;for(var A=[],v=0;v<u;v++)A.push(t._lctf.readCoverage(e,o+i.readUshort(e,a+2*v)));a+=2*u,0==h&&(s.backCvg=A),1==h&&(s.inptCvg=A),2==h&&(s.ahedCvg=A)}u=i.readUshort(e,a),a+=2,s.lookupRec=t.GSUB.readSubstLookupRecords(e,a,u)}}else{if(7==r&&1==s.fmt){var B=i.readUshort(e,a);a+=2;var y=i.readUint(e,a);if(a+=4,9==n.ltype)n.ltype=B;else if(n.ltype!=B)throw"invalid extension substitution";return t.GSUB.subt(e,n.ltype,o+y)}console.debug("unsupported GSUB table LookupType",r,"format",s.fmt)}return s},t.GSUB.readSubClassSet=function(e,r){var a=t._bin.readUshort,n=r,i=[],o=a(e,r);r+=2;for(var s=0;s<o;s++){var l=a(e,r);r+=2,i.push(t.GSUB.readSubClassRule(e,n+l))}return i},t.GSUB.readSubClassRule=function(e,r){var a=t._bin.readUshort,n={},i=a(e,r),o=a(e,r+=2);r+=2,n.input=[];for(var s=0;s<i-1;s++)n.input.push(a(e,r)),r+=2;return n.substLookupRecords=t.GSUB.readSubstLookupRecords(e,r,o),n},t.GSUB.readSubstLookupRecords=function(e,r,a){for(var n=t._bin.readUshort,i=[],o=0;o<a;o++)i.push(n(e,r),n(e,r+2)),r+=4;return i},t.GSUB.readChainSubClassSet=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readUshort(e,r);r+=2,i.push(t.GSUB.readChainSubClassRule(e,n+l))}return i},t.GSUB.readChainSubClassRule=function(e,r){for(var a=t._bin,n={},i=["backtrack","input","lookahead"],o=0;o<i.length;o++){var s=a.readUshort(e,r);r+=2,1==o&&s--,n[i[o]]=a.readUshorts(e,r,s),r+=2*n[i[o]].length}return s=a.readUshort(e,r),r+=2,n.subst=a.readUshorts(e,r,2*s),r+=2*n.subst.length,n},t.GSUB.readLigatureSet=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readUshort(e,r);r+=2,i.push(t.GSUB.readLigature(e,n+l))}return i},t.GSUB.readLigature=function(e,r){var a=t._bin,n={chain:[]};n.nglyph=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2;for(var o=0;o<i-1;o++)n.chain.push(a.readUshort(e,r)),r+=2;return n},t.head={},t.head.parse=function(e,r,a){var n=t._bin,i={};return n.readFixed(e,r),r+=4,i.fontRevision=n.readFixed(e,r),r+=4,n.readUint(e,r),r+=4,n.readUint(e,r),r+=4,i.flags=n.readUshort(e,r),r+=2,i.unitsPerEm=n.readUshort(e,r),r+=2,i.created=n.readUint64(e,r),r+=8,i.modified=n.readUint64(e,r),r+=8,i.xMin=n.readShort(e,r),r+=2,i.yMin=n.readShort(e,r),r+=2,i.xMax=n.readShort(e,r),r+=2,i.yMax=n.readShort(e,r),r+=2,i.macStyle=n.readUshort(e,r),r+=2,i.lowestRecPPEM=n.readUshort(e,r),r+=2,i.fontDirectionHint=n.readShort(e,r),r+=2,i.indexToLocFormat=n.readShort(e,r),r+=2,i.glyphDataFormat=n.readShort(e,r),r+=2,i},t.hhea={},t.hhea.parse=function(e,r,a){var n=t._bin,i={};return n.readFixed(e,r),r+=4,i.ascender=n.readShort(e,r),r+=2,i.descender=n.readShort(e,r),r+=2,i.lineGap=n.readShort(e,r),r+=2,i.advanceWidthMax=n.readUshort(e,r),r+=2,i.minLeftSideBearing=n.readShort(e,r),r+=2,i.minRightSideBearing=n.readShort(e,r),r+=2,i.xMaxExtent=n.readShort(e,r),r+=2,i.caretSlopeRise=n.readShort(e,r),r+=2,i.caretSlopeRun=n.readShort(e,r),r+=2,i.caretOffset=n.readShort(e,r),r+=2,r+=8,i.metricDataFormat=n.readShort(e,r),r+=2,i.numberOfHMetrics=n.readUshort(e,r),r+=2,i},t.hmtx={},t.hmtx.parse=function(e,r,a,n){for(var i=t._bin,o={aWidth:[],lsBearing:[]},s=0,l=0,u=0;u<n.maxp.numGlyphs;u++)u<n.hhea.numberOfHMetrics&&(s=i.readUshort(e,r),r+=2,l=i.readShort(e,r),r+=2),o.aWidth.push(s),o.lsBearing.push(l);return o},t.kern={},t.kern.parse=function(e,r,a,n){var i=t._bin,o=i.readUshort(e,r);if(r+=2,1==o)return t.kern.parseV1(e,r-2,a,n);var s=i.readUshort(e,r);r+=2;for(var l={glyph1:[],rval:[]},u=0;u<s;u++){r+=2,a=i.readUshort(e,r),r+=2;var h=i.readUshort(e,r);r+=2;var c=h>>>8;if(0!=(c&=15))throw"unknown kern table format: "+c;r=t.kern.readFormat0(e,r,l)}return l},t.kern.parseV1=function(e,r,a,n){var i=t._bin;i.readFixed(e,r),r+=4;var o=i.readUint(e,r);r+=4;for(var s={glyph1:[],rval:[]},l=0;l<o;l++){i.readUint(e,r),r+=4;var u=i.readUshort(e,r);r+=2,i.readUshort(e,r),r+=2;var h=u>>>8;if(0!=(h&=15))throw"unknown kern table format: "+h;r=t.kern.readFormat0(e,r,s)}return s},t.kern.readFormat0=function(e,r,a){var n=t._bin,i=-1,o=n.readUshort(e,r);r+=2,n.readUshort(e,r),r+=2,n.readUshort(e,r),r+=2,n.readUshort(e,r),r+=2;for(var s=0;s<o;s++){var l=n.readUshort(e,r);r+=2;var u=n.readUshort(e,r);r+=2;var h=n.readShort(e,r);r+=2,l!=i&&(a.glyph1.push(l),a.rval.push({glyph2:[],vals:[]}));var c=a.rval[a.rval.length-1];c.glyph2.push(u),c.vals.push(h),i=l}return r},t.loca={},t.loca.parse=function(e,r,a,n){var i=t._bin,o=[],s=n.head.indexToLocFormat,l=n.maxp.numGlyphs+1;if(0==s)for(var u=0;u<l;u++)o.push(i.readUshort(e,r+(u<<1))<<1);if(1==s)for(u=0;u<l;u++)o.push(i.readUint(e,r+(u<<2)));return o},t.maxp={},t.maxp.parse=function(e,r,a){var n=t._bin,i={},o=n.readUint(e,r);return r+=4,i.numGlyphs=n.readUshort(e,r),r+=2,65536==o&&(i.maxPoints=n.readUshort(e,r),r+=2,i.maxContours=n.readUshort(e,r),r+=2,i.maxCompositePoints=n.readUshort(e,r),r+=2,i.maxCompositeContours=n.readUshort(e,r),r+=2,i.maxZones=n.readUshort(e,r),r+=2,i.maxTwilightPoints=n.readUshort(e,r),r+=2,i.maxStorage=n.readUshort(e,r),r+=2,i.maxFunctionDefs=n.readUshort(e,r),r+=2,i.maxInstructionDefs=n.readUshort(e,r),r+=2,i.maxStackElements=n.readUshort(e,r),r+=2,i.maxSizeOfInstructions=n.readUshort(e,r),r+=2,i.maxComponentElements=n.readUshort(e,r),r+=2,i.maxComponentDepth=n.readUshort(e,r),r+=2),i},t.name={},t.name.parse=function(e,r,a){var n=t._bin,i={};n.readUshort(e,r),r+=2;var o=n.readUshort(e,r);r+=2,n.readUshort(e,r);for(var s,l=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],u=r+=2,h=0;h<o;h++){var c=n.readUshort(e,r);r+=2;var d=n.readUshort(e,r);r+=2;var f=n.readUshort(e,r);r+=2;var p=n.readUshort(e,r);r+=2;var m=n.readUshort(e,r);r+=2;var g=n.readUshort(e,r);r+=2;var A,v=l[p],B=u+12*o+g;if(0==c)A=n.readUnicode(e,B,m/2);else if(3==c&&0==d)A=n.readUnicode(e,B,m/2);else if(0==d)A=n.readASCII(e,B,m);else if(1==d)A=n.readUnicode(e,B,m/2);else if(3==d)A=n.readUnicode(e,B,m/2);else{if(1!=c)throw"unknown encoding "+d+", platformID: "+c;A=n.readASCII(e,B,m),console.debug("reading unknown MAC encoding "+d+" as ASCII")}var y="p"+c+","+f.toString(16);null==i[y]&&(i[y]={}),i[y][void 0!==v?v:p]=A,i[y]._lang=f}for(var C in i)if(null!=i[C].postScriptName&&1033==i[C]._lang)return i[C];for(var C in i)if(null!=i[C].postScriptName&&0==i[C]._lang)return i[C];for(var C in i)if(null!=i[C].postScriptName&&3084==i[C]._lang)return i[C];for(var C in i)if(null!=i[C].postScriptName)return i[C];for(var C in i){s=C;break}return console.debug("returning name table with languageID "+i[s]._lang),i[s]},t["OS/2"]={},t["OS/2"].parse=function(e,r,a){var n=t._bin.readUshort(e,r);r+=2;var i={};if(0==n)t["OS/2"].version0(e,r,i);else if(1==n)t["OS/2"].version1(e,r,i);else if(2==n||3==n||4==n)t["OS/2"].version2(e,r,i);else{if(5!=n)throw"unknown OS/2 table version: "+n;t["OS/2"].version5(e,r,i)}return i},t["OS/2"].version0=function(e,r,a){var n=t._bin;return a.xAvgCharWidth=n.readShort(e,r),r+=2,a.usWeightClass=n.readUshort(e,r),r+=2,a.usWidthClass=n.readUshort(e,r),r+=2,a.fsType=n.readUshort(e,r),r+=2,a.ySubscriptXSize=n.readShort(e,r),r+=2,a.ySubscriptYSize=n.readShort(e,r),r+=2,a.ySubscriptXOffset=n.readShort(e,r),r+=2,a.ySubscriptYOffset=n.readShort(e,r),r+=2,a.ySuperscriptXSize=n.readShort(e,r),r+=2,a.ySuperscriptYSize=n.readShort(e,r),r+=2,a.ySuperscriptXOffset=n.readShort(e,r),r+=2,a.ySuperscriptYOffset=n.readShort(e,r),r+=2,a.yStrikeoutSize=n.readShort(e,r),r+=2,a.yStrikeoutPosition=n.readShort(e,r),r+=2,a.sFamilyClass=n.readShort(e,r),r+=2,a.panose=n.readBytes(e,r,10),r+=10,a.ulUnicodeRange1=n.readUint(e,r),r+=4,a.ulUnicodeRange2=n.readUint(e,r),r+=4,a.ulUnicodeRange3=n.readUint(e,r),r+=4,a.ulUnicodeRange4=n.readUint(e,r),r+=4,a.achVendID=[n.readInt8(e,r),n.readInt8(e,r+1),n.readInt8(e,r+2),n.readInt8(e,r+3)],r+=4,a.fsSelection=n.readUshort(e,r),r+=2,a.usFirstCharIndex=n.readUshort(e,r),r+=2,a.usLastCharIndex=n.readUshort(e,r),r+=2,a.sTypoAscender=n.readShort(e,r),r+=2,a.sTypoDescender=n.readShort(e,r),r+=2,a.sTypoLineGap=n.readShort(e,r),r+=2,a.usWinAscent=n.readUshort(e,r),r+=2,a.usWinDescent=n.readUshort(e,r),r+=2},t["OS/2"].version1=function(e,r,a){var n=t._bin;return r=t["OS/2"].version0(e,r,a),a.ulCodePageRange1=n.readUint(e,r),r+=4,a.ulCodePageRange2=n.readUint(e,r),r+=4},t["OS/2"].version2=function(e,r,a){var n=t._bin;return r=t["OS/2"].version1(e,r,a),a.sxHeight=n.readShort(e,r),r+=2,a.sCapHeight=n.readShort(e,r),r+=2,a.usDefault=n.readUshort(e,r),r+=2,a.usBreak=n.readUshort(e,r),r+=2,a.usMaxContext=n.readUshort(e,r),r+=2},t["OS/2"].version5=function(e,r,a){var n=t._bin;return r=t["OS/2"].version2(e,r,a),a.usLowerOpticalPointSize=n.readUshort(e,r),r+=2,a.usUpperOpticalPointSize=n.readUshort(e,r),r+=2},t.post={},t.post.parse=function(e,r,a){var n=t._bin,i={};return i.version=n.readFixed(e,r),r+=4,i.italicAngle=n.readFixed(e,r),r+=4,i.underlinePosition=n.readShort(e,r),r+=2,i.underlineThickness=n.readShort(e,r),r+=2,i},null==t&&(t={}),null==t.U&&(t.U={}),t.U.codeToGlyph=function(e,t){var r=e.cmap,a=-1;if(null!=r.p0e4?a=r.p0e4:null!=r.p3e1?a=r.p3e1:null!=r.p1e0?a=r.p1e0:null!=r.p0e3&&(a=r.p0e3),-1==a)throw"no familiar platform and encoding!";var n=r.tables[a];if(0==n.format)return t>=n.map.length?0:n.map[t];if(4==n.format){for(var i=-1,o=0;o<n.endCount.length;o++)if(t<=n.endCount[o]){i=o;break}return -1==i||n.startCount[i]>t?0:65535&(0!=n.idRangeOffset[i]?n.glyphIdArray[t-n.startCount[i]+(n.idRangeOffset[i]>>1)-(n.idRangeOffset.length-i)]:t+n.idDelta[i])}if(12==n.format){if(t>n.groups[n.groups.length-1][1])return 0;for(o=0;o<n.groups.length;o++){var s=n.groups[o];if(s[0]<=t&&t<=s[1])return s[2]+(t-s[0])}return 0}throw"unknown cmap table format "+n.format},t.U.glyphToPath=function(e,r){var a={cmds:[],crds:[]};if(e.SVG&&e.SVG.entries[r]){var n=e.SVG.entries[r];return null==n?a:("string"==typeof n&&(n=t.SVG.toPath(n),e.SVG.entries[r]=n),n)}if(e.CFF){var i={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:e.CFF.Private?e.CFF.Private.defaultWidthX:0,open:!1},o=e.CFF,s=e.CFF.Private;if(o.ROS){for(var l=0;o.FDSelect[l+2]<=r;)l+=2;s=o.FDArray[o.FDSelect[l+1]].Private}t.U._drawCFF(e.CFF.CharStrings[r],i,o,s,a)}else e.glyf&&t.U._drawGlyf(r,e,a);return a},t.U._drawGlyf=function(e,r,a){var n=r.glyf[e];null==n&&(n=r.glyf[e]=t.glyf._parseGlyf(r,e)),null!=n&&(n.noc>-1?t.U._simpleGlyph(n,a):t.U._compoGlyph(n,r,a))},t.U._simpleGlyph=function(e,r){for(var a=0;a<e.noc;a++){for(var n=0==a?0:e.endPts[a-1]+1,i=e.endPts[a],o=n;o<=i;o++){var s=o==n?i:o-1,l=o==i?n:o+1,u=1&e.flags[o],h=1&e.flags[s],c=1&e.flags[l],d=e.xs[o],f=e.ys[o];if(o==n)if(u){if(!h){t.U.P.moveTo(r,d,f);continue}t.U.P.moveTo(r,e.xs[s],e.ys[s])}else h?t.U.P.moveTo(r,e.xs[s],e.ys[s]):t.U.P.moveTo(r,(e.xs[s]+d)/2,(e.ys[s]+f)/2);u?h&&t.U.P.lineTo(r,d,f):c?t.U.P.qcurveTo(r,d,f,e.xs[l],e.ys[l]):t.U.P.qcurveTo(r,d,f,(d+e.xs[l])/2,(f+e.ys[l])/2)}t.U.P.closePath(r)}},t.U._compoGlyph=function(e,r,a){for(var n=0;n<e.parts.length;n++){var i={cmds:[],crds:[]},o=e.parts[n];t.U._drawGlyf(o.glyphIndex,r,i);for(var s=o.m,l=0;l<i.crds.length;l+=2){var u=i.crds[l],h=i.crds[l+1];a.crds.push(u*s.a+h*s.b+s.tx),a.crds.push(u*s.c+h*s.d+s.ty)}for(l=0;l<i.cmds.length;l++)a.cmds.push(i.cmds[l])}},t.U._getGlyphClass=function(e,r){var a=t._lctf.getInterval(r,e);return -1==a?0:r[a+2]},t.U._applySubs=function(e,r,a,n){for(var i=e.length-r-1,o=0;o<a.tabs.length;o++)if(null!=a.tabs[o]){var s,l=a.tabs[o];if(!l.coverage||-1!=(s=t._lctf.coverageIndex(l.coverage,e[r]))){if(1==a.ltype)e[r],1==l.fmt?e[r]=e[r]+l.delta:e[r]=l.newg[s];else if(4==a.ltype)for(var u=l.vals[s],h=0;h<u.length;h++){var c=u[h],d=c.chain.length;if(!(d>i)){for(var f=!0,p=0,m=0;m<d;m++){for(;-1==e[r+p+(1+m)];)p++;c.chain[m]!=e[r+p+(1+m)]&&(f=!1)}if(f){for(e[r]=c.nglyph,m=0;m<d+p;m++)e[r+m+1]=-1;break}}}else if(5==a.ltype&&2==l.fmt)for(var g=t._lctf.getInterval(l.cDef,e[r]),A=l.cDef[g+2],v=l.scset[A],B=0;B<v.length;B++){var y=v[B],C=y.input;if(!(C.length>i)){for(f=!0,m=0;m<C.length;m++){var b=t._lctf.getInterval(l.cDef,e[r+1+m]);if(-1==g&&l.cDef[b+2]!=C[m]){f=!1;break}}if(f){var M=y.substLookupRecords;for(h=0;h<M.length;h+=2)M[h],M[h+1]}}}else if(6==a.ltype&&3==l.fmt){if(!t.U._glsCovered(e,l.backCvg,r-l.backCvg.length)||!t.U._glsCovered(e,l.inptCvg,r)||!t.U._glsCovered(e,l.ahedCvg,r+l.inptCvg.length))continue;var x=l.lookupRec;for(B=0;B<x.length;B+=2){g=x[B];var w=n[x[B+1]];t.U._applySubs(e,r+g,w,n)}}}}},t.U._glsCovered=function(e,r,a){for(var n=0;n<r.length;n++)if(-1==t._lctf.coverageIndex(r[n],e[a+n]))return!1;return!0},t.U.glyphsToPath=function(e,r,a){for(var n={cmds:[],crds:[]},i=0,o=0;o<r.length;o++){var s=r[o];if(-1!=s){for(var l=o<r.length-1&&-1!=r[o+1]?r[o+1]:0,u=t.U.glyphToPath(e,s),h=0;h<u.crds.length;h+=2)n.crds.push(u.crds[h]+i),n.crds.push(u.crds[h+1]);for(a&&n.cmds.push(a),h=0;h<u.cmds.length;h++)n.cmds.push(u.cmds[h]);a&&n.cmds.push("X"),i+=e.hmtx.aWidth[s],o<r.length-1&&(i+=t.U.getPairAdjustment(e,s,l))}}return n},t.U.P={},t.U.P.moveTo=function(e,t,r){e.cmds.push("M"),e.crds.push(t,r)},t.U.P.lineTo=function(e,t,r){e.cmds.push("L"),e.crds.push(t,r)},t.U.P.curveTo=function(e,t,r,a,n,i,o){e.cmds.push("C"),e.crds.push(t,r,a,n,i,o)},t.U.P.qcurveTo=function(e,t,r,a,n){e.cmds.push("Q"),e.crds.push(t,r,a,n)},t.U.P.closePath=function(e){e.cmds.push("Z")},t.U._drawCFF=function(e,r,a,n,i){for(var o=r.stack,s=r.nStems,l=r.haveWidth,u=r.width,h=r.open,c=0,d=r.x,f=r.y,p=0,m=0,g=0,A=0,v=0,B=0,y=0,C=0,b=0,M=0,x={val:0,size:0};c<e.length;){t.CFF.getCharString(e,c,x);var w=x.val;if(c+=x.size,"o1"==w||"o18"==w)o.length%2==0||l||(u=o.shift()+n.nominalWidthX),s+=o.length>>1,o.length=0,l=!0;else if("o3"==w||"o23"==w)o.length%2==0||l||(u=o.shift()+n.nominalWidthX),s+=o.length>>1,o.length=0,l=!0;else if("o4"==w)o.length>1&&!l&&(u=o.shift()+n.nominalWidthX,l=!0),h&&t.U.P.closePath(i),f+=o.pop(),t.U.P.moveTo(i,d,f),h=!0;else if("o5"==w)for(;o.length>0;)d+=o.shift(),f+=o.shift(),t.U.P.lineTo(i,d,f);else if("o6"==w||"o7"==w)for(var E=o.length,F="o6"==w,T=0;T<E;T++){var S=o.shift();F?d+=S:f+=S,F=!F,t.U.P.lineTo(i,d,f)}else if("o8"==w||"o24"==w){E=o.length;for(var I=0;I+6<=E;)p=d+o.shift(),m=f+o.shift(),g=p+o.shift(),A=m+o.shift(),d=g+o.shift(),f=A+o.shift(),t.U.P.curveTo(i,p,m,g,A,d,f),I+=6;"o24"==w&&(d+=o.shift(),f+=o.shift(),t.U.P.lineTo(i,d,f))}else{if("o11"==w)break;if("o1234"==w||"o1235"==w||"o1236"==w||"o1237"==w)"o1234"==w&&(m=f,g=(p=d+o.shift())+o.shift(),M=A=m+o.shift(),B=A,C=f,d=(y=(v=(b=g+o.shift())+o.shift())+o.shift())+o.shift(),t.U.P.curveTo(i,p,m,g,A,b,M),t.U.P.curveTo(i,v,B,y,C,d,f)),"o1235"==w&&(p=d+o.shift(),m=f+o.shift(),g=p+o.shift(),A=m+o.shift(),b=g+o.shift(),M=A+o.shift(),v=b+o.shift(),B=M+o.shift(),y=v+o.shift(),C=B+o.shift(),d=y+o.shift(),f=C+o.shift(),o.shift(),t.U.P.curveTo(i,p,m,g,A,b,M),t.U.P.curveTo(i,v,B,y,C,d,f)),"o1236"==w&&(p=d+o.shift(),m=f+o.shift(),g=p+o.shift(),M=A=m+o.shift(),B=A,y=(v=(b=g+o.shift())+o.shift())+o.shift(),C=B+o.shift(),d=y+o.shift(),t.U.P.curveTo(i,p,m,g,A,b,M),t.U.P.curveTo(i,v,B,y,C,d,f)),"o1237"==w&&(p=d+o.shift(),m=f+o.shift(),g=p+o.shift(),A=m+o.shift(),b=g+o.shift(),M=A+o.shift(),v=b+o.shift(),B=M+o.shift(),Math.abs((y=v+o.shift())-d)>Math.abs((C=B+o.shift())-f)?d=y+o.shift():f=C+o.shift(),t.U.P.curveTo(i,p,m,g,A,b,M),t.U.P.curveTo(i,v,B,y,C,d,f));else if("o14"==w){if(o.length>0&&!l&&(u=o.shift()+a.nominalWidthX,l=!0),4==o.length){var R=o.shift(),G=o.shift(),D=o.shift(),U=o.shift(),_=t.CFF.glyphBySE(a,D),k=t.CFF.glyphBySE(a,U);t.U._drawCFF(a.CharStrings[_],r,a,n,i),r.x=R,r.y=G,t.U._drawCFF(a.CharStrings[k],r,a,n,i)}h&&(t.U.P.closePath(i),h=!1)}else if("o19"==w||"o20"==w)o.length%2==0||l||(u=o.shift()+n.nominalWidthX),s+=o.length>>1,o.length=0,l=!0,c+=s+7>>3;else if("o21"==w)o.length>2&&!l&&(u=o.shift()+n.nominalWidthX,l=!0),f+=o.pop(),d+=o.pop(),h&&t.U.P.closePath(i),t.U.P.moveTo(i,d,f),h=!0;else if("o22"==w)o.length>1&&!l&&(u=o.shift()+n.nominalWidthX,l=!0),d+=o.pop(),h&&t.U.P.closePath(i),t.U.P.moveTo(i,d,f),h=!0;else if("o25"==w){for(;o.length>6;)d+=o.shift(),f+=o.shift(),t.U.P.lineTo(i,d,f);p=d+o.shift(),m=f+o.shift(),g=p+o.shift(),A=m+o.shift(),d=g+o.shift(),f=A+o.shift(),t.U.P.curveTo(i,p,m,g,A,d,f)}else if("o26"==w)for(o.length%2&&(d+=o.shift());o.length>0;)p=d,m=f+o.shift(),d=g=p+o.shift(),f=(A=m+o.shift())+o.shift(),t.U.P.curveTo(i,p,m,g,A,d,f);else if("o27"==w)for(o.length%2&&(f+=o.shift());o.length>0;)m=f,g=(p=d+o.shift())+o.shift(),A=m+o.shift(),d=g+o.shift(),f=A,t.U.P.curveTo(i,p,m,g,A,d,f);else if("o10"==w||"o29"==w){var P="o10"==w?n:a;if(0==o.length)console.debug("error: empty stack");else{var L=o.pop(),O=P.Subrs[L+P.Bias];r.x=d,r.y=f,r.nStems=s,r.haveWidth=l,r.width=u,r.open=h,t.U._drawCFF(O,r,a,n,i),d=r.x,f=r.y,s=r.nStems,l=r.haveWidth,u=r.width,h=r.open}}else if("o30"==w||"o31"==w){var H=o.length,j=(I=0,"o31"==w);for(I+=H-(E=-3&H);I<E;)j?(m=f,g=(p=d+o.shift())+o.shift(),f=(A=m+o.shift())+o.shift(),E-I==5?(d=g+o.shift(),I++):d=g,j=!1):(p=d,m=f+o.shift(),g=p+o.shift(),A=m+o.shift(),d=g+o.shift(),E-I==5?(f=A+o.shift(),I++):f=A,j=!0),t.U.P.curveTo(i,p,m,g,A,d,f),I+=4}else{if("o"==(w+"").charAt(0))throw console.debug("Unknown operation: "+w,e),w;o.push(w)}}}r.x=d,r.y=f,r.nStems=s,r.haveWidth=l,r.width=u,r.open=h},e.Typr=r=t,e.default={Typr:r},Object.defineProperty(e,"__esModule",{value:!0}),e).Typr},function(){return function(e){var t=Uint8Array,r=Uint16Array,a=Uint32Array,n=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(e,t){for(var n=new r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new a(n[30]);for(i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)o[s]=s-n[i]<<5|i;return[n,o]},l=s(n,2),u=l[0],h=l[1];u[28]=258,h[258]=28;for(var c=s(i,0)[0],d=new r(32768),f=0;f<32768;++f){var p=(43690&f)>>>1|(21845&f)<<1;p=(61680&(p=(52428&p)>>>2|(13107&p)<<2))>>>4|(3855&p)<<4,d[f]=((65280&p)>>>8|(255&p)<<8)>>>1}var m=function(e,t,a){for(var n=e.length,i=0,o=new r(t);i<n;++i)++o[e[i]-1];var s,l=new r(t);for(i=0;i<t;++i)l[i]=l[i-1]+o[i-1]<<1;if(a){s=new r(1<<t);var u=15-t;for(i=0;i<n;++i)if(e[i])for(var h=i<<4|e[i],c=t-e[i],f=l[e[i]-1]++<<c,p=f|(1<<c)-1;f<=p;++f)s[d[f]>>>u]=h}else for(s=new r(n),i=0;i<n;++i)e[i]&&(s[i]=d[l[e[i]-1]++]>>>15-e[i]);return s},g=new t(288);for(f=0;f<144;++f)g[f]=8;for(f=144;f<256;++f)g[f]=9;for(f=256;f<280;++f)g[f]=7;for(f=280;f<288;++f)g[f]=8;var A=new t(32);for(f=0;f<32;++f)A[f]=5;var v=m(g,9,1),B=m(A,5,1),y=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},C=function(e,t,r){var a=t/8|0;return(e[a]|e[a+1]<<8)>>(7&t)&r},b=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],x=function(e,t,r){var a=Error(t||M[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,x),!r)throw a;return a},w=function(e,s,l){var h,d,f,p,g=e.length;if(!g||l&&!l.l&&g<5)return s||new t(0);var A=!s||l,M=!l||l.i;l||(l={}),s||(s=new t(3*g));var w,E=function(e){var r=s.length;if(e>r){var a=new t(Math.max(2*r,e));a.set(s),s=a}},F=l.f||0,T=l.p||0,S=l.b||0,I=l.l,R=l.d,G=l.m,D=l.n,U=8*g;do{if(!I){l.f=F=C(e,T,1);var _=C(e,T+1,3);if(T+=3,!_){var k=e[(X=((w=T)/8|0)+(7&w&&1)+4)-4]|e[X-3]<<8,P=X+k;if(P>g){M&&x(0);break}A&&E(S+k),s.set(e.subarray(X,P),S),l.b=S+=k,l.p=T=8*P;continue}if(1==_)I=v,R=B,G=9,D=5;else if(2==_){var L=C(e,T,31)+257,O=C(e,T+10,15)+4,H=L+C(e,T+5,31)+1;T+=14;for(var j=new t(H),J=new t(19),N=0;N<O;++N)J[o[N]]=C(e,T+3*N,7);T+=3*O;var K=y(J),W=(1<<K)-1,V=m(J,K,1);for(N=0;N<H;){var X,Q=V[C(e,T,W)];if(T+=15&Q,(X=Q>>>4)<16)j[N++]=X;else{var z=0,Y=0;for(16==X?(Y=3+C(e,T,3),T+=2,z=j[N-1]):17==X?(Y=3+C(e,T,7),T+=3):18==X&&(Y=11+C(e,T,127),T+=7);Y--;)j[N++]=z}}var Z=j.subarray(0,L),q=j.subarray(L);G=y(Z),D=y(q),I=m(Z,G,1),R=m(q,D,1)}else x(1);if(T>U){M&&x(0);break}}A&&E(S+131072);for(var $=(1<<G)-1,ee=(1<<D)-1,et=T;;et=T){var er=(z=I[b(e,T)&$])>>>4;if((T+=15&z)>U){M&&x(0);break}if(z||x(2),er<256)s[S++]=er;else{if(256==er){et=T,I=null;break}var ea=er-254;if(er>264){var en=n[N=er-257];ea=C(e,T,(1<<en)-1)+u[N],T+=en}var ei=R[b(e,T)&ee],eo=ei>>>4;if(ei||x(3),T+=15&ei,q=c[eo],eo>3&&(en=i[eo],q+=b(e,T)&(1<<en)-1,T+=en),T>U){M&&x(0);break}A&&E(S+131072);for(var es=S+ea;S<es;S+=4)s[S]=s[S-q],s[S+1]=s[S+1-q],s[S+2]=s[S+2-q],s[S+3]=s[S+3-q];S=es}}l.l=I,l.p=et,l.b=S,I&&(F=1,l.m=G,l.d=R,l.n=D)}while(!F)return S==s.length?s:(h=s,(d=0)<0&&(d=0),(null==(f=S)||f>h.length)&&(f=h.length),(p=new(h instanceof r?r:h instanceof a?a:t)(f-d)).set(h.subarray(d,f)),p)},E=new t(0),F="u">typeof TextDecoder&&new TextDecoder;try{F.decode(E,{stream:!0})}catch(e){}return e.convert_streams=function(e){var t=new DataView(e),r=0;function a(){var e=t.getUint16(r);return r+=2,e}function n(){var e=t.getUint32(r);return r+=4,e}function i(e){A.setUint16(v,e),v+=2}function o(e){A.setUint32(v,e),v+=4}for(var s={signature:n(),flavor:n(),length:n(),numTables:a(),reserved:a(),totalSfntSize:n(),majorVersion:a(),minorVersion:a(),metaOffset:n(),metaLength:n(),metaOrigLength:n(),privOffset:n(),privLength:n()},l=0;Math.pow(2,l)<=s.numTables;)l++;l--;for(var u=16*Math.pow(2,l),h=16*s.numTables-u,c=12,d=[],f=0;f<s.numTables;f++)d.push({tag:n(),offset:n(),compLength:n(),origLength:n(),origChecksum:n()}),c+=16;var p,m=new Uint8Array(12+16*d.length+d.reduce(function(e,t){return e+t.origLength+4},0)),g=m.buffer,A=new DataView(g),v=0;return o(s.flavor),i(s.numTables),i(u),i(l),i(h),d.forEach(function(e){o(e.tag),o(e.origChecksum),o(c),o(e.origLength),e.outOffset=c,(c+=e.origLength)%4!=0&&(c+=4-c%4)}),d.forEach(function(t){var r=e.slice(t.offset,t.offset+t.compLength);if(t.compLength!=t.origLength){var a=new Uint8Array(t.origLength);w(new Uint8Array(r,2),a)}else a=new Uint8Array(r);m.set(a,t.outOffset);var n=0;(c=t.outOffset+t.origLength)%4!=0&&(n=4-c%4),m.set(new Uint8Array(n).buffer,t.outOffset+t.origLength),p=c+n}),g.slice(0,p)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}).convert_streams},function(e,t){let r,a={M:2,L:2,Q:4,C:6,Z:0},n={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=[null,"isol","init","fina","medi"];function o(t,r){let a=t.GDEF&&t.GDEF.glyphClassDef;return a?e.U._getGlyphClass(r,a):0}function s(...e){for(let t=0;t<e.length;t++)if("number"==typeof e[t])return e[t]}return function(l){var u;let h,c,d,f,p,m,g=new Uint8Array(l,0,4),A=e._bin.readASCII(g,0,4);if("wOFF"===A)l=t(l);else if("wOF2"===A)throw Error("woff2 fonts not supported");return u=e.parse(l)[0],h=Object.create(null),c=u["OS/2"],d=u.hhea,f=u.head.unitsPerEm,p=s(c&&c.sTypoAscender,d&&d.ascender,f),m={unitsPerEm:f,ascender:p,descender:s(c&&c.sTypoDescender,d&&d.descender,0),capHeight:s(c&&c.sCapHeight,p),xHeight:s(c&&c.sxHeight,p),lineGap:s(c&&c.sTypoLineGap,d&&d.lineGap),supportsCodePoint:t=>e.U.codeToGlyph(u,t)>0,forEachGlyph(t,s,l,c){let d=0,f=1/m.unitsPerEm*s,p=function(t,a){let o=[];for(let r=0;r<a.length;r++){let n=a.codePointAt(r);n>65535&&r++,o.push(e.U.codeToGlyph(t,n))}let s=t.GSUB;if(s){let t,{lookupList:l,featureList:u}=s,h=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,c=[];u.forEach(s=>{if(h.test(s.tag))for(let u=0;u<s.tab.length;u++){if(c[s.tab[u]])continue;c[s.tab[u]]=!0;let h=l[s.tab[u]],d=/^(isol|init|fina|medi)$/.test(s.tag);d&&!t&&(t=function(e){let t=new Uint8Array(e.length),a=32,i=1,o=-1;for(let s=0;s<e.length;s++){let l=e.codePointAt(s),u=0|function(e){if(!r){let e={R:2,L:1,D:4,C:16,U:32,T:8};for(let t in r=new Map,n){let a=0;n[t].split(",").forEach(n=>{let[i,o]=n.split("+");i=parseInt(i,36),o=o?parseInt(o,36):0,r.set(a+=i,e[t]);for(let n=o;n--;)r.set(++a,e[t])})}}return r.get(e)||32}(l),h=1;!(8&u)&&(21&a?22&u?(h=3,(1===i||3===i)&&t[o]++):33&u&&(2===i||4===i)&&t[o]--:34&a&&(2===i||4===i)&&t[o]--,i=t[s]=h,a=u,o=s,l>65535&&s++)}return t}(a));for(let r=0;r<o.length;r++)t&&d&&i[t[r]]!==s.tag||e.U._applySubs(o,r,h,l)}})}return o}(u,t),g=0,A=function(t,r){let a=new Int16Array(3*r.length),n=0;for(;n<r.length;n++){let u=r[n];if(-1===u)continue;a[3*n+2]=t.hmtx.aWidth[u];let h=t.GPOS;if(h){let c=h.lookupList;for(let h=0;h<c.length;h++){let d=c[h];for(let h=0;h<d.tabs.length;h++){let c=d.tabs[h];if(1===d.ltype){if(-1!==e._lctf.coverageIndex(c.coverage,u)&&c.pos){l(c.pos,n);break}}else if(2===d.ltype){let t=null,a=i();if(-1!==a){let i=e._lctf.coverageIndex(c.coverage,r[a]);if(-1!==i){if(1===c.fmt){let e=c.pairsets[i];for(let r=0;r<e.length;r++)e[r].gid2===u&&(t=e[r])}else if(2===c.fmt){let n=e.U._getGlyphClass(r[a],c.classDef1),i=e.U._getGlyphClass(u,c.classDef2);t=c.matrix[n][i]}if(t){t.val1&&l(t.val1,a),t.val2&&l(t.val2,n);break}}}}else if(4===d.ltype){let t=e._lctf.coverageIndex(c.markCoverage,u);if(-1!==t){let o=i(s),l=-1===o?-1:e._lctf.coverageIndex(c.baseCoverage,r[o]);if(-1!==l){let e=c.markArray[t],r=c.baseArray[l][e.markClass];a[3*n]=r.x-e.x+a[3*o]-a[3*o+2],a[3*n+1]=r.y-e.y+a[3*o+1];break}}}else if(6===d.ltype){let s=e._lctf.coverageIndex(c.mark1Coverage,u);if(-1!==s){let l=i();if(-1!==l){let i=r[l];if(3===o(t,i)){let t=e._lctf.coverageIndex(c.mark2Coverage,i);if(-1!==t){let e=c.mark1Array[s],r=c.mark2Array[t][e.markClass];a[3*n]=r.x-e.x+a[3*l]-a[3*l+2],a[3*n+1]=r.y-e.y+a[3*l+1];break}}}}}}}}else if(t.kern&&!t.cff){let e=i();if(-1!==e){let n=t.kern.glyph1.indexOf(r[e]);if(-1!==n){let r=t.kern.rval[n].glyph2.indexOf(u);-1!==r&&(a[3*e+2]+=t.kern.rval[n].vals[r])}}}}return a;function i(e){for(let t=n-1;t>=0;t--)if(-1!==r[t]&&(!e||e(r[t])))return t;return -1}function s(e){return 1===o(t,e)}function l(e,t){for(let r=0;r<3;r++)a[3*t+r]+=e[r]||0}}(u,p);return p.forEach((r,n)=>{if(-1!==r){let t=h[r];if(!t){let n,i,o,s,{cmds:l,crds:c}=e.U.glyphToPath(u,r),d="",f=0;for(let e=0,t=l.length;e<t;e++){let t=a[l[e]];d+=l[e];for(let e=1;e<=t;e++)d+=(e>1?",":"")+c[f++]}if(c.length){n=i=1/0,o=s=-1/0;for(let e=0,t=c.length;e<t;e+=2){let t=c[e],r=c[e+1];t<n&&(n=t),r<i&&(i=r),t>o&&(o=t),r>s&&(s=r)}}else n=o=i=s=0;t=h[r]={index:r,advanceWidth:u.hmtx.aWidth[r],xMin:n,yMin:i,xMax:o,yMax:s,path:d}}c.call(null,t,d+A[3*n]*f,A[3*n+1]*f,g),d+=A[3*n+2]*f,l&&(d+=l*s)}g+=t.codePointAt(g)>65535?2:1}),d}}}}],init:(e,t,r)=>r(e(),t())}),ev=ee({name:"FontResolver",dependencies:[function(e,t){let r=Object.create(null),a=Object.create(null);function n(t,n){let i=r[t];if(i)n(i);else if(a[t])a[t].push(n);else{a[t]=[n];let i=e=>{console.error(`Failure loading font ${t}`,e)};try{let n=new XMLHttpRequest;n.open("get",t,!0),n.responseType="arraybuffer",n.onload=function(){if(n.status>=400)i(Error(n.statusText));else if(n.status>0)try{var o;let i=e(n.response);i.src=t,(o=i).src=t,r[t]=o,a[t].forEach(e=>e(o)),delete a[t]}catch(e){i(e)}},n.onerror=i,n.send()}catch(e){i(e)}}}return function(e,a,{lang:i,fonts:o=[],style:s="normal",weight:l="normal",unicodeFontsURL:u}={}){let h=new Uint8Array(e.length),c=[];e.length||m();let d=new Map,f=[];if("italic"!==s&&(s="normal"),"number"!=typeof l&&(l="bold"===l?700:400),o&&!Array.isArray(o)&&(o=[o]),(o=o.slice().filter(e=>!e.lang||e.lang.test(i)).reverse()).length){let t=0;!function a(i=0){for(let s=i,l=e.length;s<l;s++){let i=e.codePointAt(s);if(1===t&&c[h[s-1]].supportsCodePoint(i)||s>0&&/\s/.test(e[s]))h[s]=h[s-1],2===t&&(f[f.length-1][1]=s);else for(let e=h[s],l=o.length;e<=l;e++)if(e===l)(2===t?f[f.length-1]:f[f.length]=[s,s])[1]=s,t=2;else{h[s]=e;let{src:l,unicodeRange:u}=o[e];if(!u||function(e,t){for(let r=0;r<t.length;r++){let[a,n=a]=t[r];if(a<=e&&e<=n)return!0}return!1}(i,u)){let e=r[l];if(!e)return void n(l,()=>{a(s)});if(e.supportsCodePoint(i)){let r=d.get(e);"number"!=typeof r&&(r=c.length,c.push(e),d.set(e,r)),h[s]=r,t=1;break}}}i>65535&&s+1<l&&(h[s+1]=h[s],s++,2===t&&(f[f.length-1][1]=s))}p()}()}else f.push([0,e.length-1]),p();function p(){if(f.length){let r=f.map(t=>e.substring(t[0],t[1]+1)).join("\n");t.getFontsForString(r,{lang:i||void 0,style:s,weight:l,dataUrl:u}).then(({fontUrls:e,chars:t})=>{let r=c.length,a=0;f.forEach(e=>{for(let n=0,i=e[1]-e[0];n<=i;n++)h[e[0]+n]=t[a++]+r;a++});let i=0;e.forEach((t,a)=>{n(t,t=>{c[a+r]=t,++i===e.length&&m()})})})}else m()}function m(){a({chars:h,fonts:c})}}},eA,function(){return function(e){var t=function(){this.buckets=new Map};t.prototype.add=function(e){var t=e>>5;this.buckets.set(t,(this.buckets.get(t)||0)|1<<(31&e))},t.prototype.has=function(e){var t=this.buckets.get(e>>5);return void 0!==t&&0!=(t&1<<(31&e))},t.prototype.serialize=function(){var e=[];return this.buckets.forEach(function(t,r){e.push((+r).toString(36)+":"+t.toString(36))}),e.join(",")},t.prototype.deserialize=function(e){var t=this;this.buckets.clear(),e.split(",").forEach(function(e){var r=e.split(":");t.buckets.set(parseInt(r[0],36),parseInt(r[1],36))})};function r(e,t){var r=255&e,a=t.codePointAt(r/6|0);return 0!=((a=(a||48)-48)&1<<r%6)}function a(e,t){e.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map(function(e){return e.split("-").map(function(e){return parseInt(e.trim(),16)})}).forEach(function(e){var r=e[0],a=e[1];void 0===a&&(a=r),function(e,r){for(var a=e;a<=r;a++)t(a)}(r,a)})}var n,i={},o={},s=new WeakMap,l="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data",u=new Map;function h(e,t,r){return e[t]?t:e[r]?r:function(e){for(var t in e)return t}(e)}return e.CodePointSet=t,e.clearCache=function(){i={},o={}},e.getFontsForString=function(e,c){void 0===c&&(c={});var d=c.lang;void 0===d&&(d=/\p{Script=Hangul}/u.test(e)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(e)?"ja":"en");var f=c.category;void 0===f&&(f="sans-serif");var p=c.style;void 0===p&&(p="normal");var m=c.weight;void 0===m&&(m=400);var g=(c.dataUrl||l).replace(/\/$/g,""),A=new Map,v=new Uint8Array(e.length),B={},y={},C=Array(e.length),b=new Map,M=!1;function x(e){var t=u.get(e);return t||(t=fetch(g+"/"+e).then(function(e){if(!e.ok)throw Error(e.statusText);return e.json().then(function(e){if(!Array.isArray(e)||1!==e[0])throw Error("Incorrect schema version; need 1, got "+e[0]);return e[1]})}).catch(function(t){if(g!==l)return M||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+g+'", trying default CDN. '+t.message),M=!0),g=l,u.delete(e),x(e);throw t}),u.set(e,t)),t}for(var w=0;w<e.length;w++)!function(t){var r=e.codePointAt(t),a=function(e){var t=(-256&e).toString(16),r=((-256&e)+256-1).toString(16);return"codepoint-index/plane"+(e>>16)+"/"+t+"-"+r+".json"}(r);C[t]=a,i[a]||b.has(a)||b.set(a,x(a).then(function(e){i[a]=e})),r>65535&&(w=++t)}(w);return Promise.all(b.values()).then(function(){b.clear();for(var t=0;t<e.length;t++)!function(a){var n=e.codePointAt(a),s=null,l=i[C[a]],u=void 0;for(var h in l){var c=y[h];if(void 0===c&&(c=y[h]=new RegExp(h).test(d||"en")),c){for(var f in u=h,l[h])if(r(n,l[h][f])){s=f;break}break}}if(!s){e:for(var p in l)if(p!==u){for(var m in l[p])if(r(n,l[p][m])){s=m;break e}}}s||(console.debug("No font coverage for U+"+n.toString(16)),s="latin"),C[a]=s,o[s]||b.has(s)||b.set(s,x("font-meta/"+s+".json").then(function(e){o[s]=e})),n>65535&&(t=++a)}(t);return Promise.all(b.values())}).then(function(){for(var r,i=null,l=0;l<e.length;l++){var u=e.codePointAt(l);if(i&&(n||(n=new Set,a("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",function(e){n.add(e)})),n.has(u)||(function(e){var r=s.get(e);return r||(r=new t,a(e.ranges,function(e){return r.add(e)}),s.set(e,r)),r})(i).has(u)))v[l]=v[l-1];else{var c=B[(i=o[C[l]]).id];if(!c){var d=i.typeforms,y=h(d,f,"sans-serif"),b=h(d[y],p,"normal"),M=function(e,t){var r=t;if(!e.includes(r)){r=1/0;for(var a=0;a<e.length;a++)Math.abs(e[a]-t)<Math.abs(r-t)&&(r=e[a])}return r}(null==(r=d[y])?void 0:r[b],m);c=B[i.id]=g+"/font-files/"+i.id+"/"+y+"."+b+"."+M+".woff"}var x=A.get(c);null==x&&(x=A.size,A.set(c,x)),v[l]=x}u>65535&&(v[++l]=v[l-1])}return{fontUrls:Array.from(A.keys()),chars:v}})},Object.defineProperty(e,"__esModule",{value:!0}),e}({})}],init:(e,t,r)=>e(t,r())}),eB=()=>(self.performance||Date).now(),ey=ea(),eC=[],eb=0;function eM(){let e=eB();for(;eC.length&&eB()-e<5;)eC.shift()();eb=eC.length?setTimeout(eM,0):0}let ex={},ew=0;function eE(e,t,r,a,n,i,o,s,l,u){let h="TroikaTextSDFGenerator_JS_"+ew++%4,c=ex[h];return c||(c=ex[h]={workerModule:ee({name:h,workerId:h,dependencies:[ea,eB],init(e,t){let r=e().javascript.generate;return function(...e){let a=t();return{textureData:r(...e),timing:t()-a}}},getTransferables:e=>[e.textureData.buffer]}),requests:0,idleTimer:null}),c.requests++,clearTimeout(c.idleTimer),c.workerModule(e,t,r,a,n,i).then(({textureData:r,timing:a})=>{let n=eB(),i=new Uint8Array(4*r.length);for(let e=0;e<r.length;e++)i[4*e+u]=r[e];return ey.webglUtils.renderImageData(o,i,s,l,e,t,1<<3-u),a+=eB()-n,0==--c.requests&&(c.idleTimer=setTimeout(()=>{q[h]&&q[h].forEach(function(e){e()}),Z[h]&&(Z[h].terminate(),delete Z[h])},2e3)),{timing:a}})}let eF=ey.webglUtils.resizeWebGLCanvasWithoutClearing,eT={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},eS=new W.Color;function eI(){return(self.performance||Date).now()}let eR=Object.create(null);function eG(e,t){e=function(e,t){for(let r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}({},e);let r=eI(),{defaultFontURL:a}=eT,n=[];if(a&&n.push({label:"default",src:eU(a)}),e.font&&n.push({label:"user",src:eU(e.font)}),e.font=n,e.text=""+e.text,e.sdfGlyphSize=e.sdfGlyphSize||eT.sdfGlyphSize,e.unicodeFontsURL=e.unicodeFontsURL||eT.unicodeFontsURL,null!=e.colorRanges){let t={};for(let r in e.colorRanges)if(e.colorRanges.hasOwnProperty(r)){let a=e.colorRanges[r];"number"!=typeof a&&(a=eS.set(a).getHex()),t[r]=a}e.colorRanges=t}Object.freeze(e);let{textureWidth:i,sdfExponent:o}=eT,{sdfGlyphSize:s}=e,l=i/s*4,u=eR[s];if(!u){var h;let e,t=document.createElement("canvas");t.width=i,t.height=256*s/l,(u=eR[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:t,sdfTexture:new W.Texture(t,void 0,void 0,void 0,W.LinearFilter,W.LinearFilter),contextLost:!1,glyphsByFont:new Map}).sdfTexture.generateMipmaps=!1,(e=(h=u).sdfCanvas).addEventListener("webglcontextlost",e=>{console.log("Context Lost",e),e.preventDefault(),h.contextLost=!0}),e.addEventListener("webglcontextrestored",e=>{console.log("Context Restored",e),h.contextLost=!1;let t=[];h.glyphsByFont.forEach(e=>{e.forEach(e=>{t.push(eD(e,h,!0))})}),Promise.all(t).then(()=>{e_(h),h.sdfTexture.needsUpdate=!0})})}let{sdfTexture:c,sdfCanvas:d}=u;(eT.useWorker?eP:eL)(e).then(a=>{let{glyphIds:n,glyphFontIndices:h,fontData:f,glyphPositions:p,fontSize:m,timings:g}=a,A=[],v=new Float32Array(4*n.length),B=0,y=0,C=eI(),b=f.map(e=>{let t=u.glyphsByFont.get(e.src);return t||u.glyphsByFont.set(e.src,t=new Map),t});n.forEach((e,t)=>{let r=h[t],{src:i,unitsPerEm:o}=f[r],l=b[r].get(e);if(!l){let{path:t,pathBounds:n}=a.glyphData[i][e],o=Math.max(n[2]-n[0],n[3]-n[1])/s*(eT.sdfMargin*s+.5),h=u.glyphCount++,c=[n[0]-o,n[1]-o,n[2]+o,n[3]+o];b[r].set(e,l={path:t,atlasIndex:h,sdfViewBox:c}),A.push(l)}let{sdfViewBox:c}=l,d=p[y++],g=p[y++],C=m/o;v[B++]=d+c[0]*C,v[B++]=g+c[1]*C,v[B++]=d+c[2]*C,v[B++]=g+c[3]*C,n[t]=l.atlasIndex}),g.quads=(g.quads||0)+(eI()-C);let M=eI();g.sdf={};let x=d.height,w=Math.pow(2,Math.ceil(Math.log2(Math.ceil(u.glyphCount/l)*s)));w>x&&(console.info(`Increasing SDF texture size ${x}->${w}`),eF(d,i,w),c.dispose()),Promise.all(A.map(t=>eD(t,u,e.gpuAccelerateSDF).then(({timing:e})=>{g.sdf[t.atlasIndex]=e}))).then(()=>{A.length&&!u.contextLost&&(e_(u),c.needsUpdate=!0),g.sdfTotal=eI()-M,g.total=eI()-r,t(Object.freeze({parameters:e,sdfTexture:c,sdfGlyphSize:s,sdfExponent:o,glyphBounds:v,glyphAtlasIndices:n,glyphColors:a.glyphColors,caretPositions:a.caretPositions,chunkedBounds:a.chunkedBounds,ascender:a.ascender,descender:a.descender,lineHeight:a.lineHeight,capHeight:a.capHeight,xHeight:a.xHeight,topBaseline:a.topBaseline,blockBounds:a.blockBounds,visibleBounds:a.visibleBounds,timings:a.timings}))})}),Promise.resolve().then(()=>{!u.contextLost&&(d._warm||(ey.webgl.isSupported(d),d._warm=!0))})}function eD({path:e,atlasIndex:r,sdfViewBox:a},{sdfGlyphSize:n,sdfCanvas:i,contextLost:o},s){if(o)return Promise.resolve({timing:-1});let{textureWidth:l,sdfExponent:u}=eT,h=Math.max(a[2]-a[0],a[3]-a[1]),c=Math.floor(r/4),d=c%(l/n)*n,f=Math.floor(c/(l/n))*n;return function(e,r,a,n,i,o,s,l,u,h,c=!0){return c?((...e)=>new Promise((t,r)=>{eC.push(()=>{let a=eB();try{ey.webgl.generateIntoCanvas(...e),t({timing:eB()-a})}catch(e){r(e)}}),eb||(eb=setTimeout(eM,0))}))(e,r,a,n,i,o,s,l,u,h).then(null,c=>(t||(console.warn("WebGL SDF generation failed, falling back to JS",c),t=!0),eE(e,r,a,n,i,o,s,l,u,h))):eE(e,r,a,n,i,o,s,l,u,h)}(n,n,e,a,h,u,i,d,f,r%4,s)}function eU(e){return r||(r="u"<typeof document?{}:document.createElement("a")),r.href=e,r.href}function e_(e){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");let{sdfCanvas:t,sdfTexture:r}=e,{width:a,height:n}=t,i=e.sdfCanvas.getContext("webgl"),o=r.image.data;o&&o.length===a*n*4||(o=new Uint8Array(a*n*4),r.image={width:a,height:n,data:o},r.flipY=!1,r.isDataTexture=!0),i.readPixels(0,0,a,n,i.RGBA,i.UNSIGNED_BYTE,o)}}let ek=ee({name:"Typesetter",dependencies:[function(e,t){let r=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,n="[^\\S\\u00A0]",i=RegExp(`${n}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function o({text:c="",font:d,lang:f,sdfGlyphSize:p=64,fontSize:m=400,fontWeight:g=1,fontStyle:A="normal",letterSpacing:v=0,lineHeight:B="normal",maxWidth:y=r,direction:C,textAlign:b="left",textIndent:M=0,whiteSpace:x="normal",overflowWrap:w="normal",anchorX:E=0,anchorY:F=0,metricsOnly:T=!1,unicodeFontsURL:S,preResolvedFonts:I=null,includeCaretPositions:R=!1,chunkedBoundsSize:G=8192,colorRanges:D=null},U){let _=u(),k={fontLoad:0,typesetting:0};c.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),c=c.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),m*=1,v*=1,y*=1,B=B||"normal",M*=1,function({text:t,lang:r,fonts:a,style:n,weight:i,preResolvedFonts:o,unicodeFontsURL:s},l){let u=({chars:e,fonts:t})=>{let r,a,n=[];for(let i=0;i<e.length;i++)e[i]!==a?(a=e[i],n.push(r={start:i,end:i,fontObj:t[e[i]]})):r.end=i;l(n)};o?u(o):e(t,u,{lang:r,fonts:a,style:n,weight:i,unicodeFontsURL:s})}({text:c,lang:f,style:A,weight:g,fonts:"string"==typeof d?[{src:d}]:d,unicodeFontsURL:S,preResolvedFonts:I},e=>{k.fontLoad=u()-_;let o=isFinite(y),d=null,f=null,p=null,g=null,A=null,S=null,I=null,P=null,L=0,O=0,H="nowrap"!==x,j=new Map,J=u(),N=M,K=0,W=new h,V=[W];e.forEach(e=>{let t,r,{fontObj:s}=e,{ascender:l,descender:u,unitsPerEm:d,lineGap:f,capHeight:p,xHeight:g}=s,A=j.get(s);if(!A){let e=m/d,t="normal"===B?(l-u+f)*e:B*m,r=(t-(l-u)*e)/2,a=Math.min(t,(l-u)*e),n=(l+u)/2*e+a/2;A={index:j.size,src:s.src,fontObj:s,fontSizeMult:e,unitsPerEm:d,ascender:l*e,descender:u*e,capHeight:p*e,xHeight:g*e,lineHeight:t,baseline:-r-l*e,caretTop:n,caretBottom:n-a},j.set(s,A)}let{fontSizeMult:C}=A,b=c.slice(e.start,e.end+1);s.forEachGlyph(b,m,v,(s,l,u,d)=>{let f;l+=K,d+=e.start,t=l,r=s;let p=c.charAt(d),g=s.advanceWidth*C,B=W.count;if("isEmpty"in s||(s.isWhitespace=!!p&&new RegExp(n).test(p),s.canBreakAfter=!!p&&i.test(p),s.isEmpty=s.xMin===s.xMax||s.yMin===s.yMax||a.test(p)),!s.isWhitespace&&!s.isEmpty&&O++,H&&o&&!s.isWhitespace&&l+g+N>y&&B){if(W.glyphAt(B-1).glyphObj.canBreakAfter)f=new h,N=-l;else for(let e=B;e--;)if(0===e&&"break-word"===w){f=new h,N=-l;break}else if(W.glyphAt(e).glyphObj.canBreakAfter){let t=(f=W.splitAt(e+1)).glyphAt(0).x;N-=t;for(let e=f.count;e--;)f.glyphAt(e).x-=t;break}f&&(W.isSoftWrapped=!0,W=f,V.push(W),L=y)}let b=W.glyphAt(W.count);b.glyphObj=s,b.x=l+N,b.y=u,b.width=g,b.charIndex=d,b.fontData=A,"\n"===p&&(W=new h,V.push(W),N=-(l+g+v*m)+M)}),K=t+r.advanceWidth*C+v*m});let X=0;V.forEach(e=>{let t=!0;for(let r=e.count;r--;){let a=e.glyphAt(r);t&&!a.glyphObj.isWhitespace&&(e.width=a.x+a.width,e.width>L&&(L=e.width),t=!1);let{lineHeight:n,capHeight:i,xHeight:o,baseline:s}=a.fontData;n>e.lineHeight&&(e.lineHeight=n);let l=s-e.baseline;l<0&&(e.baseline+=l,e.cap+=l,e.ex+=l),e.cap=Math.max(e.cap,e.baseline+i),e.ex=Math.max(e.ex,e.baseline+o)}e.baseline-=X,e.cap-=X,e.ex-=X,X+=e.lineHeight});let Q=0,z=0;if(E&&("number"==typeof E?Q=-E:"string"==typeof E&&(Q=-L*("left"===E?0:"center"===E?.5:"right"===E?1:s(E)))),F&&("number"==typeof F?z=-F:"string"==typeof F&&(z="top"===F?0:"top-baseline"===F?-V[0].baseline:"top-cap"===F?-V[0].cap:"top-ex"===F?-V[0].ex:"middle"===F?X/2:"bottom"===F?X:"bottom-baseline"===F?-V[V.length-1].baseline:s(F)*X)),!T){let e,a,n=t.getEmbeddingLevels(c,C);d=new Uint16Array(O),f=new Uint8Array(O),p=new Float32Array(2*O),g={},I=[r,r,-r,-r],P=[],R&&(S=new Float32Array(4*c.length)),D&&(A=new Uint8Array(3*O));let i=0,o=-1,s=-1;if(V.forEach((u,h)=>{let{count:m,width:v}=u;if(m>0){let h,B=0;for(let e=m;e--&&u.glyphAt(e).glyphObj.isWhitespace;)B++;let y=0,C=0;if("center"===b)y=(L-v)/2;else if("right"===b)y=L-v;else if("justify"===b&&u.isSoftWrapped){let e=0;for(let t=m-B;t--;)u.glyphAt(t).glyphObj.isWhitespace&&e++;C=(L-v)/e}if(C||y){let e=0;for(let t=0;t<m;t++){let r=u.glyphAt(t),a=r.glyphObj;r.x+=y+e,0!==C&&a.isWhitespace&&t<m-B&&(e+=C,r.width+=C)}}let M=t.getReorderSegments(c,n,u.glyphAt(0).charIndex,u.glyphAt(u.count-1).charIndex);for(let e=0;e<M.length;e++){let[t,r]=M[e],a=1/0,n=-1/0;for(let e=0;e<m;e++)if(u.glyphAt(e).charIndex>=t){let t=e,i=e;for(;i<m;i++){let e=u.glyphAt(i);if(e.charIndex>r)break;i<m-B&&(a=Math.min(a,e.x),n=Math.max(n,e.x+e.width))}for(let e=t;e<i;e++){let t=u.glyphAt(e);t.x=n-(t.x+t.width-a)}break}}let x=e=>h=e;for(let v=0;v<m;v++){let m=u.glyphAt(v),B=(h=m.glyphObj).index,y=1&n.levels[m.charIndex];if(y){let e=t.getMirroredCharacter(c[m.charIndex]);e&&m.fontData.fontObj.forEachGlyph(e,0,0,x)}if(R){let{charIndex:e,fontData:t}=m,r=m.x+Q,a=m.x+m.width+Q;S[4*e]=y?a:r,S[4*e+1]=y?r:a,S[4*e+2]=u.baseline+t.caretBottom+z,S[4*e+3]=u.baseline+t.caretTop+z;let n=e-o;n>1&&l(S,o,n),o=e}if(D){let{charIndex:e}=m;for(;e>s;)s++,D.hasOwnProperty(s)&&(a=D[s])}if(!h.isWhitespace&&!h.isEmpty){let t=i++,{fontSizeMult:n,src:o,index:s}=m.fontData,l=g[o]||(g[o]={});l[B]||(l[B]={path:h.path,pathBounds:[h.xMin,h.yMin,h.xMax,h.yMax]});let c=m.x+Q,v=m.y+u.baseline+z;p[2*t]=c,p[2*t+1]=v;let y=c+h.xMin*n,C=v+h.yMin*n,b=c+h.xMax*n,M=v+h.yMax*n;y<I[0]&&(I[0]=y),C<I[1]&&(I[1]=C),b>I[2]&&(I[2]=b),M>I[3]&&(I[3]=M),t%G==0&&(e={start:t,end:t,rect:[r,r,-r,-r]},P.push(e)),e.end++;let x=e.rect;if(y<x[0]&&(x[0]=y),C<x[1]&&(x[1]=C),b>x[2]&&(x[2]=b),M>x[3]&&(x[3]=M),d[t]=B,f[t]=s,D){let e=3*t;A[e]=a>>16&255,A[e+1]=a>>8&255,A[e+2]=255&a}}}}}),S){let e=c.length-o;e>1&&l(S,o,e)}}let Y=[];j.forEach(({index:e,src:t,unitsPerEm:r,ascender:a,descender:n,lineHeight:i,capHeight:o,xHeight:s})=>{Y[e]={src:t,unitsPerEm:r,ascender:a,descender:n,lineHeight:i,capHeight:o,xHeight:s}}),k.typesetting=u()-J,U({glyphIds:d,glyphFontIndices:f,glyphPositions:p,glyphData:g,fontData:Y,caretPositions:S,glyphColors:A,chunkedBounds:P,fontSize:m,topBaseline:z+V[0].baseline,blockBounds:[Q,z-X,Q+L,z],visibleBounds:I,timings:k})})}function s(e){let t=e.match(/^([\d.]+)%$/),r=t?parseFloat(t[1]):NaN;return isNaN(r)?0:r/100}function l(e,t,r){let a=e[4*t],n=e[4*t+1],i=e[4*t+2],o=e[4*t+3],s=(n-a)/r;for(let n=0;n<r;n++){let r=(t+n)*4;e[r]=a+s*n,e[r+1]=a+s*(n+1),e[r+2]=i,e[r+3]=o}}function u(){return(self.performance||Date).now()}function h(){this.data=[]}let c=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/c.length)},glyphAt(e){let t=h.flyweight;return t.data=this.data,t.index=e,t},splitAt(e){let t=new h;return t.data=this.data.splice(e*c.length),t}},h.flyweight=c.reduce((e,t,r,a)=>(Object.defineProperty(e,t,{get(){return this.data[this.index*c.length+r]},set(e){this.data[this.index*c.length+r]=e}}),e),{data:null,index:0}),{typeset:o,measure:function(e,t){o({...e,metricsOnly:!0},e=>{let[r,a,n,i]=e.blockBounds;t({width:n-r,height:i-a})})}}},ev,function(){return function(e){var t,r,a,n,i={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},o={},s={};o.L=1,s[1]="L",Object.keys(i).forEach(function(e,t){o[e]=1<<t+1,s[o[e]]=e}),Object.freeze(o);var l=o.LRI|o.RLI|o.FSI,u=o.L|o.R|o.AL,h=o.B|o.S|o.WS|o.ON|o.FSI|o.LRI|o.RLI|o.PDI,c=o.BN|o.RLE|o.LRE|o.RLO|o.LRO|o.PDF,d=o.S|o.WS|o.B|l|o.PDI|c,f=null;function p(e){if(!f){f=new Map;var t=function(e){if(i.hasOwnProperty(e)){var t=0;i[e].split(",").forEach(function(r){var a=r.split("+"),n=a[0],i=a[1];n=parseInt(n,36),i=i?parseInt(i,36):0,f.set(t+=n,o[e]);for(var s=0;s<i;s++)f.set(++t,o[e])})}};for(var r in i)t(r)}return f.get(e.codePointAt(0))||o.L}function m(e,t){var r,a=0,n=new Map,i=t&&new Map;return e.split(",").forEach(function e(o){if(-1!==o.indexOf("+"))for(var s=+o;s--;)e(r);else{r=o;var l=o.split(">"),u=l[0],h=l[1];u=String.fromCodePoint(a+=parseInt(u,36)),h=String.fromCodePoint(a+=parseInt(h,36)),n.set(u,h),t&&i.set(h,u)}}),{map:n,reverseMap:i}}function g(){if(!t){var e=m("14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",!0),n=e.map,i=e.reverseMap;t=n,r=i,a=m("6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye",!1).map}}function A(e){return g(),t.get(e)||null}function v(e){return g(),r.get(e)||null}function B(e){return g(),a.get(e)||null}var y=o.L,C=o.R,b=o.EN,M=o.ES,x=o.ET,w=o.AN,E=o.CS,F=o.B,T=o.S,S=o.ON,I=o.BN,R=o.NSM,G=o.AL,D=o.LRO,U=o.RLO,_=o.LRE,k=o.RLE,P=o.PDF,L=o.LRI,O=o.RLI,H=o.FSI,j=o.PDI;function J(e){if(!n){var t=m("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),r=t.map;t.reverseMap.forEach(function(e,t){r.set(t,e)}),n=r}return n.get(e)||null}function N(e,t,r,a){var n=e.length;r=Math.max(0,null==r?0:+r),a=Math.min(n-1,null==a?n-1:+a);var i=[];return t.paragraphs.forEach(function(n){var o=Math.max(r,n.start),s=Math.min(a,n.end);if(o<s){for(var l=t.levels.slice(o,s+1),u=s;u>=o&&p(e[u])&d;u--)l[u]=n.level;for(var h=n.level,c=1/0,f=0;f<l.length;f++){var m=l[f];m>h&&(h=m),m<c&&(c=1|m)}for(var g=h;g>=c;g--)for(var A=0;A<l.length;A++)if(l[A]>=g){for(var v=A;A+1<l.length&&l[A+1]>=g;)A++;A>v&&i.push([v+o,A+o])}}}),i}function K(e,t,r,a){for(var n=N(e,t,r,a),i=[],o=0;o<e.length;o++)i[o]=o;return n.forEach(function(e){for(var t=e[0],r=e[1],a=i.slice(t,r+1),n=a.length;n--;)i[r-n]=a[n]}),i}return e.closingToOpeningBracket=v,e.getBidiCharType=p,e.getBidiCharTypeName=function(e){return s[p(e)]},e.getCanonicalBracket=B,e.getEmbeddingLevels=function(e,t){for(var r=new Uint32Array(e.length),a=0;a<e.length;a++)r[a]=p(e[a]);var n=new Map;function i(e,t){var a=r[e];r[e]=t,n.set(a,n.get(a)-1),a&h&&n.set(h,n.get(h)-1),n.set(t,(n.get(t)||0)+1),t&h&&n.set(h,(n.get(h)||0)+1)}for(var o=new Uint8Array(e.length),s=new Map,f=[],m=null,g=0;g<e.length;g++)m||f.push(m={start:g,end:e.length-1,level:"rtl"===t?1:"ltr"===t?0:tI(g,!1)}),r[g]&F&&(m.end=g,m=null);for(var J=k|_|U|D|l|j|P|F,N=function(e){return e+(1&e?1:2)},K=function(e){return e+(1&e?2:1)},W=0;W<f.length;W++){var V=[{_level:(m=f[W]).level,_override:0,_isolate:0}],X=void 0,Q=0,z=0,Y=0;n.clear();for(var Z=m.start;Z<=m.end;Z++){var q=r[Z];if(X=V[V.length-1],n.set(q,(n.get(q)||0)+1),q&h&&n.set(h,(n.get(h)||0)+1),q&J)if(q&(k|_)){o[Z]=X._level;var $=(q===k?K:N)(X._level);!($<=125)||Q||z?!Q&&z++:V.push({_level:$,_override:0,_isolate:0})}else if(q&(U|D)){o[Z]=X._level;var ee=(q===U?K:N)(X._level);!(ee<=125)||Q||z?!Q&&z++:V.push({_level:ee,_override:q&U?C:y,_isolate:0})}else if(q&l){q&H&&(q=1===tI(Z+1,!0)?O:L),o[Z]=X._level,X._override&&i(Z,X._override);var et=(q===O?K:N)(X._level);et<=125&&0===Q&&0===z?(Y++,V.push({_level:et,_override:0,_isolate:1,_isolInitIndex:Z})):Q++}else if(q&j){if(Q>0)Q--;else if(Y>0){for(z=0;!V[V.length-1]._isolate;)V.pop();var er=V[V.length-1]._isolInitIndex;null!=er&&(s.set(er,Z),s.set(Z,er)),V.pop(),Y--}X=V[V.length-1],o[Z]=X._level,X._override&&i(Z,X._override)}else q&P?(0===Q&&(z>0?z--:!X._isolate&&V.length>1&&(V.pop(),X=V[V.length-1])),o[Z]=X._level):q&F&&(o[Z]=m.level);else o[Z]=X._level,X._override&&q!==I&&i(Z,X._override)}for(var ea=[],en=null,ei=m.start;ei<=m.end;ei++){var eo=r[ei];if(!(eo&c)){var es=o[ei],el=eo&l,eu=eo===j;en&&es===en._level?(en._end=ei,en._endsWithIsolInit=el):ea.push(en={_start:ei,_end:ei,_level:es,_startsWithPDI:eu,_endsWithIsolInit:el})}}for(var eh=[],ec=0;ec<ea.length;ec++){var ed=ea[ec];if(!ed._startsWithPDI||ed._startsWithPDI&&!s.has(ed._start)){for(var ef=[en=ed],ep=void 0;en&&en._endsWithIsolInit&&null!=(ep=s.get(en._end));)for(var em=ec+1;em<ea.length;em++)if(ea[em]._start===ep){ef.push(en=ea[em]);break}for(var eg=[],eA=0;eA<ef.length;eA++)for(var ev=ef[eA],eB=ev._start;eB<=ev._end;eB++)eg.push(eB);for(var ey=o[eg[0]],eC=m.level,eb=eg[0]-1;eb>=0;eb--)if(!(r[eb]&c)){eC=o[eb];break}var eM=eg[eg.length-1],ex=o[eM],ew=m.level;if(!(r[eM]&l)){for(var eE=eM+1;eE<=m.end;eE++)if(!(r[eE]&c)){ew=o[eE];break}}eh.push({_seqIndices:eg,_sosType:Math.max(eC,ey)%2?C:y,_eosType:Math.max(ew,ex)%2?C:y})}}for(var eF=0;eF<eh.length;eF++){var eT=eh[eF],eS=eT._seqIndices,eI=eT._sosType,eR=eT._eosType,eG=1&o[eS[0]]?C:y;if(n.get(R))for(var eD=0;eD<eS.length;eD++){var eU=eS[eD];if(r[eU]&R){for(var e_=eI,ek=eD-1;ek>=0;ek--)if(!(r[eS[ek]]&c)){e_=r[eS[ek]];break}i(eU,e_&(l|j)?S:e_)}}if(n.get(b))for(var eP=0;eP<eS.length;eP++){var eL=eS[eP];if(r[eL]&b)for(var eO=eP-1;eO>=-1;eO--){var eH=-1===eO?eI:r[eS[eO]];if(eH&u){eH===G&&i(eL,w);break}}}if(n.get(G))for(var ej=0;ej<eS.length;ej++){var eJ=eS[ej];r[eJ]&G&&i(eJ,C)}if(n.get(M)||n.get(E))for(var eN=1;eN<eS.length-1;eN++){var eK=eS[eN];if(r[eK]&(M|E)){for(var eW=0,eV=0,eX=eN-1;eX>=0&&(eW=r[eS[eX]])&c;eX--);for(var eQ=eN+1;eQ<eS.length&&(eV=r[eS[eQ]])&c;eQ++);eW===eV&&(r[eK]===M?eW===b:eW&(b|w))&&i(eK,eW)}}if(n.get(b)){for(var ez=0;ez<eS.length;ez++)if(r[eS[ez]]&b){for(var eY=ez-1;eY>=0&&r[eS[eY]]&(x|c);eY--)i(eS[eY],b);for(ez++;ez<eS.length&&r[eS[ez]]&(x|c|b);ez++)r[eS[ez]]!==b&&i(eS[ez],b)}}if(n.get(x)||n.get(M)||n.get(E))for(var eZ=0;eZ<eS.length;eZ++){var eq=eS[eZ];if(r[eq]&(x|M|E)){i(eq,S);for(var e$=eZ-1;e$>=0&&r[eS[e$]]&c;e$--)i(eS[e$],S);for(var e0=eZ+1;e0<eS.length&&r[eS[e0]]&c;e0++)i(eS[e0],S)}}if(n.get(b))for(var e1=0,e2=eI;e1<eS.length;e1++){var e3=eS[e1],e5=r[e3];e5&b?e2===y&&i(e3,y):e5&u&&(e2=e5)}if(n.get(h)){for(var e9=C|b|w,e4=e9|y,e8=[],e6=[],e7=0;e7<eS.length;e7++)if(r[eS[e7]]&h){var te=e[eS[e7]],tt=void 0;if(null!==A(te))if(e6.length<63)e6.push({char:te,seqIndex:e7});else break;else if(null!==(tt=v(te)))for(var tr=e6.length-1;tr>=0;tr--){var ta=e6[tr].char;if(ta===tt||ta===v(B(te))||A(B(ta))===te){e8.push([e6[tr].seqIndex,e7]),e6.length=tr;break}}}e8.sort(function(e,t){return e[0]-t[0]});for(var tn=0;tn<e8.length;tn++){for(var ti=e8[tn],to=ti[0],ts=ti[1],tl=!1,tu=0,th=to+1;th<ts;th++){var tc=eS[th];if(r[tc]&e4){tl=!0;var td=r[tc]&e9?C:y;if(td===eG){tu=td;break}}}if(tl&&!tu){tu=eI;for(var tf=to-1;tf>=0;tf--){var tp=eS[tf];if(r[tp]&e4){var tm=r[tp]&e9?C:y;tu=tm!==eG?tm:eG;break}}}if(tu){if(r[eS[to]]=r[eS[ts]]=tu,tu!==eG){for(var tg=to+1;tg<eS.length;tg++)if(!(r[eS[tg]]&c)){p(e[eS[tg]])&R&&(r[eS[tg]]=tu);break}}if(tu!==eG){for(var tA=ts+1;tA<eS.length;tA++)if(!(r[eS[tA]]&c)){p(e[eS[tA]])&R&&(r[eS[tA]]=tu);break}}}}for(var tv=0;tv<eS.length;tv++)if(r[eS[tv]]&h){for(var tB=tv,ty=tv,tC=eI,tb=tv-1;tb>=0;tb--)if(r[eS[tb]]&c)tB=tb;else{tC=r[eS[tb]]&e9?C:y;break}for(var tM=eR,tx=tv+1;tx<eS.length;tx++)if(r[eS[tx]]&(h|c))ty=tx;else{tM=r[eS[tx]]&e9?C:y;break}for(var tw=tB;tw<=ty;tw++)r[eS[tw]]=tC===tM?tC:eG;tv=ty}}}for(var tE=m.start;tE<=m.end;tE++){var tF=o[tE],tT=r[tE];if(1&tF?tT&(y|b|w)&&o[tE]++:tT&C?o[tE]++:tT&(w|b)&&(o[tE]+=2),tT&c&&(o[tE]=0===tE?m.level:o[tE-1]),tE===m.end||p(e[tE])&(T|F))for(var tS=tE;tS>=0&&p(e[tS])&d;tS--)o[tS]=m.level}}return{levels:o,paragraphs:f};function tI(t,a){for(var n=t;n<e.length;n++){var i=r[n];if(i&(C|G))return 1;if(i&(F|y)||a&&i===j)break;if(i&l){var o=function(t){for(var a=1,n=t+1;n<e.length;n++){var i=r[n];if(i&F)break;if(i&j){if(0==--a)return n}else i&l&&a++}return -1}(n);n=-1===o?e.length:o}}return 0}},e.getMirroredCharacter=J,e.getMirroredCharactersMap=function(e,t,r,a){var n=e.length;r=Math.max(0,null==r?0:+r),a=Math.min(n-1,null==a?n-1:+a);for(var i=new Map,o=r;o<=a;o++)if(1&t[o]){var s=J(e[o]);null!==s&&i.set(o,s)}return i},e.getReorderSegments=N,e.getReorderedIndices=K,e.getReorderedString=function(e,t,r,a){var n=K(e,t,r,a),i=[].concat(e);return n.forEach(function(r,a){i[a]=(1&t.levels[r]?J(e[r]):null)||e[r]}),i.join("")},e.openingToClosingBracket=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}],init:(e,t,r)=>e(t,r())}),eP=ee({name:"Typesetter",dependencies:[ek],init:e=>function(t){return new Promise(r=>{e.typeset(t,r)})},getTransferables(e){let t=[];for(let r in e)e[r]&&e[r].buffer&&t.push(e[r].buffer);return t}}),eL=eP.onMainThread,eO={},eH="aTroikaGlyphIndex";class ej extends W.InstancedBufferGeometry{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new W.Sphere,this.boundingBox=new W.Box3}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){var t;let r;this._detail=e,("number"!=typeof e||e<1)&&(e=1);let a=((r=eO[t=e])||(r=eO[t]=new W.PlaneGeometry(1,1,t,t).translate(.5,.5,0)),r);["position","normal","uv"].forEach(e=>{this.attributes[e]=a.attributes[e].clone()}),this.setIndex(a.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,r,a,n){this.updateAttributeData("aTroikaGlyphBounds",e,4),this.updateAttributeData(eH,t,1),this.updateAttributeData("aTroikaGlyphColor",n,3),this._blockBounds=r,this._chunkedBounds=a,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){let e=this._blockBounds;if(e){let{curveRadius:t,boundingBox:r}=this;if(t){let{PI:a,floor:n,min:i,max:o,sin:s,cos:l}=Math,u=a/2,h=2*a,c=Math.abs(t),d=e[0]/c,f=e[2]/c,p=n((d+u)/h)!==n((f+u)/h)?-c:i(s(d)*c,s(f)*c),m=n((d-u)/h)!==n((f-u)/h)?c:o(s(d)*c,s(f)*c),g=n((d+a)/h)!==n((f+a)/h)?2*c:o(c-l(d)*c,c-l(f)*c);r.min.set(p,e[1],t<0?-g:0),r.max.set(m,e[3],t<0?0:g)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(eH).count,r=this._chunkedBounds;if(r)for(let a=r.length;a--;){t=r[a].end;let n=r[a].rect;if(n[1]<e.w&&n[3]>e.y&&n[0]<e.z&&n[2]>e.x)break}this.instanceCount=t}updateAttributeData(e,t,r){let a=this.getAttribute(e);t?a&&a.array.length===t.length?(a.array.set(t),a.needsUpdate=!0):(this.setAttribute(e,new W.InstancedBufferAttribute(t,r)),delete this._maxInstanceCount,this.dispose()):a&&this.deleteAttribute(e)}}let eJ=`
|
|
30
|
+
uniform vec2 uTroikaSDFTextureSize;
|
|
31
|
+
uniform float uTroikaSDFGlyphSize;
|
|
32
|
+
uniform vec4 uTroikaTotalBounds;
|
|
33
|
+
uniform vec4 uTroikaClipRect;
|
|
34
|
+
uniform mat3 uTroikaOrient;
|
|
35
|
+
uniform bool uTroikaUseGlyphColors;
|
|
36
|
+
uniform float uTroikaEdgeOffset;
|
|
37
|
+
uniform float uTroikaBlurRadius;
|
|
38
|
+
uniform vec2 uTroikaPositionOffset;
|
|
39
|
+
uniform float uTroikaCurveRadius;
|
|
40
|
+
attribute vec4 aTroikaGlyphBounds;
|
|
41
|
+
attribute float aTroikaGlyphIndex;
|
|
42
|
+
attribute vec3 aTroikaGlyphColor;
|
|
43
|
+
varying vec2 vTroikaGlyphUV;
|
|
44
|
+
varying vec4 vTroikaTextureUVBounds;
|
|
45
|
+
varying float vTroikaTextureChannel;
|
|
46
|
+
varying vec3 vTroikaGlyphColor;
|
|
47
|
+
varying vec2 vTroikaGlyphDimensions;
|
|
48
|
+
`,eN=`
|
|
49
|
+
vec4 bounds = aTroikaGlyphBounds;
|
|
50
|
+
bounds.xz += uTroikaPositionOffset.x;
|
|
51
|
+
bounds.yw -= uTroikaPositionOffset.y;
|
|
52
|
+
|
|
53
|
+
vec4 outlineBounds = vec4(
|
|
54
|
+
bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
|
|
55
|
+
bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
|
|
56
|
+
);
|
|
57
|
+
vec4 clippedBounds = vec4(
|
|
58
|
+
clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
|
|
59
|
+
clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
|
|
63
|
+
|
|
64
|
+
position.xy = mix(bounds.xy, bounds.zw, clippedXY);
|
|
65
|
+
|
|
66
|
+
uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
|
|
67
|
+
|
|
68
|
+
float rad = uTroikaCurveRadius;
|
|
69
|
+
if (rad != 0.0) {
|
|
70
|
+
float angle = position.x / rad;
|
|
71
|
+
position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
|
|
72
|
+
normal.xz = vec2(sin(angle), cos(angle));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
position = uTroikaOrient * position;
|
|
76
|
+
normal = uTroikaOrient * normal;
|
|
77
|
+
|
|
78
|
+
vTroikaGlyphUV = clippedXY.xy;
|
|
79
|
+
vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
|
|
83
|
+
vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
|
|
84
|
+
vec2 txStartUV = txUvPerSquare * vec2(
|
|
85
|
+
mod(floor(aTroikaGlyphIndex / 4.0), txCols),
|
|
86
|
+
floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
|
|
87
|
+
);
|
|
88
|
+
vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
|
|
89
|
+
vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
|
|
90
|
+
`,eK=`
|
|
91
|
+
uniform sampler2D uTroikaSDFTexture;
|
|
92
|
+
uniform vec2 uTroikaSDFTextureSize;
|
|
93
|
+
uniform float uTroikaSDFGlyphSize;
|
|
94
|
+
uniform float uTroikaSDFExponent;
|
|
95
|
+
uniform float uTroikaEdgeOffset;
|
|
96
|
+
uniform float uTroikaFillOpacity;
|
|
97
|
+
uniform float uTroikaBlurRadius;
|
|
98
|
+
uniform vec3 uTroikaStrokeColor;
|
|
99
|
+
uniform float uTroikaStrokeWidth;
|
|
100
|
+
uniform float uTroikaStrokeOpacity;
|
|
101
|
+
uniform bool uTroikaSDFDebug;
|
|
102
|
+
varying vec2 vTroikaGlyphUV;
|
|
103
|
+
varying vec4 vTroikaTextureUVBounds;
|
|
104
|
+
varying float vTroikaTextureChannel;
|
|
105
|
+
varying vec2 vTroikaGlyphDimensions;
|
|
106
|
+
|
|
107
|
+
float troikaSdfValueToSignedDistance(float alpha) {
|
|
108
|
+
// Inverse of exponential encoding in webgl-sdf-generator
|
|
109
|
+
|
|
110
|
+
float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
|
|
111
|
+
float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
|
|
112
|
+
float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
|
|
113
|
+
return signedDist;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
float troikaGlyphUvToSdfValue(vec2 glyphUV) {
|
|
117
|
+
vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
|
|
118
|
+
vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
|
|
119
|
+
float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
|
|
120
|
+
return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
float troikaGlyphUvToDistance(vec2 uv) {
|
|
124
|
+
return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
float troikaGetAADist() {
|
|
128
|
+
|
|
129
|
+
#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
|
|
130
|
+
return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
|
|
131
|
+
#else
|
|
132
|
+
return vTroikaGlyphDimensions.x / 64.0;
|
|
133
|
+
#endif
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
float troikaGetFragDistValue() {
|
|
137
|
+
vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
|
|
138
|
+
float distance = troikaGlyphUvToDistance(clampedGlyphUV);
|
|
139
|
+
|
|
140
|
+
// Extrapolate distance when outside bounds:
|
|
141
|
+
distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 :
|
|
142
|
+
length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
return distance;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
|
|
150
|
+
#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
|
|
151
|
+
float alpha = step(-distanceOffset, -distance);
|
|
152
|
+
#else
|
|
153
|
+
|
|
154
|
+
float alpha = smoothstep(
|
|
155
|
+
distanceOffset + aaDist,
|
|
156
|
+
distanceOffset - aaDist,
|
|
157
|
+
distance
|
|
158
|
+
);
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
return alpha;
|
|
162
|
+
}
|
|
163
|
+
`,eW=`
|
|
164
|
+
float aaDist = troikaGetAADist();
|
|
165
|
+
float fragDistance = troikaGetFragDistValue();
|
|
166
|
+
float edgeAlpha = uTroikaSDFDebug ?
|
|
167
|
+
troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
|
|
168
|
+
troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));
|
|
169
|
+
|
|
170
|
+
#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
|
|
171
|
+
vec4 fillRGBA = gl_FragColor;
|
|
172
|
+
fillRGBA.a *= uTroikaFillOpacity;
|
|
173
|
+
vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
|
|
174
|
+
if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
|
|
175
|
+
gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
|
|
176
|
+
-uTroikaStrokeWidth - aaDist,
|
|
177
|
+
-uTroikaStrokeWidth + aaDist,
|
|
178
|
+
fragDistance
|
|
179
|
+
));
|
|
180
|
+
gl_FragColor.a *= edgeAlpha;
|
|
181
|
+
#endif
|
|
182
|
+
|
|
183
|
+
if (edgeAlpha == 0.0) {
|
|
184
|
+
discard;
|
|
185
|
+
}
|
|
186
|
+
`,eV=new W.MeshBasicMaterial({color:0xffffff,side:W.DoubleSide,transparent:!0}),eX=new W.Matrix4,eQ=new W.Vector3,ez=new W.Vector3,eY=[],eZ=new W.Vector3,eq="+x+y";function e$(e){return Array.isArray(e)?e[0]:e}let e0=()=>{let e=new W.Mesh(new W.PlaneGeometry(1,1),eV);return e0=()=>e,e},e1=()=>{let e=new W.Mesh(new W.PlaneGeometry(1,1,32,1),eV);return e1=()=>e,e},e2={type:"syncstart"},e3={type:"synccomplete"},e5=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],e9=e5.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class e4 extends W.Mesh{constructor(){super(new ej,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=8421504,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=eq,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(e2),eG({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);let r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(e=>e&&e())})),this.dispatchEvent(e3),e&&e()})))}onBeforeRender(e,t,r,a,n,i){this.sync(),n.isTroikaTextMaterial&&this._prepareForRender(n)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){let t;return(t=function e(t,r){let a,n,i=(a=JSON.stringify(r,ep),null==(n=eg.get(a))&&eg.set(a,n=++em),n),o=eh.get(t);if(o||eh.set(t,o=Object.create(null)),o[i])return new o[i];let s=`_onBeforeCompile${i}`,l=function(e,a){t.onBeforeCompile.call(this,e,a);let n=this.customProgramCacheKey()+"|"+e.vertexShader+"|"+e.fragmentShader,o=ec[n];if(!o){let t=function(e,{vertexShader:t,fragmentShader:r},a,n){let{vertexDefs:i,vertexMainIntro:o,vertexMainOutro:s,vertexTransform:l,fragmentDefs:u,fragmentMainIntro:h,fragmentMainOutro:c,fragmentColorTransform:d,customRewriter:f,timeUniform:p}=a;if(i=i||"",o=o||"",s=s||"",u=u||"",h=h||"",c=c||"",(l||f)&&(t=eo(t)),(d||f)&&(r=eo(r=r.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"))),f){let e=f({vertexShader:t,fragmentShader:r});t=e.vertexShader,r=e.fragmentShader}if(d){let e=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,t=>(e.push(t),"")),c=`${d}
|
|
187
|
+
${e.join("\n")}
|
|
188
|
+
${c}`}if(p){let e=`
|
|
189
|
+
uniform float ${p};
|
|
190
|
+
`;i=e+i,u=e+u}return l&&(t=`vec3 troika_position_${n};
|
|
191
|
+
vec3 troika_normal_${n};
|
|
192
|
+
vec2 troika_uv_${n};
|
|
193
|
+
${t}
|
|
194
|
+
`,i=`${i}
|
|
195
|
+
void troikaVertexTransform${n}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
|
|
196
|
+
${l}
|
|
197
|
+
}
|
|
198
|
+
`,o=`
|
|
199
|
+
troika_position_${n} = vec3(position);
|
|
200
|
+
troika_normal_${n} = vec3(normal);
|
|
201
|
+
troika_uv_${n} = vec2(uv);
|
|
202
|
+
troikaVertexTransform${n}(troika_position_${n}, troika_normal_${n}, troika_uv_${n});
|
|
203
|
+
${o}
|
|
204
|
+
`,t=t.replace(/\b(position|normal|uv)\b/g,(e,t,r,a)=>/\battribute\s+vec[23]\s+$/.test(a.substr(0,r))?t:`troika_${t}_${n}`),e.map&&e.map.channel>0||(t=t.replace(/\bMAP_UV\b/g,`troika_uv_${n}`))),{vertexShader:t=ef(t,n,i,o,s),fragmentShader:r=ef(r,n,u,h,c)}}(this,e,r,i);o=ec[n]=t}e.vertexShader=o.vertexShader,e.fragmentShader=o.fragmentShader,el(e.uniforms,this.uniforms),r.timeUniform&&(e.uniforms[r.timeUniform]={get value(){return Date.now()-eu}}),this[s]&&this[s](e)},u=function(){return h(r.chained?t:t.clone())},h=function(e){let a,n,o,s,l=Object.create(e,c);return Object.defineProperty(l,"baseMaterial",{value:t}),Object.defineProperty(l,"id",{value:ed++}),a=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0,o=0xffffffff*Math.random()|0,s=0xffffffff*Math.random()|0,l.uuid=(es[255&a]+es[a>>8&255]+es[a>>16&255]+es[a>>24&255]+"-"+es[255&n]+es[n>>8&255]+"-"+es[n>>16&15|64]+es[n>>24&255]+"-"+es[63&o|128]+es[o>>8&255]+"-"+es[o>>16&255]+es[o>>24&255]+es[255&s]+es[s>>8&255]+es[s>>16&255]+es[s>>24&255]).toUpperCase(),l.uniforms=el({},e.uniforms,r.uniforms),l.defines=el({},e.defines,r.defines),l.defines[`TROIKA_DERIVED_MATERIAL_${i}`]="",l.extensions=el({},e.extensions,r.extensions),l._listeners=void 0,l},c={constructor:{value:u},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:e=>{t.type=e}},isDerivedFrom:{writable:!0,configurable:!0,value:function(e){let t=this.baseMaterial;return e===t||t.isDerivedMaterial&&t.isDerivedFrom(e)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+i}},onBeforeCompile:{get:()=>l,set(e){this[s]=e}},copy:{writable:!0,configurable:!0,value:function(e){return t.copy.call(this,e),t.isShaderMaterial||t.isDerivedMaterial||(el(this.extensions,e.extensions),el(this.defines,e.defines),el(this.uniforms,p.UniformsUtils.clone(e.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){return h(new t.constructor).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let a=this._depthMaterial;return a||((a=this._depthMaterial=e(t.isDerivedMaterial?t.getDepthMaterial():new p.MeshDepthMaterial({depthPacking:p.RGBADepthPacking}),r)).defines.IS_DEPTH_MATERIAL="",a.uniforms=this.uniforms),a}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let a=this._distanceMaterial;return a||((a=this._distanceMaterial=e(t.isDerivedMaterial?t.getDistanceMaterial():new p.MeshDistanceMaterial,r)).defines.IS_DISTANCE_MATERIAL="",a.uniforms=this.uniforms),a}},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:e,_distanceMaterial:r}=this;e&&e.dispose(),r&&r.dispose(),t.dispose.call(this)}}};return o[i]=u,new u}(e,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new W.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new W.Vector4(0,0,0,0)},uTroikaClipRect:{value:new W.Vector4(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new W.Vector2},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new W.Color},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new W.Matrix3},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:eJ,vertexTransform:eN,fragmentDefs:eK,fragmentColorTransform:eW,customRewriter({vertexShader:e,fragmentShader:t}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(t)&&(t=t.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(e)||(e=e.replace(ei,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:e,fragmentShader:t}}})).transparent=!0,t.forceSinglePass=!0,Object.defineProperties(t,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),t}get material(){let e=this._derivedMaterial,t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=eV.clone());if(e&&e.isDerivedFrom(t)||(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function r(){t.removeEventListener("dispose",r),e.dispose()})),!this.hasOutline())return e;{let t=e._outlineMtl;return t||((t=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}})).isTextOutlineMaterial=!0,t.depthWrite=!1,t.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),t.dispose()})),[t,e]}}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return e$(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return e$(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){let t=e.isTextOutlineMaterial,r=e.uniforms,a=this.textRenderInfo;if(a){let e,n,i,{sdfTexture:o,blockBounds:s}=a;r.uTroikaSDFTexture.value=o,r.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),r.uTroikaSDFGlyphSize.value=a.sdfGlyphSize,r.uTroikaSDFExponent.value=a.sdfExponent,r.uTroikaTotalBounds.value.fromArray(s),r.uTroikaUseGlyphColors.value=!t&&!!a.glyphColors;let l=0,u=0,h=0,c=0,d=0;if(t){let{outlineWidth:t,outlineOffsetX:r,outlineOffsetY:a,outlineBlur:n,outlineOpacity:i}=this;l=this._parsePercent(t)||0,u=Math.max(0,this._parsePercent(n)||0),e=i,c=this._parsePercent(r)||0,d=this._parsePercent(a)||0}else(h=Math.max(0,this._parsePercent(this.strokeWidth)||0))&&(i=this.strokeColor,r.uTroikaStrokeColor.value.set(null==i?8421504:i),null==(n=this.strokeOpacity)&&(n=1)),e=this.fillOpacity;r.uTroikaEdgeOffset.value=l,r.uTroikaPositionOffset.value.set(c,d),r.uTroikaBlurRadius.value=u,r.uTroikaStrokeWidth.value=h,r.uTroikaStrokeOpacity.value=n,r.uTroikaFillOpacity.value=null==e?1:e,r.uTroikaCurveRadius.value=this.curveRadius||0;let f=this.clipRect;if(f&&Array.isArray(f)&&4===f.length)r.uTroikaClipRect.value.fromArray(f);else{let e=100*(this.fontSize||.1);r.uTroikaClipRect.value.set(s[0]-e,s[1]-e,s[2]+e,s[3]+e)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;let n=t?this.outlineColor||0:this.color;if(null==n)delete e.color;else{let t=e.hasOwnProperty("color")?e.color:e.color=new W.Color;(n!==t._input||"object"==typeof n)&&t.set(t._input=n)}let i=this.orientation||eq;if(i!==e._orientation){let t=r.uTroikaOrient.value,a=(i=i.replace(/[^-+xyz]/g,""))!==eq&&i.match(/^([-+])([xyz])([-+])([xyz])$/);if(a){let[,e,r,n,i]=a;eQ.set(0,0,0)[r]="-"===e?1:-1,ez.set(0,0,0)[i]="-"===n?-1:1,eX.lookAt(eZ,eQ.cross(ez),ez),t.setFromMatrix4(eX)}else t.identity();e._orientation=i}}_parsePercent(e){if("string"==typeof e){let t=e.match(/^(-?[\d.]+)%$/),r=t?parseFloat(t[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new W.Vector2){t.copy(e);let r=this.curveRadius;return r&&(t.x=Math.atan2(e.x,Math.abs(r)-Math.abs(e.z))*Math.abs(r)),t}worldPositionToTextCoords(e,t=new W.Vector2){return eQ.copy(e),this.localPositionToTextCoords(this.worldToLocal(eQ),t)}raycast(e,t){let{textRenderInfo:r,curveRadius:a}=this;if(r){let n=r.blockBounds,i=a?e1():e0(),o=i.geometry,{position:s,uv:l}=o.attributes;for(let e=0;e<l.count;e++){let t=n[0]+l.getX(e)*(n[2]-n[0]),r=n[1]+l.getY(e)*(n[3]-n[1]),i=0;a&&(i=a-Math.cos(t/a)*a,t=Math.sin(t/a)*a),s.setXYZ(e,t,r,i)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,i.matrixWorld=this.matrixWorld,i.material.side=this.material.side,eY.length=0,i.raycast(e,eY);for(let e=0;e<eY.length;e++)eY[e].object=this,t.push(eY[e])}}copy(e){let t=this.geometry;return super.copy(e),this.geometry=t,e9.forEach(t=>{this[t]=e[t]}),this}clone(){return new this.constructor().copy(this)}}e5.forEach(e=>{let t="_private_"+e;Object.defineProperty(e4.prototype,e,{get(){return this[t]},set(e){e!==this[t]&&(this[t]=e,this._needsSync=!0)}})}),new W.Box3,new W.Color,new WeakMap,new WeakMap;var e8=e.i(90874),e6=e.i(20284);let e7=i.forwardRef(({sdfGlyphSize:e=64,anchorX:t="center",anchorY:r="middle",font:a,fontSize:n=1,children:o,characters:s,onSync:l,...h},c)=>{let d=(0,e8.useThree)(({invalidate:e})=>e),[f]=i.useState(()=>new e4),[p,m]=i.useMemo(()=>{let e=[],t="";return i.Children.forEach(o,r=>{"string"==typeof r||"number"==typeof r?t+=r:e.push(r)}),[e,t]},[o]);return(0,e6.suspend)(()=>new Promise(e=>(function({font:e,characters:t,sdfGlyphSize:r},a){eG({font:e,sdfGlyphSize:r,text:Array.isArray(t)?t.join("\n"):""+t},a)})({font:a,characters:s},e)),["troika-text",a,s]),i.useLayoutEffect(()=>void f.sync(()=>{d(),l&&l(f)})),i.useEffect(()=>()=>f.dispose(),[f]),i.createElement("primitive",(0,u.default)({object:f,ref:c,font:a,text:m,anchorX:t,anchorY:r,fontSize:n,sdfGlyphSize:e},h),p)});e.s(["Text",0,e7],16196),e.i(85269);var te=e.i(22831);let tt={mastFoot:[0,1.85,-.56],masthead:[0,17,.45],hounds:[0,16.2,.38],innerHounds:[0,12.6,.2],gooseneck:[0,2.65,-.62],boomLength:4.95,forestayTack:[0,1.5,-4.85],innerStayTack:[0,1.5,-4.3],bowsprit:[0,1.5,-6.5],backstay:{split:[0,3.4,4.75],ends:[[-1.5,1.08,5.3],[1.5,1.08,5.3]]},traveller:{z:2.3,y:.72,halfWidth:1.15},jibTrack:{zFwd:-1.9,zAft:.3},cockpitFloor:.64,mainsheetOnBoom:2.9,rudders:{port:{pivot:[-1.12,.05,4.7],axis:[-.13,-.99,0]},starboard:{pivot:[1.12,.05,4.7],axis:[.13,-.99,0]},centre:{pivot:[0,-.1,4.26],axis:[0,-1,0]}},tiller:{pivot:[0,.95,4.95],length:1.75}},tr=["J1","J2","J3","staysail","spi"],ta=180/Math.PI,tn=(e,t,r=null)=>{let a,n=Number.isFinite(e)?1.9438444924574*e:0;return a=(Number.isFinite(t)?Math.abs(t*ta):45)>=105&&n<20?"spi":n<10?"J1":n<16?"J2":n<23?"J3":"staysail",{headsail:r?.headsail&&tr.includes(r.headsail)?r.headsail:a,reef:Number.isInteger(r?.reef)?Math.max(0,Math.min(3,r.reef)):n<17?0:n<22?1:n<28?2:3}},ti=new p.Vector3(0,1,0),to=({tack:e,head:t,clew:r,headWidth:a=0,camber:n=.1,draft:i=.4,twist:o=.1,leeward:s=1,rows:l=16,cols:u=14,stripes:h=[],leechRound:c=0,footRound:d=0})=>{let f=r.clone().sub(e).clone().setY(0).normalize(),m=t.clone().addScaledVector(f,a),g=Math.log(.5)/Math.log(i),A=a=>{let n=e.clone().lerp(t,a),i=r.clone().lerp(m,a);c&&i.addScaledVector(i.clone().sub(n).normalize(),c*Math.sin(Math.PI*a));let l=i.clone().sub(n);l.applyAxisAngle(ti,-s*o*a);let u=new p.Vector3().crossVectors(ti,l).normalize();return Math.sign(u.x||1)!==Math.sign(s)&&u.negate(),{luff:n,chord:l,normal:u,len:l.length()}},v=(e,t)=>e.luff.clone().addScaledVector(e.chord,t).addScaledVector(e.normal,n*(1-.35*e.v)*e.len*Math.sin(Math.PI*t**g)).addScaledVector(ti,-d*Math.sin(Math.PI*t)*(1-e.v)**3),B=[],y=[];for(let e=0;e<=l;e++){let t={...A(e/l),v:e/l};for(let r=0;r<=u;r++){let a=v(t,r/u);B.push(a.x,a.y,a.z),y.push(r/u,e/l)}}let C=[];for(let e=0;e<l;e++)for(let t=0;t<u;t++){let r=e*(u+1)+t,a=r+u+1;C.push(r,a,r+1,r+1,a,a+1)}let b=new p.BufferGeometry;b.setAttribute("position",new p.Float32BufferAttribute(B,3)),b.setAttribute("uv",new p.Float32BufferAttribute(y,2)),b.setIndex(C),b.computeVertexNormals();let M=(e,t)=>{let r=(e*(u+1)+t)*3;return[B[r],B[r+1],B[r+2]]},x=[];for(let e=0;e<=u;e++)x.push(M(0,e));for(let e=1;e<=l;e++)x.push(M(e,u));for(let e=u-1;e>=0;e--)x.push(M(l,e));for(let e=l-1;e>=0;e--)x.push(M(e,0));return b.userData.outline=x,b.userData.stripes=h.map(e=>{let t={...A(e),v:e},r=e=>Array.from({length:21},(r,a)=>v(t,a/20).addScaledVector(t.normal,.03*e).toArray());return{v:e,frame:t,lee:r(1),windward:r(-1),deepest:v(t,i).addScaledVector(t.normal,.04),point:e=>v(t,e)}}),b};e.s(["makeSailGeometry",0,to],98392);let ts=Math.PI/180,tl=e=>new p.Vector3(...e),tu=new p.Vector3(0,1,0),th=e=>Math.min(80*ts,Math.max(4*ts,Math.abs(e||0)-26*ts)),tc=(e,t=0,r=tt.mainsheetOnBoom)=>{let a=(e||0)>=0?-1:1;return Math.max(-1*ts,Math.min(80*ts,th(e)+.8*Math.atan2((t||0)*a,r)))},td={J1:{hoist:.97,lp:1.05,clewHeight:.35,camber:.13},J2:{hoist:.95,lp:.95,clewHeight:.55,camber:.11},J3:{hoist:.82,lp:.82,clewHeight:.9,camber:.09},staysail:{hoist:.95,lp:.75,clewHeight:.7,camber:.09,inner:!0}},tf=[.25,.5,.75],tp=12*ts,tm=2*ts,tg=12*ts,tA=(e,t)=>Math.atan(4*e)*t,tv=(e,t)=>tf.map(r=>{let a=e+(tp-t)*(r-.5)*3;return a<-3*ts?"luffing":a>8*ts?"stalled":"flowing"}),tB=({geometry:e,color:t,opacity:r,edge:a,stripe:o,accent:s,label:l,labelOutline:u})=>{(0,i.useEffect)(()=>()=>e.dispose(),[e]);let h=e.userData.stripes?.[Math.floor((e.userData.stripes.length-1)/2)];return(0,n.jsxs)("group",{children:[(0,n.jsx)("mesh",{geometry:e,renderOrder:3,children:(0,n.jsx)("meshLambertMaterial",{color:t,transparent:!0,opacity:r,side:p.DoubleSide,depthWrite:!1})}),(0,n.jsx)(K.Line,{points:e.userData.outline,color:a,lineWidth:1.5,transparent:!0,opacity:.9}),e.userData.stripes?.map(e=>(0,n.jsxs)("group",{children:[(0,n.jsx)(K.Line,{points:e.lee,color:o,lineWidth:2}),(0,n.jsx)(K.Line,{points:e.windward,color:o,lineWidth:2}),(0,n.jsxs)("mesh",{position:e.deepest,renderOrder:4,children:[(0,n.jsx)("sphereGeometry",{args:[.09,10,8]}),(0,n.jsx)("meshBasicMaterial",{color:s})]})]},e.v)),l&&h&&(0,n.jsx)(N,{position:h.deepest.clone().addScaledVector(h.frame.normal,.5).toArray(),children:(0,n.jsx)(e7,{fontSize:.5,color:o,anchorX:"center",anchorY:"middle",renderOrder:10,"material-depthTest":!1,"material-transparent":!0,font:"fonts/Roboto-Bold.ttf",outlineWidth:.04,outlineColor:u,children:l})})]})},ty=({geometry:e,at:t,states:r,colors:a})=>(0,n.jsx)("group",{children:e.userData.stripes.map((e,i)=>{let o=e.point(t);return[1,-1].map(t=>{var s,l,u;let h,c,d,f;return(0,n.jsx)(K.Line,{points:(s=e.frame.chord,l=e.frame.normal,u=r[i],c=s.clone().normalize(),(h="flowing"===u?c.clone().addScaledVector(tu,-.08):"luffing"===u&&t<0||"stalled"===u&&t>0?c.clone().multiplyScalar(-.2).addScaledVector(tu,t<0?.9:-.9).addScaledVector(l,.4*t):c.clone().addScaledVector(tu,-.15)).normalize(),d=o.clone().addScaledVector(l,.05*t),f="flowing"===u?.02:.08,[0,1,2,3].map(e=>d.clone().addScaledVector(h,e/3).addScaledVector(l,t*f*Math.sin(1.7*e)).toArray())),color:t>0?a.lee:a.windward,lineWidth:5},`${e.v}${t}`)})})}),tC=({awa:e=.6,boomAngle:t,sails:r,trim:a,mainCarAt:o,jibCarAt:s,rig:l=tt})=>{let u=(0,M.default)(),{t:h}=(0,te.useTranslation)(),{scene:c,accent:d}=u,f=(e||0)>=0?-1:1,m=t??th(e)*f,g=r?.reef??0,A=r?.headsail??"J2",v=a?.trimState?.jibCar??.5,B=a?.trimState?.tension??.5,y=(e,t)=>e*(.55+.8*(t??.55)),C=y(.11,a?.mainCamber),b=(2+20*(1-B))*ts,w=td[A]||td.J2,E=y(w.camber,a?.jibCamber),F=(2+20*v)*ts,T=Math.abs(e||0),S=tA(E,.7),I=Math.max(7*ts,Math.min(40*ts,T-S-tm)),R=(0,i.useMemo)(()=>{let t,r=tl(l.gooseneck),a=new p.Vector3(0,0,1).applyAxisAngle(tu,m),n=r.clone().addScaledVector(a,l.boomLength-.15).add(new p.Vector3(0,.12,0)),i=tl(l.masthead).sub(tl(l.mastFoot)).normalize(),o=tl(l.masthead).addScaledVector(i,-.25-1.35*g),s=to({tack:r.clone().add(new p.Vector3(0,.15,0)),head:o,clew:n,headWidth:0===g?.9:.5,camber:C,draft:.45,twist:b,leeward:f,stripes:tf}),u=null;if("spi"===A){let r=tl(l.bowsprit),a=tl(l.hounds).add(new p.Vector3(0,-.3,-.1)),n=Math.min(1,Math.abs(e||0)/Math.PI),i=l.spiClew??{out:4.2,y:2.6,z:1.8};t=to({tack:r,head:a,clew:new p.Vector3(f*(i.out+1.5*n),i.y,i.z-1.5*n),headWidth:.6,camber:.34,draft:.45,twist:.2,leeward:f,leechRound:2.2,footRound:.9,rows:20,cols:18,stripes:tf})}else{let e=tl(w.inner?l.innerStayTack:l.forestayTack),r=tl(w.inner?l.innerHounds:l.hounds),a=e.clone().lerp(r,w.hoist),n=(Math.abs(r.z-e.z)||6)*w.lp;u=new p.Vector3(f*Math.tan(I)*n,e.y+w.clewHeight,e.z+n),t=to({tack:e,head:a,clew:u,camber:E,draft:.38,twist:F,leeward:f,stripes:tf})}return{main:s,fore:t,clew:n,gooseneck:r,jibClew:u}},[e,m,g,A,f,w,C,b,E,F,I,l]),G=tv(T+tp/2-(I+F/2+S),F),D=tv(T-tg+tp/2-(Math.abs(m)+b/2+tA(C,.5)),b),U=e=>{let{r:t,g:r,b:a}=(0,x.tensionToColor)(e??.3);return`#${(0,L.tintForTheme)(u,new p.Color(t,r,a)).getHexString()}`},_={lee:f>0?c.laylineStarboard:c.laylinePort,windward:f>0?c.laylinePort:c.laylineStarboard},k=tl(l.mastFoot).add(new p.Vector3(0,.3,.15)),P=R.gooseneck.clone().lerp(R.clew,.3),O=R.gooseneck.clone().add(new p.Vector3(0,0,l.mainsheetOnBoom).applyAxisAngle(tu,m)),H=o??[0,l.traveller.y+.2,l.traveller.z],j=e=>Math.round(100*e),J="spi"===A,N=l.backstay&&[[l.masthead,l.backstay.split],...l.backstay.ends.map(e=>[l.backstay.split,e])];return(0,n.jsxs)("group",{children:[(0,n.jsx)(tB,{geometry:R.main,color:c.sail,opacity:.85,edge:c.rigging,stripe:c.compass,accent:d,labelOutline:c.background,label:`${h("hud.sailDepth")} ${j(C)}%`}),(0,n.jsx)(tB,{geometry:R.fore,color:J?c.route:c.sail,opacity:J?.7:.85,edge:J?c.route:c.rigging,stripe:c.compass,accent:d,labelOutline:c.background,label:J?null:`${h("hud.sailDepth")} ${j(E)}%`}),!J&&(0,n.jsx)(ty,{geometry:R.fore,at:.12,states:G,colors:_}),(0,n.jsx)(ty,{geometry:R.main,at:.97,states:D,colors:_}),R.jibClew&&s&&(0,n.jsx)(K.Line,{points:[R.jibClew.toArray(),s],color:U(a?.tensions?.jibSheet),lineWidth:2.5}),N&&N.map((e,t)=>(0,n.jsx)(K.Line,{points:e,color:U(a?.tensions?.backstay),lineWidth:2.5},t)),(0,n.jsx)(K.Line,{points:[k.toArray(),P.toArray()],color:U(a?.tensions?.vang),lineWidth:2.5}),(0,n.jsx)(K.Line,{points:[O.toArray(),H],color:U(a?.tensions?.mainSheet),lineWidth:2.5})]})};var tb=e.i(68911);let tM=i.forwardRef(function({args:[e=1,t=1,r=1]=[],radius:a=.05,steps:n=1,smoothness:o=4,bevelSegments:s=4,creaseAngle:l=.4,children:h,...c},d){return i.createElement("mesh",(0,u.default)({ref:d},c),i.createElement(tx,{args:[e,t,r],radius:a,steps:n,smoothness:o,bevelSegments:s,creaseAngle:l}),h)}),tx=i.forwardRef(function({args:[e=1,t=1,r=1]=[],radius:a=.05,steps:n=1,smoothness:o=4,bevelSegments:s=4,creaseAngle:l=.4,...h},c){let d=i.useMemo(()=>{let r,n;return r=new p.Shape,n=a-1e-5,r.absarc(1e-5,1e-5,1e-5,-Math.PI/2,-Math.PI,!0),r.absarc(1e-5,t-2*n,1e-5,Math.PI,Math.PI/2,!0),r.absarc(e-2*n,t-2*n,1e-5,Math.PI/2,0,!0),r.absarc(e-2*n,1e-5,1e-5,0,-Math.PI/2,!0),r},[e,t,a]),f=i.useMemo(()=>({depth:r-2*a,bevelEnabled:!0,bevelSegments:2*s,steps:n,bevelSize:a-1e-5,bevelThickness:a,curveSegments:o}),[r,a,o,s,n]),m=i.useRef(null);return i.useLayoutEffect(()=>{m.current&&(m.current.center(),(0,tb.toCreasedNormals)(m.current,l))},[d,f,l]),i.useImperativeHandle(c,()=>m.current),i.createElement("extrudeGeometry",(0,u.default)({ref:m,args:[d,f]},h))});function tw(e){let t,r,a,n=-1,i=0;for(let o=0;o<e.length;++o){let s=e[o];if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=s.itemSize),r!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===a&&(a=s.normalized),a!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===n&&(n=s.gpuType),n!==s.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;i+=s.count*r}let o=new t(i),s=new p.BufferAttribute(o,r,a),l=0;for(let t=0;t<e.length;++t){let a=e[t];if(a.isInterleavedBufferAttribute){let e=l/r;for(let t=0,n=a.count;t<n;t++)for(let n=0;n<r;n++){let r=a.getComponent(t,n);s.setComponent(t+e,n,r)}}else o.set(a.array,l);l+=a.count*r}return void 0!==n&&(s.gpuType=n),s}let tE=e=>(function(e,t=!1){let r=null!==e[0].index,a=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),i={},o={},s=e[0].morphTargetsRelative,l=new p.BufferGeometry,u=0;for(let h=0;h<e.length;++h){let c=e[h],d=0;if(r!==(null!==c.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let e in c.attributes){if(!a.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===i[e]&&(i[e]=[]),i[e].push(c.attributes[e]),d++}if(d!==a.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(s!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let e in c.morphAttributes){if(!n.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(c.morphAttributes[e])}if(t){let e;if(r)e=c.index.count;else{if(void 0===c.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;e=c.attributes.position.count}l.addGroup(u,e,h),u+=e}}if(r){let t=0,r=[];for(let a=0;a<e.length;++a){let n=e[a].index;for(let e=0;e<n.count;++e)r.push(n.getX(e)+t);t+=e[a].attributes.position.count}l.setIndex(r)}for(let e in i){let t=tw(i[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(let e in o){let t=o[e][0].length;if(0!==t){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let r=0;r<t;++r){let t=[];for(let a=0;a<o[e].length;++a)t.push(o[e][a][r]);let a=tw(t);if(!a)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(a)}}}return l})(e.map(e=>{let t=e.index?e.toNonIndexed():e;return t.attributes.uv&&t.deleteAttribute("uv"),t})),tF=e=>e*e*(3-2*e),tT=e=>Math.max(0,Math.min(1,e)),tS=e=>t=>{if(t<=e[0][0])return e[0][1];for(let r=1;r<e.length;r++){let[a,n]=e[r];if(t<=a){let[i,o]=e[r-1];return o+(n-o)*(t-i)/(a-i)}}return e[e.length-1][1]},tI=(e,t)=>{for(let r=1;r<e.length;r++)if(e[r][1]>=t){let[a,n]=e[r-1],[i,o]=e[r],s=[a+(i-a)*tT((t-n)/(o-n||1)),t];return[[...e.slice(0,r),s],[s,...e.slice(r)]]}return[e,[e[e.length-1],e[e.length-1]]]},tR=(e,t)=>{let r=[0];for(let t=1;t<e.length;t++)r.push(r[t-1]+Math.hypot(e[t][0]-e[t-1][0],e[t][1]-e[t-1][1]));let a=r[r.length-1]||1,n=[],i=1;for(let o=0;o<t;o++){let s=a*o/(t-1);for(;i<e.length-1&&r[i]<s;)i++;let l=tT((s-r[i-1])/(r[i]-r[i-1]||1));n.push([e[i-1][0]+(e[i][0]-e[i-1][0])*l,e[i-1][1]+(e[i][1]-e[i-1][1])*l])}return n},tG=(e,t=!1)=>{let r=[],a=e.length,n=e[0].pts.length;for(let t of e)for(let e of t.pts)r.push(e[0],e[1],e[2]??t.z);let i=[];for(let e=0;e<a-1;e++)for(let r=0;r<n-1;r++){let a=e*n+r,o=a+n;t?i.push(a,o,a+1,a+1,o,o+1):i.push(a,a+1,o,a+1,o+1,o)}let o=new p.BufferGeometry;return o.setAttribute("position",new p.Float32BufferAttribute(r,3)),o.setIndex(i),o.computeVertexNormals(),o},tD=e=>tE([e,(e=>{let t=e.index?e.clone():e.clone().setIndex(Array.from({length:e.attributes.position.count},(e,t)=>t));t.scale(-1,1,1);let r=t.getIndex().array.slice();for(let e=0;e<r.length;e+=3)[r[e+1],r[e+2]]=[r[e+2],r[e+1]];return t.setIndex(Array.from(r)),t.computeVertexNormals(),t})(e)]),tU=(e,t,r=!1)=>{let a=new p.ShapeGeometry(new p.Shape(e.map(([e,t])=>new p.Vector2(e,t))));if(r&&a.scale(1,1,-1),a.translate(0,0,t),r){let e=a.getIndex().array.slice();for(let t=0;t<e.length;t+=3)[e[t+1],e[t+2]]=[e[t+2],e[t+1]];a.setIndex(Array.from(e))}return a.deleteAttribute("uv"),a.computeVertexNormals(),a},t_=(e,t,r,a=r,n=10)=>{let i=new p.Vector3(...e),o=new p.Vector3(...t),s=i.distanceTo(o),l=new p.CylinderGeometry(a,r,s,n);l.translate(0,s/2,0);let u=o.clone().sub(i).normalize();return l.applyQuaternion(new p.Quaternion().setFromUnitVectors(new p.Vector3(0,1,0),u)),l.translate(i.x,i.y,i.z),l},tk=(e,t,r=12)=>{let a=[];for(let n=0;n<=r;n++){let i=(1-Math.cos(Math.PI*n/r))/2,o=5*t*(.2969*Math.sqrt(i)-.126*i-.3516*i*i+.2843*i**3-.1036*i**4);a.push([o*e,i*e])}return[...a,...a.slice(1,-1).reverse().map(([e,t])=>[-e,t])]},tP=(e,t,r)=>{let a=tk(e.chord,r),n=tk(t.chord,r),i=[];for(let[r,o]of[[a,e],[n,t]])for(let[e,t]of r)i.push((o.x??0)+e,o.y,o.lead+t);let o=a.length,s=[];for(let e=0;e<o;e++){let t=(e+1)%o;s.push(e,o+e,t,t,o+e,o+t)}let l=new p.BufferGeometry;return l.setAttribute("position",new p.Float32BufferAttribute(i,3)),l.setIndex(s),l.computeVertexNormals(),l};e.s(["bothSides",0,tD,"cap",0,tU,"clamp01",0,tT,"foil",0,tP,"loft",0,tG,"merge",0,tE,"resample",0,tR,"smooth",0,tF,"splitAt",0,tI,"table",0,tS,"tube",0,t_],8066);let tL=e=>-5.4+10.8*e,tO=tS([[0,.05],[.05,.34],[.1,.62],[.15,.87],[.2,1.08],[.3,1.42],[.4,1.66],[.5,1.83],[.6,1.94],[.7,1.99],[.8,2],[.9,1.98],[1,1.92]]),tH=tS([[0,.08],[.05,-.01],[.1,-.11],[.15,-.2],[.2,-.28],[.3,-.39],[.4,-.45],[.5,-.47],[.6,-.45],[.7,-.38],[.8,-.28],[.9,-.14],[.95,-.06],[1,.02]]),tj=e=>1.48-.12*e-.32*e*e,tJ=[[0,0],[.1,.53],[.25,.68],[.45,.77],[.7,.87],[1,.95]],tN=(e,t)=>{let r=(e+5.4)/10.8;return r>=.18?0:.22*tT((t-.1)/1.38)*(1-r/.18)**2},tK=e=>{let t=e.attributes.position;for(let e=0;e<t.count;e++)t.setZ(e,t.getZ(e)+tN(t.getZ(e),t.getY(e)));return t.needsUpdate=!0,e.computeVertexNormals(),e},tW=e=>{let t=tO(e),r=tH(e),a=Math.max(.25+.15*e*e,r+.1),n=tJ.map(([e,n])=>[n*t,r+e*(a-r)]);return n.push([.985*t,a+.45*(tj(e)-a)],[t,tj(e)]),n},tV=(e,t)=>{let r=tW(e).slice(tJ.length-1);for(let e=1;e<r.length;e++)if(t<=r[e][1]){let[a,n]=r[e-1],[i,o]=r[e];return a+(i-a)*tT((t-n)/(o-n))}return r[r.length-1][0]},tX=Array.from({length:49},(e,t)=>.35*tF(t/48)+t/48*.65),tQ=e=>.66-.06*tT((e-.6)/.4),tz=e=>1.4+.15*tT((e-.6)/.4),tY=e=>{let t=.998*tO(e),r=tj(e);if(e<.6)return[0,.15,.3,.45,.6,.75,.88,1].map(e=>[e*t,r+.06*(1-(e*t/Math.max(t,.01))**2)]);let a=tQ(e),n=tz(e),i=r+.12+.26*tF(tT((1-e)/.4));return[[0,a],[.5,a+.01],[1,a+.04],[n-.06,a+.1],[n-.02,i],[n+.08,i-.02],[n+.14,r+.04],[t,r]]},tZ=tS([[.28,1.45],[.32,1.58],[.37,1.69],[.43,1.76],[.5,1.77],[.6,1.74]]),tq=tS([[.28,.85],[.38,1.12],[.48,1.28],[.6,1.4]]),t$=e=>{let t=tq(e),r=tj(e)+.03,a=Math.max(r,tZ(e)),n=a-r;return[[0,a+.02],[.45*t,a+.01],[t-.32,a-.05*n],[t-.12,a-.35*n],[t,r]]},t0=Array.from({length:25},(e,t)=>.28+t/24*(.6-.28)),t1=(e,t,r=.012)=>{let a=t$(e),n=Math.min(Math.floor(t),a.length-2),i=t-n,[o,s]=a[n],[l,u]=a[n+1],h=u-s,c=-(l-o),d=Math.hypot(h,c)||1;return[o+(l-o)*i-h/d*r,s+(u-s)*i-c/d*r]},t2=()=>{let e=tP({y:-.3,lead:-.2,chord:.82},{y:-1.9,lead:-.07,chord:.7},.12),t=[];for(let e=0;e<=16;e++){let r=e/16,a=.21*Math.sin(Math.PI*Math.min(1,r**.8))**.8;t.push(new p.Vector2(Math.max(a,.001),-2.3*r))}let r=new p.LatheGeometry(t,18);return r.rotateX(-Math.PI/2),r.scale(1,.75,1),r.translate(0,-1.93,-.85),tE([e,r])},t3=({pivot:e,axis:t})=>{let r=tP({y:0,lead:-.09,chord:.36},{y:-1.28,lead:-.04,chord:.24},.11);return r.applyQuaternion(new p.Quaternion().setFromUnitVectors(new p.Vector3(0,-1,0),new p.Vector3(...t).normalize())),r.translate(...e),r},t5=e=>tO(tT((e+5.4)/10.8)),t9=(e,t)=>{let r=tT((t+5.4)/10.8),a=tY(r),n=Math.abs(e);for(let e=1;e<a.length;e++)if(n<=a[e][0]){let[t,r]=a[e-1],[i,o]=a[e];return r+(o-r)*tT((n-t)/(i-t||1))}return tj(r)},t4=null,t8=new WeakMap,t6=(e=tt,t={edgeAt:t5,heightAt:t9})=>{if(t8.has(e))return t8.get(e);let r=(e,r)=>new p.Vector3(e,t.heightAt(e,r),r),a=e.traveller,n=e.jibTrack,i=e=>a=>{let i=n.zFwd+(n.zAft-n.zFwd)*a;return r(e*(Number.isFinite(n.x)?n.x:t.edgeAt(i)-(n.inset??.45)),i)},o={traveller:e=>r((2*e-1)*a.halfWidth,a.z),jib:{1:i(1),[-1]:i(-1)}};return t8.set(e,o),o},t7=(e,t,r)=>e(t).add(new p.Vector3(0,r,0)),re=(e,t)=>{let r=e(Math.max(0,t-.01)),a=e(Math.min(1,t+.01));return Math.atan2(a.x-r.x,a.z-r.z)},rt=({path:e,color:t,tickColor:r})=>{let a,o=(a=(0,i.useMemo)(()=>{let t=Array.from({length:17},(t,r)=>t7(e,r/16,.03));return new p.TubeGeometry(new p.CatmullRomCurve3(t),32,.03,8,!1)},[e,.03]),(0,i.useEffect)(()=>()=>a.dispose(),[a]),a),s=Math.floor(t7(e,0,0).distanceTo(t7(e,1,0))/.25);return(0,n.jsxs)("group",{children:[(0,n.jsx)("mesh",{geometry:o,children:(0,n.jsx)("meshStandardMaterial",{color:t,roughness:.35,metalness:.6})}),[0,1].map(r=>(0,n.jsxs)("mesh",{position:t7(e,r,.03),children:[(0,n.jsx)("sphereGeometry",{args:[.054,12,8]}),(0,n.jsx)("meshStandardMaterial",{color:t,roughness:.35,metalness:.6})]},r)),Array.from({length:s+1},(t,a)=>{let i=s?a/s:0,o=1e-6>Math.abs(i-.5);return(0,n.jsxs)("mesh",{position:t7(e,i,.012),rotation:[0,re(e,i),0],children:[(0,n.jsx)("boxGeometry",{args:[o?.34:.2,.012,.025]}),(0,n.jsx)("meshBasicMaterial",{color:r})]},a)})]})},rr=({position:e,yaw:t,size:r,color:a,opacity:i=1})=>(0,n.jsxs)("group",{position:e,rotation:[0,t,0],children:[(0,n.jsx)(tM,{args:r,radius:.35*Math.min(...r),smoothness:3,position:[0,r[1]/2,0],children:(0,n.jsx)("meshStandardMaterial",{color:a,roughness:.4,transparent:i<1,opacity:i})}),(0,n.jsxs)("mesh",{position:[0,r[1]+.06,0],rotation:[0,0,Math.PI/2],children:[(0,n.jsx)("cylinderGeometry",{args:[.07,.07,.05,16]}),(0,n.jsx)("meshStandardMaterial",{color:a,roughness:.4,transparent:i<1,opacity:i})]})]}),ra=(e,t=t6())=>t7(t.traveller,e,.22).toArray(),rn=(e,t,r=t6())=>t7(r.jib[e],t,.22).toArray(),ri=({mainCar:e=.5,jibCar:t=.5,leeward:r=-1,layout:a=t6()})=>{let{scene:i,accent:o}=(0,M.default)();return(0,n.jsxs)("group",{children:[(0,n.jsx)(rt,{path:a.traveller,color:i.rigging,tickColor:i.compass}),(0,n.jsx)(rr,{position:t7(a.traveller,e??.5,.03),yaw:Math.PI/2,size:[.42,.13,.26],color:o}),[1,-1].map(e=>{let s=a.jib[e],l=e===r,u=t??.5;return(0,n.jsxs)("group",{children:[(0,n.jsx)(rt,{path:s,color:i.rigging,tickColor:i.compass}),(0,n.jsx)(rr,{position:t7(s,u,.03),yaw:re(s,u),size:[.2,.12,.4],color:l?o:i.markerDim,opacity:l?1:.7})]},e)})]})},ro=Math.PI/180,rs=35*ro,rl=({rudder:e=0})=>{let{t:t}=(0,te.useTranslation)(),{scene:r,accent:a}=(0,M.default)(),{pivot:i,length:o}=tt.tiller,s=Math.max(-rs,Math.min(rs,e)),l=Math.round(Math.abs(e)/ro),u=tt.cockpitFloor-i[1]+.02,h=[];for(let e=-35;e<=35;e+=5){let t=e*ro,a=e%10==0;h.push((0,n.jsxs)("mesh",{position:[-Math.sin(t)*(o-.05),u,-Math.cos(t)*(o-.05)],rotation:[0,t,0],children:[(0,n.jsx)("boxGeometry",{args:[.05,.02,a?.3:.15]}),(0,n.jsx)("meshBasicMaterial",{color:0===e?r.compass:r.compassDim})]},e))}return(0,n.jsxs)("group",{position:i,children:[(0,n.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,u,0],children:[(0,n.jsx)("ringGeometry",{args:[o-.08,o+.06,48,1,Math.PI/2-rs,2*rs]}),(0,n.jsx)("meshBasicMaterial",{color:r.compassDim,transparent:!0,opacity:.7,depthWrite:!1})]}),h,(0,n.jsxs)("group",{rotation:[0,s,0],children:[(0,n.jsxs)("mesh",{position:[0,0,-o/2],rotation:[Math.PI/2,0,0],children:[(0,n.jsx)("cylinderGeometry",{args:[.07,.09,o,12]}),(0,n.jsx)("meshLambertMaterial",{color:a})]}),(0,n.jsxs)("mesh",{position:[0,0,-o],children:[(0,n.jsx)("sphereGeometry",{args:[.13,14,10]}),(0,n.jsx)("meshLambertMaterial",{color:a})]}),(0,n.jsx)(N,{position:[0,.45,-o],children:(0,n.jsx)(e7,{fontSize:.55,color:a,anchorX:"center",anchorY:"bottom",font:"fonts/Roboto-Bold.ttf",outlineWidth:.03,outlineColor:r.background,children:0===l?"0°":`${l}\xb0 ${t(e>0?"hud.starboardShort":"hud.portShort")}`})})]})]})},ru=["keel_single_twinrudder","keel_single_singlerudder"],rh="#262c33",rc={mastFoot:[0,1.5,-1.85],masthead:[0,22.5,-1.5],hounds:[0,21.6,-1.52],innerHounds:[0,17,-1.6],gooseneck:[0,2.95,-1.75],boomLength:6.4,forestayTack:[0,1.5,-5.5],innerStayTack:[0,1.6,-3.8],bowsprit:[0,1.45,-7.8],traveller:{z:4.15,y:2.7,halfWidth:2.4},jibTrack:{x:2.45,zFwd:-4.6,zAft:-2.2},mainsheetOnBoom:5.9,spiClew:{out:6.5,y:3.2,z:4.5},rudders:{port:{pivot:[-2.9,.05,6.35],axis:[0,-1,0]},starboard:{pivot:[2.9,.05,6.35],axis:[0,-1,0]}}};var rd=p;let rf=new rd.Vector3;function rp(e,t,r,a,n,i){let o=2*Math.PI*n/4,s=Math.max(i-2*n,0),l=Math.PI/4;rf.copy(t),rf[a]=0,rf.normalize();let u=.5*o/(o+s),h=1-rf.angleTo(e)/l;return 1===Math.sign(rf[r])?h*u:s/(o+s)+u+u*(1-h)}class rm extends rd.BoxGeometry{constructor(e=1,t=1,r=1,a=2,n=.1){const i=2*a+1;if(n=Math.min(e/2,t/2,r/2,n),super(1,1,1,i,i,i),this.type="RoundedBoxGeometry",this.parameters={width:e,height:t,depth:r,segments:a,radius:n},1===i)return;const o=this.toNonIndexed();this.index=null,this.attributes.position=o.attributes.position,this.attributes.normal=o.attributes.normal,this.attributes.uv=o.attributes.uv;const s=new rd.Vector3,l=new rd.Vector3,u=new rd.Vector3(e,t,r).divideScalar(2).subScalar(n),h=this.attributes.position.array,c=this.attributes.normal.array,d=this.attributes.uv.array,f=h.length/6,p=new rd.Vector3,m=.5/i;for(let a=0,i=0;a<h.length;a+=3,i+=2)switch(s.fromArray(h,a),l.copy(s),l.x-=Math.sign(l.x)*m,l.y-=Math.sign(l.y)*m,l.z-=Math.sign(l.z)*m,l.normalize(),h[a+0]=u.x*Math.sign(s.x)+l.x*n,h[a+1]=u.y*Math.sign(s.y)+l.y*n,h[a+2]=u.z*Math.sign(s.z)+l.z*n,c[a+0]=l.x,c[a+1]=l.y,c[a+2]=l.z,Math.floor(a/f)){case 0:p.set(1,0,0),d[i+0]=rp(p,l,"z","y",n,r),d[i+1]=1-rp(p,l,"y","z",n,t);break;case 1:p.set(-1,0,0),d[i+0]=1-rp(p,l,"z","y",n,r),d[i+1]=1-rp(p,l,"y","z",n,t);break;case 2:p.set(0,1,0),d[i+0]=1-rp(p,l,"x","z",n,e),d[i+1]=rp(p,l,"z","x",n,r);break;case 3:p.set(0,-1,0),d[i+0]=1-rp(p,l,"x","z",n,e),d[i+1]=1-rp(p,l,"z","x",n,r);break;case 4:p.set(0,0,1),d[i+0]=1-rp(p,l,"x","y",n,e),d[i+1]=1-rp(p,l,"y","x",n,t);break;case 5:p.set(0,0,-1),d[i+0]=rp(p,l,"x","y",n,e),d[i+1]=1-rp(p,l,"y","x",n,t)}}static fromJSON(e){return new rm(e.width,e.height,e.depth,e.segments,e.radius)}}e.s(["RoundedBoxGeometry",0,rm],34297);let rg=e=>-7+14*e,rA=Array.from({length:41},(e,t)=>t/40),rv=tS([[0,.04],[.06,.3],[.15,.52],[.3,.66],[.5,.72],[.8,.72],[1,.68]]),rB=tS([[0,.05],[.05,-.2],[.15,-.45],[.4,-.6],[.7,-.55],[.9,-.35],[1,-.12]]),ry=e=>1.6-.15*e,rC=e=>{let t=rv(e),r=rB(e),a=ry(e);return[[0,r],[.45*t,r+.12],[.8*t,r+.38],[.93*t,Math.min(.2,a)],[.98*t,.6*a],[t,a]]},rb=(e,t)=>{let r=new p.Shape(e.map(([e,t])=>new p.Vector2(-e,t))),a=new p.ExtrudeGeometry(r,{depth:t,bevelEnabled:!1});return a.rotateY(Math.PI/2),a.translate(-t/2,0,0),a},rM=-1.75,rx=2.6,rw=1.1,rE=5,rF=5.9,rT=({pivot:e})=>{let t=tP({y:0,lead:-.12,chord:.45},{y:-1.1,lead:-.06,chord:.3},.11);return t.translate(...e),t},rS=(e,t)=>{let r=rC(e);for(let e=1;e<r.length;e++)if(t<=r[e][1]){let[a,n]=r[e-1],[i,o]=r[e];return a+(i-a)*tT((t-n)/(o-n||1))}return r[r.length-1][0]},rI=e=>2.9-rv(tT((e+7)/14))+.45,rR=(e,t)=>{if(Math.abs(e)<=rE/2&&t>=rx&&t<=rF+.3)return 1.5+rw+.1;if(Math.abs(e)<=rE/2&&t>=rM+1.3&&t<rx)return 1.5+rw;let r=tT((t+7)/14);return Math.abs(Math.abs(e)-2.9)<=rv(r)?ry(r)+.02:1.5},rG=null,rD="#262c33",rU={racer:({hullColor:e,alert:t=!1,windData:r,trim:a,showSail:o=!0})=>{let u=(0,i.useMemo)(()=>(()=>{let e,t,r,a,n,i,o;if(t4)return t4;let s=e=>({geometry:e}),{hull:l,bottom:u}=(()=>{let e=[],t=[],r=[];for(let a of tX){let n=tL(a),i=tW(a),o=i.slice(0,tJ.length),s=i.slice(tJ.length-1),[l,u]=tI(o,.12);e.push({z:n,pts:tR(l,7)}),t.push({z:n,pts:tR(u,3)}),r.push({z:n,pts:tR(s,4)})}let a=tW(1),[n]=tI(a,.12),i=tj(1),o=tO(1),s=tz(1),l=[...a,...[[o,i],[s+.1,i+.04],[s,tQ(1)+.04],[0,tQ(1)]].slice(1)],u=[...l,...l.slice(0,-1).reverse().map(([e,t])=>[-e,t])],h=[...n,...n.slice(0,-1).reverse().map(([e,t])=>[-e,t])];return{hull:tE([tD(tG(t)),tD(tG(r)),tU(u,tL(1))]),bottom:tE([tD(tG(e)),tU(h,tL(1)+.002)])}})();return t4={hull:s(tK(l)),bottom:s(u),deck:s(tK(tD(tG([...new Set([...tX.filter(e=>e<.6),.596,.6,...tX.filter(e=>e>.6)])].sort((e,t)=>e-t).map(e=>({z:tL(e),pts:tY(e)})),!0)))),roof:s((e=tD(tG(t0.map(e=>({z:tL(e),pts:t$(e)})),!0)),tE([e,tU([...(t=t$(.6)).slice().reverse().map(([e,t])=>[-e,t]),...t.slice(1)],tL(.6))]))),glass:s((r=tG(Array.from({length:9},(e,t)=>.298+t/8*(.41-.298)).map(e=>({z:tL(e),pts:[0,1,1.8,2.5].map(t=>t1(e,t))})),!0),a=tG(Array.from({length:9},(e,t)=>.42+t/8*(.585-.42)).map((e,t)=>{let r=.35*Math.min(1,t/2,(8-t)/2);return{z:tL(e),pts:[t1(e,3.5-r),t1(e,3.05+.4*r)]}}),!0),n=tG(Array.from({length:21},(e,t)=>.26+t/20*.48).map((e,t)=>{let r=Math.min(1,t/1.5,(20-t)/1.5),a=.8+.1*(1-r),n=1-.1*(1-r);return{z:tL(e),pts:[[tV(e,a)+.012,a],[tV(e,n)+.012,n]]}})),tE([tD(r),tD(a),tD(n)]))),ports:s((()=>{let e=[];for(let[t,r]of[[.36,.43],[.5,.6]]){let a=Array.from({length:6},(e,a)=>t+a/5*(r-t));e.push(tG(a.map(e=>({z:tL(e),pts:[[tV(e,.86)+.02,.86],[tV(e,.94)+.02,.94]]}))))}return tD(tE(e))})()),stripes:s(tK((i=tX.slice(1).map(e=>{let t=tj(e);return{z:tL(e),pts:[[tV(e,t-.09)+.006,t-.09],[tV(e,t-.035)+.006,t-.035]]}}),o=tX.slice(1).map(e=>{let[,t]=tI(tW(e).slice(0,tJ.length),.12),[r,a]=t[0],[n,i]=t[1],o=.06/Math.max(.01,i-a);return{z:tL(e),pts:[[r+.006,a],[r+(n-r)*Math.min(1,o)+.006,a+(i-a)*Math.min(1,o)]]}}),tD(tE([tG(i),tG(o)]))))),rig:s((()=>{let e=tt.mastFoot,t=tt.masthead,r=[t_(e,t,.11,.06,14)],a=r=>{let a=(r-e[1])/(t[1]-e[1]);return[0,r,e[2]+(t[2]-e[2])*a]},n=[tO(.53)-.08,tj(.53)+.02,tL(.53)];for(let e of[-1,1]){let t=a(6),i=a(10.1),o=[.95*e,6,t[2]+.35],s=[.6*e,10.1,i[2]+.22];r.push(t_(t,o,.035),t_(i,s,.03));let l=[e*n[0],n[1],n[2]];r.push(t_(l,o,.012),t_(o,s,.012),t_(s,tt.hounds,.012)),r.push(t_(l,a(6),.01))}return r.push(t_(tt.forestayTack,tt.hounds,.012)),r.push(t_([0,1.47,-4.2],tt.bowsprit,.06,.04)),tE(r)})()),boom:s(t_(tt.gooseneck,[tt.gooseneck[0],tt.gooseneck[1],tt.gooseneck[2]+tt.boomLength],.085,.06,12)),keel_single_twinrudder:s(t2()),keel_single_twinrudder_rudder_port:s(t3(tt.rudders.port)),keel_single_twinrudder_rudder_starboard:s(t3(tt.rudders.starboard)),keel_single_singlerudder:s(t2()),keel_single_singlerudder_rudder_centre:s(t3(tt.rudders.centre))}})(),[]),h=(0,i.useMemo)(()=>{let e,t;return t=(e=tX.map(e=>{let t=tj(e)+.02;return[tO(e)+.01,t,tL(e)+tN(tL(e),t)]})).map(([e,t,r])=>[-e,t,r]).reverse(),[...e,...t,e[0]]},[]),{scene:c}=(0,M.default)(),d=ru.includes(l.default.get("rmKeel"))?l.default.get("rmKeel"):ru[0],f=(0,i.useMemo)(()=>{let r,a={hull:r=e||c.ownHull,bottom:rh,deck:c.ownDeck,roof:r,glass:rh,ports:c.rigging,rig:c.rigging,boom:c.rigging,stripes:rh};t&&(a.deck=new p.Color(e).multiplyScalar(.8).getStyle());let n={};for(let[e,t]of Object.entries(a))n[e]=new p.MeshStandardMaterial({color:t,roughness:.85,metalness:0});return n.stripes.side=p.DoubleSide,n.glass.side=p.DoubleSide,n.underwater=new p.MeshStandardMaterial({color:c.vessel,roughness:.9,metalness:0,transparent:!0,opacity:.45,depthWrite:!1}),n},[c,e,t]);(0,i.useEffect)(()=>()=>Object.values(f).forEach(e=>e.dispose()),[f]);let m=r?.awa??.6,g=m>=0?-1:1,A=tc(m,((a?.trimState?.mainCar??.5)-.5)*2*tt.traveller.halfWidth)*g,v=a?.trimState?.jibCar??.5,B=rn(g,v),y=ra(a?.trimState?.mainCar??.5),C=(0,i.useMemo)(()=>tn(r?.tws,r?.twa,l.default.get("sailPlanOverride")),[r?.tws,r?.twa]),[b,x,w]=tt.gooseneck,E=(0,s.useSignalKPath)("steering.rudderAngle",0)||0;return(0,n.jsxs)("group",{children:[["hull","bottom","deck","roof","glass","ports","stripes","rig"].map(e=>u[e]&&(0,n.jsx)("mesh",{geometry:u[e].geometry,material:f[e]},e)),(0,n.jsx)(K.Line,{points:h,color:c.rigging,lineWidth:1.5}),u[d]&&(0,n.jsx)("mesh",{geometry:u[d].geometry,material:f.underwater,renderOrder:1}),u.boom&&(0,n.jsx)("group",{position:[b,x,w],rotation:[0,A,0],children:(0,n.jsx)("mesh",{geometry:u.boom.geometry,material:f.boom,position:[-b,-x,-w]})}),["port","starboard","centre"].map(e=>{let t=u[`${d}_rudder_${e}`];if(!t)return null;let{pivot:r,axis:a}=tt.rudders[e],i=new p.Quaternion().setFromAxisAngle(new p.Vector3(...a).normalize(),-E);return(0,n.jsx)("group",{position:r,quaternion:i,children:(0,n.jsx)("mesh",{geometry:t.geometry,material:f.underwater,position:r.map(e=>-e),renderOrder:1})},e)}),(0,n.jsx)(rl,{rudder:E}),o&&(0,n.jsx)(tC,{awa:m,boomAngle:A,sails:C,trim:a,mainCarAt:y,jibCarAt:B}),(0,n.jsx)(ri,{mainCar:a?.trimState?.mainCar,jibCar:v,leeward:g})]})},catamaran:({hullColor:e,alert:t=!1,windData:r,trim:a,showSail:o=!0})=>{let u=(0,i.useMemo)(()=>(()=>{let e,t,r,a,n,i,o,s,l,u,h,c,d,f,m,g;if(rG)return rG;let A=e=>({geometry:e});return rG={hull:A((e=tD(tG(rA.map(e=>({z:rg(e),pts:rC(e)})))),r=tE([e,tU([...(t=rC(1)).slice().reverse().map(([e,t])=>[-e,t]),...t.slice(1)],rg(1))]),tE([r.clone().translate(-2.9,0,0),r.clone().translate(2.9,0,0)]))),deck:A((n=[(a=tD(tG(rA.map(e=>({z:rg(e),pts:[[0,ry(e)+.02],[rv(e),ry(e)]]})),!0))).clone().translate(-2.9,0,0),a.clone().translate(2.9,0,0)],(s=new rm(2*(i=2.9-.55),.44999999999999996,o=rg(1)-.3- -1.9,2,.12)).translate(0,1.275,-1.9+o/2),tE([...n,s,rb([[-2.8,1.45],[-1.9+.1,1.5],[-1.9+.1,.9]],2*i-.1)]))),roof:A(((l=rb([[rM,0],[rM+1.3,rw],[rx,rw],[rx,0]],rE)).translate(0,1.5,0),(u=new rm(rE+.3,.1,rF-rx+1.4,2,.04)).translate(0,1.5+rw+.05,(rF+rx-1.4)/2+.35),tE([l,u,...[-1,1].map(e=>t_([e*(rE/2-.1),1.5,rF-.2],[e*(rE/2-.1),1.5+rw,rF-.2],.05))]))),glass:A(((h=rb([[rM+.14,.2],[rM+1.18,rw-.15],[rx-.3,rw-.15],[rx-.3,.2]],rE+.02)).translate(0,1.5,0),h)),stripes:A((c=tG(Array.from({length:21},(e,t)=>{let r=.28+t/20*.47,a=Math.min(1,t/1.5,(20-t)/1.5),n=.82+.08*(1-a),i=1.02-.08*(1-a);return{z:rg(r),pts:[[rS(r,n)+.012,n],[rS(r,i)+.012,i]]}})),d=tD(tG(rA.slice(1).map(e=>({z:rg(e),pts:[[rS(e,.1)+.008,.1],[rS(e,.16)+.008,.16]]})))),tE([c.clone().translate(2.9,0,0),c.clone().scale(-1,1,1).translate(-2.9,0,0),d.clone().translate(-2.9,0,0),d.clone().translate(2.9,0,0)]))),net:A((f=2.4,m=new p.Shape([new p.Vector2(-f,1.9),new p.Vector2(f,1.9),new p.Vector2(f-.05,5.5),new p.Vector2(-f+.05,5.5)]),(g=new p.ShapeGeometry(m)).rotateX(-Math.PI/2),g.translate(0,1.5,0),g)),rig:A((()=>{let e=[t_(rc.mastFoot,rc.masthead,.13,.07,14)];for(let t of[-1,1])e.push(t_([2.8*t,ry(.45),rg(.45)],rc.hounds,.014));for(let t of(e.push(t_(rc.forestayTack,rc.hounds,.014)),e.push(t_([-2.9,1.5,-5.5],[2.9,1.5,-5.5],.1)),e.push(t_([0,1.48,-1.9],rc.bowsprit,.09,.06)),[-1,1]))e.push(t_([0,1.48,-5.5],[2.6*t,1.5,-6.6],.02));return tE(e)})()),boom:A(t_(rc.gooseneck,[0,rc.gooseneck[1],rc.gooseneck[2]+rc.boomLength],.1,.07,12)),boards:A(tE([-1,1].map(e=>tP({y:.2,lead:.2,chord:.5,x:2.9*e},{y:-1.6,lead:.3,chord:.42,x:2.9*e},.12)))),rudder_port:A(rT(rc.rudders.port)),rudder_starboard:A(rT(rc.rudders.starboard))}})(),[]),h=(0,i.useMemo)(()=>[-1,1].map(e=>{let t=rA.map(t=>[2.9*e+rv(t)+.01,ry(t)+.02,rg(t)]);return[...t,...rA.map(t=>[2.9*e-rv(t)-.01,ry(t)+.02,rg(t)]).reverse(),t[0]]}),[]),c=(0,i.useMemo)(()=>t6(rc,{edgeAt:rI,heightAt:rR}),[]),{scene:d}=(0,M.default)(),f=(0,i.useMemo)(()=>{let r=e||d.ownHull,a={hull:r,deck:t?new p.Color(r).multiplyScalar(.8).getStyle():d.ownDeck,roof:r,glass:rD,stripes:rD,net:rD,rig:d.rigging,boom:d.rigging},n={};for(let[e,t]of Object.entries(a))n[e]=new p.MeshStandardMaterial({color:t,roughness:.85,metalness:0});return n.glass.side=p.DoubleSide,n.stripes.side=p.DoubleSide,n.net.side=p.DoubleSide,n.net.transparent=!0,n.net.opacity=.75,n.underwater=new p.MeshStandardMaterial({color:d.vessel,roughness:.9,metalness:0,transparent:!0,opacity:.45,depthWrite:!1}),n},[d,e,t]);(0,i.useEffect)(()=>()=>Object.values(f).forEach(e=>e.dispose()),[f]);let m=r?.awa??.6,g=m>=0?-1:1,A=a?.trimState?.mainCar??.5,v=a?.trimState?.jibCar??.5,B=tc(m,(A-.5)*2*rc.traveller.halfWidth,rc.mainsheetOnBoom)*g,y=(0,i.useMemo)(()=>tn(r?.tws,r?.twa,l.default.get("sailPlanOverride")),[r?.tws,r?.twa]),C=(0,s.useSignalKPath)("steering.rudderAngle",0)||0,[b,x,w]=rc.gooseneck;return(0,n.jsxs)("group",{children:[["hull","deck","roof","glass","stripes","net","rig"].map(e=>(0,n.jsx)("mesh",{geometry:u[e].geometry,material:f[e]},e)),h.map((e,t)=>(0,n.jsx)(K.Line,{points:e,color:d.rigging,lineWidth:1.5},t)),(0,n.jsx)("mesh",{geometry:u.boards.geometry,material:f.underwater,renderOrder:1}),(0,n.jsx)("group",{position:[b,x,w],rotation:[0,B,0],children:(0,n.jsx)("mesh",{geometry:u.boom.geometry,material:f.boom,position:[-b,-x,-w]})}),["port","starboard"].map(e=>{let{pivot:t}=rc.rudders[e];return(0,n.jsx)("group",{position:t,rotation:[0,-C,0],children:(0,n.jsx)("mesh",{geometry:u[`rudder_${e}`].geometry,material:f.underwater,position:t.map(e=>-e),renderOrder:1})},e)}),o&&(0,n.jsx)(tC,{awa:m,boomAngle:B,sails:y,trim:a,rig:rc,mainCarAt:ra(A,c),jibCarAt:rn(g,v,c)}),(0,n.jsx)(ri,{mainCar:A,jibCar:v,leeward:g,layout:c})]})}},r_=a.default.env.ASSET_PREFIX||"./",rk={name:"Racer 10.8",modelPath:"racer",capabilities:["navigation","sail","color"]},rP=({modelPath:e,selectedBoat:t,materialProperties:r,rudderRef:a,boatRef:o})=>{let{nodes:s,materials:l}=y(e,`${r_}/draco/`);(0,i.useEffect)(()=>{if("default"===t.modelPath){if(!l?.fiberglass)return;l.fiberglass.color.set(r.primaryColor),l.fiberglass.metalness=+!!r.metallicEffect,l.fiberglass.roughness=r.metallicEffect?.2:1}else o.current&&o.current.traverse(e=>{e.isMesh&&e.material&&(Array.isArray(e.material)?e.material.forEach(e=>{e.color.set(r.primaryColor),e.metalness=+!!r.metallicEffect,e.roughness=r.metallicEffect?.2:1}):(e.material.color.set(r.primaryColor),e.material.metalness=+!!r.metallicEffect,e.material.roughness=r.metallicEffect?.2:1))});r.metallicEffect||Object.values(l).forEach(e=>{"metalness"in e&&(e.metalness=Math.min(e.metalness,.1)),"roughness"in e&&(e.roughness=Math.max(e.roughness,.75))}),Object.values(l).forEach(e=>{e.map&&(e.map.minFilter=p.LinearFilter,e.map.magFilter=p.LinearFilter,e.map.anisotropy=1)})},[l,r,t,o]);let u=(0,i.useMemo)(()=>{let e={Default:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("mesh",{geometry:s.baba_metal_0.geometry,material:l.metal,position:[.24,.895,-5.546],rotation:[-Math.PI/2,0,1.968],scale:.027}),(0,n.jsx)("mesh",{geometry:s.camadadirek_fiberglass_0.geometry,material:l.fiberglass,position:[0,5.267,-3.711],rotation:[2.054,0,Math.PI],scale:[-.042,.042,4.707]}),(0,n.jsx)("mesh",{geometry:s.camadanyelkeni_bez_0.geometry,material:l.mcaterial,position:[0,5.267,-3.711],rotation:[2.054,0,Math.PI],scale:[-.042,.042,4.707]}),(0,n.jsx)("mesh",{geometry:s.camadaonbaglay_metal_0.geometry,material:l.metal,position:[0,.891,-5.958],rotation:[-Math.PI/2,0,0],scale:.02}),(0,n.jsx)("mesh",{geometry:s.capa_metal_0.geometry,material:l.metal,position:[0,.671,-6.173],rotation:[-Math.PI/2,0,0],scale:.348}),(0,n.jsx)("mesh",{geometry:s.direk_fiberglass_0.geometry,material:l.fiberglass,position:[0,4.315,-1.056],rotation:[Math.PI/2,0,Math.PI],scale:[-.113,.113,5.203]}),(0,n.jsx)("mesh",{geometry:s.duman_ahsap_0.geometry,material:l.ahsap,position:[-.011,.854,3.487],rotation:[Math.PI,0,Math.PI/2],scale:[.045,.045,.011]}),(0,n.jsx)("mesh",{geometry:s.dumenyuvasi_ahsap_0.geometry,material:l.ahsap,position:[-.011,.299,3.441],rotation:[-Math.PI/2,0,1.571],scale:.094}),(0,n.jsx)("mesh",{geometry:s.dumenyuvasi_cam_0.geometry,material:l.material_5,position:[-.011,.299,3.441],rotation:[-Math.PI/2,0,1.571],scale:.094}),(0,n.jsx)("mesh",{geometry:s.dumenyuvasi_fiberglass_0.geometry,material:l.fiberglass,position:[-.011,.299,3.441],rotation:[-Math.PI/2,0,1.571],scale:.094}),(0,n.jsx)("mesh",{geometry:s.govde_fiberglass2_0.geometry,material:l.fiberglass2,position:[0,.32,-.897],rotation:[0,Math.PI/2,0],scale:[5.11,.454,1.212]}),(0,n.jsx)("mesh",{geometry:s.govde_fiberglass_0.geometry,material:l.fiberglass,position:[0,.32,-.897],rotation:[0,Math.PI/2,0],scale:[5.11,.454,1.212]}),(0,n.jsx)("mesh",{geometry:s.govde_metal_0.geometry,material:l.metal,position:[0,.32,-.897],rotation:[0,Math.PI/2,0],scale:[5.11,.454,1.212]}),(0,n.jsx)("mesh",{geometry:s.halattutucu_fiberglass2_0.geometry,material:l.fiberglass2,position:[-1.044,.939,1.809],rotation:[-Math.PI/2,0,0],scale:[.016,.059,.016]}),(0,n.jsx)("mesh",{geometry:s.ip001_metal_0.geometry,material:l.metal,position:[-.231,7.608,-.621],rotation:[-2.322,.222,-1.556],scale:[.007,.007,.011]}),(0,n.jsx)("mesh",{geometry:s.pervan_fiberglass_0.geometry,material:l.fiberglass,position:[0,-1.005,1.561],rotation:[-Math.PI/2,Math.PI/2,0],scale:[.154,.094,.104]}),(0,n.jsx)("mesh",{geometry:s.pervane_metal_0.geometry,material:l.metal,position:[0,-1.122,1.75],scale:.034}),(0,n.jsx)("mesh",{ref:a,geometry:s.rudder_fiberglass_0.geometry,material:l.fiberglass,position:[0,-1.153,3.486],rotation:[-Math.PI/2,Math.PI/2,0],scale:[.573,.262,.262]}),(0,n.jsx)("mesh",{geometry:s.salma_fiberglass_0.geometry,material:l.fiberglass,position:[0,-1.953,-.739],scale:[.149,.108,.756]}),(0,n.jsx)("mesh",{geometry:s.ustcam_cam_0.geometry,material:l.material_5,position:[-.337,.974,-3.127],rotation:[-Math.PI/2,0,0],scale:[-.183,.133,.025]}),(0,n.jsx)("mesh",{geometry:s.ustcam_fiberglass_0.geometry,material:l.fiberglass,position:[-.337,.974,-3.127],rotation:[-Math.PI/2,0,0],scale:[-.183,.133,.025]}),(0,n.jsx)("mesh",{geometry:s.ustgovde_fiberglass_0.geometry,material:l.fiberglass,position:[0,.832,-2.741],rotation:[-Math.PI/2,0,0],scale:[.566,.7,1.212]}),(0,n.jsx)("mesh",{geometry:s.ustgovdekzak_ahsap_0.geometry,material:l.ahsap,position:[0,.862,-2.741],rotation:[-Math.PI/2,0,0],scale:[.566,.7,1.212]}),(0,n.jsx)("mesh",{geometry:s.vinc_metal_0.geometry,material:l.metal,position:[-1.07,.977,2.02],rotation:[-Math.PI/2,0,0],scale:.065}),(0,n.jsx)("mesh",{geometry:s.yancam002_cam_0.geometry,material:l.material_5,position:[-.984,.591,-3.772],rotation:[Math.PI,-1.241,-Math.PI/2],scale:[.095,.28,.014]}),(0,n.jsx)("mesh",{geometry:s.yancam002_fiberglass_0.geometry,material:l.fiberglass,position:[-.984,.591,-3.772],rotation:[Math.PI,-1.241,-Math.PI/2],scale:[.095,.28,.014]}),(0,n.jsx)("mesh",{geometry:s.yankoruma_metal_0.geometry,material:l.metal,position:[-1.641,.946,2.868],rotation:[-Math.PI/2,0,0],scale:[.01,.01,.159]}),(0,n.jsx)("mesh",{geometry:s.yankoruma_metal_0001.geometry,material:l.metal,position:[-1.641,.946,2.868],rotation:[-Math.PI/2,0,0],scale:[.01,.01,.159]}),(0,n.jsx)("mesh",{geometry:s.yankoruma_metal_0002.geometry,material:l.metal,position:[-1.641,.946,2.868],rotation:[-Math.PI/2,0,0],scale:[.01,.01,.159]}),(0,n.jsx)("mesh",{geometry:s.zincir_metal_0.geometry,material:l.metal,position:[-.001,.88,-6.258],rotation:[-1.56,-.031,-.149],scale:.004}),(0,n.jsx)("mesh",{geometry:s.zincir_metal_0001.geometry,material:l.metal,position:[-.001,.88,-6.258],rotation:[-1.56,-.031,-.149],scale:.004}),(0,n.jsx)("mesh",{geometry:s.zincirdeposu_fiberglass2_0.geometry,material:l.fiberglass2,position:[0,.863,-5.779],rotation:[-Math.PI/2,0,0],scale:[.103,.088,.009]}),(0,n.jsx)("mesh",{geometry:s.zincirmakara_metal_0.geometry,material:l.metal,position:[0,.869,-6.305],rotation:[-2.159,1.564,.59],scale:[.01,.01,.016]}),(0,n.jsx)("mesh",{geometry:s.zincirray_ahsap_0.geometry,material:l.ahsap,position:[0,.864,-6.113],rotation:[-Math.PI/2,0,0],scale:[.017,.181,.003]})]}),Optimist:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("mesh",{geometry:s.body_body_0.geometry,material:l.body,position:[-.054,.272,-.022],rotation:[-1.571,.01,.01],scale:[1,5.242,1]}),(0,n.jsx)("mesh",{geometry:s.boom_aluminium_0.geometry,material:l.aluminium,position:[-.019,2.771,.964],rotation:[0,.01,-.01],scale:[.15,.15,4.609]}),(0,n.jsx)("mesh",{geometry:s.rubber_joint__0.geometry,material:l.rubber_joint__0,position:[-.008,1.407,3.453],rotation:[1.571,-.01,-.01],scale:[-.037,.056,.079]}),(0,n.jsx)("mesh",{geometry:s.sail_sail_0.geometry,material:l.sail,position:[.038,8.739,.698],rotation:[2.356,1.557,2.356],scale:[-5.728,4.361,4.361]})]}),Ship:()=>(0,n.jsx)("mesh",{geometry:s.Object_10.geometry,material:l.material_0,position:[0,-.55,0],rotation:[-1.558,.002,3.139],scale:.004}),Windsurf:()=>(0,n.jsx)("mesh",{geometry:s["body_Material_#30_0"].geometry,material:l.Material_30,position:[-.007,0,-.071],rotation:[-Math.PI/2,0,0],scale:.002}),Sailboat:()=>(0,n.jsx)("mesh",{geometry:s.sailboat.geometry,material:l.texture,position:[0,-1.5,0],rotation:[-Math.PI,.011,-Math.PI],scale:.219})};return e[t.name]||e.Default},[t.name,s,l]);return(0,n.jsx)(u,{})};e.s(["default",0,({showSail:e=!1,onUpdateInfoPanel:t,sailTrimData:r=null,...a})=>{let u=(0,i.useRef)(),h=(0,i.useRef)(),c=l.default.getAll(),d=c.preferredWindSpeedPath||"speedTrue",f=c.preferredWindDirectionPath||"angleTrueWater",m=c.preferredHeadingPath||"courseOverGroundTrue",g=(0,i.useMemo)(()=>[`environment.wind.${f}`,`environment.wind.${d}`,"environment.wind.angleTrueWater","environment.wind.speedTrue","environment.wind.angleApparent","environment.wind.speedApparent","performance.beatAngle","performance.polarSpeed","performance.polarSpeedRatio","performance.velocityMadeGood","navigation.speedThroughWater",`navigation.${m}`,"navigation.headingTrue","navigation.courseOverGroundTrue","navigation.position"],[f,d,m]),A=(0,s.useSignalKPaths)(g),v=(0,s.useSignalKPath)("navigation.attitude"),B=(0,s.useSignalKPath)("steering.rudderAngle",0),y=(0,i.useRef)({roll:0,pitch:0,yaw:0}),b=(0,i.useRef)(0);(0,i.useEffect)(()=>{v&&(y.current=v)},[v]),(0,i.useEffect)(()=>{b.current=B},[B]);let[x,w]=(0,i.useState)(()=>l.default.getSelectedBoat()||rk);(0,i.useEffect)(()=>{w(l.default.getSelectedBoat()||rk)},[c.selectedBoat]);let E=(0,i.useMemo)(()=>((e="default")=>`${r_}/boats/${e}/assets/scene-transformed.glb`)(x.modelPath),[x]),F=x?.capabilities||[],{scene:S}=(0,M.default)(),{giveWay:I}=(0,J.default)(),R=(0,i.useMemo)(()=>({primaryColor:I?S.giveWay:c.primaryColor||S.ownHull,metallicEffect:c.metallicEffect||!1}),[c.primaryColor,c.metallicEffect,S.ownHull,S.giveWay,I]),D=(0,i.useMemo)(()=>new p.Matrix4,[]),U=(0,i.useMemo)(()=>new p.Vector3(1,0,0),[]),_=(0,i.useMemo)(()=>new p.Euler(-Math.PI/2,Math.PI/2,0),[]);(0,C.useFrame)(()=>{if(!u.current)return;let e=y.current,t=180*b.current/Math.PI;u.current&&u.current.rotation.set(e.pitch||0,0,2*Math.PI-(e.roll||0)),h.current&&(D.makeRotationFromEuler(_),h.current.setRotationFromMatrix(D),h.current.rotateOnAxis(U,-p.MathUtils.degToRad(t)))});let k=(0,i.useMemo)(()=>({name:x.name||"Sailboat",type:"sailboat",trueWindAngle:A[`environment.wind.${f}`]??A["environment.wind.angleTrueWater"]??0,trueWindSpeed:A[`environment.wind.${d}`]??A["environment.wind.speedTrue"]??0,appWindAngle:A["environment.wind.angleApparent"]||0,appWindSpeed:A["environment.wind.speedApparent"]||0,beatAngle:A["performance.beatAngle"]||0,polarSpeed:A["performance.polarSpeed"]||0,polarSpeedRatio:A["performance.polarSpeedRatio"]||0,velocityMadeGood:A["performance.velocityMadeGood"]||0,speedThroughWater:A["navigation.speedThroughWater"]||0,headingTrue:A[`navigation.${m}`]??A["navigation.headingTrue"]??0,courseOverGroundTrue:A["navigation.courseOverGroundTrue"]||0,position:A["navigation.position"]||{latitude:0,longitude:0}}),[A,x.name,f,d,m]),[L,O]=(0,i.useState)(!1);return(0,n.jsxs)("group",{...a,ref:u,dispose:null,onClick:()=>{let e=!L;O(e),t&&t(e?(e=>{let t=[];if(e.name&&t.push(`Vessel: ${e.name}`),Number.isFinite(e.trueWindSpeed)){let r=(0,o.toDegrees)(e.trueWindAngle);t.push(`Wind: ${(0,o.toKnots)(e.trueWindSpeed)} kn${null!==r?` @ ${r}\xb0`:""}`)}if(Number.isFinite(e.appWindSpeed)){let r=(0,o.toDegrees)(e.appWindAngle);t.push(`App Wind: ${(0,o.toKnots)(e.appWindSpeed)} kn${null!==r?` @ ${r}\xb0`:""}`)}return e.speedThroughWater&&t.push(`STW: ${(0,o.toKnots)(e.speedThroughWater)} kn`),void 0!==e.headingTrue&&null!==e.headingTrue&&t.push(`HDG: ${(0,o.toDegrees)(e.headingTrue)}\xb0`),void 0!==e.courseOverGroundTrue&&null!==e.courseOverGroundTrue&&t.push(`COG: ${(0,o.toDegrees)(e.courseOverGroundTrue)}\xb0`),e.velocityMadeGood&&t.push(`VMG: ${(0,o.toKnots)(e.velocityMadeGood)} kn`),e.polarSpeedRatio&&t.push(`Polar: ${(100*e.polarSpeedRatio).toFixed(0)}%`),e.position&&void 0!==e.position.latitude&&void 0!==e.position.longitude&&t.push(`Pos: ${e.position.latitude.toFixed(4)}\xb0, ${e.position.longitude.toFixed(4)}\xb0`),t.join("\n")})(k):null)},children:[F.includes("sail")&&e&&!rU[x.modelPath]&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(T,{reefLevel:r?r.reefLevel:0,mainCamber:r?r.mainCamber:1}),(0,n.jsx)(G,{jibCar:r?r.trimState.jibCar:.5,camber:r?r.jibCamber:.8,twist:r?r.jibTwist:0}),!1!==l.default.get("showRigging")&&(0,n.jsx)(j,{}),r&&r.tensions&&(0,n.jsx)(P,{tensions:r.tensions})]}),rU[x.modelPath]?i.default.createElement(rU[x.modelPath],{hullColor:R.primaryColor,alert:I,windData:r?.windData,trim:r,showSail:e}):(0,n.jsx)(rP,{modelPath:E,selectedBoat:x,materialProperties:R,rudderRef:h,boatRef:u})]})}],66326)},73919,20440,e=>{"use strict";let t;var r=e.i(43476),a=e.i(71645),n=e.i(31067),i=e.i(90874),o=e.i(95393),s=e.i(1888),l=e.i(93059),u=e.i(80566),h=e.i(90072),c=e.i(8560),d=e.i(53314),f=e.i(93282),p=h;class m extends p.DataTextureLoader{constructor(e){super(e),this.type=p.HalfFloatType}parse(e){let t,r,a,n=function(e,t){switch(e){case 1:throw Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw Error("THREE.RGBELoader: Memory Error: "+(t||""))}},i=function(e,t,r){t=t||1024;let a=e.pos,n=-1,i=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=s.indexOf("\n"))&&i<t&&a<e.byteLength;)o+=s,i+=s.length,a+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return -1<n&&(!1!==r&&(e.pos+=i+n+1),o+s.slice(0,n))},o=new Uint8Array(e);o.pos=0;let s=function(e){let t,r,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,u={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=i(e))||n(1,"no header found"),(r=t.match(/^#\?(\S+)/))||n(3,"bad initial token"),u.valid|=1,u.programtype=r[1],u.string+=t+"\n";!1!==(t=i(e));){if(u.string+=t+"\n","#"===t.charAt(0)){u.comments+=t+"\n";continue}if((r=t.match(a))&&(u.gamma=parseFloat(r[1])),(r=t.match(o))&&(u.exposure=parseFloat(r[1])),(r=t.match(s))&&(u.valid|=2,u.format=r[1]),(r=t.match(l))&&(u.valid|=4,u.height=parseInt(r[1],10),u.width=parseInt(r[2],10)),2&u.valid&&4&u.valid)break}return 2&u.valid||n(3,"missing format specifier"),4&u.valid||n(3,"missing image size specifier"),u}(o),l=s.width,u=s.height,h=function(e,t,r){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&n(3,"wrong scanline width");let a=new Uint8Array(4*t*r);a.length||n(4,"unable to allocate buffer space");let i=0,o=0,s=4*t,l=new Uint8Array(4),u=new Uint8Array(s),h=r;for(;h>0&&o<e.byteLength;){o+4>e.byteLength&&n(1),l[0]=e[o++],l[1]=e[o++],l[2]=e[o++],l[3]=e[o++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&n(3,"bad rgbe scanline format");let r=0,c;for(;r<s&&o<e.byteLength;){let t=(c=e[o++])>128;if(t&&(c-=128),(0===c||r+c>s)&&n(3,"bad scanline data"),t){let t=e[o++];for(let e=0;e<c;e++)u[r++]=t}else u.set(e.subarray(o,o+c),r),r+=c,o+=c}for(let e=0;e<t;e++){let r=0;a[i]=u[e+r],r+=t,a[i+1]=u[e+r],r+=t,a[i+2]=u[e+r],r+=t,a[i+3]=u[e+r],i+=4}h--}return a}(o.subarray(o.pos),l,u);switch(this.type){case p.FloatType:let c=new Float32Array(4*(a=h.length/4));for(let e=0;e<a;e++)!function(e,t,r,a){let n=Math.pow(2,e[t+3]-128)/255;r[a+0]=e[t+0]*n,r[a+1]=e[t+1]*n,r[a+2]=e[t+2]*n,r[a+3]=1}(h,4*e,c,4*e);t=c,r=p.FloatType;break;case p.HalfFloatType:let d=new Uint16Array(4*(a=h.length/4));for(let e=0;e<a;e++)!function(e,t,r,a){let n=Math.pow(2,e[t+3]-128)/255;r[a+0]=p.DataUtils.toHalfFloat(Math.min(e[t+0]*n,65504)),r[a+1]=p.DataUtils.toHalfFloat(Math.min(e[t+1]*n,65504)),r[a+2]=p.DataUtils.toHalfFloat(Math.min(e[t+2]*n,65504)),r[a+3]=p.DataUtils.toHalfFloat(1)}(h,4*e,d,4*e);t=d,r=p.HalfFloatType;break;default:throw Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:l,height:u,data:t,header:s.string,gamma:s.gamma,exposure:s.exposure,type:r}}setDataType(e){return this.type=e,this}load(e,t,r,a){return super.load(e,function(e,r){switch(e.type){case p.FloatType:case p.HalfFloatType:"colorSpace"in e?e.colorSpace="srgb-linear":e.encoding=3e3,e.minFilter=p.LinearFilter,e.magFilter=p.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)},r,a)}}var g=h,A={},v=function(e,t,r,a,n){var i=new Worker(A[t]||(A[t]=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))));return i.onerror=function(e){return n(e.error,null)},i.onmessage=function(e){return n(null,e.data)},i.postMessage(r,a),i},B=Uint8Array,y=Uint16Array,C=Uint32Array,b=new B([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),M=new B([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),x=new B([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w=function(e,t){for(var r=new y(31),a=0;a<31;++a)r[a]=t+=1<<e[a-1];for(var n=new C(r[30]),a=1;a<30;++a)for(var i=r[a];i<r[a+1];++i)n[i]=i-r[a]<<5|a;return[r,n]},E=w(b,2),F=E[0],T=E[1];F[28]=258,T[258]=28;for(var S=w(M,0),I=S[0],R=S[1],G=new y(32768),D=0;D<32768;++D){var U=(43690&D)>>>1|(21845&D)<<1;U=(61680&(U=(52428&U)>>>2|(13107&U)<<2))>>>4|(3855&U)<<4,G[D]=((65280&U)>>>8|(255&U)<<8)>>>1}for(var _=function(e,t,r){for(var a,n=e.length,i=0,o=new y(t);i<n;++i)++o[e[i]-1];var s=new y(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(r){a=new y(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],h=t-e[i],c=s[e[i]-1]++<<h,d=c|(1<<h)-1;c<=d;++c)a[G[c]>>>l]=u}else for(a=new y(n),i=0;i<n;++i)e[i]&&(a[i]=G[s[e[i]-1]++]>>>15-e[i]);return a},k=new B(288),D=0;D<144;++D)k[D]=8;for(var D=144;D<256;++D)k[D]=9;for(var D=256;D<280;++D)k[D]=7;for(var D=280;D<288;++D)k[D]=8;for(var P=new B(32),D=0;D<32;++D)P[D]=5;var L=_(k,9,0),O=_(k,9,1),H=_(P,5,0),j=_(P,5,1),J=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},N=function(e,t,r){var a=t/8|0;return(e[a]|e[a+1]<<8)>>(7&t)&r},K=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},W=function(e){return(e/8|0)+(7&e&&1)},V=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var a=new(e instanceof y?y:e instanceof C?C:B)(r-t);return a.set(e.subarray(t,r)),a},X=function(e,t,r){var a=e.length;if(!a||r&&!r.l&&a<5)return t||new B(0);var n=!t||r,i=!r||r.i;r||(r={}),t||(t=new B(3*a));var o=function(e){var r=t.length;if(e>r){var a=new B(Math.max(2*r,e));a.set(t),t=a}},s=r.f||0,l=r.p||0,u=r.b||0,h=r.l,c=r.d,d=r.m,f=r.n,p=8*a;do{if(!h){r.f=s=N(e,l,1);var m=N(e,l+1,3);if(l+=3,m)if(1==m)h=O,c=j,d=9,f=5;else if(2==m){var g=N(e,l,31)+257,A=N(e,l+10,15)+4,v=g+N(e,l+5,31)+1;l+=14;for(var y=new B(v),C=new B(19),w=0;w<A;++w)C[x[w]]=N(e,l+3*w,7);l+=3*A;for(var E=J(C),T=(1<<E)-1,S=_(C,E,1),w=0;w<v;){var R=S[N(e,l,T)];l+=15&R;var G=R>>>4;if(G<16)y[w++]=G;else{var D=0,U=0;for(16==G?(U=3+N(e,l,3),l+=2,D=y[w-1]):17==G?(U=3+N(e,l,7),l+=3):18==G&&(U=11+N(e,l,127),l+=7);U--;)y[w++]=D}}var k=y.subarray(0,g),P=y.subarray(g);d=J(k),f=J(P),h=_(k,d,1),c=_(P,f,1)}else throw"invalid block type";else{var G=W(l)+4,L=e[G-4]|e[G-3]<<8,H=G+L;if(H>a){if(i)throw"unexpected EOF";break}n&&o(u+L),t.set(e.subarray(G,H),u),r.b=u+=L,r.p=l=8*H;continue}if(l>p){if(i)throw"unexpected EOF";break}}n&&o(u+131072);for(var X=(1<<d)-1,Q=(1<<f)-1,z=l;;z=l){var D=h[K(e,l)&X],Y=D>>>4;if((l+=15&D)>p){if(i)throw"unexpected EOF";break}if(!D)throw"invalid length/literal";if(Y<256)t[u++]=Y;else if(256==Y){z=l,h=null;break}else{var Z=Y-254;if(Y>264){var w=Y-257,q=b[w];Z=N(e,l,(1<<q)-1)+F[w],l+=q}var $=c[K(e,l)&Q],ee=$>>>4;if(!$)throw"invalid distance";l+=15&$;var P=I[ee];if(ee>3){var q=M[ee];P+=K(e,l)&(1<<q)-1,l+=q}if(l>p){if(i)throw"unexpected EOF";break}n&&o(u+131072);for(var et=u+Z;u<et;u+=4)t[u]=t[u-P],t[u+1]=t[u+1-P],t[u+2]=t[u+2-P],t[u+3]=t[u+3-P];u=et}}r.l=h,r.p=z,r.b=u,h&&(s=1,r.m=d,r.d=c,r.n=f)}while(!s)return u==t.length?t:V(t,0,u)},Q=function(e,t,r){r<<=7&t;var a=t/8|0;e[a]|=r,e[a+1]|=r>>>8},z=function(e,t,r){r<<=7&t;var a=t/8|0;e[a]|=r,e[a+1]|=r>>>8,e[a+2]|=r>>>16},Y=function(e,t){for(var r=[],a=0;a<e.length;++a)e[a]&&r.push({s:a,f:e[a]});var n=r.length,i=r.slice();if(!n)return[ea,0];if(1==n){var o=new B(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var s=r[0],l=r[1],u=0,h=1,c=2;for(r[0]={s:-1,f:s.f+l.f,l:s,r:l};h!=n-1;)s=r[r[u].f<r[c].f?u++:c++],l=r[u!=h&&r[u].f<r[c].f?u++:c++],r[h++]={s:-1,f:s.f+l.f,l:s,r:l};for(var d=i[0].s,a=1;a<n;++a)i[a].s>d&&(d=i[a].s);var f=new y(d+1),p=Z(r[h-1],f,0);if(p>t){var a=0,m=0,g=p-t,A=1<<g;for(i.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});a<n;++a){var v=i[a].s;if(f[v]>t)m+=A-(1<<p-f[v]),f[v]=t;else break}for(m>>>=g;m>0;){var C=i[a].s;f[C]<t?m-=1<<t-f[C]++-1:++a}for(;a>=0&&m;--a){var b=i[a].s;f[b]==t&&(--f[b],++m)}p=t}return[new B(f),p]},Z=function(e,t,r){return -1==e.s?Math.max(Z(e.l,t,r+1),Z(e.r,t,r+1)):t[e.s]=r},q=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new y(++t),a=0,n=e[0],i=1,o=function(e){r[a++]=e},s=1;s<=t;++s)if(e[s]==n&&s!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=e[s]}return[r.subarray(0,a),t]},$=function(e,t){for(var r=0,a=0;a<t.length;++a)r+=e[a]*t[a];return r},ee=function(e,t,r){var a=r.length,n=W(t+2);e[n]=255&a,e[n+1]=a>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var i=0;i<a;++i)e[n+i+4]=r[i];return(n+4+a)*8},et=function(e,t,r,a,n,i,o,s,l,u,h){Q(t,h++,r),++n[256];for(var c,d,f,p,m=Y(n,15),g=m[0],A=m[1],v=Y(i,15),B=v[0],C=v[1],w=q(g),E=w[0],F=w[1],T=q(B),S=T[0],I=T[1],R=new y(19),G=0;G<E.length;++G)R[31&E[G]]++;for(var G=0;G<S.length;++G)R[31&S[G]]++;for(var D=Y(R,7),U=D[0],O=D[1],j=19;j>4&&!U[x[j-1]];--j);var J=u+5<<3,N=$(n,k)+$(i,P)+o,K=$(n,g)+$(i,B)+o+14+3*j+$(R,U)+(2*R[16]+3*R[17]+7*R[18]);if(J<=N&&J<=K)return ee(t,h,e.subarray(l,l+u));if(Q(t,h,1+(K<N)),h+=2,K<N){c=_(g,A,0),d=g,f=_(B,C,0),p=B;var W=_(U,O,0);Q(t,h,F-257),Q(t,h+5,I-1),Q(t,h+10,j-4),h+=14;for(var G=0;G<j;++G)Q(t,h+3*G,U[x[G]]);h+=3*j;for(var V=[E,S],X=0;X<2;++X)for(var Z=V[X],G=0;G<Z.length;++G){var et=31&Z[G];Q(t,h,W[et]),h+=U[et],et>15&&(Q(t,h,Z[G]>>>5&127),h+=Z[G]>>>12)}}else c=L,d=k,f=H,p=P;for(var G=0;G<s;++G)if(a[G]>255){var et=a[G]>>>18&31;z(t,h,c[et+257]),h+=d[et+257],et>7&&(Q(t,h,a[G]>>>23&31),h+=b[et]);var er=31&a[G];z(t,h,f[er]),h+=p[er],er>3&&(z(t,h,a[G]>>>5&8191),h+=M[er])}else z(t,h,c[a[G]]),h+=d[a[G]];return z(t,h,c[256]),h+d[256]},er=new C([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ea=new B(0),en=function(e,t,r,a,n,i){var o=e.length,s=new B(a+o+5*(1+Math.ceil(o/7e3))+n),l=s.subarray(a,s.length-n),u=0;if(!t||o<8)for(var h=0;h<=o;h+=65535){var c=h+65535;c<o?u=ee(l,u,e.subarray(h,c)):(l[h]=i,u=ee(l,u,e.subarray(h,o)))}else{for(var d=er[t-1],f=d>>>13,p=8191&d,m=(1<<r)-1,g=new y(32768),A=new y(m+1),v=Math.ceil(r/3),x=2*v,w=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<x)&m},E=new C(25e3),F=new y(288),S=new y(32),I=0,G=0,h=0,D=0,U=0,_=0;h<o;++h){var k=w(h),P=32767&h,L=A[k];if(g[P]=L,A[k]=P,U<=h){var O=o-h;if((I>7e3||D>24576)&&O>423){u=et(e,l,0,E,F,S,G,D,_,h-_,u),D=I=G=0,_=h;for(var H=0;H<286;++H)F[H]=0;for(var H=0;H<30;++H)S[H]=0}var j=2,J=0,N=p,K=P-L&32767;if(O>2&&k==w(h-K))for(var X=Math.min(f,O)-1,Q=Math.min(32767,h),z=Math.min(258,O);K<=Q&&--N&&P!=L;){if(e[h+j]==e[h+j-K]){for(var Y=0;Y<z&&e[h+Y]==e[h+Y-K];++Y);if(Y>j){if(j=Y,J=K,Y>X)break;for(var Z=Math.min(K,Y-2),q=0,H=0;H<Z;++H){var $=h-K+H+32768&32767,en=g[$],ei=$-en+32768&32767;ei>q&&(q=ei,L=$)}}}L=g[P=L],K+=P-L+32768&32767}if(J){E[D++]=0x10000000|T[j]<<18|R[J];var eo=31&T[j],es=31&R[J];G+=b[eo]+M[es],++F[257+eo],++S[es],U=h+j,++I}else E[D++]=e[h],++F[e[h]]}}u=et(e,l,i,E,F,S,G,D,_,h-_,u),!i&&7&u&&(u=ee(l,u+1,ea))}return V(s,0,a+W(u)+n)},ei=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,a=9;--a;)r=(1&r&&-0x12477ce0)^r>>>1;e[t]=r}return e}(),eo=function(){var e=-1;return{p:function(t){for(var r=e,a=0;a<t.length;++a)r=ei[255&r^t[a]]^r>>>8;e=r},d:function(){return~e}}},es=function(){var e=1,t=0;return{p:function(r){for(var a=e,n=t,i=r.length,o=0;o!=i;){for(var s=Math.min(o+2655,i);o<s;++o)n+=a+=r[o];a=(65535&a)+15*(a>>16),n=(65535&n)+15*(n>>16)}e=a,t=n},d:function(){return e%=65521,t%=65521,(255&e)<<24|e>>>8<<16|(255&t)<<8|t>>>8}}},el=function(e,t,r,a,n){return en(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,a,!n)},eu=function(e,t){var r={};for(var a in e)r[a]=e[a];for(var a in t)r[a]=t[a];return r},eh=function(e,t,r){for(var a=e(),n=e.toString(),i=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<a.length;++o){var s=a[o],l=i[o];if("function"==typeof s){t+=";"+l+"=";var u=s.toString();if(s.prototype)if(-1!=u.indexOf("[native code]")){var h=u.indexOf(" ",8)+1;t+=u.slice(h,u.indexOf("(",h))}else for(var c in t+=u,s.prototype)t+=";"+l+".prototype."+c+"="+s.prototype[c].toString();else t+=u}else r[l]=s}return[t,r]},ec=[],ed=function(e){var t=[];for(var r in e)(e[r]instanceof B||e[r]instanceof y||e[r]instanceof C)&&t.push((e[r]=new e[r].constructor(e[r])).buffer);return t},ef=function(e,t,r,a){if(!ec[r]){for(var n,i="",o={},s=e.length-1,l=0;l<s;++l)i=(n=eh(e[l],i,o))[0],o=n[1];ec[r]=eh(e[s],i,o)}var u=eu({},ec[r][1]);return v(ec[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,ed(u),a)},ep=function(){return[B,y,C,b,M,x,F,I,O,j,G,_,J,N,K,W,V,X,eL,ev,eB]},em=function(){return[B,y,C,b,M,x,T,R,L,k,H,P,G,er,ea,_,Q,z,Y,Z,q,$,ee,et,W,V,en,el,e_,ev]},eg=function(){return[eF,eT]},eA=function(){return[eR]},ev=function(e){return postMessage(e,[e.buffer])},eB=function(e){return e&&e.size&&new B(e.size)},ey=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}},eC=function(e,t,r,a,n){var i,o=ef(e,a,n,function(e,r){e?(o.terminate(),t.ondata.call(t,e)):(r[1]&&o.terminate(),t.ondata.call(t,e,r[0],r[1]))});o.postMessage(r),t.push=function(e,r){if(i)throw"stream finished";if(!t.ondata)throw"no stream handler";o.postMessage([e,i=r],[e.buffer])},t.terminate=function(){o.terminate()}},eb=function(e,t){return e[t]|e[t+1]<<8},eM=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ex=function(e,t){return eM(e,t)+0x100000000*eM(e,t+4)},ew=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},eE=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&ew(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var a=0;a<=r.length;++a)e[a+10]=r.charCodeAt(a)}},eF=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|(e[11]<<8)+2);for(var a=(t>>3&1)+(t>>4&1);a>0;a-=!e[r++]);return r+(2&t)},eT=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},eS=function(e){return 10+(e.filename&&e.filename.length+1||0)},eI=function(e,t){var r=t.level,a=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=a<<6|(a?32-2*a:1)},eR=function(e){if((15&e[0])!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function eG(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var eD=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(el(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),eU=function(e,t){eC([em,function(){return[ey,eD]}],this,eG.call(this,e,t),function(e){onmessage=ey(new eD(e.data))},6)};function e_(e,t){return el(e,t||{},0,0)}var ek=function(){function e(e){this.s={},this.p=new B(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new B(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,r=X(this.p,this.o,this.s);this.ondata(V(r,t,this.s.b),this.d),this.o=V(r,this.s.b-32768),this.s.b=this.o.length,this.p=V(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),eP=function(e){this.ondata=e,eC([ep,function(){return[ey,ek]}],this,0,function(){onmessage=ey(new ek)},7)};function eL(e,t){return X(e,t)}(function(){function e(e,t){this.c=eo(),this.l=0,this.v=1,eD.call(this,e,t)}e.prototype.push=function(e,t){eD.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var r=el(e,this.o,this.v&&eS(this.o),t&&8,!t);this.v&&(eE(r,this.o),this.v=0),t&&(ew(r,r.length-8,this.c.d()),ew(r,r.length-4,this.l)),this.ondata(r,t)}})();var eO=function(){function e(e){this.v=1,ek.call(this,e)}return e.prototype.push=function(e,t){if(ek.prototype.e.call(this,e),this.v){var r=this.p.length>3?eF(this.p):4;if(r>=this.p.length&&!t)return;this.p=this.p.subarray(r),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}ek.prototype.c.call(this,t)},e}(),eH=function(e){this.ondata=e,eC([ep,eg,function(){return[ey,ek,eO]}],this,0,function(){onmessage=ey(new eO)},9)},ej=(function(){function e(e,t){this.c=es(),this.v=1,eD.call(this,e,t)}e.prototype.push=function(e,t){eD.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e);var r=el(e,this.o,this.v&&2,t&&4,!t);this.v&&(eI(r,this.o),this.v=0),t&&ew(r,r.length-4,this.c.d()),this.ondata(r,t)}}(),function(){function e(e){this.v=1,ek.call(this,e)}return e.prototype.push=function(e,t){if(ek.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}ek.prototype.c.call(this,t)},e}()),eJ=function(e){this.ondata=e,eC([ep,eA,function(){return[ey,ek,ej]}],this,0,function(){onmessage=ey(new ej)},11)};function eN(e,t){return X((eR(e),e.subarray(2,-4)),t)}var eK=function(){function e(e){this.G=eO,this.I=ek,this.Z=ej,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var r=new B(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var a=this,n=function(){a.ondata.apply(a,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(n):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(n):new this.Z(n),this.s.push(this.p,t),this.p=null}}},e}();(function(e){this.G=eH,this.I=eP,this.Z=eJ,this.ondata=e}).prototype.push=function(e,t){eK.prototype.push.call(this,e,t)};var eW="u">typeof TextEncoder&&new TextEncoder,eV="u">typeof TextDecoder&&new TextDecoder,eX=0;try{eV.decode(ea,{stream:!0}),eX=1}catch(e){}var eQ=function(e){for(var t="",r=0;;){var a=e[r++],n=(a>127)+(a>223)+(a>239);if(r+n>e.length)return[t,V(e,r-1)];n?3==n?t+=String.fromCharCode(55296|(a=((15&a)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536)>>10,56320|1023&a):1&n?t+=String.fromCharCode((31&a)<<6|63&e[r++]):t+=String.fromCharCode((15&a)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(a)}};function ez(e,t){if(t){for(var r=new B(e.length),a=0;a<e.length;++a)r[a]=e.charCodeAt(a);return r}if(eW)return eW.encode(e);for(var n=e.length,i=new B(e.length+(e.length>>1)),o=0,s=function(e){i[o++]=e},a=0;a<n;++a){if(o+5>i.length){var l=new B(o+8+(n-a<<1));l.set(i),i=l}var u=e.charCodeAt(a);u<128||t?s(u):(u<2048?s(192|u>>6):(u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++a))>>18),s(128|u>>12&63)):s(224|u>>12),s(128|u>>6&63)),s(128|63&u))}return V(i,0,o)}(function(e){this.ondata=e,eX?this.t=new TextDecoder:this.p=ea}).prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var r=new B(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length);var a=eQ(r),n=a[0],i=a[1];if(t){if(i.length)throw"invalid utf-8 data";this.p=null}else this.p=i;this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(ez(e),this.d=t||!1)};var eY=function(e){return 1==e?3:e<6?2:+(9==e)},eZ=function(e,t,r){for(var a=t+r;1!=eb(e,t);t+=4+eb(e,t+2))if(t+4>a)throw"invalid zip file";return[ex(e,t+12),ex(e,t+4),ex(e,t+20)]},eq=function(e){var t=0;if(e)for(var r in e){var a=e[r].length;if(a>65535)throw"extra field too long";t+=a+4}return t},e$=function(e,t,r,a,n,i,o,s){var l=a.length,u=r.extra,h=s&&s.length,c=eq(u);ew(e,t,null!=o?0x2014b50:0x4034b50),t+=4,null!=o&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==i&&8),e[t++]=n&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var d=new Date(null==r.mtime?Date.now():r.mtime),f=d.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(ew(e,t,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),t+=4,null!=i&&(ew(e,t,r.crc),ew(e,t+4,i),ew(e,t+8,r.size)),ew(e,t+12,l),ew(e,t+14,c),t+=16,null!=o&&(ew(e,t,h),ew(e,t+6,r.attrs),ew(e,t+10,o),t+=14),e.set(a,t),t+=l,c)for(var p in u){var m=u[p],g=m.length;ew(e,t,+p),ew(e,t+2,g),e.set(m,t+4),t+=4+g}return h&&(e.set(s,t),t+=h),t},e0=function(e,t,r,a,n){ew(e,t,0x6054b50),ew(e,t+8,r),ew(e,t+10,r),ew(e,t+12,a),ew(e,t+16,n)},e1=function(){function e(e){this.filename=e,this.c=eo(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function e2(e,t){var r=this;t||(t={}),e1.call(this,e),this.d=new eD(t,function(e,t){r.ondata(null,e,t)}),this.compression=8,this.flag=eY(t.level)}function e3(e,t){var r=this;t||(t={}),e1.call(this,e),this.d=new eU(t,function(e,t,a){r.ondata(e,t,a)}),this.compression=8,this.flag=eY(t.level),this.terminate=this.d.terminate}function e5(e){this.ondata=e,this.u=[],this.d=1}e2.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e2.prototype.push=function(e,t){e1.prototype.push.call(this,e,t)},e3.prototype.process=function(e,t){this.d.push(e,t)},e3.prototype.push=function(e,t){e1.prototype.push.call(this,e,t)},e5.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=ez(e.filename),a=r.length,n=e.comment,i=n&&ez(n),o=a!=e.filename.length||i&&n.length!=i.length,s=a+eq(e.extra)+30;if(a>65535)throw"filename too long";var l=new B(s);e$(l,0,e,r,o);var u=[l],h=function(){for(var e=0,r=u;e<r.length;e++){var a=r[e];t.ondata(null,a,!1)}u=[]},c=this.d;this.d=0;var d=this.u.length,f=eu(e,{f:r,u:o,o:i,t:function(){e.terminate&&e.terminate()},r:function(){if(h(),c){var e=t.u[d+1];e?e.r():t.d=1}c=1}}),p=0;e.ondata=function(r,a,n){if(r)t.ondata(r,a,n),t.terminate();else if(p+=a.length,u.push(a),n){var i=new B(16);ew(i,0,0x8074b50),ew(i,4,e.crc),ew(i,8,p),ew(i,12,e.size),u.push(i),f.c=p,f.b=s+p+16,f.crc=e.crc,f.size=e.size,c&&f.r(),c=1}else c&&h()},this.u.push(f)},e5.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e5.prototype.e=function(){for(var e=0,t=0,r=0,a=0,n=this.u;a<n.length;a++){var i=n[a];r+=46+i.f.length+eq(i.extra)+(i.o?i.o.length:0)}for(var o=new B(r+22),s=0,l=this.u;s<l.length;s++){var i=l[s];e$(o,e,i,i.f,i.u,i.c,t,i.o),e+=46+i.f.length+eq(i.extra)+(i.o?i.o.length:0),t+=i.b}e0(o,e,this.u.length,r,t),this.ondata(null,o,!0),this.d=2},e5.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2};var e9=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();function e4(){var e=this;this.i=new ek(function(t,r){e.ondata(null,t,r)})}function e8(e,t){var r=this;t<32e4?this.i=new ek(function(e,t){r.ondata(null,e,t)}):(this.i=new eP(function(e,t,a){r.ondata(e,t,a)}),this.terminate=this.i.terminate)}function e6(e){this.onfile=e,this.k=[],this.o={0:e9},this.p=ea}e4.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e4.compression=8,e8.prototype.push=function(e,t){this.i.terminate&&(e=V(e,0)),this.i.push(e,t)},e8.compression=8,e6.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var a=Math.min(this.c,e.length),n=e.subarray(0,a);if(this.c-=a,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(a)).length)return this.push(e,t)}else{var i=0,o=0,s=void 0,l=void 0;this.p.length?e.length?((l=new B(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,h=this.c,c=h&&this.d,d=this;o<u-4&&"break"!==function(){var e=eM(l,o);if(0x4034b50==e){i=1,s=o,d.d=null,d.c=0;var t=eb(l,o+6),a=eb(l,o+8),n=8&t,c=eb(l,o+26),f=eb(l,o+28);if(u>o+30+c+f){var p,m,g=[];d.k.unshift(g),i=2;var A=eM(l,o+18),v=eM(l,o+22),B=function(e,t){if(t){for(var r="",a=0;a<e.length;a+=16384)r+=String.fromCharCode.apply(null,e.subarray(a,a+16384));return r}if(eV)return eV.decode(e);var n=eQ(e),i=n[0];if(n[1].length)throw"invalid utf-8 data";return i}(l.subarray(o+30,o+=30+c),!(2048&t));0xffffffff==A?(A=(p=n?[-2]:eZ(l,o,f))[0],v=p[1]):n&&(A=-1),o+=f,d.c=A;var y={name:B,compression:a,start:function(){if(!y.ondata)throw"no callback";if(A){var e=r.o[a];if(!e)throw"unknown compression type "+a;(m=A<0?new e(B):new e(B,A,v)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var t=0;t<g.length;t++){var n=g[t];m.push(n,!1)}r.k[0]==g&&r.c?r.d=m:m.push(ea,!0)}else y.ondata(null,ea,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};A>=0&&(y.size=A,y.originalSize=v),d.onfile(y)}return"break"}if(h){if(0x8074b50==e)return s=o+=12+(-2==h&&8),i=3,d.c=0,"break";else if(0x2014b50==e)return s=o-=4,i=3,d.c=0,"break"}}();++o);if(this.p=ea,h<0){var f=i?l.subarray(0,s-12-(-2==h&&8)-(0x8074b50==eM(l,s-16)&&4)):l.subarray(0,o);c?c.push(f,!!i):this.k[+(2==i)].push(f)}if(2&i)return this.push(l.subarray(o),t);this.p=l.subarray(o)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e6.prototype.register=function(e){this.o[e.compression]=e};let e7=e.i(31497).version>=152;class te extends g.DataTextureLoader{constructor(e){super(e),this.type=g.HalfFloatType}parse(e){let t={l:0,c:0,lc:0};function r(e,r,a,n,i){for(;a<e;)r=r<<8|E(n,i),a+=8;t.l=r>>(a-=e)&(1<<e)-1,t.c=r,t.lc=a}let a=Array(59),n={c:0,lc:0};function i(e,t,r,a){e=e<<8|E(r,a),t+=8,n.c=e,n.lc=t}let o={c:0,lc:0};function s(e,t,r,a,s,l,u,h,c,d){if(e==t){a<8&&(i(r,a,s,u),r=n.c,a=n.lc);var f=r>>(a-=8),f=new Uint8Array([f])[0];if(c.value+f>d)return!1;for(var p=h[c.value-1];f-- >0;)h[c.value++]=p}else{if(!(c.value<d))return!1;h[c.value++]=e}o.c=r,o.lc=a}function l(e){var t=65535&e;return t>32767?t-65536:t}let u={a:0,b:0};function h(e,t){var r=l(e),a=l(t),n=r+(1&a)+(a>>1),i=n-a;u.a=n,u.b=i}function c(e,t){var r=65535&t,a=(65535&e)-(r>>1)&65535;u.a=r+a-32768&65535,u.b=a}function d(e,l,u,h,c,d){var f=u.value,p=w(l,u),m=w(l,u);u.value+=4;var g=w(l,u);if(u.value+=4,p<0||p>=65537||m<0||m>=65537)throw"Something wrong with HUF_ENCSIZE";for(var A=Array(65537),v=Array(16384),B=0;B<16384;B++)v[B]={},v[B].len=0,v[B].lit=0,v[B].p=null;var y=h-(u.value-f);if(!function(e,n,i,o,s,l){for(var u=0,h=0;o<=s;o++){if(n.value-n.value>i)return!1;r(6,u,h,e,n);var c=t.l;if(u=t.c,h=t.lc,l[o]=c,63==c){if(n.value-n.value>i)throw"Something wrong with hufUnpackEncTable";r(8,u,h,e,n);var d=t.l+6;if(u=t.c,h=t.lc,o+d>s+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)l[o++]=0;o--}else if(c>=59){var d=c-59+2;if(o+d>s+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)l[o++]=0;o--}}!function(e){for(var t=0;t<=58;++t)a[t]=0;for(var t=0;t<65537;++t)a[e[t]]+=1;for(var r=0,t=58;t>0;--t){var n=r+a[t]>>1;a[t]=r,r=n}for(var t=0;t<65537;++t){var i=e[t];i>0&&(e[t]=i|a[i]++<<6)}}(l)}(e,u,y,p,m,A),g>8*(h-(u.value-f)))throw"Something wrong with hufUncompress";!function(e,t,r,a){for(;t<=r;t++){var n=e[t]>>6,i=63&e[t];if(n>>i)throw"Invalid table entry";if(i>14){var o=a[n>>i-14];if(o.len)throw"Invalid table entry";if(o.lit++,o.p){var s=o.p;o.p=Array(o.lit);for(var l=0;l<o.lit-1;++l)o.p[l]=s[l]}else o.p=[,];o.p[o.lit-1]=t}else if(i)for(var u=0,l=1<<14-i;l>0;l--){var o=a[(n<<14-i)+u];if(o.len||o.p)throw"Invalid table entry";o.len=i,o.lit=t,u++}}}(A,p,m,v),function(e,t,r,a,l,u,h,c,d,f){for(var p=0,m=0,g=Math.trunc(l.value+(u+7)/8);l.value<g;)for(i(p,m,r,l),p=n.c,m=n.lc;m>=14;){var A=t[p>>m-14&16383];if(A.len)m-=A.len,s(A.lit,h,p,m,r,a,l,d,f,c),p=o.c,m=o.lc;else{if(!A.p)throw"hufDecode issues";for(v=0;v<A.lit;v++){for(var v,B=63&e[A.p[v]];m<B&&l.value<g;)i(p,m,r,l),p=n.c,m=n.lc;if(m>=B&&e[A.p[v]]>>6==(p>>m-B&(1<<B)-1)){m-=B,s(A.p[v],h,p,m,r,a,l,d,f,c),p=o.c,m=o.lc;break}}if(v==A.lit)throw"hufDecode issues"}}var y=8-u&7;for(p>>=y,m-=y;m>0;){var A=t[p<<14-m&16383];if(A.len)m-=A.len,s(A.lit,h,p,m,r,a,l,d,f,c),p=o.c,m=o.lc;else throw"hufDecode issues"}}(A,v,e,l,u,g,m,d,c,{value:0})}function f(e){for(var t=1;t<e.length;t++){var r=e[t-1]+e[t]-128;e[t]=r}}function p(e,t){for(var r=0,a=Math.floor((e.length+1)/2),n=0,i=e.length-1;!(n>i)&&(t[n++]=e[r++],!(n>i));){;t[n++]=e[a++]}}function m(e){for(var t=e.byteLength,r=[],a=0,n=new DataView(e);t>0;){var i=n.getInt8(a++);if(i<0){var o=-i;t-=o+1;for(var s=0;s<o;s++)r.push(n.getUint8(a++))}else{var o=i;t-=2;for(var l=n.getUint8(a++),s=0;s<o+1;s++)r.push(l)}}return r}function A(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function v(e){var t=new Uint8Array(m(e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size))),r=new Uint8Array(t.length);return f(t),p(t,r),new DataView(r.buffer)}function B(e){var t=eN(e.array.slice(e.offset.value,e.offset.value+e.size)),r=new Uint8Array(t.length);return f(t),p(t,r),new DataView(r.buffer)}function y(e){for(var t=e.viewer,r={value:e.offset.value},a=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),n=new Uint8Array(8192),i=0,o=Array(e.channels),s=0;s<e.channels;s++)o[s]={},o[s].start=i,o[s].end=o[s].start,o[s].nx=e.width,o[s].ny=e.lines,o[s].size=e.type,i+=o[s].nx*o[s].ny*o[s].size;var l=G(t,r),f=G(t,r);if(f>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(l<=f)for(var s=0;s<f-l+1;s++)n[s+l]=F(t,r);var p=new Uint16Array(65536),m=function(e,t){for(var r=0,a=0;a<65536;++a)(0==a||e[a>>3]&1<<(7&a))&&(t[r++]=a);for(var n=r-1;r<65536;)t[r++]=0;return n}(n,p),g=w(t,r);d(e.array,t,r,g,a,i);for(var s=0;s<e.channels;++s)for(var A=o[s],v=0;v<o[s].size;++v)!function(e,t,r,a,n,i,o){for(var s=o<16384,l=r>n?n:r,d=1;d<=l;)d<<=1;for(d>>=1,f=d,d>>=1;d>=1;){for(var f,p,m,g,A,v=0,B=0+i*(n-f),y=i*d,C=i*f,b=a*d,M=a*f;v<=B;v+=C){for(var x=v,w=v+a*(r-f);x<=w;x+=M){var E=x+b,F=x+y,T=F+b;s?(h(e[x+t],e[F+t]),p=u.a,g=u.b,h(e[E+t],e[T+t]),m=u.a,A=u.b,h(p,m),e[x+t]=u.a,e[E+t]=u.b,h(g,A)):(c(e[x+t],e[F+t]),p=u.a,g=u.b,c(e[E+t],e[T+t]),m=u.a,A=u.b,c(p,m),e[x+t]=u.a,e[E+t]=u.b,c(g,A)),e[F+t]=u.a,e[T+t]=u.b}if(r&d){var F=x+y;s?h(e[x+t],e[F+t]):c(e[x+t],e[F+t]),p=u.a,e[F+t]=u.b,e[x+t]=p}}if(n&d)for(var x=v,w=v+a*(r-f);x<=w;x+=M){var E=x+b;s?h(e[x+t],e[E+t]):c(e[x+t],e[E+t]),p=u.a,e[E+t]=u.b,e[x+t]=p}f=d,d>>=1}}(a,A.start+v,A.nx,A.size,A.ny,A.nx*A.size,m);for(var B=i,y=0;y<B;++y)a[y]=p[a[y]];for(var C=0,b=new Uint8Array(a.buffer.byteLength),M=0;M<e.lines;M++)for(var x=0;x<e.channels;x++){var A=o[x],E=A.nx*A.size,T=new Uint8Array(a.buffer,2*A.end,2*E);b.set(T,C),C+=2*E,A.end+=E}return new DataView(b.buffer)}function C(e){var t=eN(e.array.slice(e.offset.value,e.offset.value+e.size));let r=e.lines*e.channels*e.width,a=1==e.type?new Uint16Array(r):new Uint32Array(r),n=0,i=0,o=[,,,,];for(let r=0;r<e.lines;r++)for(let r=0;r<e.channels;r++){let r=0;switch(e.type){case 1:o[0]=n,o[1]=o[0]+e.width,n=o[1]+e.width;for(let n=0;n<e.width;++n)r+=t[o[0]++]<<8|t[o[1]++],a[i]=r,i++;break;case 2:o[0]=n,o[1]=o[0]+e.width,o[2]=o[1]+e.width,n=o[2]+e.width;for(let n=0;n<e.width;++n)r+=t[o[0]++]<<24|t[o[1]++]<<16|t[o[2]++]<<8,a[i]=r,i++}}return new DataView(a.buffer)}function b(e){var t=e.viewer,r={value:e.offset.value},a=new Uint8Array(e.width*e.lines*(e.channels*e.type*2)),n={version:T(t,r),unknownUncompressedSize:T(t,r),unknownCompressedSize:T(t,r),acCompressedSize:T(t,r),dcCompressedSize:T(t,r),rleCompressedSize:T(t,r),rleUncompressedSize:T(t,r),rleRawSize:T(t,r),totalAcUncompressedCount:T(t,r),totalDcUncompressedCount:T(t,r),acCompression:T(t,r)};if(n.version<2)throw"EXRLoader.parse: "+P.compression+" version "+n.version+" is unsupported";for(var i=[],o=G(t,r)-2;o>0;){var s=M(t.buffer,r),l=F(t,r),u=l>>2&3,h=new Int8Array([(l>>4)-1])[0],c=F(t,r);i.push({name:s,index:h,type:c,compression:u}),o-=s.length+3}for(var f=P.channels,p=Array(e.channels),A=0;A<e.channels;++A){var v=p[A]={},y=f[A];v.name=y.name,v.compression=0,v.decoded=!1,v.type=y.pixelType,v.pLinear=y.pLinear,v.width=e.width,v.height=e.lines}for(var C={idx:[,,,]},b=0;b<e.channels;++b)for(var v=p[b],A=0;A<i.length;++A){var x=i[A];v.name==x.name&&(v.compression=x.compression,x.index>=0&&(C.idx[x.index]=b),v.offset=b)}if(n.acCompressedSize>0)switch(n.acCompression){case 0:var w=new Uint16Array(n.totalAcUncompressedCount);d(e.array,t,r,n.acCompressedSize,w,n.totalAcUncompressedCount);break;case 1:var E=e.array.slice(r.value,r.value+n.totalAcUncompressedCount),S=eN(E),w=new Uint16Array(S.buffer);r.value+=n.totalAcUncompressedCount}if(n.dcCompressedSize>0){var I=new Uint16Array(B({array:e.array,offset:r,size:n.dcCompressedSize}).buffer);r.value+=n.dcCompressedSize}if(n.rleRawSize>0){var E=e.array.slice(r.value,r.value+n.rleCompressedSize),S=eN(E),D=m(S.buffer);r.value+=n.rleCompressedSize}for(var U=0,_=Array(p.length),A=0;A<_.length;++A)_[A]=[];for(var k=0;k<e.lines;++k)for(var L=0;L<p.length;++L)_[L].push(U),U+=p[L].width*e.type*2;!function(e,t,r,a,n,i){var o=new DataView(i.buffer),s=r[e.idx[0]].width,l=r[e.idx[0]].height,u=Math.floor(s/8),h=Math.ceil(s/8),c=Math.ceil(l/8),d=s-(h-1)*8,f=l-(c-1)*8,p={value:0},m=[,,,],A=[,,,],v=[,,,],B=[,,,],y=[,,,];for(let r=0;r<3;++r)y[r]=t[e.idx[r]],m[r]=r<1?0:m[r-1]+h*c,A[r]=new Float32Array(64),v[r]=new Uint16Array(64),B[r]=new Uint16Array(64*h);for(let t=0;t<c;++t){var C,b,M=8;t==c-1&&(M=f);var x=8;for(let e=0;e<h;++e){e==h-1&&(x=d);for(let e=0;e<3;++e){v[e].fill(0),v[e][0]=n[m[e]++],function(e,t,r){for(var a,n=1;n<64;)65280==(a=t[e.value])?n=64:a>>8==255?n+=255&a:(r[n]=a,n++),e.value++}(p,a,v[e]),C=v[e],(b=A[e])[0]=R(C[0]),b[1]=R(C[1]),b[2]=R(C[5]),b[3]=R(C[6]),b[4]=R(C[14]),b[5]=R(C[15]),b[6]=R(C[27]),b[7]=R(C[28]),b[8]=R(C[2]),b[9]=R(C[4]),b[10]=R(C[7]),b[11]=R(C[13]),b[12]=R(C[16]),b[13]=R(C[26]),b[14]=R(C[29]),b[15]=R(C[42]),b[16]=R(C[3]),b[17]=R(C[8]),b[18]=R(C[12]),b[19]=R(C[17]),b[20]=R(C[25]),b[21]=R(C[30]),b[22]=R(C[41]),b[23]=R(C[43]),b[24]=R(C[9]),b[25]=R(C[11]),b[26]=R(C[18]),b[27]=R(C[24]),b[28]=R(C[31]),b[29]=R(C[40]),b[30]=R(C[44]),b[31]=R(C[53]),b[32]=R(C[10]),b[33]=R(C[19]),b[34]=R(C[23]),b[35]=R(C[32]),b[36]=R(C[39]),b[37]=R(C[45]),b[38]=R(C[52]),b[39]=R(C[54]),b[40]=R(C[20]),b[41]=R(C[22]),b[42]=R(C[33]),b[43]=R(C[38]),b[44]=R(C[46]),b[45]=R(C[51]),b[46]=R(C[55]),b[47]=R(C[60]),b[48]=R(C[21]),b[49]=R(C[34]),b[50]=R(C[37]),b[51]=R(C[47]),b[52]=R(C[50]),b[53]=R(C[56]),b[54]=R(C[59]),b[55]=R(C[61]),b[56]=R(C[35]),b[57]=R(C[36]),b[58]=R(C[48]),b[59]=R(C[49]),b[60]=R(C[57]),b[61]=R(C[58]),b[62]=R(C[62]),b[63]=R(C[63]),function(e){let t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),a=.5*Math.cos(3*3.14159/16),n=.5*Math.cos(3*3.14159/8);for(var i=[,,,,],o=[,,,,],s=[,,,,],l=[,,,,],u=0;u<8;++u){var h=8*u;i[0]=r*e[h+2],i[1]=n*e[h+2],i[2]=r*e[h+6],i[3]=n*e[h+6],o[0]=t*e[h+1]+a*e[h+3]+.2777854612564676*e[h+5]+.09754573032714427*e[h+7],o[1]=a*e[h+1]-.09754573032714427*e[h+3]-t*e[h+5]-.2777854612564676*e[h+7],o[2]=.2777854612564676*e[h+1]-t*e[h+3]+.09754573032714427*e[h+5]+a*e[h+7],o[3]=.09754573032714427*e[h+1]-.2777854612564676*e[h+3]+a*e[h+5]-t*e[h+7],s[0]=.35355362513961314*(e[h+0]+e[h+4]),s[3]=.35355362513961314*(e[h+0]-e[h+4]),s[1]=i[0]+i[3],s[2]=i[1]-i[2],l[0]=s[0]+s[1],l[1]=s[3]+s[2],l[2]=s[3]-s[2],l[3]=s[0]-s[1],e[h+0]=l[0]+o[0],e[h+1]=l[1]+o[1],e[h+2]=l[2]+o[2],e[h+3]=l[3]+o[3],e[h+4]=l[3]-o[3],e[h+5]=l[2]-o[2],e[h+6]=l[1]-o[1],e[h+7]=l[0]-o[0]}for(var c=0;c<8;++c)i[0]=r*e[16+c],i[1]=n*e[16+c],i[2]=r*e[48+c],i[3]=n*e[48+c],o[0]=t*e[8+c]+a*e[24+c]+.2777854612564676*e[40+c]+.09754573032714427*e[56+c],o[1]=a*e[8+c]-.09754573032714427*e[24+c]-t*e[40+c]-.2777854612564676*e[56+c],o[2]=.2777854612564676*e[8+c]-t*e[24+c]+.09754573032714427*e[40+c]+a*e[56+c],o[3]=.09754573032714427*e[8+c]-.2777854612564676*e[24+c]+a*e[40+c]-t*e[56+c],s[0]=.35355362513961314*(e[c]+e[32+c]),s[3]=.35355362513961314*(e[c]-e[32+c]),s[1]=i[0]+i[3],s[2]=i[1]-i[2],l[0]=s[0]+s[1],l[1]=s[3]+s[2],l[2]=s[3]-s[2],l[3]=s[0]-s[1],e[0+c]=l[0]+o[0],e[8+c]=l[1]+o[1],e[16+c]=l[2]+o[2],e[24+c]=l[3]+o[3],e[32+c]=l[3]-o[3],e[40+c]=l[2]-o[2],e[48+c]=l[1]-o[1],e[56+c]=l[0]-o[0]}(A[e])}for(var w=A,E=0;E<64;++E){var F=w[0][E],T=w[1][E],S=w[2][E];w[0][E]=F+1.5747*S,w[1][E]=F-.1873*T-.4682*S,w[2][E]=F+1.8556*T}for(let t=0;t<3;++t)!function(e,t,r){for(var a,n=0;n<64;++n){t[r+n]=g.DataUtils.toHalfFloat((a=e[n])<=1?Math.sign(a)*Math.pow(Math.abs(a),2.2):Math.sign(a)*Math.pow(9.025013291561939,Math.abs(a)-1))}}(A[t],B[t],64*e)}let i=0;for(let a=0;a<3;++a){let n=r[e.idx[a]].type;for(let e=8*t;e<8*t+M;++e){i=y[a][e];for(let t=0;t<u;++t){let r=64*t+(7&e)*8;o.setUint16(i+0*n,B[a][r+0],!0),o.setUint16(i+2*n,B[a][r+1],!0),o.setUint16(i+4*n,B[a][r+2],!0),o.setUint16(i+6*n,B[a][r+3],!0),o.setUint16(i+8*n,B[a][r+4],!0),o.setUint16(i+10*n,B[a][r+5],!0),o.setUint16(i+12*n,B[a][r+6],!0),o.setUint16(i+14*n,B[a][r+7],!0),i+=16*n}}if(u!=h)for(let e=8*t;e<8*t+M;++e){let t=y[a][e]+8*u*2*n,r=64*u+(7&e)*8;for(let e=0;e<x;++e)o.setUint16(t+2*e*n,B[a][r+e],!0)}}}for(var I=new Uint16Array(s),o=new DataView(i.buffer),G=0;G<3;++G){r[e.idx[G]].decoded=!0;var D=r[e.idx[G]].type;if(2==r[G].type)for(var U=0;U<l;++U){let e=y[G][U];for(var _=0;_<s;++_)I[_]=o.getUint16(e+2*_*D,!0);for(var _=0;_<s;++_)o.setFloat32(e+2*_*D,R(I[_]),!0)}}}(C,_,p,w,I,a);for(var A=0;A<p.length;++A){var v=p[A];if(!v.decoded)if(2===v.compression)for(var O=0,H=0,k=0;k<e.lines;++k){for(var j=_[A][O],J=0;J<v.width;++J){for(var N=0;N<2*v.type;++N)a[j++]=D[H+N*v.width*v.height];H++}O++}else throw"EXRLoader.parse: unsupported channel compression"}return new DataView(a.buffer)}function M(e,t){for(var r=new Uint8Array(e),a=0;0!=r[t.value+a];)a+=1;var n=new TextDecoder().decode(r.slice(t.value,t.value+a));return t.value=t.value+a+1,n}function x(e,t){var r=e.getInt32(t.value,!0);return t.value=t.value+4,r}function w(e,t){var r=e.getUint32(t.value,!0);return t.value=t.value+4,r}function E(e,t){var r=e[t.value];return t.value=t.value+1,r}function F(e,t){var r=e.getUint8(t.value);return t.value=t.value+1,r}let T=function(e,t){let r;return r="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,r};function S(e,t){var r=e.getFloat32(t.value,!0);return t.value+=4,r}function I(e,t){return g.DataUtils.toHalfFloat(S(e,t))}function R(e){var t=(31744&e)>>10,r=1023&e;return(e>>15?-1:1)*(t?31===t?r?NaN:1/0:Math.pow(2,t-15)*(1+r/1024):r/1024*6103515625e-14)}function G(e,t){var r=e.getUint16(t.value,!0);return t.value+=2,r}function D(e,t){return R(G(e,t))}let U=new DataView(e),_=new Uint8Array(e),k={value:0},P=function(e,t,r){let a={};if(0x1312f76!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";a.version=e.getUint8(4);let n=e.getUint8(5);a.spec={singleTile:!!(2&n),longName:!!(4&n),deepFormat:!!(8&n),multiPart:!!(16&n)},r.value=8;for(var i=!0;i;){var o=M(t,r);if(0==o)i=!1;else{var s=M(t,r),l=w(e,r),u=function(e,t,r,a,n){var i,o,s,l,u,h,c;if("string"===a||"stringvector"===a||"iccProfile"===a)return i=new TextDecoder().decode(new Uint8Array(t).slice(r.value,r.value+n)),r.value=r.value+n,i;if("chlist"===a)return function(e,t,r,a){for(var n=r.value,i=[];r.value<n+a-1;){var o=M(t,r),s=x(e,r),l=F(e,r);r.value+=3;var u=x(e,r),h=x(e,r);i.push({name:o,pixelType:s,pLinear:l,xSampling:u,ySampling:h})}return r.value+=1,i}(e,t,r,n);if("chromaticities"===a)return o=S(e,r),s=S(e,r),l=S(e,r),u=S(e,r),h=S(e,r),{redX:o,redY:s,greenX:l,greenY:u,blueX:h,blueY:S(e,r),whiteX:S(e,r),whiteY:S(e,r)};if("compression"===a)return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][F(e,r)];if("box2i"===a)return c=w(e,r),{xMin:c,yMin:w(e,r),xMax:w(e,r),yMax:w(e,r)};else if("lineOrder"===a)return["INCREASING_Y"][F(e,r)];else if("float"===a)return S(e,r);else if("v2f"===a)return[S(e,r),S(e,r)];else if("v3f"===a)return[S(e,r),S(e,r),S(e,r)];else if("int"===a)return x(e,r);else if("rational"===a)return[x(e,r),w(e,r)];else if("timecode"===a)return[w(e,r),w(e,r)];else return"preview"===a?(r.value+=n,"skipped"):(r.value+=n,void 0)}(e,t,r,s,l);void 0===u?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${s}'.`):a[o]=u}}if((-5&n)!=0)throw console.error("EXRHeader:",a),"THREE.EXRLoader: provided file is currently unsupported.";return a}(U,e,k),L=function(e,t,r,a,n){let i={size:0,viewer:t,array:r,offset:a,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:e.channels[0].pixelType,uncompress:null,getter:null,format:null,[e7?"colorSpace":"encoding"]:null};switch(e.compression){case"NO_COMPRESSION":i.lines=1,i.uncompress=A;break;case"RLE_COMPRESSION":i.lines=1,i.uncompress=v;break;case"ZIPS_COMPRESSION":i.lines=1,i.uncompress=B;break;case"ZIP_COMPRESSION":i.lines=16,i.uncompress=B;break;case"PIZ_COMPRESSION":i.lines=32,i.uncompress=y;break;case"PXR24_COMPRESSION":i.lines=16,i.uncompress=C;break;case"DWAA_COMPRESSION":i.lines=32,i.uncompress=b;break;case"DWAB_COMPRESSION":i.lines=256,i.uncompress=b;break;default:throw"EXRLoader.parse: "+e.compression+" is unsupported"}if(i.scanlineBlockSize=i.lines,1==i.type)switch(n){case g.FloatType:i.getter=D,i.inputSize=2;break;case g.HalfFloatType:i.getter=G,i.inputSize=2}else if(2==i.type)switch(n){case g.FloatType:i.getter=S,i.inputSize=4;break;case g.HalfFloatType:i.getter=I,i.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+i.type+" for "+e.compression+".";i.blockCount=(e.dataWindow.yMax+1)/i.scanlineBlockSize;for(var o=0;o<i.blockCount;o++)T(t,a);i.outputChannels=3==i.channels?4:i.channels;let s=i.width*i.height*i.outputChannels;switch(n){case g.FloatType:i.byteArray=new Float32Array(s),i.channels<i.outputChannels&&i.byteArray.fill(1,0,s);break;case g.HalfFloatType:i.byteArray=new Uint16Array(s),i.channels<i.outputChannels&&i.byteArray.fill(15360,0,s);break;default:console.error("THREE.EXRLoader: unsupported type: ",n)}return i.bytesPerLine=i.width*i.inputSize*i.channels,4==i.outputChannels?i.format=g.RGBAFormat:i.format=g.RedFormat,e7?i.colorSpace="srgb-linear":i.encoding=3e3,i}(P,U,_,k,this.type),O={value:0},H={R:0,G:1,B:2,A:3,Y:0};for(let e=0;e<L.height/L.scanlineBlockSize;e++){let t=w(U,k);L.size=w(U,k),L.lines=t+L.scanlineBlockSize>L.height?L.height-t:L.scanlineBlockSize;let r=L.size<L.lines*L.bytesPerLine?L.uncompress(L):A(L);k.value+=L.size;for(let t=0;t<L.scanlineBlockSize;t++){let a=t+e*L.scanlineBlockSize;if(a>=L.height)break;for(let e=0;e<L.channels;e++){let n=H[P.channels[e].name];for(let i=0;i<L.width;i++){O.value=(t*(L.channels*L.width)+e*L.width+i)*L.inputSize;let o=(L.height-1-a)*(L.width*L.outputChannels)+i*L.outputChannels+n;L.byteArray[o]=L.getter(r,O)}}}}return{header:P,width:L.width,height:L.height,data:L.byteArray,format:L.format,[e7?"colorSpace":"encoding"]:L[e7?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,r,a){return super.load(e,function(e,r){e7?e.colorSpace=r.colorSpace:e.encoding=r.encoding,e.minFilter=g.LinearFilter,e.magFilter=g.LinearFilter,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,r)},r,a)}}let tt=(e,t,r)=>{let a;switch(e){case h.UnsignedByteType:a=new Uint8ClampedArray(t*r*4);break;case h.HalfFloatType:a=new Uint16Array(t*r*4);break;case h.UnsignedIntType:a=new Uint32Array(t*r*4);break;case h.ByteType:a=new Int8Array(t*r*4);break;case h.ShortType:a=new Int16Array(t*r*4);break;case h.IntType:a=new Int32Array(t*r*4);break;case h.FloatType:a=new Float32Array(t*r*4);break;default:throw Error("Unsupported data type")}return a};class tr{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const r={format:h.RGBAFormat,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0&&e.renderTargetOptions?.generateMipmaps,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:h.LinearFilter,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:h.LinearFilter,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:h.ClampToEdgeWrapping,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:h.ClampToEdgeWrapping};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=tr.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new h.Scene,this._camera=new h.OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,r,a,n)=>{if(void 0!==t)return t;let i=new h.WebGLRenderTarget(1,1,n);r.setRenderTarget(i);let o=new h.Mesh(new h.PlaneGeometry,new h.MeshBasicMaterial({color:0xffffff}));r.render(o,a),r.setRenderTarget(null);let s=tt(e,i.width,i.height);return r.readRenderTargetPixels(i,0,0,i.width,i.height,s),i.dispose(),o.geometry.dispose(),o.material.dispose(),t=0!==s[0]})(this._type,this._renderer,this._camera,r)){let e;this._type===h.HalfFloatType&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?h.FloatType:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${h.FloatType}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new h.Mesh(new h.PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new h.WebGLRenderTarget(this.width,this.height,r),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:h.UVMapping}static instantiateRenderer(){let e=new c.WebGLRenderer;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=tt(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new h.DataTexture(this.toArray(),this.width,this.height,h.RGBAFormat,this._type,e?.mapping||h.UVMapping,e?.wrapS||h.ClampToEdgeWrapping,e?.wrapT||h.ClampToEdgeWrapping,e?.magFilter||h.LinearFilter,e?.minFilter||h.LinearFilter,e?.anisotropy||1,h.LinearSRGBColorSpace);return t.generateMipmaps=e?.generateMipmaps!==void 0&&e?.generateMipmaps,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof h.ShaderMaterial&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof h.Texture&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof h.Texture&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var ta=h;class tn extends Error{}class ti extends Error{}let to=(e,t,r)=>{let a=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(a)return a[1];let n=RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){let e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==r)return r;throw Error(`Can't find ${t} in gainmap metadata`)};class ts{options;constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,r)=>{let a,n=this.options.debug,i=new DataView(e.buffer);if(65496!==i.getUint16(0))return void r(Error("Not a valid jpeg"));let o=i.byteLength,s=2,l=0;for(;s<o;){if(++l>250)return void r(Error(`Found no marker after ${l} loops 😵`));if(255!==i.getUint8(s))return void r(Error(`Not a valid marker at offset 0x${s.toString(16)}, found: 0x${i.getUint8(s).toString(16)}`));if(a=i.getUint8(s+1),n&&console.log(`Marker: ${a.toString(16)}`),226===a){n&&console.log("Found APP2 marker (0xffe2)");let e=s+4;if(0x4d504600===i.getUint32(e)){let a,n=e+4;if(18761===i.getUint16(n))a=!1;else{if(19789!==i.getUint16(n))return void r(Error("No valid endianness marker found in TIFF header"));a=!0}if(42!==i.getUint16(n+2,!a))return void r(Error("Not valid TIFF data! (no 0x002A marker)"));let o=i.getUint32(n+4,!a);if(o<8)return void r(Error("Not valid TIFF data! (First offset less than 8)"));let s=n+o,l=i.getUint16(s,!a),u=s+2,h=0;for(let e=u;e<u+12*l;e+=12)45057===i.getUint16(e,!a)&&(h=i.getUint32(e+8,!a));let c=s+2+12*l+4,d=[];for(let e=c;e<c+16*h;e+=16){let t={MPType:i.getUint32(e,!a),size:i.getUint32(e+4,!a),dataOffset:i.getUint32(e+8,!a),dependantImages:i.getUint32(e+12,!a),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=n+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){let e=new Blob([i]),r=[];for(let t of d){if(t.isFII&&!this.options.extractFII)continue;let a=e.slice(t.start,t.end+1,"image/jpeg");r.push(a)}t(r)}}}s+=2+i.getUint16(s+2)}})}}let tl=async e=>{let t=(e=>{let t,r=(t="u">typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta");for(;-1!==r;){let e=t.indexOf("x:xmpmeta>",r),a=t.slice(r,e+10);try{let e=to(a,"hdrgm:GainMapMin","0"),t=to(a,"hdrgm:GainMapMax"),r=to(a,"hdrgm:Gamma","1"),n=to(a,"hdrgm:OffsetSDR","0.015625"),i=to(a,"hdrgm:OffsetHDR","0.015625"),o=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(a),s=o?o[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(a);if(!l)throw Error("Incomplete gainmap metadata");let u=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(r)?r.map(e=>parseFloat(e)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],hdrCapacityMin:parseFloat(s),hdrCapacityMax:parseFloat(u)}}catch(e){}r=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new ti("Gain map XMP metadata not found");let r=new ts({extractFII:!0,extractNonFII:!0}),a=await r.extract(e);if(2!==a.length)throw new tn("Gain map recovery image not found");return{sdr:new Uint8Array(await a[0].arrayBuffer()),gainMap:new Uint8Array(await a[1].arrayBuffer()),metadata:t}},tu=e=>new Promise((t,r)=>{let a=document.createElement("img");a.onload=()=>{t(a)},a.onerror=e=>{r(e)},a.src=URL.createObjectURL(e)});class th extends ta.Loader{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new ta.LoadingManager}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ta.Texture,sdr:new ta.Texture});return this._config.createQuadRenderer({width:16,height:16,type:ta.HalfFloatType,colorSpace:ta.LinearSRGBColorSpace,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,r){let a,n,i=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"}),s=!1;if("u"<typeof createImageBitmap){let e=await Promise.all([i?tu(i):Promise.resolve(void 0),tu(o)]);n=e[0],a=e[1],s="flipY"===r}else{let e=await Promise.all([i?createImageBitmap(i,{imageOrientation:r||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:r||"flipY"})]);n=e[0],a=e[1]}return{sdrImage:a,gainMapImage:n,needsFlip:s}}createTextures(e,t,r){let a=new ta.Texture(t||new ImageData(2,2),ta.UVMapping,ta.ClampToEdgeWrapping,ta.ClampToEdgeWrapping,ta.LinearFilter,ta.LinearMipMapLinearFilter,ta.RGBAFormat,ta.UnsignedByteType,1,ta.LinearSRGBColorSpace);a.flipY=r,a.needsUpdate=!0;let n=new ta.Texture(e,ta.UVMapping,ta.ClampToEdgeWrapping,ta.ClampToEdgeWrapping,ta.LinearFilter,ta.LinearMipMapLinearFilter,ta.RGBAFormat,ta.UnsignedByteType,1,ta.SRGBColorSpace);return n.flipY=r,n.needsUpdate=!0,{gainMap:a,sdr:n}}updateQuadRenderer(e,t,r,a,n){e.width=t.width,e.height=t.height,e.material.gainMap=r,e.material.sdr=a,e.material.gainMapMin=n.gainMapMin,e.material.gainMapMax=n.gainMapMax,e.material.offsetHdr=n.offsetHdr,e.material.offsetSdr=n.offsetSdr,e.material.gamma=n.gamma,e.material.hdrCapacityMin=n.hdrCapacityMin,e.material.hdrCapacityMax=n.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),e.material.needsUpdate=!0}}var tc=h;let td=`
|
|
205
|
+
varying vec2 vUv;
|
|
206
|
+
|
|
207
|
+
void main() {
|
|
208
|
+
vUv = uv;
|
|
209
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
210
|
+
}
|
|
211
|
+
`,tf=`
|
|
212
|
+
// min half float value
|
|
213
|
+
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
|
|
214
|
+
// max half float value
|
|
215
|
+
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
|
|
216
|
+
|
|
217
|
+
uniform sampler2D sdr;
|
|
218
|
+
uniform sampler2D gainMap;
|
|
219
|
+
uniform vec3 gamma;
|
|
220
|
+
uniform vec3 offsetHdr;
|
|
221
|
+
uniform vec3 offsetSdr;
|
|
222
|
+
uniform vec3 gainMapMin;
|
|
223
|
+
uniform vec3 gainMapMax;
|
|
224
|
+
uniform float weightFactor;
|
|
225
|
+
|
|
226
|
+
varying vec2 vUv;
|
|
227
|
+
|
|
228
|
+
void main() {
|
|
229
|
+
vec3 rgb = texture2D( sdr, vUv ).rgb;
|
|
230
|
+
vec3 recovery = texture2D( gainMap, vUv ).rgb;
|
|
231
|
+
vec3 logRecovery = pow( recovery, gamma );
|
|
232
|
+
vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
|
|
233
|
+
vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
|
|
234
|
+
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
|
|
235
|
+
gl_FragColor = vec4( clampedHdrColor , 1.0 );
|
|
236
|
+
}
|
|
237
|
+
`;class tp extends tc.ShaderMaterial{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:a,gainMapMax:n,maxDisplayBoost:i,hdrCapacityMin:o,hdrCapacityMax:s,sdr:l,gainMap:u}){super({name:"GainMapDecoderMaterial",vertexShader:td,fragmentShader:tf,uniforms:{sdr:{value:l},gainMap:{value:u},gamma:{value:new tc.Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new tc.Vector3().fromArray(t)},offsetSdr:{value:new tc.Vector3().fromArray(r)},gainMapMin:{value:new tc.Vector3().fromArray(a)},gainMapMax:{value:new tc.Vector3().fromArray(n)},weightFactor:{value:(Math.log2(i)-o)/(s-o)}},blending:tc.NoBlending,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=o,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}c.WebGLRenderer;class tm extends th{constructor(e,t){super({renderer:e,createMaterial:e=>new tp(e),createQuadRenderer:e=>new tr(e)},t)}async render(e,t,r,a){let{sdrImage:n,gainMapImage:i,needsFlip:o}=await this.processImages(r,a,"flipY"),{gainMap:s,sdr:l}=this.createTextures(n,i,o);this.updateQuadRenderer(e,n,s,l,t),e.render()}}class tg extends tm{load([e,t,r],a,n,i){let o,s,l,u=this.prepareQuadRenderer(),h=async()=>{if(o&&s&&l){try{await this.render(u,l,o,s)}catch(a){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(r),"function"==typeof i&&i(a),u.disposeOnDemandRenderer();return}"function"==typeof a&&a(u),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(r),u.disposeOnDemandRenderer()}},c=!0,d=0,f=0,p=!0,m=0,g=0,A=!0,v=0,B=0,y=()=>{"function"==typeof n&&n(new ProgressEvent("progress",{lengthComputable:c&&p&&A,loaded:f+g+B,total:d+m+v}))};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(r);let C=new tc.FileLoader(this._internalLoadingManager);C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(e,async e=>{if("string"==typeof e)throw Error("Invalid sdr buffer");o=e,await h()},e=>{c=e.lengthComputable,f=e.loaded,d=e.total,y()},t=>{this.manager.itemError(e),"function"==typeof i&&i(t)});let b=new tc.FileLoader(this._internalLoadingManager);b.setResponseType("arraybuffer"),b.setRequestHeader(this.requestHeader),b.setPath(this.path),b.setWithCredentials(this.withCredentials),b.load(t,async e=>{if("string"==typeof e)throw Error("Invalid gainmap buffer");s=e,await h()},e=>{p=e.lengthComputable,g=e.loaded,m=e.total,y()},e=>{this.manager.itemError(t),"function"==typeof i&&i(e)});let M=new tc.FileLoader(this._internalLoadingManager);return M.setRequestHeader(this.requestHeader),M.setPath(this.path),M.setWithCredentials(this.withCredentials),M.load(r,async e=>{if("string"!=typeof e)throw Error("Invalid metadata string");l=JSON.parse(e),await h()},e=>{A=e.lengthComputable,B=e.loaded,v=e.total,y()},e=>{this.manager.itemError(r),"function"==typeof i&&i(e)}),u}}class tA extends tm{load(e,t,r,a){let n=this.prepareQuadRenderer(),i=new tc.FileLoader(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async r=>{let i,o,s;if("string"==typeof r)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(r);try{let e=await tl(l);i=e.sdr,o=e.gainMap,s=e.metadata}catch(t){if(t instanceof ti||t instanceof tn)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),s={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},i=l;else throw t}try{await this.render(n,s,i.buffer,o?.buffer)}catch(t){this.manager.itemError(e),"function"==typeof a&&a(t),n.disposeOnDemandRenderer();return}"function"==typeof t&&t(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},r,t=>{this.manager.itemError(e),"function"==typeof a&&a(t)}),n}}let tv={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},tB="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",ty=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function tC({files:e=ty,path:t="",preset:r,colorSpace:n,extensions:o}={}){r&&(tx(r),e=tv[r],t=tB);let s=Array.isArray(e),{extension:l,isCubemap:u}=tw(e),c=tE(l);if(!c)throw Error("useEnvironment: Unrecognized file extension: "+e);let d=(0,i.useThree)(e=>e.gl);(0,a.useLayoutEffect)(()=>{("webp"===l||"jpg"===l||"jpeg"===l)&&d.domElement.addEventListener("webglcontextlost",function(){f.useLoader.clear(c,s?[e]:e)},{once:!0})},[e,d.domElement]);let p=(0,f.useLoader)(c,s?[e]:e,e=>{("webp"===l||"jpg"===l||"jpeg"===l)&&e.setRenderer(d),null==e.setPath||e.setPath(t),o&&o(e)}),m=s?p[0]:p;if("jpg"===l||"jpeg"===l||"webp"===l){var g;m=null==(g=m.renderTarget)?void 0:g.texture}return m.mapping=u?h.CubeReflectionMapping:h.EquirectangularReflectionMapping,m.colorSpace=null!=n?n:u?"srgb":"srgb-linear",m}let tb={files:ty,path:"",preset:void 0,extensions:void 0};tC.preload=e=>{let t={...tb,...e},{files:r,path:a=""}=t,{preset:n,extensions:i}=t;n&&(tx(n),r=tv[n],a=tB);let{extension:o}=tw(r);if("webp"===o||"jpg"===o||"jpeg"===o)throw Error("useEnvironment: Preloading gainmaps is not supported");let s=tE(o);if(!s)throw Error("useEnvironment: Unrecognized file extension: "+r);f.useLoader.preload(s,Array.isArray(r)?[r]:r,e=>{null==e.setPath||e.setPath(a),i&&i(e)})};let tM={files:ty,preset:void 0};function tx(e){if(!(e in tv))throw Error("Preset must be one of: "+Object.keys(tv).join(", "))}function tw(e){var t;let r=Array.isArray(e)&&6===e.length,a=Array.isArray(e)&&3===e.length&&e.some(e=>e.endsWith("json")),n=Array.isArray(e)?e[0]:e;return{extension:r?"cube":a?"webp":n.startsWith("data:application/exr")?"exr":n.startsWith("data:application/hdr")?"hdr":n.startsWith("data:image/jpeg")?"jpg":null==(t=n.split(".").pop())||null==(t=t.split("?"))||null==(t=t.shift())?void 0:t.toLowerCase(),isCubemap:r,isGainmap:a}}function tE(e){return"cube"===e?h.CubeTextureLoader:"hdr"===e?m:"exr"===e?te:"jpg"===e||"jpeg"===e?tA:"webp"===e?tg:null}function tF(e,t,r,a,n={}){var i,o,s,u,h;let c;n={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...n};let d=(c=h=t||r).current&&c.current.isScene?h.current:h,f=d.background,p=d.environment,m={backgroundBlurriness:d.backgroundBlurriness,backgroundIntensity:d.backgroundIntensity,backgroundRotation:null!=(i=null==(o=d.backgroundRotation)||null==o.clone?void 0:o.clone())?i:[0,0,0],environmentIntensity:d.environmentIntensity,environmentRotation:null!=(s=null==(u=d.environmentRotation)||null==u.clone?void 0:u.clone())?s:[0,0,0]};return"only"!==e&&(d.environment=a),e&&(d.background=a),(0,l.applyProps)(d,n),()=>{"only"!==e&&(d.environment=p),e&&(d.background=f),(0,l.applyProps)(d,m)}}function tT({scene:e,background:t=!1,map:r,...n}){let o=(0,i.useThree)(e=>e.scene);return a.useLayoutEffect(()=>{if(r)return tF(t,e,o,r,n)}),null}function tS({background:e=!1,scene:t,blur:r,backgroundBlurriness:n,backgroundIntensity:o,backgroundRotation:s,environmentIntensity:l,environmentRotation:u,...h}){let c=tC(h),d=(0,i.useThree)(e=>e.scene);return a.useLayoutEffect(()=>tF(e,t,d,c,{backgroundBlurriness:null!=r?r:n,backgroundIntensity:o,backgroundRotation:s,environmentIntensity:l,environmentRotation:u})),a.useEffect(()=>()=>{c.dispose()},[c]),null}function tI({children:e,near:t=.1,far:r=1e3,resolution:n=256,frames:l=1,map:u,background:d=!1,blur:f,backgroundBlurriness:p,backgroundIntensity:m,backgroundRotation:g,environmentIntensity:A,environmentRotation:v,scene:B,files:y,path:C,preset:b,extensions:M}){let x=(0,i.useThree)(e=>e.gl),w=(0,i.useThree)(e=>e.scene),E=a.useRef(null),[F]=a.useState(()=>new h.Scene),T=a.useMemo(()=>{let e=new c.WebGLCubeRenderTarget(n);return e.texture.type=h.HalfFloatType,e},[n]);a.useEffect(()=>()=>{T.dispose()},[T]),a.useLayoutEffect(()=>{if(1===l){let e=x.autoClear;x.autoClear=!0,E.current.update(x,F),x.autoClear=e}return tF(d,B,w,T.texture,{backgroundBlurriness:null!=f?f:p,backgroundIntensity:m,backgroundRotation:g,environmentIntensity:A,environmentRotation:v})},[e,F,T.texture,B,w,d,l,x]);let S=1;return(0,o.useFrame)(()=>{if(l===1/0||S<l){let e=x.autoClear;x.autoClear=!0,E.current.update(x,F),x.autoClear=e,S++}}),a.createElement(a.Fragment,null,(0,s.createPortal)(a.createElement(a.Fragment,null,e,a.createElement("cubeCamera",{ref:E,args:[t,r,T]}),y||b?a.createElement(tS,{background:!0,files:y,preset:b,path:C,extensions:M}):u?a.createElement(tT,{background:!0,map:u,extensions:M}):null),F))}function tR(e){var t,r,i,o;let s=tC(e),l=e.map||s;a.useMemo(()=>(0,u.extend)({GroundProjectedEnvImpl:d.GroundProjectedEnv}),[]),a.useEffect(()=>()=>{s.dispose()},[s]);let h=a.useMemo(()=>[l],[l]),c=null==(t=e.ground)?void 0:t.height,f=null==(r=e.ground)?void 0:r.radius,p=null!=(i=null==(o=e.ground)?void 0:o.scale)?i:1e3;return a.createElement(a.Fragment,null,a.createElement(tT,(0,n.default)({},e,{map:l})),a.createElement("groundProjectedEnvImpl",{args:h,scale:p,height:c,radius:f}))}function tG(e){return e.ground?a.createElement(tR,e):e.map?a.createElement(tT,e):e.children?a.createElement(tI,e):a.createElement(tS,e)}tC.clear=e=>{let t={...tM,...e},{files:r}=t,{preset:a}=t;a&&(tx(a),r=tv[a]);let{extension:n}=tw(r),i=tE(n);if(!i)throw Error("useEnvironment: Unrecognized file extension: "+r);f.useLoader.clear(i,Array.isArray(r)?[r]:r)};var tD=e.i(83646),tU=e.i(83402);let t_=()=>{let{scene:e}=(0,tD.default)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("hemisphereLight",{args:[e.light,e.ground,e.ambient]}),(0,r.jsx)("ambientLight",{intensity:.5*e.ambient,color:e.light}),(0,r.jsx)("directionalLight",{position:[30,80,60],intensity:e.keyLight,color:e.light,castShadow:!1}),(0,r.jsx)("directionalLight",{position:[-20,40,-100],intensity:e.fillLight,color:e.rimLight})]})};e.s(["default",0,({backdrop:e=!0,fogNear:t=40,fogFar:a=420,fogColor:n})=>{let{scene:i}=(0,tD.default)(),o=!0===tU.default.get("metallicEffect");return(0,r.jsxs)(r.Fragment,{children:[e&&(0,r.jsx)("color",{attach:"background",args:[i.background]}),e&&(0,r.jsx)("fog",{attach:"fog",args:[n||i.background,t,a]}),(0,r.jsx)(t_,{}),o&&(0,r.jsx)(tG,{files:"./assets/ocearo_env.hdr",background:!1,environmentIntensity:.6,resolution:128})]})}],73919);var tk=e.i(78461);let tP=()=>tU.default.get("aisLengthScalingFactor")||.7,tL=`
|
|
238
|
+
varying vec2 vLocal;
|
|
239
|
+
void main() {
|
|
240
|
+
vLocal = position.xy;
|
|
241
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
242
|
+
}
|
|
243
|
+
`,tO=`
|
|
244
|
+
uniform vec3 uGround;
|
|
245
|
+
uniform vec3 uLine;
|
|
246
|
+
uniform vec3 uBackground;
|
|
247
|
+
uniform vec2 uOffset;
|
|
248
|
+
uniform float uSpacing;
|
|
249
|
+
uniform float uFadeNear;
|
|
250
|
+
uniform float uFadeFar;
|
|
251
|
+
varying vec2 vLocal;
|
|
252
|
+
|
|
253
|
+
void main() {
|
|
254
|
+
vec2 world = vLocal + uOffset;
|
|
255
|
+
vec2 cell = abs(fract(world / uSpacing - 0.5) - 0.5) / fwidth(world / uSpacing);
|
|
256
|
+
float line = 1.0 - min(min(cell.x, cell.y), 1.0);
|
|
257
|
+
|
|
258
|
+
float dist = length(vLocal);
|
|
259
|
+
float gridFade = 1.0 - smoothstep(uFadeNear * 0.4, uFadeNear, dist);
|
|
260
|
+
vec3 color = mix(uGround, uLine, line * 0.4 * gridFade);
|
|
261
|
+
color = mix(color, uBackground, smoothstep(uFadeNear, uFadeFar, dist));
|
|
262
|
+
gl_FragColor = vec4(color, 1.0);
|
|
263
|
+
// Uniform colours are linear: convert for the screen like built-in materials
|
|
264
|
+
#include <colorspace_fragment>
|
|
265
|
+
}
|
|
266
|
+
`;e.s(["default",0,({y:e=-.32})=>{let{scene:t}=(0,tD.default)(),{heading:n,offset:i}=(0,tk.default)(),o=(0,a.useMemo)(()=>new h.ShaderMaterial({uniforms:{uGround:{value:new h.Color},uLine:{value:new h.Color},uBackground:{value:new h.Color},uOffset:{value:new h.Vector2},uSpacing:{value:50*tP()},uFadeNear:{value:220},uFadeFar:{value:1100}},vertexShader:tL,fragmentShader:tO,depthWrite:!1}),[]);return(0,a.useEffect)(()=>{o.uniforms.uGround.value.set(t.ground),o.uniforms.uLine.value.set(t.grid),o.uniforms.uBackground.value.set(t.background)},[o,t]),(0,a.useEffect)(()=>{let e=o.uniforms.uSpacing.value,t=tP();o.uniforms.uOffset.value.set(i.x*t%e,i.y*t%e)},[o,i]),(0,a.useEffect)(()=>()=>o.dispose(),[o]),(0,r.jsx)("group",{rotation:[0,n,0],position:[0,e,0],children:(0,r.jsx)("mesh",{rotation:[-Math.PI/2,0,0],material:o,renderOrder:-1,children:(0,r.jsx)("circleGeometry",{args:[2400,64]})})})}],20440)},30297,82897,e=>{"use strict";var t=e.i(31067),r=e.i(90874),a=e.i(95393),n=e.i(71645),i=e.i(90072),o=Object.defineProperty;class s{constructor(){((e,t)=>{let r,a;a=void 0,(r="symbol"!=typeof t?t+"":t)in e?o(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a})(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,a=r.length;t<a;t++)r[t].call(this,e);e.target=null}}}var l=Object.defineProperty,u=(e,t,r)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?l(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,r};let h=new i.Ray,c=new i.Plane,d=Math.cos(Math.PI/180*70),f=(e,t)=>(e%t+t)%t;class p extends s{constructor(e,t){super(),u(this,"object"),u(this,"domElement"),u(this,"enabled",!0),u(this,"target",new i.Vector3),u(this,"minDistance",0),u(this,"maxDistance",1/0),u(this,"minZoom",0),u(this,"maxZoom",1/0),u(this,"minPolarAngle",0),u(this,"maxPolarAngle",Math.PI),u(this,"minAzimuthAngle",-1/0),u(this,"maxAzimuthAngle",1/0),u(this,"enableDamping",!1),u(this,"dampingFactor",.05),u(this,"enableZoom",!0),u(this,"zoomSpeed",1),u(this,"enableRotate",!0),u(this,"rotateSpeed",1),u(this,"enablePan",!0),u(this,"panSpeed",1),u(this,"screenSpacePanning",!0),u(this,"keyPanSpeed",7),u(this,"zoomToCursor",!1),u(this,"autoRotate",!1),u(this,"autoRotateSpeed",2),u(this,"reverseOrbit",!1),u(this,"reverseHorizontalOrbit",!1),u(this,"reverseVerticalOrbit",!1),u(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),u(this,"mouseButtons",{LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN}),u(this,"touches",{ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN}),u(this,"target0"),u(this,"position0"),u(this,"zoom0"),u(this,"_domElementKeyEvents",null),u(this,"getPolarAngle"),u(this,"getAzimuthalAngle"),u(this,"setPolarAngle"),u(this,"setAzimuthalAngle"),u(this,"getDistance"),u(this,"getZoomScale"),u(this,"listenToKeyEvents"),u(this,"stopListenToKeyEvents"),u(this,"saveState"),u(this,"reset"),u(this,"update"),u(this,"connect"),u(this,"dispose"),u(this,"dollyIn"),u(this,"dollyOut"),u(this,"getScale"),u(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=e=>{let t=f(e,2*Math.PI),a=m.phi;a<0&&(a+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-a);2*Math.PI-n<n&&(t<a?t+=2*Math.PI:a+=2*Math.PI),g.phi=t-a,r.update()},this.setAzimuthalAngle=e=>{let t=f(e,2*Math.PI),a=m.theta;a<0&&(a+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-a);2*Math.PI-n<n&&(t<a?t+=2*Math.PI:a+=2*Math.PI),g.theta=t-a,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",ee),this._domElementKeyEvents=e},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ee),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(a),r.update(),l=s.NONE},this.update=(()=>{let t=new i.Vector3,n=new i.Vector3(0,1,0),o=new i.Quaternion().setFromUnitVectors(e.up,n),u=o.clone().invert(),f=new i.Vector3,B=new i.Quaternion,y=2*Math.PI;return function(){let C=r.object.position;o.setFromUnitVectors(e.up,n),u.copy(o).invert(),t.copy(C).sub(r.target),t.applyQuaternion(o),m.setFromVector3(t),r.autoRotate&&l===s.NONE&&U(2*Math.PI/60/60*r.autoRotateSpeed),r.enableDamping?(m.theta+=g.theta*r.dampingFactor,m.phi+=g.phi*r.dampingFactor):(m.theta+=g.theta,m.phi+=g.phi);let b=r.minAzimuthAngle,M=r.maxAzimuthAngle;isFinite(b)&&isFinite(M)&&(b<-Math.PI?b+=y:b>Math.PI&&(b-=y),M<-Math.PI?M+=y:M>Math.PI&&(M-=y),b<=M?m.theta=Math.max(b,Math.min(M,m.theta)):m.theta=m.theta>(b+M)/2?Math.max(b,m.theta):Math.min(M,m.theta)),m.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,m.phi)),m.makeSafe(),!0===r.enableDamping?r.target.addScaledVector(v,r.dampingFactor):r.target.add(v),r.zoomToCursor&&I||r.object.isOrthographicCamera?m.radius=j(m.radius):m.radius=j(m.radius*A),t.setFromSpherical(m),t.applyQuaternion(u),C.copy(r.target).add(t),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),!0===r.enableDamping?(g.theta*=1-r.dampingFactor,g.phi*=1-r.dampingFactor,v.multiplyScalar(1-r.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let x=!1;if(r.zoomToCursor&&I){let a=null;if(r.object instanceof i.PerspectiveCamera&&r.object.isPerspectiveCamera){let e=t.length();a=j(e*A);let n=e-a;r.object.position.addScaledVector(T,n),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){let e=new i.Vector3(S.x,S.y,0);e.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/A)),r.object.updateProjectionMatrix(),x=!0;let n=new i.Vector3(S.x,S.y,0);n.unproject(r.object),r.object.position.sub(n).add(e),r.object.updateMatrixWorld(),a=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;null!==a&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(a).add(r.object.position):(h.origin.copy(r.object.position),h.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(h.direction))<d?e.lookAt(r.target):(c.setFromNormalAndCoplanarPoint(r.object.up,r.target),h.intersectPlane(c,r.target))))}else r.object instanceof i.OrthographicCamera&&r.object.isOrthographicCamera&&(x=1!==A)&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/A)),r.object.updateProjectionMatrix());return A=1,I=!1,!!(x||f.distanceToSquared(r.object.position)>p||8*(1-B.dot(r.object.quaternion))>p)&&(r.dispatchEvent(a),f.copy(r.object.position),B.copy(r.object.quaternion),x=!1,!0)}})(),this.connect=e=>{r.domElement=e,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",et),r.domElement.addEventListener("pointerdown",Y),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",$)},this.dispose=()=>{var e,t,a,n,i,o;r.domElement&&(r.domElement.style.touchAction="auto"),null==(e=r.domElement)||e.removeEventListener("contextmenu",et),null==(t=r.domElement)||t.removeEventListener("pointerdown",Y),null==(a=r.domElement)||a.removeEventListener("pointercancel",q),null==(n=r.domElement)||n.removeEventListener("wheel",$),null==(i=r.domElement)||i.ownerDocument.removeEventListener("pointermove",Z),null==(o=r.domElement)||o.ownerDocument.removeEventListener("pointerup",q),null!==r._domElementKeyEvents&&r._domElementKeyEvents.removeEventListener("keydown",ee)};const r=this,a={type:"change"},n={type:"start"},o={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=s.NONE;const p=1e-6,m=new i.Spherical,g=new i.Spherical;let A=1;const v=new i.Vector3,B=new i.Vector2,y=new i.Vector2,C=new i.Vector2,b=new i.Vector2,M=new i.Vector2,x=new i.Vector2,w=new i.Vector2,E=new i.Vector2,F=new i.Vector2,T=new i.Vector3,S=new i.Vector2;let I=!1;const R=[],G={};function D(){return Math.pow(.95,r.zoomSpeed)}function U(e){r.reverseOrbit||r.reverseHorizontalOrbit?g.theta+=e:g.theta-=e}function _(e){r.reverseOrbit||r.reverseVerticalOrbit?g.phi+=e:g.phi-=e}const k=(()=>{let e=new i.Vector3;return function(t,r){e.setFromMatrixColumn(r,0),e.multiplyScalar(-t),v.add(e)}})(),P=(()=>{let e=new i.Vector3;return function(t,a){!0===r.screenSpacePanning?e.setFromMatrixColumn(a,1):(e.setFromMatrixColumn(a,0),e.crossVectors(r.object.up,e)),e.multiplyScalar(t),v.add(e)}})(),L=(()=>{let e=new i.Vector3;return function(t,a){let n=r.domElement;if(n&&r.object instanceof i.PerspectiveCamera&&r.object.isPerspectiveCamera){let i=r.object.position;e.copy(i).sub(r.target);let o=e.length();k(2*t*(o*=Math.tan(r.object.fov/2*Math.PI/180))/n.clientHeight,r.object.matrix),P(2*a*o/n.clientHeight,r.object.matrix)}else n&&r.object instanceof i.OrthographicCamera&&r.object.isOrthographicCamera?(k(t*(r.object.right-r.object.left)/r.object.zoom/n.clientWidth,r.object.matrix),P(a*(r.object.top-r.object.bottom)/r.object.zoom/n.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function O(e){r.object instanceof i.PerspectiveCamera&&r.object.isPerspectiveCamera||r.object instanceof i.OrthographicCamera&&r.object.isOrthographicCamera?A=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function H(e){if(!r.zoomToCursor||!r.domElement)return;I=!0;let t=r.domElement.getBoundingClientRect(),a=e.clientX-t.left,n=e.clientY-t.top,i=t.width,o=t.height;S.x=a/i*2-1,S.y=-(n/o*2)+1,T.set(S.x,S.y,1).unproject(r.object).sub(r.object.position).normalize()}function j(e){return Math.max(r.minDistance,Math.min(r.maxDistance,e))}function J(e){B.set(e.clientX,e.clientY)}function N(e){b.set(e.clientX,e.clientY)}function K(){if(1==R.length)B.set(R[0].pageX,R[0].pageY);else{let e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY);B.set(e,t)}}function W(){if(1==R.length)b.set(R[0].pageX,R[0].pageY);else{let e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY);b.set(e,t)}}function V(){let e=R[0].pageX-R[1].pageX,t=R[0].pageY-R[1].pageY,r=Math.sqrt(e*e+t*t);w.set(0,r)}function X(e){if(1==R.length)y.set(e.pageX,e.pageY);else{let t=ea(e),r=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);y.set(r,a)}C.subVectors(y,B).multiplyScalar(r.rotateSpeed);let t=r.domElement;t&&(U(2*Math.PI*C.x/t.clientHeight),_(2*Math.PI*C.y/t.clientHeight)),B.copy(y)}function Q(e){if(1==R.length)M.set(e.pageX,e.pageY);else{let t=ea(e),r=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);M.set(r,a)}x.subVectors(M,b).multiplyScalar(r.panSpeed),L(x.x,x.y),b.copy(M)}function z(e){var t;let a=ea(e),n=e.pageX-a.x,i=e.pageY-a.y,o=Math.sqrt(n*n+i*i);E.set(0,o),F.set(0,Math.pow(E.y/w.y,r.zoomSpeed)),t=F.y,O(A/t),w.copy(E)}function Y(e){var t,a,o;!1!==r.enabled&&(0===R.length&&(null==(t=r.domElement)||t.ownerDocument.addEventListener("pointermove",Z),null==(a=r.domElement)||a.ownerDocument.addEventListener("pointerup",q)),o=e,R.push(o),"touch"===e.pointerType?function(e){switch(er(e),R.length){case 1:switch(r.touches.ONE){case i.TOUCH.ROTATE:if(!1===r.enableRotate)return;K(),l=s.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===r.enablePan)return;W(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===r.enableZoom&&!1===r.enablePan)return;r.enableZoom&&V(),r.enablePan&&W(),l=s.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===r.enableZoom&&!1===r.enableRotate)return;r.enableZoom&&V(),r.enableRotate&&K(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(n)}(e):function(e){let t;switch(e.button){case 0:t=r.mouseButtons.LEFT;break;case 1:t=r.mouseButtons.MIDDLE;break;case 2:t=r.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===r.enableZoom)return;H(e),w.set(e.clientX,e.clientY),l=s.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===r.enablePan)return;N(e),l=s.PAN}else{if(!1===r.enableRotate)return;J(e),l=s.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===r.enableRotate)return;J(e),l=s.ROTATE}else{if(!1===r.enablePan)return;N(e),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(n)}(e))}function Z(e){!1!==r.enabled&&("touch"===e.pointerType?function(e){switch(er(e),l){case s.TOUCH_ROTATE:if(!1===r.enableRotate)return;X(e),r.update();break;case s.TOUCH_PAN:if(!1===r.enablePan)return;Q(e),r.update();break;case s.TOUCH_DOLLY_PAN:if(!1===r.enableZoom&&!1===r.enablePan)return;r.enableZoom&&z(e),r.enablePan&&Q(e),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===r.enableZoom&&!1===r.enableRotate)return;r.enableZoom&&z(e),r.enableRotate&&X(e),r.update();break;default:l=s.NONE}}(e):function(e){if(!1!==r.enabled)switch(l){case s.ROTATE:let t;if(!1===r.enableRotate)return;y.set(e.clientX,e.clientY),C.subVectors(y,B).multiplyScalar(r.rotateSpeed),(t=r.domElement)&&(U(2*Math.PI*C.x/t.clientHeight),_(2*Math.PI*C.y/t.clientHeight)),B.copy(y),r.update();break;case s.DOLLY:var a,n;if(!1===r.enableZoom)return;(E.set(e.clientX,e.clientY),F.subVectors(E,w),F.y>0)?(a=D(),O(A/a)):F.y<0&&(n=D(),O(A*n)),w.copy(E),r.update();break;case s.PAN:if(!1===r.enablePan)return;M.set(e.clientX,e.clientY),x.subVectors(M,b).multiplyScalar(r.panSpeed),L(x.x,x.y),b.copy(M),r.update()}}(e))}function q(e){var t,a,n;(function(e){delete G[e.pointerId];for(let t=0;t<R.length;t++)if(R[t].pointerId==e.pointerId)return void R.splice(t,1)})(e),0===R.length&&(null==(t=r.domElement)||t.releasePointerCapture(e.pointerId),null==(a=r.domElement)||a.ownerDocument.removeEventListener("pointermove",Z),null==(n=r.domElement)||n.ownerDocument.removeEventListener("pointerup",q)),r.dispatchEvent(o),l=s.NONE}function $(e){if(!1!==r.enabled&&!1!==r.enableZoom&&(l===s.NONE||l===s.ROTATE)){var t,a;e.preventDefault(),r.dispatchEvent(n),(H(e),e.deltaY<0)?(t=D(),O(A*t)):e.deltaY>0&&(a=D(),O(A/a)),r.update(),r.dispatchEvent(o)}}function ee(e){if(!1!==r.enabled&&!1!==r.enablePan){let t=!1;switch(e.code){case r.keys.UP:L(0,r.keyPanSpeed),t=!0;break;case r.keys.BOTTOM:L(0,-r.keyPanSpeed),t=!0;break;case r.keys.LEFT:L(r.keyPanSpeed,0),t=!0;break;case r.keys.RIGHT:L(-r.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),r.update())}}function et(e){!1!==r.enabled&&e.preventDefault()}function er(e){let t=G[e.pointerId];void 0===t&&(t=new i.Vector2,G[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ea(e){return G[(e.pointerId===R[0].pointerId?R[1]:R[0]).pointerId]}this.dollyIn=(e=D())=>{O(A*e),r.update()},this.dollyOut=(e=D())=>{O(A/e),r.update()},this.getScale=()=>A,this.setScale=e=>{O(e),r.update()},this.getZoomScale=()=>D(),void 0!==t&&this.connect(t),this.update()}}let m=n.forwardRef(({makeDefault:e,camera:i,regress:o,domElement:s,enableDamping:l=!0,keyEvents:u=!1,onChange:h,onStart:c,onEnd:d,...f},m)=>{let g=(0,r.useThree)(e=>e.invalidate),A=(0,r.useThree)(e=>e.camera),v=(0,r.useThree)(e=>e.gl),B=(0,r.useThree)(e=>e.events),y=(0,r.useThree)(e=>e.setEvents),C=(0,r.useThree)(e=>e.set),b=(0,r.useThree)(e=>e.get),M=(0,r.useThree)(e=>e.performance),x=i||A,w=s||B.connected||v.domElement,E=n.useMemo(()=>new p(x),[x]);return(0,a.useFrame)(()=>{E.enabled&&E.update()},-1),n.useEffect(()=>(u&&E.connect(!0===u?w:u),E.connect(w),()=>void E.dispose()),[u,w,o,E,g]),n.useEffect(()=>{let e=e=>{g(),o&&M.regress(),h&&h(e)},t=e=>{c&&c(e)},r=e=>{d&&d(e)};return E.addEventListener("change",e),E.addEventListener("start",t),E.addEventListener("end",r),()=>{E.removeEventListener("start",t),E.removeEventListener("end",r),E.removeEventListener("change",e)}},[h,c,d,E,g,y]),n.useEffect(()=>{if(e){let e=b().controls;return C({controls:E}),()=>C({controls:e})}},[e,E]),n.createElement("primitive",(0,t.default)({ref:m,object:E,enableDamping:l},f))});e.s(["OrbitControls",0,m],30297);let g=n.forwardRef(({envMap:e,resolution:o=256,frames:s=1/0,makeDefault:l,children:u,...h},c)=>{let d=(0,r.useThree)(({set:e})=>e),f=(0,r.useThree)(({camera:e})=>e),p=(0,r.useThree)(({size:e})=>e),m=n.useRef(null);n.useImperativeHandle(c,()=>m.current,[]);let g=n.useRef(null),A=function(e){let t=(0,r.useThree)(e=>e.size),a=(0,r.useThree)(e=>e.viewport),o="number"==typeof e?e:t.width*a.dpr,s=t.height*a.dpr,l=("number"==typeof e?void 0:e)||{},{samples:u=0,depth:h,...c}=l,d=null!=h?h:l.depthBuffer,f=n.useMemo(()=>{let e=new i.WebGLRenderTarget(o,s,{minFilter:i.LinearFilter,magFilter:i.LinearFilter,type:i.HalfFloatType,...c});return d&&(e.depthTexture=new i.DepthTexture(o,s,i.FloatType)),e.samples=u,e},[]);return n.useLayoutEffect(()=>{f.setSize(o,s),u&&(f.samples=u)},[u,f,o,s]),n.useEffect(()=>()=>f.dispose(),[]),f}(o);n.useLayoutEffect(()=>{h.manual||(m.current.aspect=p.width/p.height)},[p,h]),n.useLayoutEffect(()=>{m.current.updateProjectionMatrix()});let v=0,B=null,y="function"==typeof u;return(0,a.useFrame)(t=>{y&&(s===1/0||v<s)&&(g.current.visible=!1,t.gl.setRenderTarget(A),B=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,m.current),t.scene.background=B,t.gl.setRenderTarget(null),g.current.visible=!0,v++)}),n.useLayoutEffect(()=>{if(l)return d(()=>({camera:m.current})),()=>d(()=>({camera:f}))},[m,l,d]),n.createElement(n.Fragment,null,n.createElement("perspectiveCamera",(0,t.default)({ref:m},h),!y&&u),n.createElement("group",{ref:g},y&&u(A.texture)))});e.s(["PerspectiveCamera",0,g],82897)},93282,e=>{"use strict";var t=e.i(61949);e.s(["useLoader",()=>t.H])},80566,e=>{"use strict";var t=e.i(61949);e.s(["extend",()=>t.e])},1888,93059,e=>{"use strict";var t=e.i(61949);e.s(["createPortal",()=>t.q],1888),e.s(["applyProps",()=>t.v],93059)},46457,68911,27543,21359,e=>{"use strict";let t;var r=e.i(90072);function a(e,t){if(t===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==r.TriangleFanDrawMode&&t!==r.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let a=e.getIndex();if(null===a){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),a=e.getIndex()}let n=a.count-2,i=[];if(a)if(t===r.TriangleFanDrawMode)for(let e=1;e<=n;e++)i.push(a.getX(0)),i.push(a.getX(e)),i.push(a.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(i.push(a.getX(e)),i.push(a.getX(e+1)),i.push(a.getX(e+2))):(i.push(a.getX(e+2)),i.push(a.getX(e+1)),i.push(a.getX(e)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=e.clone();return o.setIndex(i),o.clearGroups(),o}}e.s(["toCreasedNormals",0,function(e,t=Math.PI/3){let a=Math.cos(t),n=(1+1e-10)*100,i=[new r.Vector3,new r.Vector3,new r.Vector3],o=new r.Vector3,s=new r.Vector3,l=new r.Vector3,u=new r.Vector3;function h(e){let t=~~(e.x*n),r=~~(e.y*n),a=~~(e.z*n);return`${t},${r},${a}`}let c=e.index?e.toNonIndexed():e,d=c.attributes.position,f={};for(let e=0,t=d.count/3;e<t;e++){let t=3*e,a=i[0].fromBufferAttribute(d,t+0),n=i[1].fromBufferAttribute(d,t+1),l=i[2].fromBufferAttribute(d,t+2);o.subVectors(l,n),s.subVectors(a,n);let u=new r.Vector3().crossVectors(o,s).normalize();for(let e=0;e<3;e++){let t=h(i[e]);t in f||(f[t]=[]),f[t].push(u)}}let p=new Float32Array(3*d.count),m=new r.BufferAttribute(p,3,!1);for(let e=0,t=d.count/3;e<t;e++){let t=3*e,r=i[0].fromBufferAttribute(d,t+0),n=i[1].fromBufferAttribute(d,t+1),c=i[2].fromBufferAttribute(d,t+2);o.subVectors(c,n),s.subVectors(r,n),l.crossVectors(o,s).normalize();for(let e=0;e<3;e++){let r=f[h(i[e])];u.set(0,0,0);for(let e=0,t=r.length;e<t;e++){let t=r[e];l.dot(t)>a&&u.add(t)}u.normalize(),m.setXYZ(t+e,u.x,u.y,u.z)}}return c.setAttribute("normal",m),c},"toTrianglesDrawMode",0,a],68911);var n=e.i(31497);function i(e){if("u">typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,a=e.length;r<a;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let o="srgb",s="srgb-linear";class l extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new p(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new w(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new A(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new B(e)}),this.register(function(e){return new y(e)}),this.register(function(e){return new f(e)}),this.register(function(e){return new C(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new b(e)}),this.register(function(e){return new c(e)}),this.register(function(e){return new F(e)}),this.register(function(e){return new T(e)})}load(e,t,a,n){let i,o=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){let t=r.LoaderUtils.extractUrlBase(e);i=r.LoaderUtils.resolveURL(t,this.path)}else i=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},l=new r.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(r){try{o.parse(r,i,function(r){t(r),o.manager.itemEnd(e)},s)}catch(e){s(e)}},a,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,a){let n,o={},s={};if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer)if(i(new Uint8Array(e.slice(0,4)))===S){try{o[h.KHR_BINARY_GLTF]=new I(e)}catch(e){a&&a(e);return}n=JSON.parse(o[h.KHR_BINARY_GLTF].content)}else n=JSON.parse(i(new Uint8Array(e)));else n=e;if(void 0===n.asset||n.asset.version[0]<2){a&&a(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new Y(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,o[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],r=n.extensionsRequired||[];switch(t){case h.KHR_MATERIALS_UNLIT:o[t]=new d;break;case h.KHR_DRACO_MESH_COMPRESSION:o[t]=new R(n,this.dracoLoader);break;case h.KHR_TEXTURE_TRANSFORM:o[t]=new G;break;case h.KHR_MESH_QUANTIZATION:o[t]=new D;break;default:r.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(o),l.setPlugins(s),l.parse(r,a)}parseAsync(e,t){let r=this;return new Promise(function(a,n){r.parse(e,t,a,n)})}}function u(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let h={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class c{constructor(e){this.parser=e,this.name=h.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,a=t.length;r<a;r++){let a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}_loadLight(e){let t,a=this.parser,n="light:"+e,i=a.cache.get(n);if(i)return i;let o=a.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],u=new r.Color(0xffffff);void 0!==l.color&&u.setRGB(l.color[0],l.color[1],l.color[2],s);let h=void 0!==l.range?l.range:0;switch(l.type){case"directional":(t=new r.DirectionalLight(u)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new r.PointLight(u)).distance=h;break;case"spot":(t=new r.SpotLight(u)).distance=h,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,t.angle=l.spot.outerConeAngle,t.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return t.position.set(0,0,0),t.decay=2,V(t,l),void 0!==l.intensity&&(t.intensity=l.intensity),t.name=a.createUniqueName(l.name||"light_"+e),i=Promise.resolve(t),a.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,r=this.parser,a=r.json.nodes[e],n=(a.extensions&&a.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})}}class d{constructor(){this.name=h.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,a){let n=[];e.color=new r.Color(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],s),e.opacity=t[3]}void 0!==i.baseColorTexture&&n.push(a.assignTexture(e,"map",i.baseColorTexture,o))}return Promise.all(n)}}class f{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let a=r.extensions[this.name].emissiveStrength;return void 0!==a&&(t.emissiveIntensity=a),Promise.resolve()}}class p{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let a=this.parser,n=a.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(a.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(a.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(a.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){let e=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(e,e)}return Promise.all(i)}}class m{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let a=r.extensions[this.name];return t.dispersion=void 0!==a.dispersion?a.dispersion:0,Promise.resolve()}}class g{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,a=r.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();let n=[],i=a.extensions[this.name];return void 0!==i.iridescenceFactor&&(t.iridescence=i.iridescenceFactor),void 0!==i.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),void 0!==i.iridescenceIor&&(t.iridescenceIOR=i.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==i.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),void 0!==i.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),void 0!==i.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(n)}}class A{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let a=this.parser,n=a.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[];t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;let l=n.extensions[this.name];if(void 0!==l.sheenColorFactor){let e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],s)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&i.push(a.assignTexture(t,"sheenColorMap",l.sheenColorTexture,o)),void 0!==l.sheenRoughnessTexture&&i.push(a.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(i)}}class v{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,a=r.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();let n=[],i=a.extensions[this.name];return void 0!==i.transmissionFactor&&(t.transmission=i.transmissionFactor),void 0!==i.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(n)}}class B{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let a=this.parser,n=a.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],o=n.extensions[this.name];t.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(a.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;let l=o.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(l[0],l[1],l[2],s),Promise.all(i)}}class y{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let a=r.extensions[this.name];return t.ior=void 0!==a.ior?a.ior:1.5,Promise.resolve()}}class C{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let a=this.parser,n=a.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],l=n.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&i.push(a.assignTexture(t,"specularIntensityMap",l.specularTexture));let u=l.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(u[0],u[1],u[2],s),void 0!==l.specularColorTexture&&i.push(a.assignTexture(t,"specularColorMap",l.specularColorTexture,o)),Promise.all(i)}}class b{constructor(e){this.parser=e,this.name=h.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,a=r.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();let n=[],i=a.extensions[this.name];return t.bumpScale=void 0!==i.bumpFactor?i.bumpFactor:1,void 0!==i.bumpTexture&&n.push(r.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(n)}}class M{constructor(e){this.parser=e,this.name=h.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,a=r.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();let n=[],i=a.extensions[this.name];return void 0!==i.anisotropyStrength&&(t.anisotropy=i.anisotropyStrength),void 0!==i.anisotropyRotation&&(t.anisotropyRotation=i.anisotropyRotation),void 0!==i.anisotropyTexture&&n.push(r.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(n)}}class x{constructor(e){this.parser=e,this.name=h.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,r=t.json,a=r.textures[e];if(!a.extensions||!a.extensions[this.name])return null;let n=a.extensions[this.name],i=t.options.ktx2Loader;if(!i)if(!(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,i)}}class w{constructor(e){this.parser=e,this.name=h.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,a=r.json,n=a.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=a.images[i.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,s);if(a.extensionsRequired&&a.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class E{constructor(e){this.parser=e,this.name=h.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,a=r.json,n=a.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=a.images[i.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,s);if(a.extensionsRequired&&a.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class F{constructor(e){this.name=h.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],a=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return a.then(function(t){let r=e.byteOffset||0,a=e.byteLength||0,i=e.count,o=e.byteStride,s=new Uint8Array(t,r,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,o,s,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(i*o);return n.decodeGltfBuffer(new Uint8Array(t),i,o,s,e.mode,e.filter),t})})}}}class T{constructor(e){this.name=h.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,a=t.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;for(let e of t.meshes[a.mesh].primitives)if(e.mode!==P.TRIANGLES&&e.mode!==P.TRIANGLE_STRIP&&e.mode!==P.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=a.extensions[this.name].attributes,i=[],o={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(o[e]=t,o[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),a=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of a){let t=new r.Matrix4,a=new r.Vector3,s=new r.Quaternion,l=new r.Vector3(1,1,1),u=new r.InstancedMesh(e.geometry,e.material,n);for(let e=0;e<n;e++)o.TRANSLATION&&a.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,e),o.SCALE&&l.fromBufferAttribute(o.SCALE,e),u.setMatrixAt(e,t.compose(a,s,l));for(let t in o)if("_COLOR_0"===t){let e=o[t];u.instanceColor=new r.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);r.Object3D.prototype.copy.call(u,e),this.parser.assignFinalMaterial(u),i.push(u)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}}let S="glTF";class I{constructor(e){this.name=h.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:i(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==S)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,a=new DataView(e,12);let n=0;for(;n<r;){const t=a.getUint32(n,!0);n+=4;const r=a.getUint32(n,!0);if(n+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+n,t);this.content=i(r)}else if(5130562===r){const r=12+n;this.body=e.slice(r,r+t)}n+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class R{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=h.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let r=this.json,a=this.dracoLoader,n=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,o={},l={},u={};for(let e in i)o[J[e]||e.toLowerCase()]=i[e];for(let t in e.attributes){let a=J[t]||t.toLowerCase();if(void 0!==i[t]){let n=r.accessors[e.attributes[t]],i=L[n.componentType];u[a]=i.name,l[a]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,r){a.decodeDracoFile(e,function(e){for(let t in e.attributes){let r=e.attributes[t],a=l[t];void 0!==a&&(r.normalized=a)}t(e)},o,u,s,r)})})}}class G{constructor(){this.name=h.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class D{constructor(){this.name=h.KHR_MESH_QUANTIZATION}}class U extends r.Interpolant{constructor(e,t,r,a){super(e,t,r,a)}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,n=e*a*3+a;for(let e=0;e!==a;e++)t[e]=r[n+e];return t}interpolate_(e,t,r,a){let n=this.resultBuffer,i=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=a-t,h=(r-t)/u,c=h*h,d=c*h,f=e*l,p=f-l,m=-2*d+3*c,g=d-c,A=1-m,v=g-c+h;for(let e=0;e!==o;e++){let t=i[p+e+o],r=i[p+e+s]*u,a=i[f+e+o],l=i[f+e]*u;n[e]=A*t+v*r+m*a+g*l}return n}}let _=new r.Quaternion;class k extends U{interpolate_(e,t,r,a){let n=super.interpolate_(e,t,r,a);return _.fromArray(n).normalize().toArray(n),n}}let P={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},O={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},H={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},j={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},J={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...n.version>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},N={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},K={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function W(e,t,r){for(let a in r.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=r.extensions[a])}function V(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function X(e){let t="",r=Object.keys(e).sort();for(let a=0,n=r.length;a<n;a++)t+=r[a]+":"+e[r[a]]+";";return t}function Q(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let z=new r.Matrix4;class Y{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new u,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let a=!1,n=!1,i=-1;"u">typeof navigator&&void 0!==navigator.userAgent&&(a=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=(n=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"u"<typeof createImageBitmap||a||n&&i<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,a=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let i={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};return W(n,i,a),V(i,a),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(i)})).then(function(){for(let e of i.scenes)e.updateMatrixWorld();e(i)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,a=t.length;r<a;r++){let a=t[r].joints;for(let t=0,r=a.length;t<r;t++)e[a[t]].isBone=!0}for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0!==a.mesh&&(this._addNodeRef(this.meshCache,a.mesh),void 0!==a.skin&&(r[a.mesh].isSkinnedMesh=!0)),void 0!==a.camera&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;let a=r.clone(),n=(e,t)=>{let r=this.associations.get(e);for(let[a,i]of(null!=r&&this.associations.set(t,r),e.children.entries()))n(i,t.children[a])};return n(r,a),a.name+="_instance_"+e.uses[t]++,a}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){let a=e(t[r]);if(a)return a}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let r=[];for(let a=0;a<t.length;a++){let n=e(t[a]);n&&r.push(n)}return r}getDependency(e,t){let r=e+":"+t,a=this.cache.get(r);if(!a){switch(e){case"scene":a=this.loadScene(t);break;case"node":a=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":a=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":a=this.loadAccessor(t);break;case"bufferView":a=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":a=this.loadBuffer(t);break;case"material":a=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":a=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":a=this.loadSkin(t);break;case"animation":a=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":a=this.loadCamera(t);break;default:if(!(a=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(r,a)}return a}getDependencies(e){let t=this.cache.get(e);if(!t){let r=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,a){return r.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],a=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[h.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(e,i){a.load(r.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,function(){i(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let r=t.byteLength||0,a=t.byteOffset||0;return e.slice(a,a+r)})}loadAccessor(e){let t=this,a=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){let e=j[n.type],t=L[n.componentType],a=!0===n.normalized,i=new t(n.count*e);return Promise.resolve(new r.BufferAttribute(i,e,a))}let i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(e){let i,o,s=e[0],l=j[n.type],u=L[n.componentType],h=u.BYTES_PER_ELEMENT,c=h*l,d=n.byteOffset||0,f=void 0!==n.bufferView?a.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized;if(f&&f!==c){let e=Math.floor(d/f),a="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count,c=t.cache.get(a);c||(i=new u(s,e*f,n.count*f/h),c=new r.InterleavedBuffer(i,f/h),t.cache.add(a,c)),o=new r.InterleavedBufferAttribute(c,l,d%f/h,p)}else i=null===s?new u(n.count*l):new u(s,d,n.count*l),o=new r.BufferAttribute(i,l,p);if(void 0!==n.sparse){let t=j.SCALAR,a=L[n.sparse.indices.componentType],i=n.sparse.indices.byteOffset||0,h=n.sparse.values.byteOffset||0,c=new a(e[1],i,n.sparse.count*t),d=new u(e[2],h,n.sparse.count*l);null!==s&&(o=new r.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(let e=0,t=c.length;e<t;e++){let t=c[e];if(o.setX(t,d[e*l]),l>=2&&o.setY(t,d[e*l+1]),l>=3&&o.setZ(t,d[e*l+2]),l>=4&&o.setW(t,d[e*l+3]),l>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o})}loadTexture(e){let t=this.json,r=this.options,a=t.textures[e].source,n=t.images[a],i=this.textureLoader;if(n.uri){let e=r.manager.getHandler(n.uri);null!==e&&(i=e)}return this.loadTextureImage(e,a,i)}loadTextureImage(e,t,a){let n=this,i=this.json,o=i.textures[e],s=i.images[t],l=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];let u=this.loadImageSource(t,a).then(function(t){t.flipY=!1,t.name=o.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let a=(i.samplers||{})[o.sampler]||{};return t.magFilter=O[a.magFilter]||r.LinearFilter,t.minFilter=O[a.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=H[a.wrapS]||r.RepeatWrapping,t.wrapT=H[a.wrapT]||r.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){let a=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=a.images[e],o=self.URL||self.webkitURL,s=i.uri||"",l=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then(function(e){l=!0;let t=new Blob([e],{type:i.mimeType});return s=o.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let u=Promise.resolve(s).then(function(e){return new Promise(function(a,i){let o=a;!0===t.isImageBitmapLoader&&(o=function(e){let t=new r.Texture(e);t.needsUpdate=!0,a(t)}),t.load(r.LoaderUtils.resolveURL(e,n.path),o,void 0,i)})}).then(function(e){var t;return!0===l&&o.revokeObjectURL(s),V(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=u,u}assignTexture(e,t,r,a){let n=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((i=i.clone()).channel=r.texCoord),n.extensions[h.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[h.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(i);i=n.extensions[h.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==a&&("number"==typeof a&&(a=3001===a?o:s),"colorSpace"in i?i.colorSpace=a:i.encoding=a===o?3001:3e3),e[t]=i,i})}assignFinalMaterial(e){let t=e.geometry,a=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+a.uuid,t=this.cache.get(e);t||(t=new r.PointsMaterial,r.Material.prototype.copy.call(t,a),t.color.copy(a.color),t.map=a.map,t.sizeAttenuation=!1,this.cache.add(e,t)),a=t}else if(e.isLine){let e="LineBasicMaterial:"+a.uuid,t=this.cache.get(e);t||(t=new r.LineBasicMaterial,r.Material.prototype.copy.call(t,a),t.color.copy(a.color),t.map=a.map,this.cache.add(e,t)),a=t}if(n||i||o){let e="ClonedMaterial:"+a.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=a.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(a))),a=t}e.material=a}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){let t,a=this,n=this.json,i=this.extensions,l=n.materials[e],u={},c=l.extensions||{},d=[];if(c[h.KHR_MATERIALS_UNLIT]){let e=i[h.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),d.push(e.extendParams(u,l,a))}else{let n=l.pbrMetallicRoughness||{};if(u.color=new r.Color(1,1,1),u.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;u.color.setRGB(e[0],e[1],e[2],s),u.opacity=e[3]}void 0!==n.baseColorTexture&&d.push(a.assignTexture(u,"map",n.baseColorTexture,o)),u.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,u.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(d.push(a.assignTexture(u,"metalnessMap",n.metallicRoughnessTexture)),d.push(a.assignTexture(u,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,u)})))}!0===l.doubleSided&&(u.side=r.DoubleSide);let f=l.alphaMode||"OPAQUE";if("BLEND"===f?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,"MASK"===f&&(u.alphaTest=void 0!==l.alphaCutoff?l.alphaCutoff:.5)),void 0!==l.normalTexture&&t!==r.MeshBasicMaterial&&(d.push(a.assignTexture(u,"normalMap",l.normalTexture)),u.normalScale=new r.Vector2(1,1),void 0!==l.normalTexture.scale)){let e=l.normalTexture.scale;u.normalScale.set(e,e)}if(void 0!==l.occlusionTexture&&t!==r.MeshBasicMaterial&&(d.push(a.assignTexture(u,"aoMap",l.occlusionTexture)),void 0!==l.occlusionTexture.strength&&(u.aoMapIntensity=l.occlusionTexture.strength)),void 0!==l.emissiveFactor&&t!==r.MeshBasicMaterial){let e=l.emissiveFactor;u.emissive=new r.Color().setRGB(e[0],e[1],e[2],s)}return void 0!==l.emissiveTexture&&t!==r.MeshBasicMaterial&&d.push(a.assignTexture(u,"emissiveMap",l.emissiveTexture,o)),Promise.all(d).then(function(){let r=new t(u);return l.name&&(r.name=l.name),V(r,l),a.associations.set(r,{materials:e}),l.extensions&&W(i,r,l),r})}createUniqueName(e){let t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,a=this.extensions,n=this.primitiveCache,i=[];for(let o=0,s=e.length;o<s;o++){let s=e[o],l=function(e){let t,r=e.extensions&&e.extensions[h.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+X(r.attributes):e.indices+":"+X(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,a=e.targets.length;r<a;r++)t+=":"+X(e.targets[r]);return t}(s),u=n[l];if(u)i.push(u.promise);else{let e;e=s.extensions&&s.extensions[h.KHR_DRACO_MESH_COMPRESSION]?function(e){return a[h.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return Z(r,e,t)})}(s):Z(new r.BufferGeometry,s,t),n[l]={primitive:s,promise:e},i.push(e)}}return Promise.all(i)}loadMesh(e){let t=this,n=this.json,i=this.extensions,o=n.meshes[e],s=o.primitives,l=[];for(let e=0,t=s.length;e<t;e++){var u;let t=void 0===s[e].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new r.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[e].material);l.push(t)}return l.push(t.loadGeometries(s)),Promise.all(l).then(function(n){let l=n.slice(0,n.length-1),u=n[n.length-1],h=[];for(let n=0,c=u.length;n<c;n++){let c,d=u[n],f=s[n],p=l[n];if(f.mode===P.TRIANGLES||f.mode===P.TRIANGLE_STRIP||f.mode===P.TRIANGLE_FAN||void 0===f.mode)!0===(c=!0===o.isSkinnedMesh?new r.SkinnedMesh(d,p):new r.Mesh(d,p)).isSkinnedMesh&&c.normalizeSkinWeights(),f.mode===P.TRIANGLE_STRIP?c.geometry=a(c.geometry,r.TriangleStripDrawMode):f.mode===P.TRIANGLE_FAN&&(c.geometry=a(c.geometry,r.TriangleFanDrawMode));else if(f.mode===P.LINES)c=new r.LineSegments(d,p);else if(f.mode===P.LINE_STRIP)c=new r.Line(d,p);else if(f.mode===P.LINE_LOOP)c=new r.LineLoop(d,p);else if(f.mode===P.POINTS)c=new r.Points(d,p);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(c.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,a=t.weights.length;r<a;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){let r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,a=r.length;t<a;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(c,o),c.name=t.createUniqueName(o.name||"mesh_"+e),V(c,o),f.extensions&&W(i,c,f),t.assignFinalMaterial(c),h.push(c)}for(let r=0,a=h.length;r<a;r++)t.associations.set(h[r],{meshes:e,primitives:r});if(1===h.length)return o.extensions&&W(i,h[0],o),h[0];let c=new r.Group;o.extensions&&W(i,c,o),t.associations.set(c,{meshes:e});for(let e=0,t=h.length;e<t;e++)c.add(h[e]);return c})}loadCamera(e){let t,a=this.json.cameras[e],n=a[a.type];return n?("perspective"===a.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===a.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),a.name&&(t.name=this.createUniqueName(a.name)),V(t,a),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],a=[];for(let e=0,r=t.joints.length;e<r;e++)a.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?a.push(this.getDependency("accessor",t.inverseBindMatrices)):a.push(null),Promise.all(a).then(function(e){let a=e.pop(),n=[],i=[];for(let o=0,s=e.length;o<s;o++){let s=e[o];if(s){n.push(s);let e=new r.Matrix4;null!==a&&e.fromArray(a.array,16*o),i.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new r.Skeleton(n,i)})}loadAnimation(e){let t=this.json,a=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],s=[],l=[],u=[],h=[];for(let e=0,t=n.channels.length;e<t;e++){let t=n.channels[e],r=n.samplers[t.sampler],a=t.target,i=a.node,c=void 0!==n.parameters?n.parameters[r.input]:r.input,d=void 0!==n.parameters?n.parameters[r.output]:r.output;void 0!==a.node&&(o.push(this.getDependency("node",i)),s.push(this.getDependency("accessor",c)),l.push(this.getDependency("accessor",d)),u.push(r),h.push(a))}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u),Promise.all(h)]).then(function(e){let t=e[0],n=e[1],o=e[2],s=e[3],l=e[4],u=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=n[e],h=o[e],c=s[e],d=l[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let f=a._createAnimationTracks(r,i,h,c,d);if(f)for(let e=0;e<f.length;e++)u.push(f[e])}return new r.AnimationClip(i,void 0,u)})}createNodeMesh(e){let t=this.json,r=this,a=t.nodes[e];return void 0===a.mesh?null:r.getDependency("mesh",a.mesh).then(function(e){let t=r._getNodeRef(r.meshCache,a.mesh,e);return void 0!==a.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,r=a.weights.length;t<r;t++)e.morphTargetInfluences[t]=a.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],r=this._loadNodeShallow(e),a=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)a.push(this.getDependency("node",n[e]));let i=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([r,Promise.all(a),i]).then(function(e){let t=e[0],r=e[1],a=e[2];null!==a&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(a,z)});for(let e=0,a=r.length;e<a;e++)t.add(r[e]);return t})}_loadNodeShallow(e){let t=this.json,a=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",s=[],l=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return l&&s.push(l),void 0!==i.camera&&s.push(n.getDependency("camera",i.camera).then(function(e){return n._getNodeRef(n.cameraCache,i.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===i.isBone?new r.Bone:t.length>1?new r.Group:1===t.length?t[0]:new r.Object3D)!==t[0])for(let e=0,r=t.length;e<r;e++)s.add(t[e]);if(i.name&&(s.userData.name=i.name,s.name=o),V(s,i),i.extensions&&W(a,s,i),void 0!==i.matrix){let e=new r.Matrix4;e.fromArray(i.matrix),s.applyMatrix4(e)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);return n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,a=this.json.scenes[e],n=this,i=new r.Group;a.name&&(i.name=n.createUniqueName(a.name)),V(i,a),a.extensions&&W(t,i,a);let o=a.nodes||[],s=[];for(let e=0,t=o.length;e<t;e++)s.push(n.getDependency("node",o[e]));return Promise.all(s).then(function(e){for(let t=0,r=e.length;t<r;t++)i.add(e[t]);return n.associations=(e=>{let t=new Map;for(let[e,a]of n.associations)(e instanceof r.Material||e instanceof r.Texture)&&t.set(e,a);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,a,n,i){let o,s=[],l=e.name?e.name:e.uuid,u=[];switch(N[i.path]===N.weights?e.traverse(function(e){e.morphTargetInfluences&&u.push(e.name?e.name:e.uuid)}):u.push(l),N[i.path]){case N.weights:o=r.NumberKeyframeTrack;break;case N.rotation:o=r.QuaternionKeyframeTrack;break;case N.position:case N.scale:o=r.VectorKeyframeTrack;break;default:o=1===a.itemSize?r.NumberKeyframeTrack:r.VectorKeyframeTrack}let h=void 0!==n.interpolation?K[n.interpolation]:r.InterpolateLinear,c=this._getArrayFromAccessor(a);for(let e=0,r=u.length;e<r;e++){let r=new o(u[e]+"."+N[i.path],t.array,c,h);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(r),s.push(r)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=Q(t.constructor),r=new Float32Array(t.length);for(let a=0,n=t.length;a<n;a++)r[a]=t[a]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?k:U)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Z(e,t,a){let n=t.attributes,i=[];for(let t in n){let r=J[t]||t.toLowerCase();r in e.attributes||i.push(function(t,r){return a.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(n[t],r))}if(void 0!==t.indices&&!e.index){let r=a.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return V(e,t),!function(e,t,a){let n=t.attributes,i=new r.Box3;if(void 0===n.POSITION)return;{let e=a.json.accessors[n.POSITION],t=e.min,o=e.max;if(void 0===t||void 0===o)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new r.Vector3(t[0],t[1],t[2]),new r.Vector3(o[0],o[1],o[2])),e.normalized){let t=Q(L[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let o=t.targets;if(void 0!==o){let e=new r.Vector3,t=new r.Vector3;for(let r=0,n=o.length;r<n;r++){let n=o[r];if(void 0!==n.POSITION){let r=a.json.accessors[n.POSITION],i=r.min,o=r.max;if(void 0!==i&&void 0!==o){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),r.normalized){let e=Q(L[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;let s=new r.Sphere;i.getCenter(s.center),s.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=s}(e,t,a),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,r){let a=!1,n=!1,i=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e];if(void 0!==r.POSITION&&(a=!0),void 0!==r.NORMAL&&(n=!0),void 0!==r.COLOR_0&&(i=!0),a&&n&&i)break}if(!a&&!n&&!i)return Promise.resolve(e);let o=[],s=[],l=[];for(let u=0,h=t.length;u<h;u++){let h=t[u];if(a){let t=void 0!==h.POSITION?r.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(n){let t=void 0!==h.NORMAL?r.getDependency("accessor",h.NORMAL):e.attributes.normal;s.push(t)}if(i){let t=void 0!==h.COLOR_0?r.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){let r=t[0],o=t[1],s=t[2];return a&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),i&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,a):e})}e.s(["GLTFLoader",0,l],46457);var q=r;let $=new WeakMap;class ee extends q.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,a){let n=new q.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(a)},r,a)}decodeDracoFile(e,t,r,a){let n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let a=JSON.stringify(t);if($.has(e)){let t=$.get(e);if(t.key===a)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,i=e.byteLength,o=this._getWorker(n,i).then(a=>(r=a,new Promise((a,i)=>{r._callbacks[n]={resolve:a,reject:i},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),$.set(e,{key:a,promise:o}),o}_createGeometry(e){let t=new q.BufferGeometry;e.index&&t.setIndex(new q.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let a=e.attributes[r],n=a.name,i=a.array,o=a.itemSize;t.setAttribute(n,new q.BufferAttribute(i,o))}return t}_loadLibrary(e,t){let r=new q.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((t,a)=>{r.load(e,t,void 0,a)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let a=et.toString(),n=["/* draco decoder */",r,"\n/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function et(){let e,t;onmessage=function(r){let a=r.data;switch(a.type){case"init":e=a.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let n=a.buffer,i=a.taskConfig;t.then(e=>{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(n),n.byteLength);try{let e=function(e,t,r,a){var n,i,o;let s,l,u,h,c,d,f=a.attributeIDs,p=a.attributeTypes,m=t.GetEncodedGeometryType(r);if(m===e.TRIANGULAR_MESH)c=new e.Mesh,d=t.DecodeBufferToMesh(r,c);else if(m===e.POINT_CLOUD)c=new e.PointCloud,d=t.DecodeBufferToPointCloud(r,c);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||0===c.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let g={index:null,attributes:[]};for(let r in f){let n,i,o=self[p[r]];if(a.useUniqueIDs)i=f[r],n=t.GetAttributeByUniqueId(c,i);else{if(-1===(i=t.GetAttributeId(c,e[f[r]])))continue;n=t.GetAttribute(c,i)}g.attributes.push(function(e,t,r,a,n,i){let o=i.num_components(),s=r.num_points()*o,l=s*n.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,i,u,l,h);let c=new n(e.HEAPF32.buffer,h,s).slice();return e._free(h),{name:a,array:c,itemSize:o}}(e,t,c,r,o,n))}return m===e.TRIANGULAR_MESH&&(n=e,i=t,o=c,s=3*o.num_faces(),l=4*s,u=n._malloc(l),i.GetTrianglesUInt32Array(o,l,u),h=new Uint32Array(n.HEAPF32.buffer,u,s).slice(),n._free(u),g.index={array:h,itemSize:1}),e.destroy(c),g}(t,r,o,i),n=e.attributes.map(e=>e.array.buffer);e.index&&n.push(e.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:e},n)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}e.s(["DRACOLoader",0,ee],27543),e.s(["MeshoptDecoder",0,()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),a=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(r)&&(n="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");let i=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let a=e.charCodeAt(r);t[r]=a>96?a-71:a>64?a-65:a>47?a+4:a>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?a[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}(n),{}).then(t=>{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,a,n,i,o){let s=e.exports.sbrk,l=a+3&-4,u=s(l*n),h=s(i.length),c=new Uint8Array(e.exports.memory.buffer);c.set(i,h);let d=t(u,a,n,h,i.length);if(0===d&&o&&o(u,l,n),r.set(c.subarray(u,u+a*n)),s(u-s(0)),0!==d)throw Error(`Malformed buffer data: ${d}`)}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:i,supported:!0,decodeVertexBuffer(t,r,a,n,i){o(e.exports.meshopt_decodeVertexBuffer,t,r,a,n,e.exports[s[i]])},decodeIndexBuffer(t,r,a,n){o(e.exports.meshopt_decodeIndexBuffer,t,r,a,n)},decodeIndexSequence(t,r,a,n){o(e.exports.meshopt_decodeIndexSequence,t,r,a,n)},decodeGltfBuffer(t,r,a,n,i,u){o(e.exports[l[i]],t,r,a,n,e.exports[s[u]])}}}],21359)},53314,e=>{"use strict";var t=e.i(90072),r=e.i(31497);class a extends t.Mesh{constructor(e,a){var n,i;const o=(e=>e&&e.isCubeTexture)(e),s=Math.floor(Math.log2((null!=(i=o?null==(n=e.image[0])?void 0:n.width:e.image.width)?i:1024)/4)),l=Math.pow(2,s),u=3*Math.max(l,112),h=`
|
|
267
|
+
varying vec3 vWorldPosition;
|
|
268
|
+
void main()
|
|
269
|
+
{
|
|
270
|
+
vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );
|
|
271
|
+
vWorldPosition = worldPosition.xyz;
|
|
272
|
+
|
|
273
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
274
|
+
}
|
|
275
|
+
`,c=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/u}`,`#define CUBEUV_TEXEL_HEIGHT ${1/(4*l)}`,`#define CUBEUV_MAX_MIP ${s}.0`].join("\n")+`
|
|
276
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
277
|
+
varying vec3 vWorldPosition;
|
|
278
|
+
uniform float radius;
|
|
279
|
+
uniform float height;
|
|
280
|
+
uniform float angle;
|
|
281
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
282
|
+
uniform samplerCube map;
|
|
283
|
+
#else
|
|
284
|
+
uniform sampler2D map;
|
|
285
|
+
#endif
|
|
286
|
+
// From: https://www.shadertoy.com/view/4tsBD7
|
|
287
|
+
float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r )
|
|
288
|
+
{
|
|
289
|
+
float d = dot ( rd, n );
|
|
290
|
+
|
|
291
|
+
if( d > 0.0 ) { return 1e6; }
|
|
292
|
+
|
|
293
|
+
vec3 o = ro - c;
|
|
294
|
+
float t = - dot( n, o ) / d;
|
|
295
|
+
vec3 q = o + rd * t;
|
|
296
|
+
|
|
297
|
+
return ( dot( q, q ) < r * r ) ? t : 1e6;
|
|
298
|
+
}
|
|
299
|
+
// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
|
|
300
|
+
float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra )
|
|
301
|
+
{
|
|
302
|
+
vec3 oc = ro - ce;
|
|
303
|
+
float b = dot( oc, rd );
|
|
304
|
+
float c = dot( oc, oc ) - ra * ra;
|
|
305
|
+
float h = b * b - c;
|
|
306
|
+
|
|
307
|
+
if( h < 0.0 ) { return -1.0; }
|
|
308
|
+
|
|
309
|
+
h = sqrt( h );
|
|
310
|
+
|
|
311
|
+
return - b + h;
|
|
312
|
+
}
|
|
313
|
+
vec3 project()
|
|
314
|
+
{
|
|
315
|
+
vec3 p = normalize( vWorldPosition );
|
|
316
|
+
vec3 camPos = cameraPosition;
|
|
317
|
+
camPos.y -= height;
|
|
318
|
+
float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );
|
|
319
|
+
if( intersection > 0.0 ) {
|
|
320
|
+
|
|
321
|
+
vec3 h = vec3( 0.0, - height, 0.0 );
|
|
322
|
+
float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );
|
|
323
|
+
p = ( camPos + min( intersection, intersection2 ) * p ) / radius;
|
|
324
|
+
} else {
|
|
325
|
+
p = vec3( 0.0, 1.0, 0.0 );
|
|
326
|
+
}
|
|
327
|
+
return p;
|
|
328
|
+
}
|
|
329
|
+
#include <common>
|
|
330
|
+
#include <cube_uv_reflection_fragment>
|
|
331
|
+
void main()
|
|
332
|
+
{
|
|
333
|
+
vec3 projectedWorldPosition = project();
|
|
334
|
+
|
|
335
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
336
|
+
vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;
|
|
337
|
+
#else
|
|
338
|
+
vec3 direction = normalize( projectedWorldPosition );
|
|
339
|
+
vec2 uv = equirectUv( direction );
|
|
340
|
+
vec3 outcolor = texture2D( map, uv ).rgb;
|
|
341
|
+
#endif
|
|
342
|
+
gl_FragColor = vec4( outcolor, 1.0 );
|
|
343
|
+
#include <tonemapping_fragment>
|
|
344
|
+
#include <${r.version>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
345
|
+
}
|
|
346
|
+
`,d={map:{value:e},height:{value:(null==a?void 0:a.height)||15},radius:{value:(null==a?void 0:a.radius)||100}};super(new t.IcosahedronGeometry(1,16),new t.ShaderMaterial({uniforms:d,fragmentShader:c,vertexShader:h,side:t.DoubleSide}))}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}e.s(["GroundProjectedEnv",0,a])}]);
|