var yd=Object.defineProperty,xd=(s,e,t)=>e in s?yd(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,v=(s,e,t)=>(xd(s,typeof e!="symbol"?e+"":e,t),t);import{n as ot,g as Zl,V as bd,p as wd}from"./functions.33b21d67.js";import{V as Je,I as Hn,a as Gn,b as Es,c as ni,d as kt,e as yt,M as is,f as ss,v as Qa,p as ai,W as Ot,C as Qe,P as Ne,g as jn,R as dt,E as Qr,h as Ri,i as Pi,j as eo,T as en,k as Vn,A as Sd,l as Md,m as $l,n as As,o as Td,q as to}from"./vue.db4a895f.js";import{_ as Ls,d as Cd,c as Ed}from"./underscore.749ca8ba.js";import{P as Kl}from"./product-gallery.bab76ea5.js";function Wn(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wn=function(e){return typeof e}:Wn=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wn(s)}function Ad(s){return Ld(s)||Rd(s)||Pd()}function Ld(s){if(Array.isArray(s)){for(var e=0,t=new Array(s.length);e<s.length;e++)t[e]=s[e];return t}}function Rd(s){if(Symbol.iterator in Object(s)||Object.prototype.toString.call(s)==="[object Arguments]")return Array.from(s)}function Pd(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var qn=typeof window<"u";function Dd(s){return Array.isArray(s)||Wn(s)==="object"?Object.freeze(s):s}function Id(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s.reduce(function(t,i){var r=i.passengers[0],n=typeof r=="function"?r(e):i.passengers;return t.concat(n)},[])}function kd(s,e){return s.map(function(t,i){return[i,t]}).sort(function(t,i){return e(t[1],i[1])||t[0]-i[0]}).map(function(t){return t[1]})}function Jl(s,e){return e.reduce(function(t,i){return s.hasOwnProperty(i)&&(t[i]=s[i]),t},{})}var Ql={},Od={},Nd={},zd=Je.extend({data:function(){return{transports:Ql,targets:Od,sources:Nd,trackInstances:qn}},methods:{open:function(s){if(qn){var e=s.to,t=s.from,i=s.passengers,r=s.order,n=r===void 0?1/0:r;if(!(!e||!t||!i)){var a={to:e,from:t,passengers:Dd(i),order:n},o=Object.keys(this.transports);o.indexOf(e)===-1&&Je.set(this.transports,e,[]);var l=this.$_getTransportIndex(a),c=this.transports[e].slice(0);l===-1?c.push(a):c[l]=a,this.transports[e]=kd(c,function(h,u){return h.order-u.order})}}},close:function(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=s.to,i=s.from;if(!(!t||!i&&e===!1)&&this.transports[t])if(e)this.transports[t]=[];else{var r=this.$_getTransportIndex(s);if(r>=0){var n=this.transports[t].slice(0);n.splice(r,1),this.transports[t]=n}}},registerTarget:function(s,e,t){qn&&(this.trackInstances&&!t&&this.targets[s]&&console.warn("[portal-vue]: Target ".concat(s," already exists")),this.$set(this.targets,s,Object.freeze([e])))},unregisterTarget:function(s){this.$delete(this.targets,s)},registerSource:function(s,e,t){qn&&(this.trackInstances&&!t&&this.sources[s]&&console.warn("[portal-vue]: source ".concat(s," already exists")),this.$set(this.sources,s,Object.freeze([e])))},unregisterSource:function(s){this.$delete(this.sources,s)},hasTarget:function(s){return!!(this.targets[s]&&this.targets[s][0])},hasSource:function(s){return!!(this.sources[s]&&this.sources[s][0])},hasContentFor:function(s){return!!this.transports[s]&&!!this.transports[s].length},$_getTransportIndex:function(s){var e=s.to,t=s.from;for(var i in this.transports[e])if(this.transports[e][i].from===t)return+i;return-1}}}),oi=new zd(Ql),Bd=1,eh=Je.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(Bd++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(Math.random()*1e7))}}},created:function(){var s=this;this.$nextTick(function(){oi.registerSource(s.name,s)})},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){oi.unregisterSource(this.name),this.clear()},watch:{to:function(s,e){e&&e!==s&&this.clear(e),this.sendUpdate()}},methods:{clear:function(s){var e={from:this.name,to:s||this.to};oi.close(e)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(s){return typeof s=="function"?s(this.slotProps):s},sendUpdate:function(){var s=this.normalizeSlots();if(s){var e={from:this.name,to:this.to,passengers:Ad(s),order:this.order};oi.open(e)}else this.clear()}},render:function(s){var e=this.$slots.default||this.$scopedSlots.default||[],t=this.tag;return e&&this.disabled?e.length<=1&&this.slim?this.normalizeOwnChildren(e)[0]:s(t,[this.normalizeOwnChildren(e)]):this.slim?s():s(t,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),th=Je.extend({name:"portalTarget",props:{multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},data:function(){return{transports:oi.transports,firstRender:!0}},created:function(){var s=this;this.$nextTick(function(){oi.registerTarget(s.name,s)})},watch:{ownTransports:function(){this.$emit("change",this.children().length>0)},name:function(s,e){oi.unregisterTarget(e),oi.registerTarget(s,this)}},mounted:function(){var s=this;this.transition&&this.$nextTick(function(){s.firstRender=!1})},beforeDestroy:function(){oi.unregisterTarget(this.name)},computed:{ownTransports:function(){var s=this.transports[this.name]||[];return this.multiple?s:s.length===0?[]:[s[s.length-1]]},passengers:function(){return Id(this.ownTransports,this.slotProps)}},methods:{children:function(){return this.passengers.length!==0?this.passengers:this.$scopedSlots.default?this.$scopedSlots.default(this.slotProps):this.$slots.default||[]},noWrapper:function(){var s=this.slim&&!this.transition;return s&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),s}},render:function(s){var e=this.noWrapper(),t=this.children(),i=this.transition||this.tag;return e?t[0]:this.slim&&!i?s():s(i,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},t)}}),Ud=0,Fd=["disabled","name","order","slim","slotProps","tag","to"],Hd=["multiple","transition"],Gd=Je.extend({name:"MountingPortal",inheritAttrs:!1,props:{append:{type:[Boolean,String]},bail:{type:Boolean},mountTo:{type:String,required:!0},disabled:{type:Boolean},name:{type:String,default:function(){return"mounted_"+String(Ud++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(Math.random()*1e7))}},multiple:{type:Boolean,default:!1},targetSlim:{type:Boolean},targetSlotProps:{type:Object,default:function(){return{}}},targetTag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},created:function(){if(!(typeof document>"u")){var s=document.querySelector(this.mountTo);if(!s){console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document"));return}var e=this.$props;if(oi.targets[e.name]){e.bail?console.warn("[portal-vue]: Target ".concat(e.name,` is already mounted.
        Aborting because 'bail: true' is set`)):this.portalTarget=oi.targets[e.name];return}var t=e.append;if(t){var i=typeof t=="string"?t:"DIV",r=document.createElement(i);s.appendChild(r),s=r}var n=Jl(this.$props,Hd);n.slim=this.targetSlim,n.tag=this.targetTag,n.slotProps=this.targetSlotProps,n.name=this.to,this.portalTarget=new th({el:s,parent:this.$parent||this,propsData:n})}},beforeDestroy:function(){var s=this.portalTarget;if(this.append){var e=s.$el;e.parentNode.removeChild(e)}s.$destroy()},render:function(s){if(!this.portalTarget)return console.warn("[portal-vue] Target wasn't mounted"),s();if(!this.$scopedSlots.manual){var e=Jl(this.$props,Fd);return s(eh,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)}var t=this.$scopedSlots.manual({to:this.to});return Array.isArray(t)&&(t=t[0]),t||s()}});function jd(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};s.component(e.portalName||"Portal",eh),s.component(e.portalTargetName||"PortalTarget",th),s.component(e.MountingPortalName||"MountingPortal",Gd)}var Vd={install:jd};/**
 * @license
 * Copyright 2010-2022 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const io="142",ur={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},dr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Wd=0,ih=1,qd=2,sh=1,Xd=2,tn=3,Rs=0,li=1,Ps=2,Yd=1,rs=0,pr=1,rh=2,nh=3,ah=4,Zd=5,fr=100,$d=101,Kd=102,oh=103,lh=104,Jd=200,Qd=201,ep=202,tp=203,hh=204,ch=205,ip=206,sp=207,rp=208,np=209,ap=210,op=0,lp=1,hp=2,so=3,cp=4,up=5,dp=6,pp=7,uh=0,fp=1,mp=2,Di=0,gp=1,vp=2,_p=3,yp=4,xp=5,dh=300,mr=301,gr=302,ro=303,no=304,Xn=306,ns=1e3,ei=1001,Yn=1002,xt=1003,ao=1004,oo=1005,gt=1006,ph=1007,as=1008,Ds=1009,bp=1010,wp=1011,fh=1012,Sp=1013,Is=1014,os=1015,sn=1016,Mp=1017,Tp=1018,vr=1020,Cp=1021,Ep=1022,hi=1023,Ap=1024,Lp=1025,ks=1026,_r=1027,Rp=1028,Pp=1029,Dp=1030,Ip=1031,kp=1033,lo=33776,ho=33777,co=33778,uo=33779,mh=35840,gh=35841,vh=35842,_h=35843,Op=36196,yh=37492,xh=37496,bh=37808,wh=37809,Sh=37810,Mh=37811,Th=37812,Ch=37813,Eh=37814,Ah=37815,Lh=37816,Rh=37817,Ph=37818,Dh=37819,Ih=37820,kh=37821,Oh=36492,rn=2300,yr=2301,po=2302,Nh=2400,zh=2401,Bh=2402,Np=2500,zp=2501,Bp=1,Uh=2,Os=3e3,Xe=3001,Up=3200,Fp=3201,fo=0,Hp=1,Ii="srgb",Ns="srgb-linear",mo=7680,Gp=519,go=35044,Fh="300 es",vo=1035;class zs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let r=0,n=i.length;r<n;r++)i[r].call(this,e);e.target=null}}}const Ct=["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 Hh=1234567;const nn=Math.PI/180,an=180/Math.PI;function ci(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ct[s&255]+Ct[s>>8&255]+Ct[s>>16&255]+Ct[s>>24&255]+"-"+Ct[e&255]+Ct[e>>8&255]+"-"+Ct[e>>16&15|64]+Ct[e>>24&255]+"-"+Ct[t&63|128]+Ct[t>>8&255]+"-"+Ct[t>>16&255]+Ct[t>>24&255]+Ct[i&255]+Ct[i>>8&255]+Ct[i>>16&255]+Ct[i>>24&255]).toLowerCase()}function bt(s,e,t){return Math.max(e,Math.min(t,s))}function _o(s,e){return(s%e+e)%e}function jp(s,e,t,i,r){return i+(s-e)*(r-i)/(t-e)}function Vp(s,e,t){return s!==e?(t-s)/(e-s):0}function on(s,e,t){return(1-t)*s+t*e}function Wp(s,e,t,i){return on(s,e,1-Math.exp(-t*i))}function qp(s,e=1){return e-Math.abs(_o(s,e*2)-e)}function Xp(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Yp(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Zp(s,e){return s+Math.floor(Math.random()*(e-s+1))}function $p(s,e){return s+Math.random()*(e-s)}function Kp(s){return s*(.5-Math.random())}function Jp(s){s!==void 0&&(Hh=s);let e=Hh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Qp(s){return s*nn}function ef(s){return s*an}function yo(s){return(s&s-1)===0&&s!==0}function Gh(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Zn(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function tf(s,e,t,i,r){const n=Math.cos,a=Math.sin,o=n(t/2),l=a(t/2),c=n((e+i)/2),h=a((e+i)/2),u=n((e-i)/2),d=a((e-i)/2),p=n((i-e)/2),g=a((i-e)/2);switch(r){case"XYX":s.set(o*h,l*u,l*d,o*c);break;case"YZY":s.set(l*d,o*h,l*u,o*c);break;case"ZXZ":s.set(l*u,l*d,o*h,o*c);break;case"XZX":s.set(o*h,l*g,l*p,o*c);break;case"YXY":s.set(l*p,o*h,l*g,o*c);break;case"ZYZ":s.set(l*g,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function sf(s,e){switch(e.constructor){case Float32Array:return s;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function rf(s,e){switch(e.constructor){case Float32Array:return s;case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}var jh=Object.freeze({__proto__:null,DEG2RAD:nn,RAD2DEG:an,generateUUID:ci,clamp:bt,euclideanModulo:_o,mapLinear:jp,inverseLerp:Vp,lerp:on,damp:Wp,pingpong:qp,smoothstep:Xp,smootherstep:Yp,randInt:Zp,randFloat:$p,randFloatSpread:Kp,seededRandom:Jp,degToRad:Qp,radToDeg:ef,isPowerOfTwo:yo,ceilPowerOfTwo:Gh,floorPowerOfTwo:Zn,setQuaternionFromProperEuler:tf,normalize:rf,denormalize:sf});class we{constructor(e=0,t=0){we.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){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,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ri{constructor(){ri.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,r,n,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=n,h[5]=l,h[6]=i,h[7]=a,h[8]=c,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,r=t.elements,n=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],h=i[4],u=i[7],d=i[2],p=i[5],g=i[8],m=r[0],f=r[3],_=r[6],y=r[1],A=r[4],b=r[7],S=r[2],D=r[5],O=r[8];return n[0]=a*m+o*y+l*S,n[3]=a*f+o*A+l*D,n[6]=a*_+o*b+l*O,n[1]=c*m+h*y+u*S,n[4]=c*f+h*A+u*D,n[7]=c*_+h*b+u*O,n[2]=d*m+p*y+g*S,n[5]=d*f+p*A+g*D,n[8]=d*_+p*b+g*O,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],r=e[2],n=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-i*n*h+i*o*l+r*n*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*n,p=c*n-a*l,g=t*u+i*d+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return e[0]=u*m,e[1]=(r*c-h*i)*m,e[2]=(o*i-r*a)*m,e[3]=d*m,e[4]=(h*t-r*l)*m,e[5]=(r*n-o*t)*m,e[6]=p*m,e[7]=(i*l-c*t)*m,e[8]=(a*t-i*n)*m,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,r,n,a,o){const l=Math.cos(n),c=Math.sin(n);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),r=this.elements,n=r[0],a=r[3],o=r[6],l=r[1],c=r[4],h=r[7];return r[0]=t*n+i*l,r[3]=t*a+i*c,r[6]=t*o+i*h,r[1]=-i*n+t*l,r[4]=-i*a+t*c,r[7]=-i*o+t*h,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])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)}}function Vh(s){for(let e=s.length-1;e>=0;--e)if(s[e]>65535)return!0;return!1}function ln(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Bs(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function $n(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}const xo={[Ii]:{[Ns]:Bs},[Ns]:{[Ii]:$n}},ui={legacyMode:!0,get workingColorSpace(){return Ns},set workingColorSpace(s){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(s,e,t){if(this.legacyMode||e===t||!e||!t)return s;if(xo[e]&&xo[e][t]!==void 0){const i=xo[e][t];return s.r=i(s.r),s.g=i(s.g),s.b=i(s.b),s}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(s,e){return this.convert(s,this.workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this.workingColorSpace)}},Wh={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},ft={r:0,g:0,b:0},di={h:0,s:0,l:0},Kn={h:0,s:0,l:0};function bo(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}function Jn(s,e){return e.r=s.r,e.g=s.g,e.b=s.b,e}class be{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ii){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ui.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ns){return this.r=e,this.g=t,this.b=i,ui.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ns){if(e=_o(e,1),t=bt(t,0,1),i=bt(i,0,1),t===0)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=bo(a,n,e+1/3),this.g=bo(a,n,e),this.b=bo(a,n,e-1/3)}return ui.toWorkingColorSpace(this,r),this}setStyle(e,t=Ii){function i(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let n;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,ui.toWorkingColorSpace(this,t),i(n[4]),this;if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,ui.toWorkingColorSpace(this,t),i(n[4]),this;break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return i(n[4]),this.setHSL(l,c,h,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=r[1],a=n.length;if(a===3)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,ui.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,ui.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ii){const i=Wh[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Bs(e.r),this.g=Bs(e.g),this.b=Bs(e.b),this}copyLinearToSRGB(e){return this.r=$n(e.r),this.g=$n(e.g),this.b=$n(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ii){return ui.fromWorkingColorSpace(Jn(this,ft),e),bt(ft.r*255,0,255)<<16^bt(ft.g*255,0,255)<<8^bt(ft.b*255,0,255)<<0}getHexString(e=Ii){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ns){ui.fromWorkingColorSpace(Jn(this,ft),t);const i=ft.r,r=ft.g,n=ft.b,a=Math.max(i,r,n),o=Math.min(i,r,n);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case i:l=(r-n)/u+(r<n?6:0);break;case r:l=(n-i)/u+2;break;case n:l=(i-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Ns){return ui.fromWorkingColorSpace(Jn(this,ft),t),e.r=ft.r,e.g=ft.g,e.b=ft.b,e}getStyle(e=Ii){return ui.fromWorkingColorSpace(Jn(this,ft),e),e!==Ii?`color(${e} ${ft.r} ${ft.g} ${ft.b})`:`rgb(${ft.r*255|0},${ft.g*255|0},${ft.b*255|0})`}offsetHSL(e,t,i){return this.getHSL(di),di.h+=e,di.s+=t,di.l+=i,this.setHSL(di.h,di.s,di.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,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(di),e.getHSL(Kn);const i=on(di.h,Kn.h,t),r=on(di.s,Kn.s,t),n=on(di.l,Kn.l,t);return this.setHSL(i,r,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),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}be.NAMES=Wh;let xr;class qh{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xr===void 0&&(xr=ln("canvas")),xr.width=e.width,xr.height=e.height;const i=xr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=xr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ln("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let a=0;a<n.length;a++)n[a]=Bs(n[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Bs(t[i]/255)*255):t[i]=Bs(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class Xh{constructor(e=null){this.isSource=!0,this.uuid=ci(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let n;if(Array.isArray(r)){n=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?n.push(wo(r[a].image)):n.push(wo(r[a]))}else n=wo(r);i.url=n}return t||(e.images[this.uuid]=i),i}}function wo(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?qh.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let nf=0;class ht extends zs{constructor(e=ht.DEFAULT_IMAGE,t=ht.DEFAULT_MAPPING,i=ei,r=ei,n=gt,a=as,o=hi,l=Ds,c=1,h=Os){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nf++}),this.uuid=ci(),this.name="",this.source=new Xh(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=n,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new we(0,0),this.repeat=new we(1,1),this.center=new we(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ri,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}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)}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.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==dh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ns:e.x=e.x-Math.floor(e.x);break;case ei:e.x=e.x<0?0:1;break;case Yn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ns:e.y=e.y-Math.floor(e.y);break;case ei:e.y=e.y<0?0:1;break;case Yn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}ht.DEFAULT_IMAGE=null,ht.DEFAULT_MAPPING=dh;class je{constructor(e=0,t=0,i=0,r=1){je.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}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,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,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,r,n;const a=e.elements,o=a[0],l=a[4],c=a[8],h=a[1],u=a[5],d=a[9],p=a[2],g=a[6],m=a[10];if(Math.abs(l-h)<.01&&Math.abs(c-p)<.01&&Math.abs(d-g)<.01){if(Math.abs(l+h)<.1&&Math.abs(c+p)<.1&&Math.abs(d+g)<.1&&Math.abs(o+u+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(o+1)/2,y=(u+1)/2,A=(m+1)/2,b=(l+h)/4,S=(c+p)/4,D=(d+g)/4;return _>y&&_>A?_<.01?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(_),r=b/i,n=S/i):y>A?y<.01?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(y),i=b/r,n=D/r):A<.01?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(A),i=S/n,r=D/n),this.set(i,r,n,t),this}let f=Math.sqrt((g-d)*(g-d)+(c-p)*(c-p)+(h-l)*(h-l));return Math.abs(f)<.001&&(f=1),this.x=(g-d)/f,this.y=(c-p)/f,this.z=(h-l)/f,this.w=Math.acos((o+u+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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,i){return i!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Us extends zs{constructor(e,t,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new je(0,0,e,t),this.scissorTest=!1,this.viewport=new je(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new ht(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:gt,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,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.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Xh(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Yh extends ht{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=ei,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class af extends ht{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=ei,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerp(e,t,i,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,r)}static slerpFlat(e,t,i,r,n,a,o){let l=i[r+0],c=i[r+1],h=i[r+2],u=i[r+3];const d=n[a+0],p=n[a+1],g=n[a+2],m=n[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=g,e[t+3]=m;return}if(u!==m||l!==d||c!==p||h!==g){let f=1-o;const _=l*d+c*p+h*g+u*m,y=_>=0?1:-1,A=1-_*_;if(A>Number.EPSILON){const S=Math.sqrt(A),D=Math.atan2(S,_*y);f=Math.sin(f*D)/S,o=Math.sin(o*D)/S}const b=o*y;if(l=l*f+d*b,c=c*f+p*b,h=h*f+g*b,u=u*f+m*b,f===1-o){const S=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=S,c*=S,h*=S,u*=S}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,n,a){const o=i[r],l=i[r+1],c=i[r+2],h=i[r+3],u=n[a],d=n[a+1],p=n[a+2],g=n[a+3];return e[t]=o*g+h*u+l*p-c*d,e[t+1]=l*g+h*d+c*u-o*p,e[t+2]=c*g+h*p+o*d-l*u,e[t+3]=h*g-o*u-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=e._x,r=e._y,n=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),h=o(r/2),u=o(n/2),d=l(i/2),p=l(r/2),g=l(n/2);switch(a){case"XYZ":this._x=d*h*u+c*p*g,this._y=c*p*u-d*h*g,this._z=c*h*g+d*p*u,this._w=c*h*u-d*p*g;break;case"YXZ":this._x=d*h*u+c*p*g,this._y=c*p*u-d*h*g,this._z=c*h*g-d*p*u,this._w=c*h*u+d*p*g;break;case"ZXY":this._x=d*h*u-c*p*g,this._y=c*p*u+d*h*g,this._z=c*h*g+d*p*u,this._w=c*h*u-d*p*g;break;case"ZYX":this._x=d*h*u-c*p*g,this._y=c*p*u+d*h*g,this._z=c*h*g-d*p*u,this._w=c*h*u+d*p*g;break;case"YZX":this._x=d*h*u+c*p*g,this._y=c*p*u+d*h*g,this._z=c*h*g-d*p*u,this._w=c*h*u-d*p*g;break;case"XZY":this._x=d*h*u-c*p*g,this._y=c*p*u-d*h*g,this._z=c*h*g+d*p*u,this._w=c*h*u+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],n=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=i+o+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(h-l)*p,this._y=(n-c)*p,this._z=(a-r)*p}else if(i>o&&i>u){const p=2*Math.sqrt(1+i-o-u);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(n+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-i-u);this._w=(n-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+u-i-o);this._w=(a-r)/p,this._x=(n+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(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(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,n=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+a*o+r*c-n*l,this._y=r*h+a*l+n*o-i*c,this._z=n*h+a*c+i*l-r*o,this._w=a*h-i*o-r*l-n*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,n=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=n,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*n+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=i*u+this._x*d,this._y=r*u+this._y*d,this._z=n*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),n=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(n),i*Math.cos(n),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class L{constructor(e=0,t=0,i=0){L.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Zh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Zh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,h=l*i+o*t-n*r,u=l*r+n*i-a*t,d=-n*t-a*i-o*r;return this.x=c*l+d*-n+h*-o-u*-a,this.y=h*l+d*-a+u*-n-c*-o,this.z=u*l+d*-o+c*-a-h*-n,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,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,n=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-n*o,this.y=n*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return So.copy(this).projectOnVector(e),this.sub(So)}reflect(e){return this.sub(So.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(bt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,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,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const So=new L,Zh=new pi;class bi{constructor(e=new L(1/0,1/0,1/0),t=new L(-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){let t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.length;l<c;l+=3){const h=e[l],u=e[l+1],d=e[l+2];h<t&&(t=h),u<i&&(i=u),d<r&&(r=d),h>n&&(n=h),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,i,r),this.max.set(n,a,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.count;l<c;l++){const h=e.getX(l),u=e.getY(l),d=e.getZ(l);h<t&&(t=h),u<i&&(i=u),d<r&&(r=d),h>n&&(n=h),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,i,r),this.max.set(n,a,o),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=Fs.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(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){const n=i.attributes.position;for(let a=0,o=n.count;a<o;a++)Fs.fromBufferAttribute(n,a).applyMatrix4(e.matrixWorld),this.expandByPoint(Fs)}else i.boundingBox===null&&i.computeBoundingBox(),Mo.copy(i.boundingBox),Mo.applyMatrix4(e.matrixWorld),this.union(Mo);const r=e.children;for(let n=0,a=r.length;n<a;n++)this.expandByObject(r[n],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,Fs),Fs.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(hn),Qn.subVectors(this.max,hn),br.subVectors(e.a,hn),wr.subVectors(e.b,hn),Sr.subVectors(e.c,hn),ls.subVectors(wr,br),hs.subVectors(Sr,wr),Hs.subVectors(br,Sr);let t=[0,-ls.z,ls.y,0,-hs.z,hs.y,0,-Hs.z,Hs.y,ls.z,0,-ls.x,hs.z,0,-hs.x,Hs.z,0,-Hs.x,-ls.y,ls.x,0,-hs.y,hs.x,0,-Hs.y,Hs.x,0];return!To(t,br,wr,Sr,Qn)||(t=[1,0,0,0,1,0,0,0,1],!To(t,br,wr,Sr,Qn))?!1:(ea.crossVectors(ls,hs),t=[ea.x,ea.y,ea.z],To(t,br,wr,Sr,Qn))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Fs.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Fs).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ki[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ki[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ki[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ki[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ki[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ki[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ki[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ki[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ki),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)}}const ki=[new L,new L,new L,new L,new L,new L,new L,new L],Fs=new L,Mo=new bi,br=new L,wr=new L,Sr=new L,ls=new L,hs=new L,Hs=new L,hn=new L,Qn=new L,ea=new L,Gs=new L;function To(s,e,t,i,r){for(let n=0,a=s.length-3;n<=a;n+=3){Gs.fromArray(s,n);const o=r.x*Math.abs(Gs.x)+r.y*Math.abs(Gs.y)+r.z*Math.abs(Gs.z),l=e.dot(Gs),c=t.dot(Gs),h=i.dot(Gs);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const of=new bi,$h=new L,ta=new L,Co=new L;class cs{constructor(e=new L,t=-1){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;t!==void 0?i.copy(t):of.setFromPoints(e).getCenter(i);let r=0;for(let n=0,a=e.length;n<a;n++)r=Math.max(r,i.distanceToSquared(e[n]));return this.radius=Math.sqrt(r),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){Co.subVectors(e,this.center);const t=Co.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.add(Co.multiplyScalar(r/i)),this.radius+=r}return this}union(e){return this.center.equals(e.center)===!0?ta.set(0,0,1).multiplyScalar(e.radius):ta.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint($h.copy(e.center).add(ta)),this.expandByPoint($h.copy(e.center).sub(ta)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Oi=new L,Eo=new L,ia=new L,us=new L,Ao=new L,sa=new L,Lo=new L;class ra{constructor(e=new L,t=new L(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Oi)),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.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Oi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Oi.copy(this.direction).multiplyScalar(t).add(this.origin),Oi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Eo.copy(e).add(t).multiplyScalar(.5),ia.copy(t).sub(e).normalize(),us.copy(this.origin).sub(Eo);const n=e.distanceTo(t)*.5,a=-this.direction.dot(ia),o=us.dot(this.direction),l=-us.dot(ia),c=us.lengthSq(),h=Math.abs(1-a*a);let u,d,p,g;if(h>0)if(u=a*l-o,d=a*o-l,g=n*h,u>=0)if(d>=-g)if(d<=g){const m=1/h;u*=m,d*=m,p=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=n,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d=-n,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d<=-g?(u=Math.max(0,-(-a*n+o)),d=u>0?-n:Math.min(Math.max(-n,-l),n),p=-u*u+d*(d+2*l)+c):d<=g?(u=0,d=Math.min(Math.max(-n,-l),n),p=d*(d+2*l)+c):(u=Math.max(0,-(a*n+o)),d=u>0?n:Math.min(Math.max(-n,-l),n),p=-u*u+d*(d+2*l)+c);else d=a>0?-n:n,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(ia).multiplyScalar(d).add(Eo),p}intersectSphere(e,t){Oi.subVectors(e.center,this.origin);const i=Oi.dot(this.direction),r=Oi.dot(Oi)-i*i,n=e.radius*e.radius;if(r>n)return null;const a=Math.sqrt(n-r),o=i-a,l=i+a;return o<0&&l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?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 i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,n,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),h>=0?(n=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(n=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),i>a||n>r||((n>i||i!==i)&&(i=n),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Oi)!==null}intersectTriangle(e,t,i,r,n){Ao.subVectors(t,e),sa.subVectors(i,e),Lo.crossVectors(Ao,sa);let a=this.direction.dot(Lo),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;us.subVectors(this.origin,e);const l=o*this.direction.dot(sa.crossVectors(us,sa));if(l<0)return null;const c=o*this.direction.dot(Ao.cross(us));if(c<0||l+c>a)return null;const h=-o*us.dot(Lo);return h<0?null:this.at(h/a,n)}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 He{constructor(){He.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,r,n,a,o,l,c,h,u,d,p,g,m,f){const _=this.elements;return _[0]=e,_[4]=t,_[8]=i,_[12]=r,_[1]=n,_[5]=a,_[9]=o,_[13]=l,_[2]=c,_[6]=h,_[10]=u,_[14]=d,_[3]=p,_[7]=g,_[11]=m,_[15]=f,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 He().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 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){const t=this.elements,i=e.elements,r=1/Mr.setFromMatrixColumn(e,0).length(),n=1/Mr.setFromMatrixColumn(e,1).length(),a=1/Mr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),h=Math.cos(n),u=Math.sin(n);if(e.order==="XYZ"){const d=a*h,p=a*u,g=o*h,m=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=p+g*c,t[5]=d-m*c,t[9]=-o*l,t[2]=m-d*c,t[6]=g+p*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,p=l*u,g=c*h,m=c*u;t[0]=d+m*o,t[4]=g*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=p*o-g,t[6]=m+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,p=l*u,g=c*h,m=c*u;t[0]=d-m*o,t[4]=-a*u,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*h,t[9]=m-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,p=a*u,g=o*h,m=o*u;t[0]=l*h,t[4]=g*c-p,t[8]=d*c+m,t[1]=l*u,t[5]=m*c+d,t[9]=p*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,p=a*c,g=o*l,m=o*c;t[0]=l*h,t[4]=m-d*u,t[8]=g*u+p,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*u+g,t[10]=d-m*u}else if(e.order==="XZY"){const d=a*l,p=a*c,g=o*l,m=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+m,t[5]=a*h,t[9]=p*u-g,t[2]=g*u-p,t[6]=o*h,t[10]=m*u+d}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(lf,e,hf)}lookAt(e,t,i){const r=this.elements;return Kt.subVectors(e,t),Kt.lengthSq()===0&&(Kt.z=1),Kt.normalize(),ds.crossVectors(i,Kt),ds.lengthSq()===0&&(Math.abs(i.z)===1?Kt.x+=1e-4:Kt.z+=1e-4,Kt.normalize(),ds.crossVectors(i,Kt)),ds.normalize(),na.crossVectors(Kt,ds),r[0]=ds.x,r[4]=na.x,r[8]=Kt.x,r[1]=ds.y,r[5]=na.y,r[9]=Kt.y,r[2]=ds.z,r[6]=na.z,r[10]=Kt.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,n=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],h=i[1],u=i[5],d=i[9],p=i[13],g=i[2],m=i[6],f=i[10],_=i[14],y=i[3],A=i[7],b=i[11],S=i[15],D=r[0],O=r[4],M=r[8],R=r[12],N=r[1],I=r[5],K=r[9],$=r[13],k=r[2],W=r[6],U=r[10],Z=r[14],Y=r[3],F=r[7],G=r[11],te=r[15];return n[0]=a*D+o*N+l*k+c*Y,n[4]=a*O+o*I+l*W+c*F,n[8]=a*M+o*K+l*U+c*G,n[12]=a*R+o*$+l*Z+c*te,n[1]=h*D+u*N+d*k+p*Y,n[5]=h*O+u*I+d*W+p*F,n[9]=h*M+u*K+d*U+p*G,n[13]=h*R+u*$+d*Z+p*te,n[2]=g*D+m*N+f*k+_*Y,n[6]=g*O+m*I+f*W+_*F,n[10]=g*M+m*K+f*U+_*G,n[14]=g*R+m*$+f*Z+_*te,n[3]=y*D+A*N+b*k+S*Y,n[7]=y*O+A*I+b*W+S*F,n[11]=y*M+A*K+b*U+S*G,n[15]=y*R+A*$+b*Z+S*te,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],r=e[8],n=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],p=e[14],g=e[3],m=e[7],f=e[11],_=e[15];return g*(+n*l*u-r*c*u-n*o*d+i*c*d+r*o*p-i*l*p)+m*(+t*l*p-t*c*d+n*a*d-r*a*p+r*c*h-n*l*h)+f*(+t*c*u-t*o*p-n*a*u+i*a*p+n*o*h-i*c*h)+_*(-r*o*h-t*l*u+t*o*d+r*a*u-i*a*d+i*l*h)}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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],p=e[11],g=e[12],m=e[13],f=e[14],_=e[15],y=u*f*c-m*d*c+m*l*p-o*f*p-u*l*_+o*d*_,A=g*d*c-h*f*c-g*l*p+a*f*p+h*l*_-a*d*_,b=h*m*c-g*u*c+g*o*p-a*m*p-h*o*_+a*u*_,S=g*u*l-h*m*l-g*o*d+a*m*d+h*o*f-a*u*f,D=t*y+i*A+r*b+n*S;if(D===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/D;return e[0]=y*O,e[1]=(m*d*n-u*f*n-m*r*p+i*f*p+u*r*_-i*d*_)*O,e[2]=(o*f*n-m*l*n+m*r*c-i*f*c-o*r*_+i*l*_)*O,e[3]=(u*l*n-o*d*n-u*r*c+i*d*c+o*r*p-i*l*p)*O,e[4]=A*O,e[5]=(h*f*n-g*d*n+g*r*p-t*f*p-h*r*_+t*d*_)*O,e[6]=(g*l*n-a*f*n-g*r*c+t*f*c+a*r*_-t*l*_)*O,e[7]=(a*d*n-h*l*n+h*r*c-t*d*c-a*r*p+t*l*p)*O,e[8]=b*O,e[9]=(g*u*n-h*m*n-g*i*p+t*m*p+h*i*_-t*u*_)*O,e[10]=(a*m*n-g*o*n+g*i*c-t*m*c-a*i*_+t*o*_)*O,e[11]=(h*o*n-a*u*n-h*i*c+t*u*c+a*i*p-t*o*p)*O,e[12]=S*O,e[13]=(h*m*r-g*u*r+g*i*d-t*m*d-h*i*f+t*u*f)*O,e[14]=(g*o*r-a*m*r-g*i*l+t*m*l+a*i*f-t*o*f)*O,e[15]=(a*u*r-h*o*r+h*i*l-t*u*l-a*i*d+t*o*d)*O,this}scale(e){const t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return 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),r=Math.sin(t),n=1-i,a=e.x,o=e.y,l=e.z,c=n*a,h=n*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+i,h*l-r*a,0,c*l-r*o,h*l+r*a,n*l*l+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,r,n,a){return this.set(1,i,n,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,n=t._x,a=t._y,o=t._z,l=t._w,c=n+n,h=a+a,u=o+o,d=n*c,p=n*h,g=n*u,m=a*h,f=a*u,_=o*u,y=l*c,A=l*h,b=l*u,S=i.x,D=i.y,O=i.z;return r[0]=(1-(m+_))*S,r[1]=(p+b)*S,r[2]=(g-A)*S,r[3]=0,r[4]=(p-b)*D,r[5]=(1-(d+_))*D,r[6]=(f+y)*D,r[7]=0,r[8]=(g+A)*O,r[9]=(f-y)*O,r[10]=(1-(d+m))*O,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let n=Mr.set(r[0],r[1],r[2]).length();const a=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(n=-n),e.x=r[12],e.y=r[13],e.z=r[14],fi.copy(this);const l=1/n,c=1/a,h=1/o;return fi.elements[0]*=l,fi.elements[1]*=l,fi.elements[2]*=l,fi.elements[4]*=c,fi.elements[5]*=c,fi.elements[6]*=c,fi.elements[8]*=h,fi.elements[9]*=h,fi.elements[10]*=h,t.setFromRotationMatrix(fi),i.x=n,i.y=a,i.z=o,this}makePerspective(e,t,i,r,n,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,l=2*n/(t-e),c=2*n/(i-r),h=(t+e)/(t-e),u=(i+r)/(i-r),d=-(a+n)/(a-n),p=-2*a*n/(a-n);return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,r,n,a){const o=this.elements,l=1/(t-e),c=1/(i-r),h=1/(a-n),u=(t+e)*l,d=(i+r)*c,p=(a+n)*h;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])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 Mr=new L,fi=new He,lf=new L(0,0,0),hf=new L(1,1,1),ds=new L,na=new L,Kt=new L,Kh=new He,Jh=new pi;class Bn{constructor(e=0,t=0,i=0,r=Bn.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,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 r=e.elements,n=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(bt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,n));break;case"ZYX":this._y=Math.asin(-bt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,n)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,n)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Kh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Kh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jh.setFromEuler(this),this.setFromQuaternion(Jh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Bn.DefaultOrder="XYZ",Bn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ro{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let cf=0;const Qh=new L,Tr=new pi,Ni=new He,aa=new L,cn=new L,uf=new L,df=new pi,ec=new L(1,0,0),tc=new L(0,1,0),ic=new L(0,0,1),pf={type:"added"},sc={type:"removed"};class rt extends zs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cf++}),this.uuid=ci(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rt.DefaultUp.clone();const e=new L,t=new Bn,i=new pi,r=new L(1,1,1);function n(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(n),i._onChange(a),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:r},modelViewMatrix:{value:new He},normalMatrix:{value:new ri}}),this.matrix=new He,this.matrixWorld=new He,this.matrixAutoUpdate=rt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ro,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Tr.setFromAxisAngle(e,t),this.quaternion.multiply(Tr),this}rotateOnWorldAxis(e,t){return Tr.setFromAxisAngle(e,t),this.quaternion.premultiply(Tr),this}rotateX(e){return this.rotateOnAxis(ec,e)}rotateY(e){return this.rotateOnAxis(tc,e)}rotateZ(e){return this.rotateOnAxis(ic,e)}translateOnAxis(e,t){return Qh.copy(e).applyQuaternion(this.quaternion),this.position.add(Qh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ec,e)}translateY(e){return this.translateOnAxis(tc,e)}translateZ(e){return this.translateOnAxis(ic,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Ni.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?aa.copy(e):aa.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),cn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ni.lookAt(cn,aa,this.up):Ni.lookAt(aa,cn,this.up),this.quaternion.setFromRotationMatrix(Ni),r&&(Ni.extractRotation(r.matrixWorld),Tr.setFromRotationMatrix(Ni),this.quaternion.premultiply(Tr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(pf)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(sc)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(sc)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Ni.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ni.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ni),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const n=this.children[i].getObjectByProperty(e,t);if(n!==void 0)return n}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cn,e,uf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cn,df,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,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let n=0,a=r.length;n<a;n++)r[n].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function n(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=n(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];n(e.shapes,u)}else n(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(n(e.materials,this.material[l]));r.material=o}else r.material=n(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(n(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}rt.DefaultUp=new L(0,1,0),rt.DefaultMatrixAutoUpdate=!0;const mi=new L,zi=new L,Po=new L,Bi=new L,Cr=new L,Er=new L,rc=new L,Do=new L,Io=new L,ko=new L;class Ji{constructor(e=new L,t=new L,i=new L){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),mi.subVectors(e,t),r.cross(mi);const n=r.lengthSq();return n>0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){mi.subVectors(r,t),zi.subVectors(i,t),Po.subVectors(e,t);const a=mi.dot(mi),o=mi.dot(zi),l=mi.dot(Po),c=zi.dot(zi),h=zi.dot(Po),u=a*c-o*o;if(u===0)return n.set(-2,-1,-1);const d=1/u,p=(c*l-o*h)*d,g=(a*h-o*l)*d;return n.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Bi),Bi.x>=0&&Bi.y>=0&&Bi.x+Bi.y<=1}static getUV(e,t,i,r,n,a,o,l){return this.getBarycoord(e,t,i,r,Bi),l.set(0,0),l.addScaledVector(n,Bi.x),l.addScaledVector(a,Bi.y),l.addScaledVector(o,Bi.z),l}static isFrontFacing(e,t,i,r){return mi.subVectors(i,t),zi.subVectors(e,t),mi.cross(zi).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mi.subVectors(this.c,this.b),zi.subVectors(this.a,this.b),mi.cross(zi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ji.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ji.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,n){return Ji.getUV(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return Ji.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ji.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,n=this.c;let a,o;Cr.subVectors(r,i),Er.subVectors(n,i),Do.subVectors(e,i);const l=Cr.dot(Do),c=Er.dot(Do);if(l<=0&&c<=0)return t.copy(i);Io.subVectors(e,r);const h=Cr.dot(Io),u=Er.dot(Io);if(h>=0&&u<=h)return t.copy(r);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(i).addScaledVector(Cr,a);ko.subVectors(e,n);const p=Cr.dot(ko),g=Er.dot(ko);if(g>=0&&p<=g)return t.copy(n);const m=p*c-l*g;if(m<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(Er,o);const f=h*g-p*u;if(f<=0&&u-h>=0&&p-g>=0)return rc.subVectors(n,r),o=(u-h)/(u-h+(p-g)),t.copy(r).addScaledVector(rc,o);const _=1/(f+m+d);return a=m*_,o=d*_,t.copy(i).addScaledVector(Cr,a).addScaledVector(Er,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let ff=0;class gi extends zs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ff++}),this.uuid=ci(),this.name="",this.type="Material",this.blending=pr,this.side=Rs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=hh,this.blendDst=ch,this.blendEquation=fr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=so,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Gp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=mo,this.stencilZFail=mo,this.stencilZPass=mo,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===Yd;continue}const r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(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),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,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==pr&&(i.blending=this.blending),this.side!==Rs&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function r(n){const a=[];for(const o in n){const l=n[o];delete l.metadata,a.push(l)}return a}if(t){const n=r(e.textures),a=r(e.images);n.length>0&&(i.textures=n),a.length>0&&(i.images=a)}return i}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.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(t!==null){const r=t.length;i=new Array(r);for(let n=0;n!==r;++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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ui extends gi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=uh,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.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 pt=new L,oa=new we;class Et{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=go,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let i=0;for(let r=0,n=e.length;r<n;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new be),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this}copyVector2sArray(e){const t=this.array;let i=0;for(let r=0,n=e.length;r<n;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new we),t[i++]=a.x,t[i++]=a.y}return this}copyVector3sArray(e){const t=this.array;let i=0;for(let r=0,n=e.length;r<n;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new L),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this}copyVector4sArray(e){const t=this.array;let i=0;for(let r=0,n=e.length;r<n;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new je),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)oa.fromBufferAttribute(this,t),oa.applyMatrix3(e),this.setXY(t,oa.x,oa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)pt.fromBufferAttribute(this,t),pt.applyMatrix3(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)pt.fromBufferAttribute(this,t),pt.applyMatrix4(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)pt.fromBufferAttribute(this,t),pt.applyNormalMatrix(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)pt.fromBufferAttribute(this,t),pt.transformDirection(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,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),this.usage!==go&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}class nc extends Et{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class ac extends Et{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Fe extends Et{constructor(e,t,i){super(new Float32Array(e),t,i)}}let mf=0;const ti=new He,Oo=new rt,Ar=new L,Jt=new bi,un=new bi,vt=new L;class lt extends zs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mf++}),this.uuid=ci(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Vh(e)?ac:nc)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,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;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const n=new ri().getNormalMatrix(e);i.applyNormalMatrix(n),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ti.makeRotationFromQuaternion(e),this.applyMatrix4(ti),this}rotateX(e){return ti.makeRotationX(e),this.applyMatrix4(ti),this}rotateY(e){return ti.makeRotationY(e),this.applyMatrix4(ti),this}rotateZ(e){return ti.makeRotationZ(e),this.applyMatrix4(ti),this}translate(e,t,i){return ti.makeTranslation(e,t,i),this.applyMatrix4(ti),this}scale(e,t,i){return ti.makeScale(e,t,i),this.applyMatrix4(ti),this}lookAt(e){return Oo.lookAt(e),Oo.updateMatrix(),this.applyMatrix4(Oo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ar).negate(),this.translate(Ar.x,Ar.y,Ar.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const n=e[i];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new Fe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const n=t[i];Jt.setFromBufferAttribute(n),this.morphTargetsRelative?(vt.addVectors(this.boundingBox.min,Jt.min),this.boundingBox.expandByPoint(vt),vt.addVectors(this.boundingBox.max,Jt.max),this.boundingBox.expandByPoint(vt)):(this.boundingBox.expandByPoint(Jt.min),this.boundingBox.expandByPoint(Jt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new cs);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new L,1/0);return}if(e){const i=this.boundingSphere.center;if(Jt.setFromBufferAttribute(e),t)for(let n=0,a=t.length;n<a;n++){const o=t[n];un.setFromBufferAttribute(o),this.morphTargetsRelative?(vt.addVectors(Jt.min,un.min),Jt.expandByPoint(vt),vt.addVectors(Jt.max,un.max),Jt.expandByPoint(vt)):(Jt.expandByPoint(un.min),Jt.expandByPoint(un.max))}Jt.getCenter(i);let r=0;for(let n=0,a=e.count;n<a;n++)vt.fromBufferAttribute(e,n),r=Math.max(r,i.distanceToSquared(vt));if(t)for(let n=0,a=t.length;n<a;n++){const o=t[n],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)vt.fromBufferAttribute(o,c),l&&(Ar.fromBufferAttribute(e,c),vt.add(Ar)),r=Math.max(r,i.distanceToSquared(vt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.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(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,n=t.normal.array,a=t.uv.array,o=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Et(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],h=[];for(let N=0;N<o;N++)c[N]=new L,h[N]=new L;const u=new L,d=new L,p=new L,g=new we,m=new we,f=new we,_=new L,y=new L;function A(N,I,K){u.fromArray(r,N*3),d.fromArray(r,I*3),p.fromArray(r,K*3),g.fromArray(a,N*2),m.fromArray(a,I*2),f.fromArray(a,K*2),d.sub(u),p.sub(u),m.sub(g),f.sub(g);const $=1/(m.x*f.y-f.x*m.y);isFinite($)&&(_.copy(d).multiplyScalar(f.y).addScaledVector(p,-m.y).multiplyScalar($),y.copy(p).multiplyScalar(m.x).addScaledVector(d,-f.x).multiplyScalar($),c[N].add(_),c[I].add(_),c[K].add(_),h[N].add(y),h[I].add(y),h[K].add(y))}let b=this.groups;b.length===0&&(b=[{start:0,count:i.length}]);for(let N=0,I=b.length;N<I;++N){const K=b[N],$=K.start,k=K.count;for(let W=$,U=$+k;W<U;W+=3)A(i[W+0],i[W+1],i[W+2])}const S=new L,D=new L,O=new L,M=new L;function R(N){O.fromArray(n,N*3),M.copy(O);const I=c[N];S.copy(I),S.sub(O.multiplyScalar(O.dot(I))).normalize(),D.crossVectors(M,I);const K=D.dot(h[N])<0?-1:1;l[N*4]=S.x,l[N*4+1]=S.y,l[N*4+2]=S.z,l[N*4+3]=K}for(let N=0,I=b.length;N<I;++N){const K=b[N],$=K.start,k=K.count;for(let W=$,U=$+k;W<U;W+=3)R(i[W+0]),R(i[W+1]),R(i[W+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Et(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const r=new L,n=new L,a=new L,o=new L,l=new L,c=new L,h=new L,u=new L;if(e)for(let d=0,p=e.count;d<p;d+=3){const g=e.getX(d+0),m=e.getX(d+1),f=e.getX(d+2);r.fromBufferAttribute(t,g),n.fromBufferAttribute(t,m),a.fromBufferAttribute(t,f),h.subVectors(a,n),u.subVectors(r,n),h.cross(u),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,m),c.fromBufferAttribute(i,f),o.add(h),l.add(h),c.add(h),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(m,l.x,l.y,l.z),i.setXYZ(f,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),n.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,n),u.subVectors(r,n),h.cross(u),i.setXYZ(d+0,h.x,h.y,h.z),i.setXYZ(d+1,h.x,h.y,h.z),i.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const r in i){if(e.attributes[r]===void 0)continue;const n=i[r].array,a=e.attributes[r],o=a.array,l=a.itemSize*t,c=Math.min(o.length,n.length-l);for(let h=0,u=l;h<c;h++,u++)n[u]=o[h]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)vt.fromBufferAttribute(e,t),vt.normalize(),e.setXYZ(t,vt.x,vt.y,vt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let p=0,g=0;for(let m=0,f=l.length;m<f;m++){o.isInterleavedBufferAttribute?p=l[m]*o.data.stride+o.offset:p=l[m]*h;for(let _=0;_<h;_++)d[g++]=c[p++]}return new Et(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new lt,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const n=this.morphAttributes;for(const o in n){const l=[],c=n[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],p=e(d,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let n=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const p=c[u];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const n=e.morphAttributes;for(const c in n){const h=[],u=n[c];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const oc=new He,Lr=new ra,No=new cs,ps=new L,fs=new L,ms=new L,zo=new L,Bo=new L,Uo=new L,la=new L,ha=new L,ca=new L,ua=new we,da=new we,pa=new we,Fo=new L,fa=new L;class Ie extends rt{constructor(e=new lt,t=new Ui){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=i.length;r<n;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}raycast(e,t){const i=this.geometry,r=this.material,n=this.matrixWorld;if(r===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),No.copy(i.boundingSphere),No.applyMatrix4(n),e.ray.intersectsSphere(No)===!1)||(oc.copy(n).invert(),Lr.copy(e.ray).applyMatrix4(oc),i.boundingBox!==null&&Lr.intersectsBox(i.boundingBox)===!1))return;let a;const o=i.index,l=i.attributes.position,c=i.morphAttributes.position,h=i.morphTargetsRelative,u=i.attributes.uv,d=i.attributes.uv2,p=i.groups,g=i.drawRange;if(o!==null)if(Array.isArray(r))for(let m=0,f=p.length;m<f;m++){const _=p[m],y=r[_.materialIndex],A=Math.max(_.start,g.start),b=Math.min(o.count,Math.min(_.start+_.count,g.start+g.count));for(let S=A,D=b;S<D;S+=3){const O=o.getX(S),M=o.getX(S+1),R=o.getX(S+2);a=ma(this,y,e,Lr,l,c,h,u,d,O,M,R),a&&(a.faceIndex=Math.floor(S/3),a.face.materialIndex=_.materialIndex,t.push(a))}}else{const m=Math.max(0,g.start),f=Math.min(o.count,g.start+g.count);for(let _=m,y=f;_<y;_+=3){const A=o.getX(_),b=o.getX(_+1),S=o.getX(_+2);a=ma(this,r,e,Lr,l,c,h,u,d,A,b,S),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}}else if(l!==void 0)if(Array.isArray(r))for(let m=0,f=p.length;m<f;m++){const _=p[m],y=r[_.materialIndex],A=Math.max(_.start,g.start),b=Math.min(l.count,Math.min(_.start+_.count,g.start+g.count));for(let S=A,D=b;S<D;S+=3){const O=S,M=S+1,R=S+2;a=ma(this,y,e,Lr,l,c,h,u,d,O,M,R),a&&(a.faceIndex=Math.floor(S/3),a.face.materialIndex=_.materialIndex,t.push(a))}}else{const m=Math.max(0,g.start),f=Math.min(l.count,g.start+g.count);for(let _=m,y=f;_<y;_+=3){const A=_,b=_+1,S=_+2;a=ma(this,r,e,Lr,l,c,h,u,d,A,b,S),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}}}}function gf(s,e,t,i,r,n,a,o){let l;if(e.side===li?l=i.intersectTriangle(a,n,r,!0,o):l=i.intersectTriangle(r,n,a,e.side!==Ps,o),l===null)return null;fa.copy(o),fa.applyMatrix4(s.matrixWorld);const c=t.ray.origin.distanceTo(fa);return c<t.near||c>t.far?null:{distance:c,point:fa.clone(),object:s}}function ma(s,e,t,i,r,n,a,o,l,c,h,u){ps.fromBufferAttribute(r,c),fs.fromBufferAttribute(r,h),ms.fromBufferAttribute(r,u);const d=s.morphTargetInfluences;if(n&&d){la.set(0,0,0),ha.set(0,0,0),ca.set(0,0,0);for(let g=0,m=n.length;g<m;g++){const f=d[g],_=n[g];f!==0&&(zo.fromBufferAttribute(_,c),Bo.fromBufferAttribute(_,h),Uo.fromBufferAttribute(_,u),a?(la.addScaledVector(zo,f),ha.addScaledVector(Bo,f),ca.addScaledVector(Uo,f)):(la.addScaledVector(zo.sub(ps),f),ha.addScaledVector(Bo.sub(fs),f),ca.addScaledVector(Uo.sub(ms),f)))}ps.add(la),fs.add(ha),ms.add(ca)}s.isSkinnedMesh&&(s.boneTransform(c,ps),s.boneTransform(h,fs),s.boneTransform(u,ms));const p=gf(s,e,t,i,ps,fs,ms,Fo);if(p){o&&(ua.fromBufferAttribute(o,c),da.fromBufferAttribute(o,h),pa.fromBufferAttribute(o,u),p.uv=Ji.getUV(Fo,ps,fs,ms,ua,da,pa,new we)),l&&(ua.fromBufferAttribute(l,c),da.fromBufferAttribute(l,h),pa.fromBufferAttribute(l,u),p.uv2=Ji.getUV(Fo,ps,fs,ms,ua,da,pa,new we));const g={a:c,b:h,c:u,normal:new L,materialIndex:0};Ji.getNormal(ps,fs,ms,g.normal),p.face=g}return p}class Un extends lt{constructor(e=1,t=1,i=1,r=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};const o=this;r=Math.floor(r),n=Math.floor(n),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,p=0;g("z","y","x",-1,-1,i,t,e,a,n,0),g("z","y","x",1,-1,i,t,-e,a,n,1),g("x","z","y",1,1,e,i,t,r,a,2),g("x","z","y",1,-1,e,i,-t,r,a,3),g("x","y","z",1,-1,e,t,i,r,n,4),g("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(l),this.setAttribute("position",new Fe(c,3)),this.setAttribute("normal",new Fe(h,3)),this.setAttribute("uv",new Fe(u,2));function g(m,f,_,y,A,b,S,D,O,M,R){const N=b/O,I=S/M,K=b/2,$=S/2,k=D/2,W=O+1,U=M+1;let Z=0,Y=0;const F=new L;for(let G=0;G<U;G++){const te=G*I-$;for(let X=0;X<W;X++){const ie=X*N-K;F[m]=ie*y,F[f]=te*A,F[_]=k,c.push(F.x,F.y,F.z),F[m]=0,F[f]=0,F[_]=D>0?1:-1,h.push(F.x,F.y,F.z),u.push(X/O),u.push(1-G/M),Z+=1}}for(let G=0;G<M;G++)for(let te=0;te<O;te++){const X=d+te+W*G,ie=d+te+W*(G+1),ce=d+(te+1)+W*(G+1),Se=d+(te+1)+W*G;l.push(X,ie,Se),l.push(ie,ce,Se),Y+=6}o.addGroup(p,Y,R),p+=Y,d+=Z}}static fromJSON(e){return new Un(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Rr(s){const e={};for(const t in s){e[t]={};for(const i in s[t]){const r=s[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function At(s){const e={};for(let t=0;t<s.length;t++){const i=Rr(s[t]);for(const r in i)e[r]=i[r]}return e}const Ho={clone:Rr,merge:At};var vf=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,_f=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Fi extends gi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=vf,this.fragmentShader=_f,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Rr(e.uniforms),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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const n=this.uniforms[r].value;n&&n.isTexture?t.uniforms[r]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:"m4",value:n.toArray()}:t.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class lc extends rt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new He,this.projectionMatrix=new He,this.projectionMatrixInverse=new He}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Nt extends lc{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=an*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(nn*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return an*2*Math.atan(Math.tan(nn*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,n,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(nn*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;n+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(n+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Pr=90,Dr=1;class yf extends rt{constructor(e,t,i){if(super(),this.type="CubeCamera",i.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;const r=new Nt(Pr,Dr,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new L(1,0,0)),this.add(r);const n=new Nt(Pr,Dr,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new L(-1,0,0)),this.add(n);const a=new Nt(Pr,Dr,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new L(0,1,0)),this.add(a);const o=new Nt(Pr,Dr,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new L(0,-1,0)),this.add(o);const l=new Nt(Pr,Dr,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new L(0,0,1)),this.add(l);const c=new Nt(Pr,Dr,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new L(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[r,n,a,o,l,c]=this.children,h=e.getRenderTarget(),u=e.toneMapping,d=e.xr.enabled;e.toneMapping=Di,e.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,n),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(h),e.toneMapping=u,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class hc extends ht{constructor(e,t,i,r,n,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:mr,super(e,t,i,r,n,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class xf extends Us{constructor(e,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new hc(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:gt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new Un(5,5,5),n=new Fi({name:"CubemapFromEquirect",uniforms:Rr(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:li,blending:rs});n.uniforms.tEquirect.value=t;const a=new Ie(r,n),o=t.minFilter;return t.minFilter===as&&(t.minFilter=gt),new yf(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const n=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(n)}}const Go=new L,bf=new L,wf=new ri;class js{constructor(e=new L(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,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Go.subVectors(i,t).cross(bf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(Go),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||n>1?null:t.copy(i).multiplyScalar(n).add(e.start)}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||wf.getNormalMatrix(e),r=this.coplanarPoint(Go).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),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 Ir=new cs,ga=new L;class jo{constructor(e=new js,t=new js,i=new js,r=new js,n=new js,a=new js){this.planes=[e,t,i,r,n,a]}set(e,t,i,r,n,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,r=i[0],n=i[1],a=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],g=i[10],m=i[11],f=i[12],_=i[13],y=i[14],A=i[15];return t[0].setComponents(o-r,u-l,m-d,A-f).normalize(),t[1].setComponents(o+r,u+l,m+d,A+f).normalize(),t[2].setComponents(o+n,u+c,m+p,A+_).normalize(),t[3].setComponents(o-n,u-c,m-p,A-_).normalize(),t[4].setComponents(o-a,u-h,m-g,A-y).normalize(),t[5].setComponents(o+a,u+h,m+g,A+y).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Ir.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ir)}intersectsSprite(e){return Ir.center.set(0,0,0),Ir.radius=.7071067811865476,Ir.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ir)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let n=0;n<6;n++)if(t[n].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(ga.x=r.normal.x>0?e.max.x:e.min.x,ga.y=r.normal.y>0?e.max.y:e.min.y,ga.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ga)<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)}}function cc(){let s=null,e=!1,t=null,i=null;function r(n,a){t(n,a),i=s.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=s.requestAnimationFrame(r),e=!0)},stop:function(){s.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(n){t=n},setContext:function(n){s=n}}}function Sf(s,e){const t=e.isWebGL2,i=new WeakMap;function r(c,h){const u=c.array,d=c.usage,p=s.createBuffer();s.bindBuffer(h,p),s.bufferData(h,u,d),c.onUploadCallback();let g;if(u instanceof Float32Array)g=5126;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=5123;else if(u instanceof Int16Array)g=5122;else if(u instanceof Uint32Array)g=5125;else if(u instanceof Int32Array)g=5124;else if(u instanceof Int8Array)g=5120;else if(u instanceof Uint8Array)g=5121;else if(u instanceof Uint8ClampedArray)g=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:p,type:g,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version}}function n(c,h,u){const d=h.array,p=h.updateRange;s.bindBuffer(u,c),p.count===-1?s.bufferSubData(u,0,d):(t?s.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):s.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1)}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);h&&(s.deleteBuffer(h.buffer),i.delete(c))}function l(c,h){if(c.isGLBufferAttribute){const d=i.get(c);(!d||d.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u===void 0?i.set(c,r(c,h)):u.version<c.version&&(n(u.buffer,c,h),u.version=c.version)}return{get:a,remove:o,update:l}}class lr extends lt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const n=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,h=l+1,u=e/o,d=t/l,p=[],g=[],m=[],f=[];for(let _=0;_<h;_++){const y=_*d-a;for(let A=0;A<c;A++){const b=A*u-n;g.push(b,-y,0),m.push(0,0,1),f.push(A/o),f.push(1-_/l)}}for(let _=0;_<l;_++)for(let y=0;y<o;y++){const A=y+c*_,b=y+c*(_+1),S=y+1+c*(_+1),D=y+1+c*_;p.push(A,b,D),p.push(b,S,D)}this.setIndex(p),this.setAttribute("position",new Fe(g,3)),this.setAttribute("normal",new Fe(m,3)),this.setAttribute("uv",new Fe(f,2))}static fromJSON(e){return new lr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Mf=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,Tf=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Cf=`#ifdef USE_ALPHATEST
	if ( diffuseColor.a < alphaTest ) discard;
#endif`,Ef=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,Af=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Lf=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,Rf="vec3 transformed = vec3( position );",Pf=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,Df=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
	float D = D_GGX( alpha, dotNH );
	return F * ( V * D );
}
#ifdef USE_IRIDESCENCE
vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = mix(F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence);
	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
	float D = D_GGX( alpha, dotNH );
	return F * ( V * D );
}
#endif
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif`,If=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
    3.2404542, -0.9692660,  0.0556434,
   -1.5371385,  1.8760108, -0.2040259,
   -0.4985314,  0.0415560,  1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
   vec3 sqrtF0 = sqrt( fresnel0 );
   return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
   return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
   return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
   float phase = 2.0 * PI * OPD * 1.0e-9;
   vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
   vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
   vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
   vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( -pow2( phase ) * var );
   xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[0] ) * exp( -4.5282e+09 * pow2( phase ) );
   xyz /= 1.0685e-7;
   vec3 srgb = XYZ_TO_REC709 * xyz;
   return srgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
   vec3 I;
   float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
   float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
   float cosTheta2Sq = 1.0 - sinTheta2Sq;
   if ( cosTheta2Sq < 0.0 ) {
       return vec3( 1.0 );
   }
   float cosTheta2 = sqrt( cosTheta2Sq );
   float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
   float R12 = F_Schlick( R0, 1.0, cosTheta1 );
   float R21 = R12;
   float T121 = 1.0 - R12;
   float phi12 = 0.0;
   if ( iridescenceIOR < outsideIOR ) phi12 = PI;
   float phi21 = PI - phi12;
   vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );   vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
   vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
   vec3 phi23 = vec3( 0.0 );
   if ( baseIOR[0] < iridescenceIOR ) phi23[0] = PI;
   if ( baseIOR[1] < iridescenceIOR ) phi23[1] = PI;
   if ( baseIOR[2] < iridescenceIOR ) phi23[2] = PI;
   float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
   vec3 phi = vec3( phi21 ) + phi23;
   vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
   vec3 r123 = sqrt( R123 );
   vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
   vec3 C0 = R12 + Rs;
   I = C0;
   vec3 Cm = Rs - T121;
   for ( int m = 1; m <= 2; ++m ) {
       Cm *= r123;
       vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
       I += Cm * Sm;
   }
   return max( I, vec3( 0.0 ) );
}
#endif`,kf=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vUv );
		vec2 dSTdy = dFdy( vUv );
		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
		vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Of=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#pragma unroll_loop_start
	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
		plane = clippingPlanes[ i ];
		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
	}
	#pragma unroll_loop_end
	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
		bool clipped = true;
		#pragma unroll_loop_start
		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
		}
		#pragma unroll_loop_end
		if ( clipped ) discard;
	#endif
#endif`,Nf=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,zf=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,Bf=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,Uf=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Ff=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,Hf=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	varying vec3 vColor;
#endif`,Gf=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif`,jf=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
struct GeometricContext {
	vec3 position;
	vec3 normal;
	vec3 viewDir;
#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float linearToRelativeLuminance( const in vec3 color ) {
	vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
	return dot( weights, color.rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}`,Vf=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define r0 1.0
	#define v0 0.339
	#define m0 - 2.0
	#define r1 0.8
	#define v1 0.276
	#define m1 - 1.0
	#define r4 0.4
	#define v4 0.046
	#define m4 2.0
	#define r5 0.305
	#define v5 0.016
	#define m5 3.0
	#define r6 0.21
	#define v6 0.0038
	#define m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= r1 ) {
			mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
		} else if ( roughness >= r4 ) {
			mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
		} else if ( roughness >= r5 ) {
			mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
		} else if ( roughness >= r6 ) {
			mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,Wf=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
	mat3 m = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
	transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,qf=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,Xf=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`,Yf=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vUv );
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,Zf=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,$f="gl_FragColor = linearToOutputTexel( gl_FragColor );",Kf=`vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 LinearTosRGB( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,Jf=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,Qf=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,em=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,tm=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,im=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,sm=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,rm=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,nm=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,am=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,om=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
	#endif
}`,lm=`#ifdef USE_LIGHTMAP
	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
	reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,hm=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,cm=`vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
	vLightBack = vec3( 0.0 );
	vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
#ifdef DOUBLE_SIDED
	vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
	vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
#endif
#if NUM_POINT_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		getPointLightInfo( pointLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		getSpotLightInfo( spotLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_DIR_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_HEMI_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
		vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
		#ifdef DOUBLE_SIDED
			vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
		#endif
	}
	#pragma unroll_loop_end
#endif`,um=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
		if ( cutoffDistance > 0.0 ) {
			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
		}
		return distanceFalloff;
	#else
		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
		}
		return 1.0;
	#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometry.position;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometry.position;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,dm=`#if defined( USE_ENVMAP )
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#if defined( ENVMAP_TYPE_CUBE_UV )
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#if defined( ENVMAP_TYPE_CUBE_UV )
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
#endif`,pm=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,fm=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material )	(0)`,mm=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,gm=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material )	(0)`,vm=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	#ifdef SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULARINTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
		#endif
		#ifdef USE_SPECULARCOLORMAP
			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEENCOLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEENROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
	#endif
#endif`,_m=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
};
vec3 clearcoatSpecular = vec3( 0.0 );
vec3 sheenSpecular = vec3( 0.0 );
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometry.normal;
		vec3 viewDir = geometry.viewDir;
		vec3 position = geometry.position;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
	#endif
	#ifdef USE_IRIDESCENCE
		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
	#else
		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
	#endif
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,ym=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef USE_CLEARCOAT
	geometry.clearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometry.viewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
	material.iridescence = 0.0;
} else {
	material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
	material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
	material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,xm=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometry.normal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,bm=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,wm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Sm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Mm=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		varying float vFragDepth;
		varying float vIsPerspective;
	#else
		uniform float logDepthBufFC;
	#endif
#endif`,Tm=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		vFragDepth = 1.0 + gl_Position.w;
		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
	#else
		if ( isPerspectiveMatrix( projectionMatrix ) ) {
			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
			gl_Position.z *= gl_Position.w;
		}
	#endif
#endif`,Cm=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,Em=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Am=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,Lm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	uniform mat3 uvTransform;
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Rm=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vUv );
	metalnessFactor *= texelMetalness.b;
#endif`,Pm=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,Dm=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,Im=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
		}
	#else
		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
	#endif
#endif`,km=`#ifdef USE_MORPHTARGETS
	uniform float morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
		uniform sampler2DArray morphTargetsTexture;
		uniform ivec2 morphTargetsTextureSize;
		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
			int y = texelIndex / morphTargetsTextureSize.x;
			int x = texelIndex - y * morphTargetsTextureSize.x;
			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
			return texelFetch( morphTargetsTexture, morphUV, 0 );
		}
	#else
		#ifndef USE_MORPHNORMALS
			uniform float morphTargetInfluences[ 8 ];
		#else
			uniform float morphTargetInfluences[ 4 ];
		#endif
	#endif
#endif`,Om=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
		}
	#else
		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
		#ifndef USE_MORPHNORMALS
			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
		#endif
	#endif
#endif`,Nm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	#ifdef USE_TANGENT
		vec3 tangent = normalize( vTangent );
		vec3 bitangent = normalize( vBitangent );
		#ifdef DOUBLE_SIDED
			tangent = tangent * faceDirection;
			bitangent = bitangent * faceDirection;
		#endif
		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
			mat3 vTBN = mat3( tangent, bitangent, normal );
		#endif
	#endif
#endif
vec3 geometryNormal = normal;`,zm=`#ifdef OBJECTSPACE_NORMALMAP
	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( TANGENTSPACE_NORMALMAP )
	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	#ifdef USE_TANGENT
		normal = normalize( vTBN * mapN );
	#else
		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
	#endif
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,Bm=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Um=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Fm=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Hm=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef OBJECTSPACE_NORMALMAP
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
		vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
		vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
		vec2 st0 = dFdx( vUv.st );
		vec2 st1 = dFdy( vUv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
	}
#endif`,Gm=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = geometryNormal;
#endif`,jm=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	#ifdef USE_TANGENT
		clearcoatNormal = normalize( vTBN * clearcoatMapN );
	#else
		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
	#endif
#endif`,Vm=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif`,Wm=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,qm=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= transmissionAlpha + 0.1;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Xm=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
	vec4 r = vec4( fract( v * PackFactors ), v );
	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors );
}
vec4 pack2HalfToRGBA( vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
	return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`,Ym=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Zm=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,$m=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,Km=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,Jm=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vUv );
	roughnessFactor *= texelRoughness.g;
#endif`,Qm=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,eg=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
		bool inFrustum = all( inFrustumVec );
		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
		bool frustumTest = all( frustumTestVec );
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return shadow;
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
		vec3 lightToPosition = shadowCoord.xyz;
		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
		vec3 bd3D = normalize( lightToPosition );
		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
			return (
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
			) * ( 1.0 / 9.0 );
		#else
			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
		#endif
	}
#endif`,tg=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,ig=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		vec4 shadowWorldPosition;
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
#endif`,sg=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,rg=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,ng=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	uniform int boneTextureSize;
	mat4 getBoneMatrix( const in float i ) {
		float j = i * 4.0;
		float x = mod( j, float( boneTextureSize ) );
		float y = floor( j / float( boneTextureSize ) );
		float dx = 1.0 / float( boneTextureSize );
		float dy = 1.0 / float( boneTextureSize );
		y = dy * ( y + 0.5 );
		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
		mat4 bone = mat4( v1, v2, v3, v4 );
		return bone;
	}
#endif`,ag=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,og=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,lg=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,hg=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,cg=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,ug=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,dg=`#ifdef USE_TRANSMISSION
	float transmissionAlpha = 1.0;
	float transmissionFactor = transmission;
	float thicknessFactor = thickness;
	#ifdef USE_TRANSMISSIONMAP
		transmissionFactor *= texture2D( transmissionMap, vUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		thicknessFactor *= texture2D( thicknessMap, vUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmission = getIBLVolumeRefraction(
		n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
		attenuationColor, attenuationDistance );
	totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
	transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
#endif`,pg=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		#ifdef texture2DLodEXT
			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
		#else
			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
		#endif
	}
	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( attenuationDistance == 0.0 ) {
			return radiance;
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
		vec3 refractedRayExit = position + transmissionRay;
		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
		refractionCoords += 1.0;
		refractionCoords /= 2.0;
		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
	}
#endif`,fg=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
	varying vec2 vUv;
#endif`,mg=`#ifdef USE_UV
	#ifdef UVS_VERTEX_ONLY
		vec2 vUv;
	#else
		varying vec2 vUv;
	#endif
	uniform mat3 uvTransform;
#endif`,gg=`#ifdef USE_UV
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,vg=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	varying vec2 vUv2;
#endif`,_g=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	attribute vec2 uv2;
	varying vec2 vUv2;
	uniform mat3 uv2Transform;
#endif`,yg=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`,xg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const bg=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,wg=`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
	gl_FragColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
	#endif
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,Sg=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Mg=`#include <envmap_common_pars_fragment>
uniform float opacity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	vec3 vReflect = vWorldDirection;
	#include <envmap_fragment>
	gl_FragColor = envColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,Tg=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,Cg=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#endif
}`,Eg=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,Ag=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,Lg=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,Rg=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,Pg=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Dg=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Ig=`#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,kg=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Og=`#define LAMBERT
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <bsdfs>
#include <lights_pars_begin>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <lights_lambert_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Ng=`uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <fog_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <emissivemap_fragment>
	#ifdef DOUBLE_SIDED
		reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
	#else
		reflectedLight.indirectDiffuse += vIndirectFront;
	#endif
	#include <lightmap_fragment>
	reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );
	#ifdef DOUBLE_SIDED
		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
	#else
		reflectedLight.directDiffuse = vLightFront;
	#endif
	reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,zg=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,Bg=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Ug=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	vViewPosition = - mvPosition.xyz;
#endif
}`,Fg=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,Hg=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Gg=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,jg=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,Vg=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULARINTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
	#ifdef USE_SPECULARCOLORMAP
		uniform sampler2D specularColorMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEENCOLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEENROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
	#endif
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Wg=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,qg=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Xg=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,Yg=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Zg=`#include <common>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,$g=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,Kg=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	vec2 scale;
	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Jg=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,ze={alphamap_fragment:Mf,alphamap_pars_fragment:Tf,alphatest_fragment:Cf,alphatest_pars_fragment:Ef,aomap_fragment:Af,aomap_pars_fragment:Lf,begin_vertex:Rf,beginnormal_vertex:Pf,bsdfs:Df,iridescence_fragment:If,bumpmap_pars_fragment:kf,clipping_planes_fragment:Of,clipping_planes_pars_fragment:Nf,clipping_planes_pars_vertex:zf,clipping_planes_vertex:Bf,color_fragment:Uf,color_pars_fragment:Ff,color_pars_vertex:Hf,color_vertex:Gf,common:jf,cube_uv_reflection_fragment:Vf,defaultnormal_vertex:Wf,displacementmap_pars_vertex:qf,displacementmap_vertex:Xf,emissivemap_fragment:Yf,emissivemap_pars_fragment:Zf,encodings_fragment:$f,encodings_pars_fragment:Kf,envmap_fragment:Jf,envmap_common_pars_fragment:Qf,envmap_pars_fragment:em,envmap_pars_vertex:tm,envmap_physical_pars_fragment:dm,envmap_vertex:im,fog_vertex:sm,fog_pars_vertex:rm,fog_fragment:nm,fog_pars_fragment:am,gradientmap_pars_fragment:om,lightmap_fragment:lm,lightmap_pars_fragment:hm,lights_lambert_vertex:cm,lights_pars_begin:um,lights_toon_fragment:pm,lights_toon_pars_fragment:fm,lights_phong_fragment:mm,lights_phong_pars_fragment:gm,lights_physical_fragment:vm,lights_physical_pars_fragment:_m,lights_fragment_begin:ym,lights_fragment_maps:xm,lights_fragment_end:bm,logdepthbuf_fragment:wm,logdepthbuf_pars_fragment:Sm,logdepthbuf_pars_vertex:Mm,logdepthbuf_vertex:Tm,map_fragment:Cm,map_pars_fragment:Em,map_particle_fragment:Am,map_particle_pars_fragment:Lm,metalnessmap_fragment:Rm,metalnessmap_pars_fragment:Pm,morphcolor_vertex:Dm,morphnormal_vertex:Im,morphtarget_pars_vertex:km,morphtarget_vertex:Om,normal_fragment_begin:Nm,normal_fragment_maps:zm,normal_pars_fragment:Bm,normal_pars_vertex:Um,normal_vertex:Fm,normalmap_pars_fragment:Hm,clearcoat_normal_fragment_begin:Gm,clearcoat_normal_fragment_maps:jm,clearcoat_pars_fragment:Vm,iridescence_pars_fragment:Wm,output_fragment:qm,packing:Xm,premultiplied_alpha_fragment:Ym,project_vertex:Zm,dithering_fragment:$m,dithering_pars_fragment:Km,roughnessmap_fragment:Jm,roughnessmap_pars_fragment:Qm,shadowmap_pars_fragment:eg,shadowmap_pars_vertex:tg,shadowmap_vertex:ig,shadowmask_pars_fragment:sg,skinbase_vertex:rg,skinning_pars_vertex:ng,skinning_vertex:ag,skinnormal_vertex:og,specularmap_fragment:lg,specularmap_pars_fragment:hg,tonemapping_fragment:cg,tonemapping_pars_fragment:ug,transmission_fragment:dg,transmission_pars_fragment:pg,uv_pars_fragment:fg,uv_pars_vertex:mg,uv_vertex:gg,uv2_pars_fragment:vg,uv2_pars_vertex:_g,uv2_vertex:yg,worldpos_vertex:xg,background_vert:bg,background_frag:wg,cube_vert:Sg,cube_frag:Mg,depth_vert:Tg,depth_frag:Cg,distanceRGBA_vert:Eg,distanceRGBA_frag:Ag,equirect_vert:Lg,equirect_frag:Rg,linedashed_vert:Pg,linedashed_frag:Dg,meshbasic_vert:Ig,meshbasic_frag:kg,meshlambert_vert:Og,meshlambert_frag:Ng,meshmatcap_vert:zg,meshmatcap_frag:Bg,meshnormal_vert:Ug,meshnormal_frag:Fg,meshphong_vert:Hg,meshphong_frag:Gg,meshphysical_vert:jg,meshphysical_frag:Vg,meshtoon_vert:Wg,meshtoon_frag:qg,points_vert:Xg,points_frag:Yg,shadow_vert:Zg,shadow_frag:$g,sprite_vert:Kg,sprite_frag:Jg},ue={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ri},uv2Transform:{value:new ri},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ri}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ri}}},qt={basic:{uniforms:At([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:At([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.fog,ue.lights,{emissive:{value:new be(0)}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:At([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:At([ue.common,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.roughnessmap,ue.metalnessmap,ue.fog,ue.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:At([ue.common,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.gradientmap,ue.fog,ue.lights,{emissive:{value:new be(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:At([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:At([ue.points,ue.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:At([ue.common,ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:At([ue.common,ue.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:At([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:At([ue.sprite,ue.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new ri},t2D:{value:null}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},cube:{uniforms:At([ue.envmap,{opacity:{value:1}}]),vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distanceRGBA:{uniforms:At([ue.common,ue.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distanceRGBA_vert,fragmentShader:ze.distanceRGBA_frag},shadow:{uniforms:At([ue.lights,ue.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};qt.physical={uniforms:At([qt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new we(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};function Qg(s,e,t,i,r,n){const a=new be(0);let o=r===!0?0:1,l,c,h=null,u=0,d=null;function p(m,f){let _=!1,y=f.isScene===!0?f.background:null;y&&y.isTexture&&(y=e.get(y));const A=s.xr,b=A.getSession&&A.getSession();b&&b.environmentBlendMode==="additive"&&(y=null),y===null?g(a,o):y&&y.isColor&&(g(y,1),_=!0),(s.autoClear||_)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Xn)?(c===void 0&&(c=new Ie(new Un(1,1,1),new Fi({name:"BackgroundCubeMaterial",uniforms:Rr(qt.cube.uniforms),vertexShader:qt.cube.vertexShader,fragmentShader:qt.cube.fragmentShader,side:li,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(S,D,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,(h!==y||u!==y.version||d!==s.toneMapping)&&(c.material.needsUpdate=!0,h=y,u=y.version,d=s.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new Ie(new lr(2,2),new Fi({name:"BackgroundMaterial",uniforms:Rr(qt.background.uniforms),vertexShader:qt.background.vertexShader,fragmentShader:qt.background.fragmentShader,side:Rs,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||u!==y.version||d!==s.toneMapping)&&(l.material.needsUpdate=!0,h=y,u=y.version,d=s.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,f){t.buffers.color.setClear(m.r,m.g,m.b,f,n)}return{getClearColor:function(){return a},setClearColor:function(m,f=1){a.set(m),o=f,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(m){o=m,g(a,o)},render:p}}function ev(s,e,t,i){const r=s.getParameter(34921),n=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||n!==null,o={},l=f(null);let c=l,h=!1;function u(k,W,U,Z,Y){let F=!1;if(a){const G=m(Z,U,W);c!==G&&(c=G,p(c.object)),F=_(k,Z,U,Y),F&&y(k,Z,U,Y)}else{const G=W.wireframe===!0;(c.geometry!==Z.id||c.program!==U.id||c.wireframe!==G)&&(c.geometry=Z.id,c.program=U.id,c.wireframe=G,F=!0)}Y!==null&&t.update(Y,34963),(F||h)&&(h=!1,M(k,W,U,Z),Y!==null&&s.bindBuffer(34963,t.get(Y).buffer))}function d(){return i.isWebGL2?s.createVertexArray():n.createVertexArrayOES()}function p(k){return i.isWebGL2?s.bindVertexArray(k):n.bindVertexArrayOES(k)}function g(k){return i.isWebGL2?s.deleteVertexArray(k):n.deleteVertexArrayOES(k)}function m(k,W,U){const Z=U.wireframe===!0;let Y=o[k.id];Y===void 0&&(Y={},o[k.id]=Y);let F=Y[W.id];F===void 0&&(F={},Y[W.id]=F);let G=F[Z];return G===void 0&&(G=f(d()),F[Z]=G),G}function f(k){const W=[],U=[],Z=[];for(let Y=0;Y<r;Y++)W[Y]=0,U[Y]=0,Z[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:U,attributeDivisors:Z,object:k,attributes:{},index:null}}function _(k,W,U,Z){const Y=c.attributes,F=W.attributes;let G=0;const te=U.getAttributes();for(const X in te)if(te[X].location>=0){const ie=Y[X];let ce=F[X];if(ce===void 0&&(X==="instanceMatrix"&&k.instanceMatrix&&(ce=k.instanceMatrix),X==="instanceColor"&&k.instanceColor&&(ce=k.instanceColor)),ie===void 0||ie.attribute!==ce||ce&&ie.data!==ce.data)return!0;G++}return c.attributesNum!==G||c.index!==Z}function y(k,W,U,Z){const Y={},F=W.attributes;let G=0;const te=U.getAttributes();for(const X in te)if(te[X].location>=0){let ie=F[X];ie===void 0&&(X==="instanceMatrix"&&k.instanceMatrix&&(ie=k.instanceMatrix),X==="instanceColor"&&k.instanceColor&&(ie=k.instanceColor));const ce={};ce.attribute=ie,ie&&ie.data&&(ce.data=ie.data),Y[X]=ce,G++}c.attributes=Y,c.attributesNum=G,c.index=Z}function A(){const k=c.newAttributes;for(let W=0,U=k.length;W<U;W++)k[W]=0}function b(k){S(k,0)}function S(k,W){const U=c.newAttributes,Z=c.enabledAttributes,Y=c.attributeDivisors;U[k]=1,Z[k]===0&&(s.enableVertexAttribArray(k),Z[k]=1),Y[k]!==W&&((i.isWebGL2?s:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](k,W),Y[k]=W)}function D(){const k=c.newAttributes,W=c.enabledAttributes;for(let U=0,Z=W.length;U<Z;U++)W[U]!==k[U]&&(s.disableVertexAttribArray(U),W[U]=0)}function O(k,W,U,Z,Y,F){i.isWebGL2===!0&&(U===5124||U===5125)?s.vertexAttribIPointer(k,W,U,Y,F):s.vertexAttribPointer(k,W,U,Z,Y,F)}function M(k,W,U,Z){if(i.isWebGL2===!1&&(k.isInstancedMesh||Z.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;A();const Y=Z.attributes,F=U.getAttributes(),G=W.defaultAttributeValues;for(const te in F){const X=F[te];if(X.location>=0){let ie=Y[te];if(ie===void 0&&(te==="instanceMatrix"&&k.instanceMatrix&&(ie=k.instanceMatrix),te==="instanceColor"&&k.instanceColor&&(ie=k.instanceColor)),ie!==void 0){const ce=ie.normalized,Se=ie.itemSize,H=t.get(ie);if(H===void 0)continue;const Ke=H.buffer,Le=H.type,Me=H.bytesPerElement;if(ie.isInterleavedBufferAttribute){const de=ie.data,Ve=de.stride,Ce=ie.offset;if(de.isInstancedInterleavedBuffer){for(let ge=0;ge<X.locationSize;ge++)S(X.location+ge,de.meshPerAttribute);k.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let ge=0;ge<X.locationSize;ge++)b(X.location+ge);s.bindBuffer(34962,Ke);for(let ge=0;ge<X.locationSize;ge++)O(X.location+ge,Se/X.locationSize,Le,ce,Ve*Me,(Ce+Se/X.locationSize*ge)*Me)}else{if(ie.isInstancedBufferAttribute){for(let de=0;de<X.locationSize;de++)S(X.location+de,ie.meshPerAttribute);k.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let de=0;de<X.locationSize;de++)b(X.location+de);s.bindBuffer(34962,Ke);for(let de=0;de<X.locationSize;de++)O(X.location+de,Se/X.locationSize,Le,ce,Se*Me,Se/X.locationSize*de*Me)}}else if(G!==void 0){const ce=G[te];if(ce!==void 0)switch(ce.length){case 2:s.vertexAttrib2fv(X.location,ce);break;case 3:s.vertexAttrib3fv(X.location,ce);break;case 4:s.vertexAttrib4fv(X.location,ce);break;default:s.vertexAttrib1fv(X.location,ce)}}}}D()}function R(){K();for(const k in o){const W=o[k];for(const U in W){const Z=W[U];for(const Y in Z)g(Z[Y].object),delete Z[Y];delete W[U]}delete o[k]}}function N(k){if(o[k.id]===void 0)return;const W=o[k.id];for(const U in W){const Z=W[U];for(const Y in Z)g(Z[Y].object),delete Z[Y];delete W[U]}delete o[k.id]}function I(k){for(const W in o){const U=o[W];if(U[k.id]===void 0)continue;const Z=U[k.id];for(const Y in Z)g(Z[Y].object),delete Z[Y];delete U[k.id]}}function K(){$(),h=!0,c!==l&&(c=l,p(c.object))}function $(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:K,resetDefaultState:$,dispose:R,releaseStatesOfGeometry:N,releaseStatesOfProgram:I,initAttributes:A,enableAttribute:b,disableUnusedAttributes:D}}function tv(s,e,t,i){const r=i.isWebGL2;let n;function a(c){n=c}function o(c,h){s.drawArrays(n,c,h),t.update(h,n,1)}function l(c,h,u){if(u===0)return;let d,p;if(r)d=s,p="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[p](n,c,h,u),t.update(h,n,u)}this.setMode=a,this.render=o,this.renderInstances=l}function iv(s,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const O=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function n(O){if(O==="highp"){if(s.getShaderPrecisionFormat(35633,36338).precision>0&&s.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";O="mediump"}return O==="mediump"&&s.getShaderPrecisionFormat(35633,36337).precision>0&&s.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&s instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&s instanceof WebGL2ComputeRenderingContext;let o=t.precision!==void 0?t.precision:"highp";const l=n(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=s.getParameter(34930),d=s.getParameter(35660),p=s.getParameter(3379),g=s.getParameter(34076),m=s.getParameter(34921),f=s.getParameter(36347),_=s.getParameter(36348),y=s.getParameter(36349),A=d>0,b=a||e.has("OES_texture_float"),S=A&&b,D=a?s.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:n,precision:o,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:f,maxVaryings:_,maxFragmentUniforms:y,vertexTextures:A,floatFragmentTextures:b,floatVertexTextures:S,maxSamples:D}}function sv(s){const e=this;let t=null,i=0,r=!1,n=!1;const a=new js,o=new ri,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d,p){const g=u.length!==0||d||i!==0||r;return r=d,t=h(u,p,0),i=u.length,g},this.beginShadows=function(){n=!0,h(null)},this.endShadows=function(){n=!1,c()},this.setState=function(u,d,p){const g=u.clippingPlanes,m=u.clipIntersection,f=u.clipShadows,_=s.get(u);if(!r||g===null||g.length===0||n&&!f)n?h(null):c();else{const y=n?0:i,A=y*4;let b=_.clippingState||null;l.value=b,b=h(g,d,A,p);for(let S=0;S!==A;++S)b[S]=t[S];_.clippingState=b,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(u,d,p,g){const m=u!==null?u.length:0;let f=null;if(m!==0){if(f=l.value,g!==!0||f===null){const _=p+m*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(f===null||f.length<_)&&(f=new Float32Array(_));for(let A=0,b=p;A!==m;++A,b+=4)a.copy(u[A]).applyMatrix4(y,o),a.normal.toArray(f,b),f[b+3]=a.constant}l.value=f,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,f}}function rv(s){let e=new WeakMap;function t(a,o){return o===ro?a.mapping=mr:o===no&&(a.mapping=gr),a}function i(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const o=a.mapping;if(o===ro||o===no)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new xf(l.height/2);return c.fromEquirectangularTexture(s,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function n(){e=new WeakMap}return{get:i,dispose:n}}class dn extends lc{constructor(e=-1,t=1,i=1,r=-1,n=.1,a=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=r,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,n,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(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,r=(this.top+this.bottom)/2;let n=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=c*this.view.offsetX,a=n+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(n,a,o,l,this.near,this.far),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const kr=4,uc=[.125,.215,.35,.446,.526,.582],Vs=20,Vo=new dn,dc=new be;let Wo=null;const Ws=(1+Math.sqrt(5))/2,Or=1/Ws,pc=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,Ws,Or),new L(0,Ws,-Or),new L(Or,0,Ws),new L(-Or,0,Ws),new L(Ws,Or,0),new L(-Ws,Or,0)];class fc{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Wo=this._renderer.getRenderTarget(),this._setSize(256);const n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(e,i,r,n),t>0&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=vc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Wo),e.scissorTest=!1,va(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===mr||e.mapping===gr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Wo=this._renderer.getRenderTarget();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:gt,minFilter:gt,generateMipmaps:!1,type:sn,format:hi,encoding:Os,depthBuffer:!1},r=mc(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mc(e,t,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=nv(n)),this._blurMaterial=av(n,e,t)}return r}_compileMaterial(e){const t=new Ie(this._lodPlanes[0],e);this._renderer.compile(t,Vo)}_sceneToCubeUV(e,t,i,r){const n=new Nt(90,1,t,i),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor(dc),l.toneMapping=Di,l.autoClear=!1;const u=new Ui({name:"PMREM.Background",side:li,depthWrite:!1,depthTest:!1}),d=new Ie(new Un,u);let p=!1;const g=e.background;g?g.isColor&&(u.color.copy(g),e.background=null,p=!0):(u.color.copy(dc),p=!0);for(let m=0;m<6;m++){const f=m%3;f===0?(n.up.set(0,a[m],0),n.lookAt(o[m],0,0)):f===1?(n.up.set(0,0,a[m]),n.lookAt(0,o[m],0)):(n.up.set(0,a[m],0),n.lookAt(0,0,o[m]));const _=this._cubeSize;va(r,f*_,m>2?_:0,_,_),l.setRenderTarget(r),p&&l.render(d,n),l.render(e,n)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=h,l.autoClear=c,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===mr||e.mapping===gr;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=vc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gc());const n=r?this._cubemapMaterial:this._equirectMaterial,a=new Ie(this._lodPlanes[0],n),o=n.uniforms;o.envMap.value=e;const l=this._cubeSize;va(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,Vo)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const n=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=pc[(r-1)%pc.length];this._blur(e,r-1,r,n,a)}t.autoClear=i}_blur(e,t,i,r,n){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",n),this._halfBlur(a,e,i,i,r,"longitudinal",n)}_halfBlur(e,t,i,r,n,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Ie(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[i]-1,g=isFinite(n)?Math.PI/(2*p):2*Math.PI/(2*Vs-1),m=n/g,f=isFinite(n)?1+Math.floor(h*m):Vs;f>Vs&&console.warn(`sigmaRadians, ${n}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${Vs}`);const _=[];let y=0;for(let O=0;O<Vs;++O){const M=O/m,R=Math.exp(-M*M/2);_.push(R),O===0?y+=R:O<f&&(y+=2*R)}for(let O=0;O<_.length;O++)_[O]=_[O]/y;d.envMap.value=e.texture,d.samples.value=f,d.weights.value=_,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:A}=this;d.dTheta.value=g,d.mipInt.value=A-i;const b=this._sizeLods[r],S=3*b*(r>A-kr?r-A+kr:0),D=4*(this._cubeSize-b);va(t,S,D,3*b,2*b),l.setRenderTarget(t),l.render(u,Vo)}}function nv(s){const e=[],t=[],i=[];let r=s;const n=s-kr+1+uc.length;for(let a=0;a<n;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>s-kr?l=uc[a-s+kr-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],p=6,g=6,m=3,f=2,_=1,y=new Float32Array(m*g*p),A=new Float32Array(f*g*p),b=new Float32Array(_*g*p);for(let D=0;D<p;D++){const O=D%3*2/3-1,M=D>2?0:-1,R=[O,M,0,O+2/3,M,0,O+2/3,M+1,0,O,M,0,O+2/3,M+1,0,O,M+1,0];y.set(R,m*g*D),A.set(d,f*g*D);const N=[D,D,D,D,D,D];b.set(N,_*g*D)}const S=new lt;S.setAttribute("position",new Et(y,m)),S.setAttribute("uv",new Et(A,f)),S.setAttribute("faceIndex",new Et(b,_)),e.push(S),r>kr&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function mc(s,e,t){const i=new Us(s,e,t);return i.texture.mapping=Xn,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function va(s,e,t,i,r){s.viewport.set(e,t,i,r),s.scissor.set(e,t,i,r)}function av(s,e,t){const i=new Float32Array(Vs),r=new L(0,1,0);return new Fi({name:"SphericalGaussianBlur",defines:{n:Vs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:qo(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:rs,depthTest:!1,depthWrite:!1})}function gc(){return new Fi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:qo(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:rs,depthTest:!1,depthWrite:!1})}function vc(){return new Fi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qo(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:rs,depthTest:!1,depthWrite:!1})}function qo(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function ov(s){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===ro||l===no,h=l===mr||l===gr;if(c||h)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=e.get(o);return t===null&&(t=new fc(s)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),e.set(o,u),u.texture}else{if(e.has(o))return e.get(o).texture;{const u=o.image;if(c&&u&&u.height>0||h&&u&&r(u)){t===null&&(t=new fc(s));const d=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",n),d.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function n(o){const l=o.target;l.removeEventListener("dispose",n);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function lv(s){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=s.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function hv(s,e,t,i){const r={},n=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",a),delete r[d.id];const p=n.get(d);p&&(e.remove(p),n.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const g in d)e.update(d[g],34962);const p=u.morphAttributes;for(const g in p){const m=p[g];for(let f=0,_=m.length;f<_;f++)e.update(m[f],34962)}}function c(u){const d=[],p=u.index,g=u.attributes.position;let m=0;if(p!==null){const y=p.array;m=p.version;for(let A=0,b=y.length;A<b;A+=3){const S=y[A+0],D=y[A+1],O=y[A+2];d.push(S,D,D,O,O,S)}}else{const y=g.array;m=g.version;for(let A=0,b=y.length/3-1;A<b;A+=3){const S=A+0,D=A+1,O=A+2;d.push(S,D,D,O,O,S)}}const f=new(Vh(d)?ac:nc)(d,1);f.version=m;const _=n.get(u);_&&e.remove(_),n.set(u,f)}function h(u){const d=n.get(u);if(d){const p=u.index;p!==null&&d.version<p.version&&c(u)}else c(u);return n.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function cv(s,e,t,i){const r=i.isWebGL2;let n;function a(d){n=d}let o,l;function c(d){o=d.type,l=d.bytesPerElement}function h(d,p){s.drawElements(n,p,o,d*l),t.update(p,n,1)}function u(d,p,g){if(g===0)return;let m,f;if(r)m=s,f="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),f="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[f](n,p,o,d*l,g),t.update(p,n,g)}this.setMode=a,this.setIndex=c,this.render=h,this.renderInstances=u}function uv(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(n,a,o){switch(t.calls++,a){case 4:t.triangles+=o*(n/3);break;case 1:t.lines+=o*(n/2);break;case 3:t.lines+=o*(n-1);break;case 2:t.lines+=o*n;break;case 0:t.points+=o*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function dv(s,e){return s[0]-e[0]}function pv(s,e){return Math.abs(e[1])-Math.abs(s[1])}function Xo(s,e){let t=1;const i=e.isInterleavedBufferAttribute?e.data.array:e.array;i instanceof Int8Array?t=127:i instanceof Uint8Array?t=255:i instanceof Uint16Array?t=65535:i instanceof Int16Array?t=32767:i instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",i),s.divideScalar(t)}function fv(s,e,t){const i={},r=new Float32Array(8),n=new WeakMap,a=new je,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,h,u,d){const p=c.morphTargetInfluences;if(e.isWebGL2===!0){const g=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,m=g!==void 0?g.length:0;let f=n.get(h);if(f===void 0||f.count!==m){let A=function(){k.dispose(),n.delete(h),h.removeEventListener("dispose",A)};f!==void 0&&f.texture.dispose();const b=h.morphAttributes.position!==void 0,S=h.morphAttributes.normal!==void 0,D=h.morphAttributes.color!==void 0,O=h.morphAttributes.position||[],M=h.morphAttributes.normal||[],R=h.morphAttributes.color||[];let N=0;b===!0&&(N=1),S===!0&&(N=2),D===!0&&(N=3);let I=h.attributes.position.count*N,K=1;I>e.maxTextureSize&&(K=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const $=new Float32Array(I*K*4*m),k=new Yh($,I,K,m);k.type=os,k.needsUpdate=!0;const W=N*4;for(let U=0;U<m;U++){const Z=O[U],Y=M[U],F=R[U],G=I*K*4*U;for(let te=0;te<Z.count;te++){const X=te*W;b===!0&&(a.fromBufferAttribute(Z,te),Z.normalized===!0&&Xo(a,Z),$[G+X+0]=a.x,$[G+X+1]=a.y,$[G+X+2]=a.z,$[G+X+3]=0),S===!0&&(a.fromBufferAttribute(Y,te),Y.normalized===!0&&Xo(a,Y),$[G+X+4]=a.x,$[G+X+5]=a.y,$[G+X+6]=a.z,$[G+X+7]=0),D===!0&&(a.fromBufferAttribute(F,te),F.normalized===!0&&Xo(a,F),$[G+X+8]=a.x,$[G+X+9]=a.y,$[G+X+10]=a.z,$[G+X+11]=F.itemSize===4?a.w:1)}}f={count:m,texture:k,size:new we(I,K)},n.set(h,f),h.addEventListener("dispose",A)}let _=0;for(let A=0;A<p.length;A++)_+=p[A];const y=h.morphTargetsRelative?1:1-_;d.getUniforms().setValue(s,"morphTargetBaseInfluence",y),d.getUniforms().setValue(s,"morphTargetInfluences",p),d.getUniforms().setValue(s,"morphTargetsTexture",f.texture,t),d.getUniforms().setValue(s,"morphTargetsTextureSize",f.size)}else{const g=p===void 0?0:p.length;let m=i[h.id];if(m===void 0||m.length!==g){m=[];for(let b=0;b<g;b++)m[b]=[b,0];i[h.id]=m}for(let b=0;b<g;b++){const S=m[b];S[0]=b,S[1]=p[b]}m.sort(pv);for(let b=0;b<8;b++)b<g&&m[b][1]?(o[b][0]=m[b][0],o[b][1]=m[b][1]):(o[b][0]=Number.MAX_SAFE_INTEGER,o[b][1]=0);o.sort(dv);const f=h.morphAttributes.position,_=h.morphAttributes.normal;let y=0;for(let b=0;b<8;b++){const S=o[b],D=S[0],O=S[1];D!==Number.MAX_SAFE_INTEGER&&O?(f&&h.getAttribute("morphTarget"+b)!==f[D]&&h.setAttribute("morphTarget"+b,f[D]),_&&h.getAttribute("morphNormal"+b)!==_[D]&&h.setAttribute("morphNormal"+b,_[D]),r[b]=O,y+=O):(f&&h.hasAttribute("morphTarget"+b)===!0&&h.deleteAttribute("morphTarget"+b),_&&h.hasAttribute("morphNormal"+b)===!0&&h.deleteAttribute("morphNormal"+b),r[b]=0)}const A=h.morphTargetsRelative?1:1-y;d.getUniforms().setValue(s,"morphTargetBaseInfluence",A),d.getUniforms().setValue(s,"morphTargetInfluences",r)}}return{update:l}}function mv(s,e,t,i){let r=new WeakMap;function n(l){const c=i.render.frame,h=l.geometry,u=e.get(l,h);return r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:n,dispose:a}}const _c=new ht,yc=new Yh,xc=new af,bc=new hc,wc=[],Sc=[],Mc=new Float32Array(16),Tc=new Float32Array(9),Cc=new Float32Array(4);function Nr(s,e,t){const i=s[0];if(i<=0||i>0)return s;const r=e*t;let n=wc[r];if(n===void 0&&(n=new Float32Array(r),wc[r]=n),e!==0){i.toArray(n,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(n,o)}return n}function zt(s,e){if(s.length!==e.length)return!1;for(let t=0,i=s.length;t<i;t++)if(s[t]!==e[t])return!1;return!0}function Bt(s,e){for(let t=0,i=e.length;t<i;t++)s[t]=e[t]}function _a(s,e){let t=Sc[e];t===void 0&&(t=new Int32Array(e),Sc[e]=t);for(let i=0;i!==e;++i)t[i]=s.allocateTextureUnit();return t}function gv(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function vv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(zt(t,e))return;s.uniform2fv(this.addr,e),Bt(t,e)}}function _v(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(zt(t,e))return;s.uniform3fv(this.addr,e),Bt(t,e)}}function yv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(zt(t,e))return;s.uniform4fv(this.addr,e),Bt(t,e)}}function xv(s,e){const t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Bt(t,e)}else{if(zt(t,i))return;Cc.set(i),s.uniformMatrix2fv(this.addr,!1,Cc),Bt(t,i)}}function bv(s,e){const t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Bt(t,e)}else{if(zt(t,i))return;Tc.set(i),s.uniformMatrix3fv(this.addr,!1,Tc),Bt(t,i)}}function wv(s,e){const t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Bt(t,e)}else{if(zt(t,i))return;Mc.set(i),s.uniformMatrix4fv(this.addr,!1,Mc),Bt(t,i)}}function Sv(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Mv(s,e){const t=this.cache;zt(t,e)||(s.uniform2iv(this.addr,e),Bt(t,e))}function Tv(s,e){const t=this.cache;zt(t,e)||(s.uniform3iv(this.addr,e),Bt(t,e))}function Cv(s,e){const t=this.cache;zt(t,e)||(s.uniform4iv(this.addr,e),Bt(t,e))}function Ev(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Av(s,e){const t=this.cache;zt(t,e)||(s.uniform2uiv(this.addr,e),Bt(t,e))}function Lv(s,e){const t=this.cache;zt(t,e)||(s.uniform3uiv(this.addr,e),Bt(t,e))}function Rv(s,e){const t=this.cache;zt(t,e)||(s.uniform4uiv(this.addr,e),Bt(t,e))}function Pv(s,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(s.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||_c,r)}function Dv(s,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(s.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||xc,r)}function Iv(s,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(s.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||bc,r)}function kv(s,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(s.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||yc,r)}function Ov(s){switch(s){case 5126:return gv;case 35664:return vv;case 35665:return _v;case 35666:return yv;case 35674:return xv;case 35675:return bv;case 35676:return wv;case 5124:case 35670:return Sv;case 35667:case 35671:return Mv;case 35668:case 35672:return Tv;case 35669:case 35673:return Cv;case 5125:return Ev;case 36294:return Av;case 36295:return Lv;case 36296:return Rv;case 35678:case 36198:case 36298:case 36306:case 35682:return Pv;case 35679:case 36299:case 36307:return Dv;case 35680:case 36300:case 36308:case 36293:return Iv;case 36289:case 36303:case 36311:case 36292:return kv}}function Nv(s,e){s.uniform1fv(this.addr,e)}function zv(s,e){const t=Nr(e,this.size,2);s.uniform2fv(this.addr,t)}function Bv(s,e){const t=Nr(e,this.size,3);s.uniform3fv(this.addr,t)}function Uv(s,e){const t=Nr(e,this.size,4);s.uniform4fv(this.addr,t)}function Fv(s,e){const t=Nr(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function Hv(s,e){const t=Nr(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function Gv(s,e){const t=Nr(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function jv(s,e){s.uniform1iv(this.addr,e)}function Vv(s,e){s.uniform2iv(this.addr,e)}function Wv(s,e){s.uniform3iv(this.addr,e)}function qv(s,e){s.uniform4iv(this.addr,e)}function Xv(s,e){s.uniform1uiv(this.addr,e)}function Yv(s,e){s.uniform2uiv(this.addr,e)}function Zv(s,e){s.uniform3uiv(this.addr,e)}function $v(s,e){s.uniform4uiv(this.addr,e)}function Kv(s,e,t){const i=e.length,r=_a(t,i);s.uniform1iv(this.addr,r);for(let n=0;n!==i;++n)t.setTexture2D(e[n]||_c,r[n])}function Jv(s,e,t){const i=e.length,r=_a(t,i);s.uniform1iv(this.addr,r);for(let n=0;n!==i;++n)t.setTexture3D(e[n]||xc,r[n])}function Qv(s,e,t){const i=e.length,r=_a(t,i);s.uniform1iv(this.addr,r);for(let n=0;n!==i;++n)t.setTextureCube(e[n]||bc,r[n])}function e0(s,e,t){const i=e.length,r=_a(t,i);s.uniform1iv(this.addr,r);for(let n=0;n!==i;++n)t.setTexture2DArray(e[n]||yc,r[n])}function t0(s){switch(s){case 5126:return Nv;case 35664:return zv;case 35665:return Bv;case 35666:return Uv;case 35674:return Fv;case 35675:return Hv;case 35676:return Gv;case 5124:case 35670:return jv;case 35667:case 35671:return Vv;case 35668:case 35672:return Wv;case 35669:case 35673:return qv;case 5125:return Xv;case 36294:return Yv;case 36295:return Zv;case 36296:return $v;case 35678:case 36198:case 36298:case 36306:case 35682:return Kv;case 35679:case 36299:case 36307:return Jv;case 35680:case 36300:case 36308:case 36293:return Qv;case 36289:case 36303:case 36311:case 36292:return e0}}class i0{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=Ov(t.type)}}class s0{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=t0(t.type)}}class r0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let n=0,a=r.length;n!==a;++n){const o=r[n];o.setValue(e,t[o.id],i)}}}const Yo=/(\w+)(\])?(\[|\.)?/g;function Ec(s,e){s.seq.push(e),s.map[e.id]=e}function n0(s,e,t){const i=s.name,r=i.length;for(Yo.lastIndex=0;;){const n=Yo.exec(i),a=Yo.lastIndex;let o=n[1];const l=n[2]==="]",c=n[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Ec(t,c===void 0?new i0(o,s,e):new s0(o,s,e));break}else{let h=t.map[o];h===void 0&&(h=new r0(o),Ec(t,h)),t=h}}}class ya{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){const n=e.getActiveUniform(t,r),a=e.getUniformLocation(t,n.name);n0(n,a,this)}}setValue(e,t,i,r){const n=this.map[t];n!==void 0&&n.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let n=0,a=t.length;n!==a;++n){const o=t[n],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,n=e.length;r!==n;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function Ac(s,e,t){const i=s.createShader(e);return s.shaderSource(i,t),s.compileShader(i),i}let a0=0;function o0(s,e){const t=s.split(`
`),i=[],r=Math.max(e-6,0),n=Math.min(e+6,t.length);for(let a=r;a<n;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
`)}function l0(s){switch(s){case Os:return["Linear","( value )"];case Xe:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",s),["Linear","( value )"]}}function Lc(s,e,t){const i=s.getShaderParameter(e,35713),r=s.getShaderInfoLog(e).trim();if(i&&r==="")return"";const n=/ERROR: 0:(\d+)/.exec(r);if(n){const a=parseInt(n[1]);return t.toUpperCase()+`

`+r+`

`+o0(s.getShaderSource(e),a)}else return r}function h0(s,e){const t=l0(e);return"vec4 "+s+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function c0(s,e){let t;switch(e){case gp:t="Linear";break;case vp:t="Reinhard";break;case _p:t="OptimizedCineon";break;case yp:t="ACESFilmic";break;case xp:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function u0(s){return[s.extensionDerivatives||s.envMapCubeUVHeight||s.bumpMap||s.tangentSpaceNormalMap||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(pn).join(`
`)}function d0(s){const e=[];for(const t in s){const i=s[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function p0(s,e){const t={},i=s.getProgramParameter(e,35721);for(let r=0;r<i;r++){const n=s.getActiveAttrib(e,r),a=n.name;let o=1;n.type===35674&&(o=2),n.type===35675&&(o=3),n.type===35676&&(o=4),t[a]={type:n.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function pn(s){return s!==""}function Rc(s,e){return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Pc(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const f0=/^[ \t]*#include +<([\w\d./]+)>/gm;function Zo(s){return s.replace(f0,m0)}function m0(s,e){const t=ze[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Zo(t)}const g0=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,v0=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Dc(s){return s.replace(v0,Ic).replace(g0,_0)}function _0(s,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ic(s,e,t,i)}function Ic(s,e,t,i){let r="";for(let n=parseInt(e);n<parseInt(t);n++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+n+" ]").replace(/UNROLLED_LOOP_INDEX/g,n);return r}function kc(s){let e="precision "+s.precision+` float;
precision `+s.precision+" int;";return s.precision==="highp"?e+=`
#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function y0(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===sh?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===Xd?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===tn&&(e="SHADOWMAP_TYPE_VSM"),e}function x0(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case mr:case gr:e="ENVMAP_TYPE_CUBE";break;case Xn:e="ENVMAP_TYPE_CUBE_UV";break}return e}function b0(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case gr:e="ENVMAP_MODE_REFRACTION";break}return e}function w0(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case uh:e="ENVMAP_BLENDING_MULTIPLY";break;case fp:e="ENVMAP_BLENDING_MIX";break;case mp:e="ENVMAP_BLENDING_ADD";break}return e}function S0(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function M0(s,e,t,i){const r=s.getContext(),n=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=y0(t),c=x0(t),h=b0(t),u=w0(t),d=S0(t),p=t.isWebGL2?"":u0(t),g=d0(n),m=r.createProgram();let f,_,y=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(f=[g].filter(pn).join(`
`),f.length>0&&(f+=`
`),_=[p,g].filter(pn).join(`
`),_.length>0&&(_+=`
`)):(f=[kc(t),"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(pn).join(`
`),_=[p,kc(t),"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Di?"#define TONE_MAPPING":"",t.toneMapping!==Di?ze.tonemapping_pars_fragment:"",t.toneMapping!==Di?c0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.encodings_pars_fragment,h0("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(pn).join(`
`)),a=Zo(a),a=Rc(a,t),a=Pc(a,t),o=Zo(o),o=Rc(o,t),o=Pc(o,t),a=Dc(a),o=Dc(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
`,f=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+f,_=["#define varying in",t.glslVersion===Fh?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Fh?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+_);const A=y+f+a,b=y+_+o,S=Ac(r,35633,A),D=Ac(r,35632,b);if(r.attachShader(m,S),r.attachShader(m,D),t.index0AttributeName!==void 0?r.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),s.debug.checkShaderErrors){const R=r.getProgramInfoLog(m).trim(),N=r.getShaderInfoLog(S).trim(),I=r.getShaderInfoLog(D).trim();let K=!0,$=!0;if(r.getProgramParameter(m,35714)===!1){K=!1;const k=Lc(r,S,"vertex"),W=Lc(r,D,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,35715)+`

Program Info Log: `+R+`
`+k+`
`+W)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(N===""||I==="")&&($=!1);$&&(this.diagnostics={runnable:K,programLog:R,vertexShader:{log:N,prefix:f},fragmentShader:{log:I,prefix:_}})}r.deleteShader(S),r.deleteShader(D);let O;this.getUniforms=function(){return O===void 0&&(O=new ya(r,m)),O};let M;return this.getAttributes=function(){return M===void 0&&(M=p0(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=a0++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=D,this}let T0=0;class C0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),n=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(n)===!1&&(a.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const i=new E0(e);t.set(e,i)}return t.get(e)}}class E0{constructor(e){this.id=T0++,this.code=e,this.usedTimes=0}}function A0(s,e,t,i,r,n,a){const o=new Ro,l=new C0,c=[],h=r.isWebGL2,u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(M,R,N,I,K){const $=I.fog,k=K.geometry,W=M.isMeshStandardMaterial?I.environment:null,U=(M.isMeshStandardMaterial?t:e).get(M.envMap||W),Z=U&&U.mapping===Xn?U.image.height:null,Y=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const F=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,G=F!==void 0?F.length:0;let te=0;k.morphAttributes.position!==void 0&&(te=1),k.morphAttributes.normal!==void 0&&(te=2),k.morphAttributes.color!==void 0&&(te=3);let X,ie,ce,Se;if(Y){const de=qt[Y];X=de.vertexShader,ie=de.fragmentShader}else X=M.vertexShader,ie=M.fragmentShader,l.update(M),ce=l.getVertexShaderID(M),Se=l.getFragmentShaderID(M);const H=s.getRenderTarget(),Ke=M.alphaTest>0,Le=M.clearcoat>0,Me=M.iridescence>0;return{isWebGL2:h,shaderID:Y,shaderName:M.type,vertexShader:X,fragmentShader:ie,defines:M.defines,customVertexShaderID:ce,customFragmentShaderID:Se,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,instancing:K.isInstancedMesh===!0,instancingColor:K.isInstancedMesh===!0&&K.instanceColor!==null,supportsVertexTextures:d,outputEncoding:H===null?s.outputEncoding:H.isXRRenderTarget===!0?H.texture.encoding:Os,map:!!M.map,matcap:!!M.matcap,envMap:!!U,envMapMode:U&&U.mapping,envMapCubeUVHeight:Z,lightMap:!!M.lightMap,aoMap:!!M.aoMap,emissiveMap:!!M.emissiveMap,bumpMap:!!M.bumpMap,normalMap:!!M.normalMap,objectSpaceNormalMap:M.normalMapType===Hp,tangentSpaceNormalMap:M.normalMapType===fo,decodeVideoTexture:!!M.map&&M.map.isVideoTexture===!0&&M.map.encoding===Xe,clearcoat:Le,clearcoatMap:Le&&!!M.clearcoatMap,clearcoatRoughnessMap:Le&&!!M.clearcoatRoughnessMap,clearcoatNormalMap:Le&&!!M.clearcoatNormalMap,iridescence:Me,iridescenceMap:Me&&!!M.iridescenceMap,iridescenceThicknessMap:Me&&!!M.iridescenceThicknessMap,displacementMap:!!M.displacementMap,roughnessMap:!!M.roughnessMap,metalnessMap:!!M.metalnessMap,specularMap:!!M.specularMap,specularIntensityMap:!!M.specularIntensityMap,specularColorMap:!!M.specularColorMap,opaque:M.transparent===!1&&M.blending===pr,alphaMap:!!M.alphaMap,alphaTest:Ke,gradientMap:!!M.gradientMap,sheen:M.sheen>0,sheenColorMap:!!M.sheenColorMap,sheenRoughnessMap:!!M.sheenRoughnessMap,transmission:M.transmission>0,transmissionMap:!!M.transmissionMap,thicknessMap:!!M.thicknessMap,combine:M.combine,vertexTangents:!!M.normalMap&&!!k.attributes.tangent,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,vertexUvs:!!M.map||!!M.bumpMap||!!M.normalMap||!!M.specularMap||!!M.alphaMap||!!M.emissiveMap||!!M.roughnessMap||!!M.metalnessMap||!!M.clearcoatMap||!!M.clearcoatRoughnessMap||!!M.clearcoatNormalMap||!!M.iridescenceMap||!!M.iridescenceThicknessMap||!!M.displacementMap||!!M.transmissionMap||!!M.thicknessMap||!!M.specularIntensityMap||!!M.specularColorMap||!!M.sheenColorMap||!!M.sheenRoughnessMap,uvsVertexOnly:!(M.map||M.bumpMap||M.normalMap||M.specularMap||M.alphaMap||M.emissiveMap||M.roughnessMap||M.metalnessMap||M.clearcoatNormalMap||M.iridescenceMap||M.iridescenceThicknessMap||M.transmission>0||M.transmissionMap||M.thicknessMap||M.specularIntensityMap||M.specularColorMap||M.sheen>0||M.sheenColorMap||M.sheenRoughnessMap)&&!!M.displacementMap,fog:!!$,useFog:M.fog===!0,fogExp2:$&&$.isFogExp2,flatShading:!!M.flatShading,sizeAttenuation:M.sizeAttenuation,logarithmicDepthBuffer:u,skinning:K.isSkinnedMesh===!0,morphTargets:k.morphAttributes.position!==void 0,morphNormals:k.morphAttributes.normal!==void 0,morphColors:k.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:te,numDirLights:R.directional.length,numPointLights:R.point.length,numSpotLights:R.spot.length,numRectAreaLights:R.rectArea.length,numHemiLights:R.hemi.length,numDirLightShadows:R.directionalShadowMap.length,numPointLightShadows:R.pointShadowMap.length,numSpotLightShadows:R.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:s.shadowMap.enabled&&N.length>0,shadowMapType:s.shadowMap.type,toneMapping:M.toneMapped?s.toneMapping:Di,physicallyCorrectLights:s.physicallyCorrectLights,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Ps,flipSided:M.side===li,useDepthPacking:!!M.depthPacking,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:M.extensions&&M.extensions.derivatives,extensionFragDepth:M.extensions&&M.extensions.fragDepth,extensionDrawBuffers:M.extensions&&M.extensions.drawBuffers,extensionShaderTextureLOD:M.extensions&&M.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function f(M){const R=[];if(M.shaderID?R.push(M.shaderID):(R.push(M.customVertexShaderID),R.push(M.customFragmentShaderID)),M.defines!==void 0)for(const N in M.defines)R.push(N),R.push(M.defines[N]);return M.isRawShaderMaterial===!1&&(_(R,M),y(R,M),R.push(s.outputEncoding)),R.push(M.customProgramCacheKey),R.join()}function _(M,R){M.push(R.precision),M.push(R.outputEncoding),M.push(R.envMapMode),M.push(R.envMapCubeUVHeight),M.push(R.combine),M.push(R.vertexUvs),M.push(R.fogExp2),M.push(R.sizeAttenuation),M.push(R.morphTargetsCount),M.push(R.morphAttributeCount),M.push(R.numDirLights),M.push(R.numPointLights),M.push(R.numSpotLights),M.push(R.numHemiLights),M.push(R.numRectAreaLights),M.push(R.numDirLightShadows),M.push(R.numPointLightShadows),M.push(R.numSpotLightShadows),M.push(R.shadowMapType),M.push(R.toneMapping),M.push(R.numClippingPlanes),M.push(R.numClipIntersection),M.push(R.depthPacking)}function y(M,R){o.disableAll(),R.isWebGL2&&o.enable(0),R.supportsVertexTextures&&o.enable(1),R.instancing&&o.enable(2),R.instancingColor&&o.enable(3),R.map&&o.enable(4),R.matcap&&o.enable(5),R.envMap&&o.enable(6),R.lightMap&&o.enable(7),R.aoMap&&o.enable(8),R.emissiveMap&&o.enable(9),R.bumpMap&&o.enable(10),R.normalMap&&o.enable(11),R.objectSpaceNormalMap&&o.enable(12),R.tangentSpaceNormalMap&&o.enable(13),R.clearcoat&&o.enable(14),R.clearcoatMap&&o.enable(15),R.clearcoatRoughnessMap&&o.enable(16),R.clearcoatNormalMap&&o.enable(17),R.iridescence&&o.enable(18),R.iridescenceMap&&o.enable(19),R.iridescenceThicknessMap&&o.enable(20),R.displacementMap&&o.enable(21),R.specularMap&&o.enable(22),R.roughnessMap&&o.enable(23),R.metalnessMap&&o.enable(24),R.gradientMap&&o.enable(25),R.alphaMap&&o.enable(26),R.alphaTest&&o.enable(27),R.vertexColors&&o.enable(28),R.vertexAlphas&&o.enable(29),R.vertexUvs&&o.enable(30),R.vertexTangents&&o.enable(31),R.uvsVertexOnly&&o.enable(32),R.fog&&o.enable(33),M.push(o.mask),o.disableAll(),R.useFog&&o.enable(0),R.flatShading&&o.enable(1),R.logarithmicDepthBuffer&&o.enable(2),R.skinning&&o.enable(3),R.morphTargets&&o.enable(4),R.morphNormals&&o.enable(5),R.morphColors&&o.enable(6),R.premultipliedAlpha&&o.enable(7),R.shadowMapEnabled&&o.enable(8),R.physicallyCorrectLights&&o.enable(9),R.doubleSided&&o.enable(10),R.flipSided&&o.enable(11),R.useDepthPacking&&o.enable(12),R.dithering&&o.enable(13),R.specularIntensityMap&&o.enable(14),R.specularColorMap&&o.enable(15),R.transmission&&o.enable(16),R.transmissionMap&&o.enable(17),R.thicknessMap&&o.enable(18),R.sheen&&o.enable(19),R.sheenColorMap&&o.enable(20),R.sheenRoughnessMap&&o.enable(21),R.decodeVideoTexture&&o.enable(22),R.opaque&&o.enable(23),M.push(o.mask)}function A(M){const R=g[M.type];let N;if(R){const I=qt[R];N=Ho.clone(I.uniforms)}else N=M.uniforms;return N}function b(M,R){let N;for(let I=0,K=c.length;I<K;I++){const $=c[I];if($.cacheKey===R){N=$,++N.usedTimes;break}}return N===void 0&&(N=new M0(s,R,M,n),c.push(N)),N}function S(M){if(--M.usedTimes===0){const R=c.indexOf(M);c[R]=c[c.length-1],c.pop(),M.destroy()}}function D(M){l.remove(M)}function O(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:A,acquireProgram:b,releaseProgram:S,releaseShaderCache:D,programs:c,dispose:O}}function L0(){let s=new WeakMap;function e(n){let a=s.get(n);return a===void 0&&(a={},s.set(n,a)),a}function t(n){s.delete(n)}function i(n,a,o){s.get(n)[a]=o}function r(){s=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function R0(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Oc(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Nc(){const s=[];let e=0;const t=[],i=[],r=[];function n(){e=0,t.length=0,i.length=0,r.length=0}function a(u,d,p,g,m,f){let _=s[e];return _===void 0?(_={id:u.id,object:u,geometry:d,material:p,groupOrder:g,renderOrder:u.renderOrder,z:m,group:f},s[e]=_):(_.id=u.id,_.object=u,_.geometry=d,_.material=p,_.groupOrder=g,_.renderOrder=u.renderOrder,_.z=m,_.group=f),e++,_}function o(u,d,p,g,m,f){const _=a(u,d,p,g,m,f);p.transmission>0?i.push(_):p.transparent===!0?r.push(_):t.push(_)}function l(u,d,p,g,m,f){const _=a(u,d,p,g,m,f);p.transmission>0?i.unshift(_):p.transparent===!0?r.unshift(_):t.unshift(_)}function c(u,d){t.length>1&&t.sort(u||R0),i.length>1&&i.sort(d||Oc),r.length>1&&r.sort(d||Oc)}function h(){for(let u=e,d=s.length;u<d;u++){const p=s[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:n,push:o,unshift:l,finish:h,sort:c}}function P0(){let s=new WeakMap;function e(i,r){let n;return s.has(i)===!1?(n=new Nc,s.set(i,[n])):r>=s.get(i).length?(n=new Nc,s.get(i).push(n)):n=s.get(i)[r],n}function t(){s=new WeakMap}return{get:e,dispose:t}}function D0(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new L,color:new be};break;case"SpotLight":t={position:new L,direction:new L,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new L,halfWidth:new L,halfHeight:new L};break}return s[e.id]=t,t}}}function I0(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let k0=0;function O0(s,e){return(e.castShadow?1:0)-(s.castShadow?1:0)}function N0(s,e){const t=new D0,i=I0(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let h=0;h<9;h++)r.probe.push(new L);const n=new L,a=new He,o=new He;function l(h,u){let d=0,p=0,g=0;for(let R=0;R<9;R++)r.probe[R].set(0,0,0);let m=0,f=0,_=0,y=0,A=0,b=0,S=0,D=0;h.sort(O0);const O=u!==!0?Math.PI:1;for(let R=0,N=h.length;R<N;R++){const I=h[R],K=I.color,$=I.intensity,k=I.distance,W=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)d+=K.r*$*O,p+=K.g*$*O,g+=K.b*$*O;else if(I.isLightProbe)for(let U=0;U<9;U++)r.probe[U].addScaledVector(I.sh.coefficients[U],$);else if(I.isDirectionalLight){const U=t.get(I);if(U.color.copy(I.color).multiplyScalar(I.intensity*O),I.castShadow){const Z=I.shadow,Y=i.get(I);Y.shadowBias=Z.bias,Y.shadowNormalBias=Z.normalBias,Y.shadowRadius=Z.radius,Y.shadowMapSize=Z.mapSize,r.directionalShadow[m]=Y,r.directionalShadowMap[m]=W,r.directionalShadowMatrix[m]=I.shadow.matrix,b++}r.directional[m]=U,m++}else if(I.isSpotLight){const U=t.get(I);if(U.position.setFromMatrixPosition(I.matrixWorld),U.color.copy(K).multiplyScalar($*O),U.distance=k,U.coneCos=Math.cos(I.angle),U.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),U.decay=I.decay,I.castShadow){const Z=I.shadow,Y=i.get(I);Y.shadowBias=Z.bias,Y.shadowNormalBias=Z.normalBias,Y.shadowRadius=Z.radius,Y.shadowMapSize=Z.mapSize,r.spotShadow[_]=Y,r.spotShadowMap[_]=W,r.spotShadowMatrix[_]=I.shadow.matrix,D++}r.spot[_]=U,_++}else if(I.isRectAreaLight){const U=t.get(I);U.color.copy(K).multiplyScalar($),U.halfWidth.set(I.width*.5,0,0),U.halfHeight.set(0,I.height*.5,0),r.rectArea[y]=U,y++}else if(I.isPointLight){const U=t.get(I);if(U.color.copy(I.color).multiplyScalar(I.intensity*O),U.distance=I.distance,U.decay=I.decay,I.castShadow){const Z=I.shadow,Y=i.get(I);Y.shadowBias=Z.bias,Y.shadowNormalBias=Z.normalBias,Y.shadowRadius=Z.radius,Y.shadowMapSize=Z.mapSize,Y.shadowCameraNear=Z.camera.near,Y.shadowCameraFar=Z.camera.far,r.pointShadow[f]=Y,r.pointShadowMap[f]=W,r.pointShadowMatrix[f]=I.shadow.matrix,S++}r.point[f]=U,f++}else if(I.isHemisphereLight){const U=t.get(I);U.skyColor.copy(I.color).multiplyScalar($*O),U.groundColor.copy(I.groundColor).multiplyScalar($*O),r.hemi[A]=U,A++}}y>0&&(e.isWebGL2||s.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ue.LTC_FLOAT_1,r.rectAreaLTC2=ue.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ue.LTC_HALF_1,r.rectAreaLTC2=ue.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=d,r.ambient[1]=p,r.ambient[2]=g;const M=r.hash;(M.directionalLength!==m||M.pointLength!==f||M.spotLength!==_||M.rectAreaLength!==y||M.hemiLength!==A||M.numDirectionalShadows!==b||M.numPointShadows!==S||M.numSpotShadows!==D)&&(r.directional.length=m,r.spot.length=_,r.rectArea.length=y,r.point.length=f,r.hemi.length=A,r.directionalShadow.length=b,r.directionalShadowMap.length=b,r.pointShadow.length=S,r.pointShadowMap.length=S,r.spotShadow.length=D,r.spotShadowMap.length=D,r.directionalShadowMatrix.length=b,r.pointShadowMatrix.length=S,r.spotShadowMatrix.length=D,M.directionalLength=m,M.pointLength=f,M.spotLength=_,M.rectAreaLength=y,M.hemiLength=A,M.numDirectionalShadows=b,M.numPointShadows=S,M.numSpotShadows=D,r.version=k0++)}function c(h,u){let d=0,p=0,g=0,m=0,f=0;const _=u.matrixWorldInverse;for(let y=0,A=h.length;y<A;y++){const b=h[y];if(b.isDirectionalLight){const S=r.directional[d];S.direction.setFromMatrixPosition(b.matrixWorld),n.setFromMatrixPosition(b.target.matrixWorld),S.direction.sub(n),S.direction.transformDirection(_),d++}else if(b.isSpotLight){const S=r.spot[g];S.position.setFromMatrixPosition(b.matrixWorld),S.position.applyMatrix4(_),S.direction.setFromMatrixPosition(b.matrixWorld),n.setFromMatrixPosition(b.target.matrixWorld),S.direction.sub(n),S.direction.transformDirection(_),g++}else if(b.isRectAreaLight){const S=r.rectArea[m];S.position.setFromMatrixPosition(b.matrixWorld),S.position.applyMatrix4(_),o.identity(),a.copy(b.matrixWorld),a.premultiply(_),o.extractRotation(a),S.halfWidth.set(b.width*.5,0,0),S.halfHeight.set(0,b.height*.5,0),S.halfWidth.applyMatrix4(o),S.halfHeight.applyMatrix4(o),m++}else if(b.isPointLight){const S=r.point[p];S.position.setFromMatrixPosition(b.matrixWorld),S.position.applyMatrix4(_),p++}else if(b.isHemisphereLight){const S=r.hemi[f];S.direction.setFromMatrixPosition(b.matrixWorld),S.direction.transformDirection(_),f++}}}return{setup:l,setupView:c,state:r}}function zc(s,e){const t=new N0(s,e),i=[],r=[];function n(){i.length=0,r.length=0}function a(h){i.push(h)}function o(h){r.push(h)}function l(h){t.setup(i,h)}function c(h){t.setupView(i,h)}return{init:n,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function z0(s,e){let t=new WeakMap;function i(n,a=0){let o;return t.has(n)===!1?(o=new zc(s,e),t.set(n,[o])):a>=t.get(n).length?(o=new zc(s,e),t.get(n).push(o)):o=t.get(n)[a],o}function r(){t=new WeakMap}return{get:i,dispose:r}}class B0 extends gi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Up,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 U0 extends gi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new L,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const F0=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,H0=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function G0(s,e,t){let i=new jo;const r=new we,n=new we,a=new je,o=new B0({depthPacking:Fp}),l=new U0,c={},h=t.maxTextureSize,u={0:li,1:Rs,2:Ps},d=new Fi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:F0,fragmentShader:H0}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new lt;g.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Ie(g,d),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sh,this.render=function(b,S,D){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||b.length===0)return;const O=s.getRenderTarget(),M=s.getActiveCubeFace(),R=s.getActiveMipmapLevel(),N=s.state;N.setBlending(rs),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);for(let I=0,K=b.length;I<K;I++){const $=b[I],k=$.shadow;if(k===void 0){console.warn("THREE.WebGLShadowMap:",$,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;r.copy(k.mapSize);const W=k.getFrameExtents();if(r.multiply(W),n.copy(k.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(n.x=Math.floor(h/W.x),r.x=n.x*W.x,k.mapSize.x=n.x),r.y>h&&(n.y=Math.floor(h/W.y),r.y=n.y*W.y,k.mapSize.y=n.y)),k.map===null){const Z=this.type!==tn?{minFilter:xt,magFilter:xt}:{};k.map=new Us(r.x,r.y,Z),k.map.texture.name=$.name+".shadowMap",k.camera.updateProjectionMatrix()}s.setRenderTarget(k.map),s.clear();const U=k.getViewportCount();for(let Z=0;Z<U;Z++){const Y=k.getViewport(Z);a.set(n.x*Y.x,n.y*Y.y,n.x*Y.z,n.y*Y.w),N.viewport(a),k.updateMatrices($,Z),i=k.getFrustum(),A(S,D,k.camera,$,this.type)}k.isPointLightShadow!==!0&&this.type===tn&&_(k,D),k.needsUpdate=!1}f.needsUpdate=!1,s.setRenderTarget(O,M,R)};function _(b,S){const D=e.update(m);d.defines.VSM_SAMPLES!==b.blurSamples&&(d.defines.VSM_SAMPLES=b.blurSamples,p.defines.VSM_SAMPLES=b.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new Us(r.x,r.y)),d.uniforms.shadow_pass.value=b.map.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,s.setRenderTarget(b.mapPass),s.clear(),s.renderBufferDirect(S,null,D,d,m,null),p.uniforms.shadow_pass.value=b.mapPass.texture,p.uniforms.resolution.value=b.mapSize,p.uniforms.radius.value=b.radius,s.setRenderTarget(b.map),s.clear(),s.renderBufferDirect(S,null,D,p,m,null)}function y(b,S,D,O,M,R){let N=null;const I=D.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(I!==void 0?N=I:N=D.isPointLight===!0?l:o,s.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){const K=N.uuid,$=S.uuid;let k=c[K];k===void 0&&(k={},c[K]=k);let W=k[$];W===void 0&&(W=N.clone(),k[$]=W),N=W}return N.visible=S.visible,N.wireframe=S.wireframe,R===tn?N.side=S.shadowSide!==null?S.shadowSide:S.side:N.side=S.shadowSide!==null?S.shadowSide:u[S.side],N.alphaMap=S.alphaMap,N.alphaTest=S.alphaTest,N.clipShadows=S.clipShadows,N.clippingPlanes=S.clippingPlanes,N.clipIntersection=S.clipIntersection,N.displacementMap=S.displacementMap,N.displacementScale=S.displacementScale,N.displacementBias=S.displacementBias,N.wireframeLinewidth=S.wireframeLinewidth,N.linewidth=S.linewidth,D.isPointLight===!0&&N.isMeshDistanceMaterial===!0&&(N.referencePosition.setFromMatrixPosition(D.matrixWorld),N.nearDistance=O,N.farDistance=M),N}function A(b,S,D,O,M){if(b.visible===!1)return;if(b.layers.test(S.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===tn)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,b.matrixWorld);const N=e.update(b),I=b.material;if(Array.isArray(I)){const K=N.groups;for(let $=0,k=K.length;$<k;$++){const W=K[$],U=I[W.materialIndex];if(U&&U.visible){const Z=y(b,U,O,D.near,D.far,M);s.renderBufferDirect(D,null,N,Z,b,W)}}}else if(I.visible){const K=y(b,I,O,D.near,D.far,M);s.renderBufferDirect(D,null,N,K,b,null)}}const R=b.children;for(let N=0,I=R.length;N<I;N++)A(R[N],S,D,O,M)}}function j0(s,e,t){const i=t.isWebGL2;function r(){let P=!1;const re=new je;let ne=null;const me=new je(0,0,0,0);return{setMask:function(fe){ne!==fe&&!P&&(s.colorMask(fe,fe,fe,fe),ne=fe)},setLocked:function(fe){P=fe},setClear:function(fe,ye,le,Te,_e){_e===!0&&(fe*=Te,ye*=Te,le*=Te),re.set(fe,ye,le,Te),me.equals(re)===!1&&(s.clearColor(fe,ye,le,Te),me.copy(re))},reset:function(){P=!1,ne=null,me.set(-1,0,0,0)}}}function n(){let P=!1,re=null,ne=null,me=null;return{setTest:function(fe){fe?Se(2929):H(2929)},setMask:function(fe){re!==fe&&!P&&(s.depthMask(fe),re=fe)},setFunc:function(fe){if(ne!==fe){if(fe)switch(fe){case op:s.depthFunc(512);break;case lp:s.depthFunc(519);break;case hp:s.depthFunc(513);break;case so:s.depthFunc(515);break;case cp:s.depthFunc(514);break;case up:s.depthFunc(518);break;case dp:s.depthFunc(516);break;case pp:s.depthFunc(517);break;default:s.depthFunc(515)}else s.depthFunc(515);ne=fe}},setLocked:function(fe){P=fe},setClear:function(fe){me!==fe&&(s.clearDepth(fe),me=fe)},reset:function(){P=!1,re=null,ne=null,me=null}}}function a(){let P=!1,re=null,ne=null,me=null,fe=null,ye=null,le=null,Te=null,_e=null;return{setTest:function(qe){P||(qe?Se(2960):H(2960))},setMask:function(qe){re!==qe&&!P&&(s.stencilMask(qe),re=qe)},setFunc:function(qe,_t,Zt){(ne!==qe||me!==_t||fe!==Zt)&&(s.stencilFunc(qe,_t,Zt),ne=qe,me=_t,fe=Zt)},setOp:function(qe,_t,Zt){(ye!==qe||le!==_t||Te!==Zt)&&(s.stencilOp(qe,_t,Zt),ye=qe,le=_t,Te=Zt)},setLocked:function(qe){P=qe},setClear:function(qe){_e!==qe&&(s.clearStencil(qe),_e=qe)},reset:function(){P=!1,re=null,ne=null,me=null,fe=null,ye=null,le=null,Te=null,_e=null}}}const o=new r,l=new n,c=new a;let h={},u={},d=new WeakMap,p=[],g=null,m=!1,f=null,_=null,y=null,A=null,b=null,S=null,D=null,O=!1,M=null,R=null,N=null,I=null,K=null;const $=s.getParameter(35661);let k=!1,W=0;const U=s.getParameter(7938);U.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(U)[1]),k=W>=1):U.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),k=W>=2);let Z=null,Y={};const F=s.getParameter(3088),G=s.getParameter(2978),te=new je().fromArray(F),X=new je().fromArray(G);function ie(P,re,ne){const me=new Uint8Array(4),fe=s.createTexture();s.bindTexture(P,fe),s.texParameteri(P,10241,9728),s.texParameteri(P,10240,9728);for(let ye=0;ye<ne;ye++)s.texImage2D(re+ye,0,6408,1,1,0,6408,5121,me);return fe}const ce={};ce[3553]=ie(3553,3553,1),ce[34067]=ie(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Se(2929),l.setFunc(so),nt(!1),at(ih),Se(2884),Ce(rs);function Se(P){h[P]!==!0&&(s.enable(P),h[P]=!0)}function H(P){h[P]!==!1&&(s.disable(P),h[P]=!1)}function Ke(P,re){return u[P]!==re?(s.bindFramebuffer(P,re),u[P]=re,i&&(P===36009&&(u[36160]=re),P===36160&&(u[36009]=re)),!0):!1}function Le(P,re){let ne=p,me=!1;if(P)if(ne=d.get(re),ne===void 0&&(ne=[],d.set(re,ne)),P.isWebGLMultipleRenderTargets){const fe=P.texture;if(ne.length!==fe.length||ne[0]!==36064){for(let ye=0,le=fe.length;ye<le;ye++)ne[ye]=36064+ye;ne.length=fe.length,me=!0}}else ne[0]!==36064&&(ne[0]=36064,me=!0);else ne[0]!==1029&&(ne[0]=1029,me=!0);me&&(t.isWebGL2?s.drawBuffers(ne):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(ne))}function Me(P){return g!==P?(s.useProgram(P),g=P,!0):!1}const de={[fr]:32774,[$d]:32778,[Kd]:32779};if(i)de[oh]=32775,de[lh]=32776;else{const P=e.get("EXT_blend_minmax");P!==null&&(de[oh]=P.MIN_EXT,de[lh]=P.MAX_EXT)}const Ve={[Jd]:0,[Qd]:1,[ep]:768,[hh]:770,[ap]:776,[rp]:774,[ip]:772,[tp]:769,[ch]:771,[np]:775,[sp]:773};function Ce(P,re,ne,me,fe,ye,le,Te){if(P===rs){m===!0&&(H(3042),m=!1);return}if(m===!1&&(Se(3042),m=!0),P!==Zd){if(P!==f||Te!==O){if((_!==fr||b!==fr)&&(s.blendEquation(32774),_=fr,b=fr),Te)switch(P){case pr:s.blendFuncSeparate(1,771,1,771);break;case rh:s.blendFunc(1,1);break;case nh:s.blendFuncSeparate(0,769,0,1);break;case ah:s.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}else switch(P){case pr:s.blendFuncSeparate(770,771,1,771);break;case rh:s.blendFunc(770,1);break;case nh:s.blendFuncSeparate(0,769,0,1);break;case ah:s.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}y=null,A=null,S=null,D=null,f=P,O=Te}return}fe=fe||re,ye=ye||ne,le=le||me,(re!==_||fe!==b)&&(s.blendEquationSeparate(de[re],de[fe]),_=re,b=fe),(ne!==y||me!==A||ye!==S||le!==D)&&(s.blendFuncSeparate(Ve[ne],Ve[me],Ve[ye],Ve[le]),y=ne,A=me,S=ye,D=le),f=P,O=null}function ge(P,re){P.side===Ps?H(2884):Se(2884);let ne=P.side===li;re&&(ne=!ne),nt(ne),P.blending===pr&&P.transparent===!1?Ce(rs):Ce(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.premultipliedAlpha),l.setFunc(P.depthFunc),l.setTest(P.depthTest),l.setMask(P.depthWrite),o.setMask(P.colorWrite);const me=P.stencilWrite;c.setTest(me),me&&(c.setMask(P.stencilWriteMask),c.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),c.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),mt(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?Se(32926):H(32926)}function nt(P){M!==P&&(P?s.frontFace(2304):s.frontFace(2305),M=P)}function at(P){P!==Wd?(Se(2884),P!==R&&(P===ih?s.cullFace(1029):P===qd?s.cullFace(1028):s.cullFace(1032))):H(2884),R=P}function et(P){P!==N&&(k&&s.lineWidth(P),N=P)}function mt(P,re,ne){P?(Se(32823),(I!==re||K!==ne)&&(s.polygonOffset(re,ne),I=re,K=ne)):H(32823)}function tt(P){P?Se(3089):H(3089)}function Ge(P){P===void 0&&(P=33984+$-1),Z!==P&&(s.activeTexture(P),Z=P)}function Dt(P,re){Z===null&&Ge();let ne=Y[Z];ne===void 0&&(ne={type:void 0,texture:void 0},Y[Z]=ne),(ne.type!==P||ne.texture!==re)&&(s.bindTexture(P,re||ce[P]),ne.type=P,ne.texture=re)}function Wt(){const P=Y[Z];P!==void 0&&P.type!==void 0&&(s.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function E(){try{s.compressedTexImage2D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function x(){try{s.texSubImage2D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function j(){try{s.texSubImage3D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function se(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function he(){try{s.texStorage2D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function pe(){try{s.texStorage3D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function xe(){try{s.texImage2D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function w(){try{s.texImage3D.apply(s,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function J(P){te.equals(P)===!1&&(s.scissor(P.x,P.y,P.z,P.w),te.copy(P))}function ae(P){X.equals(P)===!1&&(s.viewport(P.x,P.y,P.z,P.w),X.copy(P))}function oe(){s.disable(3042),s.disable(2884),s.disable(2929),s.disable(32823),s.disable(3089),s.disable(2960),s.disable(32926),s.blendEquation(32774),s.blendFunc(1,0),s.blendFuncSeparate(1,0,1,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(513),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(519,0,4294967295),s.stencilOp(7680,7680,7680),s.clearStencil(0),s.cullFace(1029),s.frontFace(2305),s.polygonOffset(0,0),s.activeTexture(33984),s.bindFramebuffer(36160,null),i===!0&&(s.bindFramebuffer(36009,null),s.bindFramebuffer(36008,null)),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),h={},Z=null,Y={},u={},d=new WeakMap,p=[],g=null,m=!1,f=null,_=null,y=null,A=null,b=null,S=null,D=null,O=!1,M=null,R=null,N=null,I=null,K=null,te.set(0,0,s.canvas.width,s.canvas.height),X.set(0,0,s.canvas.width,s.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Se,disable:H,bindFramebuffer:Ke,drawBuffers:Le,useProgram:Me,setBlending:Ce,setMaterial:ge,setFlipSided:nt,setCullFace:at,setLineWidth:et,setPolygonOffset:mt,setScissorTest:tt,activeTexture:Ge,bindTexture:Dt,unbindTexture:Wt,compressedTexImage2D:E,texImage2D:xe,texImage3D:w,texStorage2D:he,texStorage3D:pe,texSubImage2D:x,texSubImage3D:j,compressedTexSubImage2D:se,scissor:J,viewport:ae,reset:oe}}function V0(s,e,t,i,r,n,a){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,h=r.maxTextureSize,u=r.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let m;const f=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(E,x){return _?new OffscreenCanvas(E,x):ln("canvas")}function A(E,x,j,se){let he=1;if((E.width>se||E.height>se)&&(he=se/Math.max(E.width,E.height)),he<1||x===!0)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap){const pe=x?Zn:Math.floor,xe=pe(he*E.width),w=pe(he*E.height);m===void 0&&(m=y(xe,w));const J=j?y(xe,w):m;return J.width=xe,J.height=w,J.getContext("2d").drawImage(E,0,0,xe,w),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+E.width+"x"+E.height+") to ("+xe+"x"+w+")."),J}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+E.width+"x"+E.height+")."),E;return E}function b(E){return yo(E.width)&&yo(E.height)}function S(E){return o?!1:E.wrapS!==ei||E.wrapT!==ei||E.minFilter!==xt&&E.minFilter!==gt}function D(E,x){return E.generateMipmaps&&x&&E.minFilter!==xt&&E.minFilter!==gt}function O(E){s.generateMipmap(E)}function M(E,x,j,se,he=!1){if(o===!1)return x;if(E!==null){if(s[E]!==void 0)return s[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let pe=x;return x===6403&&(j===5126&&(pe=33326),j===5131&&(pe=33325),j===5121&&(pe=33321)),x===33319&&(j===5126&&(pe=33328),j===5131&&(pe=33327),j===5121&&(pe=33323)),x===6408&&(j===5126&&(pe=34836),j===5131&&(pe=34842),j===5121&&(pe=se===Xe&&he===!1?35907:32856),j===32819&&(pe=32854),j===32820&&(pe=32855)),(pe===33325||pe===33326||pe===33327||pe===33328||pe===34842||pe===34836)&&e.get("EXT_color_buffer_float"),pe}function R(E,x,j){return D(E,j)===!0||E.isFramebufferTexture&&E.minFilter!==xt&&E.minFilter!==gt?Math.log2(Math.max(x.width,x.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?x.mipmaps.length:1}function N(E){return E===xt||E===ao||E===oo?9728:9729}function I(E){const x=E.target;x.removeEventListener("dispose",I),$(x),x.isVideoTexture&&g.delete(x)}function K(E){const x=E.target;x.removeEventListener("dispose",K),W(x)}function $(E){const x=i.get(E);if(x.__webglInit===void 0)return;const j=E.source,se=f.get(j);if(se){const he=se[x.__cacheKey];he.usedTimes--,he.usedTimes===0&&k(E),Object.keys(se).length===0&&f.delete(j)}i.remove(E)}function k(E){const x=i.get(E);s.deleteTexture(x.__webglTexture);const j=E.source,se=f.get(j);delete se[x.__cacheKey],a.memory.textures--}function W(E){const x=E.texture,j=i.get(E),se=i.get(x);if(se.__webglTexture!==void 0&&(s.deleteTexture(se.__webglTexture),a.memory.textures--),E.depthTexture&&E.depthTexture.dispose(),E.isWebGLCubeRenderTarget)for(let he=0;he<6;he++)s.deleteFramebuffer(j.__webglFramebuffer[he]),j.__webglDepthbuffer&&s.deleteRenderbuffer(j.__webglDepthbuffer[he]);else{if(s.deleteFramebuffer(j.__webglFramebuffer),j.__webglDepthbuffer&&s.deleteRenderbuffer(j.__webglDepthbuffer),j.__webglMultisampledFramebuffer&&s.deleteFramebuffer(j.__webglMultisampledFramebuffer),j.__webglColorRenderbuffer)for(let he=0;he<j.__webglColorRenderbuffer.length;he++)j.__webglColorRenderbuffer[he]&&s.deleteRenderbuffer(j.__webglColorRenderbuffer[he]);j.__webglDepthRenderbuffer&&s.deleteRenderbuffer(j.__webglDepthRenderbuffer)}if(E.isWebGLMultipleRenderTargets)for(let he=0,pe=x.length;he<pe;he++){const xe=i.get(x[he]);xe.__webglTexture&&(s.deleteTexture(xe.__webglTexture),a.memory.textures--),i.remove(x[he])}i.remove(x),i.remove(E)}let U=0;function Z(){U=0}function Y(){const E=U;return E>=l&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+l),U+=1,E}function F(E){const x=[];return x.push(E.wrapS),x.push(E.wrapT),x.push(E.magFilter),x.push(E.minFilter),x.push(E.anisotropy),x.push(E.internalFormat),x.push(E.format),x.push(E.type),x.push(E.generateMipmaps),x.push(E.premultiplyAlpha),x.push(E.flipY),x.push(E.unpackAlignment),x.push(E.encoding),x.join()}function G(E,x){const j=i.get(E);if(E.isVideoTexture&&Dt(E),E.isRenderTargetTexture===!1&&E.version>0&&j.__version!==E.version){const se=E.image;if(se===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Le(j,E,x);return}}t.activeTexture(33984+x),t.bindTexture(3553,j.__webglTexture)}function te(E,x){const j=i.get(E);if(E.version>0&&j.__version!==E.version){Le(j,E,x);return}t.activeTexture(33984+x),t.bindTexture(35866,j.__webglTexture)}function X(E,x){const j=i.get(E);if(E.version>0&&j.__version!==E.version){Le(j,E,x);return}t.activeTexture(33984+x),t.bindTexture(32879,j.__webglTexture)}function ie(E,x){const j=i.get(E);if(E.version>0&&j.__version!==E.version){Me(j,E,x);return}t.activeTexture(33984+x),t.bindTexture(34067,j.__webglTexture)}const ce={[ns]:10497,[ei]:33071,[Yn]:33648},Se={[xt]:9728,[ao]:9984,[oo]:9986,[gt]:9729,[ph]:9985,[as]:9987};function H(E,x,j){if(j?(s.texParameteri(E,10242,ce[x.wrapS]),s.texParameteri(E,10243,ce[x.wrapT]),(E===32879||E===35866)&&s.texParameteri(E,32882,ce[x.wrapR]),s.texParameteri(E,10240,Se[x.magFilter]),s.texParameteri(E,10241,Se[x.minFilter])):(s.texParameteri(E,10242,33071),s.texParameteri(E,10243,33071),(E===32879||E===35866)&&s.texParameteri(E,32882,33071),(x.wrapS!==ei||x.wrapT!==ei)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(E,10240,N(x.magFilter)),s.texParameteri(E,10241,N(x.minFilter)),x.minFilter!==xt&&x.minFilter!==gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const se=e.get("EXT_texture_filter_anisotropic");if(x.type===os&&e.has("OES_texture_float_linear")===!1||o===!1&&x.type===sn&&e.has("OES_texture_half_float_linear")===!1)return;(x.anisotropy>1||i.get(x).__currentAnisotropy)&&(s.texParameterf(E,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,r.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy)}}function Ke(E,x){let j=!1;E.__webglInit===void 0&&(E.__webglInit=!0,x.addEventListener("dispose",I));const se=x.source;let he=f.get(se);he===void 0&&(he={},f.set(se,he));const pe=F(x);if(pe!==E.__cacheKey){he[pe]===void 0&&(he[pe]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,j=!0),he[pe].usedTimes++;const xe=he[E.__cacheKey];xe!==void 0&&(he[E.__cacheKey].usedTimes--,xe.usedTimes===0&&k(x)),E.__cacheKey=pe,E.__webglTexture=he[pe].texture}return j}function Le(E,x,j){let se=3553;x.isDataArrayTexture&&(se=35866),x.isData3DTexture&&(se=32879);const he=Ke(E,x),pe=x.source;if(t.activeTexture(33984+j),t.bindTexture(se,E.__webglTexture),pe.version!==pe.__currentVersion||he===!0){s.pixelStorei(37440,x.flipY),s.pixelStorei(37441,x.premultiplyAlpha),s.pixelStorei(3317,x.unpackAlignment),s.pixelStorei(37443,0);const xe=S(x)&&b(x.image)===!1;let w=A(x.image,xe,!1,h);w=Wt(x,w);const J=b(w)||o,ae=n.convert(x.format,x.encoding);let oe=n.convert(x.type),P=M(x.internalFormat,ae,oe,x.encoding,x.isVideoTexture);H(se,x,J);let re;const ne=x.mipmaps,me=o&&x.isVideoTexture!==!0,fe=pe.__currentVersion===void 0||he===!0,ye=R(x,w,J);if(x.isDepthTexture)P=6402,o?x.type===os?P=36012:x.type===Is?P=33190:x.type===vr?P=35056:P=33189:x.type===os&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),x.format===ks&&P===6402&&x.type!==fh&&x.type!==Is&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),x.type=Is,oe=n.convert(x.type)),x.format===_r&&P===6402&&(P=34041,x.type!==vr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),x.type=vr,oe=n.convert(x.type))),fe&&(me?t.texStorage2D(3553,1,P,w.width,w.height):t.texImage2D(3553,0,P,w.width,w.height,0,ae,oe,null));else if(x.isDataTexture)if(ne.length>0&&J){me&&fe&&t.texStorage2D(3553,ye,P,ne[0].width,ne[0].height);for(let le=0,Te=ne.length;le<Te;le++)re=ne[le],me?t.texSubImage2D(3553,le,0,0,re.width,re.height,ae,oe,re.data):t.texImage2D(3553,le,P,re.width,re.height,0,ae,oe,re.data);x.generateMipmaps=!1}else me?(fe&&t.texStorage2D(3553,ye,P,w.width,w.height),t.texSubImage2D(3553,0,0,0,w.width,w.height,ae,oe,w.data)):t.texImage2D(3553,0,P,w.width,w.height,0,ae,oe,w.data);else if(x.isCompressedTexture){me&&fe&&t.texStorage2D(3553,ye,P,ne[0].width,ne[0].height);for(let le=0,Te=ne.length;le<Te;le++)re=ne[le],x.format!==hi?ae!==null?me?t.compressedTexSubImage2D(3553,le,0,0,re.width,re.height,ae,re.data):t.compressedTexImage2D(3553,le,P,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):me?t.texSubImage2D(3553,le,0,0,re.width,re.height,ae,oe,re.data):t.texImage2D(3553,le,P,re.width,re.height,0,ae,oe,re.data)}else if(x.isDataArrayTexture)me?(fe&&t.texStorage3D(35866,ye,P,w.width,w.height,w.depth),t.texSubImage3D(35866,0,0,0,0,w.width,w.height,w.depth,ae,oe,w.data)):t.texImage3D(35866,0,P,w.width,w.height,w.depth,0,ae,oe,w.data);else if(x.isData3DTexture)me?(fe&&t.texStorage3D(32879,ye,P,w.width,w.height,w.depth),t.texSubImage3D(32879,0,0,0,0,w.width,w.height,w.depth,ae,oe,w.data)):t.texImage3D(32879,0,P,w.width,w.height,w.depth,0,ae,oe,w.data);else if(x.isFramebufferTexture){if(fe)if(me)t.texStorage2D(3553,ye,P,w.width,w.height);else{let le=w.width,Te=w.height;for(let _e=0;_e<ye;_e++)t.texImage2D(3553,_e,P,le,Te,0,ae,oe,null),le>>=1,Te>>=1}}else if(ne.length>0&&J){me&&fe&&t.texStorage2D(3553,ye,P,ne[0].width,ne[0].height);for(let le=0,Te=ne.length;le<Te;le++)re=ne[le],me?t.texSubImage2D(3553,le,0,0,ae,oe,re):t.texImage2D(3553,le,P,ae,oe,re);x.generateMipmaps=!1}else me?(fe&&t.texStorage2D(3553,ye,P,w.width,w.height),t.texSubImage2D(3553,0,0,0,ae,oe,w)):t.texImage2D(3553,0,P,ae,oe,w);D(x,J)&&O(se),pe.__currentVersion=pe.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function Me(E,x,j){if(x.image.length!==6)return;const se=Ke(E,x),he=x.source;if(t.activeTexture(33984+j),t.bindTexture(34067,E.__webglTexture),he.version!==he.__currentVersion||se===!0){s.pixelStorei(37440,x.flipY),s.pixelStorei(37441,x.premultiplyAlpha),s.pixelStorei(3317,x.unpackAlignment),s.pixelStorei(37443,0);const pe=x.isCompressedTexture||x.image[0].isCompressedTexture,xe=x.image[0]&&x.image[0].isDataTexture,w=[];for(let le=0;le<6;le++)!pe&&!xe?w[le]=A(x.image[le],!1,!0,c):w[le]=xe?x.image[le].image:x.image[le],w[le]=Wt(x,w[le]);const J=w[0],ae=b(J)||o,oe=n.convert(x.format,x.encoding),P=n.convert(x.type),re=M(x.internalFormat,oe,P,x.encoding),ne=o&&x.isVideoTexture!==!0,me=he.__currentVersion===void 0||se===!0;let fe=R(x,J,ae);H(34067,x,ae);let ye;if(pe){ne&&me&&t.texStorage2D(34067,fe,re,J.width,J.height);for(let le=0;le<6;le++){ye=w[le].mipmaps;for(let Te=0;Te<ye.length;Te++){const _e=ye[Te];x.format!==hi?oe!==null?ne?t.compressedTexSubImage2D(34069+le,Te,0,0,_e.width,_e.height,oe,_e.data):t.compressedTexImage2D(34069+le,Te,re,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ne?t.texSubImage2D(34069+le,Te,0,0,_e.width,_e.height,oe,P,_e.data):t.texImage2D(34069+le,Te,re,_e.width,_e.height,0,oe,P,_e.data)}}}else{ye=x.mipmaps,ne&&me&&(ye.length>0&&fe++,t.texStorage2D(34067,fe,re,w[0].width,w[0].height));for(let le=0;le<6;le++)if(xe){ne?t.texSubImage2D(34069+le,0,0,0,w[le].width,w[le].height,oe,P,w[le].data):t.texImage2D(34069+le,0,re,w[le].width,w[le].height,0,oe,P,w[le].data);for(let Te=0;Te<ye.length;Te++){const _e=ye[Te].image[le].image;ne?t.texSubImage2D(34069+le,Te+1,0,0,_e.width,_e.height,oe,P,_e.data):t.texImage2D(34069+le,Te+1,re,_e.width,_e.height,0,oe,P,_e.data)}}else{ne?t.texSubImage2D(34069+le,0,0,0,oe,P,w[le]):t.texImage2D(34069+le,0,re,oe,P,w[le]);for(let Te=0;Te<ye.length;Te++){const _e=ye[Te];ne?t.texSubImage2D(34069+le,Te+1,0,0,oe,P,_e.image[le]):t.texImage2D(34069+le,Te+1,re,oe,P,_e.image[le])}}}D(x,ae)&&O(34067),he.__currentVersion=he.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function de(E,x,j,se,he){const pe=n.convert(j.format,j.encoding),xe=n.convert(j.type),w=M(j.internalFormat,pe,xe,j.encoding);i.get(x).__hasExternalTextures||(he===32879||he===35866?t.texImage3D(he,0,w,x.width,x.height,x.depth,0,pe,xe,null):t.texImage2D(he,0,w,x.width,x.height,0,pe,xe,null)),t.bindFramebuffer(36160,E),Ge(x)?d.framebufferTexture2DMultisampleEXT(36160,se,he,i.get(j).__webglTexture,0,tt(x)):s.framebufferTexture2D(36160,se,he,i.get(j).__webglTexture,0),t.bindFramebuffer(36160,null)}function Ve(E,x,j){if(s.bindRenderbuffer(36161,E),x.depthBuffer&&!x.stencilBuffer){let se=33189;if(j||Ge(x)){const he=x.depthTexture;he&&he.isDepthTexture&&(he.type===os?se=36012:he.type===Is&&(se=33190));const pe=tt(x);Ge(x)?d.renderbufferStorageMultisampleEXT(36161,pe,se,x.width,x.height):s.renderbufferStorageMultisample(36161,pe,se,x.width,x.height)}else s.renderbufferStorage(36161,se,x.width,x.height);s.framebufferRenderbuffer(36160,36096,36161,E)}else if(x.depthBuffer&&x.stencilBuffer){const se=tt(x);j&&Ge(x)===!1?s.renderbufferStorageMultisample(36161,se,35056,x.width,x.height):Ge(x)?d.renderbufferStorageMultisampleEXT(36161,se,35056,x.width,x.height):s.renderbufferStorage(36161,34041,x.width,x.height),s.framebufferRenderbuffer(36160,33306,36161,E)}else{const se=x.isWebGLMultipleRenderTargets===!0?x.texture:[x.texture];for(let he=0;he<se.length;he++){const pe=se[he],xe=n.convert(pe.format,pe.encoding),w=n.convert(pe.type),J=M(pe.internalFormat,xe,w,pe.encoding),ae=tt(x);j&&Ge(x)===!1?s.renderbufferStorageMultisample(36161,ae,J,x.width,x.height):Ge(x)?d.renderbufferStorageMultisampleEXT(36161,ae,J,x.width,x.height):s.renderbufferStorage(36161,J,x.width,x.height)}}s.bindRenderbuffer(36161,null)}function Ce(E,x){if(x&&x.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,E),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(x.depthTexture).__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),G(x.depthTexture,0);const j=i.get(x.depthTexture).__webglTexture,se=tt(x);if(x.depthTexture.format===ks)Ge(x)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,j,0,se):s.framebufferTexture2D(36160,36096,3553,j,0);else if(x.depthTexture.format===_r)Ge(x)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,j,0,se):s.framebufferTexture2D(36160,33306,3553,j,0);else throw new Error("Unknown depthTexture format")}function ge(E){const x=i.get(E),j=E.isWebGLCubeRenderTarget===!0;if(E.depthTexture&&!x.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");Ce(x.__webglFramebuffer,E)}else if(j){x.__webglDepthbuffer=[];for(let se=0;se<6;se++)t.bindFramebuffer(36160,x.__webglFramebuffer[se]),x.__webglDepthbuffer[se]=s.createRenderbuffer(),Ve(x.__webglDepthbuffer[se],E,!1)}else t.bindFramebuffer(36160,x.__webglFramebuffer),x.__webglDepthbuffer=s.createRenderbuffer(),Ve(x.__webglDepthbuffer,E,!1);t.bindFramebuffer(36160,null)}function nt(E,x,j){const se=i.get(E);x!==void 0&&de(se.__webglFramebuffer,E,E.texture,36064,3553),j!==void 0&&ge(E)}function at(E){const x=E.texture,j=i.get(E),se=i.get(x);E.addEventListener("dispose",K),E.isWebGLMultipleRenderTargets!==!0&&(se.__webglTexture===void 0&&(se.__webglTexture=s.createTexture()),se.__version=x.version,a.memory.textures++);const he=E.isWebGLCubeRenderTarget===!0,pe=E.isWebGLMultipleRenderTargets===!0,xe=b(E)||o;if(he){j.__webglFramebuffer=[];for(let w=0;w<6;w++)j.__webglFramebuffer[w]=s.createFramebuffer()}else{if(j.__webglFramebuffer=s.createFramebuffer(),pe)if(r.drawBuffers){const w=E.texture;for(let J=0,ae=w.length;J<ae;J++){const oe=i.get(w[J]);oe.__webglTexture===void 0&&(oe.__webglTexture=s.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&E.samples>0&&Ge(E)===!1){const w=pe?x:[x];j.__webglMultisampledFramebuffer=s.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,j.__webglMultisampledFramebuffer);for(let J=0;J<w.length;J++){const ae=w[J];j.__webglColorRenderbuffer[J]=s.createRenderbuffer(),s.bindRenderbuffer(36161,j.__webglColorRenderbuffer[J]);const oe=n.convert(ae.format,ae.encoding),P=n.convert(ae.type),re=M(ae.internalFormat,oe,P,ae.encoding),ne=tt(E);s.renderbufferStorageMultisample(36161,ne,re,E.width,E.height),s.framebufferRenderbuffer(36160,36064+J,36161,j.__webglColorRenderbuffer[J])}s.bindRenderbuffer(36161,null),E.depthBuffer&&(j.__webglDepthRenderbuffer=s.createRenderbuffer(),Ve(j.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(36160,null)}}if(he){t.bindTexture(34067,se.__webglTexture),H(34067,x,xe);for(let w=0;w<6;w++)de(j.__webglFramebuffer[w],E,x,36064,34069+w);D(x,xe)&&O(34067),t.unbindTexture()}else if(pe){const w=E.texture;for(let J=0,ae=w.length;J<ae;J++){const oe=w[J],P=i.get(oe);t.bindTexture(3553,P.__webglTexture),H(3553,oe,xe),de(j.__webglFramebuffer,E,oe,36064+J,3553),D(oe,xe)&&O(3553)}t.unbindTexture()}else{let w=3553;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(o?w=E.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(w,se.__webglTexture),H(w,x,xe),de(j.__webglFramebuffer,E,x,36064,w),D(x,xe)&&O(w),t.unbindTexture()}E.depthBuffer&&ge(E)}function et(E){const x=b(E)||o,j=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let se=0,he=j.length;se<he;se++){const pe=j[se];if(D(pe,x)){const xe=E.isWebGLCubeRenderTarget?34067:3553,w=i.get(pe).__webglTexture;t.bindTexture(xe,w),O(xe),t.unbindTexture()}}}function mt(E){if(o&&E.samples>0&&Ge(E)===!1){const x=E.isWebGLMultipleRenderTargets?E.texture:[E.texture],j=E.width,se=E.height;let he=16384;const pe=[],xe=E.stencilBuffer?33306:36096,w=i.get(E),J=E.isWebGLMultipleRenderTargets===!0;if(J)for(let ae=0;ae<x.length;ae++)t.bindFramebuffer(36160,w.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(36160,36064+ae,36161,null),t.bindFramebuffer(36160,w.__webglFramebuffer),s.framebufferTexture2D(36009,36064+ae,3553,null,0);t.bindFramebuffer(36008,w.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,w.__webglFramebuffer);for(let ae=0;ae<x.length;ae++){pe.push(36064+ae),E.depthBuffer&&pe.push(xe);const oe=w.__ignoreDepthValues!==void 0?w.__ignoreDepthValues:!1;if(oe===!1&&(E.depthBuffer&&(he|=256),E.stencilBuffer&&(he|=1024)),J&&s.framebufferRenderbuffer(36008,36064,36161,w.__webglColorRenderbuffer[ae]),oe===!0&&(s.invalidateFramebuffer(36008,[xe]),s.invalidateFramebuffer(36009,[xe])),J){const P=i.get(x[ae]).__webglTexture;s.framebufferTexture2D(36009,36064,3553,P,0)}s.blitFramebuffer(0,0,j,se,0,0,j,se,he,9728),p&&s.invalidateFramebuffer(36008,pe)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),J)for(let ae=0;ae<x.length;ae++){t.bindFramebuffer(36160,w.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(36160,36064+ae,36161,w.__webglColorRenderbuffer[ae]);const oe=i.get(x[ae]).__webglTexture;t.bindFramebuffer(36160,w.__webglFramebuffer),s.framebufferTexture2D(36009,36064+ae,3553,oe,0)}t.bindFramebuffer(36009,w.__webglMultisampledFramebuffer)}}function tt(E){return Math.min(u,E.samples)}function Ge(E){const x=i.get(E);return o&&E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function Dt(E){const x=a.render.frame;g.get(E)!==x&&(g.set(E,x),E.update())}function Wt(E,x){const j=E.encoding,se=E.format,he=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||E.format===vo||j!==Os&&(j===Xe?o===!1?e.has("EXT_sRGB")===!0&&se===hi?(E.format=vo,E.minFilter=gt,E.generateMipmaps=!1):x=qh.sRGBToLinear(x):(se!==hi||he!==Ds)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",j)),x}this.allocateTextureUnit=Y,this.resetTextureUnits=Z,this.setTexture2D=G,this.setTexture2DArray=te,this.setTexture3D=X,this.setTextureCube=ie,this.rebindTextures=nt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=et,this.updateMultisampleRenderTarget=mt,this.setupDepthRenderbuffer=ge,this.setupFrameBufferTexture=de,this.useMultisampledRTT=Ge}function W0(s,e,t){const i=t.isWebGL2;function r(n,a=null){let o;if(n===Ds)return 5121;if(n===Mp)return 32819;if(n===Tp)return 32820;if(n===bp)return 5120;if(n===wp)return 5122;if(n===fh)return 5123;if(n===Sp)return 5124;if(n===Is)return 5125;if(n===os)return 5126;if(n===sn)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(n===Cp)return 6406;if(n===hi)return 6408;if(n===Ap)return 6409;if(n===Lp)return 6410;if(n===ks)return 6402;if(n===_r)return 34041;if(n===Rp)return 6403;if(n===Ep)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===vo)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(n===Pp)return 36244;if(n===Dp)return 33319;if(n===Ip)return 33320;if(n===kp)return 36249;if(n===lo||n===ho||n===co||n===uo)if(a===Xe)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===lo)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ho)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===co)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===uo)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===lo)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ho)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===co)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===uo)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===mh||n===gh||n===vh||n===_h)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===mh)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===gh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===vh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===_h)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Op)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===yh||n===xh)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===yh)return a===Xe?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===xh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===bh||n===wh||n===Sh||n===Mh||n===Th||n===Ch||n===Eh||n===Ah||n===Lh||n===Rh||n===Ph||n===Dh||n===Ih||n===kh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===bh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===wh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Sh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Mh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Th)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ch)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Eh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ah)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Lh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Rh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ph)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Dh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ih)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===kh)return a===Xe?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Oh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Oh)return a===Xe?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return n===vr?i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):s[n]!==void 0?s[n]:null}return{convert:r}}class q0 extends Nt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Re=class extends rt{constructor(){super(),this.isGroup=!0,this.type="Group"}};const X0={type:"move"};class $o{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Re,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Re,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Re,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,n=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const m of e.hand.values()){const f=t.getJointPose(m,i);if(c.joints[m.jointName]===void 0){const y=new Re;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}const _=c.joints[m.jointName];f!==null&&(_.matrix.fromArray(f.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.jointRadius=f.radius),_.visible=f!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(n=t.getPose(e.gripSpace,i),n!==null&&(l.matrix.fromArray(n.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),n.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(n.linearVelocity)):l.hasLinearVelocity=!1,n.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(n.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&n!==null&&(r=n),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(X0)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=n!==null),c!==null&&(c.visible=a!==null),this}}class Y0 extends ht{constructor(e,t,i,r,n,a,o,l,c,h){if(h=h!==void 0?h:ks,h!==ks&&h!==_r)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===ks&&(i=Is),i===void 0&&h===_r&&(i=vr),super(null,r,n,a,o,l,h,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:xt,this.minFilter=l!==void 0?l:xt,this.flipY=!1,this.generateMipmaps=!1}}class Z0 extends zs{constructor(e,t){super();const i=this;let r=null,n=1,a=null,o="local-floor",l=null,c=null,h=null,u=null,d=null,p=null;const g=t.getContextAttributes();let m=null,f=null;const _=[],y=[],A=new Nt;A.layers.enable(1),A.viewport=new je;const b=new Nt;b.layers.enable(2),b.viewport=new je;const S=[A,b],D=new q0;D.layers.enable(1),D.layers.enable(2);let O=null,M=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let G=_[F];return G===void 0&&(G=new $o,_[F]=G),G.getTargetRaySpace()},this.getControllerGrip=function(F){let G=_[F];return G===void 0&&(G=new $o,_[F]=G),G.getGripSpace()},this.getHand=function(F){let G=_[F];return G===void 0&&(G=new $o,_[F]=G),G.getHandSpace()};function R(F){const G=y.indexOf(F.inputSource);if(G===-1)return;const te=_[G];te!==void 0&&te.dispatchEvent({type:F.type,data:F.inputSource})}function N(){r.removeEventListener("select",R),r.removeEventListener("selectstart",R),r.removeEventListener("selectend",R),r.removeEventListener("squeeze",R),r.removeEventListener("squeezestart",R),r.removeEventListener("squeezeend",R),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",I);for(let F=0;F<_.length;F++){const G=y[F];G!==null&&(y[F]=null,_[F].disconnect(G))}O=null,M=null,e.setRenderTarget(m),d=null,u=null,h=null,r=null,f=null,Y.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){n=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){o=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(F){l=F},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(F){if(r=F,r!==null){if(m=e.getRenderTarget(),r.addEventListener("select",R),r.addEventListener("selectstart",R),r.addEventListener("selectend",R),r.addEventListener("squeeze",R),r.addEventListener("squeezestart",R),r.addEventListener("squeezeend",R),r.addEventListener("end",N),r.addEventListener("inputsourceschange",I),g.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const G={antialias:r.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:n};d=new XRWebGLLayer(r,t,G),r.updateRenderState({baseLayer:d}),f=new Us(d.framebufferWidth,d.framebufferHeight,{format:hi,type:Ds,encoding:e.outputEncoding})}else{let G=null,te=null,X=null;g.depth&&(X=g.stencil?35056:33190,G=g.stencil?_r:ks,te=g.stencil?vr:Is);const ie={colorFormat:32856,depthFormat:X,scaleFactor:n};h=new XRWebGLBinding(r,t),u=h.createProjectionLayer(ie),r.updateRenderState({layers:[u]}),f=new Us(u.textureWidth,u.textureHeight,{format:hi,type:Ds,depthTexture:new Y0(u.textureWidth,u.textureHeight,te,void 0,void 0,void 0,void 0,void 0,void 0,G),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0});const ce=e.properties.get(f);ce.__ignoreDepthValues=u.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(1),l=null,a=await r.requestReferenceSpace(o),Y.setContext(r),Y.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function I(F){for(let G=0;G<F.removed.length;G++){const te=F.removed[G],X=y.indexOf(te);X>=0&&(y[X]=null,_[X].dispatchEvent({type:"disconnected",data:te}))}for(let G=0;G<F.added.length;G++){const te=F.added[G];let X=y.indexOf(te);if(X===-1){for(let ce=0;ce<_.length;ce++)if(ce>=y.length){y.push(te),X=ce;break}else if(y[ce]===null){y[ce]=te,X=ce;break}if(X===-1)break}const ie=_[X];ie&&ie.dispatchEvent({type:"connected",data:te})}}const K=new L,$=new L;function k(F,G,te){K.setFromMatrixPosition(G.matrixWorld),$.setFromMatrixPosition(te.matrixWorld);const X=K.distanceTo($),ie=G.projectionMatrix.elements,ce=te.projectionMatrix.elements,Se=ie[14]/(ie[10]-1),H=ie[14]/(ie[10]+1),Ke=(ie[9]+1)/ie[5],Le=(ie[9]-1)/ie[5],Me=(ie[8]-1)/ie[0],de=(ce[8]+1)/ce[0],Ve=Se*Me,Ce=Se*de,ge=X/(-Me+de),nt=ge*-Me;G.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(nt),F.translateZ(ge),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert();const at=Se+ge,et=H+ge,mt=Ve-nt,tt=Ce+(X-nt),Ge=Ke*H/et*at,Dt=Le*H/et*at;F.projectionMatrix.makePerspective(mt,tt,Ge,Dt,at,et)}function W(F,G){G===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(G.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(r===null)return;D.near=b.near=A.near=F.near,D.far=b.far=A.far=F.far,(O!==D.near||M!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,M=D.far);const G=F.parent,te=D.cameras;W(D,G);for(let ie=0;ie<te.length;ie++)W(te[ie],G);D.matrixWorld.decompose(D.position,D.quaternion,D.scale),F.position.copy(D.position),F.quaternion.copy(D.quaternion),F.scale.copy(D.scale),F.matrix.copy(D.matrix),F.matrixWorld.copy(D.matrixWorld);const X=F.children;for(let ie=0,ce=X.length;ie<ce;ie++)X[ie].updateMatrixWorld(!0);te.length===2?k(D,A,b):D.projectionMatrix.copy(A.projectionMatrix)},this.getCamera=function(){return D},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(d!==null)return d.fixedFoveation},this.setFoveation=function(F){u!==null&&(u.fixedFoveation=F),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=F)};let U=null;function Z(F,G){if(c=G.getViewerPose(l||a),p=G,c!==null){const te=c.views;d!==null&&(e.setRenderTargetFramebuffer(f,d.framebuffer),e.setRenderTarget(f));let X=!1;te.length!==D.cameras.length&&(D.cameras.length=0,X=!0);for(let ie=0;ie<te.length;ie++){const ce=te[ie];let Se=null;if(d!==null)Se=d.getViewport(ce);else{const Ke=h.getViewSubImage(u,ce);Se=Ke.viewport,ie===0&&(e.setRenderTargetTextures(f,Ke.colorTexture,u.ignoreDepthValues?void 0:Ke.depthStencilTexture),e.setRenderTarget(f))}let H=S[ie];H===void 0&&(H=new Nt,H.layers.enable(ie),H.viewport=new je,S[ie]=H),H.matrix.fromArray(ce.transform.matrix),H.projectionMatrix.fromArray(ce.projectionMatrix),H.viewport.set(Se.x,Se.y,Se.width,Se.height),ie===0&&D.matrix.copy(H.matrix),X===!0&&D.cameras.push(H)}}for(let te=0;te<_.length;te++){const X=y[te],ie=_[te];X!==null&&ie!==void 0&&ie.update(X,G,l||a)}U&&U(F,G),p=null}const Y=new cc;Y.setAnimationLoop(Z),this.setAnimationLoop=function(F){U=F},this.dispose=function(){}}}function $0(s,e){function t(m,f){m.fogColor.value.copy(f.color),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,_,y,A){f.isMeshBasicMaterial||f.isMeshLambertMaterial?r(m,f):f.isMeshToonMaterial?(r(m,f),h(m,f)):f.isMeshPhongMaterial?(r(m,f),c(m,f)):f.isMeshStandardMaterial?(r(m,f),u(m,f),f.isMeshPhysicalMaterial&&d(m,f,A)):f.isMeshMatcapMaterial?(r(m,f),p(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),g(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(n(m,f),f.isLineDashedMaterial&&a(m,f)):f.isPointsMaterial?o(m,f,_,y):f.isSpriteMaterial?l(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.bumpMap&&(m.bumpMap.value=f.bumpMap,m.bumpScale.value=f.bumpScale,f.side===li&&(m.bumpScale.value*=-1)),f.displacementMap&&(m.displacementMap.value=f.displacementMap,m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap),f.normalMap&&(m.normalMap.value=f.normalMap,m.normalScale.value.copy(f.normalScale),f.side===li&&m.normalScale.value.negate()),f.specularMap&&(m.specularMap.value=f.specularMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const _=e.get(f).envMap;if(_&&(m.envMap.value=_,m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const b=s.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*b}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity);let y;f.map?y=f.map:f.specularMap?y=f.specularMap:f.displacementMap?y=f.displacementMap:f.normalMap?y=f.normalMap:f.bumpMap?y=f.bumpMap:f.roughnessMap?y=f.roughnessMap:f.metalnessMap?y=f.metalnessMap:f.alphaMap?y=f.alphaMap:f.emissiveMap?y=f.emissiveMap:f.clearcoatMap?y=f.clearcoatMap:f.clearcoatNormalMap?y=f.clearcoatNormalMap:f.clearcoatRoughnessMap?y=f.clearcoatRoughnessMap:f.iridescenceMap?y=f.iridescenceMap:f.iridescenceThicknessMap?y=f.iridescenceThicknessMap:f.specularIntensityMap?y=f.specularIntensityMap:f.specularColorMap?y=f.specularColorMap:f.transmissionMap?y=f.transmissionMap:f.thicknessMap?y=f.thicknessMap:f.sheenColorMap?y=f.sheenColorMap:f.sheenRoughnessMap&&(y=f.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let A;f.aoMap?A=f.aoMap:f.lightMap&&(A=f.lightMap),A!==void 0&&(A.isWebGLRenderTarget&&(A=A.texture),A.matrixAutoUpdate===!0&&A.updateMatrix(),m.uv2Transform.value.copy(A.matrix))}function n(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function o(m,f,_,y){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*_,m.scale.value=y*.5,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let A;f.map?A=f.map:f.alphaMap&&(A=f.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),m.uvTransform.value.copy(A.matrix))}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let _;f.map?_=f.map:f.alphaMap&&(_=f.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),m.uvTransform.value.copy(_.matrix))}function c(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.roughness.value=f.roughness,m.metalness.value=f.metalness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap),f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function d(m,f,_){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap)),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap),f.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),m.clearcoatNormalMap.value=f.clearcoatNormalMap,f.side===li&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap)),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap)}function p(m,f){f.matcap&&(m.matcap.value=f.matcap)}function g(m,f){m.referencePosition.value.copy(f.referencePosition),m.nearDistance.value=f.nearDistance,m.farDistance.value=f.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function K0(){const s=ln("canvas");return s.style.display="block",s}function Bc(s={}){this.isWebGLRenderer=!0;const e=s.canvas!==void 0?s.canvas:K0(),t=s.context!==void 0?s.context:null,i=s.depth!==void 0?s.depth:!0,r=s.stencil!==void 0?s.stencil:!0,n=s.antialias!==void 0?s.antialias:!1,a=s.premultipliedAlpha!==void 0?s.premultipliedAlpha:!0,o=s.preserveDrawingBuffer!==void 0?s.preserveDrawingBuffer:!1,l=s.powerPreference!==void 0?s.powerPreference:"default",c=s.failIfMajorPerformanceCaveat!==void 0?s.failIfMajorPerformanceCaveat:!1;let h;t!==null?h=t.getContextAttributes().alpha:h=s.alpha!==void 0?s.alpha:!1;let u=null,d=null;const p=[],g=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Os,this.physicallyCorrectLights=!1,this.toneMapping=Di,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const m=this;let f=!1,_=0,y=0,A=null,b=-1,S=null;const D=new je,O=new je;let M=null,R=e.width,N=e.height,I=1,K=null,$=null;const k=new je(0,0,R,N),W=new je(0,0,R,N);let U=!1;const Z=new jo;let Y=!1,F=!1,G=null;const te=new He,X=new we,ie=new L,ce={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Se(){return A===null?I:1}let H=t;function Ke(T,z){for(let V=0;V<T.length;V++){const B=T[V],q=e.getContext(B,z);if(q!==null)return q}return null}try{const T={alpha:!0,depth:i,stencil:r,antialias:n,premultipliedAlpha:a,preserveDrawingBuffer:o,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${io}`),e.addEventListener("webglcontextlost",P,!1),e.addEventListener("webglcontextrestored",re,!1),e.addEventListener("webglcontextcreationerror",ne,!1),H===null){const z=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&z.shift(),H=Ke(z,T),H===null)throw Ke(z)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(T){throw console.error("THREE.WebGLRenderer: "+T.message),T}let Le,Me,de,Ve,Ce,ge,nt,at,et,mt,tt,Ge,Dt,Wt,E,x,j,se,he,pe,xe,w,J;function ae(){Le=new lv(H),Me=new iv(H,Le,s),Le.init(Me),w=new W0(H,Le,Me),de=new j0(H,Le,Me),Ve=new uv,Ce=new L0,ge=new V0(H,Le,de,Ce,Me,w,Ve),nt=new rv(m),at=new ov(m),et=new Sf(H,Me),J=new ev(H,Le,et,Me),mt=new hv(H,et,Ve,J),tt=new mv(H,mt,et,Ve),he=new fv(H,Me,ge),x=new sv(Ce),Ge=new A0(m,nt,at,Le,Me,J,x),Dt=new $0(m,Ce),Wt=new P0,E=new z0(Le,Me),se=new Qg(m,nt,de,tt,h,a),j=new G0(m,tt,Me),pe=new tv(H,Le,Ve,Me),xe=new cv(H,Le,Ve,Me),Ve.programs=Ge.programs,m.capabilities=Me,m.extensions=Le,m.properties=Ce,m.renderLists=Wt,m.shadowMap=j,m.state=de,m.info=Ve}ae();const oe=new Z0(m,H);this.xr=oe,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const T=Le.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=Le.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(T){T!==void 0&&(I=T,this.setSize(R,N,!1))},this.getSize=function(T){return T.set(R,N)},this.setSize=function(T,z,V){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}R=T,N=z,e.width=Math.floor(T*I),e.height=Math.floor(z*I),V!==!1&&(e.style.width=T+"px",e.style.height=z+"px"),this.setViewport(0,0,T,z)},this.getDrawingBufferSize=function(T){return T.set(R*I,N*I).floor()},this.setDrawingBufferSize=function(T,z,V){R=T,N=z,I=V,e.width=Math.floor(T*V),e.height=Math.floor(z*V),this.setViewport(0,0,T,z)},this.getCurrentViewport=function(T){return T.copy(D)},this.getViewport=function(T){return T.copy(k)},this.setViewport=function(T,z,V,B){T.isVector4?k.set(T.x,T.y,T.z,T.w):k.set(T,z,V,B),de.viewport(D.copy(k).multiplyScalar(I).floor())},this.getScissor=function(T){return T.copy(W)},this.setScissor=function(T,z,V,B){T.isVector4?W.set(T.x,T.y,T.z,T.w):W.set(T,z,V,B),de.scissor(O.copy(W).multiplyScalar(I).floor())},this.getScissorTest=function(){return U},this.setScissorTest=function(T){de.setScissorTest(U=T)},this.setOpaqueSort=function(T){K=T},this.setTransparentSort=function(T){$=T},this.getClearColor=function(T){return T.copy(se.getClearColor())},this.setClearColor=function(){se.setClearColor.apply(se,arguments)},this.getClearAlpha=function(){return se.getClearAlpha()},this.setClearAlpha=function(){se.setClearAlpha.apply(se,arguments)},this.clear=function(T=!0,z=!0,V=!0){let B=0;T&&(B|=16384),z&&(B|=256),V&&(B|=1024),H.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",P,!1),e.removeEventListener("webglcontextrestored",re,!1),e.removeEventListener("webglcontextcreationerror",ne,!1),Wt.dispose(),E.dispose(),Ce.dispose(),nt.dispose(),at.dispose(),tt.dispose(),J.dispose(),Ge.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",_e),oe.removeEventListener("sessionend",qe),G&&(G.dispose(),G=null),_t.stop()};function P(T){T.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),f=!0}function re(){console.log("THREE.WebGLRenderer: Context Restored."),f=!1;const T=Ve.autoReset,z=j.enabled,V=j.autoUpdate,B=j.needsUpdate,q=j.type;ae(),Ve.autoReset=T,j.enabled=z,j.autoUpdate=V,j.needsUpdate=B,j.type=q}function ne(T){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function me(T){const z=T.target;z.removeEventListener("dispose",me),fe(z)}function fe(T){ye(T),Ce.remove(T)}function ye(T){const z=Ce.get(T).programs;z!==void 0&&(z.forEach(function(V){Ge.releaseProgram(V)}),T.isShaderMaterial&&Ge.releaseShaderCache(T))}this.renderBufferDirect=function(T,z,V,B,q,ve){z===null&&(z=ce);const Ee=q.isMesh&&q.matrixWorld.determinant()<0,Ae=$a(T,z,V,B,q);de.setMaterial(B,Ee);let Oe=V.index;const it=V.attributes.position;if(Oe===null){if(it===void 0||it.count===0)return}else if(Oe.count===0)return;let C=1;B.wireframe===!0&&(Oe=mt.getWireframeAttribute(V),C=2),J.setup(q,B,Ae,V,Oe);let ee,Q=pe;Oe!==null&&(ee=et.get(Oe),Q=xe,Q.setIndex(ee));const De=Oe!==null?Oe.count:it.count,Ze=V.drawRange.start*C,ct=V.drawRange.count*C,We=ve!==null?ve.start*C:0,Ue=ve!==null?ve.count*C:1/0,Tt=Math.max(Ze,We),ut=Math.min(De,Ze+ct,We+Ue)-1,$t=Math.max(0,ut-Tt+1);if($t!==0){if(q.isMesh)B.wireframe===!0?(de.setLineWidth(B.wireframeLinewidth*Se()),Q.setMode(1)):Q.setMode(4);else if(q.isLine){let ts=B.linewidth;ts===void 0&&(ts=1),de.setLineWidth(ts*Se()),q.isLineSegments?Q.setMode(1):q.isLineLoop?Q.setMode(2):Q.setMode(3)}else q.isPoints?Q.setMode(0):q.isSprite&&Q.setMode(4);if(q.isInstancedMesh)Q.renderInstances(Tt,$t,q.count);else if(V.isInstancedBufferGeometry){const ts=Math.min(V.instanceCount,V._maxInstanceCount);Q.renderInstances(Tt,$t,ts)}else Q.render(Tt,$t)}},this.compile=function(T,z){d=E.get(T),d.init(),g.push(d),T.traverseVisible(function(V){V.isLight&&V.layers.test(z.layers)&&(d.pushLight(V),V.castShadow&&d.pushShadow(V))}),d.setupLights(m.physicallyCorrectLights),T.traverse(function(V){const B=V.material;if(B)if(Array.isArray(B))for(let q=0;q<B.length;q++){const ve=B[q];Qi(ve,T,V)}else Qi(B,T,V)}),g.pop(),d=null};let le=null;function Te(T){le&&le(T)}function _e(){_t.stop()}function qe(){_t.start()}const _t=new cc;_t.setAnimationLoop(Te),typeof self<"u"&&_t.setContext(self),this.setAnimationLoop=function(T){le=T,oe.setAnimationLoop(T),T===null?_t.stop():_t.start()},oe.addEventListener("sessionstart",_e),oe.addEventListener("sessionend",qe),this.render=function(T,z){if(z!==void 0&&z.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(f===!0)return;T.autoUpdate===!0&&T.updateMatrixWorld(),z.parent===null&&z.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(z),z=oe.getCamera()),T.isScene===!0&&T.onBeforeRender(m,T,z,A),d=E.get(T,g.length),d.init(),g.push(d),te.multiplyMatrices(z.projectionMatrix,z.matrixWorldInverse),Z.setFromProjectionMatrix(te),F=this.localClippingEnabled,Y=x.init(this.clippingPlanes,F,z),u=Wt.get(T,p.length),u.init(),p.push(u),Zt(T,z,0,m.sortObjects),u.finish(),m.sortObjects===!0&&u.sort(K,$),Y===!0&&x.beginShadows();const V=d.state.shadowsArray;if(j.render(V,T,z),Y===!0&&x.endShadows(),this.info.autoReset===!0&&this.info.reset(),se.render(u,T),d.setupLights(m.physicallyCorrectLights),z.isArrayCamera){const B=z.cameras;for(let q=0,ve=B.length;q<ve;q++){const Ee=B[q];hr(u,T,Ee,Ee.viewport)}}else hr(u,T,z);A!==null&&(ge.updateMultisampleRenderTarget(A),ge.updateRenderTargetMipmap(A)),T.isScene===!0&&T.onAfterRender(m,T,z),J.resetDefaultState(),b=-1,S=null,g.pop(),g.length>0?d=g[g.length-1]:d=null,p.pop(),p.length>0?u=p[p.length-1]:u=null};function Zt(T,z,V,B){if(T.visible===!1)return;if(T.layers.test(z.layers)){if(T.isGroup)V=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(z);else if(T.isLight)d.pushLight(T),T.castShadow&&d.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||Z.intersectsSprite(T)){B&&ie.setFromMatrixPosition(T.matrixWorld).applyMatrix4(te);const ve=tt.update(T),Ee=T.material;Ee.visible&&u.push(T,ve,Ee,V,ie.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(T.isSkinnedMesh&&T.skeleton.frame!==Ve.render.frame&&(T.skeleton.update(),T.skeleton.frame=Ve.render.frame),!T.frustumCulled||Z.intersectsObject(T))){B&&ie.setFromMatrixPosition(T.matrixWorld).applyMatrix4(te);const ve=tt.update(T),Ee=T.material;if(Array.isArray(Ee)){const Ae=ve.groups;for(let Oe=0,it=Ae.length;Oe<it;Oe++){const C=Ae[Oe],ee=Ee[C.materialIndex];ee&&ee.visible&&u.push(T,ve,ee,V,ie.z,C)}}else Ee.visible&&u.push(T,ve,Ee,V,ie.z,null)}}const q=T.children;for(let ve=0,Ee=q.length;ve<Ee;ve++)Zt(q[ve],z,V,B)}function hr(T,z,V,B){const q=T.opaque,ve=T.transmissive,Ee=T.transparent;d.setupLightsView(V),ve.length>0&&Fn(q,z,V),B&&de.viewport(D.copy(B)),q.length>0&&Cs(q,z,V),ve.length>0&&Cs(ve,z,V),Ee.length>0&&Cs(Ee,z,V),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function Fn(T,z,V){const B=Me.isWebGL2;G===null&&(G=new Us(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")?sn:Ds,minFilter:as,samples:B&&n===!0?4:0})),m.getDrawingBufferSize(X),B?G.setSize(X.x,X.y):G.setSize(Zn(X.x),Zn(X.y));const q=m.getRenderTarget();m.setRenderTarget(G),m.clear();const ve=m.toneMapping;m.toneMapping=Di,Cs(T,z,V),m.toneMapping=ve,ge.updateMultisampleRenderTarget(G),ge.updateRenderTargetMipmap(G),m.setRenderTarget(q)}function Cs(T,z,V){const B=z.isScene===!0?z.overrideMaterial:null;for(let q=0,ve=T.length;q<ve;q++){const Ee=T[q],Ae=Ee.object,Oe=Ee.geometry,it=B===null?Ee.material:B,C=Ee.group;Ae.layers.test(V.layers)&&Za(Ae,z,V,Oe,it,C)}}function Za(T,z,V,B,q,ve){T.onBeforeRender(m,z,V,B,q,ve),T.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),q.onBeforeRender(m,z,V,B,T,ve),q.transparent===!0&&q.side===Ps?(q.side=li,q.needsUpdate=!0,m.renderBufferDirect(V,z,B,q,T,ve),q.side=Rs,q.needsUpdate=!0,m.renderBufferDirect(V,z,B,q,T,ve),q.side=Ps):m.renderBufferDirect(V,z,B,q,T,ve),T.onAfterRender(m,z,V,B,q,ve)}function Qi(T,z,V){z.isScene!==!0&&(z=ce);const B=Ce.get(T),q=d.state.lights,ve=d.state.shadowsArray,Ee=q.state.version,Ae=Ge.getParameters(T,q.state,ve,z,V),Oe=Ge.getProgramCacheKey(Ae);let it=B.programs;B.environment=T.isMeshStandardMaterial?z.environment:null,B.fog=z.fog,B.envMap=(T.isMeshStandardMaterial?at:nt).get(T.envMap||B.environment),it===void 0&&(T.addEventListener("dispose",me),it=new Map,B.programs=it);let C=it.get(Oe);if(C!==void 0){if(B.currentProgram===C&&B.lightsStateVersion===Ee)return cr(T,Ae),C}else Ae.uniforms=Ge.getUniforms(T),T.onBuild(V,Ae,m),T.onBeforeCompile(Ae,m),C=Ge.acquireProgram(Ae,Oe),it.set(Oe,C),B.uniforms=Ae.uniforms;const ee=B.uniforms;(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(ee.clippingPlanes=x.uniform),cr(T,Ae),B.needsLights=$r(T),B.lightsStateVersion=Ee,B.needsLights&&(ee.ambientLightColor.value=q.state.ambient,ee.lightProbe.value=q.state.probe,ee.directionalLights.value=q.state.directional,ee.directionalLightShadows.value=q.state.directionalShadow,ee.spotLights.value=q.state.spot,ee.spotLightShadows.value=q.state.spotShadow,ee.rectAreaLights.value=q.state.rectArea,ee.ltc_1.value=q.state.rectAreaLTC1,ee.ltc_2.value=q.state.rectAreaLTC2,ee.pointLights.value=q.state.point,ee.pointLightShadows.value=q.state.pointShadow,ee.hemisphereLights.value=q.state.hemi,ee.directionalShadowMap.value=q.state.directionalShadowMap,ee.directionalShadowMatrix.value=q.state.directionalShadowMatrix,ee.spotShadowMap.value=q.state.spotShadowMap,ee.spotShadowMatrix.value=q.state.spotShadowMatrix,ee.pointShadowMap.value=q.state.pointShadowMap,ee.pointShadowMatrix.value=q.state.pointShadowMatrix);const Q=C.getUniforms(),De=ya.seqWithValue(Q.seq,ee);return B.currentProgram=C,B.uniformsList=De,C}function cr(T,z){const V=Ce.get(T);V.outputEncoding=z.outputEncoding,V.instancing=z.instancing,V.skinning=z.skinning,V.morphTargets=z.morphTargets,V.morphNormals=z.morphNormals,V.morphColors=z.morphColors,V.morphTargetsCount=z.morphTargetsCount,V.numClippingPlanes=z.numClippingPlanes,V.numIntersection=z.numClipIntersection,V.vertexAlphas=z.vertexAlphas,V.vertexTangents=z.vertexTangents,V.toneMapping=z.toneMapping}function $a(T,z,V,B,q){z.isScene!==!0&&(z=ce),ge.resetTextureUnits();const ve=z.fog,Ee=B.isMeshStandardMaterial?z.environment:null,Ae=A===null?m.outputEncoding:A.isXRRenderTarget===!0?A.texture.encoding:Os,Oe=(B.isMeshStandardMaterial?at:nt).get(B.envMap||Ee),it=B.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,C=!!B.normalMap&&!!V.attributes.tangent,ee=!!V.morphAttributes.position,Q=!!V.morphAttributes.normal,De=!!V.morphAttributes.color,Ze=B.toneMapped?m.toneMapping:Di,ct=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,We=ct!==void 0?ct.length:0,Ue=Ce.get(B),Tt=d.state.lights;if(Y===!0&&(F===!0||T!==S)){const xi=T===S&&B.id===b;x.setState(B,T,xi)}let ut=!1;B.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Tt.state.version||Ue.outputEncoding!==Ae||q.isInstancedMesh&&Ue.instancing===!1||!q.isInstancedMesh&&Ue.instancing===!0||q.isSkinnedMesh&&Ue.skinning===!1||!q.isSkinnedMesh&&Ue.skinning===!0||Ue.envMap!==Oe||B.fog===!0&&Ue.fog!==ve||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==x.numPlanes||Ue.numIntersection!==x.numIntersection)||Ue.vertexAlphas!==it||Ue.vertexTangents!==C||Ue.morphTargets!==ee||Ue.morphNormals!==Q||Ue.morphColors!==De||Ue.toneMapping!==Ze||Me.isWebGL2===!0&&Ue.morphTargetsCount!==We)&&(ut=!0):(ut=!0,Ue.__version=B.version);let $t=Ue.currentProgram;ut===!0&&($t=Qi(B,z,q));let ts=!1,Kr=!1,Ka=!1;const It=$t.getUniforms(),Jr=Ue.uniforms;if(de.useProgram($t.program)&&(ts=!0,Kr=!0,Ka=!0),B.id!==b&&(b=B.id,Kr=!0),ts||S!==T){if(It.setValue(H,"projectionMatrix",T.projectionMatrix),Me.logarithmicDepthBuffer&&It.setValue(H,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),S!==T&&(S=T,Kr=!0,Ka=!0),B.isShaderMaterial||B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshStandardMaterial||B.envMap){const xi=It.map.cameraPosition;xi!==void 0&&xi.setValue(H,ie.setFromMatrixPosition(T.matrixWorld))}(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&It.setValue(H,"isOrthographic",T.isOrthographicCamera===!0),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial||B.isShadowMaterial||q.isSkinnedMesh)&&It.setValue(H,"viewMatrix",T.matrixWorldInverse)}if(q.isSkinnedMesh){It.setOptional(H,q,"bindMatrix"),It.setOptional(H,q,"bindMatrixInverse");const xi=q.skeleton;xi&&(Me.floatVertexTextures?(xi.boneTexture===null&&xi.computeBoneTexture(),It.setValue(H,"boneTexture",xi.boneTexture,ge),It.setValue(H,"boneTextureSize",xi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Ja=V.morphAttributes;return(Ja.position!==void 0||Ja.normal!==void 0||Ja.color!==void 0&&Me.isWebGL2===!0)&&he.update(q,V,B,$t),(Kr||Ue.receiveShadow!==q.receiveShadow)&&(Ue.receiveShadow=q.receiveShadow,It.setValue(H,"receiveShadow",q.receiveShadow)),Kr&&(It.setValue(H,"toneMappingExposure",m.toneMappingExposure),Ue.needsLights&&es(Jr,Ka),ve&&B.fog===!0&&Dt.refreshFogUniforms(Jr,ve),Dt.refreshMaterialUniforms(Jr,B,I,N,G),ya.upload(H,Ue.uniformsList,Jr,ge)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(ya.upload(H,Ue.uniformsList,Jr,ge),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&It.setValue(H,"center",q.center),It.setValue(H,"modelViewMatrix",q.modelViewMatrix),It.setValue(H,"normalMatrix",q.normalMatrix),It.setValue(H,"modelMatrix",q.matrixWorld),$t}function es(T,z){T.ambientLightColor.needsUpdate=z,T.lightProbe.needsUpdate=z,T.directionalLights.needsUpdate=z,T.directionalLightShadows.needsUpdate=z,T.pointLights.needsUpdate=z,T.pointLightShadows.needsUpdate=z,T.spotLights.needsUpdate=z,T.spotLightShadows.needsUpdate=z,T.rectAreaLights.needsUpdate=z,T.hemisphereLights.needsUpdate=z}function $r(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(T,z,V){Ce.get(T.texture).__webglTexture=z,Ce.get(T.depthTexture).__webglTexture=V;const B=Ce.get(T);B.__hasExternalTextures=!0,B.__hasExternalTextures&&(B.__autoAllocateDepthBuffer=V===void 0,B.__autoAllocateDepthBuffer||Le.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),B.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(T,z){const V=Ce.get(T);V.__webglFramebuffer=z,V.__useDefaultFramebuffer=z===void 0},this.setRenderTarget=function(T,z=0,V=0){A=T,_=z,y=V;let B=!0;if(T){const Ae=Ce.get(T);Ae.__useDefaultFramebuffer!==void 0?(de.bindFramebuffer(36160,null),B=!1):Ae.__webglFramebuffer===void 0?ge.setupRenderTarget(T):Ae.__hasExternalTextures&&ge.rebindTextures(T,Ce.get(T.texture).__webglTexture,Ce.get(T.depthTexture).__webglTexture)}let q=null,ve=!1,Ee=!1;if(T){const Ae=T.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture)&&(Ee=!0);const Oe=Ce.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(q=Oe[z],ve=!0):Me.isWebGL2&&T.samples>0&&ge.useMultisampledRTT(T)===!1?q=Ce.get(T).__webglMultisampledFramebuffer:q=Oe,D.copy(T.viewport),O.copy(T.scissor),M=T.scissorTest}else D.copy(k).multiplyScalar(I).floor(),O.copy(W).multiplyScalar(I).floor(),M=U;if(de.bindFramebuffer(36160,q)&&Me.drawBuffers&&B&&de.drawBuffers(T,q),de.viewport(D),de.scissor(O),de.setScissorTest(M),ve){const Ae=Ce.get(T.texture);H.framebufferTexture2D(36160,36064,34069+z,Ae.__webglTexture,V)}else if(Ee){const Ae=Ce.get(T.texture),Oe=z||0;H.framebufferTextureLayer(36160,36064,Ae.__webglTexture,V||0,Oe)}b=-1},this.readRenderTargetPixels=function(T,z,V,B,q,ve,Ee){if(!(T&&T.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=Ce.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ae=Ae[Ee]),Ae){de.bindFramebuffer(36160,Ae);try{const Oe=T.texture,it=Oe.format,C=Oe.type;if(it!==hi&&w.convert(it)!==H.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ee=C===sn&&(Le.has("EXT_color_buffer_half_float")||Me.isWebGL2&&Le.has("EXT_color_buffer_float"));if(C!==Ds&&w.convert(C)!==H.getParameter(35738)&&!(C===os&&(Me.isWebGL2||Le.has("OES_texture_float")||Le.has("WEBGL_color_buffer_float")))&&!ee){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=T.width-B&&V>=0&&V<=T.height-q&&H.readPixels(z,V,B,q,w.convert(it),w.convert(C),ve)}finally{const Oe=A!==null?Ce.get(A).__webglFramebuffer:null;de.bindFramebuffer(36160,Oe)}}},this.copyFramebufferToTexture=function(T,z,V=0){const B=Math.pow(2,-V),q=Math.floor(z.image.width*B),ve=Math.floor(z.image.height*B);ge.setTexture2D(z,0),H.copyTexSubImage2D(3553,V,0,0,T.x,T.y,q,ve),de.unbindTexture()},this.copyTextureToTexture=function(T,z,V,B=0){const q=z.image.width,ve=z.image.height,Ee=w.convert(V.format),Ae=w.convert(V.type);ge.setTexture2D(V,0),H.pixelStorei(37440,V.flipY),H.pixelStorei(37441,V.premultiplyAlpha),H.pixelStorei(3317,V.unpackAlignment),z.isDataTexture?H.texSubImage2D(3553,B,T.x,T.y,q,ve,Ee,Ae,z.image.data):z.isCompressedTexture?H.compressedTexSubImage2D(3553,B,T.x,T.y,z.mipmaps[0].width,z.mipmaps[0].height,Ee,z.mipmaps[0].data):H.texSubImage2D(3553,B,T.x,T.y,Ee,Ae,z.image),B===0&&V.generateMipmaps&&H.generateMipmap(3553),de.unbindTexture()},this.copyTextureToTexture3D=function(T,z,V,B,q=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ve=T.max.x-T.min.x+1,Ee=T.max.y-T.min.y+1,Ae=T.max.z-T.min.z+1,Oe=w.convert(B.format),it=w.convert(B.type);let C;if(B.isData3DTexture)ge.setTexture3D(B,0),C=32879;else if(B.isDataArrayTexture)ge.setTexture2DArray(B,0),C=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(37440,B.flipY),H.pixelStorei(37441,B.premultiplyAlpha),H.pixelStorei(3317,B.unpackAlignment);const ee=H.getParameter(3314),Q=H.getParameter(32878),De=H.getParameter(3316),Ze=H.getParameter(3315),ct=H.getParameter(32877),We=V.isCompressedTexture?V.mipmaps[0]:V.image;H.pixelStorei(3314,We.width),H.pixelStorei(32878,We.height),H.pixelStorei(3316,T.min.x),H.pixelStorei(3315,T.min.y),H.pixelStorei(32877,T.min.z),V.isDataTexture||V.isData3DTexture?H.texSubImage3D(C,q,z.x,z.y,z.z,ve,Ee,Ae,Oe,it,We.data):V.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(C,q,z.x,z.y,z.z,ve,Ee,Ae,Oe,We.data)):H.texSubImage3D(C,q,z.x,z.y,z.z,ve,Ee,Ae,Oe,it,We),H.pixelStorei(3314,ee),H.pixelStorei(32878,Q),H.pixelStorei(3316,De),H.pixelStorei(3315,Ze),H.pixelStorei(32877,ct),q===0&&B.generateMipmaps&&H.generateMipmap(C),de.unbindTexture()},this.initTexture=function(T){T.isCubeTexture?ge.setTextureCube(T,0):T.isData3DTexture?ge.setTexture3D(T,0):T.isDataArrayTexture?ge.setTexture2DArray(T,0):ge.setTexture2D(T,0),de.unbindTexture()},this.resetState=function(){_=0,y=0,A=null,de.reset(),J.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class J0 extends Bc{}J0.prototype.isWebGL1Renderer=!0;class Q0 extends rt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}class Uc{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=go,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ci()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ci()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ci()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ut=new L;class Ki{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix4(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.applyNormalMatrix(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.transformDirection(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[r+n])}return new Et(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ki(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[r+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Fc=new L,Hc=new je,Gc=new je,e_=new L,jc=new He;class t_ extends Ie{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new He,this.bindMatrixInverse=new He}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new je,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const n=1/e.manhattanLength();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const i=this.skeleton,r=this.geometry;Hc.fromBufferAttribute(r.attributes.skinIndex,e),Gc.fromBufferAttribute(r.attributes.skinWeight,e),Fc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){const a=Gc.getComponent(n);if(a!==0){const o=Hc.getComponent(n);jc.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),t.addScaledVector(e_.copy(Fc).applyMatrix4(jc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Vc extends rt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class i_ extends ht{constructor(e=null,t=1,i=1,r,n,a,o,l,c=xt,h=xt,u,d){super(null,a,o,l,c,h,r,n,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Wc=new He,s_=new He;class Yl{constructor(e=[],t=[]){this.uuid=ci(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new He)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new He;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let n=0,a=e.length;n<a;n++){const o=e[n]?e[n].matrixWorld:s_;Wc.multiplyMatrices(o,t[n]),Wc.toArray(i,n*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Yl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Gh(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new i_(t,e,e,hi,os);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const n=e.bones[i];let a=t[n];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),a=new Vc),this.bones.push(a),this.boneInverses.push(new He().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,n=t.length;r<n;r++){const a=t[r];e.bones.push(a.uuid);const o=i[r];e.boneInverses.push(o.toArray())}return e}}class Ko extends gi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qc=new L,Xc=new L,Yc=new He,Jo=new ra,xa=new cs;class ba extends rt{constructor(e=new lt,t=new Ko){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,n=t.count;r<n;r++)qc.fromBufferAttribute(t,r-1),Xc.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=qc.distanceTo(Xc);e.setAttribute("lineDistance",new Fe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,n=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),xa.copy(i.boundingSphere),xa.applyMatrix4(r),xa.radius+=n,e.ray.intersectsSphere(xa)===!1)return;Yc.copy(r).invert(),Jo.copy(e.ray).applyMatrix4(Yc);const o=n/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new L,h=new L,u=new L,d=new L,p=this.isLineSegments?2:1,g=i.index,m=i.attributes.position;if(g!==null){const f=Math.max(0,a.start),_=Math.min(g.count,a.start+a.count);for(let y=f,A=_-1;y<A;y+=p){const b=g.getX(y),S=g.getX(y+1);if(c.fromBufferAttribute(m,b),h.fromBufferAttribute(m,S),Jo.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(d);D<e.near||D>e.far||t.push({distance:D,point:u.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),_=Math.min(m.count,a.start+a.count);for(let y=f,A=_-1;y<A;y+=p){if(c.fromBufferAttribute(m,y),h.fromBufferAttribute(m,y+1),Jo.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(d);b<e.near||b>e.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=i.length;r<n;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}const Zc=new L,$c=new L;class r_ extends ba{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,n=t.count;r<n;r+=2)Zc.fromBufferAttribute(t,r),$c.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+Zc.distanceTo($c);e.setAttribute("lineDistance",new Fe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class n_ extends ba{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Kc extends gi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Jc=new He,Qo=new ra,wa=new cs,Sa=new L;class a_ extends rt{constructor(e=new lt,t=new Kc){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,n=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),wa.copy(i.boundingSphere),wa.applyMatrix4(r),wa.radius+=n,e.ray.intersectsSphere(wa)===!1)return;Jc.copy(r).invert(),Qo.copy(e.ray).applyMatrix4(Jc);const o=n/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,h=i.attributes.position;if(c!==null){const u=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let p=u,g=d;p<g;p++){const m=c.getX(p);Sa.fromBufferAttribute(h,m),Qc(Sa,m,l,r,e,t,this)}}else{const u=Math.max(0,a.start),d=Math.min(h.count,a.start+a.count);for(let p=u,g=d;p<g;p++)Sa.fromBufferAttribute(h,p),Qc(Sa,p,l,r,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=i.length;r<n;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Qc(s,e,t,i,r,n,a){const o=Qo.distanceSqToPoint(s);if(o<t){const l=new L;Qo.closestPointToPoint(s,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;n.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class Ma extends ht{constructor(e,t,i,r,n,a,o,l,c){super(e,t,i,r,n,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class o_ extends lt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new L,n=new L;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,p=u.count;for(let g=d,m=d+p;g<m;g+=3)for(let f=0;f<3;f++){const _=o.getX(g+f),y=o.getX(g+(f+1)%3);r.fromBufferAttribute(a,_),n.fromBufferAttribute(a,y),eu(r,n,i)===!0&&(t.push(r.x,r.y,r.z),t.push(n.x,n.y,n.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,u=3*o+(c+1)%3;r.fromBufferAttribute(a,h),n.fromBufferAttribute(a,u),eu(r,n,i)===!0&&(t.push(r.x,r.y,r.z),t.push(n.x,n.y,n.z))}}this.setAttribute("position",new Fe(t,3))}}}function eu(s,e,t){const i=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}class l_ extends gi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new be(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Hi extends gi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new be(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new we(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class qs extends Hi{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new we(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return bt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new be(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new be(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}const st={arraySlice:function(s,e,t){return st.isTypedArray(s)?new s.constructor(s.subarray(e,t!==void 0?t:s.length)):s.slice(e,t)},convertArray:function(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)},isTypedArray:function(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)},getKeyframeOrder:function(s){function e(r,n){return s[r]-s[n]}const t=s.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i},sortedArray:function(s,e,t){const i=s.length,r=new s.constructor(i);for(let n=0,a=0;a!==i;++n){const o=t[n]*e;for(let l=0;l!==e;++l)r[a++]=s[o+l]}return r},flattenJSON:function(s,e,t,i){let r=1,n=s[0];for(;n!==void 0&&n[i]===void 0;)n=s[r++];if(n===void 0)return;let a=n[i];if(a!==void 0)if(Array.isArray(a))do a=n[i],a!==void 0&&(e.push(n.time),t.push.apply(t,a)),n=s[r++];while(n!==void 0);else if(a.toArray!==void 0)do a=n[i],a!==void 0&&(e.push(n.time),a.toArray(t,t.length)),n=s[r++];while(n!==void 0);else do a=n[i],a!==void 0&&(e.push(n.time),t.push(a)),n=s[r++];while(n!==void 0)},subclip:function(s,e,t,i,r=30){const n=s.clone();n.name=e;const a=[];for(let l=0;l<n.tracks.length;++l){const c=n.tracks[l],h=c.getValueSize(),u=[],d=[];for(let p=0;p<c.times.length;++p){const g=c.times[p]*r;if(!(g<t||g>=i)){u.push(c.times[p]);for(let m=0;m<h;++m)d.push(c.values[p*h+m])}}u.length!==0&&(c.times=st.convertArray(u,c.times.constructor),c.values=st.convertArray(d,c.values.constructor),a.push(c))}n.tracks=a;let o=1/0;for(let l=0;l<n.tracks.length;++l)o>n.tracks[l].times[0]&&(o=n.tracks[l].times[0]);for(let l=0;l<n.tracks.length;++l)n.tracks[l].shift(-1*o);return n.resetDuration(),n},makeClipAdditive:function(s,e=0,t=s,i=30){i<=0&&(i=30);const r=t.tracks.length,n=e/i;for(let a=0;a<r;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=s.tracks.find(function(_){return _.name===o.name&&_.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const g=o.times.length-1;let m;if(n<=o.times[0]){const _=h,y=u-h;m=st.arraySlice(o.values,_,y)}else if(n>=o.times[g]){const _=g*u+h,y=_+u-h;m=st.arraySlice(o.values,_,y)}else{const _=o.createInterpolant(),y=h,A=u-h;_.evaluate(n),m=st.arraySlice(_.resultBuffer,y,A)}l==="quaternion"&&new pi().fromArray(m).normalize().conjugate().toArray(m);const f=c.times.length;for(let _=0;_<f;++_){const y=_*p+d;if(l==="quaternion")pi.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{const A=p-d*2;for(let b=0;b<A;++b)c.values[y+b]-=m[b]}}}return s.blendMode=zp,s}};class fn{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],n=t[i-1];i:{e:{let a;t:{s:if(!(e<r)){for(let o=i+2;;){if(r===void 0){if(e<n)break s;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(n=r,r=t[++i],e<r)break e}a=t.length;break t}if(!(e>=n)){const o=t[1];e<o&&(i=2,n=o);for(let l=i-2;;){if(n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=n,n=t[--i-1],e>=n)break e}a=i,i=0;break t}break i}for(;i<a;){const o=i+a>>>1;e<t[o]?a=o:i=o+1}if(r=t[i],n=t[i-1],n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r;for(let a=0;a!==r;++a)t[a]=i[n+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class h_ extends fn{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Nh,endingEnd:Nh}}intervalChanged_(e,t,i){const r=this.parameterPositions;let n=e-2,a=e+1,o=r[n],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case zh:n=e,o=2*t-i;break;case Bh:n=r.length-2,o=t+r[n]-r[n+1];break;default:n=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case zh:a=e,l=2*i-t;break;case Bh:a=1,l=i+r[1]-r[0];break;default:a=e-1,l=t}const c=(i-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,i,r){const n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,p=this._weightNext,g=(i-t)/(r-t),m=g*g,f=m*g,_=-d*f+2*d*m-d*g,y=(1+d)*f+(-1.5-2*d)*m+(-.5+d)*g+1,A=(-1-p)*f+(1.5+p)*m+.5*g,b=p*f-p*m;for(let S=0;S!==o;++S)n[S]=_*a[h+S]+y*a[c+S]+A*a[l+S]+b*a[u+S];return n}}class c_ extends fn{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(i-t)/(r-t),u=1-h;for(let d=0;d!==o;++d)n[d]=a[c+d]*u+a[l+d]*h;return n}}class u_ extends fn{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class wi{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=st.convertArray(t,this.TimeBufferType),this.values=st.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:st.convertArray(e.times,Array),values:st.convertArray(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new u_(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new c_(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new h_(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case rn:t=this.InterpolantFactoryMethodDiscrete;break;case yr:t=this.InterpolantFactoryMethodLinear;break;case po:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return rn;case this.InterpolantFactoryMethodLinear:return yr;case this.InterpolantFactoryMethodSmooth:return po}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let n=0,a=r-1;for(;n!==r&&i[n]<e;)++n;for(;a!==-1&&i[a]>t;)--a;if(++a,n!==0||a!==r){n>=a&&(a=Math.max(a,1),n=a-1);const o=this.getValueSize();this.times=st.arraySlice(i,n,a),this.values=st.arraySlice(this.values,n*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,n=i.length;n===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==n;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&st.isTypedArray(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=st.arraySlice(this.times),t=st.arraySlice(this.values),i=this.getValueSize(),r=this.getInterpolation()===po,n=e.length-1;let a=1;for(let o=1;o<n;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{const u=o*i,d=u-i,p=u+i;for(let g=0;g!==i;++g){const m=t[u+g];if(m!==t[d+g]||m!==t[p+g]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*i,d=a*i;for(let p=0;p!==i;++p)t[d+p]=t[u+p]}++a}}if(n>0){e[a]=e[n];for(let o=n*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=st.arraySlice(e,0,a),this.values=st.arraySlice(t,0,a*i)):(this.times=e,this.values=t),this}clone(){const e=st.arraySlice(this.times,0),t=st.arraySlice(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}wi.prototype.TimeBufferType=Float32Array,wi.prototype.ValueBufferType=Float32Array,wi.prototype.DefaultInterpolation=yr;class zr extends wi{}zr.prototype.ValueTypeName="bool",zr.prototype.ValueBufferType=Array,zr.prototype.DefaultInterpolation=rn,zr.prototype.InterpolantFactoryMethodLinear=void 0,zr.prototype.InterpolantFactoryMethodSmooth=void 0;class tu extends wi{}tu.prototype.ValueTypeName="color";class mn extends wi{}mn.prototype.ValueTypeName="number";class d_ extends fn{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t);let c=e*o;for(let h=c+o;c!==h;c+=4)pi.slerpFlat(n,0,a,c-o,a,c,l);return n}}class Xs extends wi{InterpolantFactoryMethodLinear(e){return new d_(this.times,this.values,this.getValueSize(),e)}}Xs.prototype.ValueTypeName="quaternion",Xs.prototype.DefaultInterpolation=yr,Xs.prototype.InterpolantFactoryMethodSmooth=void 0;class Br extends wi{}Br.prototype.ValueTypeName="string",Br.prototype.ValueBufferType=Array,Br.prototype.DefaultInterpolation=rn,Br.prototype.InterpolantFactoryMethodLinear=void 0,Br.prototype.InterpolantFactoryMethodSmooth=void 0;class gn extends wi{}gn.prototype.ValueTypeName="vector";class p_{constructor(e,t=-1,i,r=Np){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=ci(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(m_(i[a]).scale(r));const n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let n=0,a=i.length;n!==a;++n)t.push(wi.toJSON(i[n]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const n=t.length,a=[];for(let o=0;o<n;o++){let l=[],c=[];l.push((o+n-1)%n,o,(o+1)%n),c.push(0,1,0);const h=st.getKeyframeOrder(l);l=st.sortedArray(l,1,h),c=st.sortedArray(c,1,h),!r&&l[0]===0&&(l.push(n),c.push(c[0])),a.push(new mn(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},n=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(n);if(h&&h.length>1){const u=h[1];let d=r[u];d||(r[u]=d=[]),d.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,u,d,p,g){if(d.length!==0){const m=[],f=[];st.flattenJSON(d,m,f,p),m.length!==0&&g.push(new h(u,m,f))}},r=[],n=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const u=c[h].keys;if(!(!u||u.length===0))if(u[0].morphTargets){const d={};let p;for(p=0;p<u.length;p++)if(u[p].morphTargets)for(let g=0;g<u[p].morphTargets.length;g++)d[u[p].morphTargets[g]]=-1;for(const g in d){const m=[],f=[];for(let _=0;_!==u[p].morphTargets.length;++_){const y=u[p];m.push(y.time),f.push(y.morphTarget===g?1:0)}r.push(new mn(".morphTargetInfluence["+g+"]",m,f))}l=d.length*a}else{const d=".bones["+t[h].name+"]";i(gn,d+".position",u,"pos",r),i(Xs,d+".quaternion",u,"rot",r),i(gn,d+".scale",u,"scl",r)}}return r.length===0?null:new this(n,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const n=this.tracks[i];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function f_(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return mn;case"vector":case"vector2":case"vector3":case"vector4":return gn;case"color":return tu;case"quaternion":return Xs;case"bool":case"boolean":return zr;case"string":return Br}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function m_(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=f_(s.type);if(s.times===void 0){const t=[],i=[];st.flattenJSON(s.keys,t,i,"value"),s.times=t,s.values=i}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Ur={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class g_{constructor(e,t,i){const r=this;let n=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){o++,n===!1&&r.onStart!==void 0&&r.onStart(h,a,o),n=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(n=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const p=c[u],g=c[u+1];if(p.global&&(p.lastIndex=0),p.test(h))return g}return null}}}const v_=new g_;class Fr{constructor(e){this.manager=e!==void 0?e:v_,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,n){i.load(e,r,t,n)})}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}}const Gi={};class Ta extends Fr{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=Ur.get(e);if(n!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(Gi[e]!==void 0){Gi[e].push({onLoad:t,onProgress:i,onError:r});return}Gi[e]=[],Gi[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Gi[e],u=c.body.getReader(),d=c.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0;let m=0;const f=new ReadableStream({start(_){y();function y(){u.read().then(({done:A,value:b})=>{if(A)_.close();else{m+=b.byteLength;const S=new ProgressEvent("progress",{lengthComputable:g,loaded:m,total:p});for(let D=0,O=h.length;D<O;D++){const M=h[D];M.onProgress&&M.onProgress(S)}_.enqueue(b),y()}})}}});return new Response(f)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),u=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(u);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{Ur.add(e,c);const h=Gi[e];delete Gi[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onLoad&&p.onLoad(c)}}).catch(c=>{const h=Gi[e];if(h===void 0)throw this.manager.itemError(e),c;delete Gi[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onError&&p.onError(c)}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}}class __ extends Fr{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=this,a=Ur.get(e);if(a!==void 0)return n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a;const o=ln("img");function l(){h(),Ur.add(e,this),t&&t(this),n.manager.itemEnd(e)}function c(u){h(),r&&r(u),n.manager.itemError(e),n.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),n.manager.itemStart(e),o.src=e,o}}class iu extends Fr{constructor(e){super(e)}load(e,t,i,r){const n=new ht,a=new __(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){n.image=o,n.needsUpdate=!0,t!==void 0&&t(n)},i,r),n}}class Ca extends rt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new be(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const su=new He,ru=new L,nu=new L;class el{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new jo,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;ru.setFromMatrixPosition(e.matrixWorld),t.position.copy(ru),nu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(nu),t.updateMatrixWorld(),su.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(su),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class y_ extends el{constructor(){super(new Nt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=an*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(i!==t.fov||r!==t.aspect||n!==t.far)&&(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class x_ extends Ca{constructor(e,t,i=0,r=Math.PI/3,n=0,a=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(rt.DefaultUp),this.updateMatrix(),this.target=new rt,this.distance=i,this.angle=r,this.penumbra=n,this.decay=a,this.shadow=new y_}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const au=new He,vn=new L,tl=new L;class b_ extends el{constructor(){super(new Nt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new we(4,2),this._viewportCount=6,this._viewports=[new je(2,1,1,1),new je(0,1,1,1),new je(3,1,1,1),new je(1,1,1,1),new je(3,0,1,1),new je(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,n=e.distance||i.far;n!==i.far&&(i.far=n,i.updateProjectionMatrix()),vn.setFromMatrixPosition(e.matrixWorld),i.position.copy(vn),tl.copy(i.position),tl.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(tl),i.updateMatrixWorld(),r.makeTranslation(-vn.x,-vn.y,-vn.z),au.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(au)}}class w_ extends Ca{constructor(e,t,i=0,r=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new b_}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class S_ extends el{constructor(){super(new dn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ou extends Ca{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rt.DefaultUp),this.updateMatrix(),this.target=new rt,this.shadow=new S_}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class M_ extends Ca{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ys{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class T_ extends lt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class C_ extends Fr{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=this,a=Ur.get(e);if(a!==void 0)return n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(l){Ur.add(e,l),t&&t(l),n.manager.itemEnd(e)}).catch(function(l){r&&r(l),n.manager.itemError(e),n.manager.itemEnd(e)}),n.manager.itemStart(e)}}const il="\\[\\]\\.:\\/",E_=new RegExp("["+il+"]","g"),sl="[^"+il+"]",A_="[^"+il.replace("\\.","")+"]",L_=/((?:WC+[\/:])*)/.source.replace("WC",sl),R_=/(WCOD+)?/.source.replace("WCOD",A_),P_=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sl),D_=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sl),I_=new RegExp("^"+L_+R_+P_+D_+"$"),k_=["material","materials","bones"];class O_{constructor(e,t,i){const r=i||Ye.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Ye{constructor(e,t,i){this.path=t,this.parsedPath=i||Ye.parseTrackName(t),this.node=Ye.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Ye.Composite(e,t,i):new Ye(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(E_,"")}static parseTrackName(e){const t=I_.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const n=i.nodeName.substring(r+1);k_.indexOf(n)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(n){for(let a=0;a<n.length;a++){const o=n[a];if(o.name===t||o.uuid===t)return o;const l=i(o.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let n=t.propertyIndex;if(e||(e=Ye.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(n!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[n]!==void 0&&(n=e.morphTargetDictionary[n])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ye.Composite=O_,Ye.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ye.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ye.prototype.GetterByBindingType=[Ye.prototype._getValue_direct,Ye.prototype._getValue_array,Ye.prototype._getValue_arrayElement,Ye.prototype._getValue_toArray],Ye.prototype.SetterByBindingTypeAndVersioning=[[Ye.prototype._setValue_direct,Ye.prototype._setValue_direct_setNeedsUpdate,Ye.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_array,Ye.prototype._setValue_array_setNeedsUpdate,Ye.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_arrayElement,Ye.prototype._setValue_arrayElement_setNeedsUpdate,Ye.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_fromArray,Ye.prototype._setValue_fromArray_setNeedsUpdate,Ye.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class rl extends Uc{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class N_{constructor(e,t,i=0,r=1/0){this.ray=new ra(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Ro,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.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return nl(e,this,i,t),i.sort(lu),i}intersectObjects(e,t=!0,i=[]){for(let r=0,n=e.length;r<n;r++)nl(e[r],this,i,t);return i.sort(lu),i}}function lu(s,e){return s.distance-e.distance}function nl(s,e,t,i){if(s.layers.test(e.layers)&&s.raycast(e,t),i===!0){const r=s.children;for(let n=0,a=r.length;n<a;n++)nl(r[n],e,t,!0)}}class hu{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(bt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const cu=new L,Ea=new L;class z_{constructor(e=new L,t=new L){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){cu.subVectors(e,this.start),Ea.subVectors(this.end,this.start);const i=Ea.dot(Ea);let r=Ea.dot(cu)/i;return t&&(r=bt(r,0,1)),r}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:io}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=io);const uu={type:"change"},al={type:"start"},du={type:"end"};class B_ extends zs{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new L,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ur.ROTATE,MIDDLE:ur.DOLLY,RIGHT:ur.PAN},this.touches={ONE:dr.ROTATE,TWO:dr.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(w){w.addEventListener("keydown",Wt),this._domElementKeyEvents=w},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(uu),i.update(),n=r.NONE},this.update=function(){const w=new L,J=new pi().setFromUnitVectors(e.up,new L(0,1,0)),ae=J.clone().invert(),oe=new L,P=new pi,re=2*Math.PI;return function(){const ne=i.object.position;w.copy(ne).sub(i.target),w.applyQuaternion(J),o.setFromVector3(w),i.autoRotate&&n===r.NONE&&R(O()),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let me=i.minAzimuthAngle,fe=i.maxAzimuthAngle;return isFinite(me)&&isFinite(fe)&&(me<-Math.PI?me+=re:me>Math.PI&&(me-=re),fe<-Math.PI?fe+=re:fe>Math.PI&&(fe-=re),me<=fe?o.theta=Math.max(me,Math.min(fe,o.theta)):o.theta=o.theta>(me+fe)/2?Math.max(me,o.theta):Math.min(fe,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),o.radius*=c,o.radius=Math.max(i.minDistance,Math.min(i.maxDistance,o.radius)),i.enableDamping===!0?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),w.setFromSpherical(o),w.applyQuaternion(ae),ne.copy(i.target).add(w),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),c=1,u||oe.distanceToSquared(i.object.position)>a||8*(1-P.dot(i.object.quaternion))>a?(i.dispatchEvent(uu),oe.copy(i.object.position),P.copy(i.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",j),i.domElement.removeEventListener("pointerdown",nt),i.domElement.removeEventListener("pointercancel",mt),i.domElement.removeEventListener("wheel",Dt),i.domElement.removeEventListener("pointermove",at),i.domElement.removeEventListener("pointerup",et),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",Wt)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let n=r.NONE;const a=1e-6,o=new hu,l=new hu;let c=1;const h=new L;let u=!1;const d=new we,p=new we,g=new we,m=new we,f=new we,_=new we,y=new we,A=new we,b=new we,S=[],D={};function O(){return 2*Math.PI/60/60*i.autoRotateSpeed}function M(){return Math.pow(.95,i.zoomSpeed)}function R(w){l.theta-=w}function N(w){l.phi-=w}const I=function(){const w=new L;return function(J,ae){w.setFromMatrixColumn(ae,0),w.multiplyScalar(-J),h.add(w)}}(),K=function(){const w=new L;return function(J,ae){i.screenSpacePanning===!0?w.setFromMatrixColumn(ae,1):(w.setFromMatrixColumn(ae,0),w.crossVectors(i.object.up,w)),w.multiplyScalar(J),h.add(w)}}(),$=function(){const w=new L;return function(J,ae){const oe=i.domElement;if(i.object.isPerspectiveCamera){const P=i.object.position;w.copy(P).sub(i.target);let re=w.length();re*=Math.tan(i.object.fov/2*Math.PI/180),I(2*J*re/oe.clientHeight,i.object.matrix),K(2*ae*re/oe.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(J*(i.object.right-i.object.left)/i.object.zoom/oe.clientWidth,i.object.matrix),K(ae*(i.object.top-i.object.bottom)/i.object.zoom/oe.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function k(w){i.object.isPerspectiveCamera?c/=w:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*w)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function W(w){i.object.isPerspectiveCamera?c*=w:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/w)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function U(w){d.set(w.clientX,w.clientY)}function Z(w){y.set(w.clientX,w.clientY)}function Y(w){m.set(w.clientX,w.clientY)}function F(w){p.set(w.clientX,w.clientY),g.subVectors(p,d).multiplyScalar(i.rotateSpeed);const J=i.domElement;R(2*Math.PI*g.x/J.clientHeight),N(2*Math.PI*g.y/J.clientHeight),d.copy(p),i.update()}function G(w){A.set(w.clientX,w.clientY),b.subVectors(A,y),b.y>0?k(M()):b.y<0&&W(M()),y.copy(A),i.update()}function te(w){f.set(w.clientX,w.clientY),_.subVectors(f,m).multiplyScalar(i.panSpeed),$(_.x,_.y),m.copy(f),i.update()}function X(w){w.deltaY<0?W(M()):w.deltaY>0&&k(M()),i.update()}function ie(w){let J=!1;switch(w.code){case i.keys.UP:$(0,i.keyPanSpeed),J=!0;break;case i.keys.BOTTOM:$(0,-i.keyPanSpeed),J=!0;break;case i.keys.LEFT:$(i.keyPanSpeed,0),J=!0;break;case i.keys.RIGHT:$(-i.keyPanSpeed,0),J=!0;break}J&&(w.preventDefault(),i.update())}function ce(){if(S.length===1)d.set(S[0].pageX,S[0].pageY);else{const w=.5*(S[0].pageX+S[1].pageX),J=.5*(S[0].pageY+S[1].pageY);d.set(w,J)}}function Se(){if(S.length===1)m.set(S[0].pageX,S[0].pageY);else{const w=.5*(S[0].pageX+S[1].pageX),J=.5*(S[0].pageY+S[1].pageY);m.set(w,J)}}function H(){const w=S[0].pageX-S[1].pageX,J=S[0].pageY-S[1].pageY,ae=Math.sqrt(w*w+J*J);y.set(0,ae)}function Ke(){i.enableZoom&&H(),i.enablePan&&Se()}function Le(){i.enableZoom&&H(),i.enableRotate&&ce()}function Me(w){if(S.length==1)p.set(w.pageX,w.pageY);else{const ae=xe(w),oe=.5*(w.pageX+ae.x),P=.5*(w.pageY+ae.y);p.set(oe,P)}g.subVectors(p,d).multiplyScalar(i.rotateSpeed);const J=i.domElement;R(2*Math.PI*g.x/J.clientHeight),N(2*Math.PI*g.y/J.clientHeight),d.copy(p)}function de(w){if(S.length===1)f.set(w.pageX,w.pageY);else{const J=xe(w),ae=.5*(w.pageX+J.x),oe=.5*(w.pageY+J.y);f.set(ae,oe)}_.subVectors(f,m).multiplyScalar(i.panSpeed),$(_.x,_.y),m.copy(f)}function Ve(w){const J=xe(w),ae=w.pageX-J.x,oe=w.pageY-J.y,P=Math.sqrt(ae*ae+oe*oe);A.set(0,P),b.set(0,Math.pow(A.y/y.y,i.zoomSpeed)),k(b.y),y.copy(A)}function Ce(w){i.enableZoom&&Ve(w),i.enablePan&&de(w)}function ge(w){i.enableZoom&&Ve(w),i.enableRotate&&Me(w)}function nt(w){i.enabled!==!1&&(S.length===0&&(i.domElement.setPointerCapture(w.pointerId),i.domElement.addEventListener("pointermove",at),i.domElement.addEventListener("pointerup",et)),se(w),w.pointerType==="touch"?E(w):tt(w))}function at(w){i.enabled!==!1&&(w.pointerType==="touch"?x(w):Ge(w))}function et(w){he(w),S.length===0&&(i.domElement.releasePointerCapture(w.pointerId),i.domElement.removeEventListener("pointermove",at),i.domElement.removeEventListener("pointerup",et)),i.dispatchEvent(du),n=r.NONE}function mt(w){he(w)}function tt(w){let J;switch(w.button){case 0:J=i.mouseButtons.LEFT;break;case 1:J=i.mouseButtons.MIDDLE;break;case 2:J=i.mouseButtons.RIGHT;break;default:J=-1}switch(J){case ur.DOLLY:if(i.enableZoom===!1)return;Z(w),n=r.DOLLY;break;case ur.ROTATE:if(w.ctrlKey||w.metaKey||w.shiftKey){if(i.enablePan===!1)return;Y(w),n=r.PAN}else{if(i.enableRotate===!1)return;U(w),n=r.ROTATE}break;case ur.PAN:if(w.ctrlKey||w.metaKey||w.shiftKey){if(i.enableRotate===!1)return;U(w),n=r.ROTATE}else{if(i.enablePan===!1)return;Y(w),n=r.PAN}break;default:n=r.NONE}n!==r.NONE&&i.dispatchEvent(al)}function Ge(w){if(i.enabled!==!1)switch(n){case r.ROTATE:if(i.enableRotate===!1)return;F(w);break;case r.DOLLY:if(i.enableZoom===!1)return;G(w);break;case r.PAN:if(i.enablePan===!1)return;te(w);break}}function Dt(w){i.enabled===!1||i.enableZoom===!1||n!==r.NONE||(w.preventDefault(),i.dispatchEvent(al),X(w),i.dispatchEvent(du))}function Wt(w){i.enabled===!1||i.enablePan===!1||ie(w)}function E(w){switch(pe(w),S.length){case 1:switch(i.touches.ONE){case dr.ROTATE:if(i.enableRotate===!1)return;ce(),n=r.TOUCH_ROTATE;break;case dr.PAN:if(i.enablePan===!1)return;Se(),n=r.TOUCH_PAN;break;default:n=r.NONE}break;case 2:switch(i.touches.TWO){case dr.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ke(),n=r.TOUCH_DOLLY_PAN;break;case dr.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Le(),n=r.TOUCH_DOLLY_ROTATE;break;default:n=r.NONE}break;default:n=r.NONE}n!==r.NONE&&i.dispatchEvent(al)}function x(w){switch(pe(w),n){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;Me(w),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;de(w),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ce(w),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ge(w),i.update();break;default:n=r.NONE}}function j(w){i.enabled!==!1&&w.preventDefault()}function se(w){S.push(w)}function he(w){delete D[w.pointerId];for(let J=0;J<S.length;J++)if(S[J].pointerId==w.pointerId){S.splice(J,1);return}}function pe(w){let J=D[w.pointerId];J===void 0&&(J=new we,D[w.pointerId]=J),J.set(w.pageX,w.pageY)}function xe(w){const J=w.pointerId===S[0].pointerId?S[1]:S[0];return D[J.pointerId]}i.domElement.addEventListener("contextmenu",j),i.domElement.addEventListener("pointerdown",nt),i.domElement.addEventListener("pointercancel",mt),i.domElement.addEventListener("wheel",Dt,{passive:!1}),this.update()}}var _n={Linear:{None:function(s){return s}},Quadratic:{In:function(s){return s*s},Out:function(s){return s*(2-s)},InOut:function(s){return(s*=2)<1?.5*s*s:-.5*(--s*(s-2)-1)}},Cubic:{In:function(s){return s*s*s},Out:function(s){return--s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s:.5*((s-=2)*s*s+2)}},Quartic:{In:function(s){return s*s*s*s},Out:function(s){return 1- --s*s*s*s},InOut:function(s){return(s*=2)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2)}},Quintic:{In:function(s){return s*s*s*s*s},Out:function(s){return--s*s*s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2)}},Sinusoidal:{In:function(s){return 1-Math.cos(s*Math.PI/2)},Out:function(s){return Math.sin(s*Math.PI/2)},InOut:function(s){return .5*(1-Math.cos(Math.PI*s))}},Exponential:{In:function(s){return s===0?0:Math.pow(1024,s-1)},Out:function(s){return s===1?1:1-Math.pow(2,-10*s)},InOut:function(s){return s===0?0:s===1?1:(s*=2)<1?.5*Math.pow(1024,s-1):.5*(-Math.pow(2,-10*(s-1))+2)}},Circular:{In:function(s){return 1-Math.sqrt(1-s*s)},Out:function(s){return Math.sqrt(1- --s*s)},InOut:function(s){return(s*=2)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1)}},Elastic:{In:function(s){return s===0?0:s===1?1:-Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI)},Out:function(s){return s===0?0:s===1?1:Math.pow(2,-10*s)*Math.sin((s-.1)*5*Math.PI)+1},InOut:function(s){return s===0?0:s===1?1:(s*=2,s<1?-.5*Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI):.5*Math.pow(2,-10*(s-1))*Math.sin((s-1.1)*5*Math.PI)+1)}},Back:{In:function(s){var e=1.70158;return s*s*((e+1)*s-e)},Out:function(s){var e=1.70158;return--s*s*((e+1)*s+e)+1},InOut:function(s){var e=2.5949095;return(s*=2)<1?.5*(s*s*((e+1)*s-e)):.5*((s-=2)*s*((e+1)*s+e)+2)}},Bounce:{In:function(s){return 1-_n.Bounce.Out(1-s)},Out:function(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},InOut:function(s){return s<.5?_n.Bounce.In(s*2)*.5:_n.Bounce.Out(s*2-1)*.5+.5}}},yn;typeof self>"u"&&typeof process<"u"&&process.hrtime?yn=function(){var s=process.hrtime();return s[0]*1e3+s[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?yn=self.performance.now.bind(self.performance):Date.now!==void 0?yn=Date.now:yn=function(){return new Date().getTime()};var Hr=yn,U_=function(){function s(){this._tweens={},this._tweensAddedDuringUpdate={}}return s.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},s.prototype.removeAll=function(){this._tweens={}},s.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},s.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},s.prototype.update=function(e,t){e===void 0&&(e=Hr()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<i.length;r++){var n=this._tweens[i[r]],a=!t;n&&n.update(e,a)===!1&&!t&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},s}(),xn={Linear:function(s,e){var t=s.length-1,i=t*e,r=Math.floor(i),n=xn.Utils.Linear;return e<0?n(s[0],s[1],i):e>1?n(s[t],s[t-1],t-i):n(s[r],s[r+1>t?t:r+1],i-r)},Bezier:function(s,e){for(var t=0,i=s.length-1,r=Math.pow,n=xn.Utils.Bernstein,a=0;a<=i;a++)t+=r(1-e,i-a)*r(e,a)*s[a]*n(i,a);return t},CatmullRom:function(s,e){var t=s.length-1,i=t*e,r=Math.floor(i),n=xn.Utils.CatmullRom;return s[0]===s[t]?(e<0&&(r=Math.floor(i=t*(1+e))),n(s[(r-1+t)%t],s[r],s[(r+1)%t],s[(r+2)%t],i-r)):e<0?s[0]-(n(s[0],s[0],s[1],s[1],-i)-s[0]):e>1?s[t]-(n(s[t],s[t],s[t-1],s[t-1],i-t)-s[t]):n(s[r?r-1:0],s[r],s[t<r+1?t:r+1],s[t<r+2?t:r+2],i-r)},Utils:{Linear:function(s,e,t){return(e-s)*t+s},Bernstein:function(s,e){var t=xn.Utils.Factorial;return t(s)/t(e)/t(s-e)},Factorial:function(){var s=[1];return function(e){var t=1;if(s[e])return s[e];for(var i=e;i>1;i--)t*=i;return s[e]=t,t}}(),CatmullRom:function(s,e,t,i,r){var n=(t-s)*.5,a=(i-e)*.5,o=r*r,l=r*o;return(2*e-2*t+n+a)*l+(-3*e+3*t-2*n-a)*o+n*r+e}}},pu=function(){function s(){}return s.nextId=function(){return s._nextId++},s._nextId=0,s}(),fu=new U_,bn=function(){function s(e,t){t===void 0&&(t=fu),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=_n.Linear.None,this._interpolationFunction=xn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=pu.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return s.prototype.getId=function(){return this._id},s.prototype.isPlaying=function(){return this._isPlaying},s.prototype.isPaused=function(){return this._isPaused},s.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),t!==void 0&&(this._duration=t),this},s.prototype.duration=function(e){return this._duration=e,this},s.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?Hr()+parseFloat(e):e:Hr(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},s.prototype._setupProperties=function(e,t,i,r){for(var n in i){var a=e[n],o=Array.isArray(a),l=o?"array":typeof a,c=!o&&Array.isArray(i[n]);if(!(l==="undefined"||l==="function")){if(c){var h=i[n];if(h.length===0)continue;h=h.map(this._handleRelativeValue.bind(this,a)),i[n]=[a].concat(h)}if((l==="object"||o)&&a&&!c){t[n]=o?[]:{};for(var u in a)t[n][u]=a[u];r[n]=o?[]:{},this._setupProperties(a,t[n],i[n],r[n])}else typeof t[n]>"u"&&(t[n]=a),o||(t[n]*=1),c?r[n]=i[n].slice().reverse():r[n]=t[n]||0}}},s.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},s.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},s.prototype.pause=function(e){return e===void 0&&(e=Hr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},s.prototype.resume=function(e){return e===void 0&&(e=Hr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},s.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},s.prototype.group=function(e){return this._group=e,this},s.prototype.delay=function(e){return this._delayTime=e,this},s.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},s.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},s.prototype.yoyo=function(e){return this._yoyo=e,this},s.prototype.easing=function(e){return this._easingFunction=e,this},s.prototype.interpolation=function(e){return this._interpolationFunction=e,this},s.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},s.prototype.onStart=function(e){return this._onStartCallback=e,this},s.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},s.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},s.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},s.prototype.onStop=function(e){return this._onStopCallback=e,this},s.prototype.update=function(e,t){if(e===void 0&&(e=Hr()),t===void 0&&(t=!0),this._isPaused)return!0;var i,r,n=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>n)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=this._duration===0||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,l=this._chainedTweens.length;o<l;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},s.prototype._updateProperties=function(e,t,i,r){for(var n in i)if(t[n]!==void 0){var a=t[n]||0,o=i[n],l=Array.isArray(e[n]),c=Array.isArray(o),h=!l&&c;h?e[n]=this._interpolationFunction(o,r):typeof o=="object"&&o?this._updateProperties(e[n],a,o,r):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(e[n]=a+(o-a)*r))}},s.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},s.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},s}();pu.nextId;var Si=fu;Si.getAll.bind(Si),Si.removeAll.bind(Si),Si.add.bind(Si),Si.remove.bind(Si);var F_=Si.update.bind(Si);class ji extends EventTarget{constructor(){super(),v(this,"root"),v(this,"group"),v(this,"ambientLight"),v(this,"directionalLight"),v(this,"floor"),v(this,"aspect",1),v(this,"rendererWidth"),v(this,"rendererHeight"),this.root=new Q0,this.group=new Re,this.root.add(this.group),this.ambientLight=new M_(6316128),this.root.add(this.ambientLight),this.directionalLight=new ou(14540253,1),this.directionalLight.position.set(3e3,5e3,3e3),this.directionalLight.castShadow=!0,this.directionalLight.shadow.mapSize.width=1024,this.directionalLight.shadow.mapSize.height=1024,this.directionalLight.shadow.radius=15,this.directionalLight.shadow.bias=-5e-4,this.directionalLight.shadow.camera.near=.1,this.directionalLight.shadow.camera.far=1e4,this.directionalLight.shadow.camera.left=-2e3,this.directionalLight.shadow.camera.right=2e3,this.directionalLight.shadow.camera.top=2e3,this.directionalLight.shadow.camera.bottom=-1e3,this.root.add(this.directionalLight),this.floor=this.buildFloor(),this.root.add(this.floor)}async preload(){return Promise.resolve()}update(e){}getPossibleInteraction(e){}triggerInteraction(e,t="click"){}buildFloor(){const e=new l_;e.opacity=.2;const t=new lr(1e4,1e4,100,100);t.rotateX(-Math.PI/2);const i=new Ie(t,e);return i.position.y=0,i.receiveShadow=!0,i}dispose(){}getRoot(){return this.root}getDimensioning(){}getRenderDimensioningActive(){return!0}getCamera(){}setAspect(e){this.aspect=e}setRendererSize(e,t){this.rendererWidth=e,this.rendererHeight=t}}class H_ extends ji{constructor(e){super(),v(this,"camera"),v(this,"canvas"),v(this,"texture"),this.camera=new dn(-.5,.5,-.5,.5,0,1e3),this.camera.lookAt(new L(0,0,0));const t=new lr(1,1),i=this.createMaterial(e),r=new Ie(t,i);r.position.set(0,0,0),r.rotateX(Math.PI),this.root.add(r)}setConfig(e){throw new Error("Method not implemented.")}createMaterial(e){this.canvas=document.createElement("canvas"),this.canvas.width=64,this.canvas.height=64;const t=3,i=this.canvas.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height);let r=i.createLinearGradient(1,0,t,0);return r.addColorStop(0,"#ff0000ff"),r.addColorStop(1,"#ff000000"),i.fillStyle=r,i.fillRect(0,0,t,this.canvas.height),r=i.createLinearGradient(0,1,0,t),r.addColorStop(0,"#ff0000ff"),r.addColorStop(1,"#ff000000"),i.fillStyle=r,i.fillRect(0,0,this.canvas.width,t),r=i.createLinearGradient(this.canvas.width-t,0,this.canvas.width-1,0),r.addColorStop(0,"#ff000000"),r.addColorStop(1,"#ff0000ff"),i.fillStyle=r,i.fillRect(this.canvas.width-t,0,t,this.canvas.height),r=i.createLinearGradient(0,this.canvas.height-t,0,this.canvas.height-1),r.addColorStop(0,"#ff000000"),r.addColorStop(1,"#ff0000ff"),i.fillStyle=r,i.fillRect(0,this.canvas.height-t,this.canvas.width,t),this.texture=new Ma(this.canvas),this.texture.magFilter=as,this.texture.minFilter=as,new Fi({uniforms:{color:{value:new be(e)},fadeout:{value:this.texture}},vertexShader:`
				varying vec2 fadeoutUV;
				uniform vec3 color;
				uniform sampler2D fadeout;

				void main()	{
					fadeoutUV = uv;
					gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
				}
			`,fragmentShader:`
				varying vec2 fadeoutUV;
				uniform vec3 color;
				uniform sampler2D fadeout;

				void main()	{
					vec4 fadeoutColor = texture2D(fadeout, fadeoutUV);
					gl_FragColor = vec4(color.rgb, fadeoutColor.a);
				}
			`,transparent:!0})}getCenter(){}getCamera(){return this.camera}getZoom(){}dispose(){var e;super.dispose(),(e=this.texture)==null||e.dispose()}}class mu{constructor(e,t,i=!1,r=!1){v(this,"canvas"),v(this,"backgroundColor"),v(this,"useVSM"),v(this,"running",!1),v(this,"renderer"),v(this,"camera"),v(this,"specialModeRender",!1),v(this,"raycaster"),v(this,"controls"),v(this,"width",0),v(this,"height",0),v(this,"onClickHandler"),v(this,"onMouseMoveHandler"),v(this,"onMouseDownHandler"),v(this,"onMouseUpHandler"),v(this,"onResizeHandler"),v(this,"onControlsStartHandler"),v(this,"onControlsStopHandler"),v(this,"destroyed",!1),v(this,"objectScene"),v(this,"autoRotateTimer"),v(this,"isInteractionShown",!1),v(this,"aspect",1),v(this,"fade",!1),v(this,"fadeScene"),this.canvas=e,this.backgroundColor=t,this.useVSM=i,this.fade=r,jQuery(this.canvas).data("threerenderer",this),this.running=!1,this.width=jQuery(this.canvas).width(),this.height=jQuery(this.canvas).height(),this.aspect=this.width/this.height,this.renderer=new Bc({antialias:!0,canvas:this.canvas,logarithmicDepthBuffer:!0,powerPreference:"high-performance"}),this.renderer.setClearColor(this.backgroundColor,1),this.renderer.setSize(this.width,this.height,!1),this.renderer.setViewport(0,0,this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.camera=new Nt(75,this.aspect,1,3e4),this.camera.position.z=1800,this.camera.position.y=1e3,this.controls=new B_(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.25,this.controls.enableZoom=!0,this.controls.zoomSpeed=.5,this.controls.minDistance=1500,this.controls.maxDistance=5e3,this.controls.enablePan=!1,this.controls.autoRotate=!window.isTesting(),this.controls.autoRotateSpeed=1,this.controls.rotateSpeed=.5,this.controls.maxPolarAngle=Math.PI*.9,this.controls.minPolarAngle=Math.PI*.1,this.fadeScene=new H_(this.backgroundColor),this.raycaster=new N_,this.onClickHandler=this.onClick.bind(this),this.onMouseDownHandler=this.onMouseDown.bind(this),this.onMouseUpHandler=this.onMouseUp.bind(this),this.onMouseMoveHandler=this.onMouseMove.bind(this),this.onResizeHandler=this.onResize.bind(this),this.onControlsStartHandler=this.onControlsStart.bind(this),this.onControlsStopHandler=this.onControlsStop.bind(this),this.autoRotateTimer=void 0,this.controls.addEventListener("start",this.onControlsStartHandler),this.controls.addEventListener("end",this.onControlsStopHandler),this.renderer.domElement.addEventListener("click",this.onClickHandler,!1),this.renderer.domElement.addEventListener("pointermove",this.onMouseMoveHandler,!1),this.renderer.domElement.addEventListener("pointerdown",this.onMouseDownHandler,!1),this.renderer.domElement.addEventListener("pointerup",this.onMouseUpHandler,!1),window.addEventListener("resize",this.onResizeHandler,!1)}setFade(e){this.fade=e}isRunning(){return this.running}start(){this.running||(this.running=!0,this.animate())}stop(){this.running=!1}onControlsStart(e){this.stopAutoRotate()}onControlsStop(e){this.startAutoRotate()}stopAutoRotate(){this.controls.autoRotate=!1,this.autoRotateTimer&&window.clearTimeout(this.autoRotateTimer),this.autoRotateTimer=void 0}startAutoRotate(){window.isTesting()||(this.autoRotateTimer=window.setTimeout(()=>{this.controls&&(this.controls.autoRotate=!0)},1e4))}onResize(){console.debug("ThreeRenderer::resize"),this.width=this.renderer.domElement.clientWidth,this.height=this.width/this.aspect,this.objectScene&&(this.objectScene.setAspect(this.aspect),this.objectScene.setRendererSize(this.width,this.height)),this.renderer.domElement.height=this.height,this.renderer.setViewport(0,0,this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.width,this.height,!1)}animate(){this.running&&(this.destroyed||(this.controls.update(),this.objectScene&&this.objectScene.update(this.camera),F_(),this.render(),window.isTesting()?window.setTimeout(()=>{window.requestAnimationFrame(()=>{this.animate()})},300):window.requestAnimationFrame(()=>{this.animate()})))}render(){if(this.objectScene){this.renderer.autoClear=!0;const e=this.objectScene.getCamera()??this.camera;this.renderer.render(this.objectScene.getRoot(),e),this.renderer.autoClear=!1;const t=this.objectScene.getDimensioning();t&&this.objectScene.getRenderDimensioningActive()&&this.renderer.render(t,e),this.fade&&this.fadeScene&&(this.renderer.clearDepth(),this.renderer.render(this.fadeScene.getRoot(),this.fadeScene.getCamera()),this.renderer.autoClear=!0)}}dispose(){var e;this.destroyed=!0,console.debug("ThreeRenderer::dispose"),this.renderer.domElement.removeEventListener("pointermove",this.onMouseMoveHandler,!1),this.renderer.domElement.removeEventListener("pointerup",this.onMouseUpHandler,!1),this.renderer.domElement.removeEventListener("pointerdown",this.onMouseDownHandler,!1),this.renderer.domElement.removeEventListener("click",this.onClickHandler,!1),window.removeEventListener("resize",this.onResizeHandler,!1),jQuery(this.canvas).removeData("threerenderer"),this.controls.removeEventListener("start",this.onControlsStartHandler),this.controls.removeEventListener("end",this.onControlsStopHandler),this.autoRotateTimer&&window.clearTimeout(this.autoRotateTimer),this.renderer.dispose(),this.controls.dispose(),(e=this.objectScene)==null||e.dispose()}setObjectScene(e){this.objectScene=e,this.objectScene.setAspect(this.aspect),this.objectScene.setRendererSize(this.width,this.height),this.setCenter(this.objectScene.getCenter()),this.setZoom(this.objectScene.getZoom())}preload(){return Promise.resolve()}setCenter(e){this.controls.target.y=e??0}setZoom(e){this.controls.minDistance=e??1500}onMouseMove(e){if(this.objectScene){const t=this.getMouseHit(e.clientX,e.clientY);if(t){this.isInteractionShown=!0,this.objectScene.triggerInteraction(t,"mousemove");const i=this.objectScene.getPossibleInteraction(t);if(i){e.preventDefault(),document.body.style.cursor="pointer",this.renderer.domElement.title=i;return}}}this.isInteractionShown&&(document.body.style.cursor="auto",this.renderer.domElement.removeAttribute("title"))}onClick(e){if(e.preventDefault(),this.objectScene){const t=this.getMouseHit(e.clientX,e.clientY);t&&this.objectScene.triggerInteraction(t,"click")}}onMouseDown(e){if(this.objectScene){const t=this.getMouseHit(e.clientX,e.clientY);t&&(e.preventDefault(),this.objectScene.triggerInteraction(t,"mousedown"))}}onMouseUp(e){if(this.objectScene){const t=this.getMouseHit(e.clientX,e.clientY);t&&(e.preventDefault(),this.objectScene.triggerInteraction(t,"mouseup"))}}getMouseHit(e,t){if(!this.objectScene)return;const i=this.renderer.domElement.getBoundingClientRect(),r=new we;r.x=(e-i.left)/this.renderer.domElement.clientWidth*2-1,r.y=-((t-i.top)/this.renderer.domElement.clientHeight)*2+1,this.raycaster.setFromCamera(r,this.objectScene.getCamera()??this.camera);const n=this.objectScene.getRoot(),a=this.raycaster.intersectObjects(n.children,!0);return a.length>0?a:void 0}resetView(){console.debug("ThreeRenderer::resetView"),this.controls&&this.controls.reset()}}class G_{static isWebGLAvailable(){try{const e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}static isWebGL2Available(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}static getWebGLErrorMessage(){return this.getErrorMessage(1)}static getWebGL2ErrorMessage(){return this.getErrorMessage(2)}static getErrorMessage(e){const t={1:"WebGL",2:"WebGL 2"},i={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext};let r='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';const n=document.createElement("div");return n.id="webglmessage",n.style.fontFamily="monospace",n.style.fontSize="13px",n.style.fontWeight="normal",n.style.textAlign="center",n.style.background="#fff",n.style.color="#000",n.style.padding="1.5em",n.style.width="400px",n.style.margin="5em auto 0",i[e]?r=r.replace("$0","graphics card"):r=r.replace("$0","browser"),r=r.replace("$1",t[e]),n.innerHTML=r,n}}class Xt{constructor(){v(this,"__type","BaseConfig")}validate(e,t){return Promise.resolve([])}getValidatedConfig(){return Promise.resolve(this)}}var Aa=(s=>(s.None="none",s.Right="right",s.Left="left",s))(Aa||{}),ol=(s=>(s.None="none",s.TipOn="tipon",s.StainlessSteelHandle="steel",s))(ol||{});class ll extends Xt{constructor(){super(...arguments),v(this,"__type","CorpusConfig"),v(this,"procurement_board_id"),v(this,"length"),v(this,"width"),v(this,"height"),v(this,"door"),v(this,"handle"),v(this,"feet"),v(this,"shelf_count"),v(this,"shelf_drilling"),v(this,"connector")}validate(e,t){return Promise.resolve([])}}const hl=new WeakMap;class j_ extends Fr{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const n=new Ta(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,a=>{const o={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(a,o).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const n={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const i=JSON.stringify(t);if(hl.has(e)){const l=hl.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const n=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(n,a).then(l=>(r=l,new Promise((c,h)=>{r._callbacks[n]={resolve:c,reject:h},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return o.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),hl.set(e,{key:i,promise:o}),o}_createGeometry(e){const t=new lt;e.index&&t.setIndex(new Et(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],n=r.name,a=r.array,o=r.itemSize;t.setAttribute(n,new Et(a,o))}return t}_loadLibrary(e,t){const i=new Ta(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,n)=>{i.load(e,r,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const n=V_.toString(),a=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(n){const a=n.data;switch(a.type){case"decode":r._callbacks[a.id].resolve(a);break;case"error":r._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,n){return r._taskLoad>n._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function V_(){let s,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":s=o.decoderConfig,e=new Promise(function(h){s.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(s)});break;case"decode":const l=o.buffer,c=o.taskConfig;e.then(h=>{const u=h.draco,d=new u.Decoder,p=new u.DecoderBuffer;p.Init(new Int8Array(l),l.byteLength);try{const g=t(u,d,p,c),m=g.attributes.map(f=>f.array.buffer);g.index&&m.push(g.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:g},m)}catch(g){console.error(g),self.postMessage({type:"error",id:o.id,error:g.message})}finally{u.destroy(p),u.destroy(d)}});break}};function t(a,o,l,c){const h=c.attributeIDs,u=c.attributeTypes;let d,p;const g=o.GetEncodedGeometryType(l);if(g===a.TRIANGULAR_MESH)d=new a.Mesh,p=o.DecodeBufferToMesh(l,d);else if(g===a.POINT_CLOUD)d=new a.PointCloud,p=o.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const m={index:null,attributes:[]};for(const f in h){const _=self[u[f]];let y,A;if(c.useUniqueIDs)A=h[f],y=o.GetAttributeByUniqueId(d,A);else{if(A=o.GetAttributeId(d,a[h[f]]),A===-1)continue;y=o.GetAttribute(d,A)}m.attributes.push(r(a,o,d,f,_,y))}return g===a.TRIANGULAR_MESH&&(m.index=i(a,o,d)),a.destroy(d),m}function i(a,o,l){const c=l.num_faces()*3,h=c*4,u=a._malloc(h);o.GetTrianglesUInt32Array(l,h,u);const d=new Uint32Array(a.HEAPF32.buffer,u,c).slice();return a._free(u),{array:d,itemSize:1}}function r(a,o,l,c,h,u){const d=u.num_components(),p=l.num_points()*d,g=p*h.BYTES_PER_ELEMENT,m=n(a,h),f=a._malloc(g);o.GetAttributeDataArrayForAllPoints(l,u,m,g,f);const _=new h(a.HEAPF32.buffer,f,p).slice();return a._free(f),{name:c,array:_,itemSize:d}}function n(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}class W_ extends Fr{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new $_(t)}),this.register(function(t){return new sy(t)}),this.register(function(t){return new ry(t)}),this.register(function(t){return new J_(t)}),this.register(function(t){return new Q_(t)}),this.register(function(t){return new ey(t)}),this.register(function(t){return new ty(t)}),this.register(function(t){return new Z_(t)}),this.register(function(t){return new iy(t)}),this.register(function(t){return new K_(t)}),this.register(function(t){return new X_(t)}),this.register(function(t){return new ny(t)})}load(e,t,i,r){const n=this;let a;this.resourcePath!==""?a=this.resourcePath:this.path!==""?a=this.path:a=Ys.extractUrlBase(e),this.manager.itemStart(e);const o=function(c){r?r(c):console.error(c),n.manager.itemError(e),n.manager.itemEnd(e)},l=new Ta(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{n.parse(c,a,function(h){t(h),n.manager.itemEnd(e)},o)}catch(h){o(h)}},i,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let n;const a={},o={};if(typeof e=="string")n=e;else if(Ys.decodeText(new Uint8Array(e,0,4))===gu){try{a[Be.KHR_BINARY_GLTF]=new ay(e)}catch(h){r&&r(h);return}n=a[Be.KHR_BINARY_GLTF].content}else n=Ys.decodeText(new Uint8Array(e));const l=JSON.parse(n);if(l.asset===void 0||l.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new yy(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);o[u.name]=u,a[u.name]=!0}if(l.extensionsUsed)for(let h=0;h<l.extensionsUsed.length;++h){const u=l.extensionsUsed[h],d=l.extensionsRequired||[];switch(u){case Be.KHR_MATERIALS_UNLIT:a[u]=new Y_;break;case Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[u]=new hy;break;case Be.KHR_DRACO_MESH_COMPRESSION:a[u]=new oy(l,this.dracoLoader);break;case Be.KHR_TEXTURE_TRANSFORM:a[u]=new ly;break;case Be.KHR_MESH_QUANTIZATION:a[u]=new cy;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,n){i.parse(e,t,r,n)})}}function q_(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Be={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class X_{constructor(e){this.parser=e,this.name=Be.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const n=t[i];n.extensions&&n.extensions[this.name]&&n.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const n=t.json,a=((n.extensions&&n.extensions[this.name]||{}).lights||[])[e];let o;const l=new be(16777215);a.color!==void 0&&l.fromArray(a.color);const c=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new ou(l),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new w_(l),o.distance=c;break;case"spot":o=new x_(l),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),r=Promise.resolve(o),t.cache.add(i,r),r}createNodeAttachment(e){const t=this,i=this.parser,r=i.json.nodes[e],n=(r.extensions&&r.extensions[this.name]||{}).light;return n===void 0?null:this._loadLight(n).then(function(a){return i._getNodeRef(t.cache,n,a)})}}class Y_{constructor(){this.name=Be.KHR_MATERIALS_UNLIT}getMaterialType(){return Ui}extendParams(e,t,i){const r=[];e.color=new be(1,1,1),e.opacity=1;const n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){const a=n.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}n.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",n.baseColorTexture,Xe))}return Promise.all(r)}}class Z_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class $_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[],a=r.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&n.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&n.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(n.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new we(o,o)}return Promise.all(n)}}class K_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[],a=r.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&n.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&n.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}class J_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[];t.sheenColor=new be(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=r.extensions[this.name];return a.sheenColorFactor!==void 0&&t.sheenColor.fromArray(a.sheenColorFactor),a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&n.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Xe)),a.sheenRoughnessTexture!==void 0&&n.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}class Q_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[],a=r.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&n.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class ey{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[],a=r.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&n.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new be(o[0],o[1],o[2]),Promise.all(n)}}class ty{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class iy{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:qs}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const n=[],a=r.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&n.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new be(o[0],o[1],o[2]),a.specularColorTexture!==void 0&&n.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,Xe)),Promise.all(n)}}class sy{constructor(e){this.parser=e,this.name=Be.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const n=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,a)}}class ry{constructor(e){this.parser=e,this.name=Be.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const a=n.extensions[t],o=r.images[a.source];let l=i.textureLoader;if(o.uri){const c=i.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,a.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class ny{constructor(e){this.name=Be.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],n=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then(function(o){const l=r.byteOffset||0,c=r.byteLength||0,h=r.count,u=r.byteStride,d=new ArrayBuffer(h*u),p=new Uint8Array(o[0],l,c);return a.decodeGltfBuffer(new Uint8Array(d),h,u,p,r.mode,r.filter),d})}else return null}}const gu="glTF",wn=12,vu={JSON:1313821514,BIN:5130562};class ay{constructor(e){this.name=Be.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,wn);if(this.header={magic:Ys.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==gu)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-wn,r=new DataView(e,wn);let n=0;for(;n<i;){const a=r.getUint32(n,!0);n+=4;const o=r.getUint32(n,!0);if(n+=4,o===vu.JSON){const l=new Uint8Array(e,wn+n,a);this.content=Ys.decodeText(l)}else if(o===vu.BIN){const l=wn+n;this.body=e.slice(l,l+a)}n+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class oy{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Be.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},c={};for(const h in a){const u=ul[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=ul[h]||h.toLowerCase();if(a[h]!==void 0){const d=i.accessors[e.attributes[h]],p=Sn[d.componentType];c[u]=p,l[u]=d.normalized===!0}}return t.getDependency("bufferView",n).then(function(h){return new Promise(function(u){r.decodeDracoFile(h,function(d){for(const p in d.attributes){const g=d.attributes[p],m=l[p];m!==void 0&&(g.normalized=m)}u(d)},o,c)})})}}class ly{constructor(){this.name=Be.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return t.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class cl extends Hi{constructor(e){super(),this.isGLTFSpecularGlossinessMaterial=!0;const t=["#ifdef USE_SPECULARMAP","	uniform sampler2D specularMap;","#endif"].join(`
`),i=["#ifdef USE_GLOSSINESSMAP","	uniform sampler2D glossinessMap;","#endif"].join(`
`),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","	vec4 texelSpecular = texture2D( specularMap, vUv );","	// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","	specularFactor *= texelSpecular.rgb;","#endif"].join(`
`),n=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","	vec4 texelGlossiness = texture2D( glossinessMap, vUv );","	// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","	glossinessFactor *= texelGlossiness.a;","#endif"].join(`
`),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join(`
`),o={specular:{value:new be().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(l){for(const c in o)l.uniforms[c]=o[c];l.fragmentShader=l.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",i).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",n).replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(l){o.specular.value=l}},specularMap:{get:function(){return o.specularMap.value},set:function(l){o.specularMap.value=l,l?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(l){o.glossiness.value=l}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(l){o.glossinessMap.value=l,l?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class hy{constructor(){this.name=Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return cl}extendParams(e,t,i){const r=t.extensions[this.name];e.color=new be(1,1,1),e.opacity=1;const n=[];if(Array.isArray(r.diffuseFactor)){const a=r.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(r.diffuseTexture!==void 0&&n.push(i.assignTexture(e,"map",r.diffuseTexture,Xe)),e.emissive=new be(0,0,0),e.glossiness=r.glossinessFactor!==void 0?r.glossinessFactor:1,e.specular=new be(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),r.specularGlossinessTexture!==void 0){const a=r.specularGlossinessTexture;n.push(i.assignTexture(e,"glossinessMap",a)),n.push(i.assignTexture(e,"specularMap",a,Xe))}return Promise.all(n)}createMaterial(e){const t=new cl(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=e.emissiveIntensity===void 0?1:e.emissiveIntensity,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=fo,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t}}class cy{constructor(){this.name=Be.KHR_MESH_QUANTIZATION}}class _u extends fn{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r*3+r;for(let a=0;a!==r;a++)t[a]=i[n+a];return t}interpolate_(e,t,i,r){const n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,c=o*3,h=r-t,u=(i-t)/h,d=u*u,p=d*u,g=e*c,m=g-c,f=-2*p+3*d,_=p-d,y=1-f,A=_-d+u;for(let b=0;b!==o;b++){const S=a[m+b+o],D=a[m+b+l]*h,O=a[g+b+o],M=a[g+b]*h;n[b]=y*S+A*D+f*O+_*M}return n}}const uy=new pi;class dy extends _u{interpolate_(e,t,i,r){const n=super.interpolate_(e,t,i,r);return uy.fromArray(n).normalize().toArray(n),n}}const Vi={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Sn={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},yu={9728:xt,9729:gt,9984:ao,9985:ph,9986:oo,9987:as},xu={33071:ei,33648:Yn,10497:ns},bu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ul={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},gs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},py={CUBICSPLINE:void 0,LINEAR:yr,STEP:rn},dl={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function fy(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new Hi({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Rs})),s.DefaultMaterial}function Mn(s,e,t){for(const i in t.extensions)s[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Zs(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function my(s,e,t){let i=!1,r=!1,n=!1;for(let c=0,h=e.length;c<h;c++){const u=e[c];if(u.POSITION!==void 0&&(i=!0),u.NORMAL!==void 0&&(r=!0),u.COLOR_0!==void 0&&(n=!0),i&&r&&n)break}if(!i&&!r&&!n)return Promise.resolve(s);const a=[],o=[],l=[];for(let c=0,h=e.length;c<h;c++){const u=e[c];if(i){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(r){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(n){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;l.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){const h=c[0],u=c[1],d=c[2];return i&&(s.morphAttributes.position=h),r&&(s.morphAttributes.normal=u),n&&(s.morphAttributes.color=d),s.morphTargetsRelative=!0,s})}function gy(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)s.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function vy(s){const e=s.extensions&&s.extensions[Be.KHR_DRACO_MESH_COMPRESSION];let t;return e?t="draco:"+e.bufferView+":"+e.indices+":"+wu(e.attributes):t=s.indices+":"+wu(s.attributes)+":"+s.mode,t}function wu(s){let e="";const t=Object.keys(s).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+s[t[i]]+";";return e}function pl(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function _y(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}class yy{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new q_,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,n=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1;typeof createImageBitmap>"u"||i||r&&n<98?this.textureLoader=new iu(this.options.manager):this.textureLoader=new C_(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ta(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(a){const o={scene:a[0][r.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:r.asset,parser:i,userData:{}};Mn(n,o,r),Zs(o,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,n=t.length;r<n;r++){const a=t[r].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let r=0,n=e.length;r<n;r++){const a=e[r];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(i[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),n=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,h]of a.children.entries())n(h,o.children[c])};return n(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const n=e(t[r]);n&&i.push(n)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne(function(n){return n.loadMesh&&n.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(n){return n.loadBufferView&&n.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(n){return n.loadMaterial&&n.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(n){return n.loadTexture&&n.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(n){return n.loadAnimation&&n.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(n,a){return i.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Be.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(n,a){i.load(Ys.resolveURL(t.uri,r.path),n,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,n=t.byteOffset||0;return i.slice(n,n+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0)return Promise.resolve(null);const n=[];return r.bufferView!==void 0?n.push(this.getDependency("bufferView",r.bufferView)):n.push(null),r.sparse!==void 0&&(n.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(n).then(function(a){const o=a[0],l=bu[r.type],c=Sn[r.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,d=r.byteOffset||0,p=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,g=r.normalized===!0;let m,f;if(p&&p!==u){const _=Math.floor(d/p),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+_+":"+r.count;let A=t.cache.get(y);A||(m=new c(o,_*p,r.count*p/h),A=new Uc(m,p/h),t.cache.add(y,A)),f=new Ki(A,l,d%p/h,g)}else o===null?m=new c(r.count*l):m=new c(o,d,r.count*l),f=new Et(m,l,g);if(r.sparse!==void 0){const _=bu.SCALAR,y=Sn[r.sparse.indices.componentType],A=r.sparse.indices.byteOffset||0,b=r.sparse.values.byteOffset||0,S=new y(a[1],A,r.sparse.count*_),D=new c(a[2],b,r.sparse.count*l);o!==null&&(f=new Et(f.array.slice(),f.itemSize,f.normalized));for(let O=0,M=S.length;O<M;O++){const R=S[O];if(f.setX(R,D[O*l]),l>=2&&f.setY(R,D[O*l+1]),l>=3&&f.setZ(R,D[O*l+2]),l>=4&&f.setW(R,D[O*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,n=t.images[r];let a=this.textureLoader;if(n.uri){const o=i.manager.getHandler(n.uri);o!==null&&(a=o)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){const r=this,n=this.json,a=n.textures[e],o=n.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(h){h.flipY=!1,a.name&&(h.name=a.name);const u=(n.samplers||{})[a.sampler]||{};return h.magFilter=yu[u.magFilter]||gt,h.minFilter=yu[u.minFilter]||as,h.wrapS=xu[u.wrapS]||ns,h.wrapT=xu[u.wrapT]||ns,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,n=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=r.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=i.getDependency("bufferView",a.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:a.mimeType});return l=o.createObjectURL(d),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(u){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(m){const f=new ht(m);f.needsUpdate=!0,d(f)}),t.load(Ys.resolveURL(u,n.path),g,void 0,p)})}).then(function(u){return c===!0&&o.revokeObjectURL(l),u.userData.mimeType=a.mimeType||_y(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=h,h}assignTexture(e,t,i,r){const n=this;return this.getDependency("texture",i.index).then(function(a){if(i.texCoord!==void 0&&i.texCoord!=0&&!(t==="aoMap"&&i.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),n.extensions[Be.KHR_TEXTURE_TRANSFORM]){const o=i.extensions!==void 0?i.extensions[Be.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=n.associations.get(a);a=n.extensions[Be.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),n.associations.set(a,l)}}return r!==void 0&&(a.encoding=r),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,n=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+i.uuid;let l=this.cache.get(o);l||(l=new Kc,gi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(o,l)),i=l}else if(e.isLine){const o="LineBasicMaterial:"+i.uuid;let l=this.cache.get(o);l||(l=new Ko,gi.prototype.copy.call(l,i),l.color.copy(i.color),this.cache.add(o,l)),i=l}if(r||n||a){let o="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(o+="specular-glossiness:"),r&&(o+="derivative-tangents:"),n&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=i.clone(),n&&(l.vertexColors=!0),a&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(i))),i=l}i.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=i}getMaterialType(){return Hi}loadMaterial(e){const t=this,i=this.json,r=this.extensions,n=i.materials[e];let a;const o={},l=n.extensions||{},c=[];if(l[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const u=r[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];a=u.getMaterialType(),c.push(u.extendParams(o,n,t))}else if(l[Be.KHR_MATERIALS_UNLIT]){const u=r[Be.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),c.push(u.extendParams(o,n,t))}else{const u=n.pbrMetallicRoughness||{};if(o.color=new be(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.fromArray(d),o.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(o,"map",u.baseColorTexture,Xe)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}n.doubleSided===!0&&(o.side=Ps);const h=n.alphaMode||dl.OPAQUE;if(h===dl.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===dl.MASK&&(o.alphaTest=n.alphaCutoff!==void 0?n.alphaCutoff:.5)),n.normalTexture!==void 0&&a!==Ui&&(c.push(t.assignTexture(o,"normalMap",n.normalTexture)),o.normalScale=new we(1,1),n.normalTexture.scale!==void 0)){const u=n.normalTexture.scale;o.normalScale.set(u,u)}return n.occlusionTexture!==void 0&&a!==Ui&&(c.push(t.assignTexture(o,"aoMap",n.occlusionTexture)),n.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&a!==Ui&&(o.emissive=new be().fromArray(n.emissiveFactor)),n.emissiveTexture!==void 0&&a!==Ui&&c.push(t.assignTexture(o,"emissiveMap",n.emissiveTexture,Xe)),Promise.all(c).then(function(){let u;return a===cl?u=r[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):u=new a(o),n.name&&(u.name=n.name),Zs(u,n),t.associations.set(u,{materials:e}),n.extensions&&Mn(r,u,n),u})}createUniqueName(e){const t=Ye.sanitizeNodeName(e||"");let i=t;for(let r=1;this.nodeNamesUsed[i];++r)i=t+"_"+r;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function n(o){return i[Be.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(l){return Mu(l,o,t)})}const a=[];for(let o=0,l=e.length;o<l;o++){const c=e[o],h=vy(c),u=r[h];if(u)a.push(u.promise);else{let d;c.extensions&&c.extensions[Be.KHR_DRACO_MESH_COMPRESSION]?d=n(c):d=Mu(new lt,c,t),r[h]={primitive:c,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,i=this.json,r=this.extensions,n=i.meshes[e],a=n.primitives,o=[];for(let l=0,c=a.length;l<c;l++){const h=a[l].material===void 0?fy(this.cache):this.getDependency("material",a[l].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let p=0,g=h.length;p<g;p++){const m=h[p],f=a[p];let _;const y=c[p];if(f.mode===Vi.TRIANGLES||f.mode===Vi.TRIANGLE_STRIP||f.mode===Vi.TRIANGLE_FAN||f.mode===void 0)_=n.isSkinnedMesh===!0?new t_(m,y):new Ie(m,y),_.isSkinnedMesh===!0&&!_.geometry.attributes.skinWeight.normalized&&_.normalizeSkinWeights(),f.mode===Vi.TRIANGLE_STRIP?_.geometry=Tu(_.geometry,Bp):f.mode===Vi.TRIANGLE_FAN&&(_.geometry=Tu(_.geometry,Uh));else if(f.mode===Vi.LINES)_=new r_(m,y);else if(f.mode===Vi.LINE_STRIP)_=new ba(m,y);else if(f.mode===Vi.LINE_LOOP)_=new n_(m,y);else if(f.mode===Vi.POINTS)_=new a_(m,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(_.geometry.morphAttributes).length>0&&gy(_,n),_.name=t.createUniqueName(n.name||"mesh_"+e),Zs(_,n),f.extensions&&Mn(r,_,f),t.assignFinalMaterial(_),u.push(_)}for(let p=0,g=u.length;p<g;p++)t.associations.set(u[p],{meshes:e,primitives:p});if(u.length===1)return u[0];const d=new Re;t.associations.set(d,{meshes:e});for(let p=0,g=u.length;p<g;p++)d.add(u[p]);return d})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Nt(jh.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new dn(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Zs(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then(function(r){return i.inverseBindMatrices=r,i})}loadAnimation(e){const t=this.json.animations[e],i=[],r=[],n=[],a=[],o=[];for(let l=0,c=t.channels.length;l<c;l++){const h=t.channels[l],u=t.samplers[h.sampler],d=h.target,p=d.node!==void 0?d.node:d.id,g=t.parameters!==void 0?t.parameters[u.input]:u.input,m=t.parameters!==void 0?t.parameters[u.output]:u.output;i.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",g)),n.push(this.getDependency("accessor",m)),a.push(u),o.push(d)}return Promise.all([Promise.all(i),Promise.all(r),Promise.all(n),Promise.all(a),Promise.all(o)]).then(function(l){const c=l[0],h=l[1],u=l[2],d=l[3],p=l[4],g=[];for(let f=0,_=c.length;f<_;f++){const y=c[f],A=h[f],b=u[f],S=d[f],D=p[f];if(y===void 0)continue;y.updateMatrix(),y.matrixAutoUpdate=!0;let O;switch(gs[D.path]){case gs.weights:O=mn;break;case gs.rotation:O=Xs;break;case gs.position:case gs.scale:default:O=gn;break}const M=y.name?y.name:y.uuid,R=S.interpolation!==void 0?py[S.interpolation]:yr,N=[];gs[D.path]===gs.weights?y.traverse(function(K){K.morphTargetInfluences&&N.push(K.name?K.name:K.uuid)}):N.push(M);let I=b.array;if(b.normalized){const K=pl(I.constructor),$=new Float32Array(I.length);for(let k=0,W=I.length;k<W;k++)$[k]=I[k]*K;I=$}for(let K=0,$=N.length;K<$;K++){const k=new O(N[K]+"."+gs[D.path],A.array,I,R);S.interpolation==="CUBICSPLINE"&&(k.createInterpolant=function(W){const U=this instanceof Xs?dy:_u;return new U(this.times,this.values,this.getValueSize()/3,W)},k.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),g.push(k)}}const m=t.name?t.name:"animation_"+e;return new p_(m,void 0,g)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(n){const a=i._getNodeRef(i.meshCache,r.mesh,n);return r.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,c=r.weights.length;l<c;l++)o.morphTargetInfluences[l]=r.weights[l]}),a})}loadNode(e){const t=this.json,i=this.extensions,r=this,n=t.nodes[e],a=n.name?r.createUniqueName(n.name):"";return function(){const o=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&o.push(l),n.camera!==void 0&&o.push(r.getDependency("camera",n.camera).then(function(c){return r._getNodeRef(r.cameraCache,n.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),Promise.all(o)}().then(function(o){let l;if(n.isBone===!0?l=new Vc:o.length>1?l=new Re:o.length===1?l=o[0]:l=new rt,l!==o[0])for(let c=0,h=o.length;c<h;c++)l.add(o[c]);if(n.name&&(l.userData.name=n.name,l.name=a),Zs(l,n),n.extensions&&Mn(i,l,n),n.matrix!==void 0){const c=new He;c.fromArray(n.matrix),l.applyMatrix4(c)}else n.translation!==void 0&&l.position.fromArray(n.translation),n.rotation!==void 0&&l.quaternion.fromArray(n.rotation),n.scale!==void 0&&l.scale.fromArray(n.scale);return r.associations.has(l)||r.associations.set(l,{}),r.associations.get(l).nodes=e,l})}loadScene(e){const t=this.json,i=this.extensions,r=this.json.scenes[e],n=this,a=new Re;r.name&&(a.name=n.createUniqueName(r.name)),Zs(a,r),r.extensions&&Mn(i,a,r);const o=r.nodes||[],l=[];for(let c=0,h=o.length;c<h;c++)l.push(Su(o[c],a,t,n));return Promise.all(l).then(function(){const c=h=>{const u=new Map;for(const[d,p]of n.associations)(d instanceof gi||d instanceof ht)&&u.set(d,p);return h.traverse(d=>{const p=n.associations.get(d);p!=null&&u.set(d,p)}),u};return n.associations=c(a),a})}}function Su(s,e,t,i){const r=t.nodes[s];return i.getDependency("node",s).then(function(n){if(r.skin===void 0)return n;let a;return i.getDependency("skin",r.skin).then(function(o){a=o;const l=[];for(let c=0,h=a.joints.length;c<h;c++)l.push(i.getDependency("node",a.joints[c]));return Promise.all(l)}).then(function(o){return n.traverse(function(l){if(!l.isMesh)return;const c=[],h=[];for(let u=0,d=o.length;u<d;u++){const p=o[u];if(p){c.push(p);const g=new He;a.inverseBindMatrices!==void 0&&g.fromArray(a.inverseBindMatrices.array,u*16),h.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',a.joints[u])}l.bind(new Yl(c,h),l.matrixWorld)}),n})}).then(function(n){e.add(n);const a=[];if(r.children){const o=r.children;for(let l=0,c=o.length;l<c;l++){const h=o[l];a.push(Su(h,n,t,i))}}return Promise.all(a)})}function xy(s,e,t){const i=e.attributes,r=new bi;if(i.POSITION!==void 0){const o=t.json.accessors[i.POSITION],l=o.min,c=o.max;if(l!==void 0&&c!==void 0){if(r.set(new L(l[0],l[1],l[2]),new L(c[0],c[1],c[2])),o.normalized){const h=pl(Sn[o.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const n=e.targets;if(n!==void 0){const o=new L,l=new L;for(let c=0,h=n.length;c<h;c++){const u=n[c];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){if(l.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),l.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),l.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),d.normalized){const m=pl(Sn[d.componentType]);l.multiplyScalar(m)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(o)}s.boundingBox=r;const a=new cs;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,s.boundingSphere=a}function Mu(s,e,t){const i=e.attributes,r=[];function n(a,o){return t.getDependency("accessor",a).then(function(l){s.setAttribute(o,l)})}for(const a in i){const o=ul[a]||a.toLowerCase();o in s.attributes||r.push(n(i[a],o))}if(e.indices!==void 0&&!s.index){const a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});r.push(a)}return Zs(s,e),xy(s,e,t),Promise.all(r).then(function(){return e.targets!==void 0?my(s,e.targets,t):s})}function Tu(s,e){let t=s.getIndex();if(t===null){const a=[],o=s.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const i=t.count-2,r=[];if(e===Uh)for(let a=1;a<=i;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const n=s.clone();return n.setIndex(r),n}const Cu=class{constructor(){v(this,"textureCache",{}),v(this,"surfaces"),v(this,"textureLoader"),v(this,"gltfLoader"),v(this,"dracoLoader"),this.surfaces=product_configurator_surface_manager_surfaces,this.textureLoader=new iu,this.dracoLoader=new j_,this.dracoLoader.setDecoderPath(product_configurator_options.draco_path),this.gltfLoader=new W_,this.gltfLoader.setDRACOLoader(this.dracoLoader)}static getInstance(){return this.instance||(this.instance=new Cu),this.instance}async loadTexture(s){if(this.textureCache[s])return this.textureCache[s];const e=await this.textureLoader.loadAsync(s);return e.wrapS=ns,e.wrapT=ns,this.textureCache[s]=e,e}async loadModel(s){return new Promise((e,t)=>{this.gltfLoader.load(product_configurator_options.model_path+"/"+s,i=>e(i))})}loadSurface(s){const e=this.surfaces.find(t=>t.id==s);if(!e)throw new Error("Failed to load surface texture data.");return this.loadTexture(e.texture)}loadFallback(){return this.loadTexture(product_configurator_options.fallback_texture)}};let Ft=Cu;v(Ft,"instance");class Ht extends rt{constructor(){super(...arguments),v(this,"preloaded",!1),v(this,"currentConfig")}async setConfig(e){if(!this.preloaded)throw new Error("setConfig called before preload.");return this.currentConfig=await e.getValidatedConfig(),Promise.resolve()}async preload(){this.preloaded=!0}getDimensioning(){}update(e){}}class Eu{constructor(e,t,i,r,n){v(this,"left"),v(this,"right"),v(this,"top"),v(this,"width"),v(this,"height"),this.left=e,this.right=t,this.top=i,this.width=r,this.height=n}get bounds_right(){return this.left+this.width}get bounds_bottom(){return this.top+this.height}intersects(e,t){return t=t||0,Math.min(this.right,e.right+t)-Math.max(this.left,e.left-t)>0&&Math.min(this.bounds_bottom,e.bounds_bottom+t)-Math.max(this.top,e.top-t)>0}}var vs=(s=>(s.Round="round",s.Rectangle="rectangle",s))(vs||{}),by=Object.defineProperty,wy=Object.getOwnPropertyDescriptor,_s=(s,e,t,i)=>{for(var r=i>1?void 0:i?wy(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&by(e,t,r),r};class Wi extends Xt{constructor(){super(...arguments),v(this,"__type","DrillConfig"),v(this,"title"),v(this,"left"),v(this,"right"),v(this,"top"),v(this,"type")}async validate(e,t){return await Qa(this,t)}}_s([Gn()],Wi.prototype,"title",2),_s([Es({message:"Die linke Kate muss positiv sein!"}),ni({message:"Die linke Kante muss als Ganzzahl angegeben werden.",always:!0}),kt({},{message:"Die linke Kante muss angegeben werden."})],Wi.prototype,"left",2),_s([Es({message:"Die rechte Kate muss positiv sein!"}),ni({message:"Die rechte Kante muss als Ganzzahl angegeben werden.",always:!0}),kt({},{message:"Die rechte Kante muss angegeben werden."})],Wi.prototype,"right",2),_s([Es({message:"Die obere Kate muss positiv sein!"}),ni({message:"Die obere Kante muss als Ganzzahl angegeben werden.",always:!0}),kt({},{message:"Die obere Kante muss angegeben werden."})],Wi.prototype,"top",2),_s([Hn([vs.Round,vs.Rectangle])],Wi.prototype,"type",2);class Mi extends Wi{constructor(){super(),v(this,"diameter"),this.__type="RoundDrillConfig",this.type=vs.Round}get bounds(){return this.left&&this.top&&this.diameter&&this.right?new Eu(this.left,this.right,this.top,this.diameter,this.diameter):null}async validate(e){var t,i;const r=await super.validate(e);if(!e.padding||!e.plateConfig)return r;if(((t=e.plateConfig)==null?void 0:t.__type)==="HeightAdjustableCornerDeskConfig"){const n=await this.validateHeightAdjustableCornerDesk(e.padding,e.plateConfig);r.push(...n)}else if(((i=e.plateConfig)==null?void 0:i.__type)==="HeightAdjustableDeskConfig"){const n=await this.validateHeightAdjustableDesk(e.padding,e.plateConfig);r.push(...n)}return r}async validateHeightAdjustableDesk(e,t){const i=[];if(!t.width||!t.length||!this.left||!this.top||!this.diameter)return i;const r=this.diameter/2;if(this.left-r<e){const n=new yt;n.property="left",n.value=this.left,n.target=this,n.children=[],n.constraints={max:"Die linke Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(n)}if(this.top-r<e){const n=new yt;n.property="top",n.value=this.top,n.target=this,n.children=[],n.constraints={max:"Die obere Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(n)}if(this.top+r>t.width-e){const n=new yt;n.property="top",n.value=this.top,n.target=this,n.children=[],n.constraints={max:"Die untere Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(n)}if(this.left+r>t.length-e){const n=new yt;n.property="left",n.value=this.left,n.target=this,n.children=[],n.constraints={max:"Die rechte Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(n)}return i}async validateHeightAdjustableCornerDesk(e,t){const i=[];if(!t.width||!t.length||!t.width_2||!t.length_2||!t.radius||!this.left||!this.top||!this.diameter)return i;const r=this.diameter/2;if(this.left-r<e){const o=new yt;o.property="left",o.value=this.left,o.target=this,o.children=[],o.constraints={max:"Die Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(o)}if(this.top-r<e){const o=new yt;o.property="top",o.value=this.top,o.target=this,o.children=[],o.constraints={max:"Die obere Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(o)}if(this.top>t.width_2+t.radius&&this.left+r+e>t.length_2||t.length-this.left-r<e){const o=new yt;o.property="left",o.value=this.left,o.target=this,o.children=[],o.constraints={max:"Die Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(o)}if(this.left>t.length_2+t.radius&&this.top+r+e>t.width_2||t.width-this.top-r<e){const o=new yt;o.property="top",o.value=this.top,o.target=this,o.children=[],o.constraints={max:"Die untere Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(o)}const n=t.length_2+t.radius-this.left,a=t.width_2+t.radius-this.top;if(Math.sqrt(n*n+a*a)-r-e<t.radius){const o=new yt;o.property="top",o.value=this.top,o.target=this,o.children=[],o.constraints={max:"Die Kante der Bohrung darf maximal "+e+"mm an die Plattenkante ragen."},i.unshift(o)}return i}}_s([Es(),is(10,{message:"Der Durchmesser muss mindestens $constraint1mm betragen."}),ss(200,{message:"Der Durchmesser darf maximal $constraint1mm betragen."}),ni({message:"Die Durchmesser muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Der Durchmesser muss angegeben werden."})],Mi.prototype,"diameter",2);class Tn extends Wi{constructor(){super(),v(this,"length"),v(this,"width"),this.__type="RectangleDrillConfig",this.type=vs.Rectangle}get bounds(){return this.left&&this.right&&this.top&&this.length&&this.width?new Eu(this.left,this.top,this.right,this.length,this.width):null}async validate(e){throw await super.validate(e),new Error("not implemented yet")}}_s([kt(),Es()],Tn.prototype,"length",2),_s([kt(),Es()],Tn.prototype,"width",2);class Au extends Ma{constructor(e,t){const i=document.createElement("canvas");i.width=e,i.height=t,super(i),v(this,"canvas"),v(this,"drills",[]),v(this,"length"),v(this,"width"),this.canvas=i}setDrills(e,t,i){this.drills=i,this.length=e,this.width=t,this.drawDrills()}drawDrills(){const e=this.canvas.getContext("2d");if(e==null)return!1;const t=this.canvas.width/this.length,i=this.canvas.height/this.width;e.clearRect(0,0,this.canvas.width,this.canvas.height),e.fillStyle="#00000000",e.fillRect(0,0,this.canvas.width,this.canvas.height),e.lineWidth=4;for(const r of this.drills??[])if(r instanceof Mi){e.fillStyle="#ffff00ff",e.strokeStyle="#00ff00ff";const n=r.diameter/2*t,a=r.diameter/2*i,o=r.top*i,l=r.left*t;e.beginPath(),e.ellipse(l,o,n,a,0,0,2*Math.PI),e.stroke(),e.fill(),e.strokeStyle="#000000ff",e.beginPath(),e.moveTo(l-n/2,o),e.lineTo(l+n/2,o),e.moveTo(l,o-a/2),e.lineTo(l,o+a/2),e.stroke()}this.needsUpdate=!0}}class Lu extends Hi{constructor(e){super(e),v(this,"drillMap"),this.drillMap=null,this.setValues(e)}onBeforeCompile(e,t){e.fragmentShader=e.fragmentShader.replace("#include <uv_pars_fragment>",`
        #include <uv_pars_fragment>
        varying vec2 vDrillUv;
        `),e.vertexShader=e.vertexShader.replace("#include <uv_pars_vertex>",`
        #include <uv_pars_vertex>
        attribute vec2 drillUv;
        varying vec2 vDrillUv;
        `),e.vertexShader=e.vertexShader.replace("#include <uv_vertex>",`
        #include <uv_vertex>
        vDrillUv = drillUv;
        `),e.fragmentShader=e.fragmentShader.replace("#include <map_pars_fragment>",`
        #include <map_pars_fragment>
        uniform sampler2D drills;
        `),e.fragmentShader=e.fragmentShader.replace("#include <map_fragment>",`
        #include <map_fragment>
        {
            vec4 sampledDrillColor = texture2D( drills, vDrillUv );
            
            diffuseColor.rgb = (sampledDrillColor.ggg * sampledDrillColor.a) + diffuseColor.rgb * (1.0 - sampledDrillColor.a);
            diffuseColor.a *= 1.0 - sampledDrillColor.r;
        }
        `),e.uniforms.drills={value:this.drillMap}}customProgramCacheKey(){return"mesh-plate-material"}}class $e extends Ht{constructor(){super(),v(this,"drillTexture"),v(this,"geometry"),v(this,"material"),this.type="Plate",this.castShadow=!0,this.receiveShadow=!0}async preload(){this.drillTexture=new Au(1400,1400),this.geometry=new Sy(2800),this.material=new Lu({color:16777215,drillMap:this.drillTexture,map:new ht,transparent:!1,metalness:0,roughness:1});const e=new Ie(this.geometry,this.material);return e.castShadow=!0,e.receiveShadow=!0,this.add(e),super.preload()}async setConfig(e){var t,i,r,n;await super.setConfig(e),(t=this.geometry)==null||t.setConfig(e.length,e.width,e.thickness),(r=(i=this.material)==null?void 0:i.map)==null||r.dispose(),this.material&&(e.procurement_board_id?(this.material.map=await Ft.getInstance().loadSurface(e.procurement_board_id),this.material.transparent=!0):(this.material.map=await Ft.getInstance().loadFallback(),this.material.transparent=!1),this.material.needsUpdate=!0,this.material.map.needsUpdate=!0),(n=this.drillTexture)==null||n.setDrills(e.length,e.width,e.drills)}dispose(){var e,t,i;(e=this.geometry)==null||e.dispose(),(t=this.material)==null||t.dispose(),(i=this.drillTexture)==null||i.dispose()}getCenter(){}getZoom(){}}class Sy extends lt{constructor(e){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"uvs",[]),v(this,"drillUvs",[]),v(this,"currentIndex",0),this.textureRealSize=e,this.type="PlateBufferGeometry";const t=6*2+12*2;this.setIndex(new Array(t));const i=4*2+8*2;this.setAttribute("position",new Fe(i*3,3)),this.setAttribute("normal",new Fe(i*3,3)),this.setAttribute("uv",new Fe(i*2,2)),this.setAttribute("drillUv",new Fe(i*2,2))}setConfig(e,t,i){this.indices=[],this.vertices=[],this.normals=[],this.uvs=[],this.drillUvs=[],this.currentIndex=0,this.generateCap(!0,e,t,i),this.generateCap(!1,e,t,i),this.generateTorso(!0,e,t,i),this.generateTorso(!1,e,t,i),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.getAttribute("uv").copyArray(this.uvs),this.getAttribute("drillUv").copyArray(this.drillUvs),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("uv").needsUpdate=!0,this.getAttribute("drillUv").needsUpdate=!0,this.index.needsUpdate=!0,this.computeBoundingBox(),this.computeBoundingSphere()}generateCap(e,t,i,r){const n=r/2,a=t/2,o=i/2,l=e===!0?1:-1,c=[];this.vertices.push(-a,n*l,-o),this.normals.push(0,l,0),this.uvs.push(.5-o/this.textureRealSize,.5-a/this.textureRealSize),this.drillUvs.push(0,1),c.push(this.currentIndex++),this.vertices.push(-a,n*l,o),this.normals.push(0,l,0),this.uvs.push(.5+o/this.textureRealSize,.5-a/this.textureRealSize),this.drillUvs.push(0,0),c.push(this.currentIndex++),this.vertices.push(a,n*l,o),this.normals.push(0,l,0),this.uvs.push(.5+o/this.textureRealSize,.5+a/this.textureRealSize),this.drillUvs.push(1,0),c.push(this.currentIndex++),this.vertices.push(a,n*l,-o),this.normals.push(0,l,0),this.uvs.push(.5-o/this.textureRealSize,.5+a/this.textureRealSize),this.drillUvs.push(1,1),c.push(this.currentIndex++);const h=c[0],u=c[1],d=c[2],p=c[3];e?(this.indices.push(h,u,d),this.indices.push(h,d,p)):(this.indices.push(h,d,u),this.indices.push(h,p,d))}generateTorso(e,t,i,r){let n=[],a,o,l,c;const h=e===!0?-1:1,u=r/2,d=t/2,p=i/2;this.vertices.push(-d,-u,h*p),this.normals.push(0,0,h),this.uvs.push(.5-u/this.textureRealSize,.5-d/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(-d,u,h*p),this.normals.push(0,0,h),this.uvs.push(.5+u/this.textureRealSize,.5-d/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(d,u,h*p),this.normals.push(0,0,h),this.uvs.push(.5+u/this.textureRealSize,.5+d/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(d,-u,h*p),this.normals.push(0,0,h),this.uvs.push(.5-u/this.textureRealSize,.5+d/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),a=n[0],o=n[1],l=n[2],c=n[3],e?(this.indices.push(a,o,l),this.indices.push(a,l,c)):(this.indices.push(a,l,o),this.indices.push(a,c,l)),n=[],this.vertices.push(h*d,u,-p),this.normals.push(h,0,0),this.uvs.push(.5+u/this.textureRealSize,.5-p/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(h*d,-u,-p),this.normals.push(h,0,0),this.uvs.push(.5-u/this.textureRealSize,.5-p/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(h*d,-u,p),this.normals.push(h,0,0),this.uvs.push(.5-u/this.textureRealSize,.5+p/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),this.vertices.push(h*d,u,p),this.normals.push(h,0,0),this.uvs.push(.5+u/this.textureRealSize,.5+p/this.textureRealSize),this.drillUvs.push(0,0),n.push(this.currentIndex++),a=n[0],o=n[1],l=n[2],c=n[3],e?(this.indices.push(a,o,l),this.indices.push(a,l,c)):(this.indices.push(a,l,o),this.indices.push(a,c,l))}}class Lt extends Xt{constructor(){super(...arguments),v(this,"__type","BoardConfig"),v(this,"length"),v(this,"width"),v(this,"thickness"),v(this,"drills",[]),v(this,"procurement_board_id")}validate(e,t){return Promise.resolve([])}}class Ru extends Lt{constructor(){super(...arguments),v(this,"__type","DecorativeBoardConfig")}validate(e,t){return Promise.resolve([])}}class fl extends Ht{constructor(){super(),v(this,"back"),v(this,"left"),v(this,"right"),v(this,"top"),v(this,"bottom"),v(this,"group"),v(this,"doorPlate"),v(this,"doorInnerGroup"),v(this,"door"),v(this,"shelves"),v(this,"models"),v(this,"footGroup"),v(this,"footLeftFront"),v(this,"footLeftBack"),v(this,"footRightFront"),v(this,"footRightBack"),v(this,"handle"),v(this,"handleNotice"),v(this,"backOffset",24),v(this,"thickness",19),v(this,"doorOpen",!1),this.type="Corpus",this.visible=!1}async preload(){const e=await Ft.getInstance().loadModel("corpus.glb");return e.scene.traverse(t=>{t instanceof Ie&&(t.castShadow=!0,t.receiveShadow=!1)}),this.models=e.scene,await this.createObject(),this.castShadow=!0,this.receiveShadow=!0,super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Ru;t.length=e.length-this.thickness*2,t.width=e.width,t.procurement_board_id=e.procurement_board_id,t.thickness=this.thickness,await this.top.setConfig(t),await this.bottom.setConfig(t),t.length=e.height-this.thickness*2,t.width=e.length-this.thickness*2,await this.back.setConfig(t),t.length=e.height,t.width=e.length,await this.doorPlate.setConfig(t),t.length=e.height,t.width=e.width,await this.left.setConfig(t),await this.right.setConfig(t),this.top.position.y=e.height/2-this.thickness/2,this.bottom.position.y=-e.height/2+this.thickness/2,this.left.position.x=-e.length/2+this.thickness/2,this.right.position.x=e.length/2-this.thickness/2,this.back.position.z=-e.width/2+this.backOffset;const i=e.door==Aa.Left?1:-1;this.handle.position.x=(e.length/2-e.length/10)*i,this.handleNotice.position.x=(e.length/2-e.length/10)*i,this.doorInnerGroup.position.x=(e.length/2-this.thickness/2)*i,this.door.position.set((e.length/2-this.thickness/2)*i*-1,0,e.width/2+this.thickness/2),this.footGroup.visible=e.feet>0,this.footGroup.position.y=-e.height/2,this.footLeftFront.position.x=this.footLeftBack.position.x=-e.length/2+80,this.footRightFront.position.x=this.footRightBack.position.x=e.length/2-80,this.footLeftFront.position.z=this.footRightFront.position.z=e.width/2-90,this.footLeftBack.position.z=this.footRightBack.position.z=-e.width/2+90,this.footGroup.traverse(r=>{r.name==="extension"&&(r.scale.y=(e.feet-25-35)/32),r.name==="bottom"&&(r.position.y=-e.feet)}),this.group.position.y=e.height/2+(e.feet??0),this.door.visible=e.door!=Aa.None,this.handle.visible=e.handle==ol.StainlessSteelHandle,this.handleNotice.visible=e.handle!=ol.StainlessSteelHandle,this.shelves.traverse(r=>{r instanceof $e&&r.dispose()}),this.shelves.clear();for(let r=1;r<=e.shelf_count;r++){const n=new $e;await n.preload();const a=new Ru;a.procurement_board_id=e.procurement_board_id,a.thickness=this.thickness,a.length=e.length-2*this.thickness,a.width=e.width-this.thickness-this.backOffset,await n.setConfig(a),n.position.z=this.backOffset/2,n.position.y=(e.height-2*this.thickness)/(e.shelf_count+1)*r-(e.height/2-this.thickness),this.shelves.add(n)}this.visible=!0}async createObject(){this.group=new Re,this.add(this.group),this.back=new $e,await this.back.preload(),this.back.rotation.set(-Math.PI*.5,Math.PI*.5,0),this.group.add(this.back),this.left=new $e,await this.left.preload(),this.left.rotation.set(0,0,Math.PI*.5),this.group.add(this.left),this.right=new $e,await this.right.preload(),this.right.rotation.set(0,0,Math.PI*.5),this.group.add(this.right),this.top=new $e,await this.top.preload(),this.group.add(this.top),this.bottom=new $e,await this.bottom.preload(),this.group.add(this.bottom),this.doorInnerGroup=new Re,this.doorPlate=new $e,await this.doorPlate.preload(),this.doorPlate.rotation.set(Math.PI*.5,Math.PI*.5,0),this.doorInnerGroup.add(this.doorPlate),this.handle=this.models.getObjectByName("handle").clone(),this.doorInnerGroup.add(this.handle);const e=40,t=new Ko({color:16777215,transparent:!0}),i=new My(e,64);this.handleNotice=new ba(i,t),this.handleNotice.position.z=this.thickness+1;const r={opacity:1};new bn(r).to({opacity:.1},500).onUpdate(()=>{this.handleNotice.material.opacity=r.opacity}).yoyo(!0).repeat(1/0).start();const n={scale:1};new bn(n).to({scale:.8},500).onUpdate(()=>{this.handleNotice.scale.x=n.scale,this.handleNotice.scale.y=n.scale,this.handleNotice.scale.z=n.scale}).yoyo(!0).repeat(1/0).start(),this.doorInnerGroup.add(this.handleNotice),this.door=new Re,this.door.add(this.doorInnerGroup),this.group.add(this.door),this.footGroup=new Re,this.footLeftFront=this.models.getObjectByName("foot").clone(),this.footGroup.add(this.footLeftFront),this.footRightFront=this.models.getObjectByName("foot").clone(),this.footGroup.add(this.footRightFront),this.footLeftBack=this.models.getObjectByName("foot").clone(),this.footLeftBack.rotation.y=Math.PI,this.footGroup.add(this.footLeftBack),this.footRightBack=this.models.getObjectByName("foot").clone(),this.footRightBack.rotation.y=Math.PI,this.footGroup.add(this.footRightBack),this.group.add(this.footGroup),this.shelves=new Re,this.group.add(this.shelves)}dispose(){var e,t,i,r,n,a;(e=this.top)==null||e.dispose(),(t=this.left)==null||t.dispose(),(i=this.right)==null||i.dispose(),(r=this.bottom)==null||r.dispose(),(n=this.doorPlate)==null||n.dispose(),(a=this.back)==null||a.dispose(),this.traverse(function(o){o instanceof Ie&&(o.geometry.dispose(),o.material&&o.material.dispose())})}isDoorOpen(){return this.doorOpen}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}toggleDoor(){var e;let t=Math.PI/2;this.doorOpen&&(t=0),((e=this.currentConfig)==null?void 0:e.door)==Aa.Left&&(t*=-1),new bn(this.door.rotation).easing(_n.Circular.Out).to({y:t},500).onComplete(()=>{this.doorOpen=!this.doorOpen}).start()}}class My extends lt{constructor(e,t){super(),this.type="CircleLineGeometry",t=Math.max(3,t);const i=[],r=new L;for(let n=0,a=3;n<=t;n++,a+=3){const o=n/t*Math.PI*2;r.x=e*Math.cos(o),r.y=e*Math.sin(o),i.push(r.x,r.y,r.z)}this.setAttribute("position",new Fe(i,3))}}class Ty extends ji{constructor(){super(),v(this,"corpus"),v(this,"currentConfig")}async preload(){return this.corpus=new fl,await this.corpus.preload(),this.group.add(this.corpus),super.preload()}async setConfig(e){this.currentConfig=e,e&&await this.corpus.setConfig(e)}getCenter(){var e;return(e=this.corpus)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.corpus)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.corpus)==null||e.dispose()}getPossibleInteraction(e){var t,i,r;if(this.corpus&&e.length>0&&this.corpus.door.visible&&((r=(i=(t=e[0].object)==null?void 0:t.parent)==null?void 0:i.parent)==null?void 0:r.parent)===this.corpus.door)return this.corpus.isDoorOpen()?"T\xFCr schlie\xDFen":"T\xFCr \xF6ffnen"}triggerInteraction(e,t){var i,r,n;t==="click"&&this.corpus&&this.corpus.door.visible&&e.length>0&&((n=(r=(i=e[0].object)==null?void 0:i.parent)==null?void 0:r.parent)==null?void 0:n.parent)===this.corpus.door&&this.corpus.toggleDoor()}}class $s extends Ht{}class Cy extends $s{constructor(){super(),v(this,"thickness",25),v(this,"frame_offset"),v(this,"top"),v(this,"left"),v(this,"right"),v(this,"traversePlate"),v(this,"group"),this.type="DeskClassic",this.visible=!1,this.frame_offset=parseInt(product_configurator_desk_three_options.frame_offset_classic),this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2,t.length=e.height-this.thickness,t.width=e.width,await this.left.setConfig(t),this.left.position.x=-e.length/2+this.thickness/2,this.left.position.y=e.height/2-this.thickness/2,await this.right.setConfig(t),this.right.position.x=e.length/2-this.thickness/2,this.right.position.y=e.height/2-this.thickness/2,t.length=e.length-2*this.thickness,t.width=e.height/2,await this.traversePlate.setConfig(t),this.traversePlate.position.y=e.height-e.height/4-this.thickness/2,this.traversePlate.position.z=-e.width/2+this.thickness/2+this.frame_offset,this.visible=!0}dispose(){this.top.dispose(),this.left.dispose(),this.right.dispose(),this.traversePlate.dispose()}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.left=new $e,await this.left.preload(),this.left.rotation.set(0,0,Math.PI*.5),this.group.add(this.left),this.right=new $e,await this.right.preload(),this.right.rotation.set(0,0,Math.PI*.5),this.group.add(this.right),this.traversePlate=new $e,await this.traversePlate.preload(),this.traversePlate.rotation.set(Math.PI*.5,0,0),this.group.add(this.traversePlate),this.add(this.group)}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class ml extends $s{constructor(){super(),v(this,"thickness",25),v(this,"corpus_width",450),v(this,"group"),v(this,"top"),v(this,"basePlate"),v(this,"corpus"),this.type="DeskIntegratedStore",this.visible=!1}async preload(){return await this.createObject(),this.castShadow=!0,this.receiveShadow=!0,super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new ll;i.procurement_board_id=e.procurement_board_id,i.length=this.corpus_width,i.width=e.width-this.thickness,i.height=e.height-2*this.thickness,i.shelf_count=1,await this.corpus.setConfig(i),this.corpus.position.y=this.thickness,this.corpus.position.z=-this.thickness/2,this.corpus.position.x=e.length/2-this.corpus_width/2;const r=new Lt;r.procurement_board_id=e.procurement_board_id,r.length=this.corpus_width-2*this.thickness,r.width=e.width-2*this.thickness,r.thickness=this.thickness,await this.basePlate.setConfig(r),this.basePlate.position.y=this.thickness/2,this.basePlate.position.x=e.length/2-this.corpus_width/2,this.visible=!0}dispose(){this.traverse(function(e){e instanceof Ie&&(e.geometry.dispose(),e.material&&e.material.dispose())})}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.corpus=new fl,await this.corpus.preload(),this.group.add(this.corpus),this.basePlate=new $e,await this.basePlate.preload(),this.group.add(this.basePlate),this.add(this.group)}toggleDoor(){var e;(e=this.corpus)==null||e.toggleDoor()}isDoorOpen(){var e;return(e=this.corpus)==null?void 0:e.isDoorOpen()}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class gl extends Xt{constructor(){super(...arguments),v(this,"__type","MetalSkidConfig"),v(this,"length"),v(this,"width"),v(this,"height"),v(this,"thickness")}async validate(e,t){return Promise.resolve([])}}class Ks extends Xt{constructor(e,t,i){super(),v(this,"__type","BoxConfig"),this.length=e,this.width=t,this.height=i}async validate(e,t){return Promise.resolve([])}}class wt extends Ht{constructor(){super(),v(this,"geometry"),v(this,"material"),this.type="Rod",this.geometry=new Ey,this.material=new Hi({color:4210752,metalness:1,roughness:.2});const e=new Ie(this.geometry,this.material);e.castShadow=!0,e.receiveShadow=!0,this.add(e)}dispose(){this.geometry.dispose(),this.material.dispose()}async setConfig(e){await super.setConfig(e);const t=new Ks;t.length=e.length,t.width=e.width,t.height=e.height,this.geometry.setConfig(t)}getCenter(){return 0}getZoom(){return 0}}class Ey extends lt{constructor(){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"currentIndex",0),this.type="BoxBufferGeometry";const e=4*6*6;this.setIndex(new Array(e));const t=4*6;this.setAttribute("position",new Fe(t*3,3)),this.setAttribute("normal",new Fe(t*3,3))}setConfig(e){this.indices=[],this.vertices=[],this.normals=[],this.currentIndex=0,this.generateFrame(e.length,e.width,e.height),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.index.needsUpdate=!0}generateFrame(e,t,i){const r=i/2,n=e/2,a=t/2;for(let o=-1;o<=1;o+=2){this.vertices.push(-n,r*o,-a),this.normals.push(0,o,0);const l=this.currentIndex++;this.vertices.push(n,r*o,-a),this.normals.push(0,o,0);const c=this.currentIndex++;this.vertices.push(-n,r*o,a),this.normals.push(0,o,0);const h=this.currentIndex++;this.vertices.push(n,r*o,a),this.normals.push(0,o,0);const u=this.currentIndex++;o==-1?(this.indices.push(l,c,h),this.indices.push(h,c,u)):(this.indices.push(l,h,c),this.indices.push(c,h,u))}for(let o=-1;o<=1;o+=2){this.vertices.push(-n,r,a*o),this.normals.push(0,0,o);const l=this.currentIndex++;this.vertices.push(n,r,a*o),this.normals.push(0,0,o);const c=this.currentIndex++;this.vertices.push(-n,-r,a*o),this.normals.push(0,0,o);const h=this.currentIndex++;this.vertices.push(n,-r,a*o),this.normals.push(0,0,o);const u=this.currentIndex++;o==-1?(this.indices.push(l,c,h),this.indices.push(h,c,u)):(this.indices.push(l,h,c),this.indices.push(c,h,u))}for(let o=-1;o<=1;o+=2){this.vertices.push(n*o,-r,-a),this.normals.push(o,0,0);const l=this.currentIndex++;this.vertices.push(n*o,-r,a),this.normals.push(o,0,0);const c=this.currentIndex++;this.vertices.push(n*o,r,-a),this.normals.push(o,0,0);const h=this.currentIndex++;this.vertices.push(n*o,r,a),this.normals.push(o,0,0);const u=this.currentIndex++;o==-1?(this.indices.push(l,c,h),this.indices.push(h,c,u)):(this.indices.push(l,h,c),this.indices.push(c,h,u))}}}class Cn extends Ht{constructor(){super(),v(this,"bottom"),v(this,"back"),v(this,"front"),v(this,"top"),this.type="MetalSkid",this.visible=!1}async preload(){return this.bottom=new wt,await this.bottom.preload(),this.back=new wt,await this.back.preload(),this.front=new wt,await this.front.preload(),this.top=new wt,await this.top.preload(),this.back.rotation.z=Math.PI/2,this.front.rotation.z=Math.PI/2,this.add(this.bottom,this.back,this.front,this.top),super.preload()}async setConfig(e){var t,i,r,n;await super.setConfig(e),this.visible=!1;const a=new Ks(e.height-2*e.thickness,e.width,e.thickness);await((t=this.back)==null?void 0:t.setConfig(a)),await((i=this.front)==null?void 0:i.setConfig(a));const o=new Ks(e.length,e.width,e.thickness);if(await((r=this.top)==null?void 0:r.setConfig(o)),await((n=this.bottom)==null?void 0:n.setConfig(o)),this.top&&this.bottom&&this.front&&this.back){const l=e.height/2-e.thickness/2;this.top.position.y=l,this.bottom.position.y=-l;const c=e.length/2-e.thickness/2;this.front.position.x=c,this.back.position.x=-c}this.visible=!0}dispose(){var e,t,i,r;(e=this.bottom)==null||e.dispose(),(t=this.back)==null||t.dispose(),(i=this.front)==null||i.dispose(),(r=this.top)==null||r.dispose()}getCenter(){}getZoom(){}}class vl extends $s{constructor(){super(),v(this,"thickness",25),v(this,"corpus_width",450),v(this,"basesThickness",8),v(this,"basesWidth",80),v(this,"basesPadding",0),v(this,"group"),v(this,"top"),v(this,"basePlate"),v(this,"skid"),v(this,"corpus"),this.type="DeskIntegratedStoreSkid",this.visible=!1}async preload(){return await this.createObject(),this.castShadow=!0,this.receiveShadow=!0,super.preload()}dispose(){this.traverse(function(e){e instanceof Ie&&(e.geometry.dispose(),e.material&&e.material.dispose())})}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new ll;i.procurement_board_id=e.procurement_board_id,i.length=this.corpus_width,i.width=e.width-this.thickness,i.height=e.height-2*this.thickness,i.shelf_count=1,await this.corpus.setConfig(i),this.corpus.position.y=this.thickness,this.corpus.position.z=-this.thickness/2,this.corpus.position.x=e.length/2-this.corpus_width/2;const r=new Lt;r.procurement_board_id=e.procurement_board_id,r.length=this.corpus_width-2*this.thickness,r.width=e.width-2*this.thickness,r.thickness=this.thickness,await this.basePlate.setConfig(r),this.basePlate.position.y=this.thickness/2,this.basePlate.position.x=e.length/2-this.corpus_width/2;const n=new gl;n.thickness=this.basesThickness,n.width=this.basesWidth,n.height=e.height-this.thickness,n.length=e.width,await this.skid.setConfig(n),this.skid.position.set(-e.length/2+this.basesWidth/2,e.height/2-this.thickness/2,0),this.visible=!0}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.corpus=new fl,await this.corpus.preload(),this.group.add(this.corpus),this.basePlate=new $e,await this.basePlate.preload(),this.group.add(this.basePlate),this.skid=new Cn,await this.skid.preload(),this.skid.rotation.y=Math.PI/2,this.group.add(this.skid),this.add(this.group)}toggleDoor(){var e;(e=this.corpus)==null||e.toggleDoor()}isDoorOpen(){var e;return(e=this.corpus)==null?void 0:e.isDoorOpen()}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class Ay extends $s{constructor(){super(),v(this,"thickness",25),v(this,"basesThickness",8),v(this,"basesWidth",80),v(this,"basesPadding",150),v(this,"group"),v(this,"top"),v(this,"left"),v(this,"right"),this.visible=!1,this.type="DeskMetalSkid",this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.length=e.length,t.width=e.width,t.thickness=this.thickness,t.procurement_board_id=e.procurement_board_id,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new gl;i.length=e.width-this.basesPadding*2,i.width=this.basesWidth,i.height=e.height-this.thickness,i.thickness=this.basesThickness,await this.left.setConfig(i),await this.right.setConfig(i),this.left.position.set(-e.length/2+this.basesPadding,e.height/2-this.thickness/2,0),this.right.position.set(e.length/2-this.basesPadding,e.height/2-this.thickness/2,0),this.visible=!0}dispose(){this.left.dispose(),this.right.dispose(),this.top.dispose(),this.traverse(function(e){e instanceof Ie&&(e.geometry.dispose(),e.material&&e.material.dispose())})}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.left=new Cn,await this.left.preload(),this.right=new Cn,await this.right.preload(),this.group.add(this.left),this.group.add(this.right),this.left.rotation.y=Math.PI/2,this.right.rotation.y=Math.PI/2,this.add(this.group)}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class Ly extends $s{constructor(){super(),v(this,"thickness",25),v(this,"frame_thickness",19),v(this,"frame_offset_side"),v(this,"frame_offset_front"),v(this,"top"),v(this,"left"),v(this,"right"),v(this,"traversePlate"),v(this,"group"),this.type="DeskModern",this.visible=!1,this.frame_offset_side=parseInt(product_configurator_desk_three_options.frame_offset_side_modern),this.frame_offset_front=parseInt(product_configurator_desk_three_options.frame_offset_front_modern),this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2,t.procurement_board_id=e.secondary_procurement_board_id,t.length=e.height-this.thickness,t.width=e.width-2*this.frame_offset_front,await this.left.setConfig(t),this.left.position.x=-e.length/2+this.frame_thickness/2+this.frame_offset_side,this.left.position.y=e.height/2-this.thickness/2,await this.right.setConfig(t),this.right.position.x=e.length/2-this.frame_thickness/2-this.frame_offset_side,this.right.position.y=e.height/2-this.thickness/2,t.length=e.length-2*this.frame_thickness-2*this.frame_offset_side,t.width=e.height/2,await this.traversePlate.setConfig(t),this.traversePlate.position.y=e.height-e.height/4-this.thickness,this.traversePlate.position.z=-e.width/2+this.frame_thickness/2+this.frame_offset_front,this.visible=!0}dispose(){this.top.dispose(),this.left.dispose(),this.right.dispose(),this.traversePlate.dispose()}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.left=new $e,await this.left.preload(),this.left.rotation.set(0,0,Math.PI*.5),this.group.add(this.left),this.right=new $e,await this.right.preload(),this.right.rotation.set(0,0,Math.PI*.5),this.group.add(this.right),this.traversePlate=new $e,await this.traversePlate.preload(),this.traversePlate.rotation.set(Math.PI*.5,0,0),this.group.add(this.traversePlate),this.add(this.group)}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class Ry extends $s{constructor(){super(),v(this,"thickness",25),v(this,"group"),v(this,"legs"),v(this,"plate"),v(this,"frontLeftLeg"),v(this,"frontRightLeg"),v(this,"backLeftLeg"),v(this,"backRightLeg"),v(this,"legModel"),this.type="DeskSimple",this.visible=!1,this.castShadow=!0,this.receiveShadow=!0}async preload(){const e=await Ft.getInstance().loadModel("desk_tableleg.gltf");return e.scene.traverse(t=>{t instanceof Ie&&(t.castShadow=!0,t.receiveShadow=!1)}),this.legModel=e.scene,await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1,this.currentConfig=await e.getValidatedConfig();const t=this.getLegSize(),i=new Lt;i.length=e.length,i.width=e.width,i.thickness=this.thickness,i.procurement_board_id=e.procurement_board_id,await this.plate.setConfig(i);const r=e.width/2-t.z,n=e.length/2-t.x;this.frontLeftLeg.position.set(-n,0,r),this.frontRightLeg.position.set(n,0,r),this.backLeftLeg.position.set(-n,0,-r),this.backRightLeg.position.set(n,0,-r),e.color==="white"?this.legModel.getObjectByName("leg").material.color=new be(16777215):this.legModel.getObjectByName("leg").material.color=new be(14606046),this.visible=!0}dispose(){var e;(e=this.plate)==null||e.dispose()}getLegSize(){return new bi().setFromObject(this.legModel).getSize(new L)}async createObject(){this.group=new Re,this.plate=new $e,await this.plate.preload(),this.plate.position.y=this.getLegSize().y+this.thickness/2,this.group.add(this.plate),this.createLegs(),this.group.add(this.legs),this.add(this.group)}createLegs(){this.legs=new Re,this.frontLeftLeg=this.legModel.clone(),this.legs.add(this.frontLeftLeg),this.backLeftLeg=this.legModel.clone(),this.legs.add(this.backLeftLeg),this.frontRightLeg=this.legModel.clone(),this.legs.add(this.frontRightLeg),this.backRightLeg=this.legModel.clone(),this.legs.add(this.backRightLeg)}getCenter(){return this.getLegSize().y/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class Pu extends Ks{constructor(){super(...arguments),v(this,"__type","MetalFrameConfig"),v(this,"thickness"),v(this,"withMiddle"),v(this,"withFront"),v(this,"withBack")}async validate(e,t){return Promise.resolve([])}}class Du extends Ht{constructor(){super(),v(this,"legBackLeft"),v(this,"legBackRight"),v(this,"legFrontLeft"),v(this,"legFrontRight"),v(this,"topLeft"),v(this,"topBack"),v(this,"topRight"),v(this,"topFront"),v(this,"bottomLeft"),v(this,"bottomBack"),v(this,"bottomRight"),v(this,"bottomFront"),v(this,"bottomMiddle"),this.type="MetalFrame",this.visible=!1}async preload(){return this.legBackLeft=new wt,this.legBackLeft.preload(),this.legBackRight=new wt,this.legBackRight.preload(),this.legFrontLeft=new wt,await this.legFrontLeft.preload(),this.legFrontRight=new wt,await this.legFrontRight.preload(),this.topLeft=new wt,await this.topLeft.preload(),this.topBack=new wt,await this.topBack.preload(),this.topRight=new wt,await this.topRight.preload(),this.topFront=new wt,await this.topFront.preload(),this.bottomLeft=new wt,await this.bottomLeft.preload(),this.bottomBack=new wt,await this.bottomBack.preload(),this.bottomRight=new wt,await this.bottomRight.preload(),this.bottomFront=new wt,await this.bottomFront.preload(),this.bottomMiddle=new wt,await this.bottomMiddle.preload(),this.legBackLeft.rotation.z=Math.PI/2,this.legBackRight.rotation.z=Math.PI/2,this.legFrontLeft.rotation.z=Math.PI/2,this.legFrontRight.rotation.z=Math.PI/2,this.topLeft.rotation.y=Math.PI/2,this.topRight.rotation.y=Math.PI/2,this.bottomLeft.rotation.y=Math.PI/2,this.bottomRight.rotation.y=Math.PI/2,this.add(this.legBackLeft,this.legBackRight,this.legFrontLeft,this.legFrontRight,this.topLeft,this.topBack,this.topRight,this.topFront,this.bottomLeft,this.bottomRight,this.bottomFront,this.bottomBack,this.bottomMiddle),super.preload()}async setConfig(e){var t,i,r,n,a,o,l,c,h,u,d,p,g;await super.setConfig(e),this.visible=!1;const m=new Ks(e.height-2*e.thickness,e.thickness,e.thickness);await((t=this.legBackLeft)==null?void 0:t.setConfig(m)),await((i=this.legBackRight)==null?void 0:i.setConfig(m)),await((r=this.legFrontLeft)==null?void 0:r.setConfig(m)),await((n=this.legFrontRight)==null?void 0:n.setConfig(m));const f=new Ks(e.width,e.thickness,e.thickness);await((a=this.topLeft)==null?void 0:a.setConfig(f)),await((o=this.topRight)==null?void 0:o.setConfig(f)),await((l=this.bottomLeft)==null?void 0:l.setConfig(f)),await((c=this.bottomRight)==null?void 0:c.setConfig(f));const _=new Ks(e.length-2*e.thickness,e.thickness,e.thickness);if(await((h=this.topBack)==null?void 0:h.setConfig(_)),await((u=this.topFront)==null?void 0:u.setConfig(_)),await((d=this.bottomBack)==null?void 0:d.setConfig(_)),await((p=this.bottomFront)==null?void 0:p.setConfig(_)),await((g=this.bottomMiddle)==null?void 0:g.setConfig(_)),this.topBack&&this.topLeft&&this.topRight&&this.topFront&&this.bottomBack&&this.bottomLeft&&this.bottomRight&&this.bottomFront&&this.bottomMiddle&&this.legBackLeft&&this.legBackRight&&this.legFrontLeft&&this.legFrontRight){const y=(e.height-e.thickness)/2;this.topBack.position.y=y,this.topLeft.position.y=y,this.topRight.position.y=y,this.topFront.position.y=y;const A=-y;this.bottomBack.position.y=A,this.bottomLeft.position.y=A,this.bottomRight.position.y=A,this.bottomFront.position.y=A,this.bottomMiddle.position.y=A;const b=(e.width-e.thickness)/2;this.topFront.position.z=b,this.bottomFront.position.z=b,this.topBack.position.z=-b,this.bottomBack.position.z=-b;const S=(e.length-e.thickness)/2;this.topRight.position.x=S,this.bottomRight.position.x=S,this.topLeft.position.x=-S,this.bottomLeft.position.x=-S,this.legBackLeft.position.set(-S,0,-b),this.legBackRight.position.set(S,0,-b),this.legFrontLeft.position.set(-S,0,b),this.legFrontRight.position.set(S,0,b),this.bottomMiddle.visible=e.withMiddle,this.bottomFront.visible=e.withFront,this.bottomBack.visible=e.withBack}this.visible=!0}dispose(){var e,t,i,r,n,a,o,l,c,h,u,d,p;(e=this.legBackLeft)==null||e.dispose(),(t=this.legBackRight)==null||t.dispose(),(i=this.legFrontLeft)==null||i.dispose(),(r=this.legFrontRight)==null||r.dispose(),(n=this.topLeft)==null||n.dispose(),(a=this.topBack)==null||a.dispose(),(o=this.topRight)==null||o.dispose(),(l=this.topFront)==null||l.dispose(),(c=this.bottomLeft)==null||c.dispose(),(h=this.bottomBack)==null||h.dispose(),(u=this.bottomRight)==null||u.dispose(),(d=this.bottomFront)==null||d.dispose(),(p=this.bottomMiddle)==null||p.dispose()}getCenter(){}getZoom(){}}class Py extends $s{constructor(){super(),v(this,"thickness",25),v(this,"basesThickness",18),v(this,"top"),v(this,"frame"),v(this,"group"),this.visible=!1,this.type="DeskThinMetal",this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new Pu;i.length=e.length,i.width=e.width,i.height=e.height-this.thickness,i.thickness=this.basesThickness,i.withFront=!1,i.withMiddle=!1,i.withBack=!0,await this.frame.setConfig(i),this.frame.position.y=(e.height-this.thickness)/2,this.visible=!0}dispose(){this.top.dispose(),this.frame.dispose()}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.frame=new Du,await this.frame.preload(),this.group.add(this.frame),this.add(this.group)}getCenter(){var e;return(((e=this.currentConfig)==null?void 0:e.height)??0)/2}getZoom(){var e;return(e=this.currentConfig)==null?void 0:e.width}}class Dy extends ji{constructor(){super(),v(this,"desk"),v(this,"currentConfig")}async preload(){switch(product_configurator_desk_three_options.model){case"simple":this.desk=new Ry,await this.desk.preload();break;case"thin_metal":this.desk=new Py,await this.desk.preload();break;case"metal_skid":this.desk=new Ay,await this.desk.preload();break;case"classic":this.desk=new Cy,await this.desk.preload();break;case"modern":this.desk=new Ly,await this.desk.preload();break;case"integrated_store":this.desk=new ml,await this.desk.preload();break;case"integrated_store_skid":this.desk=new vl,await this.desk.preload();break;default:throw new Error("model not defined")}return this.group.add(this.desk),super.preload()}async setConfig(e){this.currentConfig=e,e&&await this.desk.setConfig(e)}getCenter(){var e;return(e=this.desk)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.desk)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.desk)==null||e.dispose()}getPossibleInteraction(e){var t,i,r;if((this.desk instanceof ml||this.desk instanceof vl)&&e.length>0&&((i=(t=e[0].object.parent)==null?void 0:t.parent)==null?void 0:i.parent)===((r=this.desk.corpus)==null?void 0:r.door))return this.desk.isDoorOpen()?"T\xFCr schlie\xDFen":"T\xFCr \xF6ffnen"}triggerInteraction(e,t){var i,r,n;(this.desk instanceof ml||this.desk instanceof vl)&&t==="click"&&e.length>0&&((r=(i=e[0].object.parent)==null?void 0:i.parent)==null?void 0:r.parent)===((n=this.desk.corpus)==null?void 0:n.door)&&this.desk.toggleDoor()}}class Iu extends Ht{}class Iy extends Iu{constructor(){super(),v(this,"thickness",25),v(this,"basesThickness",8),v(this,"basesWidth",80),v(this,"basesPadding",150),v(this,"group"),v(this,"top"),v(this,"left"),v(this,"right"),this.visible=!1,this.type="TableMetalSkid",this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.length=e.length,t.width=e.width,t.thickness=this.thickness,t.procurement_board_id=e.procurement_board_id,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new gl;i.length=e.width-this.basesPadding*2,i.width=this.basesWidth,i.height=e.height-this.thickness,i.thickness=this.basesThickness,await this.left.setConfig(i),await this.right.setConfig(i),this.left.position.set(-e.length/2+this.basesPadding,e.height/2-this.thickness/2,0),this.right.position.set(e.length/2-this.basesPadding,e.height/2-this.thickness/2,0),this.visible=!0}dispose(){this.left.dispose(),this.right.dispose(),this.top.dispose()}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.left=new Cn,await this.left.preload(),this.right=new Cn,await this.right.preload(),this.group.add(this.left),this.group.add(this.right),this.left.rotation.y=Math.PI/2,this.right.rotation.y=Math.PI/2,this.add(this.group)}getCenter(){}getZoom(){}}class ky extends Iu{constructor(){super(),v(this,"thickness",25),v(this,"basesThickness",18),v(this,"top"),v(this,"frame"),v(this,"group"),this.type="TableThinMetal",this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}async setConfig(e){await super.setConfig(e),this.visible=!1;const t=new Lt;t.procurement_board_id=e.procurement_board_id,t.length=e.length,t.width=e.width,t.thickness=this.thickness,await this.top.setConfig(t),this.top.position.y=e.height-this.thickness/2;const i=new Pu;i.length=e.length,i.width=e.width,i.height=e.height-this.thickness,i.thickness=this.basesThickness,i.withFront=!1,i.withMiddle=!0,i.withBack=!1,await this.frame.setConfig(i),this.frame.position.y=(e.height-this.thickness)/2,this.visible=!0}dispose(){var e;(e=this.top)==null||e.dispose()}async createObject(){this.group=new Re,this.top=new $e,await this.top.preload(),this.group.add(this.top),this.frame=new Du,this.frame.preload(),this.group.add(this.frame),this.add(this.group)}getCenter(){}getZoom(){}}class Oy extends ji{constructor(){super(),v(this,"models"),v(this,"currentConfig"),v(this,"table")}async preload(){switch(product_configurator_table_three_options.model){case"thin_metal":this.table=new ky,await this.table.preload();break;case"metal_skid":this.table=new Iy,await this.table.preload();break;default:throw new Error("model not defined")}return this.group.add(this.table),super.preload()}async setConfig(e){this.currentConfig=e,e&&this.table.setConfig(e)}getCenter(){var e;return(e=this.table)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.table)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.table)==null||e.dispose()}}class La extends Xt{constructor(){super(...arguments),v(this,"__type","SpecialShapeConfig"),v(this,"shape"),v(this,"length"),v(this,"width"),v(this,"length_2"),v(this,"width_2"),v(this,"radius"),v(this,"diameter"),v(this,"corner"),v(this,"thickness"),v(this,"side"),v(this,"drills",[]),v(this,"procurement_board_id")}validate(e,t){return Promise.resolve([])}async getValidatedConfig(){return this}}var Qt=(s=>(s.A="A",s.B="B",s.C="C",s.D="D",s.E="E",s.G="G",s.H="H",s.I="I",s.J="J",s))(Qt||{}),ke=(s=>(s.Left="left",s.Right="right",s.Top="top",s.Bottom="bottom",s))(ke||{});class ku extends Ht{constructor(){super(),v(this,"material"),v(this,"geometry"),v(this,"mesh"),this.type="RoundPlate",this.geometry=new Ny(2800),this.material=new Hi({color:16777215,map:new ht,metalness:0,roughness:1,wireframe:!1}),this.mesh=new Ie(this.geometry,this.material),this.add(this.mesh),this.castShadow=!0,this.receiveShadow=!0}getCenter(){}getZoom(){return 500}dispose(){this.geometry.dispose(),this.material.dispose()}async setConfig(e){await super.setConfig(e),this.geometry.setConfig(e.diameter/2,e.thickness,0,Math.PI*(e.shape===Qt.A?2:1));const t=this.material.map;e.procurement_board_id?(this.material.map=await Ft.getInstance().loadSurface(e.procurement_board_id),this.material.transparent=!0):(this.material.map=await Ft.getInstance().loadFallback(),this.material.transparent=!1),this.material.needsUpdate=!0,this.material.map.needsUpdate=!0,t?.dispose()}}class Ny extends lt{constructor(e){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"uvs",[]),v(this,"currentIndex",0),v(this,"radialPiSegments",32),this.textureRealSize=e,this.type="CylinderBufferGeometry";const t=this.radialPiSegments*2,i=t*3*2+t*6*2;this.setIndex(new Array(i));const r=(t+1)*2+(t*2+1)*2;this.setAttribute("position",new Fe(r*3,3)),this.setAttribute("normal",new Fe(r*3,3)),this.setAttribute("uv",new Fe(r*2,2)),this.setAttribute("drillUv",new Fe(r*3,2))}setConfig(e,t,i,r){this.indices=[],this.vertices=[],this.normals=[],this.uvs=[],this.currentIndex=0,this.generateCap(!0,e,t,i,r),this.generateCap(!1,e,t,i,r),this.generateTorso(e,t,i,r),(i>0||r<Math.PI*2)&&this.generateTorsoBack(e,t),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.getAttribute("uv").copyArray(this.uvs),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("uv").needsUpdate=!0,this.index.needsUpdate=!0,this.setDrawRange(0,this.indices.length)}generateTorso(e,t,i,r){const n=t/2,a=new L,o=new L,l=[],c=Math.round((r-i)/Math.PI)*this.radialPiSegments;for(let h=0;h<=1;h++){const u=[],d=h==0?1:-1;for(let p=0;p<=c;p++){const g=p/c,m=g*r+i,f=Math.sin(m),_=Math.cos(m);o.x=e*f,o.y=d*n,o.z=e*_,this.vertices.push(o.x,o.y,o.z),a.set(f,0,_).normalize(),this.normals.push(a.x,a.y,a.z),this.uvs.push(.5+d*n/this.textureRealSize,g*e*Math.PI*2/this.textureRealSize),u.push(this.currentIndex++)}l.push(u)}for(let h=0;h<c;h++)for(let u=0;u<1;u++){const d=l[u][h],p=l[u+1][h],g=l[u+1][h+1],m=l[u][h+1];this.indices.push(d,p,m),this.indices.push(p,g,m)}}generateTorsoBack(e,t){const i=new L,r=new L,n=t/2,a=[];for(let u=0;u<=1;u++){const d=[],p=u==0?1:-1;r.x=0,r.y=p*n,r.z=e,this.vertices.push(r.x,r.y,r.z),i.set(0,0,1).normalize(),this.normals.push(i.x,i.y,i.z),this.uvs.push(p*n/this.textureRealSize+.5,.5-e/this.textureRealSize),d.push(this.currentIndex++),r.x=0,r.y=p*n,r.z=-e,this.vertices.push(r.x,r.y,r.z),i.set(0,0,1).normalize(),this.normals.push(i.x,i.y,i.z),this.uvs.push(p*n/this.textureRealSize+.5,.5+e/this.textureRealSize),d.push(this.currentIndex++),a.push(d)}const o=a[0][0],l=a[1][0],c=a[1][1],h=a[0][1];this.indices.push(h,l,o),this.indices.push(h,c,l)}generateCap(e,t,i,r,n){const a=i/2,o=new we,l=new L,c=e===!0?1:-1,h=t*2/this.textureRealSize,u=Math.round((n-r)/Math.PI)*this.radialPiSegments,d=this.currentIndex;for(let g=1;g<=u;g++)this.vertices.push(0,a*c,0),this.normals.push(0,c,0),this.uvs.push(.5,.5),this.currentIndex++;const p=this.currentIndex;for(let g=0;g<=u;g++){const m=g/u*n+r,f=Math.cos(m),_=Math.sin(m);l.x=t*_,l.y=a*c,l.z=t*f,this.vertices.push(l.x,l.y,l.z),this.normals.push(0,c,0),o.x=f*.5*h+.5,o.y=_*.5*c*h+.5,this.uvs.push(o.y,o.x),this.currentIndex++}for(let g=0;g<u;g++){const m=d+g,f=p+g;e===!0?this.indices.push(f,f+1,m):this.indices.push(f+1,f,m)}}}class qi extends Ht{}class zy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeA",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new ku,await this.plate.preload(),this.add(this.plate),super.preload()}dispose(){var e;(e=this.plate)==null||e.dispose()}async setConfig(e){var t;await super.setConfig(e),await((t=this.plate)==null?void 0:t.setConfig(this.currentConfig))}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class By extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeB",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new ku,await this.plate.preload(),this.add(this.plate),super.preload()}dispose(){var e;(e=this.plate)==null||e.dispose()}async setConfig(e){var t;await super.setConfig(e),await((t=this.plate)==null?void 0:t.setConfig(this.currentConfig))}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class _l extends Xt{constructor(){super(...arguments),v(this,"__type","RoundedEdgesPlateConfig"),v(this,"length"),v(this,"width"),v(this,"thickness"),v(this,"radiusA"),v(this,"radiusB"),v(this,"radiusC"),v(this,"radiusD"),v(this,"procurement_board_id")}validate(e,t){return Promise.resolve([])}async getValidatedConfig(){return this}}class yl extends Ht{constructor(){super(),v(this,"material"),v(this,"geometry"),v(this,"mesh"),this.type="RoundedEdgesPlate",this.castShadow=!0,this.receiveShadow=!0}async preload(){return this.geometry=new Uy(2800),this.material=new Hi({color:16777215,map:new ht,metalness:0,roughness:1}),this.mesh=new Ie(this.geometry,this.material),this.add(this.mesh),super.preload()}getCenter(){}getZoom(){return 500}dispose(){var e,t;(e=this.geometry)==null||e.dispose(),(t=this.material)==null||t.dispose()}async setConfig(e){var t,i;await super.setConfig(e),(t=this.geometry)==null||t.setConfig(e.length,e.width,e.thickness,e.radiusA,e.radiusB,e.radiusC,e.radiusD);const r=(i=this.material)==null?void 0:i.map;this.material&&(e.procurement_board_id?(this.material.map=await Ft.getInstance().loadSurface(e.procurement_board_id),this.material.transparent=!0):(this.material.map=await Ft.getInstance().loadFallback(),this.material.transparent=!1),this.material.needsUpdate=!0,this.material.map.needsUpdate=!0),r?.dispose()}}class Uy extends lt{constructor(e){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"uvs",[]),v(this,"currentIndex",0),v(this,"radialSegments",16),this.textureRealSize=e,this.type="RoundedEdgesBoxBufferGeometry";const t=2*(6+2*(this.radialSegments+1)*6)+2*6+2*(6+8*3+4*(3*(1+this.radialSegments)));this.setIndex(new Array(t));const i=2*(4+(this.radialSegments+1)*2*2)+2*4+2*(12+4*(this.radialSegments+1+1));this.setAttribute("position",new Fe(i*3,3)),this.setAttribute("normal",new Fe(i*3,3)),this.setAttribute("uv",new Fe(i*2,2)),this.setAttribute("drillUv",new Fe(i*3,2))}setConfig(e,t,i,r,n,a,o){this.indices=[],this.vertices=[],this.normals=[],this.uvs=[],this.currentIndex=0,this.generateLengthTorso(!0,e,t,i,r,n,a,o),this.generateLengthTorso(!1,e,t,i,r,n,a,o),this.generateWidthTorso(!0,e,t,i,r,n,a,o),this.generateWidthTorso(!1,e,t,i,r,n,a,o),this.generateCap(!0,e,t,i,r,n,a,o),this.generateCap(!1,e,t,i,r,n,a,o),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.getAttribute("uv").copyArray(this.uvs),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("uv").needsUpdate=!0,this.index.needsUpdate=!0,this.setDrawRange(0,this.indices.length)}generateLengthTorso(e,t,i,r,n,a,o,l){const c=e===!0?-1:1,h=r/2,u=t/2,d=i/2,p={},g=e?n:o,m=e?a:l;this.vertices.push(-u+g,h,d*c),this.normals.push(0,0,c),this.uvs.push(.5+h/this.textureRealSize,.5-(u-g)/this.textureRealSize),p.top_left=this.currentIndex++,this.vertices.push(-u+g,-h,d*c),this.normals.push(0,0,c),this.uvs.push(.5-h/this.textureRealSize,.5-(u-g)/this.textureRealSize),p.bottom_left=this.currentIndex++,this.vertices.push(u-m,h,d*c),this.normals.push(0,0,c),this.uvs.push(.5+h/this.textureRealSize,.5+(u-m)/this.textureRealSize),p.top_right=this.currentIndex++,this.vertices.push(u-m,-h,d*c),this.normals.push(0,0,c),this.uvs.push(.5-h/this.textureRealSize,.5+(u-m)/this.textureRealSize),p.bottom_right=this.currentIndex++,e?(this.indices.push(p.top_left,p.top_right,p.bottom_left),this.indices.push(p.bottom_left,p.top_right,p.bottom_right)):(this.indices.push(p.top_left,p.bottom_left,p.top_right),this.indices.push(p.bottom_left,p.bottom_right,p.top_right));const f=new L;for(let _=0;_<=1;_++){const y=_==0?g:m;if(y<=0)continue;const A=_==0?-1:1,b={};b.top=[],b.bottom=[];for(let S=0;S<=this.radialSegments;S++){const D=S/this.radialSegments,O=D*Math.PI/2+0,M=Math.sin(O),R=Math.cos(O);this.vertices.push(A*(u-y+y*M),h,c*(d-y+y*R)),f.set(A*M,0,c*R).normalize(),this.normals.push(f.x,f.y,f.z),this.uvs.push(.5+h/this.textureRealSize,.5+A*((u-y)/this.textureRealSize+D*y*Math.PI/2/this.textureRealSize)),b.top.push(this.currentIndex++),this.vertices.push(A*(u-y+y*M),-h,c*(d-y+y*R)),f.set(A*M,0,c*R).normalize(),this.normals.push(f.x,f.y,f.z),this.uvs.push(.5-h/this.textureRealSize,.5+A*((u-y)/this.textureRealSize+D*y*Math.PI/2/this.textureRealSize)),b.bottom.push(this.currentIndex++)}for(let S=0;S<=this.radialSegments-1;S++){let D=0,O=1;(e&&_!=0||!e&&_==0)&&(D=1,O=0),this.indices.push(b.bottom[S+D],b.top[S+O],b.top[S+D]),this.indices.push(b.bottom[S+D],b.bottom[S+O],b.top[S+O])}}}generateWidthTorso(e,t,i,r,n,a,o,l){const c=e===!0?-1:1,h=r/2,u=t/2,d=i/2,p={},g=e?n:a,m=e?o:l;this.vertices.push(c*u,h,-d+g),this.normals.push(c,0,0),this.uvs.push(.5+h/this.textureRealSize,.5-(d-g)/this.textureRealSize),p.top_left=this.currentIndex++,this.vertices.push(c*u,-h,-d+g),this.normals.push(c,0,0),this.uvs.push(.5-h/this.textureRealSize,.5-(d-g)/this.textureRealSize),p.bottom_left=this.currentIndex++,this.vertices.push(c*u,h,d-m),this.normals.push(c,0,0),this.uvs.push(.5+h/this.textureRealSize,.5+(d-m)/this.textureRealSize),p.top_right=this.currentIndex++,this.vertices.push(c*u,-h,d-m),this.normals.push(c,0,0),this.uvs.push(.5-h/this.textureRealSize,.5+(d-m)/this.textureRealSize),p.bottom_right=this.currentIndex++,e?(this.indices.push(p.top_left,p.bottom_left,p.top_right),this.indices.push(p.bottom_left,p.bottom_right,p.top_right)):(this.indices.push(p.top_left,p.top_right,p.bottom_left),this.indices.push(p.bottom_left,p.top_right,p.bottom_right))}generateCap(e,t,i,r,n,a,o,l){const c=e===!0?1:-1,h=r/2,u=t/2,d=i/2,p={},g={};g.top={},g.right={},g.bottom={},g.left={},this.vertices.push(-u+n,h*c,-d+n),this.normals.push(0,c,0),this.uvs.push(.5+(d-n)/this.textureRealSize,.5-(u-n)/this.textureRealSize),p.top_left=this.currentIndex++,this.vertices.push(u-a,h*c,-d+a),this.normals.push(0,c,0),this.uvs.push(.5+(d-a)/this.textureRealSize,.5+(u-a)/this.textureRealSize),p.top_right=this.currentIndex++,this.vertices.push(-u+o,h*c,d-o),this.normals.push(0,c,0),this.uvs.push(.5-(d-o)/this.textureRealSize,.5-(u-o)/this.textureRealSize),p.bottom_left=this.currentIndex++,this.vertices.push(u-l,h*c,d-l),this.normals.push(0,c,0),this.uvs.push(.5-(d-l)/this.textureRealSize,.5+(u-l)/this.textureRealSize),p.bottom_right=this.currentIndex++,e===!0?(this.indices.push(p.top_left,p.bottom_left,p.top_right),this.indices.push(p.bottom_left,p.bottom_right,p.top_right)):(this.indices.push(p.top_left,p.top_right,p.bottom_left),this.indices.push(p.bottom_left,p.top_right,p.bottom_right)),this.vertices.push(-u,h*c,-d+n),this.normals.push(0,c,0),this.uvs.push(.5+(d-n)/this.textureRealSize,.5-u/this.textureRealSize),g.left.top=this.currentIndex++,e===!0?this.indices.push(p.top_left,g.left.top,p.bottom_left):this.indices.push(p.top_left,p.bottom_left,g.left.top),this.vertices.push(-u,h*c,d-o),this.normals.push(0,c,0),this.uvs.push(.5-(d-o)/this.textureRealSize,.5-u/this.textureRealSize),g.left.bottom=this.currentIndex++,e===!0?this.indices.push(g.left.top,g.left.bottom,p.bottom_left):this.indices.push(g.left.top,p.bottom_left,g.left.bottom),this.vertices.push(-u+n,h*c,-d),this.normals.push(0,c,0),this.uvs.push(.5+d/this.textureRealSize,.5-(u-n)/this.textureRealSize),g.top.left=this.currentIndex++,e===!0?this.indices.push(p.top_left,p.top_right,g.top.left):this.indices.push(p.top_left,g.top.left,p.top_right),this.vertices.push(u-a,h*c,-d),this.normals.push(0,c,0),this.uvs.push(.5+d/this.textureRealSize,.5+(u-a)/this.textureRealSize),g.top.right=this.currentIndex++,e===!0?this.indices.push(g.top.left,p.top_right,g.top.right):this.indices.push(g.top.left,g.top.right,p.top_right),this.vertices.push(u,h*c,-d+a),this.normals.push(0,c,0),this.uvs.push(.5+(d-a)/this.textureRealSize,.5+u/this.textureRealSize),g.right.top=this.currentIndex++,e===!0?this.indices.push(p.bottom_right,g.right.top,p.top_right):this.indices.push(p.bottom_right,p.top_right,g.right.top),this.vertices.push(u,h*c,d-l),this.normals.push(0,c,0),this.uvs.push(.5-(d-l)/this.textureRealSize,.5+u/this.textureRealSize),g.right.bottom=this.currentIndex++,e===!0?this.indices.push(p.bottom_right,g.right.bottom,g.right.top):this.indices.push(p.bottom_right,g.right.top,g.right.bottom),this.vertices.push(-u+o,h*c,d),this.normals.push(0,c,0),this.uvs.push(.5-d/this.textureRealSize,.5-(u-o)/this.textureRealSize),g.bottom.left=this.currentIndex++,e===!0?this.indices.push(p.bottom_left,g.bottom.left,p.bottom_right):this.indices.push(p.bottom_left,p.bottom_right,g.bottom.left),this.vertices.push(u-l,h*c,d),this.normals.push(0,c,0),this.uvs.push(.5-d/this.textureRealSize,.5+(u-l)/this.textureRealSize),g.bottom.right=this.currentIndex++,e===!0?this.indices.push(g.bottom.left,g.bottom.right,p.bottom_right):this.indices.push(g.bottom.left,p.bottom_right,g.bottom.right),n>0&&this.generateRoundCap(e,t,i,r,n,!0,!0),a>0&&this.generateRoundCap(e,t,i,r,a,!0,!1),o>0&&this.generateRoundCap(e,t,i,r,o,!1,!0),l>0&&this.generateRoundCap(e,t,i,r,l,!1,!1)}generateRoundCap(e,t,i,r,n,a,o){const l=[],c=e?1:-1,h=o?-1:1,u=a?-1:1,d=t/2,p=i/2,g=r/2;this.vertices.push(h*(d-n),g*c,u*(p-n)),this.normals.push(0,c,0),this.uvs.push(.5+(p-n)/this.textureRealSize*-u,.5+(d-n)/this.textureRealSize*h);const m=this.currentIndex++;for(let f=0;f<=this.radialSegments;f++){const _=f/this.radialSegments*Math.PI/2+0,y=Math.sin(_),A=Math.cos(_);this.vertices.push(h*(d-n+n*y),g*c,u*(p-n+n*A)),this.normals.push(0,c,0),this.uvs.push(.5+(p-n+n*A)/this.textureRealSize*-u,.5+(d-n+n*y)/this.textureRealSize*h),l.push(this.currentIndex++)}for(let f=0;f<=this.radialSegments-1;f++)e&&(o&&a||!o&&!a)||!e&&(!o&&a||o&&!a)?this.indices.push(m,l[f+0],l[f+1]):this.indices.push(m,l[f+1],l[f+0])}}class Fy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeC",this.castShadow=!1,this.receiveShadow=!1}dispose(){var e;(e=this.plate)==null||e.dispose()}async preload(){return this.plate=new yl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){await super.setConfig(e);const t=new _l;t.length=e.length,t.width=e.width,t.thickness=e.thickness,t.radiusA=e.radius,t.radiusB=e.radius,t.radiusC=e.radius,t.radiusD=e.radius,t.procurement_board_id=e.procurement_board_id,await this.plate.setConfig(t)}getCenter(){return this.plate.getCenter()}getZoom(){return this.plate.getZoom()}}class xl extends Xt{constructor(){super(...arguments),v(this,"__type","FlatEdgesPlateConfig"),v(this,"length"),v(this,"width"),v(this,"thickness"),v(this,"cornerA"),v(this,"cornerB"),v(this,"cornerC"),v(this,"cornerD"),v(this,"procurement_board_id")}validate(e,t){return Promise.resolve([])}async getValidatedConfig(){return this}}class bl extends Ht{constructor(){super(),v(this,"material"),v(this,"geometry"),v(this,"mesh"),this.type="FlatEdgesPlate",this.castShadow=!0,this.receiveShadow=!0}async preload(){return this.geometry=new Hy(2800),this.material=new Hi({color:16777215,map:new ht,metalness:0,roughness:1}),this.mesh=new Ie(this.geometry,this.material),this.add(this.mesh),super.preload()}getCenter(){}getZoom(){return 500}dispose(){var e,t;(e=this.geometry)==null||e.dispose(),(t=this.material)==null||t.dispose()}async setConfig(e){var t,i;await super.setConfig(e),(t=this.geometry)==null||t.setConfig(e.length,e.width,e.thickness,{length:e.cornerA,width:e.cornerA},{length:e.cornerB,width:e.cornerB},{length:e.cornerC,width:e.cornerC},{length:e.cornerD,width:e.cornerD});const r=(i=this.material)==null?void 0:i.map;this.material&&(e.procurement_board_id?(this.material.map=await Ft.getInstance().loadSurface(e.procurement_board_id),this.material.transparent=!0):(this.material.map=await Ft.getInstance().loadFallback(),this.material.transparent=!1),this.material.needsUpdate=!0,this.material.map.needsUpdate=!0),r?.dispose()}}class Hy extends lt{constructor(e){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"uvs",[]),v(this,"currentIndex",0),this.textureRealSize=e,this.type="FlatEdgesBoxBufferGeometry";const t=4*2*21+4*24;this.setIndex(new Array(t));const i=4*8*2+4*4*2*2;this.setAttribute("position",new Fe(i*3,3)),this.setAttribute("normal",new Fe(i*3,3)),this.setAttribute("uv",new Fe(i*2,2)),this.setAttribute("drillUv",new Fe(i*3,2))}setConfig(e,t,i,r,n,a,o){this.indices=[],this.vertices=[],this.normals=[],this.uvs=[],this.currentIndex=0,this.generatePart(e,t,i,!0,!0,r),this.generatePart(e,t,i,!0,!1,n),this.generatePart(e,t,i,!1,!0,a),this.generatePart(e,t,i,!1,!1,o),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.getAttribute("uv").copyArray(this.uvs),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("uv").needsUpdate=!0,this.index.needsUpdate=!0}generatePart(e,t,i,r,n,a){this.generatePartCap(e,t,i,!0,r,n,a),this.generatePartCap(e,t,i,!1,r,n,a),this.generatePartTorso(e,t,i,r,n,a)}generatePartCap(e,t,i,r,n,a,o){const l=i/2,c=e/2,h=t/2,u=o.length,d=o.width,p=r?1:-1,g=a?-1:1,m=n?-1:1;let f=[];this.vertices.push(0,l*p,0),this.normals.push(0,p,0),this.uvs.push(.5,.5),f.push(this.currentIndex++),this.vertices.push(g*(c-u),l*p,0),this.normals.push(0,p,0),this.uvs.push(.5,.5+g*(c-u)/this.textureRealSize),f.push(this.currentIndex++),this.vertices.push(g*(c-u),l*p,m*(h-d)),this.normals.push(0,p,0),this.uvs.push(.5+m*(h-d)/this.textureRealSize,.5+g*(c-u)/this.textureRealSize),f.push(this.currentIndex++),this.vertices.push(0,l*p,m*(h-d)),this.normals.push(0,p,0),this.uvs.push(.5+m*(h-d)/this.textureRealSize,.5),f.push(this.currentIndex++);const _=f[0],y=f[1],A=f[2],b=f[3];r&&n!=a||!r&&n==a?(this.indices.push(_,y,A),this.indices.push(_,A,b)):(this.indices.push(_,A,y),this.indices.push(_,b,A)),f=[],this.vertices.push(0,l*p,m*h),this.normals.push(0,p,0),this.uvs.push(.5+m*(h/this.textureRealSize),.5),f.push(this.currentIndex++),this.vertices.push(g*(c-u),l*p,m*h),this.normals.push(0,p,0),this.uvs.push(.5+m*(h/this.textureRealSize),.5+g*(c-u)/this.textureRealSize),f.push(this.currentIndex++);const S=f[1];r&&n!=a||!r&&n==a?(this.indices.push(b,A,f[1]),this.indices.push(b,f[1],f[0])):(this.indices.push(b,f[1],A),this.indices.push(b,f[0],f[1])),f=[],this.vertices.push(g*c,l*p,0),this.normals.push(0,p,0),this.uvs.push(.5,.5+g*c/this.textureRealSize),f.push(this.currentIndex++),this.vertices.push(g*c,l*p,m*(h-d)),this.normals.push(0,p,0),this.uvs.push(.5+m*(h-d)/this.textureRealSize,.5+g*c/this.textureRealSize),f.push(this.currentIndex++),r&&n!=a||!r&&n==a?(this.indices.push(y,f[0],f[1]),this.indices.push(y,f[1],A)):(this.indices.push(y,f[1],f[0]),this.indices.push(y,A,f[1]));const D=f[1];r&&n!=a||!r&&n==a?this.indices.push(A,D,S):this.indices.push(A,S,D)}generatePartTorso(e,t,i,r,n,a){const o=i/2,l=e/2,c=t/2,h=a.length,u=a.width,d=n?-1:1,p=r?-1:1;let g=[];for(let _=0;_<=1;_++){const y=_==0?1:-1;this.vertices.push(0,y*o,p*c),this.normals.push(0,0,p),this.uvs.push(.5+y*o/this.textureRealSize,.5),g.push(this.currentIndex++),this.vertices.push(d*(l-h),y*o,p*c),this.normals.push(0,0,p),this.uvs.push(.5+y*o/this.textureRealSize,.5+p*(l-h)/this.textureRealSize),g.push(this.currentIndex++)}n&&r||!n&&!r?(this.indices.push(g[0],g[2],g[3]),this.indices.push(g[0],g[3],g[1])):(this.indices.push(g[0],g[3],g[2]),this.indices.push(g[0],g[1],g[3])),g=[];for(let _=0;_<=1;_++){const y=_==0?1:-1;this.vertices.push(d*l,y*o,0),this.normals.push(d,0,0),this.uvs.push(.5+y*o/this.textureRealSize,.5),g.push(this.currentIndex++),this.vertices.push(d*l,y*o,p*(c-u)),this.normals.push(d,0,0),this.uvs.push(.5+y*o/this.textureRealSize,.5+p*(c-u)/this.textureRealSize),g.push(this.currentIndex++)}!n&&r||n&&!r?(this.indices.push(g[0],g[2],g[3]),this.indices.push(g[0],g[3],g[1])):(this.indices.push(g[0],g[3],g[2]),this.indices.push(g[0],g[1],g[3])),g=[];for(let _=0;_<=1;_++){const y=_==0?1:-1;this.vertices.push(d*l,y*o,0),this.normals.push(d,0,0),this.uvs.push(.5+y*o/this.textureRealSize,.5),g.push(this.currentIndex++),this.vertices.push(d*l,y*o,p*(c-u)),this.normals.push(d,0,0),this.uvs.push(.5+y*o/this.textureRealSize,.5+p*(c-u)/this.textureRealSize),g.push(this.currentIndex++)}!n&&r||n&&!r?(this.indices.push(g[0],g[2],g[3]),this.indices.push(g[0],g[3],g[1])):(this.indices.push(g[0],g[3],g[2]),this.indices.push(g[0],g[1],g[3])),g=[];const m=new L(h,0,u);m.normalize();const f=Math.sqrt(Math.pow(h,2)+Math.pow(u,2));for(let _=0;_<=1;_++){const y=_==0?1:-1;this.vertices.push(d*l,y*o,p*(c-u)),this.normals.push(m.x,m.y,m.z),this.uvs.push(.5+y*o/this.textureRealSize,.5+f/2/this.textureRealSize),g.push(this.currentIndex++),this.vertices.push(d*(l-h),y*o,p*c),this.normals.push(m.x,m.y,m.z),this.uvs.push(.5+y*o/this.textureRealSize,.5-f/2/this.textureRealSize),g.push(this.currentIndex++)}!n&&r||n&&!r?(this.indices.push(g[0],g[2],g[3]),this.indices.push(g[0],g[3],g[1])):(this.indices.push(g[0],g[3],g[2]),this.indices.push(g[0],g[1],g[3]))}}class Gy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeD",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new bl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t;await super.setConfig(e);const i=new xl;i.length=e.length,i.width=e.width,i.thickness=e.thickness,i.cornerA=e.corner,i.cornerB=e.corner,i.cornerC=e.corner,i.cornerD=e.corner,i.procurement_board_id=e.procurement_board_id,await((t=this.plate)==null?void 0:t.setConfig(i))}dispose(){var e;(e=this.plate)==null||e.dispose()}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class wl extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeE",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new jy,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t;await super.setConfig(e),await((t=this.plate)==null?void 0:t.setConfig(this.currentConfig))}dispose(){var e;(e=this.plate)==null||e.dispose()}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class jy extends Ht{constructor(){super(),v(this,"material"),v(this,"geometry"),v(this,"mesh"),v(this,"drillTexture"),this.type="CornerDeskRoundPlate",this.drillTexture=new Au(1400,1400),this.castShadow=!0,this.receiveShadow=!0,this.geometry=new Vy(2800),this.material=new Lu({color:16777215,drillMap:this.drillTexture,map:new ht,transparent:!0,metalness:0,roughness:1}),this.mesh=new Ie(this.geometry,this.material),this.mesh.castShadow=!0,this.mesh.receiveShadow=!0,this.add(this.mesh)}getCenter(){}getZoom(){}dispose(){this.geometry.dispose(),this.material.dispose(),this.drillTexture.dispose()}async setConfig(e){await super.setConfig(e),this.geometry.setConfig(e.length,e.width,e.thickness,e.length_2,e.width_2,e.radius);const t=this.material.map;e.procurement_board_id?(this.material.map=await Ft.getInstance().loadSurface(e.procurement_board_id),this.material.transparent=!0):(this.material.map=await Ft.getInstance().loadFallback(),this.material.transparent=!1),this.material.needsUpdate=!0,this.material.map.needsUpdate=!0,t?.dispose(),this.drillTexture.setDrills(e.length,e.width,e.drills),this.mesh.scale.x=e.side==ke.Left?1:-1}}class Vy extends lt{constructor(e){super(),v(this,"indices",[]),v(this,"vertices",[]),v(this,"normals",[]),v(this,"uvs",[]),v(this,"drillUvs",[]),v(this,"currentIndex",0),v(this,"radialSegments",8),this.textureRealSize=e,this.type="CornerDeskRoundBoxBufferGeometry";const t=12*2+this.radialSegments*3*2+36+6*this.radialSegments;this.setIndex(new Array(t));const i=8*2+10*2+24+18;this.setAttribute("position",new Fe(i*3,3)),this.setAttribute("normal",new Fe(i*3,3)),this.setAttribute("uv",new Fe(i*2,2)),this.setAttribute("drillUv",new Fe(i*3,2))}setConfig(e,t,i,r,n,a){this.indices=[],this.vertices=[],this.normals=[],this.uvs=[],this.drillUvs=[],this.currentIndex=0,this.generateCap(!0,e,t,i,r,n,a),this.generateCap(!1,e,t,i,r,n,a),this.generateRoundCap(!0,e,t,i,r,n,a),this.generateRoundCap(!1,e,t,i,r,n,a),this.generateTorso(e,t,i,r,n,a),this.generateRoundTorso(e,t,i,r,n,a),this.getAttribute("position").copyArray(this.vertices),this.getAttribute("normal").copyArray(this.normals),this.getAttribute("uv").copyArray(this.uvs),this.getAttribute("drillUv").copyArray(this.drillUvs),this.index.copyArray(this.indices),this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("uv").needsUpdate=!0,this.getAttribute("drillUv").needsUpdate=!0,this.index.needsUpdate=!0}generateRoundCap(e,t,i,r,n,a,o){const l=r/2,c=t/2,h=i/2,u=e===!0?1:-1;this.vertices.push(-c+n,l*u,-h+a),this.normals.push(0,u,0),this.uvs.push(.5+(-h+a)/this.textureRealSize,.5+(-c+n)/this.textureRealSize),this.drillUvs.push(n/t,1-a/i);const d=this.currentIndex++,p=[];for(let g=0;g<=this.radialSegments;g++){const m=g/this.radialSegments*Math.PI/2+0,f=Math.cos(m),_=Math.sin(m);this.vertices.push(-c+n+o*(1-_),l*u,-h+a+o*(1-f)),this.normals.push(0,u,0),this.uvs.push(.5+(-h+a+o*(1-f))/this.textureRealSize,.5+(-c+n+o*(1-_))/this.textureRealSize),this.drillUvs.push(n/t+o/t*(1-_),1-a/i-o/i*(1-f)),p.push(this.currentIndex++)}for(let g=0;g<this.radialSegments;g++)e?this.indices.push(d,p[g+1],p[g]):this.indices.push(d,p[g],p[g+1])}generateTorso(e,t,i,r,n,a){const o=i/2,l=e/2,c=t/2;let h=[],u,d,p,g;for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(-l,f*o,-c),this.normals.push(0,0,-1),this.uvs.push(.5+f*o/this.textureRealSize,.5-l/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(l,f*o,-c),this.normals.push(0,0,-1),this.uvs.push(.5+f*o/this.textureRealSize,.5+l/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[1],p=h[2],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p),h=[];for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(-l+r+a,f*o,-c+n),this.normals.push(0,0,1),this.uvs.push(.5+f*o/this.textureRealSize,.5+(-l+r+a)/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(l,f*o,-c+n),this.normals.push(0,0,1),this.uvs.push(.5+f*o/this.textureRealSize,.5+l/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[2],p=h[1],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p),h=[];for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(-l,f*o,c),this.normals.push(0,0,1),this.uvs.push(.5+f*o/this.textureRealSize,.5-l/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(-l+r,f*o,c),this.normals.push(0,0,1),this.uvs.push(.5+f*o/this.textureRealSize,.5+(-l+r)/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[2],p=h[1],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p),h=[];for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(-l,f*o,-c),this.normals.push(-1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5-c/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(-l,f*o,c),this.normals.push(-1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5+c/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[2],p=h[1],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p),h=[];for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(-l+r,f*o,c),this.normals.push(1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5+c/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(-l+r,f*o,-c+n+a),this.normals.push(1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5+(-c+n+a)/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[2],p=h[1],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p),h=[];for(let m=0;m<=1;m++){const f=m==0?1:-1;this.vertices.push(l,f*o,-c),this.normals.push(1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5-c/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++),this.vertices.push(l,f*o,-c+n),this.normals.push(1,0,0),this.uvs.push(.5+f*o/this.textureRealSize,.5+(-c+n)/this.textureRealSize),this.drillUvs.push(0,0),h.push(this.currentIndex++)}u=h[0],d=h[1],p=h[2],g=h[3],this.indices.push(u,d,p),this.indices.push(d,g,p)}generateRoundTorso(e,t,i,r,n,a){const o=i/2,l=e/2,c=t/2,h=new L,u=[];for(let d=0;d<=this.radialSegments;d++){const p=d/this.radialSegments,g=p*Math.PI/2+0,m=Math.sin(g),f=Math.cos(g);for(let _=0;_<=1;_++){const y=_==0?1:-1;this.vertices.push(-l+r+a*(1-m),y*o,-c+n+a*(1-f)),h.set(m,0,f).normalize(),this.normals.push(h.x,h.y,h.z),this.uvs.push(.5+y*o/this.textureRealSize,p*a*Math.PI/2/this.textureRealSize),this.drillUvs.push(0,0),u.push(this.currentIndex++)}}for(let d=0;d<this.radialSegments*2;d+=2){const p=u[d],g=u[d+1],m=u[d+2],f=u[d+3];this.indices.push(p,f,g),this.indices.push(p,m,f)}}generateCap(e,t,i,r,n,a,o){const l=e===!0?1:-1,c=r/2,h=t/2,u=i/2;let d=[];this.vertices.push(-h,c*l,-u),this.normals.push(0,l,0),this.uvs.push(.5-u/this.textureRealSize,.5-h/this.textureRealSize),this.drillUvs.push(0,1),d.push(this.currentIndex++),this.vertices.push(h,c*l,-u),this.normals.push(0,l,0),this.uvs.push(.5-u/this.textureRealSize,.5+h/this.textureRealSize),this.drillUvs.push(1,1),d.push(this.currentIndex++),this.vertices.push(h,c*l,-u+a),this.normals.push(0,l,0),this.uvs.push(.5+(-u+a)/this.textureRealSize,.5+h/this.textureRealSize),this.drillUvs.push(1,1-a/i),d.push(this.currentIndex++),this.vertices.push(-h,c*l,-u+a),this.normals.push(0,l,0),this.uvs.push(.5+(-u+a)/this.textureRealSize,.5-h/this.textureRealSize),this.drillUvs.push(0,1-a/i),d.push(this.currentIndex++);let p,g,m,f;p=d[3],g=d[2],m=d[1],f=d[0],e?(this.indices.push(p,g,m),this.indices.push(p,m,f)):(this.indices.push(p,m,g),this.indices.push(p,f,m)),d=[],this.vertices.push(-h,c*l,-u+a),this.normals.push(0,l,0),this.uvs.push(.5+(-u+a)/this.textureRealSize,.5-h/this.textureRealSize),this.drillUvs.push(0,1-a/i),d.push(this.currentIndex++),this.vertices.push(-h+n,c*l,-u+a),this.normals.push(0,l,0),this.uvs.push(.5+(-u+a)/this.textureRealSize,.5+(-h+n)/this.textureRealSize),this.drillUvs.push(n/t,1-a/i),d.push(this.currentIndex++),this.vertices.push(-h+n,c*l,u),this.normals.push(0,l,0),this.uvs.push(.5+u/this.textureRealSize,.5+(-h+n)/this.textureRealSize),this.drillUvs.push(n/t,0),d.push(this.currentIndex++),this.vertices.push(-h,c*l,u),this.normals.push(0,l,0),this.uvs.push(.5+u/this.textureRealSize,.5-h/this.textureRealSize),this.drillUvs.push(0,0),d.push(this.currentIndex++),p=d[3],g=d[2],m=d[1],f=d[0],e?(this.indices.push(p,g,m),this.indices.push(p,m,f)):(this.indices.push(p,m,g),this.indices.push(p,f,m))}}class Wy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeG",this.castShadow=!1,this.receiveShadow=!1}dispose(){var e;(e=this.plate)==null||e.dispose()}async preload(){return this.plate=new yl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t,i,r,n,a,o,l,c,h;await super.setConfig(e);const u=((t=this.currentConfig)==null?void 0:t.side)===ke.Top||((i=this.currentConfig)==null?void 0:i.side)===ke.Left,d=((r=this.currentConfig)==null?void 0:r.side)===ke.Top||((n=this.currentConfig)==null?void 0:n.side)===ke.Right,p=((a=this.currentConfig)==null?void 0:a.side)===ke.Bottom||((o=this.currentConfig)==null?void 0:o.side)===ke.Left,g=((l=this.currentConfig)==null?void 0:l.side)===ke.Bottom||((c=this.currentConfig)==null?void 0:c.side)===ke.Right,m=new _l;m.length=e.length,m.width=e.width,m.thickness=e.thickness,m.radiusA=u?e.radius:0,m.radiusB=d?e.radius:0,m.radiusC=p?e.radius:0,m.radiusD=g?e.radius:0,m.procurement_board_id=e.procurement_board_id,await((h=this.plate)==null?void 0:h.setConfig(m))}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class qy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeH",this.castShadow=!1,this.receiveShadow=!1}dispose(){var e;(e=this.plate)==null||e.dispose()}async preload(){return this.plate=new yl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t,i,r,n,a;await super.setConfig(e);const o=((t=this.currentConfig)==null?void 0:t.side)===ke.Top,l=((i=this.currentConfig)==null?void 0:i.side)===ke.Right,c=((r=this.currentConfig)==null?void 0:r.side)===ke.Left,h=((n=this.currentConfig)==null?void 0:n.side)===ke.Bottom,u=new _l;u.length=e.length,u.width=e.width,u.thickness=e.thickness,u.radiusA=o?e.radius:0,u.radiusB=l?e.radius:0,u.radiusC=c?e.radius:0,u.radiusD=h?e.radius:0,u.procurement_board_id=e.procurement_board_id,await((a=this.plate)==null?void 0:a.setConfig(u))}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class Xy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeI",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new bl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t,i,r,n,a;await super.setConfig(e);const o=((t=this.currentConfig)==null?void 0:t.side)===ke.Top,l=((i=this.currentConfig)==null?void 0:i.side)===ke.Right,c=((r=this.currentConfig)==null?void 0:r.side)===ke.Left,h=((n=this.currentConfig)==null?void 0:n.side)===ke.Bottom,u=new xl;u.length=e.length,u.width=e.width,u.thickness=e.thickness,u.cornerA=o?e.corner:0,u.cornerB=l?e.corner:0,u.cornerC=c?e.corner:0,u.cornerD=h?e.corner:0,u.procurement_board_id=e.procurement_board_id,await((a=this.plate)==null?void 0:a.setConfig(u))}dispose(){var e;(e=this.plate)==null||e.dispose()}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class Yy extends qi{constructor(){super(),v(this,"plate"),this.type="SpecialShapeI",this.castShadow=!1,this.receiveShadow=!1}async preload(){return this.plate=new bl,await this.plate.preload(),this.add(this.plate),super.preload()}async setConfig(e){var t,i,r,n,a,o,l,c,h;await super.setConfig(e);const u=((t=this.currentConfig)==null?void 0:t.side)===ke.Top||((i=this.currentConfig)==null?void 0:i.side)===ke.Left,d=((r=this.currentConfig)==null?void 0:r.side)===ke.Top||((n=this.currentConfig)==null?void 0:n.side)===ke.Right,p=((a=this.currentConfig)==null?void 0:a.side)===ke.Bottom||((o=this.currentConfig)==null?void 0:o.side)===ke.Left,g=((l=this.currentConfig)==null?void 0:l.side)===ke.Bottom||((c=this.currentConfig)==null?void 0:c.side)===ke.Right,m=new xl;m.length=e.length,m.width=e.width,m.thickness=e.thickness,m.cornerA=u?e.corner:0,m.cornerB=d?e.corner:0,m.cornerC=p?e.corner:0,m.cornerD=g?e.corner:0,m.procurement_board_id=e.procurement_board_id,await((h=this.plate)==null?void 0:h.setConfig(m))}dispose(){var e;(e=this.plate)==null||e.dispose()}getCenter(){var e;return(e=this.plate)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.plate)==null?void 0:e.getZoom()}}class Zy extends ji{constructor(){super(),v(this,"object")}async setConfig(e){var t;if(this.group.clear(),(t=this.object)==null||t.dispose(),!e)return;let i;switch(e.shape){case Qt.A:i=new zy,await i.preload(),await i.setConfig(e);break;case Qt.B:i=new By,await i.preload(),await i.setConfig(e);break;case Qt.C:i=new Fy,await i.preload(),await i.setConfig(e);break;case Qt.D:i=new Gy,await i.preload(),await i.setConfig(e);break;case Qt.E:i=new wl,await i.preload(),await i.setConfig(e);break;case Qt.G:i=new Wy,await i.preload(),await i.setConfig(e);break;case Qt.H:i=new qy,await i.preload(),await i.setConfig(e);break;case Qt.I:i=new Xy,await i.preload(),await i.setConfig(e);break;case Qt.J:i=new Yy,await i.preload(),await i.setConfig(e);break;default:throw new Error("model not defined")}this.object=i,this.group.add(this.object);const r=new Event("updated");this.dispatchEvent(r)}getCenter(){var e;return(e=this.object)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.object)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.object)==null||e.dispose()}}class $y extends Ht{constructor(){super(),v(this,"plate"),v(this,"thickness",25),this.type="Wallboard",this.createObject(),this.castShadow=!0,this.receiveShadow=!0}async preload(){return await this.createObject(),super.preload()}dispose(){this.plate.dispose()}async setConfig(e){await super.setConfig(e),this.visible=!1,this.currentConfig=await e.getValidatedConfig();const t=new Lt;t.length=e.length,t.width=e.width,t.procurement_board_id=e.procurement_board_id,t.thickness=this.thickness,await this.plate.setConfig(t),this.visible=!0}async createObject(){this.plate=new $e,await this.plate.preload(),this.add(this.plate)}getCenter(){return 0}getZoom(){return 500}}class Ky extends ji{constructor(){super(),v(this,"wallboard"),v(this,"currentConfig")}async preload(){return this.wallboard=new $y,await this.wallboard.preload(),this.group.add(this.wallboard),super.preload()}async setConfig(e){this.currentConfig=e,e&&this.wallboard.setConfig(e)}getCenter(){var e;return(e=this.wallboard)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.wallboard)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.wallboard)==null||e.dispose()}}class Jy{constructor(e,t){v(this,"element"),v(this,"lastConfig"),v(this,"fallbackConfig"),v(this,"renderer"),v(this,"objectScene"),v(this,"gallery"),v(this,"canvas"),v(this,"emptyHint"),v(this,"type"),this.element=jQuery(e),this.type=t}async initialize(){return G_.isWebGLAvailable()?await this.init():await this.initFallback()}async init(){switch(this.type){case"corpus":this.objectScene=new Ty;break;case"desk":this.objectScene=new Dy;break;case"table":this.objectScene=new Oy;break;case"special":this.objectScene=new Zy;break;case"wallboard":this.objectScene=new Ky;break;default:throw Error("Scene is not known.")}const e=this.element.find(".woocommerce-product-gallery");return await this.initGallery(e.get(0))}async initFallback(){const e=this.element.find(".woocommerce-product-gallery");return new Promise((t,i)=>{e.on("wc-product-gallery-after-init",(r,n)=>{n.data("flexslider").removeSlide(n.find(".three-viewer-container")),t(void 0)})})}async initGallery(e){var t;this.gallery=jQuery(e),this.canvas=this.gallery.find(".three-viewer-container .three-viewer"),this.emptyHint=this.gallery.find(".three-viewer-container .three-viewer-empty"),await this.initRenderer(),await((t=this.objectScene)==null?void 0:t.preload()),await this.showConfig(void 0),this.gallery.on("slidechanged",i=>{var r,n;i.originalEvent instanceof CustomEvent&&i.originalEvent.detail==="three"?(r=this.renderer)==null||r.start():(n=this.renderer)==null||n.stop()})}async initRenderer(){this.renderer=new mu(this.canvas.get(0),15724527,!jQuery(document.documentElement).hasClass("safari")),await this.renderer.preload(),this.renderer.start(),this.objectScene&&this.renderer.setObjectScene(this.objectScene)}async setConfig(e){(this.lastConfig||e)&&(this.lastConfig&&JSON.stringify(this.lastConfig)===JSON.stringify(e)||await this.showConfig(e)),this.lastConfig=e}setFallbackConfig(e){this.fallbackConfig=e}setEmptyHintVisible(e){this.emptyHint&&(e?this.emptyHint.fadeIn():this.emptyHint.fadeOut())}async showConfig(e){if(this.renderer&&this.gallery&&this.canvas&&this.objectScene){e?await this.objectScene.setConfig(e):this.fallbackConfig&&await this.objectScene.setConfig(this.fallbackConfig),this.renderer.setCenter(this.objectScene.getCenter()),this.renderer.setZoom(this.objectScene.getZoom()),this.canvas.fadeIn();return}this.canvas&&this.canvas.fadeOut()}}jQuery(document).on("click",".product-fields .toggle-buttons button",function(s){s.preventDefault();const e=jQuery(this).closest(".toggle-buttons").find("select");e.val(jQuery(this).data("value")),e.trigger("change"),e.trigger("input")}),jQuery(document).on("change",".product-fields .toggle-buttons select",function(s){const e=jQuery(this).closest(".toggle-buttons"),t=jQuery(this).val();e.find("button").removeClass("selected"),e.find("button[data-value="+t+"]").addClass("selected")}),jQuery(function(){jQuery(document).find(".product-fields .toggle-buttons select").trigger("change")});class En{}class Qy extends En{constructor(e){super(),v(this,"element"),v(this,"fields"),v(this,"surchargeElement"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.surchargeElement=this.element.find(".product-description .surcharge"),this.init()}init(){this.fields.find(":input").on("input",()=>{this.element.trigger("changed",[])}),this.fields.find("#corpus_door").on("change",()=>{this.fields.find("#corpus_door").is(":checked")?this.fields.find(".handle_row").show():this.fields.find(".handle_row").hide()}),this.element.on("updated",(e,t)=>{t.meta&&t.meta.surcharge?(this.surchargeElement.find(".amount").html(t.meta.surcharge),this.surchargeElement.show()):this.surchargeElement.hide()})}}let Ra=class{constructor(s){v(this,"element"),v(this,"surfaces"),v(this,"dialog"),this.element=jQuery(s),this.surfaces=this.element.data("surfaces"),this.element.on("click keydown",e=>{e.type==="keydown"&&e.key!=="Enter"||this.openSurfaceSelector(parseInt(this.element.find("select").val()),this.surfaces)}),this.element.find("select").on("input",()=>{const e=this.element.find("select").val(),t=Ls.first(Ls.where(this.surfaces,{id:parseInt(e)})),i=t?t.title:this.element.data("empty"),r=t?t.image:void 0;this.element.find(".title").text(i),this.element.find(".button-image").empty(),r&&this.element.find(".button-image").append('<img src="'+r+'" alt="'+i+'" />')})}closeSurfaceSelector(){var s;(s=this.dialog)==null||s.remove(),this.dialog=void 0,jQuery(document.documentElement).removeClass("prevent-scroll"),this.element.trigger("focus")}openSurfaceSelector(s,e){const t=window.wp.template("surface-selector-popup")({current:s,surfaces:e});this.dialog=jQuery(jQuery(t).appendTo(document.body)),s?this.dialog.find(".current").eq(0).trigger("focus"):this.dialog.find(":focusable:not(.close)").eq(0).trigger("focus"),jQuery(document.documentElement).addClass("prevent-scroll"),this.dialog.on("keydown",i=>{i.key!=="Escape"&&this.closeSurfaceSelector()}),this.dialog.on("click keydown",".close",i=>{i.type==="keydown"&&i.key==="Enter"||this.closeSurfaceSelector()}),this.dialog.on("click keydown","a.surface",i=>{if(i.type==="keydown"&&i.key==="Enter")return;const r=this.element.find("select"),n=jQuery(i.currentTarget).data("surface");r.val(n),r.trigger(jQuery.Event("input",{target:r.get(0)})),this.closeSurfaceSelector()})}};class ex extends En{constructor(e){super(),v(this,"element"),v(this,"fields"),v(this,"selector"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.selector=this.element.find(".surface-selector"),this.init()}init(){const e=this.fields.find(":input");e.on("input",()=>{this.element.trigger("changed",[])}),e.on("input",function(){e.parents(".field-container:not(:has(.surface-selector)):not(.validate)").length<=0&&jQuery(".surface-selector").parents(".field-container").addClass("validate")}),jQuery(".surface-selector").each(function(t,i){new Ra(i)})}}class tx extends En{constructor(e){super(),v(this,"element"),v(this,"fields"),v(this,"selector"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.selector=this.element.find(".surface-selector"),this.init()}init(){const e=this.fields.find(":input");e.on("input",()=>{this.element.trigger("changed",[])}),e.on("input",function(){e.parents(".field-container:not(:has(.surface-selector)):not(.validate)").length<=0&&jQuery(".surface-selector").parents(".field-container").addClass("validate")}),jQuery(".surface-selector").each(function(t,i){new Ra(i)})}}class ix extends En{constructor(e){super(),v(this,"element"),v(this,"fields"),v(this,"selector"),v(this,"unitPrice"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.selector=this.element.find(".surface-selector"),this.unitPrice=this.element.find(".unit-price"),this.init()}init(){const e=this.fields.find(":input");e.on("input",()=>{this.element.trigger("changed",[])}),e.on("input",function(){e.parents(".field-container:not(:has(.surface-selector)):not(.validate)").length<=0&&jQuery(".surface-selector").parents(".field-container").addClass("validate")}),jQuery(".surface-selector").each(function(t,i){new Ra(i)}),this.element.on("updated",(t,i)=>{i.meta&&i.meta.square_meter_price?(this.unitPrice.find(".amount").html(i.meta.square_meter_price),this.unitPrice.show()):this.unitPrice.hide()})}}class sx extends En{constructor(e){super(),v(this,"element"),v(this,"fields"),v(this,"selector"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.selector=this.element.find(".surface-selector"),this.init()}init(){const e=this.fields.find(":input");e.on("input",()=>{this.element.trigger("changed",[])}),e.on("input",()=>{e.parents(".field-container:not(:has(.surface-selector)):not(.validate)").length<=0&&jQuery(".surface-selector").parents(".field-container").addClass("validate")}),jQuery(".surface-selector").each(function(t,i){new Ra(i)})}}class rx{constructor(e){v(this,"element"),v(this,"fields"),this.element=jQuery(e),this.fields=this.element.find(".product-fields"),this.init()}init(){this.fields.find(":input").on("input",()=>{this.element.trigger("changed",[])}),this.fields.find(".toggle-buttons.surface-treatments select").on("change",function(){}),this.fields.find(".checkbox-switch.swiss-edge input[type=checkbox]").on("change",()=>{const e=jQuery(this).closest(".checkbox-switch.swiss-edge").data("image");if(e){const t=this.element.find(".flex-control-nav").find('li img[src="'+e.gallery_thumbnail_src+'"]');t.length>0&&t.trigger("click")}})}}class nx extends Xt{constructor(){super(...arguments),v(this,"__type","DeskConfig"),v(this,"procurement_board_id"),v(this,"secondary_procurement_board_id"),v(this,"length"),v(this,"width"),v(this,"height"),v(this,"color"),v(this,"model")}validate(e,t){return Promise.resolve([])}}class ax extends Xt{constructor(){super(...arguments),v(this,"__type","TableConfig"),v(this,"procurement_board_id"),v(this,"length"),v(this,"width"),v(this,"height"),v(this,"model")}validate(e,t){return Promise.resolve([])}}class ox extends Xt{constructor(){super(...arguments),v(this,"__type","WallboardConfig"),v(this,"procurement_board_id"),v(this,"length"),v(this,"width")}validate(e,t){return Promise.resolve([])}}class lx{constructor(e){v(this,"element"),v(this,"fields"),v(this,"threeInterop"),v(this,"currentRequest"),v(this,"configurator"),this.element=jQuery(e),this.fields=this.element.find(".product-fields")}async initialize(){this.init(),product_configurator_options.supports_three&&await this.initThree(),this.refreshPrice()}init(){switch(jQuery.extend(jQuery.expr.pseudos,{invalid:function(e,t,i){return e.validity!==void 0&&e.validity.valid===!1},valid:function(e,t,i){return e.validity!==void 0&&e.validity.valid===!0},focusable:function(e,t,i){return jQuery(e).is("a, button, :input, [tabindex]")}}),this.addDefaultNotificationHandler(),this.addChangeHandler(),this.addValidationHandler(),this.element.find(":input:not(button[type=submit])").on("keydown",function(e){if(e.key==="Enter")return e.preventDefault(),!1}),this.element.find(":input").on("wheel",function(e){e.preventDefault()}),product_configurator_options.type){case"corpus":this.configurator=new Qy(this.element.get(0));break;case"desk":this.configurator=new ex(this.element.get(0));break;case"table":this.configurator=new tx(this.element.get(0));break;case"special":this.configurator=new ix(this.element.get(0));break;case"wallboard":this.configurator=new sx(this.element.get(0));break;case"melamine-board":case"realwood-veneer-board":case"solidwood-board":this.configurator=new rx(this.element.get(0));break;default:throw Error("Configurator is not known.")}}async initThree(){const e=this.tryTransformToClass(product_configurator_options.example_config);this.threeInterop=new Jy(this.element.get(0),product_configurator_options.type),this.threeInterop.setFallbackConfig(e),await this.threeInterop.initialize(),this.element.on("updated",async(t,i)=>{this.threeInterop.setEmptyHintVisible(i.errors&&Object.keys(i.errors).length>0);let r=i.config;r?(r=this.tryTransformToClass(r),await this.threeInterop.setConfig(r)):await this.threeInterop.setConfig(void 0)})}tryTransformToClass(e){if(e.__type!=null)switch(e.__type){case"SpecialShapeConfig":e=ai(La,e);break;case"CorpusConfig":e=ai(ll,e);break;case"DeskConfig":e=ai(nx,e);break;case"TableConfig":e=ai(ax,e);break;case"WallboardConfig":e=ai(ox,e);break}return e}addDefaultNotificationHandler(){this.fields.find(":input").on("input",function(){jQuery(this).closest(".field-container").addClass("validate"),Pa(this)&&!isNaN(Number(this.value))&&Number(this.value)>0?(jQuery(this).closest(".field-container").addClass("value"),jQuery(this).closest(".field-container").find(".convert .value").html((Number(this.value)/10).toLocaleString("de",{style:"decimal"}))):jQuery(this).closest(".field-container").removeClass("value")})}addChangeHandler(){this.element.on("changed",()=>{this.element.find(".total .price").addClass("loading")}),this.element.on("changed",Ls.debounce(()=>this.refreshPrice(),250))}addValidationHandler(){const e=this.fields.find(":input");e.on("invalid",function(t){const i=t.target;if(Pa(i)&&i.validationMessage){jQuery(i).closest(".field-container").find(".error").remove(),jQuery(i).closest(".custom-field").removeClass("invalid");const r=jQuery('<span class="error"><i class="fa fa-exclamation-circle"></i>'+i.validationMessage+"</span>");jQuery(i).closest(".field-container").is(".validate")&&(jQuery(i).closest(".field-container").append(r),jQuery(i).closest(".custom-field").addClass("invalid")),t.preventDefault()}}),e.on("input change",function(t){jQuery(t.target).is(":valid")&&(jQuery(t.target).closest(".field-container").find(".error").remove(),jQuery(t.target).closest(".custom-field").removeClass("invalid"))}),this.element.find("form.cart").get(0).noValidate=!0}getConfig(){const e=this.fields.find(":input").serializeArray(),t={};return e.forEach(function(i,r){t[i.name]=i.value}),this.fields.find("input[type=radio],input[type=checkbox]").each(function(){this instanceof HTMLInputElement&&!Object.prototype.hasOwnProperty.call(t,this.name)&&(t[this.name]=!1)}),t}refreshPrice(){var e;const t=this.getConfig(),i={product_id:product_configurator_options.product_id,fields:t};(e=this.currentRequest)==null||e.abort(),this.currentRequest=jQuery.ajax({url:product_configurator_options.get_price_url,data:i,type:"POST",dataType:"json",success:r=>{r?(this.element.find(".total .price").html(r.formatted_price),this.element.find(".total .price").removeClass("loading"),r.delivery&&this.element.find(".delivery-time-info").html(r.delivery),this.element.trigger("updated",{response:r,formatted_price:r.formatted_price,meta:r.meta,errors:r.errors,config:r.config}),this.refreshErrors(r.errors)):(this.element.find(".total .price").html(""),this.element.find(".total .price").removeClass("loading"),r.delivery&&this.element.find(".delivery-time-info").html(r.delivery),this.element.trigger("updated",{response:r,config:void 0}),this.refreshErrors(void 0))}})}refreshErrors(e){this.fields.find(":input").each(function(t,i){Pa(i)&&(i.setCustomValidity(""),jQuery(i).closest(".field-container").find(".error").remove(),jQuery(i).closest(".custom-field").removeClass("invalid"))}),e&&Object.keys(e).forEach((t,i)=>{const r=this.fields.find(":input[name="+t+"]").get(0);r&&Pa(r)&&(r.setCustomValidity(e[t]),r.checkValidity())})}}function Pa(s){return s.setCustomValidity!==void 0}var hx=Object.defineProperty,cx=Object.getOwnPropertyDescriptor,Js=(s,e,t,i)=>{for(var r=i>1?void 0:i?cx(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&hx(e,t,r),r};let Xi=class extends Je{constructor(){super(...arguments),v(this,"isAddable"),v(this,"isRemovable"),v(this,"isExpandable"),v(this,"isContentShown"),v(this,"title"),v(this,"isContentShownLocal",this.isContentShown??!0)}onIsContentShownChanged(s){this.isContentShownLocal=s}onAddClick(s){s.preventDefault(),s.stopPropagation(),this.$emit("add")}onHeaderClick(s){s.preventDefault(),s.stopPropagation(),this.isAddable&&!this.isContentShown?this.$emit("add"):this.isExpandable&&this.onExpandClicked(s)}onRemoveClick(s){s.preventDefault(),s.stopPropagation(),this.$emit("remove")}onExpandClicked(s){s.preventDefault(),s.stopPropagation(),this.isContentShownLocal?this.$emit("collapse"):this.$emit("expand"),this.isContentShownLocal=!this.isContentShownLocal}};Js([Ne({default:!1})],Xi.prototype,"isAddable",2),Js([Ne({default:!1})],Xi.prototype,"isRemovable",2),Js([Ne({default:!1})],Xi.prototype,"isExpandable",2),Js([Ne({default:!0})],Xi.prototype,"isContentShown",2),Js([Ne({default:void 0})],Xi.prototype,"title",2),Js([Ot("isContentShown",{immediate:!0})],Xi.prototype,"onIsContentShownChanged",1),Xi=Js([Qe({name:"configurator-box"})],Xi);var ux=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"box",class:{"is-toggle-able":s.isAddable||s.isExpandable,"is-content-shown":s.isContentShownLocal,"is-addable":s.isAddable}},[s.title||s.isAddable||s.isRemovable?e("div",{staticClass:"header",on:{click:function(t){return s.onHeaderClick(t)}}},[e("span",{staticClass:"title"},[s._v(s._s(s.title))]),s.isAddable?e("button",{on:{click:function(t){return s.onAddClick(t)}}},[e("span",{staticClass:"fas fa-plus"})]):s._e(),!s.isAddable&&s.isRemovable?e("button",{on:{click:function(t){return s.onRemoveClick(t)}}},[e("span",{staticClass:"hpo-icon icon-bin"})]):s._e(),s.isExpandable?e("button",{on:{click:function(t){return s.onExpandClicked(t)}}},[e("span",{staticClass:"fas",class:{"fa-chevron-down":!s.isContentShownLocal,"fa-chevron-up":s.isContentShownLocal}})]):s._e()]):s._e(),e("div",{staticClass:"content"},[s._t("default")],2)])},dx=[],px=ot(Xi,ux,dx,!1,null,null,null,null);const Gr=px.exports;var fx=Object.defineProperty,mx=Object.getOwnPropertyDescriptor,jr=(s,e,t,i)=>{for(var r=i>1?void 0:i?mx(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&fx(e,t,r),r};let ys=class extends Je{constructor(){super(...arguments),v(this,"placeholder"),v(this,"dimension"),v(this,"error"),v(this,"errorMessage",null),v(this,"input")}onErrorChange(s,e){s&&s instanceof yt&&s.constraints?this.errorMessage=s.constraints[Object.keys(s.constraints)[0]]:typeof s=="string"?this.errorMessage=s:this.errorMessage="",this.input.setCustomValidity(this.errorMessage)}onWheel(s){s.preventDefault(),s.stopPropagation()}get hasError(){return!!this.error}get dimensionInCm(){return(this.dimension??0)/10}onFocus(){this.$emit("onFocus")}onBlur(){this.$emit("onBlur")}};jr([Ne()],ys.prototype,"placeholder",2),jr([jn()],ys.prototype,"dimension",2),jr([Ne()],ys.prototype,"error",2),jr([dt("input")],ys.prototype,"input",2),jr([Ot("error")],ys.prototype,"onErrorChange",1),ys=jr([Qe],ys);var gx=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"dimension"},[e("input",{directives:[{name:"model",rawName:"v-model.number",value:s.dimension,expression:"dimension",modifiers:{number:!0}}],ref:"input",attrs:{type:"number",step:"1",placeholder:s.placeholder,autocomplete:"off",min:"1","data-hj-allow":""},domProps:{value:s.dimension},on:{wheel:function(t){return s.onWheel(t)},focus:s.onFocus,blur:[s.onBlur,function(t){return s.$forceUpdate()}],input:function(t){t.target.composing||(s.dimension=s._n(t.target.value))}}}),e("span",{staticClass:"unit"},[s._v("mm")]),e("div",{staticClass:"warning convert",class:{value:s.dimensionInCm!=0}},[s._v(" entspricht "+s._s(s.dimensionInCm)+" cm. ")]),s.hasError?e("span",{staticClass:"error"},[e("i",{staticClass:"fa fa-exclamation-circle"}),s._v(s._s(s.errorMessage))]):s._e()])},vx=[],_x=ot(ys,gx,vx,!1,null,"c452bf0c",null,null);const Vr=_x.exports;var yx=Object.defineProperty,xx=Object.getOwnPropertyDescriptor,Ou=(s,e,t,i)=>{for(var r=i>1?void 0:i?xx(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&yx(e,t,r),r};let Da=class extends Je{onClick(){}};Ou([Qr("click")],Da.prototype,"onClick",1),Da=Ou([Qe],Da);var bx=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("button",{on:{click:s.onClick}},[s._t("default")],2)},wx=[],Sx=ot(Da,bx,wx,!1,null,"2e41a823",null,null);const An=Sx.exports;var Mx=Object.defineProperty,Tx=Object.getOwnPropertyDescriptor,Ln=(s,e,t,i)=>{for(var r=i>1?void 0:i?Tx(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Mx(e,t,r),r};let Qs=class extends Je{constructor(){super(...arguments),v(this,"price"),v(this,"taxInfo"),v(this,"big"),v(this,"title")}};Ln([Ne()],Qs.prototype,"price",2),Ln([Ne()],Qs.prototype,"taxInfo",2),Ln([Ne({default:!1})],Qs.prototype,"big",2),Ln([Ne({default:""})],Qs.prototype,"title",2),Qs=Ln([Qe],Qs);var Cx=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"price",class:{big:s.big}},[e("span",{staticClass:"total"},[s._v(" "+s._s(s.title)+" "),s.price==null?[s._v("\xA0")]:s._e(),s.price!=null&&s.price!==0?[s._v(s._s(s._f("currency")(s.price,"\u20AC",2,{thousandsSeparator:".",decimalSeparator:",",spaceBetweenAmountAndSymbol:!0})))]:s._e()],2),e("span",{staticClass:"legal"},[s.price==null?[s._v("\xA0")]:s._e(),s.price!=null?[typeof s.taxInfo=="object"?s._l(s.taxInfo,function(t,i){return e("div",{key:i},[s._v(" "+s._s(t)+" "),e("br")])}):[s._v(" "+s._s(s.taxInfo)+" ")]]:s._e()],2)])},Ex=[],Ax=ot(Qs,Cx,Ex,!1,null,"84cb85f7",null,null);const xs=Ax.exports;/*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */function bs(s){return bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bs(s)}function Sl(s,e){return Sl=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t},Sl(s,e)}function Lx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ia(s,e,t){return Lx()?Ia=Reflect.construct:Ia=function(i,r,n){var a=[null];a.push.apply(a,r);var o=Function.bind.apply(i,a),l=new o;return n&&Sl(l,n.prototype),l},Ia.apply(null,arguments)}function vi(s){return Rx(s)||Px(s)||Dx(s)||Ix()}function Rx(s){if(Array.isArray(s))return Ml(s)}function Px(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function Dx(s,e){if(s){if(typeof s=="string")return Ml(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ml(s,e)}}function Ml(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=s[t];return i}function Ix(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var kx=Object.hasOwnProperty,Nu=Object.setPrototypeOf,Ox=Object.isFrozen,Nx=Object.getPrototypeOf,zx=Object.getOwnPropertyDescriptor,Gt=Object.freeze,_i=Object.seal,Bx=Object.create,zu=typeof Reflect<"u"&&Reflect,ka=zu.apply,Tl=zu.construct;ka||(ka=function(s,e,t){return s.apply(e,t)}),Gt||(Gt=function(s){return s}),_i||(_i=function(s){return s}),Tl||(Tl=function(s,e){return Ia(s,vi(e))});var Ux=ii(Array.prototype.forEach),Bu=ii(Array.prototype.pop),Rn=ii(Array.prototype.push),Oa=ii(String.prototype.toLowerCase),Cl=ii(String.prototype.toString),Fx=ii(String.prototype.match),yi=ii(String.prototype.replace),Hx=ii(String.prototype.indexOf),Gx=ii(String.prototype.trim),jt=ii(RegExp.prototype.test),El=jx(TypeError);function ii(s){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return ka(s,e,i)}}function jx(s){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Tl(s,t)}}function Pe(s,e,t){t=t||Oa,Nu&&Nu(s,null);for(var i=e.length;i--;){var r=e[i];if(typeof r=="string"){var n=t(r);n!==r&&(Ox(e)||(e[i]=n),r=n)}s[r]=!0}return s}function er(s){var e=Bx(null),t;for(t in s)ka(kx,s,[t])===!0&&(e[t]=s[t]);return e}function Na(s,e){for(;s!==null;){var t=zx(s,e);if(t){if(t.get)return ii(t.get);if(typeof t.value=="function")return ii(t.value)}s=Nx(s)}function i(r){return console.warn("fallback value for",r),null}return i}var Uu=Gt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Al=Gt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ll=Gt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Vx=Gt(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Rl=Gt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Wx=Gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Fu=Gt(["#text"]),Hu=Gt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Pl=Gt(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Gu=Gt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),za=Gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qx=_i(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xx=_i(/<%[\w\W]*|[\w\W]*%>/gm),Yx=_i(/\${[\w\W]*}/gm),Zx=_i(/^data-[\-\w.\u00B7-\uFFFF]/),$x=_i(/^aria-[\-\w]+$/),Kx=_i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jx=_i(/^(?:\w+script|data):/i),Qx=_i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),eb=_i(/^html$/i),tb=function(){return typeof window>"u"?null:window},ib=function(s,e){if(bs(s)!=="object"||typeof s.createPolicy!="function")return null;var t=null,i="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(i)&&(t=e.currentScript.getAttribute(i));var r="dompurify"+(t?"#"+t:"");try{return s.createPolicy(r,{createHTML:function(n){return n},createScriptURL:function(n){return n}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function ju(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tb(),e=function(C){return ju(C)};if(e.version="2.4.3",e.removed=[],!s||!s.document||s.document.nodeType!==9)return e.isSupported=!1,e;var t=s.document,i=s.document,r=s.DocumentFragment,n=s.HTMLTemplateElement,a=s.Node,o=s.Element,l=s.NodeFilter,c=s.NamedNodeMap,h=c===void 0?s.NamedNodeMap||s.MozNamedAttrMap:c,u=s.HTMLFormElement,d=s.DOMParser,p=s.trustedTypes,g=o.prototype,m=Na(g,"cloneNode"),f=Na(g,"nextSibling"),_=Na(g,"childNodes"),y=Na(g,"parentNode");if(typeof n=="function"){var A=i.createElement("template");A.content&&A.content.ownerDocument&&(i=A.content.ownerDocument)}var b=ib(p,t),S=b?b.createHTML(""):"",D=i,O=D.implementation,M=D.createNodeIterator,R=D.createDocumentFragment,N=D.getElementsByTagName,I=t.importNode,K={};try{K=er(i).documentMode?i.documentMode:{}}catch{}var $={};e.isSupported=typeof y=="function"&&O&&typeof O.createHTMLDocument<"u"&&K!==9;var k=qx,W=Xx,U=Yx,Z=Zx,Y=$x,F=Jx,G=Qx,te=Kx,X=null,ie=Pe({},[].concat(vi(Uu),vi(Al),vi(Ll),vi(Rl),vi(Fu))),ce=null,Se=Pe({},[].concat(vi(Hu),vi(Pl),vi(Gu),vi(za))),H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ke=null,Le=null,Me=!0,de=!0,Ve=!1,Ce=!1,ge=!1,nt=!1,at=!1,et=!1,mt=!1,tt=!1,Ge=!0,Dt=!1,Wt="user-content-",E=!0,x=!1,j={},se=null,he=Pe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),pe=null,xe=Pe({},["audio","video","img","source","image","track"]),w=null,J=Pe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",oe="http://www.w3.org/2000/svg",P="http://www.w3.org/1999/xhtml",re=P,ne=!1,me=null,fe=Pe({},[ae,oe,P],Cl),ye,le=["application/xhtml+xml","text/html"],Te="text/html",_e,qe=null,_t=i.createElement("form"),Zt=function(C){return C instanceof RegExp||C instanceof Function},hr=function(C){qe&&qe===C||((!C||bs(C)!=="object")&&(C={}),C=er(C),ye=le.indexOf(C.PARSER_MEDIA_TYPE)===-1?ye=Te:ye=C.PARSER_MEDIA_TYPE,_e=ye==="application/xhtml+xml"?Cl:Oa,X="ALLOWED_TAGS"in C?Pe({},C.ALLOWED_TAGS,_e):ie,ce="ALLOWED_ATTR"in C?Pe({},C.ALLOWED_ATTR,_e):Se,me="ALLOWED_NAMESPACES"in C?Pe({},C.ALLOWED_NAMESPACES,Cl):fe,w="ADD_URI_SAFE_ATTR"in C?Pe(er(J),C.ADD_URI_SAFE_ATTR,_e):J,pe="ADD_DATA_URI_TAGS"in C?Pe(er(xe),C.ADD_DATA_URI_TAGS,_e):xe,se="FORBID_CONTENTS"in C?Pe({},C.FORBID_CONTENTS,_e):he,Ke="FORBID_TAGS"in C?Pe({},C.FORBID_TAGS,_e):{},Le="FORBID_ATTR"in C?Pe({},C.FORBID_ATTR,_e):{},j="USE_PROFILES"in C?C.USE_PROFILES:!1,Me=C.ALLOW_ARIA_ATTR!==!1,de=C.ALLOW_DATA_ATTR!==!1,Ve=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=C.SAFE_FOR_TEMPLATES||!1,ge=C.WHOLE_DOCUMENT||!1,et=C.RETURN_DOM||!1,mt=C.RETURN_DOM_FRAGMENT||!1,tt=C.RETURN_TRUSTED_TYPE||!1,at=C.FORCE_BODY||!1,Ge=C.SANITIZE_DOM!==!1,Dt=C.SANITIZE_NAMED_PROPS||!1,E=C.KEEP_CONTENT!==!1,x=C.IN_PLACE||!1,te=C.ALLOWED_URI_REGEXP||te,re=C.NAMESPACE||P,C.CUSTOM_ELEMENT_HANDLING&&Zt(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Zt(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ce&&(de=!1),mt&&(et=!0),j&&(X=Pe({},vi(Fu)),ce=[],j.html===!0&&(Pe(X,Uu),Pe(ce,Hu)),j.svg===!0&&(Pe(X,Al),Pe(ce,Pl),Pe(ce,za)),j.svgFilters===!0&&(Pe(X,Ll),Pe(ce,Pl),Pe(ce,za)),j.mathMl===!0&&(Pe(X,Rl),Pe(ce,Gu),Pe(ce,za))),C.ADD_TAGS&&(X===ie&&(X=er(X)),Pe(X,C.ADD_TAGS,_e)),C.ADD_ATTR&&(ce===Se&&(ce=er(ce)),Pe(ce,C.ADD_ATTR,_e)),C.ADD_URI_SAFE_ATTR&&Pe(w,C.ADD_URI_SAFE_ATTR,_e),C.FORBID_CONTENTS&&(se===he&&(se=er(se)),Pe(se,C.FORBID_CONTENTS,_e)),E&&(X["#text"]=!0),ge&&Pe(X,["html","head","body"]),X.table&&(Pe(X,["tbody"]),delete Ke.tbody),Gt&&Gt(C),qe=C)},Fn=Pe({},["mi","mo","mn","ms","mtext"]),Cs=Pe({},["foreignobject","desc","title","annotation-xml"]),Za=Pe({},["title","style","font","a","script"]),Qi=Pe({},Al);Pe(Qi,Ll),Pe(Qi,Vx);var cr=Pe({},Rl);Pe(cr,Wx);var $a=function(C){var ee=y(C);(!ee||!ee.tagName)&&(ee={namespaceURI:re,tagName:"template"});var Q=Oa(C.tagName),De=Oa(ee.tagName);return me[C.namespaceURI]?C.namespaceURI===oe?ee.namespaceURI===P?Q==="svg":ee.namespaceURI===ae?Q==="svg"&&(De==="annotation-xml"||Fn[De]):Boolean(Qi[Q]):C.namespaceURI===ae?ee.namespaceURI===P?Q==="math":ee.namespaceURI===oe?Q==="math"&&Cs[De]:Boolean(cr[Q]):C.namespaceURI===P?ee.namespaceURI===oe&&!Cs[De]||ee.namespaceURI===ae&&!Fn[De]?!1:!cr[Q]&&(Za[Q]||!Qi[Q]):!!(ye==="application/xhtml+xml"&&me[C.namespaceURI]):!1},es=function(C){Rn(e.removed,{element:C});try{C.parentNode.removeChild(C)}catch{try{C.outerHTML=S}catch{C.remove()}}},$r=function(C,ee){try{Rn(e.removed,{attribute:ee.getAttributeNode(C),from:ee})}catch{Rn(e.removed,{attribute:null,from:ee})}if(ee.removeAttribute(C),C==="is"&&!ce[C])if(et||mt)try{es(ee)}catch{}else try{ee.setAttribute(C,"")}catch{}},T=function(C){var ee,Q;if(at)C="<remove></remove>"+C;else{var De=Fx(C,/^[\r\n\t ]+/);Q=De&&De[0]}ye==="application/xhtml+xml"&&re===P&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");var Ze=b?b.createHTML(C):C;if(re===P)try{ee=new d().parseFromString(Ze,ye)}catch{}if(!ee||!ee.documentElement){ee=O.createDocument(re,"template",null);try{ee.documentElement.innerHTML=ne?S:Ze}catch{}}var ct=ee.body||ee.documentElement;return C&&Q&&ct.insertBefore(i.createTextNode(Q),ct.childNodes[0]||null),re===P?N.call(ee,ge?"html":"body")[0]:ge?ee.documentElement:ct},z=function(C){return M.call(C.ownerDocument||C,C,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},V=function(C){return C instanceof u&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof h)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},B=function(C){return bs(a)==="object"?C instanceof a:C&&bs(C)==="object"&&typeof C.nodeType=="number"&&typeof C.nodeName=="string"},q=function(C,ee,Q){$[C]&&Ux($[C],function(De){De.call(e,ee,Q,qe)})},ve=function(C){var ee;if(q("beforeSanitizeElements",C,null),V(C)||jt(/[\u0080-\uFFFF]/,C.nodeName))return es(C),!0;var Q=_e(C.nodeName);if(q("uponSanitizeElement",C,{tagName:Q,allowedTags:X}),C.hasChildNodes()&&!B(C.firstElementChild)&&(!B(C.content)||!B(C.content.firstElementChild))&&jt(/<[/\w]/g,C.innerHTML)&&jt(/<[/\w]/g,C.textContent)||Q==="select"&&jt(/<template/i,C.innerHTML))return es(C),!0;if(!X[Q]||Ke[Q]){if(!Ke[Q]&&Ae(Q)&&(H.tagNameCheck instanceof RegExp&&jt(H.tagNameCheck,Q)||H.tagNameCheck instanceof Function&&H.tagNameCheck(Q)))return!1;if(E&&!se[Q]){var De=y(C)||C.parentNode,Ze=_(C)||C.childNodes;if(Ze&&De)for(var ct=Ze.length,We=ct-1;We>=0;--We)De.insertBefore(m(Ze[We],!0),f(C))}return es(C),!0}return C instanceof o&&!$a(C)||(Q==="noscript"||Q==="noembed")&&jt(/<\/no(script|embed)/i,C.innerHTML)?(es(C),!0):(Ce&&C.nodeType===3&&(ee=C.textContent,ee=yi(ee,k," "),ee=yi(ee,W," "),ee=yi(ee,U," "),C.textContent!==ee&&(Rn(e.removed,{element:C.cloneNode()}),C.textContent=ee)),q("afterSanitizeElements",C,null),!1)},Ee=function(C,ee,Q){if(Ge&&(ee==="id"||ee==="name")&&(Q in i||Q in _t))return!1;if(!(de&&!Le[ee]&&jt(Z,ee))&&!(Me&&jt(Y,ee))){if(!ce[ee]||Le[ee]){if(!(Ae(C)&&(H.tagNameCheck instanceof RegExp&&jt(H.tagNameCheck,C)||H.tagNameCheck instanceof Function&&H.tagNameCheck(C))&&(H.attributeNameCheck instanceof RegExp&&jt(H.attributeNameCheck,ee)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(ee))||ee==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&jt(H.tagNameCheck,Q)||H.tagNameCheck instanceof Function&&H.tagNameCheck(Q))))return!1}else if(!w[ee]&&!jt(te,yi(Q,G,""))&&!((ee==="src"||ee==="xlink:href"||ee==="href")&&C!=="script"&&Hx(Q,"data:")===0&&pe[C])&&!(Ve&&!jt(F,yi(Q,G,"")))&&Q)return!1}return!0},Ae=function(C){return C.indexOf("-")>0},Oe=function(C){var ee,Q,De,Ze;q("beforeSanitizeAttributes",C,null);var ct=C.attributes;if(ct){var We={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ce};for(Ze=ct.length;Ze--;){ee=ct[Ze];var Ue=ee,Tt=Ue.name,ut=Ue.namespaceURI;if(Q=Tt==="value"?ee.value:Gx(ee.value),De=_e(Tt),We.attrName=De,We.attrValue=Q,We.keepAttr=!0,We.forceKeepAttr=void 0,q("uponSanitizeAttribute",C,We),Q=We.attrValue,!We.forceKeepAttr&&($r(Tt,C),!!We.keepAttr)){if(jt(/\/>/i,Q)){$r(Tt,C);continue}Ce&&(Q=yi(Q,k," "),Q=yi(Q,W," "),Q=yi(Q,U," "));var $t=_e(C.nodeName);if(Ee($t,De,Q)){if(Dt&&(De==="id"||De==="name")&&($r(Tt,C),Q=Wt+Q),b&&bs(p)==="object"&&typeof p.getAttributeType=="function"&&!ut)switch(p.getAttributeType($t,De)){case"TrustedHTML":Q=b.createHTML(Q);break;case"TrustedScriptURL":Q=b.createScriptURL(Q);break}try{ut?C.setAttributeNS(ut,Tt,Q):C.setAttribute(Tt,Q),Bu(e.removed)}catch{}}}}q("afterSanitizeAttributes",C,null)}},it=function C(ee){var Q,De=z(ee);for(q("beforeSanitizeShadowDOM",ee,null);Q=De.nextNode();)q("uponSanitizeShadowNode",Q,null),!ve(Q)&&(Q.content instanceof r&&C(Q.content),Oe(Q));q("afterSanitizeShadowDOM",ee,null)};return e.sanitize=function(C){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Q,De,Ze,ct,We;if(ne=!C,ne&&(C="<!-->"),typeof C!="string"&&!B(C)){if(typeof C.toString!="function")throw El("toString is not a function");if(C=C.toString(),typeof C!="string")throw El("dirty is not a string, aborting")}if(!e.isSupported){if(bs(s.toStaticHTML)==="object"||typeof s.toStaticHTML=="function"){if(typeof C=="string")return s.toStaticHTML(C);if(B(C))return s.toStaticHTML(C.outerHTML)}return C}if(nt||hr(ee),e.removed=[],typeof C=="string"&&(x=!1),x){if(C.nodeName){var Ue=_e(C.nodeName);if(!X[Ue]||Ke[Ue])throw El("root node is forbidden and cannot be sanitized in-place")}}else if(C instanceof a)Q=T("<!---->"),De=Q.ownerDocument.importNode(C,!0),De.nodeType===1&&De.nodeName==="BODY"||De.nodeName==="HTML"?Q=De:Q.appendChild(De);else{if(!et&&!Ce&&!ge&&C.indexOf("<")===-1)return b&&tt?b.createHTML(C):C;if(Q=T(C),!Q)return et?null:tt?S:""}Q&&at&&es(Q.firstChild);for(var Tt=z(x?C:Q);Ze=Tt.nextNode();)Ze.nodeType===3&&Ze===ct||ve(Ze)||(Ze.content instanceof r&&it(Ze.content),Oe(Ze),ct=Ze);if(ct=null,x)return C;if(et){if(mt)for(We=R.call(Q.ownerDocument);Q.firstChild;)We.appendChild(Q.firstChild);else We=Q;return ce.shadowroot&&(We=I.call(t,We,!0)),We}var ut=ge?Q.outerHTML:Q.innerHTML;return ge&&X["!doctype"]&&Q.ownerDocument&&Q.ownerDocument.doctype&&Q.ownerDocument.doctype.name&&jt(eb,Q.ownerDocument.doctype.name)&&(ut="<!DOCTYPE "+Q.ownerDocument.doctype.name+`>
`+ut),Ce&&(ut=yi(ut,k," "),ut=yi(ut,W," "),ut=yi(ut,U," ")),b&&tt?b.createHTML(ut):ut},e.setConfig=function(C){hr(C),nt=!0},e.clearConfig=function(){qe=null,nt=!1},e.isValidAttribute=function(C,ee,Q){qe||hr({});var De=_e(C),Ze=_e(ee);return Ee(De,Ze,Q)},e.addHook=function(C,ee){typeof ee=="function"&&($[C]=$[C]||[],Rn($[C],ee))},e.removeHook=function(C){if($[C])return Bu($[C])},e.removeHooks=function(C){$[C]&&($[C]=[])},e.removeAllHooks=function(){$={}},e}var sb=ju(),rb=Object.defineProperty,nb=Object.getOwnPropertyDescriptor,Wr=(s,e,t,i)=>{for(var r=i>1?void 0:i?nb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&rb(e,t,r),r};let ws=class extends Je{constructor(){super(...arguments),v(this,"extra"),v(this,"price"),v(this,"taxInfo")}get description(){return this.extra&&this.extra.description?sb.sanitize(this.extra.description,{ALLOWED_TAGS:["b","i","ul","li","ol","u"]}):void 0}remove(){}showInfo(){}};Wr([Ne()],ws.prototype,"extra",2),Wr([Ne({default:null})],ws.prototype,"price",2),Wr([Ne({default:null})],ws.prototype,"taxInfo",2),Wr([Qr("remove")],ws.prototype,"remove",1),Wr([Qr("info")],ws.prototype,"showInfo",1),ws=Wr([Qe({components:{PriceBadge:xs}})],ws);var ab=function(){var s,e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"extra"},[t("div",{staticClass:"left"},[t("button",{staticClass:"info",on:{click:function(i){return e.showInfo()}}},[t("i",{staticClass:"fas fa-info-circle"})]),t("span",{on:{click:function(i){return e.showInfo()}}},[e._v(e._s((s=e.extra)==null?void 0:s.title))]),e._v(" "),t("br"),t("span",{staticClass:"meta",domProps:{innerHTML:e._s(e.description)}})]),t("div",{staticClass:"right"},[t("button",{staticClass:"trash",on:{click:function(i){return e.remove()}}},[t("span",{staticClass:"hpo-icon icon-bin"})]),t("span",{staticClass:"price-result"},[t("price-badge",{attrs:{price:e.price,"tax-info":e.taxInfo}})],1)])])},ob=[],lb=ot(ws,ab,ob,!1,null,"5473c4f5",null,null);const Pn=lb.exports;var hb=Object.defineProperty,cb=Object.getOwnPropertyDescriptor,Vu=(s,e,t,i)=>{for(var r=i>1?void 0:i?cb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&hb(e,t,r),r};let Ba=class extends Je{constructor(){super(...arguments),v(this,"isOpen",!1)}onIsOpenChange(s,e){s&&!e?(document.documentElement.classList.add("prevent-scroll"),this.$nextTick(()=>{this.$emit("opened")})):document.documentElement.classList.remove("prevent-scroll")}open(){this.isOpen=!0}close(){this.isOpen=!1}get hasHeader(){return!!this.$slots.header}};Vu([Ot("isOpen")],Ba.prototype,"onIsOpenChange",1),Ba=Vu([Qe],Ba);var ub=function(){var s=this,e=s._self._c;return s._self._setupProxy,s.isOpen?e("div",[e("MountingPortal",{attrs:{"mount-to":"#portal",append:""}},[e("div",{staticClass:"popup"},[e("button",{staticClass:"close",attrs:{tabindex:"0",title:"Schlie\xDFen","aria-title":"Schlie\xDFen"},on:{click:s.close}},[e("i",{staticClass:"fas fa-times"})]),s.hasHeader?e("header",[s._t("header")],2):s._e(),e("main",[s._t("default")],2)])])],1):s._e()},db=[],pb=ot(Ba,ub,db,!1,null,"82e61f08",null,null);const qr=pb.exports;class tr{constructor(e=[]){for(const t of e)this[t.property]=t}}var fb=Object.defineProperty,mb=Object.getOwnPropertyDescriptor,Dl=(s,e,t,i)=>{for(var r=i>1?void 0:i?mb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&fb(e,t,r),r};class Xr extends Xt{constructor(){super(...arguments),v(this,"id"),v(this,"title"),v(this,"description")}async validate(e,t){return Promise.resolve([])}}Dl([kt(),Es()],Xr.prototype,"id",2),Dl([Gn()],Xr.prototype,"title",2),Dl([Gn()],Xr.prototype,"description",2);var gb=Object.defineProperty,vb=Object.getOwnPropertyDescriptor,Yr=(s,e,t,i)=>{for(var r=i>1?void 0:i?vb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&gb(e,t,r),r};const Wu=class{constructor(){v(this,"__type","HeightAdjustableDeskConfig"),v(this,"color"),v(this,"procurement_board_id"),v(this,"with_board",!1),v(this,"length"),v(this,"width"),v(this,"drills",[]),v(this,"extras",[])}async validate(s,e={}){e.strictGroups===void 0&&(e.strictGroups=!0);const t=await Qa(this,e);if(this.with_board===!0){const i=[];for(let r=0;r<this.drills.length;r++){const n=this.drills[r],a=await n.validate({padding:50,plateConfig:this});if(a.length>0){const o=new yt;o.target=this.drills,o.value=n,o.property=r.toString(),o.children=a,i.push(o)}}if(i.length<=0)for(let r=this.drills.length-1;r>0;r--){const n=this.drills[r];if(n.bounds)for(let a=r-1;a>=0;a--){const o=this.drills[a].bounds;if(o&&n.bounds.intersects(o,50)){const l=new yt;l.constraints={overlapping:"Die Bohrung darf maximal "+50+"mm an eine andere Bohrung ragen."},l.children=[];const c=new yt;c.target=this.drills,c.value=n,c.property=r.toString(),c.children=[l],i.push(c)}}}if(i.length>0){const r=new yt;r.target=this,r.value=this.drills,r.property="drills",r.children=i,t.push(r)}}return t}async getValidatedConfig(){const s=Vn(Wu,this);return s.length=Math.min(1900,Math.max(1180,s.length??1600)),s.width=Math.min(900,Math.max(584,s.width??800)),s}};let si=Wu;Yr([Ri(),Hn(["white","black","aluminum"])],si.prototype,"color",2),Yr([Pi(s=>s.with_board===!0,{always:!0}),kt({},{message:"Die Oberfl\xE4che muss angegeben werden.",groups:["cart"]})],si.prototype,"procurement_board_id",2),Yr([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(1180,{message:"Die L\xE4nge muss mindestens $constraint1mm betragen.",always:!0}),ss(1900,{message:"Die L\xE4nge darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die L\xE4nge muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die L\xE4nge muss angegeben werden.",always:!0})],si.prototype,"length",2),Yr([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(584,{message:"Die Breite muss mindestens $constraint1mm betragen.",always:!0}),ss(900,{message:"Die Breite darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die Breite muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die Breite muss angegeben werden.",always:!0})],si.prototype,"width",2),Yr([Pi(s=>s.with_board===!0,{always:!0}),eo(),en(()=>Wi,{keepDiscriminatorProperty:!0,discriminator:{property:"__type",subTypes:[{value:Mi,name:"RoundDrillConfig"},{value:Tn,name:"RectangleDrillConfig"}]}})],si.prototype,"drills",2),Yr([eo(),en(()=>Xr)],si.prototype,"extras",2);var _b=Object.defineProperty,yb=Object.getOwnPropertyDescriptor,ir=(s,e,t,i)=>{for(var r=i>1?void 0:i?yb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&_b(e,t,r),r};const qu=class extends si{constructor(){super(...arguments),v(this,"__type","HeightAdjustableCornerDeskConfig"),v(this,"length_2"),v(this,"width_2"),v(this,"radius")}async getValidatedConfig(){const s=Vn(qu,this);return s.length=Math.min(2e3,Math.max(1400,s.length??1800)),s.width=Math.min(2e3,Math.max(1500,s.width??1600)),s.length_2=Math.min(1e3,Math.max(700,s.length_2??800)),s.width_2=Math.min(1e3,Math.max(700,s.width_2??800)),s.radius=Math.min(500,Math.max(100,s.radius??300)),s}};let Vt=qu;ir([Ri(),Hn(["black","white"])],Vt.prototype,"color",2),ir([Gn(),Hn([ke.Left,ke.Right])],Vt.prototype,"side",2),ir([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(1400,{message:"Die L\xE4nge muss mindestens $constraint1mm betragen.",always:!0}),ss(2e3,{message:"Die L\xE4nge darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die L\xE4nge muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die L\xE4nge muss angegeben werden.",always:!0})],Vt.prototype,"length",2),ir([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(1500,{message:"Die Breite muss mindestens $constraint1mm betragen.",always:!0}),ss(1780,{message:"Die Breite darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die Breite muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die Breite muss angegeben werden.",always:!0})],Vt.prototype,"width",2),ir([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(700,{message:"Die L\xE4nge 2 muss mindestens $constraint1mm betragen.",always:!0}),ss(1e3,{message:"Die L\xE4nge 2 darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die L\xE4nge 2 muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die L\xE4nge 2 muss angegeben werden.",always:!0})],Vt.prototype,"length_2",2),ir([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(700,{message:"Die Breite 2 muss mindestens $constraint1mm betragen.",always:!0}),ss(1e3,{message:"Die Breite 2 darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die Breite 2 muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Die Breite 2 muss angegeben werden.",always:!0})],Vt.prototype,"width_2",2),ir([Pi(s=>s.with_board===!0,{always:!0}),Ri(),is(100,{message:"Der Radius muss mindestens $constraint1mm betragen.",always:!0}),ss(500,{message:"Der Radius darf maximal $constraint1mm betragen.",always:!0}),ni({message:"Die Radius muss eine Ganzzahl sein.",always:!0}),kt({},{message:"Der Radius muss angegeben werden.",always:!0})],Vt.prototype,"radius",2);var xb=Object.defineProperty,bb=Object.getOwnPropertyDescriptor,wb=(s,e,t,i)=>{for(var r=i>1?void 0:i?bb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&xb(e,t,r),r};const Xu=class{constructor(){v(this,"__type","SampleConfig"),v(this,"selected_surfaces",[])}async validate(s,e={}){return e.strictGroups===void 0&&(e.strictGroups=!0),await Qa(this,e)}async getValidatedConfig(){return Vn(Xu,this)}};let Il=Xu;wb([eo(),Sd({message:"Es muss mindestens ein Muster ausgew\xE4hlt werden.",always:!0}),Md()],Il.prototype,"selected_surfaces",2);var Sb=Object.defineProperty,Mb=Object.getOwnPropertyDescriptor,Yu=(s,e,t,i)=>{for(var r=i>1?void 0:i?Mb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Sb(e,t,r),r};class Ua{constructor(){v(this,"config"),v(this,"errors"),v(this,"meta"),v(this,"price"),v(this,"price_groups"),v(this,"formatted_price"),v(this,"delivery"),v(this,"shipping_cost")}}Yu([en(()=>Xt,{discriminator:{property:"__type",subTypes:[{value:si,name:"HeightAdjustableDeskConfig"},{value:Vt,name:"HeightAdjustableCornerDeskConfig"},{value:La,name:"SpecialShapeConfig"},{value:Il,name:"SampleConfig"}]}})],Ua.prototype,"config",2),Yu([en(()=>tr)],Ua.prototype,"errors",2);var Tb=Object.defineProperty,Cb=Object.getOwnPropertyDescriptor,Fa=(s,e,t,i)=>{for(var r=i>1?void 0:i?Cb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Tb(e,t,r),r};let Ss=class extends Je{constructor(){super(...arguments),v(this,"errors",new tr),v(this,"requestAbort"),v(this,"busyCount",0),v(this,"isActive",!1),v(this,"defaults"),v(this,"configuration"),v(this,"configuratorState"),v(this,"onConfigurationChangedDebounce")}async onConfigurationChanged(s,e){this.isActive&&(this.onConfigurationChangedDebounce||(this.onConfigurationChangedDebounce=Cd(async(t,i)=>{const r=await this.validate();this.errors=r;const n=[];n.push(this.refreshPrice()),await Promise.all(n)},250,!1)),await this.onConfigurationChangedDebounce(s,e))}setBusy(s){s?this.busyCount++:this.busyCount--}get isBusy(){return this.busyCount>0}async refreshPrice(){this.requestAbort&&this.requestAbort.abort(),this.requestAbort=new AbortController;const s=new URLSearchParams;s.append("product_id",product_configurator_options.product_id),s.append("payload",JSON.stringify(this.configuration));try{this.setBusy(!0);const e=await this.axios.post(product_configurator_options.get_price_url,s,{signal:this.requestAbort.signal});this.configuratorState=ai(Ua,e.data)}catch(e){if(e.message&&e.message!=="canceled")throw e}finally{this.setBusy(!1)}}async validate(s){let e=new tr;if(this.configuration){const t=await this.configuration.validate({},s);e=new tr(t)}return e}get errorList(){let s=[];if(this.errors)for(const e of Object.keys(this.errors)){const t=this.getErrorMessages(this.errors[e]);s=s.concat(t[0])}return s}getErrorMessages(s){let e=[];if(s.constraints)for(const t of Object.keys(s.constraints))e.push(s.constraints[t]);if(s.children)for(let t=0;t<s.children.length;t++)e=e.concat(this.getErrorMessages(s.children[t]));return e}async addToCart(){this.requestAbort&&this.requestAbort.abort();const s=await this.validate({groups:["cart"]});if(this.errors=s,Object.keys(this.errors).length>0)return!1;this.requestAbort=new AbortController;const e=new URLSearchParams;if(e.append("product_id",product_configurator_options.product_id),e.append("payload",JSON.stringify(this.configuration)),(await this.axios.post(product_configurator_options.add_to_cart_url,e,{signal:this.requestAbort.signal})).data.success)return!0;throw new Error("Error while adding to cart")}};Fa([$l()],Ss.prototype,"configuration",2),Fa([$l()],Ss.prototype,"configuratorState",2),Fa([Ot("configuration",{immediate:!0,deep:!0})],Ss.prototype,"onConfigurationChanged",1),Ss=Fa([Qe],Ss);var Eb=Object.defineProperty,Ab=Object.getOwnPropertyDescriptor,Zu=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ab(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Eb(e,t,r),r};let sr=class extends Je{constructor(){super(...arguments),v(this,"configuratorService")}};Zu([Ne()],sr.prototype,"configuratorService",2),sr=Zu([Qe],sr);var Lb=Object.defineProperty,Rb=Object.getOwnPropertyDescriptor,Pb=(s,e,t,i)=>{for(var r=i>1?void 0:i?Rb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Lb(e,t,r),r};let kl=class extends As(sr){get surfaces(){var s;return((s=this.configuratorService.defaults)==null?void 0:s.surfaces)??[]}get maximumOrderQuantity(){var s;return((s=this.configuratorService.defaults)==null?void 0:s.maximum_order_quantity)??0}onSelect(s,e){var t,i,r,n,a,o,l,c,h,u,d;(i=(t=this.configuratorService.configuration)==null?void 0:t.selected_surfaces)!=null&&i.includes(e.number)?(this.configuratorService.configuration.selected_surfaces=(d=(u=this.configuratorService.configuration)==null?void 0:u.selected_surfaces)==null?void 0:d.filter(p=>p!==e.number),this.$emit("errorChanged",null)):(((n=(r=this.configuratorService.configuration)==null?void 0:r.selected_surfaces)==null?void 0:n.length)??0)>=this.maximumOrderQuantity?((a=s.currentTarget)==null||a.classList.remove("error"),(o=s.currentTarget)==null||o.offsetWidth,(l=s.currentTarget)==null||l.classList.add("error"),this.$emit("errorChanged",`Es k\xF6nnen maximal ${this.maximumOrderQuantity} Muster ausgew\xE4hlt werden.`)):((h=(c=this.configuratorService.configuration)==null?void 0:c.selected_surfaces)==null||h.push(e.number),this.$emit("errorChanged",null))}};kl=Pb([Qe],kl);var Db=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"sample-picker"},[e("div",{staticClass:"surfaces"},s._l(s.surfaces,function(t,i){var r,n;return e("div",{key:i,staticClass:"surface-box"},[e("a",{staticClass:"surface",class:{selected:(n=(r=s.configuratorService.configuration)==null?void 0:r.selected_surfaces)==null?void 0:n.includes(t.number)},attrs:{role:"button",tabindex:"0"},on:{click:function(a){return s.onSelect(a,t)}}},[e("span",{staticClass:"image"},[e("img",{attrs:{alt:t.title,src:t.detail_texture||t.texture}})]),e("span",{staticClass:"title"},[s._v(s._s(t.number?t.number.toString().padStart(3,"0"):""))]),e("span",{staticClass:"title"},[s._v(s._s(t.title+""))])])])}),0)])},Ib=[],kb=ot(kl,Db,Ib,!1,null,"f7b52882",null,null);const Ob=kb.exports;var Nb=Object.defineProperty,zb=Object.getOwnPropertyDescriptor,Ol=(s,e,t,i)=>{for(var r=i>1?void 0:i?zb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Nb(e,t,r),r};let Dn=class extends Je{constructor(){super(...arguments),v(this,"deliveryTime"),v(this,"shippingCost")}};Ol([Ne()],Dn.prototype,"deliveryTime",2),Ol([Ne({default:0})],Dn.prototype,"shippingCost",2),Dn=Ol([Qe],Dn);var Bb=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"delivery"},[e("i",{staticClass:"fas fa-shipping-fast"}),e("span",{staticClass:"cost"},[s._v(" Versand um "+s._s(s._f("currency")(s.shippingCost??0,"\u20AC",2,{thousandsSeparator:".",decimalSeparator:",",spaceBetweenAmountAndSymbol:!0}))+" ")]),e("span",{staticClass:"duration"},[s._v(s._s(s.deliveryTime))])])},Ub=[],Fb=ot(Dn,Bb,Ub,!1,null,"bbb139b7",null,null);const Ha=Fb.exports;var Hb=Object.defineProperty,Gb=Object.getOwnPropertyDescriptor,rr=(s,e,t,i)=>{for(var r=i>1?void 0:i?Gb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Hb(e,t,r),r};let Yi=class extends As(sr){constructor(){super(),v(this,"cartBoxDistance",0),v(this,"addToCartError",null),v(this,"addToCartSuccess",!1),v(this,"resizeObserver"),v(this,"requestAbort"),v(this,"successTimer"),v(this,"rating"),v(this,"cartButton"),v(this,"cartBox"),v(this,"boxList")}async onAddToCartClicked(){window.clearTimeout(this.successTimer),this.addToCartError=null;try{this.configuratorService.setBusy(!0),await this.configuratorService.addToCart()?(this.addToCartSuccess=!0,this.successTimer=window.setTimeout(()=>{this.addToCartSuccess=!1},5e3)):this.addToCartError="Die Konfiguration enth\xE4lt Fehler. Bitte behebe diese bevor du das Produkt in den Warenkorb legst."}catch(s){if(s.message&&s.message!=="canceled")throw this.addToCartError="Beim Hinzuf\xFCgen ist ein Fehler aufgetreten. Bitte versuche es sp\xE4ter nochmal.",s}finally{this.configuratorService.setBusy(!1)}}onAddToCartError(s,e){var t;(t=this.cartButton)==null||t.setCustomValidity(s??"")}onErrorsChanged(s,e){Object.keys(s).length<=0&&(this.addToCartError=null)}mounted(){this.resizeObserver=new ResizeObserver(()=>{this.cartBoxDistance=this.cartBox.$el.clientHeight??0}),this.resizeObserver.observe(this.cartBox.$el)}beforeDestroy(){var s;(s=this.resizeObserver)==null||s.unobserve(this.cartBox.$el)}};rr([Ne()],Yi.prototype,"rating",2),rr([dt("cartButton")],Yi.prototype,"cartButton",2),rr([dt("cartBox")],Yi.prototype,"cartBox",2),rr([dt("boxList")],Yi.prototype,"boxList",2),rr([Ot("addToCartError")],Yi.prototype,"onAddToCartError",1),rr([Ot("configuratorService.configuratorState.errors")],Yi.prototype,"onErrorsChanged",1),Yi=rr([Qe({components:{ConfiguratorBox:Gr,ConfiguratorResponse:Ua,DeliveryBadge:Ha,PriceBadge:xs}})],Yi);var jb=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"configurator-wrap",style:{"--cartBoxDistance":s.cartBoxDistance+"px"}},[e("div",{staticClass:"visualization-wrap"},[e("div",{staticClass:"visualization-container"},[s._t("visualContent")],2)]),e("div",{staticClass:"content"},[e("div",{staticClass:"start"},[s._t("leftContent")],2),e("div",{staticClass:"end",attrs:{id:"end"}},[e("div",{staticClass:"sticky-container"},[s._t("rightContentTop"),e("div",{ref:"boxList",staticClass:"box-list"},[e("configurator-box",{ref:"cartBox",staticClass:"cart-box"},[s._t("price",function(){var t,i,r,n,a,o;return[e("delivery-badge",{attrs:{"delivery-time":(t=s.configuratorService.configuratorState)==null?void 0:t.delivery,"shipping-cost":(r=(i=s.configuratorService.configuratorState)==null?void 0:i.shipping_cost)==null?void 0:r.total}}),e("price-badge",{attrs:{big:!0,price:(n=s.configuratorService.configuratorState)==null?void 0:n.price,"tax-info":(o=(a=s.configuratorService.configuratorState)==null?void 0:a.price_groups)==null?void 0:o.total_tax_info}})]}),e("button",{ref:"cartButton",staticClass:"button alt add-to-cart",class:{success:s.addToCartSuccess},attrs:{disabled:s.configuratorService.isBusy},on:{click:s.onAddToCartClicked}},[s._v(" In den Warenkorb legen ")]),e("transition",{attrs:{name:"fade"}},[s.addToCartError?e("span",{staticClass:"message error"},[e("i",{staticClass:"fa fa-exclamation-circle"}),s._v(" "+s._s(s.addToCartError)),e("br"),s._v(" Folgende Probleme m\xFCssen behoben werden:"),e("br"),e("ul",s._l(s.configuratorService.errorList,function(t,i){return e("li",{key:i},[s._v(" "+s._s(t)+" ")])}),0)]):s._e()]),e("transition",{attrs:{name:"fade"}},[s.addToCartSuccess?e("span",{staticClass:"message success"},[e("i",{staticClass:"fa fa-check-circle"}),s._v(" Du hast deine Konfiguration erfolgreich in den Warenkorb gelegt. ")]):s._e()]),e("div",{staticClass:"rating"},[e("i",{staticClass:"fas fa-star"}),e("i",{staticClass:"fas fa-star"}),e("i",{staticClass:"fas fa-star"}),e("i",{staticClass:"fas fa-star"}),e("i",{staticClass:"fas fa-star-half-alt"}),e("span",{staticClass:"literal"},[s._v(s._s(s.rating))]),e("br"),e("span",{staticClass:"note"},[s._v("Shop-Bewertung bei Trusted Shops")])]),s.configuratorService.isBusy?e("div",{staticClass:"loading"}):s._e()],2),s._t("rightContentBottom")],2)],2)])])])},Vb=[],Wb=ot(Yi,jb,Vb,!1,null,"7ad45096",null,null);const $u=Wb.exports;var qb=Object.defineProperty,Xb=Object.getOwnPropertyDescriptor,Ku=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&qb(e,t,r),r};let Ga=class extends As(sr){constructor(){super(),v(this,"resizeObserver"),v(this,"rating")}};Ku([Ne()],Ga.prototype,"rating",2),Ga=Ku([Qe({components:{ConfiguratorFrame:$u,ConfiguratorBox:Gr,Dimension:Vr,AddButton:An,Extra:Pn}})],Ga);var Yb=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("configurator-frame",{attrs:{rating:s.rating,"configurator-service":s.configuratorService},scopedSlots:s._u([{key:"rightContentTop",fn:function(){return[s._t("rightContentTop")]},proxy:!0},{key:"rightContentBottom",fn:function(){return[s._t("rightContentBottom")]},proxy:!0},{key:"leftContent",fn:function(){return[s._t("leftContent")]},proxy:!0},{key:"price",fn:function(){return[s._t("price")]},proxy:!0}],null,!0)})},Zb=[],$b=ot(Ga,Yb,Zb,!1,null,null,null,null);const Kb=$b.exports;var Jb=Object.defineProperty,Qb=Object.getOwnPropertyDescriptor,ew=(s,e,t,i)=>{for(var r=i>1?void 0:i?Qb(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Jb(e,t,r),r};class Ju{constructor(){v(this,"config"),v(this,"thumbs")}}ew([en(()=>Xt,{discriminator:{property:"__type",subTypes:[{value:Il,name:"SampleConfig"},{value:si,name:"HeightAdjustableDeskConfig"},{value:Vt,name:"HeightAdjustableCornerDeskConfig"}]},keepDiscriminatorProperty:!0})],Ju.prototype,"config",2);var tw=Object.defineProperty,iw=Object.getOwnPropertyDescriptor,Nl=(s,e,t,i)=>{for(var r=i>1?void 0:i?iw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&tw(e,t,r),r};let nr=class extends Je{constructor(){super(...arguments),v(this,"configuratorService"),v(this,"defaults")}onDefaultsChanged(s,e){this.configuratorService.defaults=Vn(Ju,s),this.configuratorService.configuration=this.configuratorService.defaults.config}created(){this.configuratorService.isActive=!0}mounted(){}};Nl([Ne()],nr.prototype,"defaults",2),Nl([Ot("defaults",{immediate:!0})],nr.prototype,"onDefaultsChanged",1),nr=Nl([Qe],nr);var sw=Object.defineProperty,rw=Object.getOwnPropertyDescriptor,ja=(s,e,t,i)=>{for(var r=i>1?void 0:i?rw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&sw(e,t,r),r};let Zr=class extends As(nr){constructor(){super(),v(this,"error",null),v(this,"resizeObserver"),v(this,"selectedSamplesBox"),v(this,"samplePicker"),v(this,"rating"),this.configuratorService=new Ss}preload(){return Promise.resolve()}start(){}mounted(){this.adjustSamplePickerHeight(),window.addEventListener("resize",this.adjustSamplePickerHeight),this.resizeObserver=new ResizeObserver(this.adjustSamplePickerHeight),this.selectedSamplesBox&&this.resizeObserver.observe(this.selectedSamplesBox.$el)}beforeDestroy(){window.removeEventListener("resize",this.adjustSamplePickerHeight),this.resizeObserver&&this.selectedSamplesBox&&this.resizeObserver.unobserve(this.selectedSamplesBox.$el)}adjustSamplePickerHeight(){if(this.samplePicker&&this.selectedSamplesBox){const s=this.selectedSamplesBox.$el.clientHeight;window.innerWidth<=768?this.samplePicker.style.maxHeight=`calc(100vh - ${s+85+80}px)`:this.samplePicker.style.maxHeight="100%"}}async refresh(){}getSurfaceTitle(s){const e=this.surfaces.find(t=>t.number===s);return e?e.title:"Title Not Found"}getSurfaceTexture(s){const e=this.surfaces.find(t=>t.number===s);return e?.detail_texture??e?.texture??""}remove(s){var e;this.configuratorService.configuration.selected_surfaces=(e=this.configuratorService.configuration.selected_surfaces)==null?void 0:e.filter(t=>t!==s)}get surfaces(){var s;return((s=this.configuratorService.defaults)==null?void 0:s.surfaces)??[]}get maximumOrderQuantity(){return this.configuratorService.defaults.maximum_order_quantity}onErrorChanged(s){this.error=s}scrollToNewSample(){this.$nextTick(()=>{const s=this.$refs.surfaceListWrapper;s&&s instanceof HTMLElement&&(s.scrollLeft=s.scrollWidth)})}};ja([dt()],Zr.prototype,"selectedSamplesBox",2),ja([dt()],Zr.prototype,"samplePicker",2),ja([Ne()],Zr.prototype,"rating",2),Zr=ja([Qe({components:{ConfiguratorBox:Gr,Dimension:Vr,AddButton:An,Popup:qr,Extra:Pn,SamplePicker:Ob,SimpleConfiguratorFrame:Kb,PriceBadge:xs,DeliveryBadge:Ha}})],Zr);var nw=function(){var s=this,e=s._self._c;return s._self._setupProxy,s.configuratorService.configuration?e("simple-configurator-frame",{attrs:{"configurator-service":s.configuratorService,rating:s.rating},scopedSlots:s._u([{key:"rightContentTop",fn:function(){var t;return[e("div",{staticClass:"box-list"},[e("configurator-box",{ref:"selectedSamplesBox",attrs:{title:"Gew\xE4hlte Muster"}},[e("p",[s._v(" W\xE4hle bis zu "),e("b",[s._v(s._s(s.maximumOrderQuantity)+" kostenlose Muster")]),s._v(" aus. ")]),e("div",{ref:"surfaceListWrapper",staticClass:"surface-list-wrapper"},s._l((t=s.configuratorService.configuration)==null?void 0:t.selected_surfaces,function(i){return e("div",{key:i,staticClass:"surface-list"},[e("p",[e("span",{staticClass:"image-thumbnail"},[e("img",{attrs:{alt:s.getSurfaceTitle(i),src:s.getSurfaceTexture(i)}})]),s._v(" "+s._s(i.toString().padStart(3,"0"))+" "+s._s(s.getSurfaceTitle(i))+" ")]),e("button",{staticClass:"trash",on:{click:function(r){return s.remove(i)}}},[e("span",{staticClass:"hpo-icon icon-bin"})])])}),0),e("transition",{attrs:{name:"fade"}},[s.error?e("span",{staticClass:"error"},[e("i",{staticClass:"fa fa-exclamation-circle"}),s._v(s._s(s.error))]):s._e()])],1)],1)]},proxy:!0},{key:"rightContentBottom",fn:function(){var t,i;return[e("div",{staticClass:"box-list"},[e("configurator-box",{attrs:{title:"Versandinformationen","is-expandable":!0,"is-content-shown":!1}},[e("p",{staticClass:"info-text"},[s._v(" F\xFCr das Musterservice berechnen wir eine Versandpauschale in der H\xF6he von "+s._s(s._f("currency")(((i=(t=s.configuratorService.configuratorState)==null?void 0:t.shipping_cost)==null?void 0:i.total)??0,"\u20AC",2,{thousandsSeparator:".",decimalSeparator:",",spaceBetweenAmountAndSymbol:!0}))+", welche du mit einem Gutschein f\xFCr deine n\xE4chste Bestellung ersetzt bekommst. Den Gutscheincode erh\xE4ltst du in deiner Musterbestellung mitgeschickt. ")])])],1)]},proxy:!0},{key:"price",fn:function(){var t,i,r,n,a,o,l;return[e("delivery-badge",{attrs:{"delivery-time":(t=s.configuratorService.configuratorState)==null?void 0:t.delivery,"shipping-cost":(r=(i=s.configuratorService.configuratorState)==null?void 0:i.shipping_cost)==null?void 0:r.total}}),e("price-badge",{attrs:{big:!0,price:(a=(n=s.configuratorService.configuratorState)==null?void 0:n.shipping_cost)==null?void 0:a.total,"tax-info":(l=(o=s.configuratorService.configuratorState)==null?void 0:o.shipping_cost)==null?void 0:l.total_tax_info}})]},proxy:!0},{key:"leftContent",fn:function(){return[e("div",{ref:"samplePicker",staticClass:"samplePicker"},[e("sample-picker",{attrs:{"configurator-service":s.configuratorService},on:{errorChanged:s.onErrorChanged,selected:s.scrollToNewSample}})],1)]},proxy:!0}],null,!1,2737215401)}):s._e()},aw=[],ow=ot(Zr,nw,aw,!1,null,"ebd3b7bc",null,null);const lw=ow.exports,Qu=new bi,Va=new L;class ed extends T_{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Fe(e,3)),this.setAttribute("uv",new Fe(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new rl(t,6,1);return this.setAttribute("instanceStart",new Ki(i,3,0)),this.setAttribute("instanceEnd",new Ki(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new rl(t,6,1);return this.setAttribute("instanceColorStart",new Ki(i,3,0)),this.setAttribute("instanceColorEnd",new Ki(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new o_(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bi);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Qu.setFromBufferAttribute(t),this.boundingBox.union(Qu))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new cs),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let n=0,a=e.count;n<a;n++)Va.fromBufferAttribute(e,n),r=Math.max(r,i.distanceToSquared(Va)),Va.fromBufferAttribute(t,n),r=Math.max(r,i.distanceToSquared(Va));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class td extends ed{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setColors(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}ue.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new we(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},qt.line={uniforms:Ho.merge([ue.common,ue.fog,ue.line]),vertexShader:`
		#include <common>
		#include <color_pars_vertex>
		#include <fog_pars_vertex>
		#include <logdepthbuf_pars_vertex>
		#include <clipping_planes_pars_vertex>

		uniform float linewidth;
		uniform vec2 resolution;

		attribute vec3 instanceStart;
		attribute vec3 instanceEnd;

		attribute vec3 instanceColorStart;
		attribute vec3 instanceColorEnd;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#ifdef USE_DASH

			uniform float dashScale;
			attribute float instanceDistanceStart;
			attribute float instanceDistanceEnd;
			varying float vLineDistance;

		#endif

		void trimSegment( const in vec4 start, inout vec4 end ) {

			// trim end segment so it terminates between the camera plane and the near plane

			// conservative estimate of the near plane
			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
			float nearEstimate = - 0.5 * b / a;

			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

			end.xyz = mix( start.xyz, end.xyz, alpha );

		}

		void main() {

			#ifdef USE_COLOR

				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

			#endif

			#ifdef USE_DASH

				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
				vUv = uv;

			#endif

			float aspect = resolution.x / resolution.y;

			// camera space
			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

			#ifdef WORLD_UNITS

				worldStart = start.xyz;
				worldEnd = end.xyz;

			#else

				vUv = uv;

			#endif

			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
			// perhaps there is a more elegant solution -- WestLangley

			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

			if ( perspective ) {

				if ( start.z < 0.0 && end.z >= 0.0 ) {

					trimSegment( start, end );

				} else if ( end.z < 0.0 && start.z >= 0.0 ) {

					trimSegment( end, start );

				}

			}

			// clip space
			vec4 clipStart = projectionMatrix * start;
			vec4 clipEnd = projectionMatrix * end;

			// ndc space
			vec3 ndcStart = clipStart.xyz / clipStart.w;
			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;

			// direction
			vec2 dir = ndcEnd.xy - ndcStart.xy;

			// account for clip-space aspect ratio
			dir.x *= aspect;
			dir = normalize( dir );

			#ifdef WORLD_UNITS

				// get the offset direction as perpendicular to the view vector
				vec3 worldDir = normalize( end.xyz - start.xyz );
				vec3 offset;
				if ( position.y < 0.5 ) {

					offset = normalize( cross( start.xyz, worldDir ) );

				} else {

					offset = normalize( cross( end.xyz, worldDir ) );

				}

				// sign flip
				if ( position.x < 0.0 ) offset *= - 1.0;

				float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );

				// don't extend the line if we're rendering dashes because we
				// won't be rendering the endcaps
				#ifndef USE_DASH

					// extend the line bounds to encompass  endcaps
					start.xyz += - worldDir * linewidth * 0.5;
					end.xyz += worldDir * linewidth * 0.5;

					// shift the position of the quad so it hugs the forward edge of the line
					offset.xy -= dir * forwardOffset;
					offset.z += 0.5;

				#endif

				// endcaps
				if ( position.y > 1.0 || position.y < 0.0 ) {

					offset.xy += dir * 2.0 * forwardOffset;

				}

				// adjust for linewidth
				offset *= linewidth * 0.5;

				// set the world position
				worldPos = ( position.y < 0.5 ) ? start : end;
				worldPos.xyz += offset;

				// project the worldpos
				vec4 clip = projectionMatrix * worldPos;

				// shift the depth of the projected points so the line
				// segments overlap neatly
				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
				clip.z = clipPose.z * clip.w;

			#else

				vec2 offset = vec2( dir.y, - dir.x );
				// undo aspect ratio adjustment
				dir.x /= aspect;
				offset.x /= aspect;

				// sign flip
				if ( position.x < 0.0 ) offset *= - 1.0;

				// endcaps
				if ( position.y < 0.0 ) {

					offset += - dir;

				} else if ( position.y > 1.0 ) {

					offset += dir;

				}

				// adjust for linewidth
				offset *= linewidth;

				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
				offset /= resolution.y;

				// select end
				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;

				// back to clip space
				offset *= clip.w;

				clip.xy += offset;

			#endif

			gl_Position = clip;

			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

			#include <logdepthbuf_vertex>
			#include <clipping_planes_vertex>
			#include <fog_vertex>

		}
		`,fragmentShader:`
		uniform vec3 diffuse;
		uniform float opacity;
		uniform float linewidth;

		#ifdef USE_DASH

			uniform float dashOffset;
			uniform float dashSize;
			uniform float gapSize;

		#endif

		varying float vLineDistance;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#include <common>
		#include <color_pars_fragment>
		#include <fog_pars_fragment>
		#include <logdepthbuf_pars_fragment>
		#include <clipping_planes_pars_fragment>

		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {

			float mua;
			float mub;

			vec3 p13 = p1 - p3;
			vec3 p43 = p4 - p3;

			vec3 p21 = p2 - p1;

			float d1343 = dot( p13, p43 );
			float d4321 = dot( p43, p21 );
			float d1321 = dot( p13, p21 );
			float d4343 = dot( p43, p43 );
			float d2121 = dot( p21, p21 );

			float denom = d2121 * d4343 - d4321 * d4321;

			float numer = d1343 * d4321 - d1321 * d4343;

			mua = numer / denom;
			mua = clamp( mua, 0.0, 1.0 );
			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
			mub = clamp( mub, 0.0, 1.0 );

			return vec2( mua, mub );

		}

		void main() {

			#include <clipping_planes_fragment>

			#ifdef USE_DASH

				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

			#endif

			float alpha = opacity;

			#ifdef WORLD_UNITS

				// Find the closest points on the view ray and the line segment
				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
				vec3 lineDir = worldEnd - worldStart;
				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );

				vec3 p1 = worldStart + lineDir * params.x;
				vec3 p2 = rayEnd * params.y;
				vec3 delta = p1 - p2;
				float len = length( delta );
				float norm = len / linewidth;

				#ifndef USE_DASH

					#ifdef USE_ALPHA_TO_COVERAGE

						float dnorm = fwidth( norm );
						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );

					#else

						if ( norm > 0.5 ) {

							discard;

						}

					#endif

				#endif

			#else

				#ifdef USE_ALPHA_TO_COVERAGE

					// artifacts appear on some hardware if a derivative is taken within a conditional
					float a = vUv.x;
					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
					float len2 = a * a + b * b;
					float dlen = fwidth( len2 );

					if ( abs( vUv.y ) > 1.0 ) {

						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

					}

				#else

					if ( abs( vUv.y ) > 1.0 ) {

						float a = vUv.x;
						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
						float len2 = a * a + b * b;

						if ( len2 > 1.0 ) discard;

					}

				#endif

			#endif

			vec4 diffuseColor = vec4( diffuse, alpha );

			#include <logdepthbuf_fragment>
			#include <color_fragment>

			gl_FragColor = vec4( diffuseColor.rgb, alpha );

			#include <tonemapping_fragment>
			#include <encodings_fragment>
			#include <fog_fragment>
			#include <premultiplied_alpha_fragment>

		}
		`};class zl extends Fi{constructor(e){super({type:"LineMaterial",uniforms:Ho.clone(qt.line.uniforms),vertexShader:qt.line.vertexShader,fragmentShader:qt.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const id=new L,sd=new L,St=new je,Mt=new je,Ti=new je,Bl=new L,Ul=new He,Rt=new z_,rd=new L,Wa=new bi,qa=new cs,Ci=new je;let Ei,Fl,nd,ar;function ad(s,e,t){return Ci.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),Ci.multiplyScalar(1/Ci.w),Ci.x=ar/t.width,Ci.y=ar/t.height,Ci.applyMatrix4(s.projectionMatrixInverse),Ci.multiplyScalar(1/Ci.w),Math.abs(Math.max(Ci.x,Ci.y))}function hw(s,e){for(let t=0,i=Fl.count;t<i;t++){Rt.start.fromBufferAttribute(Fl,t),Rt.end.fromBufferAttribute(nd,t);const r=new L,n=new L;Ei.distanceSqToSegment(Rt.start,Rt.end,n,r),n.distanceTo(r)<ar*.5&&e.push({point:n,pointOnLine:r,distance:Ei.origin.distanceTo(n),object:s,face:null,faceIndex:t,uv:null,uv2:null})}}function cw(s,e,t){const i=e.projectionMatrix,r=s.material.resolution,n=s.matrixWorld,a=s.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=-e.near;Ei.at(1,Ti),Ti.w=1,Ti.applyMatrix4(e.matrixWorldInverse),Ti.applyMatrix4(i),Ti.multiplyScalar(1/Ti.w),Ti.x*=r.x/2,Ti.y*=r.y/2,Ti.z=0,Bl.copy(Ti),Ul.multiplyMatrices(e.matrixWorldInverse,n);for(let h=0,u=o.count;h<u;h++){if(St.fromBufferAttribute(o,h),Mt.fromBufferAttribute(l,h),St.w=1,Mt.w=1,St.applyMatrix4(Ul),Mt.applyMatrix4(Ul),St.z>c&&Mt.z>c)continue;if(St.z>c){const f=St.z-Mt.z,_=(St.z-c)/f;St.lerp(Mt,_)}else if(Mt.z>c){const f=Mt.z-St.z,_=(Mt.z-c)/f;Mt.lerp(St,_)}St.applyMatrix4(i),Mt.applyMatrix4(i),St.multiplyScalar(1/St.w),Mt.multiplyScalar(1/Mt.w),St.x*=r.x/2,St.y*=r.y/2,Mt.x*=r.x/2,Mt.y*=r.y/2,Rt.start.copy(St),Rt.start.z=0,Rt.end.copy(Mt),Rt.end.z=0;const d=Rt.closestPointToPointParameter(Bl,!0);Rt.at(d,rd);const p=jh.lerp(St.z,Mt.z,d),g=p>=-1&&p<=1,m=Bl.distanceTo(rd)<ar*.5;if(g&&m){Rt.start.fromBufferAttribute(o,h),Rt.end.fromBufferAttribute(l,h),Rt.start.applyMatrix4(n),Rt.end.applyMatrix4(n);const f=new L,_=new L;Ei.distanceSqToSegment(Rt.start,Rt.end,_,f),t.push({point:_,pointOnLine:f,distance:Ei.origin.distanceTo(_),object:s,face:null,faceIndex:h,uv:null,uv2:null})}}}class uw extends Ie{constructor(e=new ed,t=new zl({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)id.fromBufferAttribute(t,a),sd.fromBufferAttribute(i,a),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+id.distanceTo(sd);const n=new rl(r,2,1);return e.setAttribute("instanceDistanceStart",new Ki(n,1,0)),e.setAttribute("instanceDistanceEnd",new Ki(n,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const n=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ei=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;ar=l.linewidth+n,Fl=o.attributes.instanceStart,nd=o.attributes.instanceEnd,o.boundingSphere===null&&o.computeBoundingSphere(),qa.copy(o.boundingSphere).applyMatrix4(a);let c;if(i)c=ar*.5;else{const u=Math.max(r.near,qa.distanceToPoint(Ei.origin));c=ad(r,u,l.resolution)}if(qa.radius+=c,Ei.intersectsSphere(qa)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),Wa.copy(o.boundingBox).applyMatrix4(a);let h;if(i)h=ar*.5;else{const u=Math.max(r.near,Wa.distanceToPoint(Ei.origin));h=ad(r,u,l.resolution)}Wa.expandByScalar(h),Ei.intersectsBox(Wa)!==!1&&(i?hw(this,t):cw(this,r,t))}}class dw extends uw{constructor(e=new td,t=new zl({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}function pw(s,e=!1){const t=s[0].index!==null,i=new Set(Object.keys(s[0].attributes)),r=new Set(Object.keys(s[0].morphAttributes)),n={},a={},o=s[0].morphTargetsRelative,l=new lt;let c=0;for(let h=0;h<s.length;++h){const u=s[h];let d=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in u.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;n[p]===void 0&&(n[p]=[]),n[p].push(u.attributes[p]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in u.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+".  .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(u.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let p;if(t)p=u.index.count;else if(u.attributes.position!==void 0)p=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,h),c+=p}}if(t){let h=0;const u=[];for(let d=0;d<s.length;++d){const p=s[d].index;for(let g=0;g<p.count;++g)u.push(p.getX(g)+h);h+=s[d].attributes.position.count}l.setIndex(u)}for(const h in n){const u=od(n[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(const h in a){const u=a[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let d=0;d<u;++d){const p=[];for(let m=0;m<a[h].length;++m)p.push(a[h][m][d]);const g=od(p);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(g)}}return l}function od(s){let e,t,i,r=0;for(let o=0;o<s.length;++o){const l=s[o];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=l.normalized),i!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=l.array.length}const n=new e(r);let a=0;for(let o=0;o<s.length;++o)n.set(s[o].array,a),a+=s[o].array.length;return new Et(n,t,i)}class Zi extends rt{constructor(e){super(),v(this,"positions",new Array(6)),v(this,"material"),v(this,"geometry"),v(this,"textCanvas"),v(this,"textTexture"),v(this,"textMaterial"),v(this,"textObject"),v(this,"textOverride"),v(this,"distance"),v(this,"dimension_name"),v(this,"highlightColor","#5ca942"),this.dimension_name=e,this.positions.fill(0),this.createLine(),this.createText()}setConfig(e,t,i,r){if(!this.geometry||!this.textCanvas||!this.textObject)return;this.positions[0]=e.x,this.positions[1]=e.y,this.positions[2]=e.z,this.positions[3]=t.x,this.positions[4]=t.y,this.positions[5]=t.z,this.distance=i,this.geometry.setPositions(this.positions),this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingBox(),this.geometry.computeBoundingSphere();const n=new L;n.subVectors(e,t).setLength(e.distanceTo(t)/2).add(t);const a=new L,o=new L().subVectors(e,t).normalize();Math.abs(o.x)>Math.abs(o.y)||Math.abs(o.z)>Math.abs(o.y)?(n.y+=30+75/2,a.copy(n),Math.abs(o.x)>Math.abs(o.y)?a.z=0:a.x=0):(n.x-=Math.sqrt(.5)*30,n.z-=Math.sqrt(.5)*30,a.set(0,n.y,0)),this.textObject.position.copy(n),this.textObject.lookAt(a),this.textObject.updateWorldMatrix(!1,!0);let l;r?(this.textOverride=r,l=r):l=i+"mm",this.drawText(l,"#000000")}createLine(){this.geometry=new td,this.geometry.setPositions(this.positions),this.material=new zl({color:0,linewidth:5,vertexColors:!1,dashed:!1,alphaToCoverage:!0,worldUnits:!0});const e=new dw(this.geometry,this.material);this.add(e)}dispose(){var e,t,i,r,n;(e=this.material)==null||e.dispose(),(t=this.geometry)==null||t.dispose(),(i=this.textTexture)==null||i.dispose(),(r=this.textMaterial)==null||r.dispose(),(n=this.textCanvas)==null||n.remove()}createText(){this.textCanvas=document.createElement("canvas"),this.textCanvas.width=128*window.devicePixelRatio,this.textCanvas.height=64*window.devicePixelRatio,this.textTexture=new Ma(this.textCanvas),this.textTexture.repeat.set(1,1),this.textTexture.magFilter=gt,this.textTexture.minFilter=gt,this.textMaterial=new Ui({map:this.textTexture,transparent:!0,opacity:1,side:Rs});const e=new lr(150,75),t=e.clone();t.applyMatrix4(new He().makeRotationY(Math.PI));const i=pw([e,t]);this.textObject=new Ie(i,this.textMaterial),this.add(this.textObject)}drawText(e,t){if(!this.textCanvas)return;const i=this.textCanvas.getContext("2d");if(i==null)return;i.clearRect(0,0,this.textCanvas.width,this.textCanvas.height),i.fillStyle="#ffffff",i.fillRect(0,0,this.textCanvas.width,this.textCanvas.height),i.textAlign="center",i.fillStyle=t,i.strokeStyle="#000000",i.font=25*window.devicePixelRatio+"px sans-serif";const r=i.measureText(e);i.fillText(e,this.textCanvas.width/2,this.textCanvas.height/2+r.actualBoundingBoxAscent/2),this.textTexture.needsUpdate=!0}toggleLineHighlight(e){if(!this.textCanvas||!this.material||!this.textTexture||!this.distance)return;let t;this.textOverride?t=this.textOverride:t=this.distance.toLocaleString("de-DE",{maximumFractionDigits:2})+"mm",e?(this.material.color.set(this.highlightColor),this.material.linewidth=10):(this.material.color.set(0),this.material.linewidth=5),this.drawText(t,e?this.highlightColor:"#000000"),this.material.needsUpdate=!0}getDimensionLineName(){return this.dimension_name}}let fw=class extends Ht{constructor(){super(),v(this,"thickness"),v(this,"adjustableHeight"),v(this,"minHeight",570),v(this,"maxHeight",1100),v(this,"isExtended"),v(this,"dimensioning"),v(this,"dimensioningBack"),v(this,"dimensioningSide"),v(this,"materials",{}),v(this,"plate"),v(this,"models"),v(this,"highlightedLine"),this.type="HeightAdjustableDesk",this.adjustableHeight=this.minHeight,this.thickness=25,this.castShadow=!0,this.receiveShadow=!0,this.isExtended=!1}async preload(){const s=await Ft.getInstance().loadModel("height_adjustable_desk.glb?v2");return s.scene.traverse(e=>{e instanceof Ie&&(e.scale.set(1e3,1e3,1e3),e.castShadow=!0,e.receiveShadow=!1)}),this.models=s.scene,await this.createObject(),this.createDimensioning(),super.preload()}async setConfig(s){await super.setConfig(s),await this.setConfigDesk(),this.setConfigDimensioning()}toggleLineHighlight(s){s===this.highlightedLine||!s&&!this.highlightedLine||(!s&&this.highlightedLine?(this.changeLineHighlight(this.highlightedLine,!1),this.highlightedLine=void 0):s&&!this.highlightedLine?(this.changeLineHighlight(s,!0),this.highlightedLine=s):this.highlightedLine&&s&&(this.changeLineHighlight(this.highlightedLine,!1),this.changeLineHighlight(s,!0),this.highlightedLine=s))}changeLineHighlight(s,e){var t;(t=this.dimensioning)==null||t.children.forEach(i=>{i instanceof Zi&&i.getDimensionLineName()===s&&i.toggleLineHighlight(e)})}dispose(){var s;this.traverse(function(e){e instanceof Ie&&(e.geometry.dispose(),e.material&&e.material.dispose())}),(s=this.dimensioning)==null||s.traverse(function(e){e instanceof Zi&&e.dispose()})}async createObject(){const s=new Re,e=new Re;e.name="top",e.position.y=this.adjustableHeight,s.add(e),this.plate=new $e,await this.plate.preload();const t=new Lt;t.length=1800,t.width=800,t.procurement_board_id=null,t.thickness=this.thickness,this.plate.setConfig(t),this.plate.position.y=+this.thickness/2,this.plate.name="plate",e.add(this.plate);const i=this.models.getObjectByName("feet").clone(),r=new Re;r.name="left_foot",r.add(i);const n=new Re;n.name="right_foot",n.scale.x=-1,s.add(r),s.add(n),n.add(i.clone()),r.add(this.models.getObjectByName("leg_1").clone()),n.add(this.models.getObjectByName("leg_1").clone());const a=this.models.getObjectByName("leg_2").clone(),o=this.models.getObjectByName("leg_2").clone();r.add(a),n.add(o);const l=this.models.getObjectByName("leg_3").clone(),c=this.models.getObjectByName("leg_3").clone();l.name="left_leg_3",e.add(l),c.name="right_leg_3",c.scale.x=c.scale.x*-1,e.add(c);const h=this.models.getObjectByName("beam_inside").clone();e.add(h);const u=this.models.getObjectByName("beam_extern").clone(),d=this.models.getObjectByName("beam_extern").clone();u.name="left_beam_extern",d.name="right_beam_extern",d.scale.x=d.scale.x*-1,e.add(u),e.add(d);const p=this.models.getObjectByName("panel").clone();e.add(p),this.models.traverse(g=>{g instanceof Ie&&g.material.name==="black"?this.materials.black=g.material:g instanceof Ie&&g.material.name==="white"?this.materials.white=g.material:g instanceof Ie&&g.material.name==="aluminum"&&(this.materials.aluminum=g.material)}),this.add(s)}getPanelObject(){return this.getObjectByName("panel")}toggleHeight(){this.setAdjustableHeight(this.isExtended?this.minHeight:this.maxHeight),this.isExtended=!this.isExtended}setAdjustableHeight(s){s=Math.max(this.minHeight,Math.min(this.maxHeight,s));const e=this.getObjectByName("top");new bn(this).to({adjustableHeight:s},5e3).onUpdate(t=>{e.position.y=this.adjustableHeight,this.getObjectByName("left_foot").getObjectByName("leg_2").position.y=this.adjustableHeight/2,this.getObjectByName("right_foot").getObjectByName("leg_2").position.y=this.adjustableHeight/2,this.setConfigDimensioning()}).start()}getCenter(){return this.adjustableHeight/2}getZoom(){return 1e3}getDimensioning(){return this.dimensioning}setConfigDimensioning(){var s,e;const t=this.currentConfig.length,i=this.currentConfig.width;(s=this.dimensioningBack)==null||s.setConfig(new L(-t/2-50,this.adjustableHeight+50,-i/2-50),new L(t/2,this.adjustableHeight+50,-i/2-50),Math.floor(t)),(e=this.dimensioningSide)==null||e.setConfig(new L(-t/2-50,this.adjustableHeight+50,-i/2-50),new L(-t/2-50,this.adjustableHeight+50,i/2),Math.floor(i)),this.highlightedLine&&this.changeLineHighlight(this.highlightedLine,!0)}async setConfigDesk(){const s=this.currentConfig,e=new Lt;e.length=s.length,e.width=s.width,e.procurement_board_id=s.procurement_board_id,e.thickness=this.thickness,e.drills=s.drills,await this.plate.setConfig(e),this.plate.visible=s.with_board;const t=70,i=Math.min(s.length,1750)/2-t;this.getObjectByName("left_foot").position.x=-i,this.getObjectByName("right_foot").position.x=i,this.getObjectByName("left_leg_3").position.x=-i,this.getObjectByName("right_leg_3").position.x=i,this.getObjectByName("left_beam_extern").position.x=-i,this.getObjectByName("right_beam_extern").position.x=i,this.getObjectByName("left_foot").getObjectByName("leg_2").position.y=this.adjustableHeight/2,this.getObjectByName("right_foot").getObjectByName("leg_2").position.y=this.adjustableHeight/2,this.getObjectByName("panel").position.z=s.width/2,this.getObjectByName("panel").position.x=i-t,s.color&&this.traverse(r=>{r instanceof Ie&&r.material.userData.metal_material&&r.material.userData.metal_material==="true"&&r.material.name!==s.color&&(r.material=this.materials[s.color])})}createDimensioning(){this.dimensioning=new rt,this.dimensioningBack=new Zi("length"),this.dimensioningSide=new Zi("width"),this.dimensioning.add(this.dimensioningBack),this.dimensioning.add(this.dimensioningSide)}};class ld extends ji{constructor(){super(),v(this,"desk"),v(this,"currentConfig")}async preload(){return this.desk=new fw,await this.desk.preload(),this.group.add(this.desk),super.preload()}async setConfig(e){e&&(await this.desk.setConfig(e),this.currentConfig=e)}toggleLineHighlight(e){this.desk.toggleLineHighlight(e)}getCenter(){var e;return(e=this.desk)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.desk)==null?void 0:e.getZoom()}dispose(){var e;this.group.clear(),(e=this.desk)==null||e.dispose()}getPossibleInteraction(e){if(this.desk){const t=this.desk.getPanelObject();if(e.length>0&&e[0].object===t)return"H\xF6he umstellen"}}triggerInteraction(e,t){if(this.desk){const i=this.desk.getPanelObject();t==="click"&&e.length>0&&e[0].object===i&&this.desk.toggleHeight()}}getDimensioning(){var e;return(e=this.desk)==null?void 0:e.getDimensioning()}getRenderDimensioningActive(){var e;return((e=this.currentConfig)==null?void 0:e.with_board)??!1}update(e){}}var mw=Object.defineProperty,gw=Object.getOwnPropertyDescriptor,Hl=(s,e,t,i)=>{for(var r=i>1?void 0:i?gw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&mw(e,t,r),r};let In=class extends Je{constructor(){super(...arguments),v(this,"options"),v(this,"selected")}};Hl([Ne({type:Array,required:!0})],In.prototype,"options",2),Hl([jn({type:String})],In.prototype,"selected",2),In=Hl([Qe],In);var vw=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("span",{staticClass:"color-swatch"},s._l(s.options,function(t,i){return e("span",{key:i,staticClass:"option"},[e("input",{directives:[{name:"model",rawName:"v-model",value:s.selected,expression:"selected"}],attrs:{id:"color-"+t.key,type:"radio",name:"color"},domProps:{value:t.key,checked:s._q(s.selected,t.key)},on:{change:function(r){s.selected=t.key}}}),e("label",{attrs:{for:"color-"+t.key,title:t.title}},[e("span",{staticClass:"color",style:{backgroundColor:t.color}})])])}),0)},_w=[],yw=ot(In,vw,_w,!1,null,"adbf15d9",null,null);const Gl=yw.exports;var xw=Object.defineProperty,bw=Object.getOwnPropertyDescriptor,or=(s,e,t,i)=>{for(var r=i>1?void 0:i?bw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&xw(e,t,r),r};let $i=class extends Je{constructor(){super(...arguments),v(this,"value"),v(this,"internalValue",0),v(this,"popup"),v(this,"selectedSurface"),v(this,"surfaces"),v(this,"error"),v(this,"errorMessage",null)}onValueChange(s,e){this.internalValue=s}onErrorChange(s,e){s&&s instanceof yt&&s.constraints?this.errorMessage=s.constraints[Object.keys(s.constraints)[0]]:typeof s=="string"?this.errorMessage=s:this.errorMessage=""}get hasError(){return!!this.error}onClick(){this.popup.open()}onSelect(s){var e;this.selectedSurface=s,this.internalValue=s.id,(e=this.popup)==null||e.close(),this.$emit("input",this.selectedSurface.id)}};or([Ne({default:0})],$i.prototype,"value",2),or([Ot("value")],$i.prototype,"onValueChange",1),or([dt("popup")],$i.prototype,"popup",2),or([Ne()],$i.prototype,"surfaces",2),or([Ne()],$i.prototype,"error",2),or([Ot("error")],$i.prototype,"onErrorChange",1),$i=or([Qe({components:{Popup:qr}})],$i);var ww=function(){var s,e,t,i=this,r=i._self._c;return i._self._setupProxy,r("div",{staticClass:"surface-selector"},[r("button",{staticClass:"open-button",class:{invalid:i.hasError},on:{click:i.onClick}},[r("div",{staticClass:"button-image"},[i.internalValue?r("img",{attrs:{src:(s=i.selectedSurface)==null?void 0:s.image,alt:(e=i.selectedSurface)==null?void 0:e.title}}):i._e()]),r("span",{staticClass:"title"},[i.internalValue?i._e():[i._v("w\xE4hlen")],i.internalValue?[i._v(i._s((t=i.selectedSurface)==null?void 0:t.title))]:i._e()],2)]),i.hasError?r("span",{staticClass:"error"},[r("i",{staticClass:"fa fa-exclamation-circle"}),i._v(i._s(i.errorMessage))]):i._e(),r("Popup",{ref:"popup",scopedSlots:i._u([{key:"header",fn:function(){return[r("h1",[i._v("W\xE4hle eine Oberfl\xE4che")]),r("p",[i._v(" Finde deine Lieblingsoberfl\xE4che und f\xFCge es deinem M\xF6belst\xFCck hinzu. "),r("br"),r("span",{staticClass:"important-info-text"},[i._v("(je nach Auswahl) Melaminharz- oder Echtholzoberfl\xE4che")])])]},proxy:!0}])},[[r("div",{staticClass:"e-con e-con-boxed e-flex",staticStyle:{"--display":"flex"}},[r("section",{staticClass:"e-con-inner"},[r("div",{staticClass:"surfaces"},i._l(i.surfaces,function(n,a){return r("div",{key:a,staticClass:"surface-box"},[r("a",{staticClass:"surface",class:{current:n.id===i.internalValue},attrs:{role:"button",tabindex:"0"},on:{click:function(o){return i.onSelect(n)}}},[r("span",{staticClass:"image"},[r("img",{attrs:{alt:n.title,src:n.image}})]),r("span",{staticClass:"title"},[i._v(i._s(n.title))]),r("span",{staticClass:"price"},[i._v("ab "+i._s(i._f("currency")(n.price,"\u20AC",2,{thousandsSeparator:".",decimalSeparator:",",spaceBetweenAmountAndSymbol:!0})))])])])}),0)])])]],2)],1)},Sw=[],Mw=ot($i,ww,Sw,!1,null,"38c3239d",null,null);const hd=Mw.exports;var Tw=Object.defineProperty,Cw=Object.getOwnPropertyDescriptor,Yt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Cw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Tw(e,t,r),r};let Pt=class extends Je{constructor(){super(...arguments),v(this,"drill"),v(this,"temporaryDrill",null),v(this,"plateConfig"),v(this,"error"),v(this,"price"),v(this,"taxInfo"),v(this,"plateLength"),v(this,"displayRight"),v(this,"errorMessage",null),v(this,"editErrors",new tr),v(this,"internalTempChange",!1),v(this,"internalChange",!1)}get roundDrill(){return this.drill instanceof Mi?this.drill:null}get rectangleDrill(){return this.drill instanceof Tn?this.drill:null}get roundTemporaryDrill(){return this.temporaryDrill instanceof Mi?this.temporaryDrill:null}get rectangleTemporaryDrill(){return this.temporaryDrill instanceof Tn?this.temporaryDrill:null}async onTemporaryDrillChange(s,e){s instanceof Wi&&(this.editErrors=await this.validate(),Object.keys(this.editErrors).length<=0&&this.$emit("drillConfigChanged",s))}onErrorChange(s,e){s&&s instanceof yt&&s.constraints?this.errorMessage=s.constraints[Object.keys(s.constraints)[0]]:typeof s=="string"?this.errorMessage=s:this.errorMessage=""}async mounted(){this.error&&this.error instanceof yt&&this.error.constraints?this.errorMessage=this.error.constraints[Object.keys(this.error.constraints)[0]]:typeof this.error=="string"?this.errorMessage=this.error:this.errorMessage=""}async validate(s){if(!this.temporaryDrill)return new tr;const e=50,t=await this.temporaryDrill.validate({padding:e,plateConfig:this.plateConfig},s);return new tr(t)}get drillType(){var s,e;return(((s=this.temporaryDrill)==null?void 0:s.type)||((e=this.drill)==null?void 0:e.type))===vs.Round?"Rund":"Rechteck"}startEditDrill(s){return s?this.temporaryDrill=s:this.temporaryDrill=ai(Mi,Ed(this.drill)),this.temporaryDrill}stopEditDrill(){this.temporaryDrill=null}edit(){this.startEditDrill()}remove(){this.stopEditDrill()}async save(){const s=await this.validate();Object.keys(s).length<=0&&(this.drill?(Td(this.drill,this.temporaryDrill),this.$emit("save",this.drill),this.stopEditDrill()):(this.$emit("save",this.temporaryDrill),this.stopEditDrill()))}cancel(){this.stopEditDrill(),this.$emit("cancel")}onLeftTempChanged(s,e){!this.internalTempChange&&this.temporaryDrill&&(this.internalTempChange=!0,this.plateLength?this.temporaryDrill.right=this.plateLength-s:this.temporaryDrill.right=150,this.internalTempChange=!1)}onRightTempChanged(s,e){!this.internalTempChange&&this.temporaryDrill&&(this.internalTempChange=!0,this.plateLength?this.temporaryDrill.left=this.plateLength-s:this.temporaryDrill.left=150,this.internalTempChange=!1)}};Yt([jn()],Pt.prototype,"drill",2),Yt([Ne()],Pt.prototype,"plateConfig",2),Yt([Ne()],Pt.prototype,"error",2),Yt([Ne({default:null})],Pt.prototype,"price",2),Yt([Ne({default:null})],Pt.prototype,"taxInfo",2),Yt([Ne()],Pt.prototype,"plateLength",2),Yt([Ne()],Pt.prototype,"displayRight",2),Yt([Ot("temporaryDrill",{immediate:!0,deep:!0})],Pt.prototype,"onTemporaryDrillChange",1),Yt([Ot("error")],Pt.prototype,"onErrorChange",1),Yt([Qr("edit")],Pt.prototype,"edit",1),Yt([Qr("remove")],Pt.prototype,"remove",1),Yt([Ot("temporaryDrill.left")],Pt.prototype,"onLeftTempChanged",1),Yt([Ot("temporaryDrill.right")],Pt.prototype,"onRightTempChanged",1),Pt=Yt([Qe({components:{Dimension:Vr,PriceBadge:xs}})],Pt);var Ew=function(){var s,e,t,i,r,n,a,o,l,c,h=this,u=h._self._c;return h._self._setupProxy,u("div",{staticClass:"drill"},[h.temporaryDrill===null?u("div",{staticClass:"header"},[u("div",{staticClass:"left"},[h.temporaryDrill==null?u("span",{staticClass:"meta"},[h._v(h._s(h.drillType)+" | \u2300"+h._s((s=h.roundDrill)==null?void 0:s.diameter)+"mm")]):h._e(),h.temporaryDrill!=null?u("span",{staticClass:"meta"},[h._v(h._s(h.drillType)+" | \u2300"+h._s((e=h.roundTemporaryDrill)==null?void 0:e.diameter)+"mm")]):h._e(),h.temporaryDrill==null?u("button",{staticClass:"edit",on:{click:function(d){return h.edit()}}},[u("span",{staticClass:"fas fa-pencil-alt"})]):h._e(),u("br"),h.temporaryDrill==null&&!h.displayRight?u("span",{staticClass:"meta"},[h._v(" Links: "+h._s((t=h.roundDrill)==null?void 0:t.left)+"mm | Oben: "+h._s((i=h.roundDrill)==null?void 0:i.top)+"mm ")]):h._e(),h.temporaryDrill==null&&h.displayRight?u("span",{staticClass:"meta"},[h._v(" Links: "+h._s((r=h.roundDrill)==null?void 0:r.right)+"mm | Oben: "+h._s((n=h.roundDrill)==null?void 0:n.top)+"mm ")]):h._e(),h.temporaryDrill!=null&&!h.displayRight?u("span",{staticClass:"meta"},[h._v(" Links: "+h._s((a=h.roundTemporaryDrill)==null?void 0:a.left)+"mm | Oben: "+h._s((o=h.roundTemporaryDrill)==null?void 0:o.top)+"mm ")]):h._e(),h.temporaryDrill!=null&&h.displayRight?u("span",{staticClass:"meta"},[h._v(" Links: "+h._s((l=h.roundTemporaryDrill)==null?void 0:l.right)+"mm | Oben: "+h._s((c=h.roundTemporaryDrill)==null?void 0:c.top)+"mm ")]):h._e()]),u("div",{staticClass:"right"},[u("div",{staticClass:"price-result"},[u("price-badge",{attrs:{price:h.price,"tax-info":h.taxInfo}})],1)]),h.error?u("span",{staticClass:"error"},[u("i",{staticClass:"fa fa-exclamation-circle"}),h._v(h._s(h.errorMessage))]):h._e()]):h._e(),h.temporaryDrill!=null?[h.roundTemporaryDrill!=null?u("div",{staticClass:"configurator-option"},[u("label",[h._v("Durchmesser")]),u("dimension",{attrs:{error:h.editErrors.diameter},model:{value:h.roundTemporaryDrill.diameter,callback:function(d){h.$set(h.roundTemporaryDrill,"diameter",d)},expression:"roundTemporaryDrill.diameter"}})],1):h._e(),h.rectangleTemporaryDrill!=null?u("div",{staticClass:"configurator-option"},[u("label",[h._v("L\xE4nge")]),u("dimension",{attrs:{error:h.editErrors.length},model:{value:h.rectangleTemporaryDrill.length,callback:function(d){h.$set(h.rectangleTemporaryDrill,"length",d)},expression:"rectangleTemporaryDrill.length"}})],1):h._e(),h.rectangleTemporaryDrill!=null?u("div",{staticClass:"configurator-option"},[u("label",[h._v("Breite")]),u("dimension",{attrs:{error:h.editErrors.width},model:{value:h.rectangleTemporaryDrill.width,callback:function(d){h.$set(h.rectangleTemporaryDrill,"width",d)},expression:"rectangleTemporaryDrill.width"}})],1):h._e(),h.displayRight?h._e():u("div",{staticClass:"configurator-option"},[u("label",[h._v("Links")]),u("dimension",{attrs:{error:h.editErrors.left},model:{value:h.temporaryDrill.left,callback:function(d){h.$set(h.temporaryDrill,"left",d)},expression:"temporaryDrill.left"}})],1),h.displayRight?u("div",{staticClass:"configurator-option"},[u("label",[h._v("Links")]),u("dimension",{attrs:{error:h.editErrors.left},model:{value:h.temporaryDrill.right,callback:function(d){h.$set(h.temporaryDrill,"right",d)},expression:"temporaryDrill.right"}})],1):h._e(),u("div",{staticClass:"configurator-option"},[u("label",[h._v("Oben")]),u("dimension",{attrs:{error:h.editErrors.top},model:{value:h.temporaryDrill.top,callback:function(d){h.$set(h.temporaryDrill,"top",d)},expression:"temporaryDrill.top"}})],1),u("div",{staticClass:"actions"},[u("button",{staticClass:"close",on:{click:function(d){return h.cancel()}}},[h._v(" Abbrechen ")]),u("button",{staticClass:"close",on:{click:function(d){return h.save()}}},[h._v(" Speichern ")])])]:h._e()],2)},Aw=[],Lw=ot(Pt,Ew,Aw,!1,null,"a8808a80",null,null);const cd=Lw.exports;class ud extends ji{constructor(e){super(),v(this,"camera"),v(this,"dimensioningCanvas"),v(this,"dimensioningTexture"),v(this,"config"),v(this,"plate"),v(this,"currentDrill"),v(this,"isDragging",!1),v(this,"renderSize"),v(this,"areaSize"),this.config=e,this.root.remove(this.floor);const t=this.getRenderSpecs();this.renderSize=Math.max(t.width,t.height),this.areaSize=Math.max(t.width*3,t.height*3),this.createCamera(),this.createDimensioning()}async preload(){var e,t;if(this.config=await((e=this.config)==null?void 0:e.getValidatedConfig()),this.config instanceof Vt){const i=new La;i.procurement_board_id=null,i.length=this.config.length,i.width=this.config.width,i.length_2=this.config.length_2,i.width_2=this.config.width_2,i.radius=this.config.radius,i.thickness=25,i.shape=Qt.E,i.side=this.config.side,this.plate=new wl,await this.plate.preload(),await((t=this.plate)==null?void 0:t.setConfig(i))}else if(this.config instanceof si){const i=new Lt;i.procurement_board_id=null,i.length=this.config.length,i.width=this.config.width,i.thickness=25,this.plate=new $e,await this.plate.preload(),await this.plate.setConfig(i)}else throw new Error("Config is not valid.");this.group.add(this.plate)}setAspect(e){super.setAspect(e),this.createCamera(),this.draw()}createCamera(){this.camera=new dn(-this.areaSize/2,this.areaSize/2,-this.areaSize/2/this.aspect,this.areaSize/2/this.aspect,.1,3e3),this.camera.position.set(0,-2e3,0),this.camera.lookAt(0,0,0)}createDimensioning(){this.dimensioningCanvas=document.createElement("canvas"),this.dimensioningCanvas.width=this.renderSize,this.dimensioningCanvas.height=this.renderSize,this.dimensioningTexture=new Ma(this.dimensioningCanvas),this.dimensioningTexture.repeat.set(1,1),this.dimensioningTexture.magFilter=gt,this.dimensioningTexture.minFilter=gt;const e=new Ui({map:this.dimensioningTexture,transparent:!0,opacity:1}),t=new Ie(new lr(this.areaSize,this.areaSize),e);t.rotation.x=-Math.PI/2,t.position.set(0,10,0),this.group.add(t)}getCenter(){}getZoom(){}drawDistanceLine(e,t,i,r){e.save(),e.strokeStyle="#000000",e.fillStyle="#000000",e.beginPath(),e.setLineDash([5*t,5*t]),e.moveTo(i.x,i.y),e.lineTo(r.x,r.y),e.stroke(),e.setLineDash([]);const n=Math.atan2(r.y-i.y,r.x-i.x),a=8*t;e.beginPath(),e.moveTo(r.x,r.y),e.lineTo(r.x-a*Math.cos(n-Math.PI/7),r.y-a*Math.sin(n-Math.PI/7)),e.lineTo(r.x-a*Math.cos(n+Math.PI/7),r.y-a*Math.sin(n+Math.PI/7)),e.lineTo(r.x,r.y),e.closePath(),e.fill(),e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(i.x+a*Math.cos(n-Math.PI/7),i.y+a*Math.sin(n-Math.PI/7)),e.lineTo(i.x+a*Math.cos(n+Math.PI/7),i.y+a*Math.sin(n+Math.PI/7)),e.lineTo(i.x,i.y),e.closePath(),e.fill(),e.restore()}getRenderSpecs(){if(this.config instanceof Vt)return{width:this.config.length,height:this.config.width,x:this.config.length/2,y:this.config.width/2};if(this.config instanceof si)return{width:this.config.length,height:this.config.width,x:this.config.length/2,y:this.config.width/2};throw new Error("Config is not valid.")}draw(){const e=this.currentDrill,t=this.dimensioningCanvas.getContext("2d");if(t==null||e==null)return!1;const i=this.areaSize/(this.rendererWidth??this.areaSize);return t.font=Math.round(15*i)+"px sans-serif",t.strokeStyle="#000000",t.fillStyle="#000000",t.lineWidth=1*i,t.clearRect(0,0,this.renderSize,this.renderSize),t.scale(this.renderSize/this.areaSize,this.renderSize/this.areaSize),t.translate(this.areaSize/2-this.getRenderSpecs().x,this.areaSize/2-this.getRenderSpecs().y),this.drawDimensioning(t,i),this.drawDrill(e,t,i),t.scale(1,1),t.resetTransform(),this.dimensioningTexture.needsUpdate=!0,!0}drawDimensioning(e,t){if(this.config instanceof Vt){const i=this.config.length,r=this.config.width,n=this.config.length_2,a=this.config.width_2,o=this.config.radius;if(this.config.side==ke.Left){this.drawDistanceLine(e,t,{x:-20*t,y:0},{x:-20*t,y:r});let l=r+" mm",c=e.measureText(l);e.fillText(l,-20*t-c.width-10*t,r/2+c.actualBoundingBoxAscent/2),this.drawDistanceLine(e,t,{x:i+20*t,y:0},{x:i+20*t,y:a}),l=a+" mm",c=e.measureText(l),e.fillText(l,i+20*t+10*t,a/2+c.actualBoundingBoxAscent/2),this.drawDistanceLine(e,t,{x:0,y:-20*t},{x:i,y:-20*t}),l=i+" mm",c=e.measureText(l),e.fillText(l,i/2-c.width/2,-20*t-10*t-c.actualBoundingBoxAscent),this.drawDistanceLine(e,t,{x:0,y:r+20*t},{x:n,y:r+20*t}),l=n+" mm",c=e.measureText(l),e.fillText(l,n/2-c.width/2,r+20*t+10*t+c.actualBoundingBoxAscent),this.drawDistanceLine(e,t,{x:n+o,y:a+o},{x:n+o-Math.cos(Math.PI/4)*o,y:a+o-Math.sin(Math.PI/4)*o}),l=o+" mm",c=e.measureText(l),e.fillText(l,n+o-Math.cos(Math.PI/4)*o/2+t*10,a+o-Math.sin(Math.PI/4)*o/2)}else if(this.config.side==ke.Right){this.drawDistanceLine(e,t,{x:i+20*t,y:0},{x:i+20*t,y:r});let l=r+" mm",c=e.measureText(l);e.fillText(l,i+20*t+10*t,r/2+c.actualBoundingBoxAscent/2),this.drawDistanceLine(e,t,{x:-20*t,y:0},{x:-20*t,y:a}),l=a+" mm",c=e.measureText(l),e.fillText(l,-20*t-c.width-10*t,a/2+c.actualBoundingBoxAscent/2),this.drawDistanceLine(e,t,{x:0,y:-20*t},{x:i,y:-20*t}),l=i+" mm",c=e.measureText(l),e.fillText(l,i/2-c.width/2,-20*t-10*t-c.actualBoundingBoxAscent),this.drawDistanceLine(e,t,{x:i-n,y:r+20*t},{x:i,y:r+20*t}),l=n+" mm",c=e.measureText(l),e.fillText(l,n/2+i-n-c.width/2,r+20*t+10*t+c.actualBoundingBoxAscent),this.drawDistanceLine(e,t,{x:i-n-o,y:a+o},{x:i-n-o+Math.cos(Math.PI/4)*o,y:a+o-Math.sin(Math.PI/4)*o}),l=o+" mm",c=e.measureText(l),e.fillText(l,i-n-o-Math.cos(Math.PI/4)*o/2+t*10-c.width,a+o-Math.sin(Math.PI/4)*o/2)}}else if(this.config instanceof si){const i=this.config.length,r=this.config.width;this.drawDistanceLine(e,t,{x:-20*t,y:0},{x:-20*t,y:r});let n=r+" mm",a=e.measureText(n);e.fillText(n,-20*t-a.width-10*t,r/2+a.actualBoundingBoxAscent/2),this.drawDistanceLine(e,t,{x:0,y:r+20*t},{x:i,y:r+20*t}),n=i+" mm",a=e.measureText(n),e.fillText(n,i/2-a.width/2,r+20*t+10*t+a.actualBoundingBoxAscent),n="Hintere Tischkante",a=e.measureText(n),e.fillText(n,i/2-a.width/2,-a.actualBoundingBoxAscent)}}drawDrill(e,t,i){if(e instanceof Mi){const r=e.top;let n;this.config instanceof Vt&&this.config.side==ke.Right?n=e.right:n=e.left;const a=e.diameter,o=a/2;t.setLineDash([]),t.lineWidth=2*i,t.beginPath(),t.ellipse(n,r,o,o,Math.PI/4,0,2*Math.PI),t.stroke(),t.beginPath(),t.lineWidth=1*i,t.moveTo(n,r),t.lineTo(n-o/3,r),t.moveTo(n,r),t.lineTo(n+o/3,r),t.moveTo(n,r),t.lineTo(n,r-o/3),t.moveTo(n,r),t.lineTo(n,r+o/3),t.stroke(),this.drawDistanceLine(t,i,{x:0,y:r+a},{x:n,y:r+a});let l=n+" mm",c=t.measureText(l);t.fillText(l,n/2-c.width/2,r+a+20*i),t.beginPath(),t.moveTo(n,r+o),t.lineTo(n,r+a+10*i),t.stroke(),this.drawDistanceLine(t,i,{x:n+a,y:0},{x:n+a,y:r}),l=r+" mm",c=t.measureText(l),t.fillText(l,n+a+10*i,r/2+(c.actualBoundingBoxAscent??0)/2),t.beginPath(),t.moveTo(n+o,r),t.lineTo(n+a+10*i,r),t.stroke()}}async setConfig(e){this.currentDrill=e,this.draw()}dispose(){var e,t,i;(e=this.plate)==null||e.dispose(),(t=this.dimensioningTexture)==null||t.dispose(),(i=this.dimensioningCanvas)==null||i.remove()}getCamera(){return this.camera}getPossibleInteraction(e){if(this.isHitDrill(e))return"verschieben"}triggerInteraction(e,t){if(t==="mousedown"&&this.isHitDrill(e)&&(this.isDragging=!0),t==="mousemove"&&this.isDragging===!0&&this.currentDrill){const i=e[0].point,r=this.getRenderSpecs().x+i.x,n=this.getRenderSpecs().y+i.z;this.currentDrill.top=Math.round(n),this.config instanceof Vt&&this.config.side==ke.Right?this.currentDrill.right=Math.round(r):this.currentDrill.left=Math.round(r)}t==="mouseup"&&(this.isDragging=!1)}isHitDrill(e){if(e.length>0&&this.currentDrill instanceof Mi){const t=e[0].point,i=this.getRenderSpecs().x+t.x,r=this.getRenderSpecs().y+t.z;let n;this.config instanceof Vt&&this.config.side==ke.Right?n=(this.currentDrill.right??0)-(this.currentDrill.diameter??0)/2:n=(this.currentDrill.left??0)-(this.currentDrill.diameter??0)/2;const a=(this.currentDrill.top??0)-(this.currentDrill.diameter??0)/2,o=n+(this.currentDrill.diameter??0),l=a+(this.currentDrill.diameter??0);if(i>=n&&i<=o&&r>=a&&r<=l)return!0}return!1}}class dd{constructor(){v(this,"id"),v(this,"url"),v(this,"title"),v(this,"description"),v(this,"excerpt"),v(this,"highlight"),v(this,"information"),v(this,"delivery"),v(this,"price"),v(this,"tax_info"),v(this,"gallery")}}var Rw=Object.defineProperty,Pw=Object.getOwnPropertyDescriptor,pd=(s,e,t,i)=>{for(var r=i>1?void 0:i?Pw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Rw(e,t,r),r};let Xa=class extends Je{constructor(){super(...arguments),v(this,"popup"),v(this,"busy",!1),v(this,"requestAbort"),v(this,"products",[]),v(this,"isLoaded",!1)}async open(){var s;(s=this.popup)==null||s.open(),this.isLoaded||(await this.loadExtras(),this.isLoaded=!0)}addProduct(s){this.$emit("add",s),this.close()}close(){var s;(s=this.popup)==null||s.close()}updated(){this.$nextTick(function(){this.initGallery()})}opened(){this.initGallery()}initGallery(){jQuery(".woocommerce-product-gallery").each(function(s,e){new Kl(e)})}async loadExtras(){this.requestAbort&&this.requestAbort.abort(),this.requestAbort=new AbortController;try{this.busy=!0;const s=new URLSearchParams;s.append("product_id",product_configurator_options.product_id);const e=await this.axios.post(product_configurator_options.get_extras_url,s,{signal:this.requestAbort.signal}),t=[];for(let i of e.data){const r=ai(dd,i);t.push(r)}this.products=t}catch(s){if(s.message&&s.message!=="canceled")throw s}finally{this.busy=!1}}};pd([dt()],Xa.prototype,"popup",2),Xa=pd([Qe({components:{Popup:qr,DeliveryBadge:Ha,PriceBadge:xs}})],Xa);var Dw=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("Popup",{ref:"popup",on:{opened:function(t){return s.opened()}},scopedSlots:s._u([{key:"header",fn:function(){return[e("h1",[s._v("W\xE4hle dein Zubeh\xF6r")]),e("p",[s._v("Finde dein Zubeh\xF6r.")])]},proxy:!0}])},[[s.busy?e("div",{staticClass:"loading"}):s._e(),s._l(s.products,function(t,i){return e("section",{key:i,staticClass:"e-con e-con-boxed e-flex",staticStyle:{"--display":"flex"}},[e("div",{staticClass:"e-con-inner"},[e("div",{staticClass:"elementor-row elementor-column-gap-extended"},[e("div",{staticClass:"elementor-column elementor-col-33"},[e("div",{staticClass:"elementor-column-wrap elementor-element-populated"},[e("div",{staticClass:"elementor-widget-wrap"},[e("div",{staticClass:"elementor-element elementor-widget"},[e("div",{staticClass:"elementor-widget-container",domProps:{innerHTML:s._s(t.gallery)}})])])])]),e("div",{staticClass:"elementor-column elementor-col-66"},[e("div",{staticClass:"elementor-column-wrap elementor-element-populated"},[e("div",{staticClass:"elementor-widget-wrap"},[e("div",{staticClass:"elementor-element elementor-widget"},[e("div",{staticClass:"elementor-widget-container"},[e("div",[e("h2",[s._v(s._s(t.title))]),e("p",{domProps:{innerHTML:s._s(t.description)}})]),e("div",{staticClass:"meta"},[e("delivery-badge",{staticClass:"delivery",attrs:{"delivery-time":t.delivery}}),e("price-badge",{staticClass:"price",attrs:{price:t.price,"tax-info":t.tax_info}}),e("button",{staticClass:"button add",on:{click:function(r){return s.addProduct(t)}}},[s._v(" Hinzuf\xFCgen ")])],1)])])])])])])])])})]],2)},Iw=[],kw=ot(Xa,Dw,Iw,!1,null,"b3530a4b",null,null);const fd=kw.exports;var Ow=Object.defineProperty,Nw=Object.getOwnPropertyDescriptor,md=(s,e,t,i)=>{for(var r=i>1?void 0:i?Nw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Ow(e,t,r),r};let Ya=class extends Je{constructor(){super(...arguments),v(this,"popup"),v(this,"busy",!1),v(this,"requestAbort"),v(this,"product",null)}async open(s){var e;this.product=null,(e=this.popup)==null||e.open(),await this.load(s)}close(){var s;(s=this.popup)==null||s.close()}updated(){this.$nextTick(function(){this.initGallery()})}opened(){this.initGallery()}initGallery(){jQuery(".woocommerce-product-gallery").each(function(s,e){new Kl(e)})}async load(s){this.requestAbort&&this.requestAbort.abort(),this.requestAbort=new AbortController;try{this.busy=!0;const e=new URLSearchParams;e.append("product_id",product_configurator_options.product_id),e.append("extra_id",s.toString());const t=await this.axios.post(product_configurator_options.get_extras_url,e,{signal:this.requestAbort.signal}),i=[];for(let r of t.data){const n=ai(dd,r);i.push(n)}this.product=i[0]}catch(e){if(e.message&&e.message!=="canceled")throw e}finally{this.busy=!1}}};md([dt()],Ya.prototype,"popup",2),Ya=md([Qe({components:{Popup:qr,DeliveryBadge:Ha,PriceBadge:xs}})],Ya);var zw=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("Popup",{ref:"popup",on:{opened:function(t){return s.opened()}}},[[s.busy?e("div",{staticClass:"loading"}):s._e(),s.product?e("section",{staticClass:"elementor-section elementor-section-boxed"},[e("div",{staticClass:"elementor-container elementor-column-gap-extended"},[e("div",{staticClass:"elementor-row"},[e("div",{staticClass:"elementor-column elementor-col-33"},[e("div",{staticClass:"elementor-column-wrap elementor-element-populated"},[e("div",{staticClass:"elementor-widget-wrap"},[e("div",{staticClass:"elementor-element elementor-widget"},[e("div",{staticClass:"elementor-widget-container",domProps:{innerHTML:s._s(s.product.gallery)}})])])])]),e("div",{staticClass:"elementor-column elementor-col-66"},[e("div",{staticClass:"elementor-column-wrap elementor-element-populated"},[e("div",{staticClass:"elementor-widget-wrap"},[e("div",{staticClass:"elementor-element elementor-widget"},[e("div",{staticClass:"elementor-widget-container"},[e("div",[e("h2",[s._v(s._s(s.product.title))]),e("p",{domProps:{innerHTML:s._s(s.product.description)}})]),e("div",{staticClass:"meta"},[e("delivery-badge",{staticClass:"delivery",attrs:{"delivery-time":s.product.delivery}}),e("price-badge",{staticClass:"price",attrs:{price:s.product.price,"tax-info":s.product.tax_info}})],1)])])])])])])])]):s._e()]],2)},Bw=[],Uw=ot(Ya,zw,Bw,!1,null,"bc89a169",null,null);const gd=Uw.exports;var Fw=Object.defineProperty,Hw=Object.getOwnPropertyDescriptor,jl=(s,e,t,i)=>{for(var r=i>1?void 0:i?Hw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Fw(e,t,r),r};let kn=class extends Je{constructor(){super(...arguments),v(this,"thumbs"),v(this,"isVertical")}};jl([Ne()],kn.prototype,"thumbs",2),jl([Ne()],kn.prototype,"isVertical",2),kn=jl([Qe],kn);var Gw=function(){var s,e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"info-circles",class:{"is-vertical":e.isVertical}},[e._m(0),t("a",{staticClass:"thumbs",attrs:{href:"#gallery",title:"Zur Bildergallery springen"}},e._l((s=e.thumbs)==null?void 0:s.slice(0,3),function(i,r){return t("span",{key:r,staticClass:"circle"},[t("img",{attrs:{src:i,alt:""}})])}),0)])},jw=[function(){var s=this,e=s._self._c;return s._self._setupProxy,e("a",{attrs:{href:"#info",title:"Zu weiteren Produktdetails springen"}},[e("span",{staticClass:"circle"},[s._v("Info")])])}],Vw=ot(kn,Gw,jw,!1,null,"355c43a8",null,null);const Ww=Vw.exports;var qw=Object.defineProperty,Xw=Object.getOwnPropertyDescriptor,Vl=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&qw(e,t,r),r};let On=class extends As(sr){constructor(){super(),v(this,"resizeObserver"),v(this,"canvasHeight",0),v(this,"renderer"),v(this,"rating"),v(this,"canvas")}async mounted(){var s,e;this.canvas&&(this.renderer=new mu(this.canvas,15790320,!jQuery(document.documentElement).hasClass("safari"),!1),this.resetRendererFade(),await this.renderer.preload(),this.renderer.start(),(e=(s=import.meta)==null?void 0:s.hot)==null||e.dispose(t=>{var i,r;(i=this.renderer)==null||i.stop(),(r=this.renderer)==null||r.dispose()})),this.resizeObserver=new ResizeObserver(()=>{var t;this.canvasHeight=((t=this.canvas)==null?void 0:t.clientHeight)??0}),this.resizeObserver.observe(this.canvas),window.addEventListener("resize",()=>{this.resetRendererFade()})}resetRendererFade(){var s,e;window.matchMedia("(max-width: 768px)").matches?(s=this.renderer)==null||s.setFade(!1):(e=this.renderer)==null||e.setFade(!0)}beforeDestroy(){var s;(s=this.resizeObserver)==null||s.unobserve(this.canvas)}setScene(s){var e;(e=this.renderer)==null||e.setObjectScene(s)}onScrollTo(s){window.matchMedia("(max-width: 768px)").matches?window.scrollTo({left:0,top:this.canvasHeight+s-280,behavior:"smooth"}):window.matchMedia("(min-height: 850px)").matches?window.scrollTo({left:0,top:s-200,behavior:"smooth"}):window.scrollTo({left:0,top:s,behavior:"smooth"})}scrollToElementBottom(s){const e=s.getBoundingClientRect(),t=(window.scrollY||window.pageYOffset)+e.bottom-window.innerHeight;window.scrollTo({left:0,top:t,behavior:"smooth"})}get thumbs(){var s;return((s=this.configuratorService.defaults)==null?void 0:s.thumbs)??[]}};Vl([Ne()],On.prototype,"rating",2),Vl([dt("canvas")],On.prototype,"canvas",2),On=Vl([Qe({components:{ConfiguratorBox:Gr,ColorSwatch:Gl,Dimension:Vr,AddButton:An,Extra:Pn,ConfiguratorFrame:$u,InfoCircles:Ww}})],On);var Yw=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("configurator-frame",{attrs:{rating:s.rating,"configurator-service":s.configuratorService},scopedSlots:s._u([{key:"rightContentTop",fn:function(){return[e("div",[e("div",{staticClass:"info-circles-container desktop"},[e("info-circles",{attrs:{thumbs:s.thumbs,"is-vertical":!0}})],1),s._t("rightContentTop")],2)]},proxy:!0},{key:"rightContentBottom",fn:function(){return[s._t("rightContentBottom")]},proxy:!0},{key:"visualContent",fn:function(){return[e("div",{staticClass:"render-area"},[e("canvas",{ref:"canvas"}),e("div",{staticClass:"info-circles-container mobile"},[e("info-circles",{attrs:{thumbs:s.thumbs,"is-vertical":!1}})],1)])]},proxy:!0},{key:"price",fn:function(){return[s._t("price")]},proxy:!0}],null,!0)})},Zw=[],$w=ot(On,Yw,Zw,!1,null,null,null,null);const vd=$w.exports;var Kw=Object.defineProperty,Jw=Object.getOwnPropertyDescriptor,Ms=(s,e,t,i)=>{for(var r=i>1?void 0:i?Jw(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&Kw(e,t,r),r};let Ai=class extends As(nr){constructor(){super(),v(this,"editDrillIndex",null),v(this,"isAddingNewDrill",!1),v(this,"drillScene"),v(this,"scene",new ld),v(this,"editDrillConfig",null),v(this,"rating"),v(this,"boxList"),v(this,"newDrillComponent"),v(this,"addExtrasPopup"),v(this,"extrasInfoPopup"),v(this,"frame"),this.configuratorService=new Ss}onDrillConfigChanged(s){s&&this.drillScene&&this.drillScene.setConfig(s)}get surfaces(){var s;return(s=this.configuratorService.defaults)!=null&&s.surfaces?Object.values(this.configuratorService.defaults.surfaces):[]}get isInDrillMode(){return this.editDrillConfig!==null}getDrillError(s){if(this.configuratorService.errors&&this.configuratorService.errors.drills&&this.configuratorService.errors.drills.children){const e=Ls.first(Ls.where(this.configuratorService.errors.drills.children,{property:s.toString()}));return e?.children[0]}}async refresh(){var s;await((s=this.scene)==null?void 0:s.setConfig(this.configuratorService.configuration))}async preload(){this.scene=new ld,await this.scene.preload(),this.configuratorService.configuration&&await this.scene.setConfig(this.configuratorService.configuration)}start(){this.frame&&this.scene&&this.frame.setScene(this.scene)}addDeskplate(){this.configuratorService.configuration.with_board=!0}removeDeskplate(){this.configuratorService.configuration.with_board=!1}addDrill(){this.isInDrillMode||(this.isAddingNewDrill=!0,this.$nextTick(()=>{this.startEditDrill(this.newDrillComponent)}))}openAddExtraDialog(){this.addExtrasPopup.open()}openExtraInfoDialog(s){this.extrasInfoPopup.open(s.id)}addExtra(s){const e=new Xr;e.id=s.id,e.title=s.title,e.description=s.excerpt,this.configuratorService.configuration.extras.push(e)}async startEditDrill(s){var e,t;let i;if(this.drillScene=new ud(this.configuratorService.configuration),await this.drillScene.preload(),(e=this.frame)==null||e.setScene(this.drillScene),Number.isInteger(s)&&this.$refs.drills instanceof Array)i=this.$refs.drills.find(n=>n.$attrs["data-key"]==s.toString()),this.editDrillConfig=i.startEditDrill(),this.editDrillIndex=s;else{i=s;const n=ai(Mi,{title:"Bohrung",type:vs.Round,diameter:100,left:150,top:150});this.editDrillConfig=i.startEditDrill(n),this.editDrillIndex=null}const r=Zl(i.$el,this.boxList);(t=this.frame)==null||t.onScrollTo(r.y)}stopEditDrill(){var s,e;this.frame&&this.scene&&this.frame.setScene(this.scene),this.editDrillConfig=null,this.editDrillIndex=null,this.isAddingNewDrill=!1;const t=window.pageYOffset+this.boxList.getBoundingClientRect().top;(s=this.frame)==null||s.onScrollTo(t),(e=this.drillScene)==null||e.dispose(),this.drillScene=void 0}onSaveNewDrill(s){this.configuratorService.configuration.drills.push(s),this.stopEditDrill()}removeDrill(s){this.stopEditDrill(),this.configuratorService.configuration.drills.splice(s,1)}onRemoveExtra(s){this.configuratorService.configuration.extras.splice(s,1)}onFocused(s){var e;(e=this.scene)==null||e.toggleLineHighlight(s)}onBlur(){var s;(s=this.scene)==null||s.toggleLineHighlight()}async mounted(){await this.preload(),this.start()}};Ms([Ne()],Ai.prototype,"rating",2),Ms([dt()],Ai.prototype,"boxList",2),Ms([dt()],Ai.prototype,"newDrillComponent",2),Ms([dt()],Ai.prototype,"addExtrasPopup",2),Ms([dt()],Ai.prototype,"extrasInfoPopup",2),Ms([dt()],Ai.prototype,"frame",2),Ms([Ot("configuratorService.configuration",{deep:!0})],Ai.prototype,"refresh",1),Ai=Ms([Qe({components:{ConfiguratorBox:Gr,ColorSwatch:Gl,Dimension:Vr,SurfaceSelector:hd,AddButton:An,Drill:cd,Popup:qr,AddExtrasPopup:fd,ExtrasInfoPopup:gd,Extra:Pn,PriceBadge:xs,InteractiveConfiguratorFrame:vd}})],Ai);var Qw=function(){var s=this,e=s._self._c;return s._self._setupProxy,s.configuratorService.configuration?e("interactive-configurator-frame",{ref:"frame",attrs:{"configurator-service":s.configuratorService,rating:s.rating},scopedSlots:s._u([{key:"rightContentTop",fn:function(){var t,i,r,n,a,o,l,c,h,u,d,p,g,m,f,_,y,A,b,S,D,O,M;return[e("div",{ref:"boxList",staticClass:"box-list",class:{"is-focus":s.isInDrillMode}},[e("configurator-box",{attrs:{title:"Tischgestell"}},[e("div",{staticClass:"configurator-option"},[e("label",[s._v("Farbe")]),e("color-swatch",{attrs:{options:[{key:"black",title:"Schwarz",color:"#000"},{key:"white",title:"Wei\xDF",color:"#fff"},{key:"aluminum",title:"Aluminium",color:"#979796"}]},model:{value:s.configuratorService.configuration.color,callback:function(R){s.$set(s.configuratorService.configuration,"color",R)},expression:"configuratorService.configuration.color"}})],1),e("div",{staticClass:"price-result"},[e("price-badge",{attrs:{price:(i=(t=s.configuratorService.configuratorState)==null?void 0:t.price_groups)==null?void 0:i.item_price,"tax-info":(n=(r=s.configuratorService.configuratorState)==null?void 0:r.price_groups)==null?void 0:n.item_tax_info}})],1)]),e("configurator-box",{attrs:{title:"Tischplatte","is-addable":!s.configuratorService.configuration.with_board,"is-removable":s.configuratorService.configuration.with_board,"is-content-shown":s.configuratorService.configuration.with_board},on:{add:s.addDeskplate,remove:s.removeDeskplate}},[e("div",{staticClass:"configurator-option"},[e("label",[s._v("Oberfl\xE4che")]),e("surface-selector",{attrs:{surfaces:s.surfaces,error:s.configuratorService.errors.procurement_board_id},model:{value:s.configuratorService.configuration.procurement_board_id,callback:function(R){s.$set(s.configuratorService.configuration,"procurement_board_id",R)},expression:"configuratorService.configuration.procurement_board_id"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("L\xE4nge")]),e("dimension",{attrs:{error:s.configuratorService.errors.length,placeholder:"L\xE4nge w\xE4hlen"},on:{onFocus:function(R){return s.onFocused("length")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.length,callback:function(R){s.$set(s.configuratorService.configuration,"length",s._n(R))},expression:"configuratorService.configuration.length"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("Breite")]),e("dimension",{attrs:{error:s.configuratorService.errors.width,placeholder:"Breite w\xE4hlen"},on:{onFocus:function(R){return s.onFocused("width")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.width,callback:function(R){s.$set(s.configuratorService.configuration,"width",s._n(R))},expression:"configuratorService.configuration.width"}})],1),e("div",{staticClass:"price-result"},[e("price-badge",{attrs:{price:(l=(o=(a=s.configuratorService.configuratorState)==null?void 0:a.price_groups)==null?void 0:o.board_price)==null?void 0:l.item_price,"tax-info":(u=(h=(c=s.configuratorService.configuratorState)==null?void 0:c.price_groups)==null?void 0:h.board_price)==null?void 0:u.item_tax_info}})],1)]),((d=s.configuratorService.defaults)==null?void 0:d.has_extras)??!1?e("configurator-box",{attrs:{title:"Zubeh\xF6r","is-addable":!0,"is-content-shown":s.configuratorService.configuration.extras&&s.configuratorService.configuration.extras.length>0},on:{add:function(R){return s.openAddExtraDialog()}}},[e("add-extras-popup",{ref:"addExtrasPopup",on:{add:s.addExtra}}),e("extras-info-popup",{ref:"extrasInfoPopup"}),s._l(s.configuratorService.configuration.extras,function(R,N){var I,K,$,k,W,U,Z,Y;return e("div",{key:N,staticClass:"configurator-option"},[e("extra",{attrs:{extra:R,price:(k=($=(K=(I=s.configuratorService.configuratorState)==null?void 0:I.price_groups)==null?void 0:K.extra_prices)==null?void 0:$[N])==null?void 0:k.item_price,"tax-info":(Y=(Z=(U=(W=s.configuratorService.configuratorState)==null?void 0:W.price_groups)==null?void 0:U.extra_prices)==null?void 0:Z[N])==null?void 0:Y.item_tax_info},on:{remove:function(F){return s.onRemoveExtra(N)},info:function(F){return s.openExtraInfoDialog(R)}}})],1)})],2):s._e(),s.configuratorService.configuration.with_board&&((m=(g=(p=s.configuratorService.configuratorState)==null?void 0:p.price_groups)==null?void 0:g.board_price)!=null&&m.item_price||(_=(f=s.configuratorService.errors)==null?void 0:f.drills)!=null&&_.children&&!((y=s.configuratorService.errors)!=null&&y.length)&&!s.configuratorService.errors.width)?s._l(s.configuratorService.configuration.drills,function(R,N){var I,K,$,k,W,U,Z,Y,F,G;return e("configurator-box",{key:N,class:{"is-focused":N==s.editDrillIndex},attrs:{title:"Bohrung","is-addable":!1,"is-removable":!0,"is-content-shown":s.isInDrillMode||s.configuratorService.configuration.drills&&s.configuratorService.configuration.drills.length>0},on:{add:function(te){return s.addDrill()},remove:function(te){return s.removeDrill(N)}}},[e("div",{staticClass:"configurator-option"},[e("drill",{attrs:{"plate-config":s.configuratorService.configuration,error:s.getDrillError(N),price:(W=(k=($=(K=(I=s.configuratorService.configuratorState)==null?void 0:I.price_groups)==null?void 0:K.board_price)==null?void 0:$.drill_prices)==null?void 0:k[N])==null?void 0:W.total,"tax-info":(G=(F=(Y=(Z=(U=s.configuratorService.configuratorState)==null?void 0:U.price_groups)==null?void 0:Z.board_price)==null?void 0:Y.drill_prices)==null?void 0:F[N])==null?void 0:G.tax_info,"data-key":N,"plate-length":s.configuratorService.configuration.length,"display-right":!1},on:{edit:function(te){return s.startEditDrill(N)},save:s.stopEditDrill,cancel:function(te){return s.stopEditDrill()},drillConfigChanged:s.onDrillConfigChanged},model:{value:s.configuratorService.configuration.drills[N],callback:function(te){s.$set(s.configuratorService.configuration.drills,N,te)},expression:"configuratorService.configuration.drills[index]"}})],1)])}):s._e(),s.configuratorService.configuration.with_board&&((S=(b=(A=s.configuratorService.configuratorState)==null?void 0:A.price_groups)==null?void 0:b.board_price)!=null&&S.item_price||(O=(D=s.configuratorService.errors)==null?void 0:D.drills)!=null&&O.children&&!((M=s.configuratorService.errors)!=null&&M.length)&&!s.configuratorService.errors.width)?e("configurator-box",{class:{"is-focused":s.isAddingNewDrill},attrs:{title:"Bohrung","is-addable":!s.isInDrillMode,"is-removable":s.isInDrillMode,"is-content-shown":s.isInDrillMode},on:{add:function(R){return s.addDrill()},remove:function(R){return s.stopEditDrill()}}},[e("div",[s.isAddingNewDrill?e("div",{staticClass:"configurator-option"},[e("drill",{ref:"newDrillComponent",attrs:{"plate-config":s.configuratorService.configuration,"plate-length":s.configuratorService.configuration.length,"display-right":!1},on:{cancel:function(R){return s.stopEditDrill()},save:s.onSaveNewDrill,drillConfigChanged:s.onDrillConfigChanged}})],1):s._e()])]):s._e()],2)]},proxy:!0}],null,!1,390006242)}):s._e()},eS=[],tS=ot(Ai,Qw,eS,!1,null,null,null,null);const iS=tS.exports;let sS=class extends Ht{constructor(){super(),v(this,"models"),v(this,"thickness"),v(this,"adjustableHeight"),v(this,"minHeight",650),v(this,"maxHeight",1180),v(this,"isExtended"),v(this,"dimensioning"),v(this,"materials",{}),v(this,"plate"),v(this,"dimensioningLength"),v(this,"dimensioningLength2"),v(this,"dimensioningWidth"),v(this,"dimensioningWidth2"),v(this,"panel"),v(this,"highlightedLine"),this.type="HeightAdjustableCornerDesk",this.adjustableHeight=this.minHeight,this.thickness=25,this.castShadow=!0,this.receiveShadow=!0,this.adjustableHeight=this.minHeight,this.isExtended=!1}async preload(){const s=await Ft.getInstance().loadModel("height_adjustable_corner_desk.glb?v3");return s.scene.traverse(e=>{e instanceof Ie&&(e.scale.set(1e3,1e3,1e3),e.castShadow=!0,e.receiveShadow=!1)}),this.models=s.scene,await this.createObject(),this.createDimensioning(),super.preload()}async setConfig(s){await super.setConfig(s),await this.setConfigDesk(),this.setConfigDimensioning();const e=this.getObjectByName("frame"),t=this.getObjectByName("top"),i=this.getObjectByName("panel");if(e&&t&&i){const r=s.side===ke.Left?1:-1;e.scale.x=r,i.scale.x=1e3*r}}toggleLineHighlight(s){s===this.highlightedLine||!s&&!this.highlightedLine||(!s&&this.highlightedLine?(this.changeLineHighlight(this.highlightedLine,!1),this.highlightedLine=void 0):s&&!this.highlightedLine?(this.changeLineHighlight(s,!0),this.highlightedLine=s):this.highlightedLine&&s&&(this.changeLineHighlight(this.highlightedLine,!1),this.changeLineHighlight(s,!0),this.highlightedLine=s))}changeLineHighlight(s,e){var t;(t=this.dimensioning)==null||t.children.forEach(i=>{i instanceof Zi&&i.getDimensionLineName()===s&&i.toggleLineHighlight(e)})}dispose(){this.traverse(function(s){s instanceof Ie&&(s.geometry.dispose(),s.material&&s.material.dispose())})}async createObject(){const s=new Re,e=new Re;e.name="top",e.position.y=this.adjustableHeight,s.add(e),this.plate=new wl,await this.plate.preload(),this.plate.name="plate",this.plate.position.y=+this.thickness/2,e.add(this.plate);const t=this.models.getObjectByName("leg_bottom"),i=new Re;i.add(t.clone()),i.name="right_leg";const r=new Re;r.add(t.clone()),r.scale.x=-1,r.name="left_leg";const n=new Re;n.add(t.clone()),n.rotation.y=-Math.PI/2,n.name="third_leg",s.add(r),s.add(i),s.add(n);const a=this.models.getObjectByName("leg_middle"),o=new Re;o.add(a.clone()),o.name="right_leg_middle";const l=new Re;l.add(a.clone()),l.scale.x=-1,l.name="left_leg_middle";const c=new Re;c.add(a.clone()),c.rotation.y=-Math.PI/2,c.name="third_leg_middle";const h=new Re;h.name="middle_legs",h.position.y=this.minHeight,h.add(l),h.add(o),h.add(c),s.add(h);const u=this.models.getObjectByName("beam"),d=new Re;d.add(u.clone()),d.name="left_beam";const p=new Re;p.add(u.clone()),p.scale.x=-1,p.name="right_beam";const g=new Re;g.add(u.clone()),g.rotation.y=-Math.PI/2,g.name="third_beam";const m=new Re;m.add(d),m.add(p),m.add(g),m.name="beams",e.add(m),this.panel=this.models.getObjectByName("panel").clone(),e.add(this.panel);const f=this.models.getObjectByName("traverse_1").clone();f.name="traverse_right";const _=this.models.getObjectByName("traverse_2").clone();_.name="traverse_left";const y=this.models.getObjectByName("traverse_1").clone();y.rotation.y=-Math.PI/2,y.name="traverse_third_front";const A=this.models.getObjectByName("traverse_2").clone();A.rotation.y=-Math.PI/2,A.name="traverse_third_back",e.add(f),e.add(_),e.add(y),e.add(A);const b=this.models.getObjectByName("power_supply").clone();e.add(b),this.models.traverse(S=>{S instanceof Ie&&S.material.name==="black"?this.materials.black=S.material:S instanceof Ie&&S.material.name==="white"&&(this.materials.white=S.material)}),s.name="frame",this.add(s)}async setConfigDesk(){const s=this.currentConfig,e=new La;e.shape=Qt.E,e.length=s.length,e.width=s.width,e.length_2=s.length_2,e.width_2=s.width_2,e.radius=s.radius,e.thickness=this.thickness,e.procurement_board_id=s.procurement_board_id,e.drills=s.drills,e.side=ke.Left,await this.plate.setConfig(e),this.plate.visible=s.with_board;const t=100,i=Math.min(Math.max(s.length,1340),1940)/2-t;this.getObjectByName("left_beam").position.x=i,this.getObjectByName("left_beam").position.z=-(s.width-s.width_2)/2,this.getObjectByName("right_beam").position.x=-i,this.getObjectByName("right_beam").position.z=-(s.width-s.width_2)/2,this.getObjectByName("third_beam").position.x=-(s.length-s.length_2)/2,this.getObjectByName("third_beam").position.z=s.width/2-t,this.getObjectByName("left_leg").position.x=-i,this.getObjectByName("left_leg").position.z=-(s.width-s.width_2)/2,this.getObjectByName("right_leg").position.x=i,this.getObjectByName("right_leg").position.z=-(s.width-s.width_2)/2,this.getObjectByName("third_leg").position.x=-(s.length-s.length_2)/2,this.getObjectByName("third_leg").position.z=s.width/2-t,this.getObjectByName("left_leg_middle").position.x=-i,this.getObjectByName("left_leg_middle").position.z=-(s.width-s.width_2)/2,this.getObjectByName("right_leg_middle").position.x=i,this.getObjectByName("right_leg_middle").position.z=-(s.width-s.width_2)/2,this.getObjectByName("third_leg_middle").position.x=-(s.length-s.length_2)/2,this.getObjectByName("third_leg_middle").position.z=s.width/2-t,this.getObjectByName("traverse_right").position.x=i,this.getObjectByName("traverse_right").position.z=-(s.width-s.width_2)/2,this.getObjectByName("traverse_left").position.x=-i,this.getObjectByName("traverse_left").position.z=-(s.width-s.width_2)/2,this.getObjectByName("traverse_third_front").position.x=-(s.length-s.length_2)/2,this.getObjectByName("traverse_third_front").position.z=s.width/2-t,this.getObjectByName("traverse_third_back").position.x=-(s.length-s.length_2)/2,this.getObjectByName("traverse_third_back").position.z=-(s.width-s.width_2)/2-269+60,this.getObjectByName("power_supply").position.x=-s.length/4,this.getObjectByName("power_supply").position.z=-(s.width-s.width_2)/2-s.width_2/4,this.panel.position.z=-s.width/2+s.width_2,this.panel.position.x=s.length/2-t*2,s.color&&this.traverse(r=>{r instanceof Ie&&r.material.userData.metal_material&&r.material.userData.metal_material==="true"&&r.material.name!==s.color&&(r.material=this.materials[s.color])})}setConfigDimensioning(){var s,e,t,i;const r=this.currentConfig.length,n=this.currentConfig.width,a=this.currentConfig.length_2,o=this.currentConfig.width_2,l=this.currentConfig.side===ke.Left?1:-1;(s=this.dimensioningLength)==null||s.setConfig(new L((-r/2-50)*l,this.adjustableHeight+50,-n/2-50),new L((r/2+50)*l,this.adjustableHeight+50,-n/2-50),Math.floor(r),"L\xE4nge"),(e=this.dimensioningWidth)==null||e.setConfig(new L((-r/2-50)*l,this.adjustableHeight+50,-n/2-50),new L((-r/2-50)*l,this.adjustableHeight+50,n/2+50),Math.floor(n),"Breite"),(t=this.dimensioningLength2)==null||t.setConfig(new L((-r/2-50)*l,this.adjustableHeight+50,n/2+50),new L((-r/2+a)*l,this.adjustableHeight+50,n/2+50),Math.floor(a),"L\xE4nge 2"),(i=this.dimensioningWidth2)==null||i.setConfig(new L((r/2+50)*l,this.adjustableHeight+50,-n/2-50),new L((r/2+50)*l,this.adjustableHeight+50,-n/2+o),Math.floor(o),"Breite 2"),this.highlightedLine&&this.changeLineHighlight(this.highlightedLine,!0)}getPanelObject(){return this.panel}toggleHeight(){this.setAdjustableHeight(this.isExtended?this.minHeight:1100),this.isExtended=!this.isExtended}setAdjustableHeight(s){s=Math.max(this.minHeight,Math.min(this.maxHeight,s));const e=this.getObjectByName("top"),t=this.getObjectByName("middle_legs");new bn(this).to({adjustableHeight:s},5e3).onUpdate(i=>{e.position.y=this.adjustableHeight,t.position.y=this.minHeight+(this.adjustableHeight-this.minHeight)/2,this.setConfigDimensioning()}).start()}getCenter(){return this.adjustableHeight/2}getZoom(){return 1e3}createDimensioning(){this.dimensioning=new rt,this.dimensioningLength=new Zi("length"),this.dimensioningWidth=new Zi("width"),this.dimensioningLength2=new Zi("length_2"),this.dimensioningWidth2=new Zi("width_2"),this.dimensioning.add(this.dimensioningLength),this.dimensioning.add(this.dimensioningWidth),this.dimensioning.add(this.dimensioningLength2),this.dimensioning.add(this.dimensioningWidth2)}getDimensioning(){return this.dimensioning}};class _d extends ji{constructor(){super(),v(this,"desk"),v(this,"currentConfig")}async preload(){return this.desk=new sS,await this.desk.preload(),this.group.add(this.desk),super.preload()}async setConfig(e){e&&(await this.desk.setConfig(e),this.currentConfig=e)}toggleLineHighlight(e){this.desk.toggleLineHighlight(e)}getCenter(){var e;return(e=this.desk)==null?void 0:e.getCenter()}getZoom(){var e;return(e=this.desk)==null?void 0:e.getZoom()}dispose(){this.group.clear(),this.desk&&this.desk.dispose()}getPossibleInteraction(e){if(this.desk){const t=this.desk.getPanelObject();if(e.length>0&&e[0].object===t)return"H\xF6he umstellen"}}triggerInteraction(e,t){if(this.desk){const i=this.desk.getPanelObject();t==="click"&&e.length>0&&e[0].object===i&&this.desk.toggleHeight()}}getDimensioning(){var e;return(e=this.desk)==null?void 0:e.getDimensioning()}getRenderDimensioningActive(){var e;return((e=this.currentConfig)==null?void 0:e.with_board)??!1}update(e){}}var rS=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,Wl=(s,e,t,i)=>{for(var r=i>1?void 0:i?nS(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&rS(e,t,r),r};let Nn=class extends Je{constructor(){super(...arguments),v(this,"options"),v(this,"selected")}setItem(s){this.selected=s}isActive(s){return this.selected===s}};Wl([Ne({type:Array,required:!0})],Nn.prototype,"options",2),Wl([jn()],Nn.prototype,"selected",2),Nn=Wl([Qe],Nn);var aS=function(){var s=this,e=s._self._c;return s._self._setupProxy,e("div",{staticClass:"toggle-button-group"},s._l(s.options,function(t,i){return e("button",{key:i,class:{active:s.isActive(t.value)},on:{click:function(r){return s.setItem(t.value)}}},[s._v(" "+s._s(t.name)+" ")])}),0)},oS=[],lS=ot(Nn,aS,oS,!1,null,"3781d86c",null,null);const hS=lS.exports;var cS=Object.defineProperty,uS=Object.getOwnPropertyDescriptor,Ts=(s,e,t,i)=>{for(var r=i>1?void 0:i?uS(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&cS(e,t,r),r};let Li=class extends As(nr){constructor(){super(),v(this,"SpecialSide",ke),v(this,"editDrillIndex",null),v(this,"isAddingNewDrill",!1),v(this,"drillScene"),v(this,"scene",new _d),v(this,"editDrillConfig",null),v(this,"rating"),v(this,"boxList"),v(this,"newDrillComponent"),v(this,"addExtrasPopup"),v(this,"extrasInfoPopup"),v(this,"frame"),this.configuratorService=new Ss}onDrillConfigChanged(s){s&&this.drillScene&&this.drillScene.setConfig(s)}get surfaces(){var s;return(s=this.defaults)!=null&&s.surfaces?Object.values(this.defaults.surfaces):[]}get isInDrillMode(){return this.editDrillConfig!==null}getDrillError(s){if(this.configuratorService.errors&&this.configuratorService.errors.drills&&this.configuratorService.errors.drills.children){const e=Ls.first(Ls.where(this.configuratorService.errors.drills.children,{property:s.toString()}));return e?.children[0]}}get displayRight(){var s;return((s=this.configuratorService.configuration)==null?void 0:s.side)===ke.Right}async refresh(){var s;await((s=this.scene)==null?void 0:s.setConfig(this.configuratorService.configuration))}async preload(){this.scene=new _d,await this.scene.preload(),this.configuratorService.configuration&&await this.scene.setConfig(this.configuratorService.configuration)}start(){this.frame&&this.scene&&this.frame.setScene(this.scene)}addDeskplate(){this.configuratorService.configuration.with_board=!0}removeDeskplate(){this.configuratorService.configuration.with_board=!1}addDrill(){this.isInDrillMode||(this.isAddingNewDrill=!0,this.$nextTick(()=>{this.startEditDrill(this.newDrillComponent)}))}openAddExtraDialog(){this.addExtrasPopup.open()}openExtraInfoDialog(s){this.extrasInfoPopup.open(s.id)}addExtra(s){const e=new Xr;e.id=s.id,e.title=s.title,e.description=s.excerpt,this.configuratorService.configuration.extras.push(e)}async startEditDrill(s){var e,t;let i;if(this.drillScene=new ud(this.configuratorService.configuration),await this.drillScene.preload(),(e=this.frame)==null||e.setScene(this.drillScene),Number.isInteger(s)&&this.$refs.drills instanceof Array)i=this.$refs.drills.find(n=>n.$attrs["data-key"]==s.toString()),this.editDrillConfig=i.startEditDrill(),this.editDrillIndex=s;else{i=s;const n=ai(Mi,{title:"Bohrung",type:vs.Round,diameter:100,left:150,right:this.configuratorService.configuration.length-150,top:150});this.editDrillConfig=i.startEditDrill(n),this.editDrillIndex=null}const r=Zl(i.$el,this.boxList);(t=this.frame)==null||t.onScrollTo(r.y)}stopEditDrill(){var s,e;this.frame&&this.scene&&this.frame.setScene(this.scene),this.editDrillConfig=null,this.editDrillIndex=null,this.isAddingNewDrill=!1;const t=window.pageYOffset+this.boxList.getBoundingClientRect().top;(s=this.frame)==null||s.onScrollTo(t),(e=this.drillScene)==null||e.dispose(),this.drillScene=void 0}onSaveNewDrill(s){this.configuratorService.configuration.drills.push(s),this.stopEditDrill()}removeDrill(s){this.stopEditDrill(),this.configuratorService.configuration.drills.splice(s,1)}onRemoveExtra(s){this.configuratorService.configuration.extras.splice(s,1)}onFocused(s){var e;(e=this.scene)==null||e.toggleLineHighlight(s)}onBlur(){var s;(s=this.scene)==null||s.toggleLineHighlight()}async mounted(){await this.preload(),this.start()}};Ts([Ne()],Li.prototype,"rating",2),Ts([dt()],Li.prototype,"boxList",2),Ts([dt()],Li.prototype,"newDrillComponent",2),Ts([dt()],Li.prototype,"addExtrasPopup",2),Ts([dt()],Li.prototype,"extrasInfoPopup",2),Ts([dt()],Li.prototype,"frame",2),Ts([Ot("configuratorService.configuration",{deep:!0})],Li.prototype,"refresh",1),Li=Ts([Qe({components:{ConfiguratorBox:Gr,ColorSwatch:Gl,Dimension:Vr,SurfaceSelector:hd,AddButton:An,Drill:cd,Popup:qr,AddExtrasPopup:fd,ExtrasInfoPopup:gd,Extra:Pn,PriceBadge:xs,InteractiveConfiguratorFrame:vd,ToggleButton:hS}})],Li);var dS=function(){var s=this,e=s._self._c;return s._self._setupProxy,s.configuratorService.configuration?e("interactive-configurator-frame",{ref:"frame",attrs:{"configurator-service":s.configuratorService,rating:s.rating,defaults:s.defaults},scopedSlots:s._u([{key:"rightContentTop",fn:function(){var t,i,r,n,a,o,l,c,h,u,d,p,g,m,f,_,y,A,b,S,D,O,M,R,N;return[e("div",{ref:"boxList",staticClass:"box-list",class:{"is-focus":s.isInDrillMode}},[e("configurator-box",{attrs:{title:"Tischgestell"}},[e("div",{staticClass:"configurator-option"},[e("label",[s._v("Farbe")]),e("color-swatch",{attrs:{options:[{key:"black",title:"Schwarz",color:"#000"},{key:"white",title:"Wei\xDF",color:"#fff"}]},model:{value:s.configuratorService.configuration.color,callback:function(I){s.$set(s.configuratorService.configuration,"color",I)},expression:"configuratorService.configuration.color"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("Seite")]),e("toggle-button",{attrs:{options:[{value:s.SpecialSide.Left,name:"Links"},{value:s.SpecialSide.Right,name:"Rechts"}]},model:{value:s.configuratorService.configuration.side,callback:function(I){s.$set(s.configuratorService.configuration,"side",I)},expression:"configuratorService.configuration.side"}})],1),e("div",{staticClass:"price-result"},[e("price-badge",{attrs:{price:(i=(t=s.configuratorService.configuratorState)==null?void 0:t.price_groups)==null?void 0:i.item_price,"tax-info":(n=(r=s.configuratorService.configuratorState)==null?void 0:r.price_groups)==null?void 0:n.item_tax_info}})],1)]),e("configurator-box",{attrs:{title:"Tischplatte","is-addable":!s.configuratorService.configuration.with_board,"is-removable":s.configuratorService.configuration.with_board,"is-content-shown":s.configuratorService.configuration.with_board},on:{add:s.addDeskplate,remove:s.removeDeskplate}},[e("div",{staticClass:"configurator-option"},[e("label",[s._v("Oberfl\xE4che")]),e("surface-selector",{attrs:{surfaces:s.surfaces,error:s.configuratorService.errors.procurement_board_id},model:{value:s.configuratorService.configuration.procurement_board_id,callback:function(I){s.$set(s.configuratorService.configuration,"procurement_board_id",I)},expression:"configuratorService.configuration.procurement_board_id"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("St\xE4rke")]),e("div",{staticClass:"dimension",staticStyle:{"text-align":"right",width:"100%","padding-right":"10px","align-self":"center"}},[s._v(" 25 mm ")])]),e("div",{staticClass:"configurator-option"},[e("label",[s._v("L\xE4nge")]),e("dimension",{attrs:{error:s.configuratorService.errors.length,placeholder:"L\xE4nge w\xE4hlen"},on:{onFocus:function(I){return s.onFocused("length")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.length,callback:function(I){s.$set(s.configuratorService.configuration,"length",s._n(I))},expression:"configuratorService.configuration.length"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("Breite")]),e("dimension",{attrs:{error:s.configuratorService.errors.width,placeholder:"Breite w\xE4hlen"},on:{onFocus:function(I){return s.onFocused("width")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.width,callback:function(I){s.$set(s.configuratorService.configuration,"width",s._n(I))},expression:"configuratorService.configuration.width"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("L\xE4nge 2")]),e("dimension",{attrs:{error:s.configuratorService.errors.length_2,placeholder:"L\xE4nge 2 w\xE4hlen"},on:{onFocus:function(I){return s.onFocused("length_2")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.length_2,callback:function(I){s.$set(s.configuratorService.configuration,"length_2",s._n(I))},expression:"configuratorService.configuration.length_2"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("Breite 2")]),e("dimension",{attrs:{error:s.configuratorService.errors.width_2,placeholder:"Breite 2 w\xE4hlen"},on:{onFocus:function(I){return s.onFocused("width_2")},onBlur:s.onBlur},model:{value:s.configuratorService.configuration.width_2,callback:function(I){s.$set(s.configuratorService.configuration,"width_2",s._n(I))},expression:"configuratorService.configuration.width_2"}})],1),e("div",{staticClass:"configurator-option"},[e("label",[s._v("Radius")]),e("dimension",{attrs:{error:s.configuratorService.errors.radius,placeholder:"Radius w\xE4hlen"},model:{value:s.configuratorService.configuration.radius,callback:function(I){s.$set(s.configuratorService.configuration,"radius",s._n(I))},expression:"configuratorService.configuration.radius"}})],1),e("div",{staticClass:"price-result"},[e("price-badge",{attrs:{price:(l=(o=(a=s.configuratorService.configuratorState)==null?void 0:a.price_groups)==null?void 0:o.board_price)==null?void 0:l.item_price,"tax-info":(u=(h=(c=s.configuratorService.configuratorState)==null?void 0:c.price_groups)==null?void 0:h.board_price)==null?void 0:u.item_tax_info}})],1)]),((d=s.defaults)==null?void 0:d.has_extras)??!1?e("configurator-box",{attrs:{title:"Zubeh\xF6r","is-addable":!0,"is-content-shown":s.configuratorService.configuration.extras&&s.configuratorService.configuration.extras.length>0},on:{add:function(I){return s.openAddExtraDialog()}}},[e("add-extras-popup",{ref:"addExtrasPopup",on:{add:s.addExtra}}),e("extras-info-popup",{ref:"extrasInfoPopup"}),s._l(s.configuratorService.configuration.extras,function(I,K){var $,k,W,U,Z,Y,F,G;return e("div",{key:K,staticClass:"configurator-option"},[e("extra",{attrs:{extra:I,price:(U=(W=(k=($=s.configuratorService.configuratorState)==null?void 0:$.price_groups)==null?void 0:k.extra_prices)==null?void 0:W[K])==null?void 0:U.item_price,"tax-info":(G=(F=(Y=(Z=s.configuratorService.configuratorState)==null?void 0:Z.price_groups)==null?void 0:Y.extra_prices)==null?void 0:F[K])==null?void 0:G.item_tax_info},on:{remove:function(te){return s.onRemoveExtra(K)},info:function(te){return s.openExtraInfoDialog(I)}}})],1)})],2):s._e(),s.configuratorService.configuration.with_board&&((m=(g=(p=s.configuratorService.configuratorState)==null?void 0:p.price_groups)==null?void 0:g.board_price)!=null&&m.item_price||(_=(f=s.configuratorService.errors)==null?void 0:f.drills)!=null&&_.children&&!((y=s.configuratorService.errors)!=null&&y.length)&&!s.configuratorService.errors.width&&!((A=s.configuratorService.errors)!=null&&A.length_2)&&!s.configuratorService.errors.width_2&&!((b=s.configuratorService.errors)!=null&&b.radius))?s._l(s.configuratorService.configuration.drills,function(I,K){var $,k,W,U,Z,Y,F,G,te,X;return e("configurator-box",{key:K,class:{"is-focused":K==s.editDrillIndex},attrs:{title:"Bohrung","is-addable":!1,"is-removable":!0,"is-content-shown":s.isInDrillMode||s.configuratorService.configuration.drills&&s.configuratorService.configuration.drills.length>0},on:{add:function(ie){return s.addDrill()},remove:function(ie){return s.removeDrill(K)}}},[e("div",{staticClass:"configurator-option"},[e("drill",{ref:"drills",refInFor:!0,attrs:{"plate-config":s.configuratorService.configuration,error:s.getDrillError(K),price:(Z=(U=(W=(k=($=s.configuratorService.configuratorState)==null?void 0:$.price_groups)==null?void 0:k.board_price)==null?void 0:W.drill_prices)==null?void 0:U[K])==null?void 0:Z.item_price,"tax-info":(X=(te=(G=(F=(Y=s.configuratorService.configuratorState)==null?void 0:Y.price_groups)==null?void 0:F.board_price)==null?void 0:G.drill_prices)==null?void 0:te[K])==null?void 0:X.item_tax_info,"data-key":K,"plate-length":s.configuratorService.configuration.length,"display-right":s.displayRight},on:{edit:function(ie){return s.startEditDrill(K)},save:s.stopEditDrill,cancel:function(ie){return s.stopEditDrill()},drillConfigChanged:s.onDrillConfigChanged},model:{value:s.configuratorService.configuration.drills[K],callback:function(ie){s.$set(s.configuratorService.configuration.drills,K,ie)},expression:"configuratorService.configuration.drills[index]"}})],1)])}):s._e(),s.configuratorService.configuration.with_board&&((O=(D=(S=s.configuratorService.configuratorState)==null?void 0:S.price_groups)==null?void 0:D.board_price)!=null&&O.item_price||(R=(M=s.configuratorService.errors)==null?void 0:M.drills)!=null&&R.children&&!((N=s.configuratorService.errors)!=null&&N.length)&&!s.configuratorService.errors.width)?e("configurator-box",{class:{"is-focused":s.isAddingNewDrill},attrs:{title:"Bohrung","is-addable":!s.isInDrillMode,"is-removable":s.isInDrillMode,"is-content-shown":s.isInDrillMode},on:{add:function(I){return s.addDrill()},remove:function(I){return s.stopEditDrill()}}},[e("div",[s.isAddingNewDrill?e("div",{staticClass:"configurator-option"},[e("drill",{ref:"newDrillComponent",attrs:{"plate-config":s.configuratorService.configuration,"plate-length":s.configuratorService.configuration.length,"display-right":s.displayRight},on:{cancel:function(I){return s.stopEditDrill()},save:s.onSaveNewDrill,drillConfigChanged:s.onDrillConfigChanged}})],1):s._e()])]):s._e()],2),void 0]},proxy:!0}],null,!1,1066161561)}):s._e()},pS=[],fS=ot(Li,dS,pS,!1,null,null,null,null);const mS=fS.exports;var gS=Object.defineProperty,vS=Object.getOwnPropertyDescriptor,_S=(s,e,t,i)=>{for(var r=i>1?void 0:i?vS(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&gS(e,t,r),r};Je.use(bd),Je.use(Vd),Je.use(wd,to);let zn=0;to.interceptors.request.use(s=>(zn++,s),s=>(zn--,Promise.reject(s))),to.interceptors.response.use(s=>(zn--,s),s=>(zn--,Promise.reject(s))),window.isAnyRequestActive=()=>zn>0;let ql=class extends Je{};ql=_S([Qe({components:{Sample:lw,HeightAdjustableDesk:iS,HeightAdjustableCornerDesk:mS}})],ql);let Xl;jQuery(()=>{jQuery("#configurator").length>0?!Xl&&jQuery("#configurator").length>0&&(jQuery(document.body).append(jQuery('<div id="portal">')),Xl=new ql,Xl.$mount("#configurator")):jQuery("form.cart").closest(".product").each(function(){new lx(this).initialize()})});
