@panoramax/web-viewer 5.2.0-develop-08c7a778 ā 5.2.0-develop-0b4f95c7
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.
|
@@ -1159,7 +1159,7 @@ const dl={prefix:"far",iconName:"lightbulb",icon:[384,512,[128161],"f0eb","M297.
|
|
|
1159
1159
|
* @license
|
|
1160
1160
|
* Copyright 2010-2026 Three.js Authors
|
|
1161
1161
|
* SPDX-License-Identifier: MIT
|
|
1162
|
-
*/(_o(t.pitch)),s=50*r,o=Al*r;this._cursor.style.top=e.clientY-3*s/5+"px",this._cursor.style.left=e.clientX-o/2+"px",this._cursor.style.height=`${s}px`,this._cursor.style.width=`${o}px`,this._cursor.style.display="block",clearTimeout(this._throttledBestPicMap),this._throttledBestPicMap=setTimeout(()=>{const e=(_o(t.yaw)+this.psv.getPictureOriginalHeading())%360,r=El(n.gps,a,e),s=this._getMapNearbyPictures(r);if(s?.length>0){const e=(_o(t.yaw)+this.psv.getPictureOriginalHeading())%360,r=El(n.gps,a,e),o=this._bestPicAround(n,r,e,s);o?(this._cursor.src=hl,this._mapPreviewPic=o,i._picMarkerPreview.setLngLat(o.geometry.coordinates).setRotation(360===o.properties?.["pers:interior_orientation"]?.field_of_view?this.psv.getXYZ().x||0:o.properties?.["view:azimuth"]||0).addTo(i)):(this._cursor.src=pl,i._picMarkerPreview?.remove(),this._mapPreviewPic=null)}else this._cursor.src=hl,this._mapPreviewPic=null,i&&(this._isMapShowingPictures()||0===this._getMapNearbySequences(r).length)?(this._cursor.src=pl,i?._picMarkerPreview?.remove()):(this._cursor.src=hl,i?._picMarkerPreview.setLngLat(r).setRotation(e).addTo(i))},10)}}else this.isDesktop&&(this._cursor.style.display="none",this._mapPreviewPic=null,this._hideCursor||i?._picMarkerPreview?.remove())}_onPointerLeave(){this.isDesktop&&(this._cursor.style.display="none"),this._couldGoSomewhere=!1}_onHoverOtherStuff(){this._hideCursor=!0,this._onPointerLeave()}_onLeaveOtherStuff(){this._hideCursor=!1}_onPSVPicNavChanged(e){if("pic"===e?.detail?.value)this._onHoverOtherStuff();else this._onLeaveOtherStuff()}_pitchDegToProjectedDistance(e,t){return t?this.isDesktop?e>=30?0:e>=-2.5?ml:e>=-6?25:e>=-15?12.5:e>=gl?6.25:0:e>=20?0:e>=4?ml/3:e>=-4?ml/1.5:e>=-20?ml/3:0:ml/3}_isMapShowingPictures(){if(this.psv._parent.map){const e=this.psv._parent.map;let t=e.getLayersOrder().find(e=>e.endsWith("pictures"));if(t){return e.queryRenderedFeatures({layers:[t]}).length>0}}return!1}_getMapNearbyPictures(e){const t=this.psv._parent.map;if(t){const i=this.psv._parent?.mapStyleComposer;if(i){const n=Object.keys(i.layerRanges.panoramax[i.panoramax].sources)[0];if(n)return t.querySourceFeatures(n,{sourceLayer:"pictures",filter:["within",{type:"Polygon",coordinates:[[[e[0]-fl,e[1]-fl],[e[0]+fl,e[1]-fl],[e[0]+fl,e[1]+fl],[e[0]-fl,e[1]+fl],[e[0]-fl,e[1]-fl]]]}]}).map(e=>({id:e.properties.id,collection:e.properties.first_sequence||e.properties?.sequences?.[0],geometry:e.geometry,properties:{datetime:e.properties.datetime||e.properties.ts,"view:azimuth":e.properties?.["view:azimuth"]||e.properties.heading,"pers:interior_orientation":e.properties?.["pers:interior_orientation"]||{field_of_view:"equirectangular"===e.properties.type?360:void 0}}}))}}return null}_getMapNearbySequences(e){const t=this.psv._parent.map;if(t){const i=t.getLayersOrder().find(e=>e.endsWith("sequences"));if(i){const n=25e-6,a=[t.project([e[0]-n,e[1]-n]),t.project([e[0]+n,e[1]+n])];return t.queryRenderedFeatures(a,{layers:[i]})}}return[]}_bestPicAround(e,t,i,n){if(!Array.isArray(n)||!n.length)return null;const a=new Date(e.properties?.datetime),r=n.filter(t=>t.id!==e.id).map(n=>{const r=360===n.properties?.["pers:interior_orientation"]?.field_of_view,s=Js(t,n.geometry.coordinates),o=n.collection===e.sequence?.id||"any"===this.psv.getPicturesNavigation(),l=n.properties?.["view:azimuth"],c=r||"number"==typeof l&&no(i,l)<=45,d=Math.abs((i-io(e.gps,n.geometry.coordinates))%360)<=45,u=new Date(n.properties?.datetime),h=a.toDateString()===u.toDateString(),p=Math.abs((a-u)/864e5);let A=!0;if(this.psv._parent.map){const e=this.psv._parent.map;e.indoorEqual&&"-1000"!==e.indoorEqual.level&&(A=e._indoorFeaturesIDs.pictures[e.indoorEqual.level]?.has(n.id),A||"0"!==e.indoorEqual.level||(A=!0,Object.entries(e._indoorFeaturesIDs.pictures).forEach(([e,t])=>{A&&"0"!==e&&(A=!t.has(n.id))})))}let m=1/0;return o&&d&&A&&(h&&r?m=1:r&&p<=30?m=2:c&&p<=30?m=3:r?m=4:c&&(m=5)),{p:n,category:m,dist:s,daysDiff:p,headingMatch:c,sameDay:h,is360:r}});if(!r.length)return null;r.sort((e,t)=>e.category!==t.category?e.category-t.category:e.dist!==t.dist?e.dist-t.dist:e.daysDiff!==t.daysDiff?e.daysDiff-t.daysDiff:0);const s=r[0];return s.category<1/0?s.p:null}}function vl(e){return void 0!==e?.properties?.["pers:roll"]||void 0!==e?.properties?.["pers:pitch"]}function El(e,t,i){const[n,a]=e,r=vo(a),s=vo(n),o=vo(i),l=t/6378137,c=Math.sin(r),d=Math.cos(r),u=Math.sin(l),h=Math.cos(l),p=Math.sin(o),A=c*h+d*u*Math.cos(o),m=Math.asin(A),g=p*u*d,f=h-c*A;return[_o(s+Math.atan2(g,f)),_o(m)]}const yl="185",bl=1,kl=3,xl=0,wl=1,Ml=2,Sl=100,Cl=101,Tl=102,Dl=200,Pl=201,Il=202,Ll=203,Rl=204,zl=205,Fl=206,Ul=207,Nl=208,Bl=209,Ol=210,jl=211,Gl=212,Vl=213,Hl=214,ql=0,Wl=1,Kl=2,Xl=3,Ql=4,Zl=5,Yl=6,Jl=7,$l=0,ec=1,tc=2,ic=1,nc=2,ac=3,rc=4,sc=5,oc=6,lc=7,cc=301,dc=302,uc=303,hc=304,pc=306,Ac=1e3,mc=1001,gc=1002,fc=1003,_c=1004,vc=1005,Ec=1006,yc=1007,bc=1008,kc=1009,xc=1010,wc=1011,Mc=1012,Sc=1013,Cc=1014,Tc=1015,Dc=1016,Pc=1017,Ic=1018,Lc=1020,Rc=35902,zc=35899,Fc=1023,Uc=1026,Nc=1027,Bc=1029,Oc=1030,jc=1031,Gc=1033,Vc=33776,Hc=33777,qc=33778,Wc=33779,Kc=35840,Xc=35841,Qc=35842,Zc=35843,Yc=36196,Jc=37492,$c=37496,ed=37488,td=37489,id=37490,nd=37491,ad=37808,rd=37809,sd=37810,od=37811,ld=37812,cd=37813,dd=37814,ud=37815,hd=37816,pd=37817,Ad=37818,md=37819,gd=37820,fd=37821,_d=36492,vd=36494,Ed=36495,yd=36283,bd=36284,kd=36285,xd=36286,wd="",Md="srgb",Sd="srgb-linear",Cd="linear",Td="srgb",Dd=7680,Pd=512,Id=513,Ld=514,Rd=515,zd=516,Fd=517,Ud=518,Nd=519,Bd="300 es",Od=2e3,jd=2001;function Gd(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Vd(){const e=Gd("canvas");return e.style.display="block",e}const Hd={};function qd(...e){const t="THREE."+e.shift();console.log(t,...e)}function Wd(e){const t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){const t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Kd(...e){const t="THREE."+(e=Wd(e)).shift();{const i=e[0];i&&i.isStackTrace?console.warn(i.getError(t)):console.warn(t,...e)}}function Xd(...e){const t="THREE."+(e=Wd(e)).shift();{const i=e[0];i&&i.isStackTrace?console.error(i.getError(t)):console.error(t,...e)}}function Qd(...e){const t=e.join(" ");t in Hd||(Hd[t]=!0,Kd(...e))}const Zd={[ql]:1,[Kl]:6,[Ql]:7,[Xl]:5,[Wl]:0,[Yl]:2,[Jl]:4,[Zl]:3};class Yd{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return void 0!==i&&(void 0!==i[e]&&-1!==i[e].indexOf(t))}removeEventListener(e,t){const i=this._listeners;if(void 0===i)return;const n=i[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){const t=this._listeners;if(void 0===t)return;const i=t[e.type];if(void 0!==i){e.target=this;const t=i.slice(0);for(let i=0,n=t.length;i<n;i++)t[i].call(this,e);e.target=null}}}const Jd=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let $d=1234567;const eu=Math.PI/180,tu=180/Math.PI;function iu(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Jd[255&e]+Jd[e>>8&255]+Jd[e>>16&255]+Jd[e>>24&255]+"-"+Jd[255&t]+Jd[t>>8&255]+"-"+Jd[t>>16&15|64]+Jd[t>>24&255]+"-"+Jd[63&i|128]+Jd[i>>8&255]+"-"+Jd[i>>16&255]+Jd[i>>24&255]+Jd[255&n]+Jd[n>>8&255]+Jd[n>>16&255]+Jd[n>>24&255]).toLowerCase()}function nu(e,t,i){return Math.max(t,Math.min(i,e))}function au(e,t){return(e%t+t)%t}function ru(e,t,i){return(1-i)*e+i*t}function su(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ou(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const lu={DEG2RAD:eu,RAD2DEG:tu,generateUUID:iu,clamp:nu,euclideanModulo:au,mapLinear:function(e,t,i,n,a){return n+(e-t)*(a-n)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:ru,damp:function(e,t,i,n){return ru(e,t,1-Math.exp(-i*n))},pingpong:function(e,t=1){return t-Math.abs(au(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&($d=e);let t=$d+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*eu},radToDeg:function(e){return e*tu},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,i,n,a){const r=Math.cos,s=Math.sin,o=r(i/2),l=s(i/2),c=r((t+n)/2),d=s((t+n)/2),u=r((t-n)/2),h=s((t-n)/2),p=r((n-t)/2),A=s((n-t)/2);switch(a){case"XYX":e.set(o*d,l*u,l*h,o*c);break;case"YZY":e.set(l*h,o*d,l*u,o*c);break;case"ZXZ":e.set(l*u,l*h,o*d,o*c);break;case"XZX":e.set(o*d,l*A,l*p,o*c);break;case"YXY":e.set(l*p,o*d,l*A,o*c);break;case"ZYZ":e.set(l*A,l*p,o*d,o*c);break;default:Kd("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+a)}},normalize:ou,denormalize:su};class cu{static{cu.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(nu(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,r=this.y-e.y;return this.x=a*i-r*n+e.x,this.y=a*n+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class du{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,r,s){let o=i[n+0],l=i[n+1],c=i[n+2],d=i[n+3],u=a[r+0],h=a[r+1],p=a[r+2],A=a[r+3];if(d!==A||o!==u||l!==h||c!==p){let e=o*u+l*h+c*p+d*A;e<0&&(u=-u,h=-h,p=-p,A=-A,e=-e);let t=1-s;if(e<.9995){const i=Math.acos(e),n=Math.sin(i);t=Math.sin(t*i)/n,o=o*t+u*(s=Math.sin(s*i)/n),l=l*t+h*s,c=c*t+p*s,d=d*t+A*s}else{o=o*t+u*s,l=l*t+h*s,c=c*t+p*s,d=d*t+A*s;const e=1/Math.sqrt(o*o+l*l+c*c+d*d);o*=e,l*=e,c*=e,d*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,n,a,r){const s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],d=a[r],u=a[r+1],h=a[r+2],p=a[r+3];return e[t]=s*p+c*d+o*h-l*u,e[t+1]=o*p+c*u+l*d-s*h,e[t+2]=l*p+c*h+s*u-o*d,e[t+3]=c*p-s*d-o*u-l*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,n=e._y,a=e._z,r=e._order,s=Math.cos,o=Math.sin,l=s(i/2),c=s(n/2),d=s(a/2),u=o(i/2),h=o(n/2),p=o(a/2);switch(r){case"XYZ":this._x=u*c*d+l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d-u*h*p;break;case"YXZ":this._x=u*c*d+l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d+u*h*p;break;case"ZXY":this._x=u*c*d-l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d-u*h*p;break;case"ZYX":this._x=u*c*d-l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d+u*h*p;break;case"YZX":this._x=u*c*d+l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d-u*h*p;break;case"XZY":this._x=u*c*d-l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d+u*h*p;break;default:Kd("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],n=t[4],a=t[8],r=t[1],s=t[5],o=t[9],l=t[2],c=t[6],d=t[10],u=i+s+d;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-o)*e,this._y=(a-l)*e,this._z=(r-n)*e}else if(i>s&&i>d){const e=2*Math.sqrt(1+i-s-d);this._w=(c-o)/e,this._x=.25*e,this._y=(n+r)/e,this._z=(a+l)/e}else if(s>d){const e=2*Math.sqrt(1+s-i-d);this._w=(a-l)/e,this._x=(n+r)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+d-i-s);this._w=(r-n)/e,this._x=(a+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nu(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(0===i)return this;const n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,n=e._y,a=e._z,r=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=i*c+r*s+n*l-a*o,this._y=n*c+r*o+a*s-i*l,this._z=a*c+r*l+i*o-n*s,this._w=r*c-i*s-n*o-a*l,this._onChangeCallback(),this}slerp(e,t){let i=e._x,n=e._y,a=e._z,r=e._w,s=this.dot(e);s<0&&(i=-i,n=-n,a=-a,r=-r,s=-s);let o=1-t;if(s<.9995){const e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+a*t,this._w=this._w*o+r*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+a*t,this._w=this._w*o+r*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class uu{static{uu.prototype.isVector3=!0}constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(pu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,a=e.elements,r=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*r,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*r,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*r,this}applyQuaternion(e){const t=this.x,i=this.y,n=this.z,a=e.x,r=e.y,s=e.z,o=e.w,l=2*(r*n-s*i),c=2*(s*t-a*n),d=2*(a*i-r*t);return this.x=t+o*l+r*d-s*c,this.y=i+o*c+s*l-a*d,this.z=n+o*d+a*c-r*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this.z=nu(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this.z=nu(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,n=e.y,a=e.z,r=t.x,s=t.y,o=t.z;return this.x=n*o-a*s,this.y=a*r-i*o,this.z=i*s-n*r,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return hu.copy(this).projectOnVector(e),this.sub(hu)}reflect(e){return this.sub(hu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(nu(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const hu=new uu,pu=new du;class Au{static{Au.prototype.isMatrix3=!0}constructor(e,t,i,n,a,r,s,o,l){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,a,r,s,o,l)}set(e,t,i,n,a,r,s,o,l){const c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=o,c[6]=i,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,a=this.elements,r=i[0],s=i[3],o=i[6],l=i[1],c=i[4],d=i[7],u=i[2],h=i[5],p=i[8],A=n[0],m=n[3],g=n[6],f=n[1],_=n[4],v=n[7],E=n[2],y=n[5],b=n[8];return a[0]=r*A+s*f+o*E,a[3]=r*m+s*_+o*y,a[6]=r*g+s*v+o*b,a[1]=l*A+c*f+d*E,a[4]=l*m+c*_+d*y,a[7]=l*g+c*v+d*b,a[2]=u*A+h*f+p*E,a[5]=u*m+h*_+p*y,a[8]=u*g+h*v+p*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*r*c-t*s*l-i*a*c+i*s*o+n*a*l-n*r*o}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8],d=c*r-s*l,u=s*o-c*a,h=l*a-r*o,p=t*d+i*u+n*h;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return e[0]=d*A,e[1]=(n*l-c*i)*A,e[2]=(s*i-n*r)*A,e[3]=u*A,e[4]=(c*t-n*o)*A,e[5]=(n*a-s*t)*A,e[6]=h*A,e[7]=(i*o-l*t)*A,e[8]=(r*t-i*a)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,r,s){const o=Math.cos(a),l=Math.sin(a);return this.set(i*o,i*l,-i*(o*r+l*s)+r+e,-n*l,n*o,-n*(-l*r+o*s)+s+t,0,0,1),this}scale(e,t){return Qd("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(mu.makeScale(e,t)),this}rotate(e){return Qd("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(mu.makeRotation(-e)),this}translate(e,t){return Qd("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(mu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const mu=new Au,gu=(new Au).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fu=(new Au).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function _u(){const e={enabled:!0,workingColorSpace:Sd,spaces:{},convert:function(e,t,i){return!1!==this.enabled&&t!==i&&t&&i?(this.spaces[t].transfer===Td&&(e.r=Eu(e.r),e.g=Eu(e.g),e.b=Eu(e.b)),this.spaces[t].primaries!==this.spaces[i].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===Td&&(e.r=yu(e.r),e.g=yu(e.g),e.b=yu(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===wd?Cd:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,i){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,i){return Qd("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,i)},toWorkingColorSpace:function(t,i){return Qd("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,i)}},t=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return e.define({[Sd]:{primaries:t,whitePoint:n,transfer:Cd,toXYZ:gu,fromXYZ:fu,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Md},outputColorSpaceConfig:{drawingBufferColorSpace:Md}},[Md]:{primaries:t,whitePoint:n,transfer:Td,toXYZ:gu,fromXYZ:fu,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Md}}}),e}const vu=_u();function Eu(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function yu(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let bu;class ku{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{void 0===bu&&(bu=Gd("canvas")),bu.width=e.width,bu.height=e.height;const t=bu.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),i=bu}return i.toDataURL(t)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Gd("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let e=0;e<a.length;e++)a[e]=255*Eu(a[e]/255);return i.putImageData(n,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*Eu(t[e]/255)):t[e]=Eu(t[e]);return{data:t,width:e.width,height:e.height}}return Kd("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let xu=0;class wu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:xu++}),this.uuid=iu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(Mu(n[t].image)):e.push(Mu(n[t]))}else e=Mu(n);i.url=e}return t||(e.images[this.uuid]=i),i}}function Mu(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ku.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(Kd("Texture: Unable to serialize Texture."),{})}let Su=0;const Cu=new uu;class Tu extends Yd{constructor(e=Tu.DEFAULT_IMAGE,t=Tu.DEFAULT_MAPPING,i=1001,n=1001,a=1006,r=1008,s=1023,o=kc,l=Tu.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Su++}),this.uuid=iu(),this.name="",this.source=new wu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=a,this.minFilter=r,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new cu(0,0),this.repeat=new cu(1,1),this.center=new cu(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Au,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Cu).x}get height(){return this.source.getSize(Cu).y}get depth(){return this.source.getSize(Cu).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(void 0===i){Kd(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const n=this[t];void 0!==n?n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[t]=i:Kd(`Texture.setValues(): property '${t}' does not exist.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ac:e.x=e.x-Math.floor(e.x);break;case mc:e.x=e.x<0?0:1;break;case gc:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Ac:e.y=e.y-Math.floor(e.y);break;case mc:e.y=e.y<0?0:1;break;case gc:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Tu.DEFAULT_IMAGE=null,Tu.DEFAULT_MAPPING=300,Tu.DEFAULT_ANISOTROPY=1;class Du{static{Du.prototype.isVector4=!0}constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,a=this.w,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12]*a,this.y=r[1]*t+r[5]*i+r[9]*n+r[13]*a,this.z=r[2]*t+r[6]*i+r[10]*n+r[14]*a,this.w=r[3]*t+r[7]*i+r[11]*n+r[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a;const r=.01,s=.1,o=e.elements,l=o[0],c=o[4],d=o[8],u=o[1],h=o[5],p=o[9],A=o[2],m=o[6],g=o[10];if(Math.abs(c-u)<r&&Math.abs(d-A)<r&&Math.abs(p-m)<r){if(Math.abs(c+u)<s&&Math.abs(d+A)<s&&Math.abs(p+m)<s&&Math.abs(l+h+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,o=(h+1)/2,f=(g+1)/2,_=(c+u)/4,v=(d+A)/4,E=(p+m)/4;return e>o&&e>f?e<r?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(e),n=_/i,a=v/i):o>f?o<r?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(o),i=_/n,a=E/n):f<r?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(f),i=v/a,n=E/a),this.set(i,n,a,t),this}let f=Math.sqrt((m-p)*(m-p)+(d-A)*(d-A)+(u-c)*(u-c));return Math.abs(f)<.001&&(f=1),this.x=(m-p)/f,this.y=(d-A)/f,this.z=(u-c)/f,this.w=Math.acos((l+h+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this.z=nu(this.z,e.z,t.z),this.w=nu(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this.z=nu(this.z,e,t),this.w=nu(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Pu extends Yd{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ec,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Du(0,0,e,t),this.scissorTest=!1,this.viewport=new Du(0,0,e,t),this.textures=[];const n={width:e,height:t,depth:i.depth},a=new Tu(n),r=i.count;for(let e=0;e<r;e++)this.textures[e]=a.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Ec,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++){this.textures[e].setValues(t)}}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i,!0!==this.textures[n].isData3DTexture&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new wu(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Iu extends Pu{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Lu extends Tu{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=fc,this.minFilter=fc,this.wrapR=mc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ru extends Tu{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=fc,this.minFilter=fc,this.wrapR=mc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class zu{static{zu.prototype.isMatrix4=!0}constructor(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m)}set(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=a,g[5]=r,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=d,g[14]=u,g[3]=h,g[7]=p,g[11]=A,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new zu).fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return 0===this.determinantAffine()?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinantAffine())return this.identity();const t=this.elements,i=e.elements,n=1/Fu.setFromMatrixColumn(e,0).length(),a=1/Fu.setFromMatrixColumn(e,1).length(),r=1/Fu.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*r,t[9]=i[9]*r,t[10]=i[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,n=e.y,a=e.z,r=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(a),d=Math.sin(a);if("XYZ"===e.order){const e=r*c,i=r*d,n=s*c,a=s*d;t[0]=o*c,t[4]=-o*d,t[8]=l,t[1]=i+n*l,t[5]=e-a*l,t[9]=-s*o,t[2]=a-e*l,t[6]=n+i*l,t[10]=r*o}else if("YXZ"===e.order){const e=o*c,i=o*d,n=l*c,a=l*d;t[0]=e+a*s,t[4]=n*s-i,t[8]=r*l,t[1]=r*d,t[5]=r*c,t[9]=-s,t[2]=i*s-n,t[6]=a+e*s,t[10]=r*o}else if("ZXY"===e.order){const e=o*c,i=o*d,n=l*c,a=l*d;t[0]=e-a*s,t[4]=-r*d,t[8]=n+i*s,t[1]=i+n*s,t[5]=r*c,t[9]=a-e*s,t[2]=-r*l,t[6]=s,t[10]=r*o}else if("ZYX"===e.order){const e=r*c,i=r*d,n=s*c,a=s*d;t[0]=o*c,t[4]=n*l-i,t[8]=e*l+a,t[1]=o*d,t[5]=a*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=r*o}else if("YZX"===e.order){const e=r*o,i=r*l,n=s*o,a=s*l;t[0]=o*c,t[4]=a-e*d,t[8]=n*d+i,t[1]=d,t[5]=r*c,t[9]=-s*c,t[2]=-l*c,t[6]=i*d+n,t[10]=e-a*d}else if("XZY"===e.order){const e=r*o,i=r*l,n=s*o,a=s*l;t[0]=o*c,t[4]=-d,t[8]=l*c,t[1]=e*d+a,t[5]=r*c,t[9]=i*d-n,t[2]=n*d-i,t[6]=s*c,t[10]=a*d+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Nu,e,Bu)}lookAt(e,t,i){const n=this.elements;return Gu.subVectors(e,t),0===Gu.lengthSq()&&(Gu.z=1),Gu.normalize(),Ou.crossVectors(i,Gu),0===Ou.lengthSq()&&(1===Math.abs(i.z)?Gu.x+=1e-4:Gu.z+=1e-4,Gu.normalize(),Ou.crossVectors(i,Gu)),Ou.normalize(),ju.crossVectors(Gu,Ou),n[0]=Ou.x,n[4]=ju.x,n[8]=Gu.x,n[1]=Ou.y,n[5]=ju.y,n[9]=Gu.y,n[2]=Ou.z,n[6]=ju.z,n[10]=Gu.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,a=this.elements,r=i[0],s=i[4],o=i[8],l=i[12],c=i[1],d=i[5],u=i[9],h=i[13],p=i[2],A=i[6],m=i[10],g=i[14],f=i[3],_=i[7],v=i[11],E=i[15],y=n[0],b=n[4],k=n[8],x=n[12],w=n[1],M=n[5],S=n[9],C=n[13],T=n[2],D=n[6],P=n[10],I=n[14],L=n[3],R=n[7],z=n[11],F=n[15];return a[0]=r*y+s*w+o*T+l*L,a[4]=r*b+s*M+o*D+l*R,a[8]=r*k+s*S+o*P+l*z,a[12]=r*x+s*C+o*I+l*F,a[1]=c*y+d*w+u*T+h*L,a[5]=c*b+d*M+u*D+h*R,a[9]=c*k+d*S+u*P+h*z,a[13]=c*x+d*C+u*I+h*F,a[2]=p*y+A*w+m*T+g*L,a[6]=p*b+A*M+m*D+g*R,a[10]=p*k+A*S+m*P+g*z,a[14]=p*x+A*C+m*I+g*F,a[3]=f*y+_*w+v*T+E*L,a[7]=f*b+_*M+v*D+E*R,a[11]=f*k+_*S+v*P+E*z,a[15]=f*x+_*C+v*I+E*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],r=e[1],s=e[5],o=e[9],l=e[13],c=e[2],d=e[6],u=e[10],h=e[14],p=e[3],A=e[7],m=e[11],g=e[15],f=o*h-l*u,_=s*h-l*d,v=s*u-o*d,E=r*h-l*c,y=r*u-o*c,b=r*d-s*c;return t*(A*f-m*_+g*v)-i*(p*f-m*E+g*y)+n*(p*_-A*E+g*b)-a*(p*v-A*y+m*b)}determinantAffine(){const e=this.elements,t=e[0],i=e[4],n=e[8],a=e[1],r=e[5],s=e[9],o=e[2],l=e[6],c=e[10];return t*(r*c-s*l)-i*(a*c-s*o)+n*(a*l-r*o)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8],d=e[9],u=e[10],h=e[11],p=e[12],A=e[13],m=e[14],g=e[15],f=t*s-i*r,_=t*o-n*r,v=t*l-a*r,E=i*o-n*s,y=i*l-a*s,b=n*l-a*o,k=c*A-d*p,x=c*m-u*p,w=c*g-h*p,M=d*m-u*A,S=d*g-h*A,C=u*g-h*m,T=f*C-_*S+v*M+E*w-y*x+b*k;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/T;return e[0]=(s*C-o*S+l*M)*D,e[1]=(n*S-i*C-a*M)*D,e[2]=(A*b-m*y+g*E)*D,e[3]=(u*y-d*b-h*E)*D,e[4]=(o*w-r*C-l*x)*D,e[5]=(t*C-n*w+a*x)*D,e[6]=(m*v-p*b-g*_)*D,e[7]=(c*b-u*v+h*_)*D,e[8]=(r*S-s*w+l*k)*D,e[9]=(i*w-t*S-a*k)*D,e[10]=(p*y-A*v+g*f)*D,e[11]=(d*v-c*y-h*f)*D,e[12]=(s*x-r*M-o*k)*D,e[13]=(t*M-i*x+n*k)*D,e[14]=(A*_-p*E-m*f)*D,e[15]=(c*E-d*_+u*f)*D,this}scale(e){const t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),n=Math.sin(t),a=1-i,r=e.x,s=e.y,o=e.z,l=a*r,c=a*s;return this.set(l*r+i,l*s-n*o,l*o+n*s,0,l*s+n*o,c*s+i,c*o-n*r,0,l*o-n*s,c*o+n*r,a*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,r){return this.set(1,i,a,0,e,1,r,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){const n=this.elements,a=t._x,r=t._y,s=t._z,o=t._w,l=a+a,c=r+r,d=s+s,u=a*l,h=a*c,p=a*d,A=r*c,m=r*d,g=s*d,f=o*l,_=o*c,v=o*d,E=i.x,y=i.y,b=i.z;return n[0]=(1-(A+g))*E,n[1]=(h+v)*E,n[2]=(p-_)*E,n[3]=0,n[4]=(h-v)*y,n[5]=(1-(u+g))*y,n[6]=(m+f)*y,n[7]=0,n[8]=(p+_)*b,n[9]=(m-f)*b,n[10]=(1-(u+A))*b,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){const n=this.elements;e.x=n[12],e.y=n[13],e.z=n[14];const a=this.determinantAffine();if(0===a)return i.set(1,1,1),t.identity(),this;let r=Fu.set(n[0],n[1],n[2]).length();const s=Fu.set(n[4],n[5],n[6]).length(),o=Fu.set(n[8],n[9],n[10]).length();a<0&&(r=-r),Uu.copy(this);const l=1/r,c=1/s,d=1/o;return Uu.elements[0]*=l,Uu.elements[1]*=l,Uu.elements[2]*=l,Uu.elements[4]*=c,Uu.elements[5]*=c,Uu.elements[6]*=c,Uu.elements[8]*=d,Uu.elements[9]*=d,Uu.elements[10]*=d,t.setFromRotationMatrix(Uu),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,n,a,r,s=2e3,o=!1){const l=this.elements,c=2*a/(t-e),d=2*a/(i-n),u=(t+e)/(t-e),h=(i+n)/(i-n);let p,A;if(o)p=a/(r-a),A=r*a/(r-a);else if(s===Od)p=-(r+a)/(r-a),A=-2*r*a/(r-a);else{if(s!==jd)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);p=-r/(r-a),A=-r*a/(r-a)}return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,r,s=2e3,o=!1){const l=this.elements,c=2/(t-e),d=2/(i-n),u=-(t+e)/(t-e),h=-(i+n)/(i-n);let p,A;if(o)p=1/(r-a),A=r/(r-a);else if(s===Od)p=-2/(r-a),A=-(r+a)/(r-a);else{if(s!==jd)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=-1/(r-a),A=-a/(r-a)}return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=d,l[9]=0,l[13]=h,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Fu=new uu,Uu=new zu,Nu=new uu(0,0,0),Bu=new uu(1,1,1),Ou=new uu,ju=new uu,Gu=new uu,Vu=new zu,Hu=new du;class qu{constructor(e=0,t=0,i=0,n=qu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const n=e.elements,a=n[0],r=n[4],s=n[8],o=n[1],l=n[5],c=n[9],d=n[2],u=n[6],h=n[10];switch(t){case"XYZ":this._y=Math.asin(nu(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-r,a)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-nu(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,h),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case"ZXY":this._x=Math.asin(nu(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,h),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(o,a));break;case"ZYX":this._y=Math.asin(-nu(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,h),this._z=Math.atan2(o,a)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(nu(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,h));break;case"XZY":this._z=Math.asin(-nu(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,h),this._y=0);break;default:Kd("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Vu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Vu,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Hu.setFromEuler(this),this.setFromQuaternion(Hu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qu.DEFAULT_ORDER="XYZ";class Wu{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Ku=0;const Xu=new uu,Qu=new du,Zu=new zu,Yu=new uu,Ju=new uu,$u=new uu,eh=new du,th=new uu(1,0,0),ih=new uu(0,1,0),nh=new uu(0,0,1),ah={type:"added"},rh={type:"removed"},sh={type:"childadded",child:null},oh={type:"childremoved",child:null};class lh extends Yd{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ku++}),this.uuid=iu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lh.DEFAULT_UP.clone();const e=new uu,t=new qu,i=new du,n=new uu(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new zu},normalMatrix:{value:new Au}}),this.matrix=new zu,this.matrixWorld=new zu,this.matrixAutoUpdate=lh.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=lh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Wu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qu.setFromAxisAngle(e,t),this.quaternion.multiply(Qu),this}rotateOnWorldAxis(e,t){return Qu.setFromAxisAngle(e,t),this.quaternion.premultiply(Qu),this}rotateX(e){return this.rotateOnAxis(th,e)}rotateY(e){return this.rotateOnAxis(ih,e)}rotateZ(e){return this.rotateOnAxis(nh,e)}translateOnAxis(e,t){return Xu.copy(e).applyQuaternion(this.quaternion),this.position.add(Xu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(th,e)}translateY(e){return this.translateOnAxis(ih,e)}translateZ(e){return this.translateOnAxis(nh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zu.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Yu.copy(e):Yu.set(e,t,i);const n=this.parent;this.updateWorldMatrix(!0,!1),Ju.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zu.lookAt(Ju,Yu,this.up):Zu.lookAt(Yu,Ju,this.up),this.quaternion.setFromRotationMatrix(Zu),n&&(Zu.extractRotation(n.matrixWorld),Qu.setFromRotationMatrix(Zu),this.quaternion.premultiply(Qu.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(Xd("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ah),sh.child=e,this.dispatchEvent(sh),sh.child=null):Xd("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rh),oh.child=e,this.dispatchEvent(oh),oh.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Zu.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Zu.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zu),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ah),sh.child=e,this.dispatchEvent(sh),sh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const n=this.children;for(let a=0,r=n.length;a<r;a++)n[a].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ju,e,$u),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ju,eh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(null!==e){const t=e.x,i=e.y,n=e.z,a=this.matrix.elements;a[12]+=t-a[0]*t-a[4]*i-a[8]*n,a[13]+=i-a[1]*t-a[5]*i-a[9]*n,a[14]+=n-a[2]*t-a[6]*i-a[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,n=t.length;i<n;i++){t[i].updateMatrixWorld(e)}}updateWorldMatrix(e,t,i=!1){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){e[t].updateWorldMatrix(!1,!0,i)}}}toJSON(e){const t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const n={};function a(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),!1!==this.static&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),null!==this.pivot&&(n.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(e=>({...e})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(e),n.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(n.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=a(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const n=i[t];a(e.shapes,n)}else a(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(a(e.materials,this.material[i]));n.material=t}else n.material=a(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){const i=this.animations[t];n.animations.push(a(e.animations,i))}}if(t){const t=r(e.geometries),n=r(e.materials),a=r(e.textures),s=r(e.images),o=r(e.shapes),l=r(e.skeletons),c=r(e.animations),d=r(e.nodes);t.length>0&&(i.geometries=t),n.length>0&&(i.materials=n),a.length>0&&(i.textures=a),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),d.length>0&&(i.nodes=d)}return i.object=n,i;function r(e){const t=[];for(const i in e){const n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=null!==e.pivot?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const i=e.children[t];this.add(i.clone())}return this}}lh.DEFAULT_UP=new uu(0,1,0),lh.DEFAULT_MATRIX_AUTO_UPDATE=!0,lh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class ch extends lh{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dh={type:"move"};class uh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ch,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ch,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new uu,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new uu),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ch,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new uu,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new uu,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,r=null;const s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){r=!0;for(const n of e.hand.values()){const e=t.getJointPose(n,i),a=this._getHandJoint(l,n);null!==e&&(a.matrix.fromArray(e.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,a.jointRadius=e.radius),a.visible=null!==e}const n=l.joints["index-finger-tip"],a=l.joints["thumb-tip"],s=n.position.distanceTo(a.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),null!==a&&(o.matrix.fromArray(a.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,a.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(a.linearVelocity)):o.hasLinearVelocity=!1,a.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(a.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:e,target:this})));null!==s&&(n=t.getPose(e.targetRaySpace,i),null===n&&null!==a&&(n=a),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(dh)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==a),null!==l&&(l.visible=null!==r),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const i=new ch;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ph={h:0,s:0,l:0},Ah={h:0,s:0,l:0};function mh(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}class gh{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(void 0===t&&void 0===i){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Md){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,vu.colorSpaceToWorking(this,t),this}setRGB(e,t,i,n=vu.workingColorSpace){return this.r=e,this.g=t,this.b=i,vu.colorSpaceToWorking(this,n),this}setHSL(e,t,i,n=vu.workingColorSpace){if(e=au(e,1),t=nu(t,0,1),i=nu(i,0,1),0===t)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+t):i+t-i*t,a=2*i-n;this.r=mh(a,n,e+1/3),this.g=mh(a,n,e),this.b=mh(a,n,e-1/3)}return vu.colorSpaceToWorking(this,n),this}setStyle(e,t=Md){function i(t){void 0!==t&&parseFloat(t)<1&&Kd("Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const r=n[1],s=n[2];switch(r){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:Kd("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],a=i.length;if(3===a)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===a)return this.setHex(parseInt(i,16),t);Kd("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Md){const i=hh[e.toLowerCase()];return void 0!==i?this.setHex(i,t):Kd("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eu(e.r),this.g=Eu(e.g),this.b=Eu(e.b),this}copyLinearToSRGB(e){return this.r=yu(e.r),this.g=yu(e.g),this.b=yu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Md){return vu.workingToColorSpace(fh.copy(this),e),65536*Math.round(nu(255*fh.r,0,255))+256*Math.round(nu(255*fh.g,0,255))+Math.round(nu(255*fh.b,0,255))}getHexString(e=Md){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vu.workingColorSpace){vu.workingToColorSpace(fh.copy(this),t);const i=fh.r,n=fh.g,a=fh.b,r=Math.max(i,n,a),s=Math.min(i,n,a);let o,l;const c=(s+r)/2;if(s===r)o=0,l=0;else{const e=r-s;switch(l=c<=.5?e/(r+s):e/(2-r-s),r){case i:o=(n-a)/e+(n<a?6:0);break;case n:o=(a-i)/e+2;break;case a:o=(i-n)/e+4}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=vu.workingColorSpace){return vu.workingToColorSpace(fh.copy(this),t),e.r=fh.r,e.g=fh.g,e.b=fh.b,e}getStyle(e=Md){vu.workingToColorSpace(fh.copy(this),e);const t=fh.r,i=fh.g,n=fh.b;return e!==Md?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(e,t,i){return this.getHSL(ph),this.setHSL(ph.h+e,ph.s+t,ph.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ph),e.getHSL(Ah);const i=ru(ph.h,Ah.h,t),n=ru(ph.s,Ah.s,t),a=ru(ph.l,Ah.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const fh=new gh;gh.NAMES=hh;class _h extends lh{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new qu,this.environmentIntensity=1,this.environmentRotation=new qu,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const vh=new uu,Eh=new uu,yh=new uu,bh=new uu,kh=new uu,xh=new uu,wh=new uu,Mh=new uu,Sh=new uu,Ch=new uu,Th=new Du,Dh=new Du,Ph=new Du;class Ih{constructor(e=new uu,t=new uu,i=new uu){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),vh.subVectors(e,t),n.cross(vh);const a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){vh.subVectors(n,t),Eh.subVectors(i,t),yh.subVectors(e,t);const r=vh.dot(vh),s=vh.dot(Eh),o=vh.dot(yh),l=Eh.dot(Eh),c=Eh.dot(yh),d=r*l-s*s;if(0===d)return a.set(0,0,0),null;const u=1/d,h=(l*o-s*c)*u,p=(r*c-s*o)*u;return a.set(1-h-p,p,h)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,bh)&&(bh.x>=0&&bh.y>=0&&bh.x+bh.y<=1)}static getInterpolation(e,t,i,n,a,r,s,o){return null===this.getBarycoord(e,t,i,n,bh)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(a,bh.x),o.addScaledVector(r,bh.y),o.addScaledVector(s,bh.z),o)}static getInterpolatedAttribute(e,t,i,n,a,r){return Th.setScalar(0),Dh.setScalar(0),Ph.setScalar(0),Th.fromBufferAttribute(e,t),Dh.fromBufferAttribute(e,i),Ph.fromBufferAttribute(e,n),r.setScalar(0),r.addScaledVector(Th,a.x),r.addScaledVector(Dh,a.y),r.addScaledVector(Ph,a.z),r}static isFrontFacing(e,t,i,n){return vh.subVectors(i,t),Eh.subVectors(e,t),vh.cross(Eh).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vh.subVectors(this.c,this.b),Eh.subVectors(this.a,this.b),.5*vh.cross(Eh).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ih.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ih.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return Ih.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return Ih.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ih.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,n=this.b,a=this.c;let r,s;kh.subVectors(n,i),xh.subVectors(a,i),Mh.subVectors(e,i);const o=kh.dot(Mh),l=xh.dot(Mh);if(o<=0&&l<=0)return t.copy(i);Sh.subVectors(e,n);const c=kh.dot(Sh),d=xh.dot(Sh);if(c>=0&&d<=c)return t.copy(n);const u=o*d-c*l;if(u<=0&&o>=0&&c<=0)return r=o/(o-c),t.copy(i).addScaledVector(kh,r);Ch.subVectors(e,a);const h=kh.dot(Ch),p=xh.dot(Ch);if(p>=0&&h<=p)return t.copy(a);const A=h*l-o*p;if(A<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(i).addScaledVector(xh,s);const m=c*p-h*d;if(m<=0&&d-c>=0&&h-p>=0)return wh.subVectors(a,n),s=(d-c)/(d-c+(h-p)),t.copy(n).addScaledVector(wh,s);const g=1/(m+A+u);return r=A*g,s=u*g,t.copy(i).addScaledVector(kh,r).addScaledVector(xh,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Lh{constructor(e=new uu(1/0,1/0,1/0),t=new uu(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(zh.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(zh.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=zh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,zh):zh.fromBufferAttribute(n,t),zh.applyMatrix4(e.matrixWorld),this.expandByPoint(zh);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Fh.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Fh.copy(i.boundingBox)),Fh.applyMatrix4(e.matrixWorld),this.union(Fh)}const n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,zh),zh.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vh),Hh.subVectors(this.max,Vh),Uh.subVectors(e.a,Vh),Nh.subVectors(e.b,Vh),Bh.subVectors(e.c,Vh),Oh.subVectors(Nh,Uh),jh.subVectors(Bh,Nh),Gh.subVectors(Uh,Bh);let t=[0,-Oh.z,Oh.y,0,-jh.z,jh.y,0,-Gh.z,Gh.y,Oh.z,0,-Oh.x,jh.z,0,-jh.x,Gh.z,0,-Gh.x,-Oh.y,Oh.x,0,-jh.y,jh.x,0,-Gh.y,Gh.x,0];return!!Kh(t,Uh,Nh,Bh,Hh)&&(t=[1,0,0,0,1,0,0,0,1],!!Kh(t,Uh,Nh,Bh,Hh)&&(qh.crossVectors(Oh,jh),t=[qh.x,qh.y,qh.z],Kh(t,Uh,Nh,Bh,Hh)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zh).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(zh).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Rh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rh)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Rh=[new uu,new uu,new uu,new uu,new uu,new uu,new uu,new uu],zh=new uu,Fh=new Lh,Uh=new uu,Nh=new uu,Bh=new uu,Oh=new uu,jh=new uu,Gh=new uu,Vh=new uu,Hh=new uu,qh=new uu,Wh=new uu;function Kh(e,t,i,n,a){for(let r=0,s=e.length-3;r<=s;r+=3){Wh.fromArray(e,r);const s=a.x*Math.abs(Wh.x)+a.y*Math.abs(Wh.y)+a.z*Math.abs(Wh.z),o=t.dot(Wh),l=i.dot(Wh),c=n.dot(Wh);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Xh=new uu,Qh=new cu;let Zh=0;class Yh extends Yd{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Zh++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=Tc,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)Qh.fromBufferAttribute(this,t),Qh.applyMatrix3(e),this.setXY(t,Qh.x,Qh.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyMatrix3(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyMatrix4(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyNormalMatrix(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.transformDirection(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=su(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ou(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=su(t,this.array)),t}setX(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=su(t,this.array)),t}setY(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=su(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=su(t,this.array)),t}setW(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array),n=ou(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array),n=ou(n,this.array),a=ou(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Jh extends Yh{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class $h extends Yh{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class ep extends Yh{constructor(e,t,i){super(new Float32Array(e),t,i)}}const tp=new Lh,ip=new uu,np=new uu;class ap{constructor(e=new uu,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;void 0!==t?i.copy(t):tp.setFromPoints(e).getCenter(i);let n=0;for(let t=0,a=e.length;t<a;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ip.subVectors(e,this.center);const t=ip.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),i=.5*(e-this.radius);this.center.addScaledVector(ip,i/e),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(np.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ip.copy(e.center).add(np)),this.expandByPoint(ip.copy(e.center).sub(np))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let rp=0;const sp=new zu,op=new lh,lp=new uu,cp=new Lh,dp=new Lh,up=new uu;class hp extends Yd{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rp++}),this.uuid=iu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?$h:Jh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const t=(new Au).getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return sp.makeRotationFromQuaternion(e),this.applyMatrix4(sp),this}rotateX(e){return sp.makeRotationX(e),this.applyMatrix4(sp),this}rotateY(e){return sp.makeRotationY(e),this.applyMatrix4(sp),this}rotateZ(e){return sp.makeRotationZ(e),this.applyMatrix4(sp),this}translate(e,t,i){return sp.makeTranslation(e,t,i),this.applyMatrix4(sp),this}scale(e,t,i){return sp.makeScale(e,t,i),this.applyMatrix4(sp),this}lookAt(e){return op.lookAt(e),op.updateMatrix(),this.applyMatrix4(op.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(lp).negate(),this.translate(lp.x,lp.y,lp.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i];t.push(n.x,n.y,n.z||0)}this.setAttribute("position",new ep(t,3))}else{const i=Math.min(e.length,t.count);for(let n=0;n<i;n++){const i=e[n];t.setXYZ(n,i.x,i.y,i.z||0)}e.length>t.count&&Kd("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Lh);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xd("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new uu(-1/0,-1/0,-1/0),new uu(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){const i=t[e];cp.setFromBufferAttribute(i),this.morphTargetsRelative?(up.addVectors(this.boundingBox.min,cp.min),this.boundingBox.expandByPoint(up),up.addVectors(this.boundingBox.max,cp.max),this.boundingBox.expandByPoint(up)):(this.boundingBox.expandByPoint(cp.min),this.boundingBox.expandByPoint(cp.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Xd('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ap);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xd("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new uu,1/0);if(e){const i=this.boundingSphere.center;if(cp.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){const i=t[e];dp.setFromBufferAttribute(i),this.morphTargetsRelative?(up.addVectors(cp.min,dp.min),cp.expandByPoint(up),up.addVectors(cp.max,dp.max),cp.expandByPoint(up)):(cp.expandByPoint(dp.min),cp.expandByPoint(dp.max))}cp.getCenter(i);let n=0;for(let t=0,a=e.count;t<a;t++)up.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(up));if(t)for(let a=0,r=t.length;a<r;a++){const r=t[a],s=this.morphTargetsRelative;for(let t=0,a=r.count;t<a;t++)up.fromBufferAttribute(r,t),s&&(lp.fromBufferAttribute(e,t),up.add(lp)),n=Math.max(n,i.distanceToSquared(up))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&Xd('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void Xd("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.position,n=t.normal,a=t.uv;let r=this.getAttribute("tangent");void 0!==r&&r.count===i.count||(r=new Yh(new Float32Array(4*i.count),4),this.setAttribute("tangent",r));const s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new uu,o[e]=new uu;const l=new uu,c=new uu,d=new uu,u=new cu,h=new cu,p=new cu,A=new uu,m=new uu;function g(e,t,n){l.fromBufferAttribute(i,e),c.fromBufferAttribute(i,t),d.fromBufferAttribute(i,n),u.fromBufferAttribute(a,e),h.fromBufferAttribute(a,t),p.fromBufferAttribute(a,n),c.sub(l),d.sub(l),h.sub(u),p.sub(u);const r=1/(h.x*p.y-p.x*h.y);isFinite(r)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(d,-h.y).multiplyScalar(r),m.copy(d).multiplyScalar(h.x).addScaledVector(c,-p.x).multiplyScalar(r),s[e].add(A),s[t].add(A),s[n].add(A),o[e].add(m),o[t].add(m),o[n].add(m))}let f=this.groups;0===f.length&&(f=[{start:0,count:e.count}]);for(let t=0,i=f.length;t<i;++t){const i=f[t],n=i.start;for(let t=n,a=n+i.count;t<a;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const _=new uu,v=new uu,E=new uu,y=new uu;function b(e){E.fromBufferAttribute(n,e),y.copy(E);const t=s[e];_.copy(t),_.sub(E.multiplyScalar(E.dot(t))).normalize(),v.crossVectors(y,t);const i=v.dot(o[e])<0?-1:1;r.setXYZW(e,_.x,_.y,_.z,i)}for(let t=0,i=f.length;t<i;++t){const i=f[t],n=i.start;for(let t=n,a=n+i.count;t<a;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i||i.count!==t.count)i=new Yh(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);const n=new uu,a=new uu,r=new uu,s=new uu,o=new uu,l=new uu,c=new uu,d=new uu;if(e)for(let u=0,h=e.count;u<h;u+=3){const h=e.getX(u+0),p=e.getX(u+1),A=e.getX(u+2);n.fromBufferAttribute(t,h),a.fromBufferAttribute(t,p),r.fromBufferAttribute(t,A),c.subVectors(r,a),d.subVectors(n,a),c.cross(d),s.fromBufferAttribute(i,h),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,A),s.add(c),o.add(c),l.add(c),i.setXYZ(h,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),a.fromBufferAttribute(t,e+1),r.fromBufferAttribute(t,e+2),c.subVectors(r,a),d.subVectors(n,a),c.cross(d),i.setXYZ(e+0,c.x,c.y,c.z),i.setXYZ(e+1,c.x,c.y,c.z),i.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)up.fromBufferAttribute(e,t),up.normalize(),e.setXYZ(t,up.x,up.y,up.z)}toNonIndexed(){function e(e,t){const i=e.array,n=e.itemSize,a=e.normalized,r=new i.constructor(t.length*n);let s=0,o=0;for(let a=0,l=t.length;a<l;a++){s=e.isInterleavedBufferAttribute?t[a]*e.data.stride+e.offset:t[a]*n;for(let e=0;e<n;e++)r[o++]=i[s++]}return new Yh(r,n,a)}if(null===this.index)return Kd("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new hp,i=this.index.array,n=this.attributes;for(const a in n){const r=e(n[a],i);t.setAttribute(a,r)}const a=this.morphAttributes;for(const n in a){const r=[],s=a[n];for(let t=0,n=s.length;t<n;t++){const n=e(s[t],i);r.push(n)}t.morphAttributes[n]=r}t.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let e=0,i=r.length;e<i;e++){const i=r[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=void 0!==this.parameters&&!0===this._transformed?"BufferGeometry":this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters&&!0!==this._transformed){const t=this.parameters;for(const i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const t in i){const n=i[t];e.data.attributes[t]=n.toJSON(e.data)}const n={};let a=!1;for(const t in this.morphAttributes){const i=this.morphAttributes[t],r=[];for(let t=0,n=i.length;t<n;t++){const n=i[t];r.push(n.toJSON(e.data))}r.length>0&&(n[t]=r,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;null!==i&&this.setIndex(i.clone());const n=e.attributes;for(const e in n){const i=n[e];this.setAttribute(e,i.clone(t))}const a=e.morphAttributes;for(const e in a){const i=[],n=a[e];for(let e=0,a=n.length;e<a;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let e=0,t=r.length;e<t;e++){const t=r[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let pp=0;class Ap extends Yd{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pp++}),this.uuid=iu(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Sl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new gh(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Dd,this.stencilZFail=Dd,this.stencilZPass=Dd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const i=e[t];if(void 0===i){Kd(`Material: parameter '${t}' has value of undefined.`);continue}const n=this[t];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector2&&i&&i.isVector2||n&&n.isEuler&&i&&i.isEuler||n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i:Kd(`Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(e){const t=[];for(const i in e){const n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==Sl&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Dd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Dd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Dd&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){const t=n(e.textures),a=n(e.images);t.length>0&&(i.textures=t),a.length>0&&(i.images=a)}return i}fromJSON(e,t){if(void 0!==e.uuid&&(this.uuid=e.uuid),void 0!==e.name&&(this.name=e.name),void 0!==e.color&&void 0!==this.color&&this.color.setHex(e.color),void 0!==e.roughness&&(this.roughness=e.roughness),void 0!==e.metalness&&(this.metalness=e.metalness),void 0!==e.sheen&&(this.sheen=e.sheen),void 0!==e.sheenColor&&(this.sheenColor=(new gh).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(this.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==this.emissive&&this.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==this.specular&&this.specular.setHex(e.specular),void 0!==e.specularIntensity&&(this.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==this.specularColor&&this.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(this.shininess=e.shininess),void 0!==e.clearcoat&&(this.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(this.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(this.dispersion=e.dispersion),void 0!==e.iridescence&&(this.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(this.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(this.transmission=e.transmission),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.attenuationDistance&&(this.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==this.attenuationColor&&this.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(this.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(this.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.flatShading&&(this.flatShading=e.flatShading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.side&&(this.side=e.side),void 0!==e.shadowSide&&(this.shadowSide=e.shadowSide),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.transparent&&(this.transparent=e.transparent),void 0!==e.alphaTest&&(this.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(this.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(this.depthFunc=e.depthFunc),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.depthWrite&&(this.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(this.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(this.blendSrc=e.blendSrc),void 0!==e.blendDst&&(this.blendDst=e.blendDst),void 0!==e.blendEquation&&(this.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(this.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(this.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(this.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==this.blendColor&&this.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(this.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(this.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(this.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(this.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(this.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(this.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(this.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(this.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(this.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(this.rotation=e.rotation),void 0!==e.linewidth&&(this.linewidth=e.linewidth),void 0!==e.dashSize&&(this.dashSize=e.dashSize),void 0!==e.gapSize&&(this.gapSize=e.gapSize),void 0!==e.scale&&(this.scale=e.scale),void 0!==e.polygonOffset&&(this.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(this.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(this.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(this.dithering=e.dithering),void 0!==e.alphaToCoverage&&(this.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(this.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(this.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(this.allowOverride=e.allowOverride),void 0!==e.visible&&(this.visible=e.visible),void 0!==e.toneMapped&&(this.toneMapped=e.toneMapped),void 0!==e.userData&&(this.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),void 0!==e.size&&(this.size=e.size),void 0!==e.sizeAttenuation&&(this.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(this.map=t[e.map]||null),void 0!==e.matcap&&(this.matcap=t[e.matcap]||null),void 0!==e.alphaMap&&(this.alphaMap=t[e.alphaMap]||null),void 0!==e.bumpMap&&(this.bumpMap=t[e.bumpMap]||null),void 0!==e.bumpScale&&(this.bumpScale=e.bumpScale),void 0!==e.normalMap&&(this.normalMap=t[e.normalMap]||null),void 0!==e.normalMapType&&(this.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),this.normalScale=(new cu).fromArray(t)}return void 0!==e.displacementMap&&(this.displacementMap=t[e.displacementMap]||null),void 0!==e.displacementScale&&(this.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(this.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(this.roughnessMap=t[e.roughnessMap]||null),void 0!==e.metalnessMap&&(this.metalnessMap=t[e.metalnessMap]||null),void 0!==e.emissiveMap&&(this.emissiveMap=t[e.emissiveMap]||null),void 0!==e.emissiveIntensity&&(this.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(this.specularMap=t[e.specularMap]||null),void 0!==e.specularIntensityMap&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),void 0!==e.specularColorMap&&(this.specularColorMap=t[e.specularColorMap]||null),void 0!==e.envMap&&(this.envMap=t[e.envMap]||null),void 0!==e.envMapRotation&&this.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(this.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(this.lightMap=t[e.lightMap]||null),void 0!==e.lightMapIntensity&&(this.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(this.aoMap=t[e.aoMap]||null),void 0!==e.aoMapIntensity&&(this.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(this.gradientMap=t[e.gradientMap]||null),void 0!==e.clearcoatMap&&(this.clearcoatMap=t[e.clearcoatMap]||null),void 0!==e.clearcoatRoughnessMap&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),void 0!==e.clearcoatNormalMap&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),void 0!==e.clearcoatNormalScale&&(this.clearcoatNormalScale=(new cu).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(this.iridescenceMap=t[e.iridescenceMap]||null),void 0!==e.iridescenceThicknessMap&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),void 0!==e.transmissionMap&&(this.transmissionMap=t[e.transmissionMap]||null),void 0!==e.thicknessMap&&(this.thicknessMap=t[e.thicknessMap]||null),void 0!==e.anisotropyMap&&(this.anisotropyMap=t[e.anisotropyMap]||null),void 0!==e.sheenColorMap&&(this.sheenColorMap=t[e.sheenColorMap]||null),void 0!==e.sheenRoughnessMap&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(null!==t){const e=t.length;i=new Array(e);for(let n=0;n!==e;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}const mp=new uu,gp=new uu,fp=new uu,_p=new uu,vp=new uu,Ep=new uu,yp=new uu;class bp{constructor(e=new uu,t=new uu(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mp)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=mp.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mp.copy(this.origin).addScaledVector(this.direction,t),mp.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){gp.copy(e).add(t).multiplyScalar(.5),fp.copy(t).sub(e).normalize(),_p.copy(this.origin).sub(gp);const a=.5*e.distanceTo(t),r=-this.direction.dot(fp),s=_p.dot(this.direction),o=-_p.dot(fp),l=_p.lengthSq(),c=Math.abs(1-r*r);let d,u,h,p;if(c>0)if(d=r*o-s,u=r*s-o,p=a*c,d>=0)if(u>=-p)if(u<=p){const e=1/c;d*=e,u*=e,h=d*(d+r*u+2*s)+u*(r*d+u+2*o)+l}else u=a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;else u=-a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;else u<=-p?(d=Math.max(0,-(-r*a+s)),u=d>0?-a:Math.min(Math.max(-a,-o),a),h=-d*d+u*(u+2*o)+l):u<=p?(d=0,u=Math.min(Math.max(-a,-o),a),h=u*(u+2*o)+l):(d=Math.max(0,-(r*a+s)),u=d>0?a:Math.min(Math.max(-a,-o),a),h=-d*d+u*(u+2*o)+l);else u=r>0?-a:a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,d),n&&n.copy(gp).addScaledVector(fp,u),h}intersectSphere(e,t){mp.subVectors(e.center,this.origin);const i=mp.dot(this.direction),n=mp.dot(mp)-i*i,a=e.radius*e.radius;if(n>a)return null;const r=Math.sqrt(a-n),s=i-r,o=i+r;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,r,s,o;const l=1/this.direction.x,c=1/this.direction.y,d=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),c>=0?(a=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c):(a=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c),i>r||a>n?null:((a>i||isNaN(i))&&(i=a),(r<n||isNaN(n))&&(n=r),d>=0?(s=(e.min.z-u.z)*d,o=(e.max.z-u.z)*d):(s=(e.max.z-u.z)*d,o=(e.min.z-u.z)*d),i>o||s>n?null:((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,t)))}intersectsBox(e){return null!==this.intersectBox(e,mp)}intersectTriangle(e,t,i,n,a){vp.subVectors(t,e),Ep.subVectors(i,e),yp.crossVectors(vp,Ep);let r,s=this.direction.dot(yp);if(s>0){if(n)return null;r=1}else{if(!(s<0))return null;r=-1,s=-s}_p.subVectors(this.origin,e);const o=r*this.direction.dot(Ep.crossVectors(_p,Ep));if(o<0)return null;const l=r*this.direction.dot(vp.cross(_p));if(l<0)return null;if(o+l>s)return null;const c=-r*_p.dot(yp);return c<0?null:this.at(c/s,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class kp extends Ap{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new qu,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const xp=new zu,wp=new bp,Mp=new ap,Sp=new uu,Cp=new uu,Tp=new uu,Dp=new uu,Pp=new uu,Ip=new uu,Lp=new uu,Rp=new uu;class zp extends lh{constructor(e=new hp,t=new kp){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){const t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,r=i.morphTargetsRelative;t.fromBufferAttribute(n,e);const s=this.morphTargetInfluences;if(a&&s){Ip.set(0,0,0);for(let i=0,n=a.length;i<n;i++){const n=s[i],o=a[i];0!==n&&(Pp.fromBufferAttribute(o,e),r?Ip.addScaledVector(Pp,n):Ip.addScaledVector(Pp.sub(t),n))}t.add(Ip)}return t}raycast(e,t){const i=this.geometry,n=this.material,a=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Mp.copy(i.boundingSphere),Mp.applyMatrix4(a),wp.copy(e.ray).recast(e.near),!1===Mp.containsPoint(wp.origin)){if(null===wp.intersectSphere(Mp,Sp))return;if(wp.origin.distanceToSquared(Sp)>(e.far-e.near)**2)return}xp.copy(a).invert(),wp.copy(e.ray).applyMatrix4(xp),null!==i.boundingBox&&!1===wp.intersectsBox(i.boundingBox)||this._computeIntersections(e,t,wp)}}_computeIntersections(e,t,i){let n;const a=this.geometry,r=this.material,s=a.index,o=a.attributes.position,l=a.attributes.uv,c=a.attributes.uv1,d=a.attributes.normal,u=a.groups,h=a.drawRange;if(null!==s)if(Array.isArray(r))for(let a=0,o=u.length;a<o;a++){const o=u[a],p=r[o.materialIndex];for(let a=Math.max(o.start,h.start),r=Math.min(s.count,Math.min(o.start+o.count,h.start+h.count));a<r;a+=3){n=Fp(this,p,e,i,l,c,d,s.getX(a),s.getX(a+1),s.getX(a+2)),n&&(n.faceIndex=Math.floor(a/3),n.face.materialIndex=o.materialIndex,t.push(n))}}else{for(let a=Math.max(0,h.start),o=Math.min(s.count,h.start+h.count);a<o;a+=3){n=Fp(this,r,e,i,l,c,d,s.getX(a),s.getX(a+1),s.getX(a+2)),n&&(n.faceIndex=Math.floor(a/3),t.push(n))}}else if(void 0!==o)if(Array.isArray(r))for(let a=0,s=u.length;a<s;a++){const s=u[a],p=r[s.materialIndex];for(let a=Math.max(s.start,h.start),r=Math.min(o.count,Math.min(s.start+s.count,h.start+h.count));a<r;a+=3){n=Fp(this,p,e,i,l,c,d,a,a+1,a+2),n&&(n.faceIndex=Math.floor(a/3),n.face.materialIndex=s.materialIndex,t.push(n))}}else{for(let a=Math.max(0,h.start),s=Math.min(o.count,h.start+h.count);a<s;a+=3){n=Fp(this,r,e,i,l,c,d,a,a+1,a+2),n&&(n.faceIndex=Math.floor(a/3),t.push(n))}}}}function Fp(e,t,i,n,a,r,s,o,l,c){e.getVertexPosition(o,Cp),e.getVertexPosition(l,Tp),e.getVertexPosition(c,Dp);const d=function(e,t,i,n,a,r,s,o){let l;if(l=1===t.side?n.intersectTriangle(s,r,a,!0,o):n.intersectTriangle(a,r,s,0===t.side,o),null===l)return null;Rp.copy(o),Rp.applyMatrix4(e.matrixWorld);const c=i.ray.origin.distanceTo(Rp);return c<i.near||c>i.far?null:{distance:c,point:Rp.clone(),object:e}}(e,t,i,n,Cp,Tp,Dp,Lp);if(d){const e=new uu;Ih.getBarycoord(Lp,Cp,Tp,Dp,e),a&&(d.uv=Ih.getInterpolatedAttribute(a,o,l,c,e,new cu)),r&&(d.uv1=Ih.getInterpolatedAttribute(r,o,l,c,e,new cu)),s&&(d.normal=Ih.getInterpolatedAttribute(s,o,l,c,e,new uu),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const t={a:o,b:l,c:c,normal:new uu,materialIndex:0};Ih.getNormal(Cp,Tp,Dp,t.normal),d.face=t,d.barycoord=e}return d}class Up extends Tu{constructor(e=null,t=1,i=1,n,a,r,s,o,l=1003,c=1003,d,u){super(null,r,s,o,l,c,n,a,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Np=new uu,Bp=new uu,Op=new Au;class jp{constructor(e=new uu(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const n=Np.subVectors(i,t).cross(Bp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const n=e.delta(Np),a=this.normal.dot(n);if(0===a)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/a;return!0===i&&(r<0||r>1)?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Op.getNormalMatrix(e),n=this.coplanarPoint(Np).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Gp=new ap,Vp=new cu(.5,.5),Hp=new uu;class qp{constructor(e=new jp,t=new jp,i=new jp,n=new jp,a=new jp,r=new jp){this.planes=[e,t,i,n,a,r]}set(e,t,i,n,a,r){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(r),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3,i=!1){const n=this.planes,a=e.elements,r=a[0],s=a[1],o=a[2],l=a[3],c=a[4],d=a[5],u=a[6],h=a[7],p=a[8],A=a[9],m=a[10],g=a[11],f=a[12],_=a[13],v=a[14],E=a[15];if(n[0].setComponents(l-r,h-c,g-p,E-f).normalize(),n[1].setComponents(l+r,h+c,g+p,E+f).normalize(),n[2].setComponents(l+s,h+d,g+A,E+_).normalize(),n[3].setComponents(l-s,h-d,g-A,E-_).normalize(),i)n[4].setComponents(o,u,m,v).normalize(),n[5].setComponents(l-o,h-u,g-m,E-v).normalize();else if(n[4].setComponents(l-o,h-u,g-m,E-v).normalize(),t===Od)n[5].setComponents(l+o,h+u,g+m,E+v).normalize();else{if(t!==jd)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,u,m,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Gp.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Gp.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gp)}intersectsSprite(e){Gp.center.set(0,0,0);const t=Vp.distanceTo(e.center);return Gp.radius=.7071067811865476+t,Gp.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gp)}intersectsSphere(e){const t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(i)<n)return!1}return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const n=t[i];if(Hp.x=n.normal.x>0?e.max.x:e.min.x,Hp.y=n.normal.y>0?e.max.y:e.min.y,Hp.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Hp)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Wp extends Ap{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new gh(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Kp=new uu,Xp=new uu,Qp=new zu,Zp=new bp,Yp=new ap,Jp=new uu,$p=new uu;class eA extends lh{constructor(e=new hp,t=new Wp){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)Kp.fromBufferAttribute(t,e-1),Xp.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=Kp.distanceTo(Xp);e.setAttribute("lineDistance",new ep(i,1))}else Kd("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,r=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Yp.copy(i.boundingSphere),Yp.applyMatrix4(n),Yp.radius+=a,!1===e.ray.intersectsSphere(Yp))return;Qp.copy(n).invert(),Zp.copy(e.ray).applyMatrix4(Qp);const s=a/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,c=i.index,d=i.attributes.position;if(null!==c){const i=Math.max(0,r.start),n=Math.min(c.count,r.start+r.count);for(let a=i,r=n-1;a<r;a+=l){const i=c.getX(a),n=c.getX(a+1),r=tA(this,e,Zp,o,i,n,a);r&&t.push(r)}if(this.isLineLoop){const a=c.getX(n-1),r=c.getX(i),s=tA(this,e,Zp,o,a,r,n-1);s&&t.push(s)}}else{const i=Math.max(0,r.start),n=Math.min(d.count,r.start+r.count);for(let a=i,r=n-1;a<r;a+=l){const i=tA(this,e,Zp,o,a,a+1,a);i&&t.push(i)}if(this.isLineLoop){const a=tA(this,e,Zp,o,n-1,i,n-1);a&&t.push(a)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){const t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function tA(e,t,i,n,a,r,s){const o=e.geometry.attributes.position;Kp.fromBufferAttribute(o,a),Xp.fromBufferAttribute(o,r);if(i.distanceSqToSegment(Kp,Xp,Jp,$p)>n)return;Jp.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(Jp);return l<t.near||l>t.far?void 0:{distance:l,point:$p.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}const iA=new uu,nA=new uu;class aA extends eA{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,i=[];for(let e=0,n=t.count;e<n;e+=2)iA.fromBufferAttribute(t,e),nA.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+iA.distanceTo(nA);e.setAttribute("lineDistance",new ep(i,1))}else Kd("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class rA extends Tu{constructor(e,t,i,n,a=1006,r=1006,s,o,l){super(e,t,i,n,a,r,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const c=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class sA extends Tu{constructor(e=[],t=301,i,n,a,r,s,o,l,c){super(e,t,i,n,a,r,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class oA extends Tu{constructor(e,t,i=1014,n,a,r,s=1003,o=1003,l,c=1026,d=1){if(c!==Uc&&c!==Nc)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:d},n,a,r,s,o,c,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new wu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class lA extends oA{constructor(e,t=1014,i=301,n,a,r=1003,s=1003,o,l=1026){const c={width:e,height:e,depth:1},d=[c,c,c,c,c,c];super(e,e,t,i,n,a,r,s,o,l),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class cA extends Tu{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class dA extends hp{constructor(e=1,t=1,i=1,n=1,a=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:r};const s=this;n=Math.floor(n),a=Math.floor(a),r=Math.floor(r);const o=[],l=[],c=[],d=[];let u=0,h=0;function p(e,t,i,n,a,r,p,A,m,g,f){const _=r/m,v=p/g,E=r/2,y=p/2,b=A/2,k=m+1,x=g+1;let w=0,M=0;const S=new uu;for(let r=0;r<x;r++){const s=r*v-y;for(let o=0;o<k;o++){const u=o*_-E;S[e]=u*n,S[t]=s*a,S[i]=b,l.push(S.x,S.y,S.z),S[e]=0,S[t]=0,S[i]=A>0?1:-1,c.push(S.x,S.y,S.z),d.push(o/m),d.push(1-r/g),w+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const i=u+t+k*e,n=u+t+k*(e+1),a=u+(t+1)+k*(e+1),r=u+(t+1)+k*e;o.push(i,n,r),o.push(n,a,r),M+=6}s.addGroup(h,M,f),h+=M,u+=w}p("z","y","x",-1,-1,i,t,e,r,a,0),p("z","y","x",1,-1,i,t,-e,r,a,1),p("x","z","y",1,1,e,i,t,n,r,2),p("x","z","y",1,-1,e,i,-t,n,r,3),p("x","y","z",1,-1,e,t,i,n,a,4),p("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(o),this.setAttribute("position",new ep(l,3)),this.setAttribute("normal",new ep(c,3)),this.setAttribute("uv",new ep(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dA(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class uA extends hp{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const a=e/2,r=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,c=o+1,d=e/s,u=t/o,h=[],p=[],A=[],m=[];for(let e=0;e<c;e++){const t=e*u-r;for(let i=0;i<l;i++){const n=i*d-a;p.push(n,-t,0),A.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,n=t+l*(e+1),a=t+1+l*(e+1),r=t+1+l*e;h.push(i,n,r),h.push(n,a,r)}this.setIndex(h),this.setAttribute("position",new ep(p,3)),this.setAttribute("normal",new ep(A,3)),this.setAttribute("uv",new ep(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uA(e.width,e.height,e.widthSegments,e.heightSegments)}}class hA extends hp{constructor(e=1,t=32,i=16,n=0,a=2*Math.PI,r=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:a,thetaStart:r,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const o=Math.min(r+s,Math.PI);let l=0;const c=[],d=new uu,u=new uu,h=[],p=[],A=[],m=[];for(let h=0;h<=i;h++){const g=[],f=h/i,_=r+f*s,v=e*Math.cos(_),E=Math.sqrt(e*e-v*v);let y=0;0===h&&0===r?y=.5/t:h===i&&o===Math.PI&&(y=-.5/t);for(let e=0;e<=t;e++){const i=e/t,r=n+i*a;d.x=-E*Math.cos(r),d.y=v,d.z=E*Math.sin(r),p.push(d.x,d.y,d.z),u.copy(d).normalize(),A.push(u.x,u.y,u.z),m.push(i+y,1-f),g.push(l++)}c.push(g)}for(let e=0;e<i;e++)for(let n=0;n<t;n++){const t=c[e][n+1],a=c[e][n],s=c[e+1][n],l=c[e+1][n+1];(0!==e||r>0)&&h.push(t,a,l),(e!==i-1||o<Math.PI)&&h.push(a,s,l)}this.setIndex(h),this.setAttribute("position",new ep(p,3)),this.setAttribute("normal",new ep(A,3)),this.setAttribute("uv",new ep(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hA(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class pA extends hp{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],i=new Set,n=new uu,a=new uu;if(null!==e.index){const r=e.attributes.position,s=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],c=l.start;for(let e=c,o=c+l.count;e<o;e+=3)for(let o=0;o<3;o++){const l=s.getX(e+o),c=s.getX(e+(o+1)%3);n.fromBufferAttribute(r,l),a.fromBufferAttribute(r,c),!0===AA(n,a,i)&&(t.push(n.x,n.y,n.z),t.push(a.x,a.y,a.z))}}}else{const r=e.attributes.position;for(let e=0,s=r.count/3;e<s;e++)for(let s=0;s<3;s++){const o=3*e+s,l=3*e+(s+1)%3;n.fromBufferAttribute(r,o),a.fromBufferAttribute(r,l),!0===AA(n,a,i)&&(t.push(n.x,n.y,n.z),t.push(a.x,a.y,a.z))}}this.setAttribute("position",new ep(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function AA(e,t,i){const n=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,a=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==i.has(n)&&!0!==i.has(a)&&(i.add(n),i.add(a),!0)}function mA(e){const t={};for(const i in e){t[i]={};for(const n in e[i]){const a=e[i][n];if(fA(a))a.isRenderTargetTexture?(Kd("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=a.clone();else if(Array.isArray(a))if(fA(a[0])){const e=[];for(let t=0,i=a.length;t<i;t++)e[t]=a[t].clone();t[i][n]=e}else t[i][n]=a.slice();else t[i][n]=a}}return t}function gA(e){const t={};for(let i=0;i<e.length;i++){const n=mA(e[i]);for(const e in n)t[e]=n[e]}return t}function fA(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function _A(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:vu.workingColorSpace}const vA={clone:mA,merge:gA};class EA extends Ap{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=mA(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}fromJSON(e,t){if(super.fromJSON(e,t),void 0!==e.uniforms)for(const i in e.uniforms){const n=e.uniforms[i];switch(this.uniforms[i]={},n.type){case"t":this.uniforms[i].value=t[n.value]||null;break;case"c":this.uniforms[i].value=(new gh).setHex(n.value);break;case"v2":this.uniforms[i].value=(new cu).fromArray(n.value);break;case"v3":this.uniforms[i].value=(new uu).fromArray(n.value);break;case"v4":this.uniforms[i].value=(new Du).fromArray(n.value);break;case"m3":this.uniforms[i].value=(new Au).fromArray(n.value);break;case"m4":this.uniforms[i].value=(new zu).fromArray(n.value);break;default:this.uniforms[i].value=n.value}}if(void 0!==e.defines&&(this.defines=e.defines),void 0!==e.vertexShader&&(this.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(this.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(this.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)this.extensions[t]=e.extensions[t];return void 0!==e.lights&&(this.lights=e.lights),void 0!==e.clipping&&(this.clipping=e.clipping),this}}class yA extends EA{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class bA extends Ap{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class kA extends Ap{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const xA={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(wA(e)||(this.files[e]=t))},get:function(e){if(!1!==this.enabled&&!wA(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function wA(e){try{const t=e.slice(e.indexOf(":")+1);return"blob:"===new URL(t).protocol}catch(e){return!1}}class MA{constructor(e,t,i){const n=this;let a,r=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(e){o++,!1===r&&void 0!==n.onStart&&n.onStart(e,s,o),r=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return e=e.normalize("NFC"),a?a(e):e},this.setURLModifier=function(e){return a=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){const i=l[t],n=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return n}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const SA=new MA;let CA=class{constructor(e){this.manager=void 0!==e?e:SA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const i=this;return new Promise(function(n,a){i.load(e,n,t,a)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};CA.DEFAULT_MATERIAL_NAME="__DEFAULT";const TA={};class DA extends Error{constructor(e,t){super(e),this.response=t}}class PA extends CA{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const a=xA.get(`file:${e}`);if(void 0!==a)return this.manager.itemStart(e),void setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0);if(void 0!==TA[e])return void TA[e].push({onLoad:t,onProgress:i,onError:n});TA[e]=[],TA[e].push({onLoad:t,onProgress:i,onError:n});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(r).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&Kd("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const i=TA[e],n=t.body.getReader(),a=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),r=a?parseInt(a):0,s=0!==r;let o=0;const l=new ReadableStream({start(e){!function t(){n.read().then(({done:n,value:a})=>{if(n)e.close();else{o+=a.byteLength;const n=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:r});for(let e=0,t=i.length;e<t;e++){const t=i[e];t.onProgress&&t.onProgress(n)}e.enqueue(a),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new DA(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),i=t&&t[1]?t[1].toLowerCase():void 0,n=new TextDecoder(i);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{xA.add(`file:${e}`,t);const i=TA[e];delete TA[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];n.onLoad&&n.onLoad(t)}}).catch(t=>{const i=TA[e];if(void 0===i)throw this.manager.itemError(e),t;delete TA[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];n.onError&&n.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const IA=new WeakMap;class LA extends CA{constructor(e){super(e)}load(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,r=xA.get(`image:${e}`);if(void 0!==r){if(!0===r.complete)a.manager.itemStart(e),setTimeout(function(){t&&t(r),a.manager.itemEnd(e)},0);else{let e=IA.get(r);void 0===e&&(e=[],IA.set(r,e)),e.push({onLoad:t,onError:n})}return r}const s=Gd("img");function o(){c(),t&&t(this);const i=IA.get(this)||[];for(let e=0;e<i.length;e++){const t=i[e];t.onLoad&&t.onLoad(this)}IA.delete(this),a.manager.itemEnd(e)}function l(t){c(),n&&n(t),xA.remove(`image:${e}`);const i=IA.get(this)||[];for(let e=0;e<i.length;e++){const n=i[e];n.onError&&n.onError(t)}IA.delete(this),a.manager.itemError(e),a.manager.itemEnd(e)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),xA.add(`image:${e}`,s),a.manager.itemStart(e),s.src=e,s}}const RA=new uu,zA=new du,FA=new uu;class UA extends lh{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zu,this.projectionMatrix=new zu,this.projectionMatrixInverse=new zu,this.coordinateSystem=Od,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(RA,zA,FA),1===FA.x&&1===FA.y&&1===FA.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RA,zA,FA.set(1,1,1)).invert()}updateWorldMatrix(e,t,i=!1){super.updateWorldMatrix(e,t,i),this.matrixWorld.decompose(RA,zA,FA),1===FA.x&&1===FA.y&&1===FA.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RA,zA,FA.set(1,1,1)).invert()}clone(){return(new this.constructor).copy(this)}}const NA=new uu,BA=new cu,OA=new cu;class jA extends UA{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*tu*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*eu*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*tu*Math.atan(Math.tan(.5*eu*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){NA.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(NA.x,NA.y).multiplyScalar(-e/NA.z),NA.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(NA.x,NA.y).multiplyScalar(-e/NA.z)}getViewSize(e,t){return this.getViewBounds(e,BA,OA),t.subVectors(OA,BA)}setViewOffset(e,t,i,n,a,r){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*eu*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n;const r=this.view;if(null!==this.view&&this.view.enabled){const e=r.fullWidth,s=r.fullHeight;a+=r.offsetX*n/e,t-=r.offsetY*i/s,n*=r.width/e,i*=r.height/s}const s=this.filmOffset;0!==s&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class GA extends UA{constructor(e=-1,t=1,i=1,n=-1,a=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let a=i-e,r=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=e*this.view.offsetX,r=a+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(a,r,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const VA=-90;class HA extends lh{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new jA(VA,1,e,t);n.layers=this.layers,this.add(n);const a=new jA(VA,1,e,t);a.layers=this.layers,this.add(a);const r=new jA(VA,1,e,t);r.layers=this.layers,this.add(r);const s=new jA(VA,1,e,t);s.layers=this.layers,this.add(s);const o=new jA(VA,1,e,t);o.layers=this.layers,this.add(o);const l=new jA(VA,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,n,a,r,s,o]=t;for(const e of t)this.remove(e);if(e===Od)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==jd)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,r,s,o,l,c]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;m=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(i,0,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,1,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,r),e.setRenderTarget(i,2,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,3,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,4,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),i.texture.generateMipmaps=A,e.setRenderTarget(i,5,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,c),e.setRenderTarget(d,u,h),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class qA extends jA{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const WA=new zu;class KA{constructor(e,t,i=0,n=1/0){this.ray=new bp(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new Wu,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Xd("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return WA.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(WA),this}intersectObject(e,t=!0,i=[]){return QA(e,this,i,t),i.sort(XA),i}intersectObjects(e,t=!0,i=[]){for(let n=0,a=e.length;n<a;n++)QA(e[n],this,i,t);return i.sort(XA),i}}function XA(e,t){return e.distance-t.distance}function QA(e,t,i,n){let a=!0;if(e.layers.test(t.layers)){!1===e.raycast(t,i)&&(a=!1)}if(!0===a&&!0===n){const n=e.children;for(let e=0,a=n.length;e<a;e++)QA(n[e],t,i,!0)}}class ZA{static{ZA.prototype.isMatrix2=!0}constructor(e,t,i,n){this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,i,n)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,n){const a=this.elements;return a[0]=e,a[2]=t,a[1]=i,a[3]=n,this}}function YA(e,t,i,n){const a=function(e){switch(e){case kc:case xc:return{byteLength:1,components:1};case Mc:case wc:case Dc:return{byteLength:2,components:1};case Pc:case Ic:return{byteLength:2,components:4};case Cc:case Sc:case Tc:return{byteLength:4,components:1};case Rc:case zc:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}(n);switch(i){case 1021:return e*t;case 1028:case Bc:return e*t/a.components*a.byteLength;case Oc:case jc:return e*t*2/a.components*a.byteLength;case 1022:return e*t*3/a.components*a.byteLength;case Fc:case Gc:return e*t*4/a.components*a.byteLength;case Vc:case Hc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case qc:case Wc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Xc:case Zc:return Math.max(e,16)*Math.max(t,8)/4;case Kc:case Qc:return Math.max(e,8)*Math.max(t,8)/2;case Yc:case Jc:case ed:case td:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case $c:case id:case nd:case ad:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case rd:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case sd:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case od:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case ld:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case cd:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case dd:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case ud:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case hd:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case pd:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ad:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case md:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case gd:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case fd:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case _d:case vd:case Ed:return Math.ceil(e/4)*Math.ceil(t/4)*16;case yd:case bd:return Math.ceil(e/4)*Math.ceil(t/4)*8;case kd:case xd:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}
|
|
1162
|
+
*/(_o(t.pitch)),s=50*r,o=Al*r;this._cursor.style.top=e.layerY-3*s/5+"px",this._cursor.style.left=e.layerX-o/2+"px",this._cursor.style.height=`${s}px`,this._cursor.style.width=`${o}px`,this._cursor.style.display="block",clearTimeout(this._throttledBestPicMap),this._throttledBestPicMap=setTimeout(()=>{const e=(_o(t.yaw)+this.psv.getPictureOriginalHeading())%360,r=El(n.gps,a,e),s=this._getMapNearbyPictures(r);if(s?.length>0){const e=(_o(t.yaw)+this.psv.getPictureOriginalHeading())%360,r=El(n.gps,a,e),o=this._bestPicAround(n,r,e,s);o?(this._cursor.src=hl,this._mapPreviewPic=o,i._picMarkerPreview.setLngLat(o.geometry.coordinates).setRotation(360===o.properties?.["pers:interior_orientation"]?.field_of_view?this.psv.getXYZ().x||0:o.properties?.["view:azimuth"]||0).addTo(i)):(this._cursor.src=pl,i._picMarkerPreview?.remove(),this._mapPreviewPic=null)}else this._cursor.src=hl,this._mapPreviewPic=null,i&&(this._isMapShowingPictures()||0===this._getMapNearbySequences(r).length)?(this._cursor.src=pl,i?._picMarkerPreview?.remove()):(this._cursor.src=hl,i?._picMarkerPreview.setLngLat(r).setRotation(e).addTo(i))},10)}}else this.isDesktop&&(this._cursor.style.display="none",this._mapPreviewPic=null,this._hideCursor||i?._picMarkerPreview?.remove())}_onPointerLeave(){this.isDesktop&&(this._cursor.style.display="none"),this._couldGoSomewhere=!1}_onHoverOtherStuff(){this._hideCursor=!0,this._onPointerLeave()}_onLeaveOtherStuff(){this._hideCursor=!1}_onPSVPicNavChanged(e){if("pic"===e?.detail?.value)this._onHoverOtherStuff();else this._onLeaveOtherStuff()}_pitchDegToProjectedDistance(e,t){return t?this.isDesktop?e>=30?0:e>=-2.5?ml:e>=-6?25:e>=-15?12.5:e>=gl?6.25:0:e>=20?0:e>=4?ml/3:e>=-4?ml/1.5:e>=-20?ml/3:0:ml/3}_isMapShowingPictures(){if(this.psv._parent.map){const e=this.psv._parent.map;let t=e.getLayersOrder().find(e=>e.endsWith("pictures"));if(t){return e.queryRenderedFeatures({layers:[t]}).length>0}}return!1}_getMapNearbyPictures(e){const t=this.psv._parent.map;if(t){const i=this.psv._parent?.mapStyleComposer;if(i){const n=Object.keys(i.layerRanges.panoramax[i.panoramax].sources)[0];if(n)return t.querySourceFeatures(n,{sourceLayer:"pictures",filter:["within",{type:"Polygon",coordinates:[[[e[0]-fl,e[1]-fl],[e[0]+fl,e[1]-fl],[e[0]+fl,e[1]+fl],[e[0]-fl,e[1]+fl],[e[0]-fl,e[1]-fl]]]}]}).map(e=>({id:e.properties.id,collection:e.properties.first_sequence||e.properties?.sequences?.[0],geometry:e.geometry,properties:{datetime:e.properties.datetime||e.properties.ts,"view:azimuth":e.properties?.["view:azimuth"]||e.properties.heading,"pers:interior_orientation":e.properties?.["pers:interior_orientation"]||{field_of_view:"equirectangular"===e.properties.type?360:void 0}}}))}}return null}_getMapNearbySequences(e){const t=this.psv._parent.map;if(t){const i=t.getLayersOrder().find(e=>e.endsWith("sequences"));if(i){const n=25e-6,a=[t.project([e[0]-n,e[1]-n]),t.project([e[0]+n,e[1]+n])];return t.queryRenderedFeatures(a,{layers:[i]})}}return[]}_bestPicAround(e,t,i,n){if(!Array.isArray(n)||!n.length)return null;const a=new Date(e.properties?.datetime),r=n.filter(t=>t.id!==e.id).map(n=>{const r=360===n.properties?.["pers:interior_orientation"]?.field_of_view,s=Js(t,n.geometry.coordinates),o=n.collection===e.sequence?.id||"any"===this.psv.getPicturesNavigation(),l=n.properties?.["view:azimuth"],c=r||"number"==typeof l&&no(i,l)<=45,d=Math.abs((i-io(e.gps,n.geometry.coordinates))%360)<=45,u=new Date(n.properties?.datetime),h=a.toDateString()===u.toDateString(),p=Math.abs((a-u)/864e5);let A=!0;if(this.psv._parent.map){const e=this.psv._parent.map;e.indoorEqual&&"-1000"!==e.indoorEqual.level&&(A=e._indoorFeaturesIDs.pictures[e.indoorEqual.level]?.has(n.id),A||"0"!==e.indoorEqual.level||(A=!0,Object.entries(e._indoorFeaturesIDs.pictures).forEach(([e,t])=>{A&&"0"!==e&&(A=!t.has(n.id))})))}let m=1/0;return o&&d&&A&&(h&&r?m=1:r&&p<=30?m=2:c&&p<=30?m=3:r?m=4:c&&(m=5)),{p:n,category:m,dist:s,daysDiff:p,headingMatch:c,sameDay:h,is360:r}});if(!r.length)return null;r.sort((e,t)=>e.category!==t.category?e.category-t.category:e.dist!==t.dist?e.dist-t.dist:e.daysDiff!==t.daysDiff?e.daysDiff-t.daysDiff:0);const s=r[0];return s.category<1/0?s.p:null}}function vl(e){return void 0!==e?.properties?.["pers:roll"]||void 0!==e?.properties?.["pers:pitch"]}function El(e,t,i){const[n,a]=e,r=vo(a),s=vo(n),o=vo(i),l=t/6378137,c=Math.sin(r),d=Math.cos(r),u=Math.sin(l),h=Math.cos(l),p=Math.sin(o),A=c*h+d*u*Math.cos(o),m=Math.asin(A),g=p*u*d,f=h-c*A;return[_o(s+Math.atan2(g,f)),_o(m)]}const yl="185",bl=1,kl=3,xl=0,wl=1,Ml=2,Sl=100,Cl=101,Tl=102,Dl=200,Pl=201,Il=202,Ll=203,Rl=204,zl=205,Fl=206,Ul=207,Nl=208,Bl=209,Ol=210,jl=211,Gl=212,Vl=213,Hl=214,ql=0,Wl=1,Kl=2,Xl=3,Ql=4,Zl=5,Yl=6,Jl=7,$l=0,ec=1,tc=2,ic=1,nc=2,ac=3,rc=4,sc=5,oc=6,lc=7,cc=301,dc=302,uc=303,hc=304,pc=306,Ac=1e3,mc=1001,gc=1002,fc=1003,_c=1004,vc=1005,Ec=1006,yc=1007,bc=1008,kc=1009,xc=1010,wc=1011,Mc=1012,Sc=1013,Cc=1014,Tc=1015,Dc=1016,Pc=1017,Ic=1018,Lc=1020,Rc=35902,zc=35899,Fc=1023,Uc=1026,Nc=1027,Bc=1029,Oc=1030,jc=1031,Gc=1033,Vc=33776,Hc=33777,qc=33778,Wc=33779,Kc=35840,Xc=35841,Qc=35842,Zc=35843,Yc=36196,Jc=37492,$c=37496,ed=37488,td=37489,id=37490,nd=37491,ad=37808,rd=37809,sd=37810,od=37811,ld=37812,cd=37813,dd=37814,ud=37815,hd=37816,pd=37817,Ad=37818,md=37819,gd=37820,fd=37821,_d=36492,vd=36494,Ed=36495,yd=36283,bd=36284,kd=36285,xd=36286,wd="",Md="srgb",Sd="srgb-linear",Cd="linear",Td="srgb",Dd=7680,Pd=512,Id=513,Ld=514,Rd=515,zd=516,Fd=517,Ud=518,Nd=519,Bd="300 es",Od=2e3,jd=2001;function Gd(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Vd(){const e=Gd("canvas");return e.style.display="block",e}const Hd={};function qd(...e){const t="THREE."+e.shift();console.log(t,...e)}function Wd(e){const t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){const t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Kd(...e){const t="THREE."+(e=Wd(e)).shift();{const i=e[0];i&&i.isStackTrace?console.warn(i.getError(t)):console.warn(t,...e)}}function Xd(...e){const t="THREE."+(e=Wd(e)).shift();{const i=e[0];i&&i.isStackTrace?console.error(i.getError(t)):console.error(t,...e)}}function Qd(...e){const t=e.join(" ");t in Hd||(Hd[t]=!0,Kd(...e))}const Zd={[ql]:1,[Kl]:6,[Ql]:7,[Xl]:5,[Wl]:0,[Yl]:2,[Jl]:4,[Zl]:3};class Yd{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return void 0!==i&&(void 0!==i[e]&&-1!==i[e].indexOf(t))}removeEventListener(e,t){const i=this._listeners;if(void 0===i)return;const n=i[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){const t=this._listeners;if(void 0===t)return;const i=t[e.type];if(void 0!==i){e.target=this;const t=i.slice(0);for(let i=0,n=t.length;i<n;i++)t[i].call(this,e);e.target=null}}}const Jd=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let $d=1234567;const eu=Math.PI/180,tu=180/Math.PI;function iu(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Jd[255&e]+Jd[e>>8&255]+Jd[e>>16&255]+Jd[e>>24&255]+"-"+Jd[255&t]+Jd[t>>8&255]+"-"+Jd[t>>16&15|64]+Jd[t>>24&255]+"-"+Jd[63&i|128]+Jd[i>>8&255]+"-"+Jd[i>>16&255]+Jd[i>>24&255]+Jd[255&n]+Jd[n>>8&255]+Jd[n>>16&255]+Jd[n>>24&255]).toLowerCase()}function nu(e,t,i){return Math.max(t,Math.min(i,e))}function au(e,t){return(e%t+t)%t}function ru(e,t,i){return(1-i)*e+i*t}function su(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ou(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const lu={DEG2RAD:eu,RAD2DEG:tu,generateUUID:iu,clamp:nu,euclideanModulo:au,mapLinear:function(e,t,i,n,a){return n+(e-t)*(a-n)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:ru,damp:function(e,t,i,n){return ru(e,t,1-Math.exp(-i*n))},pingpong:function(e,t=1){return t-Math.abs(au(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&($d=e);let t=$d+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*eu},radToDeg:function(e){return e*tu},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,i,n,a){const r=Math.cos,s=Math.sin,o=r(i/2),l=s(i/2),c=r((t+n)/2),d=s((t+n)/2),u=r((t-n)/2),h=s((t-n)/2),p=r((n-t)/2),A=s((n-t)/2);switch(a){case"XYX":e.set(o*d,l*u,l*h,o*c);break;case"YZY":e.set(l*h,o*d,l*u,o*c);break;case"ZXZ":e.set(l*u,l*h,o*d,o*c);break;case"XZX":e.set(o*d,l*A,l*p,o*c);break;case"YXY":e.set(l*p,o*d,l*A,o*c);break;case"ZYZ":e.set(l*A,l*p,o*d,o*c);break;default:Kd("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+a)}},normalize:ou,denormalize:su};class cu{static{cu.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(nu(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,r=this.y-e.y;return this.x=a*i-r*n+e.x,this.y=a*n+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class du{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,r,s){let o=i[n+0],l=i[n+1],c=i[n+2],d=i[n+3],u=a[r+0],h=a[r+1],p=a[r+2],A=a[r+3];if(d!==A||o!==u||l!==h||c!==p){let e=o*u+l*h+c*p+d*A;e<0&&(u=-u,h=-h,p=-p,A=-A,e=-e);let t=1-s;if(e<.9995){const i=Math.acos(e),n=Math.sin(i);t=Math.sin(t*i)/n,o=o*t+u*(s=Math.sin(s*i)/n),l=l*t+h*s,c=c*t+p*s,d=d*t+A*s}else{o=o*t+u*s,l=l*t+h*s,c=c*t+p*s,d=d*t+A*s;const e=1/Math.sqrt(o*o+l*l+c*c+d*d);o*=e,l*=e,c*=e,d*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,n,a,r){const s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],d=a[r],u=a[r+1],h=a[r+2],p=a[r+3];return e[t]=s*p+c*d+o*h-l*u,e[t+1]=o*p+c*u+l*d-s*h,e[t+2]=l*p+c*h+s*u-o*d,e[t+3]=c*p-s*d-o*u-l*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,n=e._y,a=e._z,r=e._order,s=Math.cos,o=Math.sin,l=s(i/2),c=s(n/2),d=s(a/2),u=o(i/2),h=o(n/2),p=o(a/2);switch(r){case"XYZ":this._x=u*c*d+l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d-u*h*p;break;case"YXZ":this._x=u*c*d+l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d+u*h*p;break;case"ZXY":this._x=u*c*d-l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d-u*h*p;break;case"ZYX":this._x=u*c*d-l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d+u*h*p;break;case"YZX":this._x=u*c*d+l*h*p,this._y=l*h*d+u*c*p,this._z=l*c*p-u*h*d,this._w=l*c*d-u*h*p;break;case"XZY":this._x=u*c*d-l*h*p,this._y=l*h*d-u*c*p,this._z=l*c*p+u*h*d,this._w=l*c*d+u*h*p;break;default:Kd("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],n=t[4],a=t[8],r=t[1],s=t[5],o=t[9],l=t[2],c=t[6],d=t[10],u=i+s+d;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-o)*e,this._y=(a-l)*e,this._z=(r-n)*e}else if(i>s&&i>d){const e=2*Math.sqrt(1+i-s-d);this._w=(c-o)/e,this._x=.25*e,this._y=(n+r)/e,this._z=(a+l)/e}else if(s>d){const e=2*Math.sqrt(1+s-i-d);this._w=(a-l)/e,this._x=(n+r)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+d-i-s);this._w=(r-n)/e,this._x=(a+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nu(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(0===i)return this;const n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,n=e._y,a=e._z,r=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=i*c+r*s+n*l-a*o,this._y=n*c+r*o+a*s-i*l,this._z=a*c+r*l+i*o-n*s,this._w=r*c-i*s-n*o-a*l,this._onChangeCallback(),this}slerp(e,t){let i=e._x,n=e._y,a=e._z,r=e._w,s=this.dot(e);s<0&&(i=-i,n=-n,a=-a,r=-r,s=-s);let o=1-t;if(s<.9995){const e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+a*t,this._w=this._w*o+r*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+a*t,this._w=this._w*o+r*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class uu{static{uu.prototype.isVector3=!0}constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(pu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,a=e.elements,r=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*r,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*r,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*r,this}applyQuaternion(e){const t=this.x,i=this.y,n=this.z,a=e.x,r=e.y,s=e.z,o=e.w,l=2*(r*n-s*i),c=2*(s*t-a*n),d=2*(a*i-r*t);return this.x=t+o*l+r*d-s*c,this.y=i+o*c+s*l-a*d,this.z=n+o*d+a*c-r*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this.z=nu(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this.z=nu(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,n=e.y,a=e.z,r=t.x,s=t.y,o=t.z;return this.x=n*o-a*s,this.y=a*r-i*o,this.z=i*s-n*r,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return hu.copy(this).projectOnVector(e),this.sub(hu)}reflect(e){return this.sub(hu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(nu(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const hu=new uu,pu=new du;class Au{static{Au.prototype.isMatrix3=!0}constructor(e,t,i,n,a,r,s,o,l){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,a,r,s,o,l)}set(e,t,i,n,a,r,s,o,l){const c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=o,c[6]=i,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,a=this.elements,r=i[0],s=i[3],o=i[6],l=i[1],c=i[4],d=i[7],u=i[2],h=i[5],p=i[8],A=n[0],m=n[3],g=n[6],f=n[1],_=n[4],v=n[7],E=n[2],y=n[5],b=n[8];return a[0]=r*A+s*f+o*E,a[3]=r*m+s*_+o*y,a[6]=r*g+s*v+o*b,a[1]=l*A+c*f+d*E,a[4]=l*m+c*_+d*y,a[7]=l*g+c*v+d*b,a[2]=u*A+h*f+p*E,a[5]=u*m+h*_+p*y,a[8]=u*g+h*v+p*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*r*c-t*s*l-i*a*c+i*s*o+n*a*l-n*r*o}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8],d=c*r-s*l,u=s*o-c*a,h=l*a-r*o,p=t*d+i*u+n*h;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return e[0]=d*A,e[1]=(n*l-c*i)*A,e[2]=(s*i-n*r)*A,e[3]=u*A,e[4]=(c*t-n*o)*A,e[5]=(n*a-s*t)*A,e[6]=h*A,e[7]=(i*o-l*t)*A,e[8]=(r*t-i*a)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,r,s){const o=Math.cos(a),l=Math.sin(a);return this.set(i*o,i*l,-i*(o*r+l*s)+r+e,-n*l,n*o,-n*(-l*r+o*s)+s+t,0,0,1),this}scale(e,t){return Qd("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(mu.makeScale(e,t)),this}rotate(e){return Qd("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(mu.makeRotation(-e)),this}translate(e,t){return Qd("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(mu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const mu=new Au,gu=(new Au).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fu=(new Au).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function _u(){const e={enabled:!0,workingColorSpace:Sd,spaces:{},convert:function(e,t,i){return!1!==this.enabled&&t!==i&&t&&i?(this.spaces[t].transfer===Td&&(e.r=Eu(e.r),e.g=Eu(e.g),e.b=Eu(e.b)),this.spaces[t].primaries!==this.spaces[i].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===Td&&(e.r=yu(e.r),e.g=yu(e.g),e.b=yu(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===wd?Cd:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,i){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,i){return Qd("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,i)},toWorkingColorSpace:function(t,i){return Qd("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,i)}},t=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return e.define({[Sd]:{primaries:t,whitePoint:n,transfer:Cd,toXYZ:gu,fromXYZ:fu,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Md},outputColorSpaceConfig:{drawingBufferColorSpace:Md}},[Md]:{primaries:t,whitePoint:n,transfer:Td,toXYZ:gu,fromXYZ:fu,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Md}}}),e}const vu=_u();function Eu(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function yu(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let bu;class ku{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{void 0===bu&&(bu=Gd("canvas")),bu.width=e.width,bu.height=e.height;const t=bu.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),i=bu}return i.toDataURL(t)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Gd("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let e=0;e<a.length;e++)a[e]=255*Eu(a[e]/255);return i.putImageData(n,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*Eu(t[e]/255)):t[e]=Eu(t[e]);return{data:t,width:e.width,height:e.height}}return Kd("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let xu=0;class wu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:xu++}),this.uuid=iu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(Mu(n[t].image)):e.push(Mu(n[t]))}else e=Mu(n);i.url=e}return t||(e.images[this.uuid]=i),i}}function Mu(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ku.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(Kd("Texture: Unable to serialize Texture."),{})}let Su=0;const Cu=new uu;class Tu extends Yd{constructor(e=Tu.DEFAULT_IMAGE,t=Tu.DEFAULT_MAPPING,i=1001,n=1001,a=1006,r=1008,s=1023,o=kc,l=Tu.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Su++}),this.uuid=iu(),this.name="",this.source=new wu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=a,this.minFilter=r,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new cu(0,0),this.repeat=new cu(1,1),this.center=new cu(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Au,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Cu).x}get height(){return this.source.getSize(Cu).y}get depth(){return this.source.getSize(Cu).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(void 0===i){Kd(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const n=this[t];void 0!==n?n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[t]=i:Kd(`Texture.setValues(): property '${t}' does not exist.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ac:e.x=e.x-Math.floor(e.x);break;case mc:e.x=e.x<0?0:1;break;case gc:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Ac:e.y=e.y-Math.floor(e.y);break;case mc:e.y=e.y<0?0:1;break;case gc:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Tu.DEFAULT_IMAGE=null,Tu.DEFAULT_MAPPING=300,Tu.DEFAULT_ANISOTROPY=1;class Du{static{Du.prototype.isVector4=!0}constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,a=this.w,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12]*a,this.y=r[1]*t+r[5]*i+r[9]*n+r[13]*a,this.z=r[2]*t+r[6]*i+r[10]*n+r[14]*a,this.w=r[3]*t+r[7]*i+r[11]*n+r[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a;const r=.01,s=.1,o=e.elements,l=o[0],c=o[4],d=o[8],u=o[1],h=o[5],p=o[9],A=o[2],m=o[6],g=o[10];if(Math.abs(c-u)<r&&Math.abs(d-A)<r&&Math.abs(p-m)<r){if(Math.abs(c+u)<s&&Math.abs(d+A)<s&&Math.abs(p+m)<s&&Math.abs(l+h+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,o=(h+1)/2,f=(g+1)/2,_=(c+u)/4,v=(d+A)/4,E=(p+m)/4;return e>o&&e>f?e<r?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(e),n=_/i,a=v/i):o>f?o<r?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(o),i=_/n,a=E/n):f<r?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(f),i=v/a,n=E/a),this.set(i,n,a,t),this}let f=Math.sqrt((m-p)*(m-p)+(d-A)*(d-A)+(u-c)*(u-c));return Math.abs(f)<.001&&(f=1),this.x=(m-p)/f,this.y=(d-A)/f,this.z=(u-c)/f,this.w=Math.acos((l+h+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=nu(this.x,e.x,t.x),this.y=nu(this.y,e.y,t.y),this.z=nu(this.z,e.z,t.z),this.w=nu(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=nu(this.x,e,t),this.y=nu(this.y,e,t),this.z=nu(this.z,e,t),this.w=nu(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(nu(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Pu extends Yd{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ec,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Du(0,0,e,t),this.scissorTest=!1,this.viewport=new Du(0,0,e,t),this.textures=[];const n={width:e,height:t,depth:i.depth},a=new Tu(n),r=i.count;for(let e=0;e<r;e++)this.textures[e]=a.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Ec,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++){this.textures[e].setValues(t)}}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i,!0!==this.textures[n].isData3DTexture&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new wu(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Iu extends Pu{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Lu extends Tu{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=fc,this.minFilter=fc,this.wrapR=mc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ru extends Tu{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=fc,this.minFilter=fc,this.wrapR=mc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class zu{static{zu.prototype.isMatrix4=!0}constructor(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m)}set(e,t,i,n,a,r,s,o,l,c,d,u,h,p,A,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=a,g[5]=r,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=d,g[14]=u,g[3]=h,g[7]=p,g[11]=A,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new zu).fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return 0===this.determinantAffine()?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinantAffine())return this.identity();const t=this.elements,i=e.elements,n=1/Fu.setFromMatrixColumn(e,0).length(),a=1/Fu.setFromMatrixColumn(e,1).length(),r=1/Fu.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*r,t[9]=i[9]*r,t[10]=i[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,n=e.y,a=e.z,r=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(a),d=Math.sin(a);if("XYZ"===e.order){const e=r*c,i=r*d,n=s*c,a=s*d;t[0]=o*c,t[4]=-o*d,t[8]=l,t[1]=i+n*l,t[5]=e-a*l,t[9]=-s*o,t[2]=a-e*l,t[6]=n+i*l,t[10]=r*o}else if("YXZ"===e.order){const e=o*c,i=o*d,n=l*c,a=l*d;t[0]=e+a*s,t[4]=n*s-i,t[8]=r*l,t[1]=r*d,t[5]=r*c,t[9]=-s,t[2]=i*s-n,t[6]=a+e*s,t[10]=r*o}else if("ZXY"===e.order){const e=o*c,i=o*d,n=l*c,a=l*d;t[0]=e-a*s,t[4]=-r*d,t[8]=n+i*s,t[1]=i+n*s,t[5]=r*c,t[9]=a-e*s,t[2]=-r*l,t[6]=s,t[10]=r*o}else if("ZYX"===e.order){const e=r*c,i=r*d,n=s*c,a=s*d;t[0]=o*c,t[4]=n*l-i,t[8]=e*l+a,t[1]=o*d,t[5]=a*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=r*o}else if("YZX"===e.order){const e=r*o,i=r*l,n=s*o,a=s*l;t[0]=o*c,t[4]=a-e*d,t[8]=n*d+i,t[1]=d,t[5]=r*c,t[9]=-s*c,t[2]=-l*c,t[6]=i*d+n,t[10]=e-a*d}else if("XZY"===e.order){const e=r*o,i=r*l,n=s*o,a=s*l;t[0]=o*c,t[4]=-d,t[8]=l*c,t[1]=e*d+a,t[5]=r*c,t[9]=i*d-n,t[2]=n*d-i,t[6]=s*c,t[10]=a*d+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Nu,e,Bu)}lookAt(e,t,i){const n=this.elements;return Gu.subVectors(e,t),0===Gu.lengthSq()&&(Gu.z=1),Gu.normalize(),Ou.crossVectors(i,Gu),0===Ou.lengthSq()&&(1===Math.abs(i.z)?Gu.x+=1e-4:Gu.z+=1e-4,Gu.normalize(),Ou.crossVectors(i,Gu)),Ou.normalize(),ju.crossVectors(Gu,Ou),n[0]=Ou.x,n[4]=ju.x,n[8]=Gu.x,n[1]=Ou.y,n[5]=ju.y,n[9]=Gu.y,n[2]=Ou.z,n[6]=ju.z,n[10]=Gu.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,a=this.elements,r=i[0],s=i[4],o=i[8],l=i[12],c=i[1],d=i[5],u=i[9],h=i[13],p=i[2],A=i[6],m=i[10],g=i[14],f=i[3],_=i[7],v=i[11],E=i[15],y=n[0],b=n[4],k=n[8],x=n[12],w=n[1],M=n[5],S=n[9],C=n[13],T=n[2],D=n[6],P=n[10],I=n[14],L=n[3],R=n[7],z=n[11],F=n[15];return a[0]=r*y+s*w+o*T+l*L,a[4]=r*b+s*M+o*D+l*R,a[8]=r*k+s*S+o*P+l*z,a[12]=r*x+s*C+o*I+l*F,a[1]=c*y+d*w+u*T+h*L,a[5]=c*b+d*M+u*D+h*R,a[9]=c*k+d*S+u*P+h*z,a[13]=c*x+d*C+u*I+h*F,a[2]=p*y+A*w+m*T+g*L,a[6]=p*b+A*M+m*D+g*R,a[10]=p*k+A*S+m*P+g*z,a[14]=p*x+A*C+m*I+g*F,a[3]=f*y+_*w+v*T+E*L,a[7]=f*b+_*M+v*D+E*R,a[11]=f*k+_*S+v*P+E*z,a[15]=f*x+_*C+v*I+E*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],r=e[1],s=e[5],o=e[9],l=e[13],c=e[2],d=e[6],u=e[10],h=e[14],p=e[3],A=e[7],m=e[11],g=e[15],f=o*h-l*u,_=s*h-l*d,v=s*u-o*d,E=r*h-l*c,y=r*u-o*c,b=r*d-s*c;return t*(A*f-m*_+g*v)-i*(p*f-m*E+g*y)+n*(p*_-A*E+g*b)-a*(p*v-A*y+m*b)}determinantAffine(){const e=this.elements,t=e[0],i=e[4],n=e[8],a=e[1],r=e[5],s=e[9],o=e[2],l=e[6],c=e[10];return t*(r*c-s*l)-i*(a*c-s*o)+n*(a*l-r*o)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],r=e[4],s=e[5],o=e[6],l=e[7],c=e[8],d=e[9],u=e[10],h=e[11],p=e[12],A=e[13],m=e[14],g=e[15],f=t*s-i*r,_=t*o-n*r,v=t*l-a*r,E=i*o-n*s,y=i*l-a*s,b=n*l-a*o,k=c*A-d*p,x=c*m-u*p,w=c*g-h*p,M=d*m-u*A,S=d*g-h*A,C=u*g-h*m,T=f*C-_*S+v*M+E*w-y*x+b*k;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/T;return e[0]=(s*C-o*S+l*M)*D,e[1]=(n*S-i*C-a*M)*D,e[2]=(A*b-m*y+g*E)*D,e[3]=(u*y-d*b-h*E)*D,e[4]=(o*w-r*C-l*x)*D,e[5]=(t*C-n*w+a*x)*D,e[6]=(m*v-p*b-g*_)*D,e[7]=(c*b-u*v+h*_)*D,e[8]=(r*S-s*w+l*k)*D,e[9]=(i*w-t*S-a*k)*D,e[10]=(p*y-A*v+g*f)*D,e[11]=(d*v-c*y-h*f)*D,e[12]=(s*x-r*M-o*k)*D,e[13]=(t*M-i*x+n*k)*D,e[14]=(A*_-p*E-m*f)*D,e[15]=(c*E-d*_+u*f)*D,this}scale(e){const t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),n=Math.sin(t),a=1-i,r=e.x,s=e.y,o=e.z,l=a*r,c=a*s;return this.set(l*r+i,l*s-n*o,l*o+n*s,0,l*s+n*o,c*s+i,c*o-n*r,0,l*o-n*s,c*o+n*r,a*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,r){return this.set(1,i,a,0,e,1,r,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){const n=this.elements,a=t._x,r=t._y,s=t._z,o=t._w,l=a+a,c=r+r,d=s+s,u=a*l,h=a*c,p=a*d,A=r*c,m=r*d,g=s*d,f=o*l,_=o*c,v=o*d,E=i.x,y=i.y,b=i.z;return n[0]=(1-(A+g))*E,n[1]=(h+v)*E,n[2]=(p-_)*E,n[3]=0,n[4]=(h-v)*y,n[5]=(1-(u+g))*y,n[6]=(m+f)*y,n[7]=0,n[8]=(p+_)*b,n[9]=(m-f)*b,n[10]=(1-(u+A))*b,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){const n=this.elements;e.x=n[12],e.y=n[13],e.z=n[14];const a=this.determinantAffine();if(0===a)return i.set(1,1,1),t.identity(),this;let r=Fu.set(n[0],n[1],n[2]).length();const s=Fu.set(n[4],n[5],n[6]).length(),o=Fu.set(n[8],n[9],n[10]).length();a<0&&(r=-r),Uu.copy(this);const l=1/r,c=1/s,d=1/o;return Uu.elements[0]*=l,Uu.elements[1]*=l,Uu.elements[2]*=l,Uu.elements[4]*=c,Uu.elements[5]*=c,Uu.elements[6]*=c,Uu.elements[8]*=d,Uu.elements[9]*=d,Uu.elements[10]*=d,t.setFromRotationMatrix(Uu),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,n,a,r,s=2e3,o=!1){const l=this.elements,c=2*a/(t-e),d=2*a/(i-n),u=(t+e)/(t-e),h=(i+n)/(i-n);let p,A;if(o)p=a/(r-a),A=r*a/(r-a);else if(s===Od)p=-(r+a)/(r-a),A=-2*r*a/(r-a);else{if(s!==jd)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);p=-r/(r-a),A=-r*a/(r-a)}return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,r,s=2e3,o=!1){const l=this.elements,c=2/(t-e),d=2/(i-n),u=-(t+e)/(t-e),h=-(i+n)/(i-n);let p,A;if(o)p=1/(r-a),A=r/(r-a);else if(s===Od)p=-2/(r-a),A=-(r+a)/(r-a);else{if(s!==jd)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=-1/(r-a),A=-a/(r-a)}return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=d,l[9]=0,l[13]=h,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Fu=new uu,Uu=new zu,Nu=new uu(0,0,0),Bu=new uu(1,1,1),Ou=new uu,ju=new uu,Gu=new uu,Vu=new zu,Hu=new du;class qu{constructor(e=0,t=0,i=0,n=qu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const n=e.elements,a=n[0],r=n[4],s=n[8],o=n[1],l=n[5],c=n[9],d=n[2],u=n[6],h=n[10];switch(t){case"XYZ":this._y=Math.asin(nu(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-r,a)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-nu(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,h),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case"ZXY":this._x=Math.asin(nu(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,h),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(o,a));break;case"ZYX":this._y=Math.asin(-nu(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,h),this._z=Math.atan2(o,a)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(nu(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,h));break;case"XZY":this._z=Math.asin(-nu(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,h),this._y=0);break;default:Kd("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Vu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Vu,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Hu.setFromEuler(this),this.setFromQuaternion(Hu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qu.DEFAULT_ORDER="XYZ";class Wu{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Ku=0;const Xu=new uu,Qu=new du,Zu=new zu,Yu=new uu,Ju=new uu,$u=new uu,eh=new du,th=new uu(1,0,0),ih=new uu(0,1,0),nh=new uu(0,0,1),ah={type:"added"},rh={type:"removed"},sh={type:"childadded",child:null},oh={type:"childremoved",child:null};class lh extends Yd{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ku++}),this.uuid=iu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lh.DEFAULT_UP.clone();const e=new uu,t=new qu,i=new du,n=new uu(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new zu},normalMatrix:{value:new Au}}),this.matrix=new zu,this.matrixWorld=new zu,this.matrixAutoUpdate=lh.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=lh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Wu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qu.setFromAxisAngle(e,t),this.quaternion.multiply(Qu),this}rotateOnWorldAxis(e,t){return Qu.setFromAxisAngle(e,t),this.quaternion.premultiply(Qu),this}rotateX(e){return this.rotateOnAxis(th,e)}rotateY(e){return this.rotateOnAxis(ih,e)}rotateZ(e){return this.rotateOnAxis(nh,e)}translateOnAxis(e,t){return Xu.copy(e).applyQuaternion(this.quaternion),this.position.add(Xu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(th,e)}translateY(e){return this.translateOnAxis(ih,e)}translateZ(e){return this.translateOnAxis(nh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zu.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Yu.copy(e):Yu.set(e,t,i);const n=this.parent;this.updateWorldMatrix(!0,!1),Ju.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zu.lookAt(Ju,Yu,this.up):Zu.lookAt(Yu,Ju,this.up),this.quaternion.setFromRotationMatrix(Zu),n&&(Zu.extractRotation(n.matrixWorld),Qu.setFromRotationMatrix(Zu),this.quaternion.premultiply(Qu.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(Xd("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ah),sh.child=e,this.dispatchEvent(sh),sh.child=null):Xd("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rh),oh.child=e,this.dispatchEvent(oh),oh.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Zu.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Zu.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zu),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ah),sh.child=e,this.dispatchEvent(sh),sh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const n=this.children;for(let a=0,r=n.length;a<r;a++)n[a].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ju,e,$u),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ju,eh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(null!==e){const t=e.x,i=e.y,n=e.z,a=this.matrix.elements;a[12]+=t-a[0]*t-a[4]*i-a[8]*n,a[13]+=i-a[1]*t-a[5]*i-a[9]*n,a[14]+=n-a[2]*t-a[6]*i-a[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,n=t.length;i<n;i++){t[i].updateMatrixWorld(e)}}updateWorldMatrix(e,t,i=!1){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){e[t].updateWorldMatrix(!1,!0,i)}}}toJSON(e){const t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const n={};function a(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),!1!==this.static&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),null!==this.pivot&&(n.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(e=>({...e})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(e),n.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(n.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=a(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const n=i[t];a(e.shapes,n)}else a(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(a(e.materials,this.material[i]));n.material=t}else n.material=a(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){const i=this.animations[t];n.animations.push(a(e.animations,i))}}if(t){const t=r(e.geometries),n=r(e.materials),a=r(e.textures),s=r(e.images),o=r(e.shapes),l=r(e.skeletons),c=r(e.animations),d=r(e.nodes);t.length>0&&(i.geometries=t),n.length>0&&(i.materials=n),a.length>0&&(i.textures=a),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),d.length>0&&(i.nodes=d)}return i.object=n,i;function r(e){const t=[];for(const i in e){const n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=null!==e.pivot?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const i=e.children[t];this.add(i.clone())}return this}}lh.DEFAULT_UP=new uu(0,1,0),lh.DEFAULT_MATRIX_AUTO_UPDATE=!0,lh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class ch extends lh{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dh={type:"move"};class uh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ch,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ch,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new uu,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new uu),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ch,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new uu,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new uu,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,r=null;const s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){r=!0;for(const n of e.hand.values()){const e=t.getJointPose(n,i),a=this._getHandJoint(l,n);null!==e&&(a.matrix.fromArray(e.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,a.jointRadius=e.radius),a.visible=null!==e}const n=l.joints["index-finger-tip"],a=l.joints["thumb-tip"],s=n.position.distanceTo(a.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),null!==a&&(o.matrix.fromArray(a.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,a.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(a.linearVelocity)):o.hasLinearVelocity=!1,a.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(a.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:e,target:this})));null!==s&&(n=t.getPose(e.targetRaySpace,i),null===n&&null!==a&&(n=a),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(dh)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==a),null!==l&&(l.visible=null!==r),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const i=new ch;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ph={h:0,s:0,l:0},Ah={h:0,s:0,l:0};function mh(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}class gh{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(void 0===t&&void 0===i){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Md){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,vu.colorSpaceToWorking(this,t),this}setRGB(e,t,i,n=vu.workingColorSpace){return this.r=e,this.g=t,this.b=i,vu.colorSpaceToWorking(this,n),this}setHSL(e,t,i,n=vu.workingColorSpace){if(e=au(e,1),t=nu(t,0,1),i=nu(i,0,1),0===t)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+t):i+t-i*t,a=2*i-n;this.r=mh(a,n,e+1/3),this.g=mh(a,n,e),this.b=mh(a,n,e-1/3)}return vu.colorSpaceToWorking(this,n),this}setStyle(e,t=Md){function i(t){void 0!==t&&parseFloat(t)<1&&Kd("Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const r=n[1],s=n[2];switch(r){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:Kd("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],a=i.length;if(3===a)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===a)return this.setHex(parseInt(i,16),t);Kd("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Md){const i=hh[e.toLowerCase()];return void 0!==i?this.setHex(i,t):Kd("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eu(e.r),this.g=Eu(e.g),this.b=Eu(e.b),this}copyLinearToSRGB(e){return this.r=yu(e.r),this.g=yu(e.g),this.b=yu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Md){return vu.workingToColorSpace(fh.copy(this),e),65536*Math.round(nu(255*fh.r,0,255))+256*Math.round(nu(255*fh.g,0,255))+Math.round(nu(255*fh.b,0,255))}getHexString(e=Md){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vu.workingColorSpace){vu.workingToColorSpace(fh.copy(this),t);const i=fh.r,n=fh.g,a=fh.b,r=Math.max(i,n,a),s=Math.min(i,n,a);let o,l;const c=(s+r)/2;if(s===r)o=0,l=0;else{const e=r-s;switch(l=c<=.5?e/(r+s):e/(2-r-s),r){case i:o=(n-a)/e+(n<a?6:0);break;case n:o=(a-i)/e+2;break;case a:o=(i-n)/e+4}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=vu.workingColorSpace){return vu.workingToColorSpace(fh.copy(this),t),e.r=fh.r,e.g=fh.g,e.b=fh.b,e}getStyle(e=Md){vu.workingToColorSpace(fh.copy(this),e);const t=fh.r,i=fh.g,n=fh.b;return e!==Md?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(e,t,i){return this.getHSL(ph),this.setHSL(ph.h+e,ph.s+t,ph.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ph),e.getHSL(Ah);const i=ru(ph.h,Ah.h,t),n=ru(ph.s,Ah.s,t),a=ru(ph.l,Ah.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const fh=new gh;gh.NAMES=hh;class _h extends lh{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new qu,this.environmentIntensity=1,this.environmentRotation=new qu,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const vh=new uu,Eh=new uu,yh=new uu,bh=new uu,kh=new uu,xh=new uu,wh=new uu,Mh=new uu,Sh=new uu,Ch=new uu,Th=new Du,Dh=new Du,Ph=new Du;class Ih{constructor(e=new uu,t=new uu,i=new uu){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),vh.subVectors(e,t),n.cross(vh);const a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){vh.subVectors(n,t),Eh.subVectors(i,t),yh.subVectors(e,t);const r=vh.dot(vh),s=vh.dot(Eh),o=vh.dot(yh),l=Eh.dot(Eh),c=Eh.dot(yh),d=r*l-s*s;if(0===d)return a.set(0,0,0),null;const u=1/d,h=(l*o-s*c)*u,p=(r*c-s*o)*u;return a.set(1-h-p,p,h)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,bh)&&(bh.x>=0&&bh.y>=0&&bh.x+bh.y<=1)}static getInterpolation(e,t,i,n,a,r,s,o){return null===this.getBarycoord(e,t,i,n,bh)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(a,bh.x),o.addScaledVector(r,bh.y),o.addScaledVector(s,bh.z),o)}static getInterpolatedAttribute(e,t,i,n,a,r){return Th.setScalar(0),Dh.setScalar(0),Ph.setScalar(0),Th.fromBufferAttribute(e,t),Dh.fromBufferAttribute(e,i),Ph.fromBufferAttribute(e,n),r.setScalar(0),r.addScaledVector(Th,a.x),r.addScaledVector(Dh,a.y),r.addScaledVector(Ph,a.z),r}static isFrontFacing(e,t,i,n){return vh.subVectors(i,t),Eh.subVectors(e,t),vh.cross(Eh).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vh.subVectors(this.c,this.b),Eh.subVectors(this.a,this.b),.5*vh.cross(Eh).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ih.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ih.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return Ih.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return Ih.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ih.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,n=this.b,a=this.c;let r,s;kh.subVectors(n,i),xh.subVectors(a,i),Mh.subVectors(e,i);const o=kh.dot(Mh),l=xh.dot(Mh);if(o<=0&&l<=0)return t.copy(i);Sh.subVectors(e,n);const c=kh.dot(Sh),d=xh.dot(Sh);if(c>=0&&d<=c)return t.copy(n);const u=o*d-c*l;if(u<=0&&o>=0&&c<=0)return r=o/(o-c),t.copy(i).addScaledVector(kh,r);Ch.subVectors(e,a);const h=kh.dot(Ch),p=xh.dot(Ch);if(p>=0&&h<=p)return t.copy(a);const A=h*l-o*p;if(A<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(i).addScaledVector(xh,s);const m=c*p-h*d;if(m<=0&&d-c>=0&&h-p>=0)return wh.subVectors(a,n),s=(d-c)/(d-c+(h-p)),t.copy(n).addScaledVector(wh,s);const g=1/(m+A+u);return r=A*g,s=u*g,t.copy(i).addScaledVector(kh,r).addScaledVector(xh,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Lh{constructor(e=new uu(1/0,1/0,1/0),t=new uu(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(zh.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(zh.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=zh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,zh):zh.fromBufferAttribute(n,t),zh.applyMatrix4(e.matrixWorld),this.expandByPoint(zh);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Fh.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Fh.copy(i.boundingBox)),Fh.applyMatrix4(e.matrixWorld),this.union(Fh)}const n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,zh),zh.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vh),Hh.subVectors(this.max,Vh),Uh.subVectors(e.a,Vh),Nh.subVectors(e.b,Vh),Bh.subVectors(e.c,Vh),Oh.subVectors(Nh,Uh),jh.subVectors(Bh,Nh),Gh.subVectors(Uh,Bh);let t=[0,-Oh.z,Oh.y,0,-jh.z,jh.y,0,-Gh.z,Gh.y,Oh.z,0,-Oh.x,jh.z,0,-jh.x,Gh.z,0,-Gh.x,-Oh.y,Oh.x,0,-jh.y,jh.x,0,-Gh.y,Gh.x,0];return!!Kh(t,Uh,Nh,Bh,Hh)&&(t=[1,0,0,0,1,0,0,0,1],!!Kh(t,Uh,Nh,Bh,Hh)&&(qh.crossVectors(Oh,jh),t=[qh.x,qh.y,qh.z],Kh(t,Uh,Nh,Bh,Hh)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zh).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(zh).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Rh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rh)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Rh=[new uu,new uu,new uu,new uu,new uu,new uu,new uu,new uu],zh=new uu,Fh=new Lh,Uh=new uu,Nh=new uu,Bh=new uu,Oh=new uu,jh=new uu,Gh=new uu,Vh=new uu,Hh=new uu,qh=new uu,Wh=new uu;function Kh(e,t,i,n,a){for(let r=0,s=e.length-3;r<=s;r+=3){Wh.fromArray(e,r);const s=a.x*Math.abs(Wh.x)+a.y*Math.abs(Wh.y)+a.z*Math.abs(Wh.z),o=t.dot(Wh),l=i.dot(Wh),c=n.dot(Wh);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Xh=new uu,Qh=new cu;let Zh=0;class Yh extends Yd{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Zh++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=Tc,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)Qh.fromBufferAttribute(this,t),Qh.applyMatrix3(e),this.setXY(t,Qh.x,Qh.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyMatrix3(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyMatrix4(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.applyNormalMatrix(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Xh.fromBufferAttribute(this,t),Xh.transformDirection(e),this.setXYZ(t,Xh.x,Xh.y,Xh.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=su(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ou(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=su(t,this.array)),t}setX(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=su(t,this.array)),t}setY(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=su(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=su(t,this.array)),t}setW(e,t){return this.normalized&&(t=ou(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array),n=ou(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=ou(t,this.array),i=ou(i,this.array),n=ou(n,this.array),a=ou(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Jh extends Yh{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class $h extends Yh{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class ep extends Yh{constructor(e,t,i){super(new Float32Array(e),t,i)}}const tp=new Lh,ip=new uu,np=new uu;class ap{constructor(e=new uu,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;void 0!==t?i.copy(t):tp.setFromPoints(e).getCenter(i);let n=0;for(let t=0,a=e.length;t<a;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ip.subVectors(e,this.center);const t=ip.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),i=.5*(e-this.radius);this.center.addScaledVector(ip,i/e),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(np.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ip.copy(e.center).add(np)),this.expandByPoint(ip.copy(e.center).sub(np))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let rp=0;const sp=new zu,op=new lh,lp=new uu,cp=new Lh,dp=new Lh,up=new uu;class hp extends Yd{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rp++}),this.uuid=iu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?$h:Jh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const t=(new Au).getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return sp.makeRotationFromQuaternion(e),this.applyMatrix4(sp),this}rotateX(e){return sp.makeRotationX(e),this.applyMatrix4(sp),this}rotateY(e){return sp.makeRotationY(e),this.applyMatrix4(sp),this}rotateZ(e){return sp.makeRotationZ(e),this.applyMatrix4(sp),this}translate(e,t,i){return sp.makeTranslation(e,t,i),this.applyMatrix4(sp),this}scale(e,t,i){return sp.makeScale(e,t,i),this.applyMatrix4(sp),this}lookAt(e){return op.lookAt(e),op.updateMatrix(),this.applyMatrix4(op.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(lp).negate(),this.translate(lp.x,lp.y,lp.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i];t.push(n.x,n.y,n.z||0)}this.setAttribute("position",new ep(t,3))}else{const i=Math.min(e.length,t.count);for(let n=0;n<i;n++){const i=e[n];t.setXYZ(n,i.x,i.y,i.z||0)}e.length>t.count&&Kd("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Lh);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xd("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new uu(-1/0,-1/0,-1/0),new uu(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){const i=t[e];cp.setFromBufferAttribute(i),this.morphTargetsRelative?(up.addVectors(this.boundingBox.min,cp.min),this.boundingBox.expandByPoint(up),up.addVectors(this.boundingBox.max,cp.max),this.boundingBox.expandByPoint(up)):(this.boundingBox.expandByPoint(cp.min),this.boundingBox.expandByPoint(cp.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Xd('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ap);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xd("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new uu,1/0);if(e){const i=this.boundingSphere.center;if(cp.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){const i=t[e];dp.setFromBufferAttribute(i),this.morphTargetsRelative?(up.addVectors(cp.min,dp.min),cp.expandByPoint(up),up.addVectors(cp.max,dp.max),cp.expandByPoint(up)):(cp.expandByPoint(dp.min),cp.expandByPoint(dp.max))}cp.getCenter(i);let n=0;for(let t=0,a=e.count;t<a;t++)up.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(up));if(t)for(let a=0,r=t.length;a<r;a++){const r=t[a],s=this.morphTargetsRelative;for(let t=0,a=r.count;t<a;t++)up.fromBufferAttribute(r,t),s&&(lp.fromBufferAttribute(e,t),up.add(lp)),n=Math.max(n,i.distanceToSquared(up))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&Xd('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void Xd("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.position,n=t.normal,a=t.uv;let r=this.getAttribute("tangent");void 0!==r&&r.count===i.count||(r=new Yh(new Float32Array(4*i.count),4),this.setAttribute("tangent",r));const s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new uu,o[e]=new uu;const l=new uu,c=new uu,d=new uu,u=new cu,h=new cu,p=new cu,A=new uu,m=new uu;function g(e,t,n){l.fromBufferAttribute(i,e),c.fromBufferAttribute(i,t),d.fromBufferAttribute(i,n),u.fromBufferAttribute(a,e),h.fromBufferAttribute(a,t),p.fromBufferAttribute(a,n),c.sub(l),d.sub(l),h.sub(u),p.sub(u);const r=1/(h.x*p.y-p.x*h.y);isFinite(r)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(d,-h.y).multiplyScalar(r),m.copy(d).multiplyScalar(h.x).addScaledVector(c,-p.x).multiplyScalar(r),s[e].add(A),s[t].add(A),s[n].add(A),o[e].add(m),o[t].add(m),o[n].add(m))}let f=this.groups;0===f.length&&(f=[{start:0,count:e.count}]);for(let t=0,i=f.length;t<i;++t){const i=f[t],n=i.start;for(let t=n,a=n+i.count;t<a;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const _=new uu,v=new uu,E=new uu,y=new uu;function b(e){E.fromBufferAttribute(n,e),y.copy(E);const t=s[e];_.copy(t),_.sub(E.multiplyScalar(E.dot(t))).normalize(),v.crossVectors(y,t);const i=v.dot(o[e])<0?-1:1;r.setXYZW(e,_.x,_.y,_.z,i)}for(let t=0,i=f.length;t<i;++t){const i=f[t],n=i.start;for(let t=n,a=n+i.count;t<a;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i||i.count!==t.count)i=new Yh(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);const n=new uu,a=new uu,r=new uu,s=new uu,o=new uu,l=new uu,c=new uu,d=new uu;if(e)for(let u=0,h=e.count;u<h;u+=3){const h=e.getX(u+0),p=e.getX(u+1),A=e.getX(u+2);n.fromBufferAttribute(t,h),a.fromBufferAttribute(t,p),r.fromBufferAttribute(t,A),c.subVectors(r,a),d.subVectors(n,a),c.cross(d),s.fromBufferAttribute(i,h),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,A),s.add(c),o.add(c),l.add(c),i.setXYZ(h,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),a.fromBufferAttribute(t,e+1),r.fromBufferAttribute(t,e+2),c.subVectors(r,a),d.subVectors(n,a),c.cross(d),i.setXYZ(e+0,c.x,c.y,c.z),i.setXYZ(e+1,c.x,c.y,c.z),i.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)up.fromBufferAttribute(e,t),up.normalize(),e.setXYZ(t,up.x,up.y,up.z)}toNonIndexed(){function e(e,t){const i=e.array,n=e.itemSize,a=e.normalized,r=new i.constructor(t.length*n);let s=0,o=0;for(let a=0,l=t.length;a<l;a++){s=e.isInterleavedBufferAttribute?t[a]*e.data.stride+e.offset:t[a]*n;for(let e=0;e<n;e++)r[o++]=i[s++]}return new Yh(r,n,a)}if(null===this.index)return Kd("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new hp,i=this.index.array,n=this.attributes;for(const a in n){const r=e(n[a],i);t.setAttribute(a,r)}const a=this.morphAttributes;for(const n in a){const r=[],s=a[n];for(let t=0,n=s.length;t<n;t++){const n=e(s[t],i);r.push(n)}t.morphAttributes[n]=r}t.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let e=0,i=r.length;e<i;e++){const i=r[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=void 0!==this.parameters&&!0===this._transformed?"BufferGeometry":this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters&&!0!==this._transformed){const t=this.parameters;for(const i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const t in i){const n=i[t];e.data.attributes[t]=n.toJSON(e.data)}const n={};let a=!1;for(const t in this.morphAttributes){const i=this.morphAttributes[t],r=[];for(let t=0,n=i.length;t<n;t++){const n=i[t];r.push(n.toJSON(e.data))}r.length>0&&(n[t]=r,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;null!==i&&this.setIndex(i.clone());const n=e.attributes;for(const e in n){const i=n[e];this.setAttribute(e,i.clone(t))}const a=e.morphAttributes;for(const e in a){const i=[],n=a[e];for(let e=0,a=n.length;e<a;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let e=0,t=r.length;e<t;e++){const t=r[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let pp=0;class Ap extends Yd{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pp++}),this.uuid=iu(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Sl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new gh(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Dd,this.stencilZFail=Dd,this.stencilZPass=Dd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const i=e[t];if(void 0===i){Kd(`Material: parameter '${t}' has value of undefined.`);continue}const n=this[t];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector2&&i&&i.isVector2||n&&n.isEuler&&i&&i.isEuler||n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i:Kd(`Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(e){const t=[];for(const i in e){const n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==Sl&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Dd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Dd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Dd&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){const t=n(e.textures),a=n(e.images);t.length>0&&(i.textures=t),a.length>0&&(i.images=a)}return i}fromJSON(e,t){if(void 0!==e.uuid&&(this.uuid=e.uuid),void 0!==e.name&&(this.name=e.name),void 0!==e.color&&void 0!==this.color&&this.color.setHex(e.color),void 0!==e.roughness&&(this.roughness=e.roughness),void 0!==e.metalness&&(this.metalness=e.metalness),void 0!==e.sheen&&(this.sheen=e.sheen),void 0!==e.sheenColor&&(this.sheenColor=(new gh).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(this.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==this.emissive&&this.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==this.specular&&this.specular.setHex(e.specular),void 0!==e.specularIntensity&&(this.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==this.specularColor&&this.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(this.shininess=e.shininess),void 0!==e.clearcoat&&(this.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(this.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(this.dispersion=e.dispersion),void 0!==e.iridescence&&(this.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(this.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(this.transmission=e.transmission),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.attenuationDistance&&(this.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==this.attenuationColor&&this.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(this.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(this.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.flatShading&&(this.flatShading=e.flatShading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.side&&(this.side=e.side),void 0!==e.shadowSide&&(this.shadowSide=e.shadowSide),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.transparent&&(this.transparent=e.transparent),void 0!==e.alphaTest&&(this.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(this.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(this.depthFunc=e.depthFunc),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.depthWrite&&(this.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(this.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(this.blendSrc=e.blendSrc),void 0!==e.blendDst&&(this.blendDst=e.blendDst),void 0!==e.blendEquation&&(this.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(this.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(this.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(this.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==this.blendColor&&this.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(this.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(this.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(this.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(this.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(this.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(this.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(this.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(this.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(this.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(this.rotation=e.rotation),void 0!==e.linewidth&&(this.linewidth=e.linewidth),void 0!==e.dashSize&&(this.dashSize=e.dashSize),void 0!==e.gapSize&&(this.gapSize=e.gapSize),void 0!==e.scale&&(this.scale=e.scale),void 0!==e.polygonOffset&&(this.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(this.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(this.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(this.dithering=e.dithering),void 0!==e.alphaToCoverage&&(this.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(this.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(this.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(this.allowOverride=e.allowOverride),void 0!==e.visible&&(this.visible=e.visible),void 0!==e.toneMapped&&(this.toneMapped=e.toneMapped),void 0!==e.userData&&(this.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),void 0!==e.size&&(this.size=e.size),void 0!==e.sizeAttenuation&&(this.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(this.map=t[e.map]||null),void 0!==e.matcap&&(this.matcap=t[e.matcap]||null),void 0!==e.alphaMap&&(this.alphaMap=t[e.alphaMap]||null),void 0!==e.bumpMap&&(this.bumpMap=t[e.bumpMap]||null),void 0!==e.bumpScale&&(this.bumpScale=e.bumpScale),void 0!==e.normalMap&&(this.normalMap=t[e.normalMap]||null),void 0!==e.normalMapType&&(this.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),this.normalScale=(new cu).fromArray(t)}return void 0!==e.displacementMap&&(this.displacementMap=t[e.displacementMap]||null),void 0!==e.displacementScale&&(this.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(this.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(this.roughnessMap=t[e.roughnessMap]||null),void 0!==e.metalnessMap&&(this.metalnessMap=t[e.metalnessMap]||null),void 0!==e.emissiveMap&&(this.emissiveMap=t[e.emissiveMap]||null),void 0!==e.emissiveIntensity&&(this.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(this.specularMap=t[e.specularMap]||null),void 0!==e.specularIntensityMap&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),void 0!==e.specularColorMap&&(this.specularColorMap=t[e.specularColorMap]||null),void 0!==e.envMap&&(this.envMap=t[e.envMap]||null),void 0!==e.envMapRotation&&this.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(this.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(this.lightMap=t[e.lightMap]||null),void 0!==e.lightMapIntensity&&(this.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(this.aoMap=t[e.aoMap]||null),void 0!==e.aoMapIntensity&&(this.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(this.gradientMap=t[e.gradientMap]||null),void 0!==e.clearcoatMap&&(this.clearcoatMap=t[e.clearcoatMap]||null),void 0!==e.clearcoatRoughnessMap&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),void 0!==e.clearcoatNormalMap&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),void 0!==e.clearcoatNormalScale&&(this.clearcoatNormalScale=(new cu).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(this.iridescenceMap=t[e.iridescenceMap]||null),void 0!==e.iridescenceThicknessMap&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),void 0!==e.transmissionMap&&(this.transmissionMap=t[e.transmissionMap]||null),void 0!==e.thicknessMap&&(this.thicknessMap=t[e.thicknessMap]||null),void 0!==e.anisotropyMap&&(this.anisotropyMap=t[e.anisotropyMap]||null),void 0!==e.sheenColorMap&&(this.sheenColorMap=t[e.sheenColorMap]||null),void 0!==e.sheenRoughnessMap&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(null!==t){const e=t.length;i=new Array(e);for(let n=0;n!==e;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}const mp=new uu,gp=new uu,fp=new uu,_p=new uu,vp=new uu,Ep=new uu,yp=new uu;class bp{constructor(e=new uu,t=new uu(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mp)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=mp.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mp.copy(this.origin).addScaledVector(this.direction,t),mp.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){gp.copy(e).add(t).multiplyScalar(.5),fp.copy(t).sub(e).normalize(),_p.copy(this.origin).sub(gp);const a=.5*e.distanceTo(t),r=-this.direction.dot(fp),s=_p.dot(this.direction),o=-_p.dot(fp),l=_p.lengthSq(),c=Math.abs(1-r*r);let d,u,h,p;if(c>0)if(d=r*o-s,u=r*s-o,p=a*c,d>=0)if(u>=-p)if(u<=p){const e=1/c;d*=e,u*=e,h=d*(d+r*u+2*s)+u*(r*d+u+2*o)+l}else u=a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;else u=-a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;else u<=-p?(d=Math.max(0,-(-r*a+s)),u=d>0?-a:Math.min(Math.max(-a,-o),a),h=-d*d+u*(u+2*o)+l):u<=p?(d=0,u=Math.min(Math.max(-a,-o),a),h=u*(u+2*o)+l):(d=Math.max(0,-(r*a+s)),u=d>0?a:Math.min(Math.max(-a,-o),a),h=-d*d+u*(u+2*o)+l);else u=r>0?-a:a,d=Math.max(0,-(r*u+s)),h=-d*d+u*(u+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,d),n&&n.copy(gp).addScaledVector(fp,u),h}intersectSphere(e,t){mp.subVectors(e.center,this.origin);const i=mp.dot(this.direction),n=mp.dot(mp)-i*i,a=e.radius*e.radius;if(n>a)return null;const r=Math.sqrt(a-n),s=i-r,o=i+r;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,r,s,o;const l=1/this.direction.x,c=1/this.direction.y,d=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),c>=0?(a=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c):(a=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c),i>r||a>n?null:((a>i||isNaN(i))&&(i=a),(r<n||isNaN(n))&&(n=r),d>=0?(s=(e.min.z-u.z)*d,o=(e.max.z-u.z)*d):(s=(e.max.z-u.z)*d,o=(e.min.z-u.z)*d),i>o||s>n?null:((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,t)))}intersectsBox(e){return null!==this.intersectBox(e,mp)}intersectTriangle(e,t,i,n,a){vp.subVectors(t,e),Ep.subVectors(i,e),yp.crossVectors(vp,Ep);let r,s=this.direction.dot(yp);if(s>0){if(n)return null;r=1}else{if(!(s<0))return null;r=-1,s=-s}_p.subVectors(this.origin,e);const o=r*this.direction.dot(Ep.crossVectors(_p,Ep));if(o<0)return null;const l=r*this.direction.dot(vp.cross(_p));if(l<0)return null;if(o+l>s)return null;const c=-r*_p.dot(yp);return c<0?null:this.at(c/s,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class kp extends Ap{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new qu,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const xp=new zu,wp=new bp,Mp=new ap,Sp=new uu,Cp=new uu,Tp=new uu,Dp=new uu,Pp=new uu,Ip=new uu,Lp=new uu,Rp=new uu;class zp extends lh{constructor(e=new hp,t=new kp){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){const t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,r=i.morphTargetsRelative;t.fromBufferAttribute(n,e);const s=this.morphTargetInfluences;if(a&&s){Ip.set(0,0,0);for(let i=0,n=a.length;i<n;i++){const n=s[i],o=a[i];0!==n&&(Pp.fromBufferAttribute(o,e),r?Ip.addScaledVector(Pp,n):Ip.addScaledVector(Pp.sub(t),n))}t.add(Ip)}return t}raycast(e,t){const i=this.geometry,n=this.material,a=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Mp.copy(i.boundingSphere),Mp.applyMatrix4(a),wp.copy(e.ray).recast(e.near),!1===Mp.containsPoint(wp.origin)){if(null===wp.intersectSphere(Mp,Sp))return;if(wp.origin.distanceToSquared(Sp)>(e.far-e.near)**2)return}xp.copy(a).invert(),wp.copy(e.ray).applyMatrix4(xp),null!==i.boundingBox&&!1===wp.intersectsBox(i.boundingBox)||this._computeIntersections(e,t,wp)}}_computeIntersections(e,t,i){let n;const a=this.geometry,r=this.material,s=a.index,o=a.attributes.position,l=a.attributes.uv,c=a.attributes.uv1,d=a.attributes.normal,u=a.groups,h=a.drawRange;if(null!==s)if(Array.isArray(r))for(let a=0,o=u.length;a<o;a++){const o=u[a],p=r[o.materialIndex];for(let a=Math.max(o.start,h.start),r=Math.min(s.count,Math.min(o.start+o.count,h.start+h.count));a<r;a+=3){n=Fp(this,p,e,i,l,c,d,s.getX(a),s.getX(a+1),s.getX(a+2)),n&&(n.faceIndex=Math.floor(a/3),n.face.materialIndex=o.materialIndex,t.push(n))}}else{for(let a=Math.max(0,h.start),o=Math.min(s.count,h.start+h.count);a<o;a+=3){n=Fp(this,r,e,i,l,c,d,s.getX(a),s.getX(a+1),s.getX(a+2)),n&&(n.faceIndex=Math.floor(a/3),t.push(n))}}else if(void 0!==o)if(Array.isArray(r))for(let a=0,s=u.length;a<s;a++){const s=u[a],p=r[s.materialIndex];for(let a=Math.max(s.start,h.start),r=Math.min(o.count,Math.min(s.start+s.count,h.start+h.count));a<r;a+=3){n=Fp(this,p,e,i,l,c,d,a,a+1,a+2),n&&(n.faceIndex=Math.floor(a/3),n.face.materialIndex=s.materialIndex,t.push(n))}}else{for(let a=Math.max(0,h.start),s=Math.min(o.count,h.start+h.count);a<s;a+=3){n=Fp(this,r,e,i,l,c,d,a,a+1,a+2),n&&(n.faceIndex=Math.floor(a/3),t.push(n))}}}}function Fp(e,t,i,n,a,r,s,o,l,c){e.getVertexPosition(o,Cp),e.getVertexPosition(l,Tp),e.getVertexPosition(c,Dp);const d=function(e,t,i,n,a,r,s,o){let l;if(l=1===t.side?n.intersectTriangle(s,r,a,!0,o):n.intersectTriangle(a,r,s,0===t.side,o),null===l)return null;Rp.copy(o),Rp.applyMatrix4(e.matrixWorld);const c=i.ray.origin.distanceTo(Rp);return c<i.near||c>i.far?null:{distance:c,point:Rp.clone(),object:e}}(e,t,i,n,Cp,Tp,Dp,Lp);if(d){const e=new uu;Ih.getBarycoord(Lp,Cp,Tp,Dp,e),a&&(d.uv=Ih.getInterpolatedAttribute(a,o,l,c,e,new cu)),r&&(d.uv1=Ih.getInterpolatedAttribute(r,o,l,c,e,new cu)),s&&(d.normal=Ih.getInterpolatedAttribute(s,o,l,c,e,new uu),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const t={a:o,b:l,c:c,normal:new uu,materialIndex:0};Ih.getNormal(Cp,Tp,Dp,t.normal),d.face=t,d.barycoord=e}return d}class Up extends Tu{constructor(e=null,t=1,i=1,n,a,r,s,o,l=1003,c=1003,d,u){super(null,r,s,o,l,c,n,a,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Np=new uu,Bp=new uu,Op=new Au;class jp{constructor(e=new uu(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const n=Np.subVectors(i,t).cross(Bp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const n=e.delta(Np),a=this.normal.dot(n);if(0===a)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/a;return!0===i&&(r<0||r>1)?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Op.getNormalMatrix(e),n=this.coplanarPoint(Np).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Gp=new ap,Vp=new cu(.5,.5),Hp=new uu;class qp{constructor(e=new jp,t=new jp,i=new jp,n=new jp,a=new jp,r=new jp){this.planes=[e,t,i,n,a,r]}set(e,t,i,n,a,r){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(r),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3,i=!1){const n=this.planes,a=e.elements,r=a[0],s=a[1],o=a[2],l=a[3],c=a[4],d=a[5],u=a[6],h=a[7],p=a[8],A=a[9],m=a[10],g=a[11],f=a[12],_=a[13],v=a[14],E=a[15];if(n[0].setComponents(l-r,h-c,g-p,E-f).normalize(),n[1].setComponents(l+r,h+c,g+p,E+f).normalize(),n[2].setComponents(l+s,h+d,g+A,E+_).normalize(),n[3].setComponents(l-s,h-d,g-A,E-_).normalize(),i)n[4].setComponents(o,u,m,v).normalize(),n[5].setComponents(l-o,h-u,g-m,E-v).normalize();else if(n[4].setComponents(l-o,h-u,g-m,E-v).normalize(),t===Od)n[5].setComponents(l+o,h+u,g+m,E+v).normalize();else{if(t!==jd)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,u,m,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Gp.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Gp.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gp)}intersectsSprite(e){Gp.center.set(0,0,0);const t=Vp.distanceTo(e.center);return Gp.radius=.7071067811865476+t,Gp.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gp)}intersectsSphere(e){const t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(i)<n)return!1}return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const n=t[i];if(Hp.x=n.normal.x>0?e.max.x:e.min.x,Hp.y=n.normal.y>0?e.max.y:e.min.y,Hp.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Hp)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Wp extends Ap{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new gh(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Kp=new uu,Xp=new uu,Qp=new zu,Zp=new bp,Yp=new ap,Jp=new uu,$p=new uu;class eA extends lh{constructor(e=new hp,t=new Wp){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)Kp.fromBufferAttribute(t,e-1),Xp.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=Kp.distanceTo(Xp);e.setAttribute("lineDistance",new ep(i,1))}else Kd("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,r=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Yp.copy(i.boundingSphere),Yp.applyMatrix4(n),Yp.radius+=a,!1===e.ray.intersectsSphere(Yp))return;Qp.copy(n).invert(),Zp.copy(e.ray).applyMatrix4(Qp);const s=a/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,c=i.index,d=i.attributes.position;if(null!==c){const i=Math.max(0,r.start),n=Math.min(c.count,r.start+r.count);for(let a=i,r=n-1;a<r;a+=l){const i=c.getX(a),n=c.getX(a+1),r=tA(this,e,Zp,o,i,n,a);r&&t.push(r)}if(this.isLineLoop){const a=c.getX(n-1),r=c.getX(i),s=tA(this,e,Zp,o,a,r,n-1);s&&t.push(s)}}else{const i=Math.max(0,r.start),n=Math.min(d.count,r.start+r.count);for(let a=i,r=n-1;a<r;a+=l){const i=tA(this,e,Zp,o,a,a+1,a);i&&t.push(i)}if(this.isLineLoop){const a=tA(this,e,Zp,o,n-1,i,n-1);a&&t.push(a)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){const t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function tA(e,t,i,n,a,r,s){const o=e.geometry.attributes.position;Kp.fromBufferAttribute(o,a),Xp.fromBufferAttribute(o,r);if(i.distanceSqToSegment(Kp,Xp,Jp,$p)>n)return;Jp.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(Jp);return l<t.near||l>t.far?void 0:{distance:l,point:$p.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}const iA=new uu,nA=new uu;class aA extends eA{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,i=[];for(let e=0,n=t.count;e<n;e+=2)iA.fromBufferAttribute(t,e),nA.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+iA.distanceTo(nA);e.setAttribute("lineDistance",new ep(i,1))}else Kd("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class rA extends Tu{constructor(e,t,i,n,a=1006,r=1006,s,o,l){super(e,t,i,n,a,r,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const c=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class sA extends Tu{constructor(e=[],t=301,i,n,a,r,s,o,l,c){super(e,t,i,n,a,r,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class oA extends Tu{constructor(e,t,i=1014,n,a,r,s=1003,o=1003,l,c=1026,d=1){if(c!==Uc&&c!==Nc)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:d},n,a,r,s,o,c,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new wu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class lA extends oA{constructor(e,t=1014,i=301,n,a,r=1003,s=1003,o,l=1026){const c={width:e,height:e,depth:1},d=[c,c,c,c,c,c];super(e,e,t,i,n,a,r,s,o,l),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class cA extends Tu{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class dA extends hp{constructor(e=1,t=1,i=1,n=1,a=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:r};const s=this;n=Math.floor(n),a=Math.floor(a),r=Math.floor(r);const o=[],l=[],c=[],d=[];let u=0,h=0;function p(e,t,i,n,a,r,p,A,m,g,f){const _=r/m,v=p/g,E=r/2,y=p/2,b=A/2,k=m+1,x=g+1;let w=0,M=0;const S=new uu;for(let r=0;r<x;r++){const s=r*v-y;for(let o=0;o<k;o++){const u=o*_-E;S[e]=u*n,S[t]=s*a,S[i]=b,l.push(S.x,S.y,S.z),S[e]=0,S[t]=0,S[i]=A>0?1:-1,c.push(S.x,S.y,S.z),d.push(o/m),d.push(1-r/g),w+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const i=u+t+k*e,n=u+t+k*(e+1),a=u+(t+1)+k*(e+1),r=u+(t+1)+k*e;o.push(i,n,r),o.push(n,a,r),M+=6}s.addGroup(h,M,f),h+=M,u+=w}p("z","y","x",-1,-1,i,t,e,r,a,0),p("z","y","x",1,-1,i,t,-e,r,a,1),p("x","z","y",1,1,e,i,t,n,r,2),p("x","z","y",1,-1,e,i,-t,n,r,3),p("x","y","z",1,-1,e,t,i,n,a,4),p("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(o),this.setAttribute("position",new ep(l,3)),this.setAttribute("normal",new ep(c,3)),this.setAttribute("uv",new ep(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dA(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class uA extends hp{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const a=e/2,r=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,c=o+1,d=e/s,u=t/o,h=[],p=[],A=[],m=[];for(let e=0;e<c;e++){const t=e*u-r;for(let i=0;i<l;i++){const n=i*d-a;p.push(n,-t,0),A.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,n=t+l*(e+1),a=t+1+l*(e+1),r=t+1+l*e;h.push(i,n,r),h.push(n,a,r)}this.setIndex(h),this.setAttribute("position",new ep(p,3)),this.setAttribute("normal",new ep(A,3)),this.setAttribute("uv",new ep(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uA(e.width,e.height,e.widthSegments,e.heightSegments)}}class hA extends hp{constructor(e=1,t=32,i=16,n=0,a=2*Math.PI,r=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:a,thetaStart:r,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const o=Math.min(r+s,Math.PI);let l=0;const c=[],d=new uu,u=new uu,h=[],p=[],A=[],m=[];for(let h=0;h<=i;h++){const g=[],f=h/i,_=r+f*s,v=e*Math.cos(_),E=Math.sqrt(e*e-v*v);let y=0;0===h&&0===r?y=.5/t:h===i&&o===Math.PI&&(y=-.5/t);for(let e=0;e<=t;e++){const i=e/t,r=n+i*a;d.x=-E*Math.cos(r),d.y=v,d.z=E*Math.sin(r),p.push(d.x,d.y,d.z),u.copy(d).normalize(),A.push(u.x,u.y,u.z),m.push(i+y,1-f),g.push(l++)}c.push(g)}for(let e=0;e<i;e++)for(let n=0;n<t;n++){const t=c[e][n+1],a=c[e][n],s=c[e+1][n],l=c[e+1][n+1];(0!==e||r>0)&&h.push(t,a,l),(e!==i-1||o<Math.PI)&&h.push(a,s,l)}this.setIndex(h),this.setAttribute("position",new ep(p,3)),this.setAttribute("normal",new ep(A,3)),this.setAttribute("uv",new ep(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hA(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class pA extends hp{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],i=new Set,n=new uu,a=new uu;if(null!==e.index){const r=e.attributes.position,s=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],c=l.start;for(let e=c,o=c+l.count;e<o;e+=3)for(let o=0;o<3;o++){const l=s.getX(e+o),c=s.getX(e+(o+1)%3);n.fromBufferAttribute(r,l),a.fromBufferAttribute(r,c),!0===AA(n,a,i)&&(t.push(n.x,n.y,n.z),t.push(a.x,a.y,a.z))}}}else{const r=e.attributes.position;for(let e=0,s=r.count/3;e<s;e++)for(let s=0;s<3;s++){const o=3*e+s,l=3*e+(s+1)%3;n.fromBufferAttribute(r,o),a.fromBufferAttribute(r,l),!0===AA(n,a,i)&&(t.push(n.x,n.y,n.z),t.push(a.x,a.y,a.z))}}this.setAttribute("position",new ep(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function AA(e,t,i){const n=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,a=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==i.has(n)&&!0!==i.has(a)&&(i.add(n),i.add(a),!0)}function mA(e){const t={};for(const i in e){t[i]={};for(const n in e[i]){const a=e[i][n];if(fA(a))a.isRenderTargetTexture?(Kd("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=a.clone();else if(Array.isArray(a))if(fA(a[0])){const e=[];for(let t=0,i=a.length;t<i;t++)e[t]=a[t].clone();t[i][n]=e}else t[i][n]=a.slice();else t[i][n]=a}}return t}function gA(e){const t={};for(let i=0;i<e.length;i++){const n=mA(e[i]);for(const e in n)t[e]=n[e]}return t}function fA(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function _A(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:vu.workingColorSpace}const vA={clone:mA,merge:gA};class EA extends Ap{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=mA(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}fromJSON(e,t){if(super.fromJSON(e,t),void 0!==e.uniforms)for(const i in e.uniforms){const n=e.uniforms[i];switch(this.uniforms[i]={},n.type){case"t":this.uniforms[i].value=t[n.value]||null;break;case"c":this.uniforms[i].value=(new gh).setHex(n.value);break;case"v2":this.uniforms[i].value=(new cu).fromArray(n.value);break;case"v3":this.uniforms[i].value=(new uu).fromArray(n.value);break;case"v4":this.uniforms[i].value=(new Du).fromArray(n.value);break;case"m3":this.uniforms[i].value=(new Au).fromArray(n.value);break;case"m4":this.uniforms[i].value=(new zu).fromArray(n.value);break;default:this.uniforms[i].value=n.value}}if(void 0!==e.defines&&(this.defines=e.defines),void 0!==e.vertexShader&&(this.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(this.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(this.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)this.extensions[t]=e.extensions[t];return void 0!==e.lights&&(this.lights=e.lights),void 0!==e.clipping&&(this.clipping=e.clipping),this}}class yA extends EA{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class bA extends Ap{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class kA extends Ap{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const xA={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(wA(e)||(this.files[e]=t))},get:function(e){if(!1!==this.enabled&&!wA(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function wA(e){try{const t=e.slice(e.indexOf(":")+1);return"blob:"===new URL(t).protocol}catch(e){return!1}}class MA{constructor(e,t,i){const n=this;let a,r=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(e){o++,!1===r&&void 0!==n.onStart&&n.onStart(e,s,o),r=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return e=e.normalize("NFC"),a?a(e):e},this.setURLModifier=function(e){return a=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){const i=l[t],n=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return n}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const SA=new MA;let CA=class{constructor(e){this.manager=void 0!==e?e:SA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const i=this;return new Promise(function(n,a){i.load(e,n,t,a)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};CA.DEFAULT_MATERIAL_NAME="__DEFAULT";const TA={};class DA extends Error{constructor(e,t){super(e),this.response=t}}class PA extends CA{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const a=xA.get(`file:${e}`);if(void 0!==a)return this.manager.itemStart(e),void setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0);if(void 0!==TA[e])return void TA[e].push({onLoad:t,onProgress:i,onError:n});TA[e]=[],TA[e].push({onLoad:t,onProgress:i,onError:n});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(r).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&Kd("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const i=TA[e],n=t.body.getReader(),a=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),r=a?parseInt(a):0,s=0!==r;let o=0;const l=new ReadableStream({start(e){!function t(){n.read().then(({done:n,value:a})=>{if(n)e.close();else{o+=a.byteLength;const n=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:r});for(let e=0,t=i.length;e<t;e++){const t=i[e];t.onProgress&&t.onProgress(n)}e.enqueue(a),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new DA(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),i=t&&t[1]?t[1].toLowerCase():void 0,n=new TextDecoder(i);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{xA.add(`file:${e}`,t);const i=TA[e];delete TA[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];n.onLoad&&n.onLoad(t)}}).catch(t=>{const i=TA[e];if(void 0===i)throw this.manager.itemError(e),t;delete TA[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];n.onError&&n.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const IA=new WeakMap;class LA extends CA{constructor(e){super(e)}load(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,r=xA.get(`image:${e}`);if(void 0!==r){if(!0===r.complete)a.manager.itemStart(e),setTimeout(function(){t&&t(r),a.manager.itemEnd(e)},0);else{let e=IA.get(r);void 0===e&&(e=[],IA.set(r,e)),e.push({onLoad:t,onError:n})}return r}const s=Gd("img");function o(){c(),t&&t(this);const i=IA.get(this)||[];for(let e=0;e<i.length;e++){const t=i[e];t.onLoad&&t.onLoad(this)}IA.delete(this),a.manager.itemEnd(e)}function l(t){c(),n&&n(t),xA.remove(`image:${e}`);const i=IA.get(this)||[];for(let e=0;e<i.length;e++){const n=i[e];n.onError&&n.onError(t)}IA.delete(this),a.manager.itemError(e),a.manager.itemEnd(e)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),xA.add(`image:${e}`,s),a.manager.itemStart(e),s.src=e,s}}const RA=new uu,zA=new du,FA=new uu;class UA extends lh{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zu,this.projectionMatrix=new zu,this.projectionMatrixInverse=new zu,this.coordinateSystem=Od,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(RA,zA,FA),1===FA.x&&1===FA.y&&1===FA.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RA,zA,FA.set(1,1,1)).invert()}updateWorldMatrix(e,t,i=!1){super.updateWorldMatrix(e,t,i),this.matrixWorld.decompose(RA,zA,FA),1===FA.x&&1===FA.y&&1===FA.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RA,zA,FA.set(1,1,1)).invert()}clone(){return(new this.constructor).copy(this)}}const NA=new uu,BA=new cu,OA=new cu;class jA extends UA{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*tu*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*eu*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*tu*Math.atan(Math.tan(.5*eu*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){NA.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(NA.x,NA.y).multiplyScalar(-e/NA.z),NA.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(NA.x,NA.y).multiplyScalar(-e/NA.z)}getViewSize(e,t){return this.getViewBounds(e,BA,OA),t.subVectors(OA,BA)}setViewOffset(e,t,i,n,a,r){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*eu*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n;const r=this.view;if(null!==this.view&&this.view.enabled){const e=r.fullWidth,s=r.fullHeight;a+=r.offsetX*n/e,t-=r.offsetY*i/s,n*=r.width/e,i*=r.height/s}const s=this.filmOffset;0!==s&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class GA extends UA{constructor(e=-1,t=1,i=1,n=-1,a=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let a=i-e,r=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=e*this.view.offsetX,r=a+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(a,r,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const VA=-90;class HA extends lh{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new jA(VA,1,e,t);n.layers=this.layers,this.add(n);const a=new jA(VA,1,e,t);a.layers=this.layers,this.add(a);const r=new jA(VA,1,e,t);r.layers=this.layers,this.add(r);const s=new jA(VA,1,e,t);s.layers=this.layers,this.add(s);const o=new jA(VA,1,e,t);o.layers=this.layers,this.add(o);const l=new jA(VA,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,n,a,r,s,o]=t;for(const e of t)this.remove(e);if(e===Od)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==jd)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,r,s,o,l,c]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;m=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(i,0,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,1,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,r),e.setRenderTarget(i,2,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,3,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,4,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),i.texture.generateMipmaps=A,e.setRenderTarget(i,5,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,c),e.setRenderTarget(d,u,h),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class qA extends jA{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const WA=new zu;class KA{constructor(e,t,i=0,n=1/0){this.ray=new bp(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new Wu,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Xd("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return WA.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(WA),this}intersectObject(e,t=!0,i=[]){return QA(e,this,i,t),i.sort(XA),i}intersectObjects(e,t=!0,i=[]){for(let n=0,a=e.length;n<a;n++)QA(e[n],this,i,t);return i.sort(XA),i}}function XA(e,t){return e.distance-t.distance}function QA(e,t,i,n){let a=!0;if(e.layers.test(t.layers)){!1===e.raycast(t,i)&&(a=!1)}if(!0===a&&!0===n){const n=e.children;for(let e=0,a=n.length;e<a;e++)QA(n[e],t,i,!0)}}class ZA{static{ZA.prototype.isMatrix2=!0}constructor(e,t,i,n){this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,i,n)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,n){const a=this.elements;return a[0]=e,a[2]=t,a[1]=i,a[3]=n,this}}function YA(e,t,i,n){const a=function(e){switch(e){case kc:case xc:return{byteLength:1,components:1};case Mc:case wc:case Dc:return{byteLength:2,components:1};case Pc:case Ic:return{byteLength:2,components:4};case Cc:case Sc:case Tc:return{byteLength:4,components:1};case Rc:case zc:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}(n);switch(i){case 1021:return e*t;case 1028:case Bc:return e*t/a.components*a.byteLength;case Oc:case jc:return e*t*2/a.components*a.byteLength;case 1022:return e*t*3/a.components*a.byteLength;case Fc:case Gc:return e*t*4/a.components*a.byteLength;case Vc:case Hc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case qc:case Wc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Xc:case Zc:return Math.max(e,16)*Math.max(t,8)/4;case Kc:case Qc:return Math.max(e,8)*Math.max(t,8)/2;case Yc:case Jc:case ed:case td:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case $c:case id:case nd:case ad:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case rd:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case sd:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case od:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case ld:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case cd:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case dd:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case ud:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case hd:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case pd:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ad:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case md:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case gd:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case fd:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case _d:case vd:case Ed:return Math.ceil(e/4)*Math.ceil(t/4)*16;case yd:case bd:return Math.ceil(e/4)*Math.ceil(t/4)*8;case kd:case xd:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}
|
|
1163
1163
|
/**
|
|
1164
1164
|
* @license
|
|
1165
1165
|
* Copyright 2010-2026 Three.js Authors
|
|
@@ -2077,7 +2077,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}(this._re
|
|
|
2077
2077
|
${"empty"===this._icon?Ir(Ts):q}
|
|
2078
2078
|
${"warn"===this._icon?Ir(Hr):q}
|
|
2079
2079
|
</span>
|
|
2080
|
-
</div>`}}customElements.define("pnx-search-bar",lw);class cw extends EventTarget{constructor(e,t={}){if(super(),null==e||"string"!=typeof e){const e=new Error("endpoint parameter is empty or not a valid string");throw this.dispatchEvent(new CustomEvent("broken",{detail:{error:e}})),e}if(e.startsWith("/")&&(e=window.location.href.split("/").slice(0,3).join("/")+e),!cw.isValidHttpUrl(e)){const t=new Error(`endpoint parameter is not a valid URL: ${e}`);throw this.dispatchEvent(new CustomEvent("broken",{detail:{error:t}})),t}this._endpoint=e,this._isReady=0,this._dataBbox=null,this._fetchOpts=t?.fetch||{},this._metadata={},this._configuration=null,t.skipReadLanding||(this._readLanding=fetch(e,this._getFetchOptions()).then(e=>e.json()).then(e=>this._parseLanding(e,t)).catch(e=>(this._isReady=-1,console.error(e),this.dispatchEvent(new CustomEvent("broken",{detail:{error:e}})),Promise.reject("Viewer failed to communicate with API"))).then(()=>(this._isReady=1,this.dispatchEvent(new Event("ready")),"API is ready")))}onceReady(){return-1===this._isReady?Promise.reject("Viewer failed to communicate with API"):1===this._isReady?Promise.resolve("API is ready"):this._readLanding}isReady(){return 1===this._isReady}getAvailableFeatures(){return Object.entries(this._endpoints).filter(e=>null!==e[1]).map(e=>e[0])}getUnavailableFeatures(){return Object.entries(this._endpoints).filter(e=>null===e[1]).map(e=>e[0])}_parseLanding(e,t){if(this._endpoints={collections:null,search:null,style:null,user_style:null,tiles:t?.tiles||null,user_tiles:null,user_search:null,collection_preview:null,item_preview:null,rss:null,report:null,queryables:null},!e||!e.links||!Array.isArray(e.links))throw new Error("API Landing page doesn't contain 'links' list");if(!e.stac_version.startsWith("1."))throw new Error(`API is not in a supported STAC version (Panoramax viewer supports only 1.x, API is ${e.stac_version})`);this._metadata.name=e.title||"Unnamed",this._metadata.stac_version=e.stac_version,this._metadata.geovisio_version=e.geovisio_version;const i=[],n=[];if([{rel:"search",type:"application/geo+json",endpointId:"search",mandatory:!0,missingIssue:"No direct access to pictures metadata."},{rel:"data",type:"application/json",endpointId:"collections",mandatory:!0,missingIssue:"No way for viewer to access sequences."},{rel:"data",type:"application/rss+xml",endpointId:"rss"},{rel:"xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"tiles"},{rel:"xyz-style",type:"application/json",endpointId:"style"},{rel:"user-xyz-style",type:"application/json",endpointId:"user_style"},{rel:"user-xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"user_tiles"},{rel:"user-search",type:"application/json",endpointId:"user_search",missingIssue:"Filter map data by user name will not be available."},{rel:"collection-preview",type:"image/jpeg",endpointId:"collection_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"item-preview",type:"image/jpeg",endpointId:"item_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"report",type:"application/json",endpointId:"report"},{rel:"http://www.opengis.net/def/rel/ogc/1.0/queryables",type:"application/schema+json",endpointId:"queryables",missingIssue:"Tags map overlay will not be available."}].forEach(t=>{const a=e.links.filter(e=>e.rel===t.rel&&e.type===t.type);if(0===a.length){if(!this._endpoints[t.endpointId]){let e=`API doesn't offer a '${t.rel}' (${t.type}) endpoint in its links`;t.missingIssue&&(e+=`\n${t.missingIssue}`),t.mandatory?i.push(e):t.missingIssue&&n.push(e)}}else{const e=1===a.length?a[0]:a.find(e=>e.title?.includes("v2"))||a[0];if(!cw.isValidHttpUrl(e.href))throw new Error(`API endpoint '${e.rel}' (${e.type}) is not a valid URL: ${e.href}`);this._endpoints[t.endpointId]&&"xyz-style"!==t.endpointId||(this._endpoints[t.endpointId]=e.href)}}),this._endpoints.style||this._endpoints.tiles||n.push("API doesn't offer 'xyz' or 'xyz-style' endpoints in its links.\nMap widget will not be available."),this._endpoints.user_style||this._endpoints.user_tiles||n.push("API doesn't offer 'user-xyz' or 'user-xyz-style' endpoints in its links.\nFilter map data by user ID will not be available."),n.forEach(e=>console.warn(e)),i.length>0)throw new Error(i.join("\n"));const a=e?.extent?.spatial?.bbox;this._dataBbox=a&&Array.isArray(a)&&a.length>0&&Array.isArray(a[0])&&4===a[0].length?[[a[0][0],a[0][1]],[a[0][2],a[0][3]]]:null}_getFetchOptions(e=!1){const t=Object.assign({},this._fetchOpts);return e||(t.signal=AbortSignal.timeout(15e3)),t}_getMapRequestTransform(){const e=this._getFetchOptions();return delete e.signal,t=>{if(t.startsWith(this._endpoint)){if(Object.keys(e).length>0)return{url:t,...e}}else if(t.includes("data.geopf.fr")&&t.includes("@2x"))return{url:t.replace("@2x","")}}}_getPSVWithCredentials(){return"include"===this._getFetchOptions().credentials?e=>e.startsWith(this._endpoint):void 0}cleanResourceURL(e){if(!e)return;const t=new URL(this._endpoint);return e.startsWith("/")?t.protocol+"//"+t.host+e:e.startsWith("./")?this._endpoint+e.substring(1):e}async getSequenceItems(e,t=null,i=null,n=null){if(!this.isReady())throw new Error("API is not ready to use");try{return cw.isIdValid(e),await fetch(t||`${this._endpoints.collections}/${e}/items${n?"?limit="+n:""}`,this._getFetchOptions(!0)).then(e=>e.json()).then(t=>{let a=t;i&&(a.features=i.features.concat(a.features));const r=t.links.find(e=>"next"===e.rel);return!n&&r?this.getSequenceItems(e,r.href,a):a})}catch(e){return await Promise.reject(e)}}getPicturesAroundCoordinatesUrl(e,t,i=5e-4,n=null,a=null){if(!this.isReady())throw new Error("API is not ready to use");if(isNaN(parseFloat(e))||isNaN(parseFloat(t)))throw new Error("lat and lon parameters should be valid numbers");const r=[t-i,e-i,t+i,e+i].map(e=>e.toFixed(7)).join(","),s=n?`&limit=${n}`:"",o=a?`&collections=${a}`:"";return`${this._endpoints.search}?bbox=${r}${s}${o}`}getPicturesAroundCoordinates(e,t,i,n,a){return fetch(this.getPicturesAroundCoordinatesUrl(e,t,i,n,a),this._getFetchOptions()).then(e=>e.json())}getPictureMetadataUrl(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(cw.isIdValid(e))return t?`${this._endpoints.collections}/${t}/items/${e}`:`${this._endpoints.search}?ids=${e}`}findThumbnailInPictureFeature(e){if(!this.isReady())throw new Error("API is not ready to use");if(!e||!e.assets)return null;let t=null;for(let i of Object.values(e.assets)){if(i.roles.includes("thumbnail")&&"image/jpeg"===i.type&&cw.isValidHttpUrl(i.href))return this.cleanResourceURL(i.href);i.roles.includes("visual")&&"image/jpeg"===i.type&&cw.isValidHttpUrl(i.href)&&(t=this.cleanResourceURL(i.href))}return t}getPictureThumbnailURLForSequence(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.collection_preview)return Promise.resolve(this._endpoints.collection_preview.replace("{id}",e));if(t&&Array.isArray(t.links)&&t.links.length>0){let e=t.links.find(e=>"preview"===e.rel&&"image/jpeg"===e.type);if(e&&cw.isValidHttpUrl(e.href))return Promise.resolve(e.href)}const i=`${this._endpoints.search}?limit=1&collections=${e}`;return fetch(i,this._getFetchOptions()).then(e=>e.json()).then(e=>Array.isArray(e.features)&&0!==e.features.length?this.findThumbnailInPictureFeature(e.features.pop()):null)}getPictureThumbnailURL(e,t){if(!this.isReady())throw new Error("API is not ready to use");return e?this._endpoints.item_preview?Promise.resolve(this._endpoints.item_preview.replace("{id}",e)):e&&t?fetch(`${this._endpoints.collections}/${t}/items/${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e?this.findThumbnailInPictureFeature(e):null):fetch(`${this._endpoints.search}?ids=${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e&&Array.isArray(e.features)&&0!==e.features.length?this.findThumbnailInPictureFeature(e.features.pop()):null):Promise.resolve(null)}getRSSURL(e){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.rss){let t=this._endpoints.rss;return e&&(t+=t.includes("?")?"&":"?",t+="bbox="+[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()].join(",")),t}return null}getSequenceMetadataUrl(e){if(!this.isReady())throw new Error("API is not ready to use");return`${this._endpoints.collections}/${e}`}getSequenceMetadata(e){if(!this.isReady())throw new Error("API is not ready to use");return fetch(this.getSequenceMetadataUrl(e),this._getFetchOptions()).then(e=>e.json())}getDataBbox(){if(!this.isReady())throw new Error("API is not ready to use");return this._dataBbox}searchUsers(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(`${this._endpoints.user_search}?q=${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e?.features||null)}getUserName(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(this._endpoints.user_search.replace(/\/search$/,`/${e}`),this._getFetchOptions()).then(e=>e.json()).then(e=>e?.label||e?.name||null)}sendReport(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.report)throw new Error("Report sending is not available");const t={...this._getFetchOptions(),method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}};return fetch(this._endpoints.report,t).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}deletePicture(e,t){if(!this.isReady())throw new Error("API is not ready to use");let i=`${this._endpoint}/collections/${e}/items/${t}`;const n={...this._getFetchOptions(),method:"DELETE"};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return!0})}sendPictureSemantics(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(!e?.sequence?.id||!e?.id)throw new Error("Missing IDs from picture");let i=this.getPictureMetadataUrl(e.id,e.sequence.id);e?.origInstance&&(i=`${e.origInstance.href}/api/collections/${e.sequence.id}/items/${e.id}`);const n={...this._getFetchOptions(),method:"PATCH",body:JSON.stringify({semantics:t}),headers:{"Content-Type":"application/json"}};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}createPictureAnnotation(e,t,i){if(!this.isReady())throw new Error("API is not ready to use");if(!e?.sequence?.id||!e?.id)throw new Error("Missing IDs from picture");let n=this.getPictureMetadataUrl(e.id,e.sequence.id)+"/annotations";e?.origInstance&&(n=`${e.origInstance.href}/api/collections/${e.sequence.id}/items/${e.id}/annotations`);const a={...this._getFetchOptions(),method:"POST",body:JSON.stringify({semantics:i,shape:{type:"Polygon",coordinates:[t]}}),headers:{"Content-Type":"application/json"}};return fetch(n,a).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}editPictureAnnotation(e,t){if(!this.isReady())throw new Error("API is not ready to use");let i=`${this._endpoint}/annotations/${e}`;const n={...this._getFetchOptions(),method:"PATCH",body:JSON.stringify({semantics:t}),headers:{"Content-Type":"application/json"}};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}deletePictureAnnotation(e){if(!this.isReady())throw new Error("API is not ready to use");let t=`${this._endpoint}/annotations/${e}`;const i={...this._getFetchOptions(),method:"DELETE"};return fetch(t,i).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return!0})}getAuthURL(){return this._configuration?Promise.resolve(!!this._configuration?.auth?.enabled&&`${this._endpoint}/auth/login?next_url=<CBURL>`):null===this._configuration?fetch(this._endpoint+"/configuration",this._getFetchOptions()).then(e=>e.json()).then(e=>(this._configuration=e,this.getAuthURL())).catch(()=>(this._configuration=!1,!1)):Promise.resolve(!1)}static isValidHttpUrl(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}static isIdValid(e){if(Zs(e))throw new Error("id should be a valid picture unique identifier");return!0}}var dw={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},uw={isSpaceSeparator:e=>"string"==typeof e&&dw.Space_Separator.test(e),isIdStartChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||dw.ID_Start.test(e)),isIdContinueChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"ā"===e||"ā"===e||dw.ID_Continue.test(e)),isDigit:e=>"string"==typeof e&&/[0-9]/.test(e),isHexDigit:e=>"string"==typeof e&&/[0-9A-Fa-f]/.test(e)};let hw,pw,Aw,mw,gw,fw,_w,vw,Ew;function yw(e,t,i){const n=e[t];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(let e=0;e<n.length;e++){const t=String(e),a=yw(n,t,i);void 0===a?delete n[t]:Object.defineProperty(n,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(const e in n){const t=yw(n,e,i);void 0===t?delete n[e]:Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return i.call(e,t,n)}let bw,kw,xw,ww,Mw;function Sw(){for(bw="default",kw="",xw=!1,ww=1;;){Mw=Cw();const e=Dw[bw]();if(e)return e}}function Cw(){if(hw[mw])return String.fromCodePoint(hw.codePointAt(mw))}function Tw(){const e=Cw();return"\n"===e?(gw++,fw=0):e?fw+=e.length:fw++,e&&(mw+=e.length),e}const Dw={default(){switch(Mw){case"\t":case"\v":case"\f":case" ":case"Ā ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void Tw();case"/":return Tw(),void(bw="comment");case void 0:return Tw(),Pw("eof")}if(!uw.isSpaceSeparator(Mw))return Dw[pw]();Tw()},comment(){switch(Mw){case"*":return Tw(),void(bw="multiLineComment");case"/":return Tw(),void(bw="singleLineComment")}throw Uw(Tw())},multiLineComment(){switch(Mw){case"*":return Tw(),void(bw="multiLineCommentAsterisk");case void 0:throw Uw(Tw())}Tw()},multiLineCommentAsterisk(){switch(Mw){case"*":return void Tw();case"/":return Tw(),void(bw="default");case void 0:throw Uw(Tw())}Tw(),bw="multiLineComment"},singleLineComment(){switch(Mw){case"\n":case"\r":case"\u2028":case"\u2029":return Tw(),void(bw="default");case void 0:return Tw(),Pw("eof")}Tw()},value(){switch(Mw){case"{":case"[":return Pw("punctuator",Tw());case"n":return Tw(),Iw("ull"),Pw("null",null);case"t":return Tw(),Iw("rue"),Pw("boolean",!0);case"f":return Tw(),Iw("alse"),Pw("boolean",!1);case"-":case"+":return"-"===Tw()&&(ww=-1),void(bw="sign");case".":return kw=Tw(),void(bw="decimalPointLeading");case"0":return kw=Tw(),void(bw="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return kw=Tw(),void(bw="decimalInteger");case"I":return Tw(),Iw("nfinity"),Pw("numeric",1/0);case"N":return Tw(),Iw("aN"),Pw("numeric",NaN);case'"':case"'":return xw='"'===Tw(),kw="",void(bw="string")}throw Uw(Tw())},identifierNameStartEscape(){if("u"!==Mw)throw Uw(Tw());Tw();const e=Lw();switch(e){case"$":case"_":break;default:if(!uw.isIdStartChar(e))throw Bw()}kw+=e,bw="identifierName"},identifierName(){switch(Mw){case"$":case"_":case"ā":case"ā":return void(kw+=Tw());case"\\":return Tw(),void(bw="identifierNameEscape")}if(!uw.isIdContinueChar(Mw))return Pw("identifier",kw);kw+=Tw()},identifierNameEscape(){if("u"!==Mw)throw Uw(Tw());Tw();const e=Lw();switch(e){case"$":case"_":case"ā":case"ā":break;default:if(!uw.isIdContinueChar(e))throw Bw()}kw+=e,bw="identifierName"},sign(){switch(Mw){case".":return kw=Tw(),void(bw="decimalPointLeading");case"0":return kw=Tw(),void(bw="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return kw=Tw(),void(bw="decimalInteger");case"I":return Tw(),Iw("nfinity"),Pw("numeric",ww*(1/0));case"N":return Tw(),Iw("aN"),Pw("numeric",NaN)}throw Uw(Tw())},zero(){switch(Mw){case".":return kw+=Tw(),void(bw="decimalPoint");case"e":case"E":return kw+=Tw(),void(bw="decimalExponent");case"x":case"X":return kw+=Tw(),void(bw="hexadecimal")}return Pw("numeric",0*ww)},decimalInteger(){switch(Mw){case".":return kw+=Tw(),void(bw="decimalPoint");case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},decimalPointLeading(){if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalFraction");throw Uw(Tw())},decimalPoint(){switch(Mw){case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}return uw.isDigit(Mw)?(kw+=Tw(),void(bw="decimalFraction")):Pw("numeric",ww*Number(kw))},decimalFraction(){switch(Mw){case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},decimalExponent(){switch(Mw){case"+":case"-":return kw+=Tw(),void(bw="decimalExponentSign")}if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalExponentInteger");throw Uw(Tw())},decimalExponentSign(){if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalExponentInteger");throw Uw(Tw())},decimalExponentInteger(){if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},hexadecimal(){if(uw.isHexDigit(Mw))return kw+=Tw(),void(bw="hexadecimalInteger");throw Uw(Tw())},hexadecimalInteger(){if(!uw.isHexDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},string(){switch(Mw){case"\\":return Tw(),void(kw+=function(){switch(Cw()){case"b":return Tw(),"\b";case"f":return Tw(),"\f";case"n":return Tw(),"\n";case"r":return Tw(),"\r";case"t":return Tw(),"\t";case"v":return Tw(),"\v";case"0":if(Tw(),uw.isDigit(Cw()))throw Uw(Tw());return"\0";case"x":return Tw(),function(){let e="",t=Cw();if(!uw.isHexDigit(t))throw Uw(Tw());if(e+=Tw(),t=Cw(),!uw.isHexDigit(t))throw Uw(Tw());return e+=Tw(),String.fromCodePoint(parseInt(e,16))}();case"u":return Tw(),Lw();case"\n":case"\u2028":case"\u2029":return Tw(),"";case"\r":return Tw(),"\n"===Cw()&&Tw(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw Uw(Tw())}return Tw()}());case'"':return xw?(Tw(),Pw("string",kw)):void(kw+=Tw());case"'":return xw?void(kw+=Tw()):(Tw(),Pw("string",kw));case"\n":case"\r":throw Uw(Tw());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ow(e)}' in strings is not valid ECMAScript; consider escaping`)}(Mw);break;case void 0:throw Uw(Tw())}kw+=Tw()},start(){switch(Mw){case"{":case"[":return Pw("punctuator",Tw())}bw="value"},beforePropertyName(){switch(Mw){case"$":case"_":return kw=Tw(),void(bw="identifierName");case"\\":return Tw(),void(bw="identifierNameStartEscape");case"}":return Pw("punctuator",Tw());case'"':case"'":return xw='"'===Tw(),void(bw="string")}if(uw.isIdStartChar(Mw))return kw+=Tw(),void(bw="identifierName");throw Uw(Tw())},afterPropertyName(){if(":"===Mw)return Pw("punctuator",Tw());throw Uw(Tw())},beforePropertyValue(){bw="value"},afterPropertyValue(){switch(Mw){case",":case"}":return Pw("punctuator",Tw())}throw Uw(Tw())},beforeArrayValue(){if("]"===Mw)return Pw("punctuator",Tw());bw="value"},afterArrayValue(){switch(Mw){case",":case"]":return Pw("punctuator",Tw())}throw Uw(Tw())},end(){throw Uw(Tw())}};function Pw(e,t){return{type:e,value:t,line:gw,column:fw}}function Iw(e){for(const t of e){if(Cw()!==t)throw Uw(Tw());Tw()}}function Lw(){let e="",t=4;for(;t-- >0;){const t=Cw();if(!uw.isHexDigit(t))throw Uw(Tw());e+=Tw()}return String.fromCodePoint(parseInt(e,16))}const Rw={start(){if("eof"===_w.type)throw Nw();zw()},beforePropertyName(){switch(_w.type){case"identifier":case"string":return vw=_w.value,void(pw="afterPropertyName");case"punctuator":return void Fw();case"eof":throw Nw()}},afterPropertyName(){if("eof"===_w.type)throw Nw();pw="beforePropertyValue"},beforePropertyValue(){if("eof"===_w.type)throw Nw();zw()},beforeArrayValue(){if("eof"===_w.type)throw Nw();"punctuator"!==_w.type||"]"!==_w.value?zw():Fw()},afterPropertyValue(){if("eof"===_w.type)throw Nw();switch(_w.value){case",":return void(pw="beforePropertyName");case"}":Fw()}},afterArrayValue(){if("eof"===_w.type)throw Nw();switch(_w.value){case",":return void(pw="beforeArrayValue");case"]":Fw()}},end(){}};function zw(){let e;switch(_w.type){case"punctuator":switch(_w.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_w.value}if(void 0===Ew)Ew=e;else{const t=Aw[Aw.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,vw,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(null!==e&&"object"==typeof e)Aw.push(e),pw=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Aw[Aw.length-1];pw=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function Fw(){Aw.pop();const e=Aw[Aw.length-1];pw=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}function Uw(e){return jw(void 0===e?`JSON5: invalid end of input at ${gw}:${fw}`:`JSON5: invalid character '${Ow(e)}' at ${gw}:${fw}`)}function Nw(){return jw(`JSON5: invalid end of input at ${gw}:${fw}`)}function Bw(){return fw-=5,jw(`JSON5: invalid identifier character at ${gw}:${fw}`)}function Ow(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return e}function jw(e){const t=new SyntaxError(e);return t.lineNumber=gw,t.columnNumber=fw,t}const Gw={parse:function(e,t){hw=String(e),pw="start",Aw=[],mw=0,gw=1,fw=0,_w=void 0,vw=void 0,Ew=void 0;do{_w=Sw(),Rw[pw]()}while("eof"!==_w.type);return"function"==typeof t?yw({"":Ew},"",t):Ew},stringify:function(e,t,i){const n=[];let a,r,s,o="",l="";if(null==t||"object"!=typeof t||Array.isArray(t)||(i=t.space,s=t.quote,t=t.replacer),"function"==typeof t)r=t;else if(Array.isArray(t)){a=[];for(const e of t){let t;"string"==typeof e?t=e:("number"==typeof e||e instanceof String||e instanceof Number)&&(t=String(e)),void 0!==t&&a.indexOf(t)<0&&a.push(t)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),"number"==typeof i?i>0&&(i=Math.min(10,Math.floor(i)),l=" ".substr(0,i)):"string"==typeof i&&(l=i.substr(0,10)),c("",{"":e});function c(e,t){let i=t[e];switch(null!=i&&("function"==typeof i.toJSON5?i=i.toJSON5(e):"function"==typeof i.toJSON&&(i=i.toJSON(e))),r&&(i=r.call(t,e,i)),i instanceof Number?i=Number(i):i instanceof String?i=String(i):i instanceof Boolean&&(i=i.valueOf()),i){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof i?d(i):"number"==typeof i?String(i):"object"==typeof i?Array.isArray(i)?function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,a=[];for(let t=0;t<e.length;t++){const i=c(String(t),e);a.push(void 0!==i?i:"null")}if(0===a.length)i="[]";else if(""===l){i="["+a.join(",")+"]"}else{let e=",\n"+o,n=a.join(e);i="[\n"+o+n+",\n"+t+"]"}return n.pop(),o=t,i}(i):function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,r=a||Object.keys(e),s=[];for(const t of r){const i=c(t,e);if(void 0!==i){let e=u(t)+":";""!==l&&(e+=" "),e+=i,s.push(e)}}if(0===s.length)i="{}";else{let e;if(""===l)e=s.join(","),i="{"+e+"}";else{let n=",\n"+o;e=s.join(n),i="{\n"+o+e+",\n"+t+"}"}}return n.pop(),o=t,i}(i):void 0}function d(e){const t={"'":.1,'"':.2},i={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let n="";for(let a=0;a<e.length;a++){const r=e[a];switch(r){case"'":case'"':t[r]++,n+=r;continue;case"\0":if(uw.isDigit(e[a+1])){n+="\\x00";continue}}if(i[r])n+=i[r];else{if(r<" "){let e=r.charCodeAt(0).toString(16);n+="\\x"+("00"+e).substring(e.length);continue}n+=r}}const a=s||Object.keys(t).reduce((e,i)=>t[e]<t[i]?e:i);return n=n.replace(new RegExp(a,"g"),i[a]),a+n+a}function u(e){if(0===e.length)return d(e);const t=String.fromCodePoint(e.codePointAt(0));if(!uw.isIdStartChar(t))return d(e);for(let i=t.length;i<e.length;i++)if(!uw.isIdContinueChar(String.fromCodePoint(e.codePointAt(i))))return d(e);return e}}};var Vw=Gw;const Hw=new CSSStyleSheet;Hw.replaceSync("/* atkinson-hyperlegible-next-latin-ext-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff) format('woff');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n\n/* atkinson-hyperlegible-next-latin-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff) format('woff');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}");const qw=new CSSStyleSheet;qw.replaceSync('/* Colors */\n:root, :host {\n\t--white: #ffffff;\n\t--black: #181818;\n\t--black-pale: #1b1a17;\n\t--red: #f70000;\n\t--red-transparent: rgba(247, 0, 0, 0.3);\n\t--red-pale: #ff726f;\n\t--grey: #f5f5f5;\n\t--grey-very-pale: #e6e6e6;\n\t--grey-pale: #cfd2cf;\n\t--grey-semi-dark: #808080;\n\t--grey-dark: #3e3e3e;\n\t--blue: #2954e9;\n\t--blue-dark: #0a1f69;\n\t--blue-semi: #d7dffc;\n\t--blue-pale: #f2f5ff;\n\t--blue-geovisio: #34495e;\n\t--beige: #f5f3ec;\n\t--yellow: #fec868;\n\t--orange: #ff6f00;\n\t--orange-transparent: rgba(255,111,0,0.3);\n\t--orange-pale: #fffafa;\n\t--green: #7ec636;\n\t--green-pale: #f0ffee;\n\t--widget-bg: var(--white);\n\t--widget-bg-hover: var(--grey);\n\t--widget-bg-active: var(--blue);\n\t--widget-bg-inactive: var(--grey-pale);\n\t--widget-bg-primary: var(--blue-semi);\n\t--widget-bg-primary-hover: #e0e7ff;\n\t--widget-bg-warn: #FFECB3;\n\t--widget-bg-danger: #FFCDD2;\n\t--widget-bg-success: #C8E6C9;\n\t--widget-border-div: var(--grey-pale);\n\t--widget-border-btn: var(--blue);\n\t--widget-font: var(--grey-dark);\n\t--widget-font-active: var(--white);\n\t--widget-font-direct: var(--blue);\n\t--widget-font-warn: #BF360C;\n\t--widget-font-danger: #B71C1C;\n\t--widget-font-success: #1B5E20;\n\t--font-family: "Atkinson Hyperlegible Next", sans-serif;\n\t--widget-option-left: #6A1B9A;\n\t--widget-option-right: #0D47A1;\n\toverscroll-behavior-y: contain;\n}\n\n.pnx-hidden { display: none !important; }\n\n/* Hidden elements on mobile */\n@container (max-width: 576px) {\n\t.pnx-mobile-hidden { display: none !important; }\n}\n\n/* Hidden elements on print */\n@media print {\n\t.pnx-print-hidden { display: none !important; }\n}\n'),document.adoptedStyleSheets.push(Hw),document.adoptedStyleSheets.push(qw);class Ww extends le{static properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Ww.GetJSONConverter()},lang:{type:String},endpoint:{type:String}};constructor(e=!1){super(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`š· Panoramax ${this.getClassName()} - Version 5.2.0 (08c7a77)\n\nš Issues can be reported at https://gitlab.com/panoramax/clients/web-viewer/-/work_items`),e||(this._isInternetFast=null,Ao().then(e=>this._isInternetFast=e))}connectedCallback(){super.connectedCallback(),this._t=Sx(this.lang),this.loader=Rr("pnx-loader",{_parent:this,"no-label":ho()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach(([e,t])=>{this.getAttribute(e)&&console.error(`Component attribute "${e}" has been renamed into "${t}". Old attribute "${e}" is ignored.`)}),ho()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||Rr("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let e=this.endpoint;try{this.api=new cw(this.endpoint,{fetch:this["fetch-options"]}),this.api.onceReady().then(()=>{if(e!==this._loadsAPI||!this.api)return;let t=this.api.getUnavailableFeatures(),i=this.api.getAvailableFeatures();i=0===t.length?"ā
All features available":"ā
Available features: "+i.join(", "),t=0===t.length?"":"š« Unavailable features: "+t.join(", "),console.info(`š Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\nā¹ļø API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${i}\n ${t}\n`.trim())}).catch(e=>this.loader?.dismiss?.(e,this._t?.pnx.error_api)).finally(()=>delete this._loadsAPI)}catch(e){delete this._loadsAPI,this.loader?.dismiss?this.loader.dismiss(e,this._t.pnx.error_api):console.error(e)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise(e=>setTimeout(e,250)).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"endpoint"===e&&(this._loadsAPI&&i&&this._loadsAPI===i||this.api&&this.api._endpoint===i||!i||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(e)){let n,a,r,s;"picture"===e?(n=this.sequence,r=this.sequence,a=i,s=t):(n=i,r=t,a=this.picture,s=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:n,picId:a,prevSeqId:r,prevPicId:s}}))}}getClassName(){return"Basic"}select(e=null,t=null,i=!1){i&&(this.picture=null,this.sequence=null),this.picture=t,this.sequence=e}isWidthSmall(){return this?.offsetWidth<576}isWidthMedium(){return this?.offsetWidth>=576&&this?.offsetWidth<768}isHeightSmall(){return this?.offsetHeight<400}render(){return V`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}getAPI(){return this.api}addEventListener(e,t,i){let n=e.split(":").shift();if(n&&this.getSubComponentsNames().includes(n)){const a=e.substring(n.length+1);this[n]?.addEventListener?this[n].addEventListener(a,t,i):setTimeout(()=>this.addEventListener(e,t,i),50)}else super.addEventListener(e,t,i)}static GetJSONConverter(){return{fromAttribute:e=>null==e||""===e?null:"object"==typeof e||Array.isArray(e)?e:Vw.parse(e),toAttribute:e=>null==e||""===e?"":"string"==typeof e?e:Vw.stringify(e)}}}class Kw extends le{static styles=[Ro,s`
|
|
2080
|
+
</div>`}}customElements.define("pnx-search-bar",lw);class cw extends EventTarget{constructor(e,t={}){if(super(),null==e||"string"!=typeof e){const e=new Error("endpoint parameter is empty or not a valid string");throw this.dispatchEvent(new CustomEvent("broken",{detail:{error:e}})),e}if(e.startsWith("/")&&(e=window.location.href.split("/").slice(0,3).join("/")+e),!cw.isValidHttpUrl(e)){const t=new Error(`endpoint parameter is not a valid URL: ${e}`);throw this.dispatchEvent(new CustomEvent("broken",{detail:{error:t}})),t}this._endpoint=e,this._isReady=0,this._dataBbox=null,this._fetchOpts=t?.fetch||{},this._metadata={},this._configuration=null,t.skipReadLanding||(this._readLanding=fetch(e,this._getFetchOptions()).then(e=>e.json()).then(e=>this._parseLanding(e,t)).catch(e=>(this._isReady=-1,console.error(e),this.dispatchEvent(new CustomEvent("broken",{detail:{error:e}})),Promise.reject("Viewer failed to communicate with API"))).then(()=>(this._isReady=1,this.dispatchEvent(new Event("ready")),"API is ready")))}onceReady(){return-1===this._isReady?Promise.reject("Viewer failed to communicate with API"):1===this._isReady?Promise.resolve("API is ready"):this._readLanding}isReady(){return 1===this._isReady}getAvailableFeatures(){return Object.entries(this._endpoints).filter(e=>null!==e[1]).map(e=>e[0])}getUnavailableFeatures(){return Object.entries(this._endpoints).filter(e=>null===e[1]).map(e=>e[0])}_parseLanding(e,t){if(this._endpoints={collections:null,search:null,style:null,user_style:null,tiles:t?.tiles||null,user_tiles:null,user_search:null,collection_preview:null,item_preview:null,rss:null,report:null,queryables:null},!e||!e.links||!Array.isArray(e.links))throw new Error("API Landing page doesn't contain 'links' list");if(!e.stac_version.startsWith("1."))throw new Error(`API is not in a supported STAC version (Panoramax viewer supports only 1.x, API is ${e.stac_version})`);this._metadata.name=e.title||"Unnamed",this._metadata.stac_version=e.stac_version,this._metadata.geovisio_version=e.geovisio_version;const i=[],n=[];if([{rel:"search",type:"application/geo+json",endpointId:"search",mandatory:!0,missingIssue:"No direct access to pictures metadata."},{rel:"data",type:"application/json",endpointId:"collections",mandatory:!0,missingIssue:"No way for viewer to access sequences."},{rel:"data",type:"application/rss+xml",endpointId:"rss"},{rel:"xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"tiles"},{rel:"xyz-style",type:"application/json",endpointId:"style"},{rel:"user-xyz-style",type:"application/json",endpointId:"user_style"},{rel:"user-xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"user_tiles"},{rel:"user-search",type:"application/json",endpointId:"user_search",missingIssue:"Filter map data by user name will not be available."},{rel:"collection-preview",type:"image/jpeg",endpointId:"collection_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"item-preview",type:"image/jpeg",endpointId:"item_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"report",type:"application/json",endpointId:"report"},{rel:"http://www.opengis.net/def/rel/ogc/1.0/queryables",type:"application/schema+json",endpointId:"queryables",missingIssue:"Tags map overlay will not be available."}].forEach(t=>{const a=e.links.filter(e=>e.rel===t.rel&&e.type===t.type);if(0===a.length){if(!this._endpoints[t.endpointId]){let e=`API doesn't offer a '${t.rel}' (${t.type}) endpoint in its links`;t.missingIssue&&(e+=`\n${t.missingIssue}`),t.mandatory?i.push(e):t.missingIssue&&n.push(e)}}else{const e=1===a.length?a[0]:a.find(e=>e.title?.includes("v2"))||a[0];if(!cw.isValidHttpUrl(e.href))throw new Error(`API endpoint '${e.rel}' (${e.type}) is not a valid URL: ${e.href}`);this._endpoints[t.endpointId]&&"xyz-style"!==t.endpointId||(this._endpoints[t.endpointId]=e.href)}}),this._endpoints.style||this._endpoints.tiles||n.push("API doesn't offer 'xyz' or 'xyz-style' endpoints in its links.\nMap widget will not be available."),this._endpoints.user_style||this._endpoints.user_tiles||n.push("API doesn't offer 'user-xyz' or 'user-xyz-style' endpoints in its links.\nFilter map data by user ID will not be available."),n.forEach(e=>console.warn(e)),i.length>0)throw new Error(i.join("\n"));const a=e?.extent?.spatial?.bbox;this._dataBbox=a&&Array.isArray(a)&&a.length>0&&Array.isArray(a[0])&&4===a[0].length?[[a[0][0],a[0][1]],[a[0][2],a[0][3]]]:null}_getFetchOptions(e=!1){const t=Object.assign({},this._fetchOpts);return e||(t.signal=AbortSignal.timeout(15e3)),t}_getMapRequestTransform(){const e=this._getFetchOptions();return delete e.signal,t=>{if(t.startsWith(this._endpoint)){if(Object.keys(e).length>0)return{url:t,...e}}else if(t.includes("data.geopf.fr")&&t.includes("@2x"))return{url:t.replace("@2x","")}}}_getPSVWithCredentials(){return"include"===this._getFetchOptions().credentials?e=>e.startsWith(this._endpoint):void 0}cleanResourceURL(e){if(!e)return;const t=new URL(this._endpoint);return e.startsWith("/")?t.protocol+"//"+t.host+e:e.startsWith("./")?this._endpoint+e.substring(1):e}async getSequenceItems(e,t=null,i=null,n=null){if(!this.isReady())throw new Error("API is not ready to use");try{return cw.isIdValid(e),await fetch(t||`${this._endpoints.collections}/${e}/items${n?"?limit="+n:""}`,this._getFetchOptions(!0)).then(e=>e.json()).then(t=>{let a=t;i&&(a.features=i.features.concat(a.features));const r=t.links.find(e=>"next"===e.rel);return!n&&r?this.getSequenceItems(e,r.href,a):a})}catch(e){return await Promise.reject(e)}}getPicturesAroundCoordinatesUrl(e,t,i=5e-4,n=null,a=null){if(!this.isReady())throw new Error("API is not ready to use");if(isNaN(parseFloat(e))||isNaN(parseFloat(t)))throw new Error("lat and lon parameters should be valid numbers");const r=[t-i,e-i,t+i,e+i].map(e=>e.toFixed(7)).join(","),s=n?`&limit=${n}`:"",o=a?`&collections=${a}`:"";return`${this._endpoints.search}?bbox=${r}${s}${o}`}getPicturesAroundCoordinates(e,t,i,n,a){return fetch(this.getPicturesAroundCoordinatesUrl(e,t,i,n,a),this._getFetchOptions()).then(e=>e.json())}getPictureMetadataUrl(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(cw.isIdValid(e))return t?`${this._endpoints.collections}/${t}/items/${e}`:`${this._endpoints.search}?ids=${e}`}findThumbnailInPictureFeature(e){if(!this.isReady())throw new Error("API is not ready to use");if(!e||!e.assets)return null;let t=null;for(let i of Object.values(e.assets)){if(i.roles.includes("thumbnail")&&"image/jpeg"===i.type&&cw.isValidHttpUrl(i.href))return this.cleanResourceURL(i.href);i.roles.includes("visual")&&"image/jpeg"===i.type&&cw.isValidHttpUrl(i.href)&&(t=this.cleanResourceURL(i.href))}return t}getPictureThumbnailURLForSequence(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.collection_preview)return Promise.resolve(this._endpoints.collection_preview.replace("{id}",e));if(t&&Array.isArray(t.links)&&t.links.length>0){let e=t.links.find(e=>"preview"===e.rel&&"image/jpeg"===e.type);if(e&&cw.isValidHttpUrl(e.href))return Promise.resolve(e.href)}const i=`${this._endpoints.search}?limit=1&collections=${e}`;return fetch(i,this._getFetchOptions()).then(e=>e.json()).then(e=>Array.isArray(e.features)&&0!==e.features.length?this.findThumbnailInPictureFeature(e.features.pop()):null)}getPictureThumbnailURL(e,t){if(!this.isReady())throw new Error("API is not ready to use");return e?this._endpoints.item_preview?Promise.resolve(this._endpoints.item_preview.replace("{id}",e)):e&&t?fetch(`${this._endpoints.collections}/${t}/items/${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e?this.findThumbnailInPictureFeature(e):null):fetch(`${this._endpoints.search}?ids=${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e&&Array.isArray(e.features)&&0!==e.features.length?this.findThumbnailInPictureFeature(e.features.pop()):null):Promise.resolve(null)}getRSSURL(e){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.rss){let t=this._endpoints.rss;return e&&(t+=t.includes("?")?"&":"?",t+="bbox="+[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()].join(",")),t}return null}getSequenceMetadataUrl(e){if(!this.isReady())throw new Error("API is not ready to use");return`${this._endpoints.collections}/${e}`}getSequenceMetadata(e){if(!this.isReady())throw new Error("API is not ready to use");return fetch(this.getSequenceMetadataUrl(e),this._getFetchOptions()).then(e=>e.json())}getDataBbox(){if(!this.isReady())throw new Error("API is not ready to use");return this._dataBbox}searchUsers(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(`${this._endpoints.user_search}?q=${e}`,this._getFetchOptions()).then(e=>e.json()).then(e=>e?.features||null)}getUserName(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(this._endpoints.user_search.replace(/\/search$/,`/${e}`),this._getFetchOptions()).then(e=>e.json()).then(e=>e?.label||e?.name||null)}sendReport(e){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.report)throw new Error("Report sending is not available");const t={...this._getFetchOptions(),method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}};return fetch(this._endpoints.report,t).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}deletePicture(e,t){if(!this.isReady())throw new Error("API is not ready to use");let i=`${this._endpoint}/collections/${e}/items/${t}`;const n={...this._getFetchOptions(),method:"DELETE"};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return!0})}sendPictureSemantics(e,t){if(!this.isReady())throw new Error("API is not ready to use");if(!e?.sequence?.id||!e?.id)throw new Error("Missing IDs from picture");let i=this.getPictureMetadataUrl(e.id,e.sequence.id);e?.origInstance&&(i=`${e.origInstance.href}/api/collections/${e.sequence.id}/items/${e.id}`);const n={...this._getFetchOptions(),method:"PATCH",body:JSON.stringify({semantics:t}),headers:{"Content-Type":"application/json"}};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}createPictureAnnotation(e,t,i){if(!this.isReady())throw new Error("API is not ready to use");if(!e?.sequence?.id||!e?.id)throw new Error("Missing IDs from picture");let n=this.getPictureMetadataUrl(e.id,e.sequence.id)+"/annotations";e?.origInstance&&(n=`${e.origInstance.href}/api/collections/${e.sequence.id}/items/${e.id}/annotations`);const a={...this._getFetchOptions(),method:"POST",body:JSON.stringify({semantics:i,shape:{type:"Polygon",coordinates:[t]}}),headers:{"Content-Type":"application/json"}};return fetch(n,a).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}editPictureAnnotation(e,t){if(!this.isReady())throw new Error("API is not ready to use");let i=`${this._endpoint}/annotations/${e}`;const n={...this._getFetchOptions(),method:"PATCH",body:JSON.stringify({semantics:t}),headers:{"Content-Type":"application/json"}};return fetch(i,n).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return e.json()})}deletePictureAnnotation(e){if(!this.isReady())throw new Error("API is not ready to use");let t=`${this._endpoint}/annotations/${e}`;const i={...this._getFetchOptions(),method:"DELETE"};return fetch(t,i).then(async e=>{if(e.status>=400){let t=await e.text();try{t=JSON.parse(t).message}catch(e){}return Promise.reject(t)}return!0})}getAuthURL(){return this._configuration?Promise.resolve(!!this._configuration?.auth?.enabled&&`${this._endpoint}/auth/login?next_url=<CBURL>`):null===this._configuration?fetch(this._endpoint+"/configuration",this._getFetchOptions()).then(e=>e.json()).then(e=>(this._configuration=e,this.getAuthURL())).catch(()=>(this._configuration=!1,!1)):Promise.resolve(!1)}static isValidHttpUrl(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}static isIdValid(e){if(Zs(e))throw new Error("id should be a valid picture unique identifier");return!0}}var dw={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},uw={isSpaceSeparator:e=>"string"==typeof e&&dw.Space_Separator.test(e),isIdStartChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||dw.ID_Start.test(e)),isIdContinueChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"ā"===e||"ā"===e||dw.ID_Continue.test(e)),isDigit:e=>"string"==typeof e&&/[0-9]/.test(e),isHexDigit:e=>"string"==typeof e&&/[0-9A-Fa-f]/.test(e)};let hw,pw,Aw,mw,gw,fw,_w,vw,Ew;function yw(e,t,i){const n=e[t];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(let e=0;e<n.length;e++){const t=String(e),a=yw(n,t,i);void 0===a?delete n[t]:Object.defineProperty(n,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(const e in n){const t=yw(n,e,i);void 0===t?delete n[e]:Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return i.call(e,t,n)}let bw,kw,xw,ww,Mw;function Sw(){for(bw="default",kw="",xw=!1,ww=1;;){Mw=Cw();const e=Dw[bw]();if(e)return e}}function Cw(){if(hw[mw])return String.fromCodePoint(hw.codePointAt(mw))}function Tw(){const e=Cw();return"\n"===e?(gw++,fw=0):e?fw+=e.length:fw++,e&&(mw+=e.length),e}const Dw={default(){switch(Mw){case"\t":case"\v":case"\f":case" ":case"Ā ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void Tw();case"/":return Tw(),void(bw="comment");case void 0:return Tw(),Pw("eof")}if(!uw.isSpaceSeparator(Mw))return Dw[pw]();Tw()},comment(){switch(Mw){case"*":return Tw(),void(bw="multiLineComment");case"/":return Tw(),void(bw="singleLineComment")}throw Uw(Tw())},multiLineComment(){switch(Mw){case"*":return Tw(),void(bw="multiLineCommentAsterisk");case void 0:throw Uw(Tw())}Tw()},multiLineCommentAsterisk(){switch(Mw){case"*":return void Tw();case"/":return Tw(),void(bw="default");case void 0:throw Uw(Tw())}Tw(),bw="multiLineComment"},singleLineComment(){switch(Mw){case"\n":case"\r":case"\u2028":case"\u2029":return Tw(),void(bw="default");case void 0:return Tw(),Pw("eof")}Tw()},value(){switch(Mw){case"{":case"[":return Pw("punctuator",Tw());case"n":return Tw(),Iw("ull"),Pw("null",null);case"t":return Tw(),Iw("rue"),Pw("boolean",!0);case"f":return Tw(),Iw("alse"),Pw("boolean",!1);case"-":case"+":return"-"===Tw()&&(ww=-1),void(bw="sign");case".":return kw=Tw(),void(bw="decimalPointLeading");case"0":return kw=Tw(),void(bw="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return kw=Tw(),void(bw="decimalInteger");case"I":return Tw(),Iw("nfinity"),Pw("numeric",1/0);case"N":return Tw(),Iw("aN"),Pw("numeric",NaN);case'"':case"'":return xw='"'===Tw(),kw="",void(bw="string")}throw Uw(Tw())},identifierNameStartEscape(){if("u"!==Mw)throw Uw(Tw());Tw();const e=Lw();switch(e){case"$":case"_":break;default:if(!uw.isIdStartChar(e))throw Bw()}kw+=e,bw="identifierName"},identifierName(){switch(Mw){case"$":case"_":case"ā":case"ā":return void(kw+=Tw());case"\\":return Tw(),void(bw="identifierNameEscape")}if(!uw.isIdContinueChar(Mw))return Pw("identifier",kw);kw+=Tw()},identifierNameEscape(){if("u"!==Mw)throw Uw(Tw());Tw();const e=Lw();switch(e){case"$":case"_":case"ā":case"ā":break;default:if(!uw.isIdContinueChar(e))throw Bw()}kw+=e,bw="identifierName"},sign(){switch(Mw){case".":return kw=Tw(),void(bw="decimalPointLeading");case"0":return kw=Tw(),void(bw="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return kw=Tw(),void(bw="decimalInteger");case"I":return Tw(),Iw("nfinity"),Pw("numeric",ww*(1/0));case"N":return Tw(),Iw("aN"),Pw("numeric",NaN)}throw Uw(Tw())},zero(){switch(Mw){case".":return kw+=Tw(),void(bw="decimalPoint");case"e":case"E":return kw+=Tw(),void(bw="decimalExponent");case"x":case"X":return kw+=Tw(),void(bw="hexadecimal")}return Pw("numeric",0*ww)},decimalInteger(){switch(Mw){case".":return kw+=Tw(),void(bw="decimalPoint");case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},decimalPointLeading(){if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalFraction");throw Uw(Tw())},decimalPoint(){switch(Mw){case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}return uw.isDigit(Mw)?(kw+=Tw(),void(bw="decimalFraction")):Pw("numeric",ww*Number(kw))},decimalFraction(){switch(Mw){case"e":case"E":return kw+=Tw(),void(bw="decimalExponent")}if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},decimalExponent(){switch(Mw){case"+":case"-":return kw+=Tw(),void(bw="decimalExponentSign")}if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalExponentInteger");throw Uw(Tw())},decimalExponentSign(){if(uw.isDigit(Mw))return kw+=Tw(),void(bw="decimalExponentInteger");throw Uw(Tw())},decimalExponentInteger(){if(!uw.isDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},hexadecimal(){if(uw.isHexDigit(Mw))return kw+=Tw(),void(bw="hexadecimalInteger");throw Uw(Tw())},hexadecimalInteger(){if(!uw.isHexDigit(Mw))return Pw("numeric",ww*Number(kw));kw+=Tw()},string(){switch(Mw){case"\\":return Tw(),void(kw+=function(){switch(Cw()){case"b":return Tw(),"\b";case"f":return Tw(),"\f";case"n":return Tw(),"\n";case"r":return Tw(),"\r";case"t":return Tw(),"\t";case"v":return Tw(),"\v";case"0":if(Tw(),uw.isDigit(Cw()))throw Uw(Tw());return"\0";case"x":return Tw(),function(){let e="",t=Cw();if(!uw.isHexDigit(t))throw Uw(Tw());if(e+=Tw(),t=Cw(),!uw.isHexDigit(t))throw Uw(Tw());return e+=Tw(),String.fromCodePoint(parseInt(e,16))}();case"u":return Tw(),Lw();case"\n":case"\u2028":case"\u2029":return Tw(),"";case"\r":return Tw(),"\n"===Cw()&&Tw(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw Uw(Tw())}return Tw()}());case'"':return xw?(Tw(),Pw("string",kw)):void(kw+=Tw());case"'":return xw?void(kw+=Tw()):(Tw(),Pw("string",kw));case"\n":case"\r":throw Uw(Tw());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ow(e)}' in strings is not valid ECMAScript; consider escaping`)}(Mw);break;case void 0:throw Uw(Tw())}kw+=Tw()},start(){switch(Mw){case"{":case"[":return Pw("punctuator",Tw())}bw="value"},beforePropertyName(){switch(Mw){case"$":case"_":return kw=Tw(),void(bw="identifierName");case"\\":return Tw(),void(bw="identifierNameStartEscape");case"}":return Pw("punctuator",Tw());case'"':case"'":return xw='"'===Tw(),void(bw="string")}if(uw.isIdStartChar(Mw))return kw+=Tw(),void(bw="identifierName");throw Uw(Tw())},afterPropertyName(){if(":"===Mw)return Pw("punctuator",Tw());throw Uw(Tw())},beforePropertyValue(){bw="value"},afterPropertyValue(){switch(Mw){case",":case"}":return Pw("punctuator",Tw())}throw Uw(Tw())},beforeArrayValue(){if("]"===Mw)return Pw("punctuator",Tw());bw="value"},afterArrayValue(){switch(Mw){case",":case"]":return Pw("punctuator",Tw())}throw Uw(Tw())},end(){throw Uw(Tw())}};function Pw(e,t){return{type:e,value:t,line:gw,column:fw}}function Iw(e){for(const t of e){if(Cw()!==t)throw Uw(Tw());Tw()}}function Lw(){let e="",t=4;for(;t-- >0;){const t=Cw();if(!uw.isHexDigit(t))throw Uw(Tw());e+=Tw()}return String.fromCodePoint(parseInt(e,16))}const Rw={start(){if("eof"===_w.type)throw Nw();zw()},beforePropertyName(){switch(_w.type){case"identifier":case"string":return vw=_w.value,void(pw="afterPropertyName");case"punctuator":return void Fw();case"eof":throw Nw()}},afterPropertyName(){if("eof"===_w.type)throw Nw();pw="beforePropertyValue"},beforePropertyValue(){if("eof"===_w.type)throw Nw();zw()},beforeArrayValue(){if("eof"===_w.type)throw Nw();"punctuator"!==_w.type||"]"!==_w.value?zw():Fw()},afterPropertyValue(){if("eof"===_w.type)throw Nw();switch(_w.value){case",":return void(pw="beforePropertyName");case"}":Fw()}},afterArrayValue(){if("eof"===_w.type)throw Nw();switch(_w.value){case",":return void(pw="beforeArrayValue");case"]":Fw()}},end(){}};function zw(){let e;switch(_w.type){case"punctuator":switch(_w.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_w.value}if(void 0===Ew)Ew=e;else{const t=Aw[Aw.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,vw,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(null!==e&&"object"==typeof e)Aw.push(e),pw=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Aw[Aw.length-1];pw=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function Fw(){Aw.pop();const e=Aw[Aw.length-1];pw=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}function Uw(e){return jw(void 0===e?`JSON5: invalid end of input at ${gw}:${fw}`:`JSON5: invalid character '${Ow(e)}' at ${gw}:${fw}`)}function Nw(){return jw(`JSON5: invalid end of input at ${gw}:${fw}`)}function Bw(){return fw-=5,jw(`JSON5: invalid identifier character at ${gw}:${fw}`)}function Ow(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return e}function jw(e){const t=new SyntaxError(e);return t.lineNumber=gw,t.columnNumber=fw,t}const Gw={parse:function(e,t){hw=String(e),pw="start",Aw=[],mw=0,gw=1,fw=0,_w=void 0,vw=void 0,Ew=void 0;do{_w=Sw(),Rw[pw]()}while("eof"!==_w.type);return"function"==typeof t?yw({"":Ew},"",t):Ew},stringify:function(e,t,i){const n=[];let a,r,s,o="",l="";if(null==t||"object"!=typeof t||Array.isArray(t)||(i=t.space,s=t.quote,t=t.replacer),"function"==typeof t)r=t;else if(Array.isArray(t)){a=[];for(const e of t){let t;"string"==typeof e?t=e:("number"==typeof e||e instanceof String||e instanceof Number)&&(t=String(e)),void 0!==t&&a.indexOf(t)<0&&a.push(t)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),"number"==typeof i?i>0&&(i=Math.min(10,Math.floor(i)),l=" ".substr(0,i)):"string"==typeof i&&(l=i.substr(0,10)),c("",{"":e});function c(e,t){let i=t[e];switch(null!=i&&("function"==typeof i.toJSON5?i=i.toJSON5(e):"function"==typeof i.toJSON&&(i=i.toJSON(e))),r&&(i=r.call(t,e,i)),i instanceof Number?i=Number(i):i instanceof String?i=String(i):i instanceof Boolean&&(i=i.valueOf()),i){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof i?d(i):"number"==typeof i?String(i):"object"==typeof i?Array.isArray(i)?function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,a=[];for(let t=0;t<e.length;t++){const i=c(String(t),e);a.push(void 0!==i?i:"null")}if(0===a.length)i="[]";else if(""===l){i="["+a.join(",")+"]"}else{let e=",\n"+o,n=a.join(e);i="[\n"+o+n+",\n"+t+"]"}return n.pop(),o=t,i}(i):function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,r=a||Object.keys(e),s=[];for(const t of r){const i=c(t,e);if(void 0!==i){let e=u(t)+":";""!==l&&(e+=" "),e+=i,s.push(e)}}if(0===s.length)i="{}";else{let e;if(""===l)e=s.join(","),i="{"+e+"}";else{let n=",\n"+o;e=s.join(n),i="{\n"+o+e+",\n"+t+"}"}}return n.pop(),o=t,i}(i):void 0}function d(e){const t={"'":.1,'"':.2},i={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let n="";for(let a=0;a<e.length;a++){const r=e[a];switch(r){case"'":case'"':t[r]++,n+=r;continue;case"\0":if(uw.isDigit(e[a+1])){n+="\\x00";continue}}if(i[r])n+=i[r];else{if(r<" "){let e=r.charCodeAt(0).toString(16);n+="\\x"+("00"+e).substring(e.length);continue}n+=r}}const a=s||Object.keys(t).reduce((e,i)=>t[e]<t[i]?e:i);return n=n.replace(new RegExp(a,"g"),i[a]),a+n+a}function u(e){if(0===e.length)return d(e);const t=String.fromCodePoint(e.codePointAt(0));if(!uw.isIdStartChar(t))return d(e);for(let i=t.length;i<e.length;i++)if(!uw.isIdContinueChar(String.fromCodePoint(e.codePointAt(i))))return d(e);return e}}};var Vw=Gw;const Hw=new CSSStyleSheet;Hw.replaceSync("/* atkinson-hyperlegible-next-latin-ext-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff) format('woff');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n\n/* atkinson-hyperlegible-next-latin-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff) format('woff');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}");const qw=new CSSStyleSheet;qw.replaceSync('/* Colors */\n:root, :host {\n\t--white: #ffffff;\n\t--black: #181818;\n\t--black-pale: #1b1a17;\n\t--red: #f70000;\n\t--red-transparent: rgba(247, 0, 0, 0.3);\n\t--red-pale: #ff726f;\n\t--grey: #f5f5f5;\n\t--grey-very-pale: #e6e6e6;\n\t--grey-pale: #cfd2cf;\n\t--grey-semi-dark: #808080;\n\t--grey-dark: #3e3e3e;\n\t--blue: #2954e9;\n\t--blue-dark: #0a1f69;\n\t--blue-semi: #d7dffc;\n\t--blue-pale: #f2f5ff;\n\t--blue-geovisio: #34495e;\n\t--beige: #f5f3ec;\n\t--yellow: #fec868;\n\t--orange: #ff6f00;\n\t--orange-transparent: rgba(255,111,0,0.3);\n\t--orange-pale: #fffafa;\n\t--green: #7ec636;\n\t--green-pale: #f0ffee;\n\t--widget-bg: var(--white);\n\t--widget-bg-hover: var(--grey);\n\t--widget-bg-active: var(--blue);\n\t--widget-bg-inactive: var(--grey-pale);\n\t--widget-bg-primary: var(--blue-semi);\n\t--widget-bg-primary-hover: #e0e7ff;\n\t--widget-bg-warn: #FFECB3;\n\t--widget-bg-danger: #FFCDD2;\n\t--widget-bg-success: #C8E6C9;\n\t--widget-border-div: var(--grey-pale);\n\t--widget-border-btn: var(--blue);\n\t--widget-font: var(--grey-dark);\n\t--widget-font-active: var(--white);\n\t--widget-font-direct: var(--blue);\n\t--widget-font-warn: #BF360C;\n\t--widget-font-danger: #B71C1C;\n\t--widget-font-success: #1B5E20;\n\t--font-family: "Atkinson Hyperlegible Next", sans-serif;\n\t--widget-option-left: #6A1B9A;\n\t--widget-option-right: #0D47A1;\n\toverscroll-behavior-y: contain;\n}\n\n.pnx-hidden { display: none !important; }\n\n/* Hidden elements on mobile */\n@container (max-width: 576px) {\n\t.pnx-mobile-hidden { display: none !important; }\n}\n\n/* Hidden elements on print */\n@media print {\n\t.pnx-print-hidden { display: none !important; }\n}\n'),document.adoptedStyleSheets.push(Hw),document.adoptedStyleSheets.push(qw);class Ww extends le{static properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Ww.GetJSONConverter()},lang:{type:String},endpoint:{type:String}};constructor(e=!1){super(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`š· Panoramax ${this.getClassName()} - Version 5.2.0 (0b4f95c)\n\nš Issues can be reported at https://gitlab.com/panoramax/clients/web-viewer/-/work_items`),e||(this._isInternetFast=null,Ao().then(e=>this._isInternetFast=e))}connectedCallback(){super.connectedCallback(),this._t=Sx(this.lang),this.loader=Rr("pnx-loader",{_parent:this,"no-label":ho()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach(([e,t])=>{this.getAttribute(e)&&console.error(`Component attribute "${e}" has been renamed into "${t}". Old attribute "${e}" is ignored.`)}),ho()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||Rr("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let e=this.endpoint;try{this.api=new cw(this.endpoint,{fetch:this["fetch-options"]}),this.api.onceReady().then(()=>{if(e!==this._loadsAPI||!this.api)return;let t=this.api.getUnavailableFeatures(),i=this.api.getAvailableFeatures();i=0===t.length?"ā
All features available":"ā
Available features: "+i.join(", "),t=0===t.length?"":"š« Unavailable features: "+t.join(", "),console.info(`š Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\nā¹ļø API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${i}\n ${t}\n`.trim())}).catch(e=>this.loader?.dismiss?.(e,this._t?.pnx.error_api)).finally(()=>delete this._loadsAPI)}catch(e){delete this._loadsAPI,this.loader?.dismiss?this.loader.dismiss(e,this._t.pnx.error_api):console.error(e)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise(e=>setTimeout(e,250)).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"endpoint"===e&&(this._loadsAPI&&i&&this._loadsAPI===i||this.api&&this.api._endpoint===i||!i||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(e)){let n,a,r,s;"picture"===e?(n=this.sequence,r=this.sequence,a=i,s=t):(n=i,r=t,a=this.picture,s=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:n,picId:a,prevSeqId:r,prevPicId:s}}))}}getClassName(){return"Basic"}select(e=null,t=null,i=!1){i&&(this.picture=null,this.sequence=null),this.picture=t,this.sequence=e}isWidthSmall(){return this?.offsetWidth<576}isWidthMedium(){return this?.offsetWidth>=576&&this?.offsetWidth<768}isHeightSmall(){return this?.offsetHeight<400}render(){return V`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}getAPI(){return this.api}addEventListener(e,t,i){let n=e.split(":").shift();if(n&&this.getSubComponentsNames().includes(n)){const a=e.substring(n.length+1);this[n]?.addEventListener?this[n].addEventListener(a,t,i):setTimeout(()=>this.addEventListener(e,t,i),50)}else super.addEventListener(e,t,i)}static GetJSONConverter(){return{fromAttribute:e=>null==e||""===e?null:"object"==typeof e||Array.isArray(e)?e:Vw.parse(e),toAttribute:e=>null==e||""===e?"":"string"==typeof e?e:Vw.stringify(e)}}}class Kw extends le{static styles=[Ro,s`
|
|
2081
2081
|
textarea:invalid {
|
|
2082
2082
|
border: 2px solid var(--red);
|
|
2083
2083
|
background-color:var(--beige);
|