diff --git a/src/assets/fengmap/fengmap.analyser.min.js b/src/assets/fengmap/fengmap.analyser.min.js new file mode 100644 index 0000000..7910efa --- /dev/null +++ b/src/assets/fengmap/fengmap.analyser.min.js @@ -0,0 +1,2 @@ +// /**Released Version v3.1.10,BUILD 236,Time 1749031420367. Fengmap Javascript SDK es6, see: https://www.fengmap.com for details**/ +var L={VERSION:"v3.1.10",BUILD:236};let t={NONE:0,EXTRUDE_MARKER:2,FM3DTILE_LAYER:4,IMAGE_MARKER:8,LOCATION_MARKER:16,POLYGON_MARKER:32,TEXT_MARKER:64,LINE_MARKER:128,LINE3D_MARKER:256,HEAT_MAP_MARKER:512,EXTENT:1024,EXTERNAL_MODEL:2048,MODEL:4096,FACILITY:8192,LABEL:16384,DYNAMIC_MODEL_MARKER:32768,DOM_MARKER:65536,SPHERE_MARKER:1<<17,CAD_LAYER:1<<18,EXTENT_LAYER:1<<20,EXTERNAL_MODEL_LAYER:1<<21,MODEL_LAYER:1<<22,FACILITY_LAYER:1<<23,LABEL_LAYER:1<<24,MARKER_GROUP:1<<25,FLOW_LINE_LAYER:1<<27,FLOW_LINE_MARKER:1<<27,FIRE_MARKER:1<<28,WALL_MARKER:1<<29,TUBE_MARKER:1<<30},f=(t.LAYER_NODE_TYPE=new Map,t.LAYER_NODE_TYPE.set(t.EXTENT_LAYER,t.EXTENT),t.LAYER_NODE_TYPE.set(t.EXTERNAL_MODEL_LAYER,t.EXTERNAL_MODEL),t.LAYER_NODE_TYPE.set(t.MODEL_LAYER,t.MODEL),t.LAYER_NODE_TYPE.set(t.FACILITY_LAYER,t.FACILITY),t.LAYER_NODE_TYPE.set(t.LABEL_LAYER,t.LABEL),t.LAYER_NODE_TYPE.set(t.DOM_MARKER,t.DOM_MARKER),t.LAYER_NODE_TYPE.set(t.DYNAMIC_MODEL_MARKER,t.DYNAMIC_MODEL_MARKER),t.LAYER_NODE_TYPE.set(t.EXTRUDE_MARKER,t.EXTRUDE_MARKER),t.LAYER_NODE_TYPE.set(t.HEAT_MAP_MARKER,t.HEAT_MAP_MARKER),t.LAYER_NODE_TYPE.set(t.LINE_MARKER,t.LINE_MARKER),t.LAYER_NODE_TYPE.set(t.LOCATION_MARKER,t.LOCATION_MARKER),t.LAYER_NODE_TYPE.set(t.POLYGON_MARKER,t.POLYGON_MARKER),t.LAYER_NODE_TYPE.set(t.TEXT_MARKER,t.TEXT_MARKER),t.LAYER_NODE_TYPE.set(t.IMAGE_MARKER,t.IMAGE_MARKER),t.LAYER_NODE_TYPE.set(t.FLOW_LINE_LAYER,t.FLOW_LINE_MARKER),t.LAYER_NODE_TYPE.set(t.FIRE_MARKER,t.FIRE_MARKER),t.LAYER_NODE_TYPE.set(t.WALL_MARKER,t.WALL_MARKER),t.LAYER_NODE_TYPE.set(t.TUBE_MARKER,t.TUBE_MARKER),t.LAYER_NODE_TYPE.set(t.LINE3D_MARKER,t.LINE3D_MARKER),t.LAYER_NODE_TYPE.set(t.SPHERE_MARKER,t.SPHERE_MARKER),t.LAYER_NODE_TYPE.set(t.CAD_LAYER,t.CAD_LAYER),{MODULE_SHORTEST:1,MODULE_BEST:2}),p={PRIORITY_DEFAULT:1,PRIORITY_LIFTFIRST:2,PRIORITY_ESCALATORFIRST:3,PRIORITY_STAIRFIRST:4,PRIORITY_LIFTONLY:5,PRIORITY_ESCALATORONLY:6,PRIORITY_STAIRONLY:7,PRIORITY_ACCESSIBLEONLY:8,PRIORITY_LIFTFIRST1:9,PRIORITY_ESCALATORFIRST1:10,PRIORITY_STAIRFIRST1:11},F={ROUTE_SUCCESS:1,ROUTE_FAILED_NO_DATA_START:2,ROUTE_FAILED_NO_DATA_DEST:3,ROUTE_FAILED_CANNOT_ARRIVE:4,ROUTE_FAILED_WAYPOINT_CALCULATE_ERROR:5,ROUTE_FAILED_NO_START_ARRIVAL:6,ROUTE_FAILED_NO_DEST_ARRIVAL:7,ROUTE_FAILED_OUTLINE:8,ROUTE_FAILED_ENTRANCE:9},s={ZH:"zh",EN:"en"},a={TRANSFER_LIFT:1,TRANSFER_STAIR:2,TRANSFER_ESCALATOR:3,TRANSFER_ACCESSIBLE:4,TRANSFER_RAMP:5,TRANSFER_ENTRANCE:6},D={NONE_RODE_NETWORK:1,NONE_WALK_RODE_NETWORK:2,NONE_DRIVE_RODE_NETWORK:4};class i{constructor(t,i){this.t=t,this.o=i}}Object.assign(i.prototype,{u(t){return!1},v(t,i){}});class S extends i{constructor(t,i){super(t,i)}}Object.assign(S.prototype,{u(t){return Array.isArray(this.o)?-1!=this.o.indexOf(t.fid):this.o===t.fid}});class B extends i{constructor(t,i){super(t,i),this.p=null,"object"==typeof this.o?(this._=this.o.text,this.M=this.o.fuzzy,this.R=void 0===this.o.matchCase||this.o.matchCase):(this._=this.o,this.R=!0)}}Object.assign(B.prototype,{u(t){let i=null;return i="ename"===this.p?t.ename:t.name,this._=this._.trim(),!!i&&(this.M?(t=this._.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=this._.replace(/%rn%/g,".*"),new RegExp(t,this.R?"":"i").test(i&&i.replace(/%rn%/g,".*"))):this.R?i&&this._===i:i&&this._.toLowerCase()===i.toLowerCase())}});class C extends B{constructor(t,i){super(t,i),this.p="name"}}class Z extends B{constructor(t,i){super(t,i),this.p="ename"}}class W extends i{constructor(t,i){super(t),this.o=Array.isArray(i)?i:[i]}}Object.assign(W.prototype,{u(t){return-1!=this.o.indexOf(t.type)}});class U extends i{constructor(t,i){super(t,i),"object"==typeof this.o?(this._=this.o.text,this.M=void 0===this.o.fuzzy||this.o.fuzzy,this.R=void 0===this.o.matchCase||this.o.matchCase):(this._=this.o,this.M=!0,this.R=!0)}}Object.assign(U.prototype,{u(t){var i=null,e=null,i=t.name,e=t.ename;return this._=this._.trim(),this.M?(t=this._.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=this._.replace(/%rn%/g,".*"),(t=new RegExp(t,this.R?"":"i")).test(i&&i.replace(/%rn%/g,".*"))||t.test(e&&e.replace(/%rn%/g,".*"))):this.R?i&&this._===i||e&&this._===e:i&&this._.toLowerCase()===i.toLowerCase()||e&&this._.toLowerCase()===e.toLowerCase()}});let y={NONE:0,POINT:1,LINE:2,POLYGON:4,MULTIPOINT:8,MULTILINE:16,MULTIPOLYGON:32,GROUP:64,EXTENT:1024,EXTERNALMODEL:2048,MODEL:4096,FACILITY:8192,LABEL:16384,EXTENTGROUP:1<<20,EXTERNALMODELGROUP:1<<21,MODELGROUP:1<<22,FACILITYGROUP:1<<23,LABELGROUP:1<<24},q=(Object.freeze(y),{triangulate:function(a,o,l){l=l||2;var u=o&&o.length,f=u?o[0]*l:a.length;let d=Y(a,0,f,l,!0);var c=[];if(d&&d.next!==d.prev){let i,e,r,s,n,h,t;if(u&&(d=$(a,o,d,l)),a.length>80*l){i=r=a[0],e=s=a[1];for(let t=l;tr&&(r=n),h>s&&(s=h);t=0!==(t=Math.max(r-i,s-e))?1/t:0}X(d,c,l,i,e,t)}return c}});function Y(t,i,e,r,s){let n,h;if(s===0=i;n-=r)h=bt(n,t[n],t[n+1],h);return h&&ut(h,h.next)&&(gt(h),h=h.next),h}function z(t,i){if(!t)return t;i=i||t;let e=t,r;do{if(r=!1,e.steiner||!ut(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(gt(e),(e=i=e.prev)===e.next)break;r=!0}}while(r||e!==i);return i}function X(r,s,n,h,a,o,l){if(r){!l&&o&&st(r,h,a,o);let t=r,i,e;for(;r.prev!==r.next;)if(i=r.prev,e=r.next,o?Q(r,h,a,o):H(r))s.push(i.i/n),s.push(r.i/n),s.push(e.i/n),gt(r),r=e.next,t=e.next;else if((r=e)===t){l?1===l?X(r=K(z(r),s,n),s,n,h,a,o,2):2===l&&J(r,s,n,h,a,o):X(z(r),s,n,h,a,o,1);break}}}function H(t){var i=t.prev,e=t,r=t.next;if(0<=_(i,e,r))return!1;let s=t.next.next;for(;s!==t.prev;){if(ot(i.x,i.y,e.x,e.y,r.x,r.y,s.x,s.y)&&0<=_(s.prev,s,s.next))return!1;s=s.next}return!0}function Q(t,i,e,r){var s=t.prev,n=t,h=t.next;if(0<=_(s,n,h))return!1;var a=(s.xn.x?s.x>h.x?s:h:n.x>h.x?n:h).x,u=(s.y>n.y?s.y>h.y?s:h:n.y>h.y?n:h).y,f=ht(a,o,i,e,r),d=ht(l,u,i,e,r);let c=t.prevZ,v=t.nextZ;for(;c&&c.z>=f&&v&&v.z<=d;){if(c!==t.prev&&c!==t.next&&ot(s.x,s.y,n.x,n.y,h.x,h.y,c.x,c.y)&&0<=_(c.prev,c,c.next))return!1;if(c=c.prevZ,v!==t.prev&&v!==t.next&&ot(s.x,s.y,n.x,n.y,h.x,h.y,v.x,v.y)&&0<=_(v.prev,v,v.next))return!1;v=v.nextZ}for(;c&&c.z>=f;){if(c!==t.prev&&c!==t.next&&ot(s.x,s.y,n.x,n.y,h.x,h.y,c.x,c.y)&&0<=_(c.prev,c,c.next))return!1;c=c.prevZ}for(;v&&v.z<=d;){if(v!==t.prev&&v!==t.next&&ot(s.x,s.y,n.x,n.y,h.x,h.y,v.x,v.y)&&0<=_(v.prev,v,v.next))return!1;v=v.nextZ}return!0}function K(t,i,e){let r=t;do{var s=r.prev,n=r.next.next;!ut(s,n)&&ft(s,r,r.next,n)&&pt(s,n)&&pt(n,s)&&(i.push(s.i/e),i.push(r.i/e),i.push(n.i/e),gt(r),gt(r.next),r=t=n),r=r.next}while(r!==t);return z(r)}function J(t,i,e,r,s,n){let h=t;do{let t=h.next.next;for(;t!==h.prev;){var a;if(h.i!==t.i&<(h,t))return a=_t(h,t),h=z(h,h.next),a=z(a,a.next),X(h,i,e,r,s,n),void X(a,i,e,r,s,n);t=t.next}}while((h=h.next)!==t)}function $(t,i,e,r){var s=[];let n,h,a,o,l;for(n=0,h=i.length;n=r.next.y&&r.next.y!==r.y){var i=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(i<=s&&i>h){if((h=i)===s){if(n===r.y)return r;if(n===r.next.y)return r.next}a=r.x=r.x&&r.x>=l&&s!==r.x&&ot(na.x||r.x===a.x&&rt(a,r)))&&(a=r,t=i),(r=r.next)!==o;);}return a}function rt(t,i){return _(t.prev,t,i.prev)<0&&_(i.next,t,t.next)<0}function st(t,i,e,r){let s=t;for(;null===s.z&&(s.z=ht(s.x,s.y,i,e,r)),s.prevZ=s.prev,s.nextZ=s.next,(s=s.next)!==t;);s.prevZ.nextZ=null,s.prevZ=null,nt(s)}function nt(t){let i,e,r,s,n,h,a,o,l=1;do{for(e=t,t=null,n=null,h=0;e;){for(h++,r=e,a=0,i=0;i=Math.min(t.x,e.x)&&i.y<=Math.max(t.y,e.y)&&i.y>=Math.min(t.y,e.y)}function ct(t){return 0n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(r=!r),(e=e.next)!==t;);return r}function _t(t,i){var e=new mt(t.i,t.x,t.y),r=new mt(i.i,i.x,i.y),s=t.next,n=i.prev;return(t.next=i).prev=t,(e.next=s).prev=e,(r.next=e).prev=r,(n.next=r).prev=n,r}function bt(t,i,e,r){t=new mt(t,i,e);return r?(t.next=r.next,(t.prev=r).next.prev=t,r.next=t):(t.prev=t).next=t,t}function gt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function mt(t,i,e){this.i=t,this.x=i,this.y=e,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wt(e,r,s,n){let h=0;for(let t=r,i=s-n;tNumber.EPSILON&&(c=Math.sqrt(c),n=Math.atan2(c,n*d),t=Math.sin(t*n)/c,h=Math.sin(h*n)/c),h*d);a=a*t+e*n,o=o*t+r*n,l=l*t+f*n,u=u*t+s*n,t===1-h&&(c=1/Math.sqrt(a*a+o*o+l*l+u*u),a*=c,o*=c,l*=c,u*=c)}t[i]=a,t[i+1]=o,t[i+2]=l,t[i+3]=u}}static multiplyQuaternionsFlat(t,i,e,r,s,n){var h=e[r],a=e[r+1],o=e[r+2],e=e[r+3],r=s[n],l=s[n+1],u=s[n+2],s=s[n+3];return t[i]=h*s+e*r+a*u-o*l,t[i+1]=a*s+e*l+o*r-h*u,t[i+2]=o*s+e*u+h*l-a*r,t[i+3]=e*s-h*r-a*l-o*u,t}get x(){return this.O}set x(t){this.O=t,this.T()}get y(){return this.N}set y(t){this.N=t,this.T()}get z(){return this.I}set z(t){this.I=t,this.T()}get w(){return this.k}set w(t){this.k=t,this.T()}set(t,i,e,r){return this.O=t,this.N=i,this.I=e,this.k=r,this.T(),this}clone(){return new this.constructor(this.O,this.N,this.I,this.k)}copy(t){return this.O=t.x,this.N=t.y,this.I=t.z,this.k=t.w,this.T(),this}setFromEuler(t,i=!0){var e=t.O,r=t.N,s=t.I,n=t._order,t=Math.cos,h=Math.sin,a=t(e/2),o=t(r/2),l=t(s/2),u=h(e/2),f=h(r/2),d=h(s/2);switch(n){case"XYZ":this.O=u*o*l+a*f*d,this.N=a*f*l-u*o*d,this.I=a*o*d+u*f*l,this.k=a*o*l-u*f*d;break;case"YXZ":this.O=u*o*l+a*f*d,this.N=a*f*l-u*o*d,this.I=a*o*d-u*f*l,this.k=a*o*l+u*f*d;break;case"ZXY":this.O=u*o*l-a*f*d,this.N=a*f*l+u*o*d,this.I=a*o*d+u*f*l,this.k=a*o*l-u*f*d;break;case"ZYX":this.O=u*o*l-a*f*d,this.N=a*f*l+u*o*d,this.I=a*o*d-u*f*l,this.k=a*o*l+u*f*d;break;case"YZX":this.O=u*o*l+a*f*d,this.N=a*f*l+u*o*d,this.I=a*o*d-u*f*l,this.k=a*o*l-u*f*d;break;case"XZY":this.O=u*o*l-a*f*d,this.N=a*f*l-u*o*d,this.I=a*o*d+u*f*l,this.k=a*o*l+u*f*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===i&&this.T(),this}setFromAxisAngle(t,i){var i=i/2,e=Math.sin(i);return this.O=t.x*e,this.N=t.y*e,this.I=t.z*e,this.k=Math.cos(i),this.T(),this}setFromRotationMatrix(t){var t=t.elements,i=t[0],e=t[4],r=t[8],s=t[1],n=t[5],h=t[9],a=t[2],o=t[6],t=t[10],l=i+n+t;return 0Math.abs(t.z)?(this.O=-t.y,this.N=t.x,this.I=0):(this.O=0,this.N=-t.z,this.I=t.y)):(this.O=t.y*i.z-t.z*i.y,this.N=t.z*i.x-t.x*i.z,this.I=t.x*i.y-t.y*i.x),this.k=e,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Et(this.dot(t),-1,1)))}rotateTowards(t,i){var e=this.angleTo(t);return 0!==e&&(i=Math.min(1,i/e),this.slerp(t,i)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this.O*=-1,this.N*=-1,this.I*=-1,this.T(),this}dot(t){return this.O*t.O+this.N*t.N+this.I*t.I+this.k*t.k}lengthSq(){return this.O*this.O+this.N*this.N+this.I*this.I+this.k*this.k}length(){return Math.sqrt(this.O*this.O+this.N*this.N+this.I*this.I+this.k*this.k)}normalize(){var t=this.length();return 0===t?(this.O=0,this.N=0,this.I=0,this.k=1):(this.O=this.O*(t=1/t),this.N=this.N*t,this.I=this.I*t,this.k=this.k*t),this.T(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,i){var e=t.O,r=t.N,s=t.I,t=t.k,n=i.O,h=i.N,a=i.I,i=i.k;return this.O=e*i+t*n+r*a-s*h,this.N=r*i+t*h+s*n-e*a,this.I=s*i+t*a+e*h-r*n,this.k=t*i-e*n-r*h-s*a,this.T(),this}slerp(i,e){if(0!==e){if(1===e)return this.copy(i);var r,s,n=this.O,h=this.N,a=this.I,o=this.k;let t=o*i.k+n*i.O+h*i.N+a*i.I;t<0?(this.k=-i.k,this.O=-i.O,this.N=-i.N,this.I=-i.I,t=-t):this.copy(i),1<=t?(this.k=o,this.O=n,this.N=h,this.I=a):(i=1-t*t)<=Number.EPSILON?(this.k=(r=1-e)*o+e*this.k,this.O=r*n+e*this.O,this.N=r*h+e*this.N,this.I=r*a+e*this.I,this.normalize()):(r=Math.sqrt(i),i=Math.atan2(r,t),s=Math.sin((1-e)*i)/r,e=Math.sin(e*i)/r,this.k=o*s+this.k*e,this.O=n*s+this.O*e,this.N=h*s+this.N*e,this.I=a*s+this.I*e,this.T())}return this}slerpQuaternions(t,i,e){return this.copy(t).slerp(i,e)}random(){var t=2*Math.PI*Math.random(),i=2*Math.PI*Math.random(),e=Math.random(),r=Math.sqrt(1-e),e=Math.sqrt(e);return this.set(r*Math.sin(t),r*Math.cos(t),e*Math.sin(i),e*Math.cos(i))}equals(t){return t.O===this.O&&t.N===this.N&&t.I===this.I&&t.k===this.k}fromArray(t,i=0){return this.O=t[i],this.N=t[i+1],this.I=t[i+2],this.k=t[i+3],this.T(),this}toArray(t=[],i=0){return t[i]=this.O,t[i+1]=this.N,t[i+2]=this.I,t[i+3]=this.k,t}fromBufferAttribute(t,i){return this.O=t.getX(i),this.N=t.getY(i),this.I=t.getZ(i),this.k=t.getW(i),this.T(),this}toJSON(){return this.toArray()}j(t){return this.T=t,this}T(){}*[Symbol.iterator](){yield this.O,yield this.N,yield this.I,yield this.k}}class xt{constructor(t=0,i=0,e=0){xt.prototype.isVector3=!0,this.x=t,this.y=i,this.z=e}set(t,i,e){return void 0===e&&(e=this.z),this.x=t,this.y=i,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this}applyEuler(t){return this.applyQuaternion(At.setFromEuler(t))}applyAxisAngle(t,i){return this.applyQuaternion(At.setFromAxisAngle(t,i))}applyMatrix3(t){var i=this.x,e=this.y,r=this.z,t=t.elements;return this.x=t[0]*i+t[3]*e+t[6]*r,this.y=t[1]*i+t[4]*e+t[7]*r,this.z=t[2]*i+t[5]*e+t[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){var i=this.x,e=this.y,r=this.z,t=t.elements,s=1/(t[3]*i+t[7]*e+t[11]*r+t[15]);return this.x=(t[0]*i+t[4]*e+t[8]*r+t[12])*s,this.y=(t[1]*i+t[5]*e+t[9]*r+t[13])*s,this.z=(t[2]*i+t[6]*e+t[10]*r+t[14])*s,this}applyQuaternion(t){var i=this.x,e=this.y,r=this.z,s=t.x,n=t.y,h=t.z,t=t.w,a=2*(n*r-h*e),o=2*(h*i-s*r),l=2*(s*e-n*i);return this.x=i+t*a+n*l-h*o,this.y=e+t*o+h*a-s*l,this.z=r+t*l+s*o-n*a,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){var i=this.x,e=this.y,r=this.z,t=t.elements;return this.x=t[0]*i+t[4]*e+t[8]*r,this.y=t[1]*i+t[5]*e+t[9]*r,this.z=t[2]*i+t[6]*e+t[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this}clampLength(t,i){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(i,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this}lerpVectors(t,i,e){return this.x=t.x+(i.x-t.x)*e,this.y=t.y+(i.y-t.y)*e,this.z=t.z+(i.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,i){var e=t.x,r=t.y,t=t.z,s=i.x,n=i.y,i=i.z;return this.x=r*i-t*n,this.y=t*s-e*i,this.z=e*n-r*s,this}projectOnVector(t){var i=t.lengthSq();return 0===i?this.set(0,0,0):(i=t.dot(this)/i,this.copy(t).multiplyScalar(i))}projectOnPlane(t){return jt.copy(this).projectOnVector(t),this.sub(jt)}reflect(t){return this.sub(jt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){var i=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===i?Math.PI/2:(t=this.dot(t)/i,Math.acos(Et(t,-1,1)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){var i=this.x-t.x,e=this.y-t.y,t=this.z-t.z;return i*i+e*e+t*t}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,i,e){var r=Math.sin(i)*t;return this.x=r*Math.sin(e),this.y=Math.cos(i)*t,this.z=r*Math.cos(e),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,i,e){return this.x=t*Math.sin(i),this.y=e,this.z=t*Math.cos(i),this}setFromMatrixPosition(t){t=t.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(t){var i=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),t=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=e,this.z=t,this}setFromMatrixColumn(t,i){return this.fromArray(t.elements,4*i)}setFromMatrix3Column(t,i){return this.fromArray(t.elements,3*i)}setFromEuler(t){return this.x=t.O,this.y=t.N,this.z=t.I,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){var t=Math.random()*Math.PI*2,i=2*Math.random()-1,e=Math.sqrt(1-i*i);return this.x=e*Math.cos(t),this.y=i,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let jt=new xt,At=new Tt,o=1e-5,Pt=1e-5,Lt=.001,Dt=Math.PI/180,St=180/Math.PI;class Ft{constructor(){}}Object.assign(Ft.prototype,{A(){return o},P(){return Dt},L(){return St},D(t){return t-o},S(t){return t>o},F(t){return t<-o},G(t,i,e){i=(t.x-e.x)*(i.y-e.y)-(i.x-e.x)*(t.y-e.y);return Math.abs(i)=Math.min(h,t)&&o>s.x&&o!==h&&(o===t&&0<(a-s.y)*(i-s.y)?n+=2:n++):o<=Math.max(h,t)&&o>=Math.min(h,t)&&o>s.x&&(o===t&&0<(a-s.y)*(i-s.y)?n+=2:n++)}}return 0e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(n=!n,a.y>o.y?h++:h--),s=t}return 0!=h},isPolygonInPolygon(t,i){var e=Object.assign([],t),r=Object.assign([],i);e.push(e[0]),r.push(r[0]);for(let t=0;te.x||e.ys||t.yi)},Y(t,i,e){var r=Math.min(e.x,i.x),s=Math.max(e.x,i.x),n=Math.min(e.y,i.y),e=Math.max(e.y,i.y);return!(t.xs||t.ye)},X(i,e,r){let s=!1;var n,h;for(let t=0;t=i.y||h.y=i.y)&&(n.x<=i.x||h.x<=i.x)&&n.x+(i.y-n.y)/(h.y-n.y)*(h.x-n.x)h||(h-n=d&&t.y<=v||t.y>=v&&t.y<=d?(s.x=t.x,s.y=t.y,0):dh||(Math.abs(h-n=d&&t.y<=v||t.y>=v&&t.y<=d?(s.x=t.x,s.y=t.y,0):dv?(s.x=c,s.y=v,0):!(vd)||(s.x=f,s.y=d,0):(s.y=p=(v-d)/(c-f)*(l-f)+d,s.x=l,uo&&n*h>o)},It(r,s,n){var h=n.length,a={isintersect:!1,start:null,end:null,type:0,outer:null},o=[];if(this.Et(r,n)&&(a.start=r),this.Et(s,n)&&(a.end=s),null!=a.start&&null!=a.end)a.isintersect=!0,a.type=1;else{let i=(n[1].x+n[2].x)/2,e=(n[1].y+n[2].y)/2;for(let t=1;tthis.distanceOfTwoPoints(h[0].point,e)?h[0]:h[1]).point,n.isintersect=!0)}return n},Tt(s,t){if(0==t.length)return[s];var i,e,r=this.xt(t),n=[];r.sort(function(t,i){var e=(t.jt.x-s.jt.x)*(t.jt.x-s.jt.x)+(t.jt.y-s.jt.y)*(t.jt.y-s.jt.y),r=(i.jt.x-s.jt.x)*(i.jt.x-s.jt.x)+(i.jt.y-s.jt.y)*(i.jt.y-s.jt.y),t=(t.At.x-s.jt.x)*(t.At.x-s.jt.x)+(t.At.y-s.jt.y)*(t.At.y-s.jt.y),i=(i.At.x-s.jt.x)*(i.At.x-s.jt.x)+(i.At.y-s.jt.y)*(i.At.y-s.jt.y);return(e=t.length){if(i.push(e),t.splice(0,1),t.length<1)break;e=t[0],r=1}if(1===t.length){i.push(e);break}this.B(e.jt,e.At,t[r].jt)?(this.B(e.jt,e.At,t[r].At)||(e.At=t[r].At),t.splice(r,1)):this.B(e.jt,e.At,t[r].At)?(e.jt=t[r].jt,t.splice(r,1)):this.B(t[r].jt,t[r].At,e.jt)?(e=(this.B(t[r].jt,t[r].At,e.At)||(t[r].At=e.At),t[r]),t.splice(r,1)):this.B(t[r].jt,t[r].At,e.At)?(t[r].jt=e.jt,e=t[r],t.splice(r,1)):r++}return i},B(t,i,e){let r=t.x-e.x,s=t.y-e.y,n=i.x-e.x,h=i.y-e.y;var a=this.distanceOfTwoPoints(t,e),e=this.distanceOfTwoPoints(i,e),t=this.distanceOfTwoPoints(t,i);return r*h-s*n<1e-5&&a+e-t<.001},Dt(t,i,e){let r=i.x-t.x,s=i.y-t.y;t=Math.sqrt(r*r+s*s);return{x:i.x+r/t*e,y:i.y+s/t*e}},St(i){let e=null,r=0,t=0,s=0;for(let t=0;te)&&(e=i[t].x,r=t);var n=new xt(i[r].x,i[r].y,0),h=(t=0===r?i.length-1:r-1,s=r===i.length-1?0:r+1,new xt(i[t].x,i[t].y,0)),a=new xt(i[s].x,i[s].y,0),h=(new xt).copy(n).sub(h),a=(new xt).copy(a).sub(n);return 0this.max.x&&(i=!1),t.max.ythis.max.y?!1:i}}Object.assign(l.prototype,{Ct(){return!(this.min.x>this.max.x||this.min.y>this.max.y)},Vt(t){t&&t.valid()&&(t.min.xthis.max.x&&(this.max.x=t.max.x),t.max.y>this.max.y)&&(this.max.y=t.max.y)},Bt(t){t&&0!=t.length&&t.forEach(t=>{t.xthis.max.x&&(this.max.x=t.x),t.y>this.max.y&&(this.max.y=t.y)})}});class Gt extends i{constructor(t,i){super(t,i),this.Zt=new l,this.Wt=null}}Object.assign(Gt.prototype,{u(t){return t.getType()!=y.MODEL?this.Ut(t):this.qt(t)},qt(t){return!0},Yt(t){t=t.getBound();return!!G.C(this.Zt.Ft,this.Zt.Gt,t.min,t.max)},v(t,i){var s=t.getCoordinates();if(t.getType()!==y.MODEL)i.K=Math.sqrt(G.J(s[0],this.zt));else{let r=Number.MAX_VALUE;for(let e=0,t=s.length;en&&(r=n)}i.K=Math.sqrt(r)}},Ut(t){t=t.getCoordinates()[0];return!!G.W(t,this.Zt.Ft,this.Zt.Gt)&&("circle"===this.Wt?G.J(t,this.zt){200===o.status||0===o.status||201===o.status?t&&t(o.response):i&&(404===o.status?i(d.PATH_ERROR):2069===o.response.error_code?i(d.NAME_KEY_ERROR):2063===o.response.error_code?i(d.MAP_ID_URL_ERROR):400===o.response.error_code?i(d.THEME_ID_URL_ERROR):i(o.response))}),o.addEventListener("timeout",t=>{e&&e(t)}),o.addEventListener("error",t=>{i&&i(t)}),o.send(JSON.stringify(r)),this.ci=o},pi(){this.ci&&this.ci.abort&&(this.ci.abort(),this.ci=null)}});var Qt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Kt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jt={exports:{}},$t={},ti={},ii,ei;function ri(){return ei||(ei=1,ii=function(t,i){var e=new Array(arguments.length-1),n=0,r=2,h=!0;for(;r>2],r=(3&o)<<4,a=1;break;case 1:n[h++]=l[r|o>>4],r=(15&o)<<2,a=2;break;case 2:n[h++]=l[r|o>>6],n[h++]=l[63&o],a=0}8191>4,r=a,n=2;break;case 2:i[e++]=(15&r)<<4|(60&a)>>2,r=a,n=3;break;case 3:i[e++]=(3&r)<<6|a,n=0}}if(1===n)throw Error(u);return e-s},t.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}}return si}function ci(){return ai||(ai=1,(hi=t).prototype.on=function(t,i,e){return(this.yi[t]||(this.yi[t]=[])).push({fn:i,ctx:e||this}),this},t.prototype.off=function(t,i){if(void 0===t)this.yi={};else if(void 0===i)this.yi[t]=[];else for(var e=this.yi[t],r=0;r>>0:i<11754943508222875e-54?(s<<31|Math.round(i/1401298464324817e-60))>>>0:(s<<31|(t=Math.floor(Math.log(i)/Math.LN2))+127<<23|8388607&Math.round(i*Math.pow(2,-t)*8388608))>>>0,e,r)}function e(t,i,e){t=t(i,e),i=2*(t>>31)+1,e=t>>>23&255,t&=8388607;return 255==e?t?NaN:1/0*i:0==e?1401298464324817e-60*i*t:i*Math.pow(2,e-150)*(8388608+t)}function r(t,i,e){a[0]=t,i[e]=o[0],i[e+1]=o[1],i[e+2]=o[2],i[e+3]=o[3]}function s(t,i,e){a[0]=t,i[e]=o[3],i[e+1]=o[2],i[e+2]=o[1],i[e+3]=o[0]}function n(t,i){return o[0]=t[i],o[1]=t[i+1],o[2]=t[i+2],o[3]=t[i+3],a[0]}function h(t,i){return o[3]=t[i],o[2]=t[i+1],o[1]=t[i+2],o[0]=t[i+3],a[0]}var a,o,l,u,f;function d(t,i,e,r,s,n){var h,a,o=r<0?1:0;0===(r=o?-r:r)?(t(0,s,n+i),t(0<1/r?0:2147483648,s,n+e)):isNaN(r)?(t(0,s,n+i),t(2146959360,s,n+e)):17976931348623157e292>>0,s,n+e)):r<22250738585072014e-324?(t((h=r/5e-324)>>>0,s,n+i),t((o<<31|h/4294967296)>>>0,s,n+e)):(1024===(a=Math.floor(Math.log(r)/Math.LN2))&&(a=1023),t(4503599627370496*(h=r*Math.pow(2,-a))>>>0,s,n+i),t((o<<31|a+1023<<20|1048576*h&1048575)>>>0,s,n+e))}function c(t,i,e,r,s){i=t(r,s+i),t=t(r,s+e),r=2*(t>>31)+1,s=t>>>20&2047,e=4294967296*(1048575&t)+i;return 2047==s?e?NaN:1/0*r:0==s?5e-324*r*e:r*Math.pow(2,s-1075)*(e+4503599627370496)}function v(t,i,e){l[0]=t,i[e]=u[0],i[e+1]=u[1],i[e+2]=u[2],i[e+3]=u[3],i[e+4]=u[4],i[e+5]=u[5],i[e+6]=u[6],i[e+7]=u[7]}function p(t,i,e){l[0]=t,i[e]=u[7],i[e+1]=u[6],i[e+2]=u[5],i[e+3]=u[4],i[e+4]=u[3],i[e+5]=u[2],i[e+6]=u[1],i[e+7]=u[0]}function y(t,i){return u[0]=t[i],u[1]=t[i+1],u[2]=t[i+2],u[3]=t[i+3],u[4]=t[i+4],u[5]=t[i+5],u[6]=t[i+6],u[7]=t[i+7],l[0]}function _(t,i){return u[7]=t[i],u[6]=t[i+1],u[5]=t[i+2],u[4]=t[i+3],u[3]=t[i+4],u[2]=t[i+5],u[1]=t[i+6],u[0]=t[i+7],l[0]}return"undefined"!=typeof Float32Array?(a=new Float32Array([-0]),o=new Uint8Array(a.buffer),f=128===o[3],t.writeFloatLE=f?r:s,t.writeFloatBE=f?s:r,t.readFloatLE=f?n:h,t.readFloatBE=f?h:n):(t.writeFloatLE=i.bind(null,b),t.writeFloatBE=i.bind(null,g),t.readFloatLE=e.bind(null,m),t.readFloatBE=e.bind(null,w)),"undefined"!=typeof Float64Array?(l=new Float64Array([-0]),u=new Uint8Array(l.buffer),f=128===u[7],t.writeDoubleLE=f?v:p,t.writeDoubleBE=f?p:v,t.readDoubleLE=f?y:_,t.readDoubleBE=f?_:y):(t.writeDoubleLE=d.bind(null,b,0,4),t.writeDoubleBE=d.bind(null,g,4,0),t.readDoubleLE=c.bind(null,m,0,4),t.readDoubleBE=c.bind(null,w,4,0)),t}function b(t,i,e){i[e]=255&t,i[e+1]=t>>>8&255,i[e+2]=t>>>16&255,i[e+3]=t>>>24}function g(t,i,e){i[e]=t>>>24,i[e+1]=t>>>16&255,i[e+2]=t>>>8&255,i[e+3]=255&t}function m(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16|t[i+3]<<24)>>>0}function w(t,i){return(t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3])>>>0}}function pi(){return fi||(fi=1,ui=t),ui;function t(t){try{var i=eval("quire".replace(/^/,"re"))(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}}var yi={},_i,bi,gi,mi,wi,Mi;function Ri(){var t;return _i||(_i=1,(t=yi).length=function(t){for(var i,e=0,r=0;r>10),n[h++]=56320+(1023&r)):n[h++]=(15&r)<<12|(63&t[i++])<<6|63&t[i++],8191>6|192:(55296==(64512&r)&&56320==(64512&(s=t.charCodeAt(h+1)))?(++h,i[e++]=(r=65536+((1023&r)<<10)+(1023&s))>>18|240,i[e++]=r>>12&63|128):i[e++]=r>>12|224,i[e++]=r>>6&63|128),i[e++]=63&r|128);return e-n}),yi}function Oi(){return gi||(gi=1,bi=function(i,e,t){var r=t||8192,s=r>>>1,n=null,h=r;return function(t){if(t<1||s>>0,t=(t-e)/4294967296>>>0,i&&(t=~t>>>0,e=~e>>>0,4294967295<++e)&&(e=0,4294967295<++t)&&(t=0),new s(e,t))},s.from=function(t){if("number"==typeof t)return s.fromNumber(t);if(i.isString(t)){if(!i.Long)return s.fromNumber(parseInt(t,10));t=i.Long.fromString(t)}return t.low||t.high?new s(t.low>>>0,t.high>>>0):r},s.prototype.toNumber=function(t){var i;return!t&&this.hi>>>31?(t=1+~this.lo>>>0,i=~this.hi>>>0,-(t+4294967296*(i=t?i:i+1>>>0))):this.lo+4294967296*this.hi},s.prototype.toLong=function(t){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}},e=String.prototype.charCodeAt,s.fromHash=function(t){return"\0\0\0\0\0\0\0\0"===t?r:new s((e.call(t,0)|e.call(t,1)<<8|e.call(t,2)<<16|e.call(t,3)<<24)>>>0,(e.call(t,4)|e.call(t,5)<<8|e.call(t,6)<<16|e.call(t,7)<<24)>>>0)},s.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},s.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},s.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},s.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,e=this.hi>>>24;return 0==e?0==i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:e<128?9:10}),mi;function s(t,i){this.lo=t>>>0,this.hi=i>>>0}}function c(){var r;return Mi||(Mi=1,(r=ti).asPromise=ri(),r.base64=di(),r.EventEmitter=ci(),r.float=vi(),r.inquire=pi(),r.utf8=Ri(),r.pool=Oi(),r.LongBits=Ni(),r.isNode=Boolean(void 0!==Qt&&Qt&&Qt.process&&Qt.process.versions&&Qt.process.versions.node),r.global=r.isNode&&Qt||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||Qt,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},r.isString=function(t){return"string"==typeof t||t instanceof String},r.isObject=function(t){return t&&"object"==typeof t},r.isset=r.isSet=function(t,i){var e=t[i];return!(null==e||!t.hasOwnProperty(i))&&("object"!=typeof e||0<(Array.isArray(e)?e:Object.keys(e)).length)},r.Buffer=(()=>{try{var t=r.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}})(),r._i=null,r.bi=null,r.newBuffer=function(t){return"number"==typeof t?r.Buffer?r.bi(t):new r.Array(t):r.Buffer?r._i(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(t){return t?r.LongBits.from(t).toHash():r.LongBits.zeroHash},r.longFromHash=function(t,i){t=r.LongBits.fromHash(t);return r.Long?r.Long.fromBits(t.lo,t.hi,i):t.toNumber(Boolean(i))},r.merge=s,r.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},r.newError=t,r.ProtocolError=t("ProtocolError"),r.oneOfGetter=function(t){for(var e={},i=0;i>>=7;i[e]=t}function Fi(t,i){this.len=t,this.next=void 0,this.val=i}function Gi(t,i,e){for(;t.hi;)i[e++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127>>7;i[e++]=t.lo}function Vi(t,i,e){i[e]=255&t,i[e+1]=t>>>8&255,i[e+2]=t>>>16&255,i[e+3]=t>>>24}n.create=Li(),n.alloc=function(t){return new r.Array(t)},r.Array!==Array&&(n.alloc=r.pool(n.alloc,r.Array.prototype.subarray)),n.prototype.mi=function(t,i,e){return this.tail=this.tail.next=new ji(t,i,e),this.len+=i,this},Fi.prototype=Object.create(ji.prototype),Fi.prototype.fn=Si,n.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Fi((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},n.prototype.int32=function(t){return t<0?this.mi(Gi,10,ki.fromNumber(t)):this.uint32(t)},n.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},n.prototype.uint64=function(t){t=ki.from(t);return this.mi(Gi,t.length(),t)},n.prototype.int64=n.prototype.uint64,n.prototype.sint64=function(t){t=ki.from(t).zzEncode();return this.mi(Gi,t.length(),t)},n.prototype.bool=function(t){return this.mi(Di,1,t?1:0)},n.prototype.fixed32=function(t){return this.mi(Vi,4,t>>>0)},n.prototype.sfixed32=n.prototype.fixed32,n.prototype.fixed64=function(t){t=ki.from(t);return this.mi(Vi,4,t.lo).mi(Vi,4,t.hi)},n.prototype.sfixed64=n.prototype.fixed64,n.prototype.float=function(t){return this.mi(r.float.writeFloatLE,4,t)},n.prototype.double=function(t){return this.mi(r.float.writeDoubleLE,8,t)};var Bi=r.Array.prototype.set?function(t,i,e){i.set(t,e)}:function(t,i,e){for(var r=0;r>>0;return e?(r.isString(t)&&(i=n.alloc(e=Ti.length(t)),Ti.decode(t,i,0),t=i),this.uint32(e).mi(Bi,e,t)):this.mi(Di,1,0)},n.prototype.string=function(t){var i=xi.length(t);return i?this.uint32(i).mi(xi.write,i,t):this.mi(Di,1,0)},n.prototype.fork=function(){return this.states=new Pi(this),this.head=this.tail=new ji(Ai,0,0),this.len=0,this},n.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ji(Ai,0,0),this.len=0),this},n.prototype.ldelim=function(){var t=this.head,i=this.tail,e=this.len;return this.reset().uint32(e),e&&(this.tail.next=t.next,this.tail=i,this.len+=e),this},n.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),e=0;t;)t.fn(t.val,i,e),e+=t.len,t=t.next;return i},n.gi=function(t){Ii=t,n.create=Li(),Ii.gi()},e),Zi=Ei,Wi=((e.prototype=Object.create(Zi.prototype)).constructor=e,c());function e(){Zi.call(this)}function Ui(t,i,e){t.length<40?Wi.utf8.write(t,i,e):i.utf8Write?i.utf8Write(t,e):i.write(t,e)}e.gi=function(){e.alloc=Wi.bi,e.writeBytesBuffer=Wi.Buffer&&Wi.Buffer.prototype instanceof Uint8Array&&"set"===Wi.Buffer.prototype.set.name?function(t,i,e){i.set(t,e)}:function(t,i,e){if(t.copy)t.copy(i,e,0,t.length);else for(var r=0;r>>0;return this.uint32(i),i&&this.mi(e.writeBytesBuffer,i,t),this},e.prototype.string=function(t){var i=Wi.Buffer.byteLength(t);return this.uint32(i),i&&this.mi(Ui,i,t),this},e.gi();var qi=g,v=c(),Yi,zi=v.LongBits,Xi=v.utf8;function b(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function g(t){this.buf=t,this.pos=0,this.len=t.length}var Hi="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new g(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new g(t);throw Error("illegal buffer")},Qi=function(){return v.Buffer?function(t){return(g.create=function(t){return v.Buffer.isBuffer(t)?new Yi(t):Hi(t)})(t)}:Hi};function Ki(){var t=new zi(0,0),i=0;if(!(4=this.len)throw b(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,4>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw b(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function Ji(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function $i(){if(this.pos+8>this.len)throw b(this,8);return new zi(Ji(this.buf,this.pos+=4),Ji(this.buf,this.pos+=4))}g.create=Qi(),g.prototype.wi=v.Array.prototype.subarray||v.Array.prototype.slice,g.prototype.uint32=(()=>{var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return t;throw this.pos=this.len,b(this,10)}})(),g.prototype.int32=function(){return 0|this.uint32()},g.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},g.prototype.bool=function(){return 0!==this.uint32()},g.prototype.fixed32=function(){if(this.pos+4>this.len)throw b(this,4);return Ji(this.buf,this.pos+=4)},g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw b(this,4);return 0|Ji(this.buf,this.pos+=4)},g.prototype.float=function(){if(this.pos+4>this.len)throw b(this,4);var t=v.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},g.prototype.double=function(){if(this.pos+8>this.len)throw b(this,4);var t=v.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},g.prototype.bytes=function(){var t=this.uint32(),i=this.pos,e=this.pos+t;if(e>this.len)throw b(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,e):i===e?new this.buf.constructor(0):this.wi.call(this.buf,i,e)},g.prototype.string=function(){var t=this.bytes();return Xi.read(t,0,t.length)},g.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw b(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw b(this)}while(128&this.buf[this.pos++]);return this},g.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},g.gi=function(t){Yi=t,g.create=Qi(),Yi.gi();var i=v.Long?"toLong":"toNumber";v.merge(g.prototype,{int64:function(){return Ki.call(this)[i](!1)},uint64:function(){return Ki.call(this)[i](!0)},sint64:function(){return Ki.call(this).zzDecode()[i](!1)},fixed64:function(){return $i.call(this)[i](!0)},sfixed64:function(){return $i.call(this)[i](!1)}})};var te=re,ie=qi,ee=((re.prototype=Object.create(ie.prototype)).constructor=re,c());function re(t){ie.call(this,t)}re.gi=function(){ee.Buffer&&(re.prototype.wi=ee.Buffer.prototype.slice)},re.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},re.gi();var se={},ne=ae,he=c();function ae(t,i,e){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");he.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(i),this.responseDelimited=Boolean(e)}(ae.prototype=Object.create(he.EventEmitter.prototype)).constructor=ae,ae.prototype.rpcCall=function t(e,i,r,s,n){if(!s)throw TypeError("request must be specified");var h=this;if(!n)return he.asPromise(t,h,e,i,r,s);if(h.rpcImpl)try{return h.rpcImpl(e,i[h.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(t,i){if(t)return h.emit("error",t,e),n(t);if(null!==i){if(!(i instanceof r))try{i=r[h.responseDelimited?"decodeDelimited":"decode"](i)}catch(t){return h.emit("error",t,e),n(t)}return h.emit("data",i,e),n(null,i)}h.end(!0)})}catch(t){h.emit("error",t,e),setTimeout(function(){n(t)},0)}else setTimeout(function(){n(Error("already ended"))},0)},ae.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},se.Service=ne;var oe={},le=((()=>{var t=$t;function i(){t.util.gi(),t.Writer.gi(t.BufferWriter),t.Reader.gi(t.BufferReader)}t.build="minimal",t.Writer=Ei,t.BufferWriter=Ci,t.Reader=qi,t.BufferReader=te,t.util=c(),t.rpc=se,t.roots=oe,t.configure=i,i()})(),{exports:{}}),ue,fe,de,ce;function ve(){return fe||(fe=1,(ue=t).verbose=!1),ue;function t(i,e){"string"==typeof i&&(e=i,i=void 0);var o=[];function l(t){if("string"!=typeof t){var i="return "+u();if(t){for(var e=Object.keys(t),r=new Array(e.length+1),s=new Array(e.length),n=0;ni)return!0;return!1},u.isReservedName=function(t,i){if(t)for(var e=0;e>>3){");for(var e=0;e>>3){")("case 1: k=r.%s(); break",r.keyType)("case 2:"),void 0===o.basic[s]?i("value=types[%i].decode(r,r.uint32())",e):i("value=r.%s()",s),i("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[r.keyType]?i('%s[typeof k==="object"?util.longToHash(k):k]=value',n):i("%s[k]=value",n)):r.repeated?(i("if(!(%s&&%s.length))",n,n)("%s=[]",n),void 0!==o.packed[s]&&i("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{switch(i.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",e)("return%j",l(i,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",e)("return%j",l(i,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",e)("return%j",l(i,"boolean key"))}})(i,h,"k[i]"),u(i,h,s,a+"[k[i]]")("}")):h.repeated?(i("if(!Array.isArray(%s))",a)("return%j",l(h,"array"))("for(var i=0;i<%s.length;++i){",a),u(i,h,s,a+"[i]")("}")):(h.partOf&&(n=o.safeProp(h.partOf.name),1===r[h.partOf.name]&&i("if(p%s===1)",n)("return%j",h.partOf.name+": multiple values"),r[h.partOf.name]=1,i("p%s=1",n)),u(i,h,s,a)),h.optional&&i("}")}return i("return null")},h=M(),o=w()),Ue;function l(t,i){return t.name+": "+i+(t.repeated&&"array"!==i?"[]":t.map&&"object"!==i?"{k:"+t.keyType+"}":"")+" expected"}function u(t,i,e,r){if(i.resolvedType)if(i.resolvedType instanceof h){t("switch(%s){",r)("default:")("return%j",l(i,"enum value"));for(var s=Object.keys(i.resolvedType.values),n=0;n>>0",r,r);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",r,r);break;case"uint64":a=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,a)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,a?"true":"");break;case"bytes":t('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length)",r)("m%s=d%s",r,r);break;case"string":t("m%s=String(d%s)",r,r);break;case"bool":t("m%s=Boolean(d%s)",r,r)}}return t}function v(t,i,e,r){if(i.resolvedType)i.resolvedType instanceof d?t("d%s=o.enums===String?types[%i].values[m%s]:m%s",r,e,r,r):t("d%s=types[%i].toObject(m%s,o)",r,e,r);else{var s=!1;switch(i.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,s?"true":"",r);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:t("d%s=m%s",r,r)}}return t}}var Ke={},Je,$e,tr,ir,er,rr,sr,nr,hr,ar,or;function lr(){var h,a,o,l,u,f,s,n,d,c,v,p,y,_,b;return $e||($e=1,Je=g,h=Se(),((g.prototype=Object.create(h.prototype)).constructor=g).className="Type",a=M(),o=De(),l=Le(),u=Fe(),f=Ve(),s=Be,n=qi,d=Ei,c=w(),v=dr(),p=Ye(),y=ze(),_=Qe(),b=Ke,Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(!this.Ei){this.Ei={};for(var t=Object.keys(this.fields),i=0;i>>0,8|u.mapKey[n.keyType],n.keyType),void 0===o?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",h,i):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|o,a,i),e("}")("}")):n.repeated?(e("if(%s!=null&&%s.length){",i,i),n.packed&&void 0!==u.packed[a]?e("w.uint32(%i).fork()",(n.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",a,i)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",i),void 0===o?d(e,n,h,i+"[i]"):e("w.uint32(%i).%s(%s[i])",(n.id<<3|o)>>>0,a,i)),e("}")):(n.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,n.name),void 0===o?d(e,n,h,i):e("w.uint32(%i).%s(%s)",(n.id<<3|o)>>>0,a,i))}return e("return w")},l=M(),u=Pe(),f=w()),ar;function d(t,i,e,r){i.resolvedType.group?t("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",e,r,(i.id<<3|3)>>>0,(i.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",e,r,(i.id<<3|2)>>>0)}}(()=>{var h=Be;Ke[".google.protobuf.Any"]={fromObject:function(t){if(t&&t["@type"]){var i,e=t["@type"].substring(t["@type"].lastIndexOf("/")+1),e=this.lookup(e);if(e)return-1===(i="."===t["@type"].charAt(0)?t["@type"].substr(1):t["@type"]).indexOf("/")&&(i="/"+i),this.create({type_url:i,value:e.encode(e.fromObject(t)).finish()})}return this.fromObject(t)},toObject:function(t,i){var e,r,s="",n="";return!((t=i&&i.json&&t.type_url&&t.value&&(n=t.type_url.substring(t.type_url.lastIndexOf("/")+1),s=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1),e=this.lookup(n))?e.decode(t.value):t)instanceof this.ctor)&&t instanceof h?(e=t.$type.toObject(t,i),r="."===t.$type.fullName[0]?t.$type.fullName.substr(1):t.$type.fullName,e["@type"]=n=(s=""===s?"type.googleapis.com/":s)+r,e):this.toObject(t,i)}}})();var R=Jt.exports=$t;function cr(t,i,e){return(i="function"==typeof i?(e=i,new R.Root):i||new R.Root).load(t,e)}function vr(t,i){return(i=i||new R.Root).loadSync(t)}R.build="light",R.load=cr,R.loadSync=vr,R.encoder=dr(),R.decoder=Ye(),R.verifier=ze(),R.converter=Qe(),R.ReflectionObject=fr(),R.Namespace=Se(),R.Root=ur(),R.Enum=M(),R.Type=lr(),R.Field=Le(),R.OneOf=De(),R.MapField=Fe(),R.Service=Ve(),R.Method=Ge(),R.Message=Be,R.wrappers=Ke,R.types=Pe(),R.util=w(),R.ReflectionObject.gi(R.Root),R.Namespace.gi(R.Type,R.Service,R.Enum),R.Root.gi(R.Type),R.Field.gi(R.Type);var pr=Jt.exports,yr=pr,_r=Kt(yr),br=["TmF2aVNlZ21lbg==","YWNjZXNzaWJsZQ==","Zmlk","bmZv","Rmxvb3JHZW8=","bGlmdFR5cGU=","bGVu","dmVs","ZXh0ZW50TGF5ZQ==","RXh0ZW50Qml6SQ==","cmVhZE9ubHk=","LnByb3RvYnVm","aW50MzI=","ZG9vcnR5cGU=","R0VPUE9JTlRfTQ==","TmF2aVpvbmU=","ZW50cmFuY2VGbA==","bGVuZ3Ro","ZWxCaXpJbmZv","c3RhaXJMYXllcg==","dG9CaWQ=","R2F0ZQ==","b2Zmc2V0WQ==","Zmlkcw==","aXNTZWxlY3RhYg==","ZmxhZw==","ZXh0ZXJuYWxNbw==","bGlmdEVudHJ5","VklTRUdNRU5U","SW5kZXhJbmZv","ZGF0YQ==","ZGVsQml6SW5mbw==","bWlk","cG9pTGF5ZXI=","bW9kZWxpZA==","cGFja2Vk","dGhyb3VnaA==","bmF2aVNlZ21lbg==","bGlmdExheWVy","cmVwZWF0ZWQ=","ZGVmQ2VuWQ==","b29y","bm9kZUlk","TmF2aU1vZGVs","cmFuaw==","c25vZGU=","cHRz","ZGVmR2lk","aGFzaENvZGU=","bmVzdGVk","Ymlk","cmVxdWlyZWQ=","R0VPTElORV9OQQ==","b2Zmc2V0WA==","TmF2aU5vZGU=","bHR5cGU=","T1ZFUkxBWURBVA==","ZGVmQ2VuWA==","b3B0aW9ucw==","YmFzZUxldmVs","YXJlYQ==","TGF5ZXJHcm91cA==","ZmllbGRz","cGFzcw==","Zmxvb3Jz","SUZU","Rmxvb3JOYXZp","amF2YV9vdXRlcg==","UG9seWdvbkxhYg==","ZW50cmFuY2VUeQ==","VHlwZQ==","bmF2aVpvbmVz","ZWxMYXllcg==","YWxpYXM=","d2lkdGg=","YXllcg==","ZW50cnl0eXBlcw==","TGlmdEJpekluZg==","bm9kZXR5cGVz","amF2YV9wYWNrYQ==","bmF2aVR5cGU=","ZGF0ZVZlcg==","bGlmdEZsYWc=","Z2lk","bWF4WA==","bW5hbWU=","bWluU2NhbGVMZQ==","Zmxvb3JJZA==","X2NsYXNzbmFtZQ==","TW9kZWxCaXpJbg==","Zmxvb3I=","bmFtZQ==","c2NhbGVMZXZlbA==","RXh0ZXJuYWxNbw==","cGdpZA==","ZmlsZVZlcg==","VEFJUg==","bWlubGV2ZWw=","Rmxvb3JDb25maQ==","R2VuZXJhbEdlbw==","ZHJpdmU=","Ym9vbA==","a2V5","R0VPUE9MWUdPTg==","dG9HaWQ=","ZGVmQ2VuWg==","YnR5cGU=","R0VPUE9JTlRfUw==","cC5wbGF0Zm9ybQ==","TmF2aUZsb29y","ZmxvYXQ=","bmF2aUV4dGVudA==","UE9JQml6SW5mbw==","TGFiZWxCaXpJbg==","TGF5ZXI=","cnVsZQ==","bGlk","Y29tLmZlbmdtYQ==","c2NhbGU=","c2VnbWVudElk","ZGVzYw==","ZGVsTGF5ZXI=","R0VPUE9JTlRfUA==","cm90YXRlQW5nbA==","X0xBQkVM","cG9seWdvbkxheQ==","ZmlsZURhdGU=","R0VPUE9JTlRfTA==","U3RhaXJCaXpJbg==","ZXNjYWxhdG9yTA==","bGlua1NlZw==","QnVmZmVy","TmF2aUV4dGVudA==","Z2Vv","R0VPTElORQ==","bmF2aU5vZGVz","cmVqZWN0cw==","UG9seWdvbkJpeg==","aXNWaXNpYmxl","b25zaGlw","YnVmZmVycw==","bWF4bGV2ZWw=","ZG91Ymxl","R0VPUE9JTlRfRQ==","bmF2aQ==","Rmxvb3JCaXo=","Z1Byb3RvQnVm","T0RFTA==","ZW5hbWU=","bW9kZWxMYXllcg==","a2V5cw==","ZWlk","bGF5ZXJz","QU5PUkFNQQ==","UkRFUg==","R0VPUE9JTlQ=","QnVpbGRpbmc=","bWluWA==","TWFw","aGVpZ2h0","c3RyaW5n","dHlwZQ==","ZGVmYXVsdA==","cG9seWdvbkxhYg==","TmF2aVJlbGF0aQ==","dWludDY0","aWR4cw==","SW5mbw==","X0VYVEVOVA=="];(t=>{for(var i=218;--i;)t.push(t.shift())})(br);class gr{constructor(){this.id={nested:{protobuf:{options:{java_package:"com.fengmap.platform.protobuf",java_outer_classname:"FloorConfigProtoBuf"},nested:{Map:{fields:{mid:{rule:"required",type:"string",id:1},fileVer:{rule:"required",type:"int32",id:2},dateVer:{rule:"required",type:"uint64",id:3},mname:{rule:"required",type:"string",id:4},hashCode:{rule:"required",type:"string",id:5},key:{type:"string",id:6},fileDate:{type:"string",id:7},desc:{type:"string",id:8},readOnly:{type:"bool",id:9,options:{default:!1}},buffers:{rule:"repeated",type:"Buffer",id:10},keys:{rule:"repeated",type:"string",id:11}},nested:{Buffer:{fields:{gid:{rule:"required",type:"int32",id:1},fileVer:{rule:"required",type:"int32",id:2},btype:{rule:"required",type:"int32",id:3},len:{rule:"required",type:"uint64",id:4},data:{rule:"required",type:"bytes",id:5}}}}},Scene:{fields:{mid:{rule:"required",type:"string",id:19},fileVer:{rule:"required",type:"int32",id:20},dateVer:{rule:"required",type:"uint64",id:21},mname:{rule:"required",type:"string",id:22},hashCode:{rule:"required",type:"string",id:23},key:{type:"string",id:24},desc:{type:"string",id:25},readOnly:{type:"bool",id:26,options:{default:!1}},x:{type:"float",id:1},y:{type:"float",id:2},z:{type:"float",id:3},minX:{type:"float",id:4},minY:{type:"float",id:5},maxX:{type:"float",id:6},maxY:{type:"float",id:7},defGid:{type:"string",id:8},defCenX:{type:"float",id:9},defCenY:{type:"float",id:10},defCenZ:{type:"float",id:11},height:{type:"float",id:12},rotateAngleX:{type:"float",id:13},rotateAngleY:{type:"float",id:14},rotateAngleZ:{type:"float",id:15},scale:{type:"float",id:16},scaleLevel:{type:"string",id:17},naviType:{type:"int32",id:28},layerGroups:{rule:"repeated",type:"LayerGroup",id:18},buildings:{rule:"repeated",type:"Building",id:27}},nested:{Layer:{fields:{lid:{type:"int32",id:1},lname:{type:"string",id:2},alias:{type:"string",id:3},ltype:{type:"Type",id:4},offsetX:{type:"float",id:5},offsetY:{type:"float",id:6},height:{type:"float",id:7},rotateAngleX:{type:"float",id:8},rotateAngleY:{type:"float",id:9},rotateAngleZ:{type:"float",id:10},minScaleLevel:{type:"float",id:11},maxScaleLevel:{type:"float",id:12},isVisible:{type:"bool",id:13},isSelectable:{type:"bool",id:14},isEditable:{type:"bool",id:15},desc:{type:"string",id:16}},nested:{Type:{values:{GEOPOINT:1,GEOPOINT_ESCALATOR:2,GEOPOINT_LIFT:3,GEOPOINT_STAIR:4,GEOPOINT_PANORAMA:5,GEOPOINT_POI:6,GEOPOINT_STORELABEL:7,GEOPOINT_NAVINODE:8,GEOPOINT_MODEL:9,GEOLINE:20,GEOLINE_NAVISEGMENT:21,GEOLINE_BORDER:22,GEOPOLYGON:30,GEOPOLYGON_EXTENT:31,GEOPOLYGON_STORE:32,GEOPOLYGON_LABEL:33,RASTERATA:40,OVERLAYDATA:50}}}},LayerGroup:{fields:{gid:{type:"int32",id:1},gname:{type:"string",id:2},alias:{type:"string",id:3},height:{type:"float",id:4},desc:{type:"string",id:5},layers:{rule:"repeated",type:"Layer",id:6},floorId:{type:"string",id:7},naviType:{type:"int32",id:8}}},Floor:{fields:{gid:{type:"int32",id:1},x:{type:"float",id:2},y:{type:"float",id:3},offsetX:{type:"float",id:4},offsetY:{type:"float",id:5},angle:{type:"float",id:6},scale:{type:"float",id:7},fids:{rule:"repeated",type:"string",id:8},pgid:{type:"int32",id:9},baseLevel:{type:"bool",id:10},minlevel:{type:"int32",id:11},maxlevel:{type:"int32",id:12},floorId:{type:"string",id:13},idxs:{rule:"repeated",type:"IndexInfo",id:14},pts:{rule:"repeated",type:"double",id:15,options:{packed:!1}}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}},Building:{fields:{bid:{type:"string",id:1},name:{type:"string",id:2},ename:{type:"string",id:3},alias:{type:"string",id:4},x:{type:"float",id:5},y:{type:"float",id:6},mid:{type:"string",id:7},version:{type:"int32",id:8},floors:{rule:"repeated",type:"Floor",id:9},bcode:{type:"int32",id:10}}}}},Gate:{fields:{mid:{rule:"required",type:"string",id:1},floors:{rule:"repeated",type:"NaviFloor",id:2}},nested:{NaviFloor:{fields:{gid:{type:"int32",id:1},floorId:{type:"string",id:2},bid:{type:"string",id:3},mid:{type:"string",id:4},navi:{rule:"repeated",type:"NaviRelationship",id:5},drive:{rule:"repeated",type:"NaviRelationship",id:6},accessible:{rule:"repeated",type:"NaviRelationship",id:7}}},NaviRelationship:{fields:{eid:{rule:"required",type:"int32",id:1},type:{type:"int32",id:2},accessible:{type:"int32",id:3},idxs:{rule:"repeated",type:"IndexInfo",id:4},pts:{rule:"repeated",type:"double",id:5,options:{packed:!1}},flag:{type:"int32",id:6},toBid:{rule:"repeated",type:"string",id:7},toGid:{rule:"repeated",type:"string",id:8}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}},FloorGeo:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},height:{type:"float",id:3},extentLayer:{rule:"repeated",type:"GeneralGeoInfo",id:4},modelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:5},labelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:6},poiLayer:{rule:"repeated",type:"GeneralGeoInfo",id:7},polygonLayer:{rule:"repeated",type:"GeneralGeoInfo",id:8},polygonLabelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:9},liftLayer:{rule:"repeated",type:"GeneralGeoInfo",id:10},stairLayer:{rule:"repeated",type:"GeneralGeoInfo",id:11},escalatorLayer:{rule:"repeated",type:"GeneralGeoInfo",id:12},externalModelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:13}},nested:{GeneralGeoInfo:{fields:{eid:{rule:"required",type:"int32",id:1},geo:{type:"string",id:2},height:{type:"float",id:3},area:{type:"float",id:4},idxs:{rule:"repeated",type:"IndexInfo",id:5},pts:{rule:"repeated",type:"double",id:6,options:{packed:!1}},baseheight:{type:"float",id:7}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}},FloorBiz:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},extentLayer:{rule:"repeated",type:"ExtentBizInfo",id:3},modelLayer:{rule:"repeated",type:"ModelBizInfo",id:4},labelLayer:{rule:"repeated",type:"LabelBizInfo",id:5},poiLayer:{rule:"repeated",type:"POIBizInfo",id:6},polygonLayer:{rule:"repeated",type:"PolygonBizInfo",id:7},liftLayer:{rule:"repeated",type:"LiftBizInfo",id:8},stairLayer:{rule:"repeated",type:"StairBizInfo",id:9},polygonLabelLayer:{rule:"repeated",type:"PolygonLabelBizInfo",id:10},externalModelLayer:{rule:"repeated",type:"ExternalModelBizInfo",id:11}},nested:{ExtentBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},ModelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7},pass:{type:"int32",id:8}}},LabelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},PolygonBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},POIBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},LiftBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},flag:{type:"int32",id:4},floor:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},StairBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},flag:{type:"int32",id:4},minlevel:{type:"int32",id:5},maxlevel:{type:"int32",id:6}}},PolygonLabelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},width:{type:"float",id:4},name:{type:"string",id:5},ename:{type:"string",id:6},angle:{type:"float",id:7}}},ExternalModelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}}}},FloorNavi:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},naviNodes:{rule:"repeated",type:"NaviNode",id:3},naviSegments:{rule:"repeated",type:"NaviSegment",id:4},naviZones:{rule:"repeated",type:"NaviZone",id:5},naviModels:{rule:"repeated",type:"NaviModel",id:6},nextFloors:{rule:"repeated",type:"int32",id:7,options:{packed:!1}},naviExtents:{rule:"repeated",type:"NaviExtent",id:8}},nested:{NaviNode:{fields:{nodeId:{type:"int32",id:1},nodeType:{type:"int32",id:2},liftType:{type:"int32",id:3},liftFlag:{type:"int32",id:4},liftEntry:{type:"int32",id:5},liftFloor:{type:"string",id:6},linkSeg:{type:"string",id:7},geo:{type:"string",id:8},entranceType:{type:"int32",id:9},entranceFloor:{type:"string",id:10},doortype:{type:"int32",id:11},idxs:{rule:"repeated",type:"int32",id:12,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:13,options:{packed:!1}},accessible:{type:"int32",id:14,options:{default:0}}}},NaviSegment:{fields:{segmentId:{type:"int32",id:1},snode:{type:"int32",id:2},enode:{type:"int32",id:3},length:{type:"double",id:4},rank:{type:"int32",id:5},name:{type:"string",id:6},entry:{type:"int32",id:7},desc:{type:"string",id:8},geo:{type:"string",id:9},through:{type:"int32",id:10},idxs:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:12,options:{packed:!1}}}},NaviZone:{fields:{id:{rule:"required",type:"int32",id:1},type:{rule:"required",type:"int32",id:2,options:{default:0}},geo:{type:"string",id:3},rejects:{rule:"repeated",type:"string",id:4},idxs:{rule:"repeated",type:"int32",id:5,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:6,options:{packed:!1}}}},NaviModel:{fields:{modelid:{rule:"required",type:"int32",id:1},doorids:{rule:"repeated",type:"int32",id:2,options:{packed:!1}},nodetypes:{rule:"repeated",type:"int32",id:3,options:{packed:!1}},entrytypes:{rule:"repeated",type:"int32",id:4,options:{packed:!1}}}},NaviExtent:{fields:{id:{rule:"required",type:"int32",id:1},pts:{rule:"repeated",type:"double",id:2,options:{packed:!1}},idxs:{rule:"repeated",type:"IndexInfo",id:3}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}}}}}}}}class mr{constructor(){this.ji=null}}Object.assign(mr.prototype,{Ai(){this.ji||(this.ji=_r.Root.fromJSON((new("undefined"!=typeof KjWzhWlSj&&KjWzhWlSj.ProtoDef?KjWzhWlSj.ProtoDef:gr)).id))},Pi(t){return this.Ai(),this.ji.lookup("Map").decode(t)},Li(i){for(let t=0;t{i.levels.push(t.gid)}),i},Fi(t){return this.Ai(),this.ji.lookup("Gate").decode(t)},Vi(t){return this.Ai(),this.ji.lookup("FloorGeo").decode(t)},Ci(t){return this.Ai(),this.ji.lookup("FloorBiz").decode(t)},Wi(t){return this.Ai(),this.ji.lookup("FloorNavi").decode(t)}});class wr{constructor(){var t;u.environment===zt.WX?this.Yi=new u.ProtoReaderStatic:void 0!==Ht.global().KjWzhWlSj&&Ht.global().KjWzhWlSj.ProtoReaderStatic?(t=Ht.global().KjWzhWlSj.ProtoReaderStatic,this.Yi=new t):this.Yi=new mr}}Object.assign(wr.prototype,{Pi(t){return this.Yi.Pi(t)},Li(t){return this.Yi.Li(t)},Si(t){return this.Yi.Si(t)},Gi(t,i){return this.Yi.Gi(t,i)},Bi(t,i){return this.Yi.Bi(t,i)},Zi(t,i){return this.Yi.Zi(t,i)},Ui(t,i){return this.Yi.Ui(t,i)},qi(t,i){return this.Yi.qi(t,i)},Di(t){return this.Yi.Di(t)},Fi(t){return this.Yi.Fi(t)},Vi(t){return this.Yi.Vi(t)},Ci(t){return this.Yi.Ci(t)},Wi(t){return this.Yi.Wi(t)}});let Mr="https://console.fengmap.com/api-s/",Rr={domain:Mr,online:Mr+"sdk/check",check:Mr+"sdk/auth/web",download:Mr+"sdk/auth/obtainMapRoute",downloadTile:Mr+"sdk/authLayered/obtainMapRoute",collect:Mr+"sdk/collect",themeUrl:Mr+"webtheme/",externalModelURL:Mr+"webmodel/"},Or=(()=>{function v(t,i){for(var e,r=0,s=0,s=0;s<8;s++)1&i&&(r^=t),e=128&t,t<<=1,e&&(t^=27),i>>=1;return r}function p(t,i,e){for(var r=0;r<4;r++)t[0+r]^=i[16*e+4*r],t[4+r]^=i[16*e+4*r+1],t[8+r]^=i[16*e+4*r+2],t[12+r]^=i[16*e+4*r+3]}function y(t){for(var i,e,r,s=1;s<4;s++)for(e=0;e>4,t[4*r+i]=s[16*e+(15&t[4*r+i])]}function b(t){for(var i=0;i<4;i++)t[i]=e[16*((240&t[i])>>4)+(15&t[i])]}function g(t){return parseInt(t,16)}var e=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],s=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=0,w=0,M=[2,0,0,0];return{decryption:function(t,i){for(var e=Array(16),r=0;r<16;r++)e[r]=16*g(i.substr(2*r,1))+g(i.substr(2*r+1,1));var s=Array(16);for(r=0;r<16;r++)s[r]=16*g(t.substr(2*r,1))+g(t.substr(2*r+1,1));var n=Array(16);switch(r=[],e.length){default:case 16:m=4,w=10;break;case 24:m=6,w=12;break;case 32:m=8,w=14}for(var h=r=Array(16*(w+1)),a=Array(4),o=4*(w+1),l=0;l{function f(t,i){var e=(65535&t)+(65535&i);return(t>>16)+(i>>16)+(e>>16)<<16|65535&e}function a(t,i,e,r,s,n){return f((i=f(f(i,t),f(r,n)))<>>32-s,e)}function d(t,i,e,r,s,n,h){return a(i&e|~i&r,t,i,s,n,h)}function c(t,i,e,r,s,n,h){return a(i&r|e&~r,t,i,s,n,h)}function v(t,i,e,r,s,n,h){return a(i^e^r,t,i,s,n,h)}function p(t,i,e,r,s,n,h){return a(e^(i|~r),t,i,s,n,h)}function h(t,i){t[i>>5]|=128<>>9<<4)]=i;for(var e,r,s,n,h=1732584193,a=-271733879,o=-1732584194,l=271733878,u=0;u>5]>>>r%32&255);return i}function l(t){var i=[];for(i[(t.length>>2)-1]=void 0,r=0;r>5]|=(255&t.charCodeAt(r/8))<>>4&15)+e.charAt(15&i);return r}function u(t){return unescape(encodeURIComponent(t))}function s(t){return o(h(l(t=u(t)),8*t.length))}function n(t,i){var e,t=u(t),i=u(i),r=l(t),s=[],n=[];for(s[15]=n[15]=void 0,16{e&&e()},()=>{r&&r(d.LICENSE_ERROR)}):r&&r(d.NAME_KEY_ERROR)},Hi(t,i,e){void 0!==t.mapURL?i&&i():(t.enableCollect&&this.Qi(t),this.Ki(()=>{new h({method:"POST",url:Rr.check,header:{"X-Requested-With":"XMLHttpRequest","Content-type":"application/json;charset=utf-8"},data:this.Ji(t)}).vi(()=>{i&&i()},t=>{e&&e(t)},()=>{i&&i()})},()=>{i&&i()}))},Ki(t,i){new h({method:"GET",url:Rr.online}).vi(()=>{t&&t()},()=>{i&&i()},()=>{i&&i()})},Ji(t,i){let e;u.environment===zt.BROWSER&&(r=Ht.global(),-1!==(r=(e=r.location.host).indexOf(":")))&&(e=e.slice(0,r));var r={mapId:t.buildingID,appName:t.appName};return i?r.keyValue=t.key:r.appKey=t.key,i?r.webUrl=e||kr:r.webURL=e||kr,r},Qi(t){if("undefined"!=typeof navigator&&"undefined"!=typeof document){var e={};-1!==navigator.userAgent.indexOf("Opera")?e.userAgent="Opera":-1!==navigator.userAgent.indexOf("Firefox")?e.userAgent="FF":-1!==navigator.userAgent.indexOf("Chrome")?e.userAgent="Chrome":-1!==navigator.userAgent.indexOf("Safari")&&0===navigator.userAgent.indexOf("Chrome")?e.userAgent="Safari":-1!==navigator.userAgent.indexOf("compatible")&&-1!==navigator.userAgent.indexOf("MSIE")?e.userAgent="IE":-1!==navigator.userAgent.indexOf("Trident")&&(e.userAgent="Edge"),e.product="JS",e.sdkVersion=L.VERSION+"."+L.BUILD,e.appName=t.appName,e.appkey=t.key;var t=u.document.createElement("canvas").getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");e.gpu=r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):null,e.os=navigator.platform;let i=!0;var s=navigator.userAgent,n=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"];for(let t=0;t{200!==t.ci.status&&this.ue.oe(t.di.url),t.pi()}),this.le.length=0,this.ue.he(!0)},de(i,e,r,s){if(i.mapURL){let t;t=i.isPreview?i.isOutdoor?i.tile?i.mapURL+i.buildingID+"/separate/"+i.buildingID+e+".fmap":i.mapURL+i.buildingID+"/"+i.buildingID+e+".fmap":i.tile?i.mapURL+i.mapID+"/"+i.bid+"/"+i.buildingID+"/separate/"+i.buildingID+e+".fmap":i.mapURL+i.mapID+"/"+i.bid+"/"+i.buildingID+"/"+i.buildingID+e+".fmap":i.mapURLAbsolute?i.mapURL+i.buildingID+e+".fmap":i.isOutdoor?i.mapURL+i.buildingID+"/"+i.buildingID+e+".fmap":i.mapURL+i.mapID+"/"+i.bid+"/"+i.buildingID+"/"+i.buildingID+e+".fmap",void(r&&r(t))}else{var t={newFlag:Ar,keyType:Pr,isSeparate:!1},e=(i.isOutdoor||(t.bId=i.bid,t.rootMid=i.mapID),new h({method:"POST",url:""===e?Rr.download:Rr.downloadTile+"/"+i.buildingID+e+".fmap",header:{"X-Requested-With":"XMLHttpRequest","Content-type":"application/json;charset=utf-8"},data:Object.assign(t,xr.Ji(i,!0))}));this.le.push(e),e.vi(t=>{r&&r(t.replace('"',"").replace('"',""))},t=>{s&&s(t)},t=>{s&&s(t)})}},ce(r,s,n){r.enableCollect=Lr,xr.Hi(r,()=>{this.de(r,"",e=>{var t=new h({method:"GET",responseType:"arraybuffer",url:e});this.le.push(t),this.ue.ae(e),t.vi(t=>{this.ue.oe(e);var t=new Uint8Array(t);let i=this.Yi.Pi(t);!r.isOutdoor||(t=[],i.keys&&0!==i.keys.length?t.push(...i.keys):t.push(i.key),r.isPreview)?s&&s(i):xr.Xi(r,t,()=>{s&&s(i)},t=>{n&&n(t)})},t=>{n&&(t===d.PATH_ERROR?n(d.MAP_ID_URL_ERROR):n(t)),this.ue.oe(e)},t=>{n&&n(t),this.ue.oe(e)})},t=>{n&&n(t)})},t=>{n&&n(t)})},ve(r,s,n){r.enableCollect=Lr,xr.Hi(r,()=>{this.de(r,".scene",e=>{this.ue.ae(e);var t=new h({method:"GET",responseType:"arraybuffer",url:e});this.le.push(t),t.vi(t=>{var t=new Uint8Array(t);let i=this.Yi.Di(t);this.ue.oe(e),!r.isOutdoor||(t=[],i.keys&&0!==i.keys.length?t.push(...i.keys):t.push(i.key),r.isPreview)?s&&s(i):xr.Xi(r,t,()=>{s&&s(i)},t=>{n&&n(t)})},t=>{n&&n(t),this.ue.oe(e)},t=>{n&&n(t),this.ue.oe(e)})},t=>{n&&n(t)})},t=>{n&&n(t)})},pe(t,e,r){this.de(t,".gate",i=>{this.ue.ae(i);var t=new h({method:"GET",responseType:"arraybuffer",url:i});this.le.push(t),t.vi(t=>{t=new Uint8Array(t),t=this.Yi.Fi(t);e&&e(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)})},t=>{r&&r(t)})},ye(t,i,e,r){this.de(t,".floor."+i+".geo",i=>{var t=new h({method:"GET",responseType:"arraybuffer",url:i});this.ue.ae(i),this.le.push(t),t.vi(t=>{t=new Uint8Array(t),t=this.Yi.Vi(t);e&&e(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)})},t=>{r&&r(t)})},_e(t,i,e,r){this.de(t,".floor."+i+".biz",i=>{var t=new h({method:"GET",responseType:"arraybuffer",url:i});this.ue.ae(i),this.le.push(t),t.vi(t=>{t=new Uint8Array(t),t=this.Yi.Ci(t);e&&e(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)})},t=>{r&&r(t)})},be(t,i,e,r){this.de(t,i,i=>{var t=new h({method:"GET",responseType:"arraybuffer",url:i});this.ue.ae(i),this.le.push(t),t.vi(t=>{t=new Uint8Array(t),t=this.Yi.Wi(t);e&&e(t),this.ue.oe(i)},t=>{r&&r(t),this.ue.oe(i)})},t=>{r&&r(t)},t=>{r&&r(t)})},ge(t,i,e,r){this.be(t,".floor."+i+".navi",e,r)},me(t,i,e,r){this.be(t,".floor."+i+".drive.navi",e,r)},we(t,i,e,r){this.be(t,".floor."+i+".accessible.navi",e,r)}});class Gr{constructor(){}}Object.assign(Gr.prototype,{Me(e,r){var s=[];let n=0;for(let t=0;t{t.xe(i)}):t==Zr.PUSH&&i.je.push(this)},Te(){this.Zt=new l,0!=this.Ie.size&&this.Ie.forEach(t=>{this.Zt.Vt(t.getBound())})}});class Ur{constructor(){this.ke=-1,this.ni=y.NONE,this.Ae=null,this.Zt=null}getType(){return this.ni}getCoordinates(){return this.Ae}getBound(){return this.Zt||this.Te(),this.Zt}}Object.assign(Ur.prototype,{pi(){},xe(t){t._support(this)==Zr.PUSH&&t.je.push(this)}});class qr extends Ur{constructor(t){super(),this.ke=t.eid,this.ni=y.POINT,Object.assign(this,t)}}Object.assign(qr.prototype,{Te(){this.Zt=new l,this.Ae&&this.Zt.Bt(this.Ae)},xe(t){t._support(this)==Zr.PUSH&&t.je.push(this)}});class Yr extends Ur{constructor(t){super(),this.ke=t.eid,this.ni=y.POLYGON,Object.assign(this,t)}getCenter(){return this.zt}}Object.assign(Yr.prototype,{Te(){this.Zt=new l,this.Ae&&this.Ae.forEach(t=>{this.Zt.Bt(t)})},xe(t){t._support(this)==Zr.PUSH&&t.je.push(this)}});class zr{constructor(){this.Pe=[1,2,3,4],this.Le=[6,7,9],this.De=[31,32],this.Se=new Map,this.Se.set(31,y.EXTENTGROUP),this.Se.set(32,y.MODELGROUP),this.Se.set(6,y.FACILITYGROUP),this.Se.set(7,y.LABELGROUP),this.Se.set(9,y.EXTERNALMODELGROUP),this.Fe=new Map,this.Fe.set(31,["extentLayer",null]),this.Fe.set(32,["modelLayer","labelLayer"]),this.Fe.set(6,["poiLayer",null]),this.Fe.set(7,["labelLayer",null]),this.Fe.set(9,["externalModelLayer",null]),this.Yi=new wr}}Object.assign(zr.prototype,{Ge(t){var i;return t?(i=t.scene,this.Ve(i,t)):null},Ve(t,e){let{layerGroups:i,...r}=t,s=t.fileVer,n=new Wr(r);return i.forEach(t=>{var i=this.Be(t,e,s);n.Ie.set(t.gid,i)}),n},Be(t,i,e){let{layers:r,...s}=t,n=new Wr(s),h=i&&i.floors?i.floors.get(t.gid).geo[0]:null,a=i&&i.floors?i.floors.get(t.gid).biz[0]:null;return r.forEach(t=>{6===t.ltype&&-1!==t.lname.indexOf("storelabel")&&(t.ltype=7);var i=this.Ce(t,h,a,e);null!==i&&n.Ie.set(this.Se.get(t.ltype),i)}),this.Ze(n),n},Ze(t){var i=Array.from(t.Ie);i.sort((t,i)=>t[0]-i[0]),t.Ie=new Map(i)},Ce(t,i,e,r){var s;return-1===this.Pe.indexOf(t.ltype)&&this.Fe.get(t.ltype)?(s=new Wr(t),this.We(s,i,e,r),s&&(s.ni=this.Se.get(t.ltype)),s):null},We(t,i,e,r){if(t){var s=this.Fe.get(t.ltype);if(s){var n=i?i[s[0]]:[],h=e?e[s[0]]:[];switch(t.ltype){case 6:this.Ue(t,n,h,r,y.FACILITY);break;case 7:this.Ue(t,n,h,r,y.LABEL);break;case 9:this.Ue(t,n,h,r,y.EXTERNALMODEL);break;case 31:this.qe(t,n,h,r,y.EXTENT,null);break;case 32:this.qe(t,n,h,r,y.MODEL,i?i[s[1]]:null)}}}},Ue(i,e,r,s,n){for(let t=0;t{h&&h(i,t);let s=this.lr(n);t=n.loadNavi&&s.buildings&&0{h&&h(t,i);var e=void 0!==n.level?n.level:parseInt(s.defGid),r=(this.ur(n,e,h),n.visibleLevels||s.levels);for(let t=0;t{h&&h(i,t)})},(t,i)=>{h&&h(t,i)})},pe(e,t,r,s){t?(t=this.dr(e))?r&&r("gate",t):this.er.pe(e,t=>{this.He.get(e.buildingID).gate=t,r&&r("gate",t)},t=>{var i;e.navigationData?((i=this.He.get(e.buildingID)).gate=e.navigationData,r&&r("gate",i.gate)):s("error",t)}):r&&r("gate",null)},ve(i,e,r){var t=this.lr(i);t?(e&&e("scene",t),i.justDecode||(t=this.Xe.get(i.buildingID),e&&e("building",t))):this.er.ve(i,t=>{i.isOutdoor&&this.cr(t),this.He.set(i.buildingID,{scene:t}),e&&e("scene",t),i.justDecode||(t=this.ir.Ve(t),this.Xe.set(i.buildingID,t),e&&e("building",t))},t=>{r&&(t===d.PATH_ERROR?r("error",d.MAP_ID_URL_ERROR):r("error",t))})},cr(t){var i=t.fileVer;t.buildings&&1{i.floors&&(i.levelChart=[],i.fids=[],i.floors.forEach(t=>{t.Ae=Vr.Oe(t.idxs,t.pts),t.pgid&&i.levelChart.push(t.pgid,t.gid),t.baseLevel&&(i.minlevel=t.minlevel,i.maxlevel=t.maxlevel),t.fids&&i.fids.push.apply(i.fids,t.fids)}))})},ur(t,i,e,r){let s=this.Qe.get(t.buildingID+t.uuid);s||(s=[],this.Qe.set(t.buildingID+t.uuid,s)),r?s.unshift(i):s.push(i),this.tr&&1!==s.length||this.vr(t,e)},vr(n,h){let a=this.lr(n);if(a){let s=this.Qe.get(n.buildingID+n.uuid);if(s&&0!==s.length){let t=this.Ke.get(n.buildingID+n.uuid),r=(t||(t=[],this.Ke.set(n.buildingID+n.uuid,t)),s[0]);-1!==t.indexOf(r)?(s.splice(s.indexOf(r),1),this.vr(n,h)):(t.push(r),this.pr(n,r,(t,i)=>{let e=this.Je.get(n.buildingID+n.uuid);"layerGroup"===t&&(h&&h(t,i),e++,this.Je.set(n.buildingID+n.uuid,e),e===a.layerGroups.length&&h&&h("decode",this.nr(n)),s.splice(s.indexOf(r),1),this.vr(n,h)),"layer"===t&&h&&h(t,i),"floor"===t&&(h&&h(t,i),e===a.layerGroups.length)&&h&&h("complete",this.yr(n))},(t,i)=>{h&&h(t,i)}))}}},pr(h,a,o,l){let u=this.lr(h);var t=this._r(u,a);if(t){var f=t.gname,t=t.naviType||0;let i=this.$e[0],e=0,s=new Map,n=h.merge,r=function(r){if(e++,i===e){let i=s.get("geo"),e=s.get("biz");var t;n&&n.merge(a,i,e,u.fileVer),o&&o("layerGroup",s),h.justDecode||((t=r.br(h,a)).Ie.forEach(t=>{r.ir.We(t,i,e,u.fileVer),o&&o("layer",t)}),o&&o("floor",t))}};h.loadNavi&&((0!=(t&Xr.WALK_RODE_NETWORK)||u.fileVer<3)&&(i++,this.ge(h,a,f,(t,i)=>{s.set(t,i),o&&o(t,i),r(this)},t=>{l&&l(t)})),0!=(t&Xr.DRIVE_RODE_NETWORK)&&(i++,this.me(h,a,f,(t,i)=>{s.set(t,i),o&&o(t,i),r(this)},t=>{l&&l(t)})),0!=(t&Xr.ACCESSIBLE_RODE_NETWORK))&&(i++,this.we(h,a,f,(t,i)=>{s.set(t,i),o&&o(t,i),r(this)},t=>{l&&l(t)})),this.ye(h,a,f,(t,i)=>{s.set(t,i),o&&o(t,i),r(this)},t=>{l&&l(t)}),this._e(h,a,f,(t,i)=>{s.set(t,i),o&&o(t,i),r(this)},t=>{l&&l(t)})}else l&&l("error",d.DEFAULT_LEVEL_ERROR)},ye(i,e,t,r,s){var n=this.gr(i,e,"geo");n?r&&r("geo",n):this.er.ye(i,t,t=>{this.mr(i,e,"geo",t),r&&r("geo",t)},t=>{s&&s("error",t)})},_e(i,e,t,r,s){var n=this.gr(i,e,"biz");n?r&&r("biz",n):this.er._e(i,t,t=>{this.mr(i,e,"biz",t),r&&r("biz",t)},t=>{s&&s("error",t)})},ge(i,e,t,r,s){var n=this.gr(i,e,"navi");n?r&&r("navi",n):this.er.ge(i,t,t=>{this.mr(i,e,"navi",t),r&&r("navi",t)},t=>{s&&s("error",t)})},me(i,e,t,r,s){var n=this.gr(i,e,"drive_navi");n?r&&r("drive_navi",n):this.er.me(i,t,t=>{this.mr(i,e,"drive_navi",t),r&&r("drive_navi",t)},t=>{s&&s("error",t)})},we(i,e,t,r,s){var n=this.gr(i,e,"accessible_navi");n?r&&r("drive_navi",n):this.er.we(i,t,t=>{this.mr(i,e,"accessible_navi",t),r&&r("accessible_navi",t)},t=>{s&&s("error",t)})},sr(t,e){this.ce(t,(t,i)=>{e&&e(t,i)},(t,i)=>{e&&e(t,i)})},ce(i,e,r){let s=this.nr(i);s?e&&e("decode",s):this.er.ce(i,t=>{this.wr(i,t),s=this.nr(i),e&&e("decode",s),i.justDecode||(t=this.ir.Ge(s),this.Xe.set(i.buildingID,t),e&&e("complete",t))},t=>{r&&r("error",t)})},yr(t){if(this.Xe)return this.Xe.get(t.buildingID)||null},br(t,i){t=this.Xe.get(t.buildingID);return t?t.Ie.get(i):null},wr(i,e){var r={scene:null,floors:new Map},s=this.Yi.Li(e);i.isOutdoor&&this.cr(s),r.scene=s,r.gate=this.Yi.Si(e);for(let t=0;tt,fromReference:t=>t},[Kr]:{transfer:es,primaries:rs,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[ts]:{transfer:is,primaries:ss,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(os),fromReference:t=>t.applyMatrix3(as)},[$r]:{transfer:es,primaries:ss,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(os),fromReference:t=>t.applyMatrix3(as).convertLinearToSRGB()}},us=new Set([Jr,ts]),N={enabled:!0,Mr:Jr,get workingColorSpace(){return this.Mr},set workingColorSpace(t){if(!us.has(t))throw new Error(`Unsupported working color space, "${t}".`);this.Mr=t},convert:function(t,i,e){return!1!==this.enabled&&i!==e&&i&&e?(i=ls[i].toReference,(0,ls[e].fromReference)(i(t))):t},fromWorkingColorSpace:function(t,i){return this.convert(t,this.Mr,i)},toWorkingColorSpace:function(t,i){return this.convert(t,i,this.Mr)},getPrimaries:function(t){return ls[t].primaries},getTransfer:function(t){return t===Qr?is:ls[t].transfer},getLuminanceCoefficients:function(t,i=this.Mr){return t.fromArray(ls[i].luminanceCoefficients)}};function fs(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ds(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let cs=Jr,vs={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},ps={h:0,s:0,l:0},ys={h:0,s:0,l:0};function _s(t,i,e){return e<0&&(e+=1),1>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,N.toWorkingColorSpace(this,i),this}setRGB(t,i,e,r=N.workingColorSpace){return this.r=t,this.g=i,this.b=e,N.toWorkingColorSpace(this,r),this}setHSL(t,i,e,r=N.workingColorSpace){return t=It(t,1),i=Et(i,0,1),e=Et(e,0,1),0===i?this.r=this.g=this.b=e:(this.r=_s(i=2*e-(e=e<=.5?e*(1+i):e+i-e*i),e,t+1/3),this.g=_s(i,e,t),this.b=_s(i,e,t-1/3)),N.toWorkingColorSpace(this,r),this}setStyle(i,e=cs){function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+i+" will be ignored.")}if(h=/^(\w+)\(([^\)]*)\)/.exec(i)){let t;var s=h[1],n=h[2];switch(s){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return r(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return r(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return r(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+i)}}else if(h=/^\#([A-Fa-f\d]+)$/.exec(i)){var s=h[1],h=s.length;if(3===h)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===h)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+i)}else if(i&&0>8&255]+i[t>>16&255]+i[t>>24&255]+"-"+i[255&e]+i[e>>8&255]+"-"+i[e>>16&15|64]+i[e>>24&255]+"-"+i[63&r|128]+i[r>>8&255]+"-"+i[r>>16&255]+i[r>>24&255]+i[255&s]+i[s>>8&255]+i[s>>16&255]+i[s>>24&255];return i.length=0,t.toUpperCase()}static findNearNthPowerOfTwo(t){t-=1;return(t=(t=(t=(t=(t|=t>>1)|t>>2)|t>>4)|t>>8)|t>>16)<0?1:1+t}static rgbToArray(t){var i=new bs;return i.setStyle(t),[i.r,i.g,i.b]}static toRgba(t){var i;return void 0===t?t:"number"!=typeof t?3<=(i=t.split(",")).length?"rgba("+parseInt(i[0])+","+parseInt(i[1])+","+parseInt(i[2])+",1)":t:"rgba("+parseInt(255*new bs(t).r)+","+parseInt(255*new bs(t).g)+","+parseInt(255*new bs(t).b)+",1)"}static toColor(t){var i;return"number"==typeof t?t:3<=(i=t.split(",")).length?parseInt(i[0])<<16|parseInt(i[1])<<8|parseInt(i[2]):(console.error("color format error",t),0)}static cov(s){var t=[],i=[0,0],n=[];for(let t=0;t{}),this.Or=null,this.Ir=null,this.kr=null}query(t,i){if(this.Ar(),null===t.buildings){var e=[];for(let t=0;t{this.di.tile?this.Or.load(e,(t,i)=>{this.Sr(t,i,e.isOutdoor),this.Er&&this.Er._analyse(t,i,e)}):this.Or.loadWhole(e,(t,i)=>{this.Sr(t,i,e.isOutdoor),this.Er&&this.Er._analyse(t,i,e)})},0)},Ar(){if(!(0t.level==i.level&&t.type==i.type&&t.distance&&i.distance?t.distance-i.distance:0)},Pr(t,i,e){let r=this.di;null!==t.buildingID&&(r={buildingID:t.buildingID,mapID:t.buildingID});var s=this.Or.getData(r);if(!s)return[];var n=this.Gr(t),h=this.Fr(t);if(h===y.NONE)return[];var a,o=t.li,l=o.length,u=[];for(a of s.getChildren()){var f,d=a[0];if(-1!==n.indexOf(d))for(f of a[1].getChildren()){var c=f[1];if(0!=(c.getType()&h))for(var v of c.getChildren()){var v=v[1],p={K:void 0};this.Vr(o,l,v,p)&&u.push(this.Br(d,v,p))}}}return u},Lr(i){let e=null;var r=this.fi;for(let t=0;t>2&7},set ss(t){this.ni|=t<<5},get ss(){return this.ni>>5&3},jr(t){this.ke=t,this.Jt={x:0,y:0},this.ni=0,this.Xr=0,this.Qr=!1,this.Kr=!1},ns(t){return this.ke==t.ke},hs(i){this.ke=i.ke,this.Jt=Object.assign({},i.Jt),this.ni=i.ni,this.Yr=[];for(let t=0;t>2&3},set Ms(t){this.ni|=t<<4},get Ms(){return this.ni>>4&3},set Rs(t){t?this.ni|=16:this.ni&=-17},get Rs(){return 16&this.ni?1:0},Os(i){this.ke=i.ke,this.cs=i.cs,this.jt=Object.assign({},i.jt),this.vs=i.vs,this.At=Object.assign({},i.At),this.Wr=i.Wr,this.ni=i.ni,this.ps=[],this.ys=i.ys;for(let t=0;tthis.hn&&(this.hn=this.zs[t].ke),t++);for(let t=0;tthis.nn&&(this.nn=this.Ys[t].ke),t++)},yn(t){t=this.rn.get(t);return void 0===t?null:t},_n(t){t=this.sn.get(t);return void 0===t?null:t},bn(i){let e=Number.MAX_VALUE,r=null;for(let t=0;ts.area&&(e=s,r=s.area)}return e},Ln(i){let e=-1;for(let t=0;ti?(y.Jr=i,y.ts=[],y.ts.push(o),h.push(e.Ys[c]),h.sort(a)):Math.abs(y.Jr-(d+l.Jr+t))<1e-12&&-1==y.ts.indexOf(o)&&y.ts.push(o))}}}}}}return!(nl){n=v.left[t],l=M;break}}if(!n)break;r.push(...v.left),r.push(...v.other)}for(n=i[0];;){var O=this.La(e,n,s);if(O.inside&&0G.A()?v.push(...y):(t=!0,p=this.Ca(o,y[0].G,y[0].Lt),this.Za(o,e,p))}t||v.forEach(t=>{t=this.Ca(o,t.G,t.Lt);this.Za(o,e,t)})}if(a&&a.pass!=V.NaviModelPassType_NOT_PASS){if(a.pass===V.NaviModelPassType_PASS_THROUGH||a.pass===V.NaviModelPassType_PASS_NOT_THROUGH){var b={},g=[],m=[],w=this.Yn.zs;let i=!0;for(let t=0;tu&&((o=this.$a(e,l.Jt))==n||o.pass!=V.NaviModelPassType_PASS_NOT_THROUGH)&&(h=u,a=l)}return a},$a(t,i){let e=null;t=this.ua(t);let r=Number.MAX_VALUE,s=Number.MAX_VALUE,n=null;var h=t.Xs;for(let t=0;to&&(s=o,n=a),this.Wh>o&&(o=a.area,r>o)&&(r=o,e=a)}return null==e?n:e},Ja(t,i){return!!t.bound.isCross(i.bound)&&(t=t.zt,!!G.X(t,i.$t,i.ks))},Ca(t,i,e){var r=this.Uh.find(function(t){return t==e.cs}),s=this.Uh.find(function(t){return t==e.vs}),n=(null==r&&this.Uh.push(e.cs),null==s&&this.Uh.push(e.vs),this.Vh);let h=null;for(let t=0;t=o)return r.K=Number.MAX_VALUE,r.gh=!1;if(!r.gh)return!1;if(1!=this.ni){var f={};for(let t=0;tG.K(u.G,r.jt)?(n.push(u),n.push(i)):(n.push(i),n.push(u))),n}return n},po(i,e,r,t,s){var n=t||30;for(let t=0;t<360;t+=n){var h=new Ts;this.uo(i,e,t,h,s),1==h.gh&&r.push(h)}r.sort(this.fo)},Ua(t,i,e,r){var s=new Map,n=[];for(this.po(t,i,n,e,r);0!=n.length;){var h=n[0];let t=s.get(h.Lt.ke);t?t.push(h):((t=[]).push(h),s.set(h.Lt.ke,t)),n.splice(0,1)}return s},ba(t,i){var e=new x,i=(e.ke=this.ka(),e.Jt=Object.assign({},i),this.ua(t));return i.Ys.push(e),i.rn.set(e.ke,i.Ys.length-1),this.Xa(t).Yn=i,e},yo(t,i,e){return e?this.ba(t,i):((e=new x).ke=this.mn(),e.Jt=Object.assign({},i),t=(i=this.ua(t)).Ys,t=this.no(e,t),i.rn.set(e.ke,t),e)},vo(i,e,r,s){var n,h=this.ua(-1);for(let t=0;t[t,!1]));for(let r=0;r{i.zr.push(parseInt(t))}),n.liftFloorArr.forEach(t=>{i.Yr.push(parseInt(t))}),s.push(i),e.set(n.nodeId,r)}}return s},Bl(t){var i,e=[];for(i in t.naviSegments){var r,s=t.naviSegments[i],n=s.geoArr;n&&((r=new j).ke=s.segmentId,r.cs=s.snode,r.jt={x:parseFloat(n[0].x.toFixed(3)),y:parseFloat(n[0].y.toFixed(3))},r.vs=s.enode,r.At={x:parseFloat(n[1].x.toFixed(3)),y:parseFloat(n[1].y.toFixed(3))},r.Wr=s.length,r.ws=s.entry,r.gs=s.rank,e.push(r))}return e},Zl(e){var r=[];for(let i=0,t=e.extentLayer.length;iu&&(r=u),s=!0;break}if(V.NaviLiftType_Stair==l){u=this.Uo;r>u&&(r=u),s=!0;break}}else if(p.PRIORITY_ESCALATORFIRST==this.No){if(V.NaviLiftType_Lift==l||V.NaviLiftType_Accessible==l){u=this.Fo;r>u&&(r=u),s=!0;break}if(V.NaviLiftType_Escalator==l)return this.Vo;if(V.NaviLiftType_Stair==l){u=this.Uo;r>u&&(r=u),s=!0;break}}else if(p.PRIORITY_STAIRFIRST==this.No){if(V.NaviLiftType_Lift==l){u=this.Fo;r>u&&(r=u),s=!0;break}if(V.NaviLiftType_Escalator==l||V.NaviLiftType_Accessible==l){u=this.Co;r>u&&(r=u),s=!0;break}if(V.NaviLiftType_Stair==l)return this.Zo}else{if(p.PRIORITY_LIFTFIRST1==this.No||p.PRIORITY_STAIRFIRST1==this.No||p.PRIORITY_ESCALATORFIRST1==this.No)return this.qo;if(p.PRIORITY_LIFTONLY==this.No||p.PRIORITY_ESCALATORONLY==this.No||p.PRIORITY_STAIRONLY==this.No||p.PRIORITY_ACCESSIBLEONLY==this.No)return this.qo}}}}return s?r:null},zl(i,e){let r=Number.MAX_VALUE,s=!1;var n=i.Zre.Zr)&&3!==c.ss))for(let t=0;ti.Zr)&&3!==u.ss))for(let t=0;t[t,!1]));for(let r=0;r=t.size)ethis.hl))for(var s of t.get(i).adjs)if(s.id!==i&&-1===r.indexOf(s.id)){if(r.push(s.id),(e+=s.length)>this.hl)return;this.eu(t,s.id,e,r),r.pop(),e-=s.length}},ru(t,i,e,r,s){if(e>=t.size-1)rthis.hl))for(var n of t.get(i).adjs)if(n.id!=i&&-1===s.indexOf(n.id)){if(s.push(n.id),(r+=n.length)>=this.hl)return;this.eu(t,n.id,e+1,r,s),s.pop(),r-=n.length}},su(t,e,r){var s=t.Ro(r.Jt).Ta(r.Jt).bh;if(this.Ko&&(this.Qo=null,s)&&0e.Zr))for(let t=0;t{t=this.Iu(s,t);return t.index=i,t}),h=[];for(let t=0;t{(t.sa||t.Jt.sa)&&e.push(r),r++}),0!=e.length)for(;0!=e.length;){for(let t=0;t=e[0]){i[t+1].sa=!0;break}e.splice(0,1)}},Pu(t){let i="";t=this.br(t);return i=null==t||""+(i=this.vu==s.ZH?t.desc:t.gname.toUpperCase())!="null"&&""+i!=""&&""+i!="undefined"?i:t.gname.toUpperCase()},Lu(e,i,r,s,n,h){var t=e[i],a=e[i+1];let o=null,l=this.ku(this._u[a.relField]);if(this.mu=i==e.length-3&&a.distancee?this.ku("drive_up"):this.ku("drive_down"),this.ku("along_ramp")+" "+t+" "+_):(t=o>e?this.ku("up_to"):this.ku("down_to"),this.ku("take_stair")+" "+t+" "+_),n.push(c),h.push({startPoint:p[0],startDirection:o>e?this.ku("up"):this.ku("down"),startLevel:e})}f=!f}}else{d=e;for(let t=0;t=r.size)return!1}var f=[];for(f.push(t);0_&&(b.Jr=_,b.ts=[],b.ts.push(d),f.push(y))}f.sort(function(t,i){return r.get(t).Jr-r.get(i).Jr})}}}return!(lr&&((t=t===V.Entry_FORWARD?ws.Entry_BACK:t)===V.Entry_BACK&&(t=ws.Entry_FORWARD),i=l.startId),t===ws.Entry_FORWARD||t===ws.Entry_BOTH){for(var c of d)c.direction=t,c.u0=i;s.points.push(...d),l.startPoint.x>=n&&l.startPoint.x<=h&&l.startPoint.y>=a&&l.startPoint.y<=o&&u.push(l.startId),l.endPoint.x>=n&&l.endPoint.x<=h&&l.endPoint.y>=a&&l.endPoint.y<=o&&u.push(l.endId)}}}var v,p,t=t.level,y=(this.Qf.xf?.get(i)).Eo.get(t).$s;for(v of u)f.set(v,y.get(v));for(p of s.points)p.branch=this.f0(f,p.u0,e.nodeID);return s}queryNode(i){let t,e;if(null!=(e=i.buildingID?this.Qf.xf.get(i.buildingID):this.Qf.xf.get(null))){var r=(t=(i.barrierFree?e.Io:e.Eo).get(i.level)).ln(i.point);if(!(r<=0)){var s=t.zs,n=new Set;for(let t=0;t{e.tile?this.Or.load(e,(t,i)=>{this.Sr(t,i,e)}):this.Or.loadWhole(e,(t,i)=>{this.Sr(t,i,e)})},0)},Sr(t,i,e){if("error"===t)this.isExistAccess=!1,this.isExistNavi=!1,this.isExistDrive=!1;else if("scene"===t&&i.naviType&&"undefined"!=i.naviType&&0!=i.naviType){this.isExistAccess=!0,this.isExistNavi=!0,this.isExistDrive=!0;let t=i.naviType;1===t?(this.isExistAccess=!1,this.isExistNavi=!1,this.isExistDrive=!1):(8<=t&&(t-=8),this.isExistAccess=!1,4<=t?t-=4:this.ni===I.Drive&&(this.isExistDrive=!1),t<=0&&!this.isExistAccess&&this.ni===I.Walk&&(this.isExistNavi=!1)),this.load_cnt++,this.isExistAccess||this.isExistNavi||this.ni!==I.Walk?this.isExistDrive||this.ni!==I.Drive||this.$f.push({buildingID:e.buildingID,error:"NONE_DRIVE_RODE_NETWORK",data:D.NONE_DRIVE_RODE_NETWORK}):this.$f.push({buildingID:e.buildingID,error:"NONE_WALK_RODE_NETWORK",data:D.NONE_WALK_RODE_NETWORK})}else if("decode"===t){var r=new As(e);r.jr(i),this.Qf.xf.set(e.bid,r),this.Qf.Eo.set(e.bid,r.Eo),i.gate&&(this.h0=i.gate.floors);for(let t=0;t=this.load_cnt?this.kr&&this.kr({result:this.$f}):(this.$f={state:t,error:"0",data:null},this.Ir&&this.Ir()))}},Br(){var i={buildings:[],distance:0,subs:[],viapoints:[]};for(let t=0;t{t.sa&&delete(h=t.Wa).sa}),{points:s,via:h}},a0(t,i){var e=t.bid;return this.y0(t.result)?(e=new Ds(Object.assign({data:this.Or.getDecode(this.Hf.get(e)),directionAssert:10,combineAsset:10,language:s.ZH},i)).Fu(t),i=this._0(e[5]),{descriptions:e[0],descriptionsData:e[1],distance:e[2],distances:e[3],ladderList:i}):{}},_0(i){for(let t=0;t{var i=parseFloat(""+t.x),t=parseFloat(""+t.y);e.push({x:i,y:t,z:r})}),h.length<2&&(a=parseFloat(""+h[0].x),h=parseFloat(""+h[0].y),e.push({x:a,y:h,z:r}));var a=new fengmap.FMSegment;a.level=n,a.points=e,s.push(a)}}e=new fengmap.FMLineMarker(Object.assign({segments:s},e));return e.passed=t&&t.passed?t.passed:this._linePassed,e},l0(t){return{id:t.ke,startPoint:{x:t.jt.x,y:t.jt.y},endPoint:{x:t.At.x,y:t.At.y},startId:t.cs,endId:t.vs,roadRank:t.gs,roadEntry:t.ws}},f0(t,i,e){if(0==t.length||null==t.get(i)||null==t.get(e))return!1;var r,s=new Map;for(r of t.keys())s.set(r,!1);for(var n=[i];0e?t.x-i.x:i.x-t.x)}else{let e=i[0].ye?t.y-i.y:i.y-t.y)}return e},T0(t,i){var e=[],r=(e.push(t[0]),e.push(...i),e.push(t[1]),[]);for(let t=0;t{let i=t.createReadStream(r),e=0;this.P0=null,i.on("readable",()=>{var t=i.read();null!=t&&(e+=t.length,this.P0?this.P0=Buffer.concat([this.P0,new Buffer(t)],e):this.P0=new Buffer(t))}),i.on("end",()=>{this.j0=200,this.L0("load")}),i.on("error",t=>{this.j0=400,this.L0("error",t)})})}}Object.assign(Us.prototype,{L0(t,i){if(0!=this.yi.size){var e=this.yi.get(t);if(e)for(let t=0;t{"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.fengmap=n():t.fengmap=n()})(this,function(){return e=[function(S,x,t){t.r(x);var o={},r=(t.r(o),t.d(o,"ArcCurve",function(){return Zu}),t.d(o,"CatmullRomCurve3",function(){return cl}),t.d(o,"CubicBezierCurve",function(){return Sl}),t.d(o,"CubicBezierCurve3",function(){return Cl}),t.d(o,"EllipseCurve",function(){return zu}),t.d(o,"LineCurve",function(){return Bl}),t.d(o,"LineCurve3",function(){return ql}),t.d(o,"QuadraticBezierCurve",function(){return rc}),t.d(o,"QuadraticBezierCurve3",function(){return vc}),t.d(o,"SplineCurve",function(){return Sc}),["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"]),A=1234567,M=Math.PI/180,P=180/Math.PI;function j(){var t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(r[255&t]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+"-"+r[255&n]+r[n>>8&255]+"-"+r[n>>16&15|64]+r[n>>24&255]+"-"+r[63&e|128]+r[e>>8&255]+"-"+r[e>>16&255]+r[e>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toLowerCase()}function y(t,n,e){return Math.max(n,Math.min(e,t))}function V(t,n){return(t%n+n)%n}function z(t,n,e){return(1-e)*t+e*n}function G(t,n){switch(n.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function a(t,n){switch(n.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}var X={DEG2RAD:M,RAD2DEG:P,generateUUID:j,clamp:y,euclideanModulo:V,mapLinear:function(t,n,e,i,r){return i+(t-n)*(r-i)/(e-n)},inverseLerp:function(t,n,e){return t!==n?(e-t)/(n-t):0},lerp:z,damp:function(t,n,e,i){return z(t,n,1-Math.exp(-e*i))},pingpong:function(t){var n=1>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(t){return t*M},radToDeg:function(t){return t*P},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,n,e,i,r){var o=Math.cos,a=Math.sin,s=o(e/2),u=a(e/2),l=o((n+i)/2),c=a((n+i)/2),f=o((n-i)/2),h=a((n-i)/2),v=o((i-n)/2),d=a((i-n)/2);switch(r){case"XYX":t.set(s*c,u*f,u*h,s*l);break;case"YZY":t.set(u*h,s*c,u*f,s*l);break;case"ZXZ":t.set(u*f,u*h,s*c,s*l);break;case"XZX":t.set(s*c,u*d,u*v,s*l);break;case"YXY":t.set(u*v,s*c,u*d,s*l);break;case"ZYZ":t.set(u*d,u*v,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:a,denormalize:G},Y=0,W=1,Q=1e3,q=1001,m=1003,O=1006,Z=1016,J=1023,K="srgb-linear",t="display-p3-linear",$="linear",tt=7680;function nt(t){return(nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function et(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=nt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=nt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==nt(t)?t:t+""))(i.key),i)}}var v=(()=>{function l(t,n,e,i,r,o,a,s,u){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");l.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,e,i,r,o,a,s,u)}return t=l,(n=[{key:"set",value:function(t,n,e,i,r,o,a,s,u){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=n,l[4]=r,l[5]=s,l[6]=e,l[7]=o,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(t){var n=this.elements,t=t.elements;return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],this}},{key:"extractBasis",value:function(t,n,e){return t.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(t){t=t.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,n){var t=t.elements,n=n.elements,e=this.elements,i=t[0],r=t[3],o=t[6],a=t[1],s=t[4],u=t[7],l=t[2],c=t[5],t=t[8],f=n[0],h=n[3],v=n[6],d=n[1],m=n[4],p=n[7],y=n[2],g=n[5],n=n[8];return e[0]=i*f+r*d+o*y,e[3]=i*h+r*m+o*g,e[6]=i*v+r*p+o*n,e[1]=a*f+s*d+u*y,e[4]=a*h+s*m+u*g,e[7]=a*v+s*p+u*n,e[2]=l*f+c*d+t*y,e[5]=l*h+c*m+t*g,e[8]=l*v+c*p+t*n,this}},{key:"multiplyScalar",value:function(t){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=t,n[4]*=t,n[7]*=t,n[2]*=t,n[5]*=t,n[8]*=t,this}},{key:"determinant",value:function(){var t=this.elements,n=t[0],e=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],u=t[7],t=t[8];return n*o*t-n*a*u-e*r*t+e*a*s+i*r*u-i*o*s}},{key:"invert",value:function(){var t=this.elements,n=t[0],e=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],c=l*o-a*u,f=a*s-l*r,h=u*r-o*s,v=n*c+e*f+i*h;return 0==v?this.set(0,0,0,0,0,0,0,0,0):(t[0]=c*(c=1/v),t[1]=(i*u-l*e)*c,t[2]=(a*e-i*o)*c,t[3]=f*c,t[4]=(l*n-i*s)*c,t[5]=(i*r-a*n)*c,t[6]=h*c,t[7]=(e*s-u*n)*c,t[8]=(o*n-e*r)*c,this)}},{key:"transpose",value:function(){var t=this.elements,n=t[1];return t[1]=t[3],t[3]=n,n=t[2],t[2]=t[6],t[6]=n,n=t[5],t[5]=t[7],t[7]=n,this}},{key:"getNormalMatrix",value:function(t){return this.setFromMatrix4(t).invert().transpose()}},{key:"transposeIntoArray",value:function(t){var n=this.elements;return t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8],this}},{key:"setUvTransform",value:function(t,n,e,i,r,o,a){var s=Math.cos(r),r=Math.sin(r);return this.set(e*s,e*r,-e*(s*o+r*a)+o+t,-i*r,i*s,-i*(-r*o+s*a)+a+n,0,0,1),this}},{key:"scale",value:function(t,n){return this.premultiply(it.makeScale(t,n)),this}},{key:"rotate",value:function(t){return this.premultiply(it.makeRotation(-t)),this}},{key:"translate",value:function(t,n){return this.premultiply(it.makeTranslation(t,n)),this}},{key:"makeTranslation",value:function(t,n){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,n,0,0,1),this}},{key:"makeRotation",value:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(n,-t,0,t,n,0,0,0,1),this}},{key:"makeScale",value:function(t,n){return this.set(t,0,0,0,n,0,0,0,1),this}},{key:"equals",value:function(t){for(var n=this.elements,e=t.elements,i=0;i<9;i++)if(n[i]!==e[i])return!1;return!0}},{key:"fromArray",value:function(t){for(var n=1(t=((t,n)=>{if("object"!=rt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=rt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==rt(t)?t:t+""))(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var at=(new v).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),st=(new v).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ut=ot(ot(ot(ot({},K,{transfer:$,primaries:"rec709",luminanceCoefficients:[.2126,.7152,.0722],toReference:function(t){return t},fromReference:function(t){return t}}),"srgb",{transfer:"srgb",primaries:"rec709",luminanceCoefficients:[.2126,.7152,.0722],toReference:function(t){return t.convertSRGBToLinear()},fromReference:function(t){return t.convertLinearToSRGB()}}),t,{transfer:$,primaries:"p3",luminanceCoefficients:[.2289,.6917,.0793],toReference:function(t){return t.applyMatrix3(st)},fromReference:function(t){return t.applyMatrix3(at)}}),"display-p3",{transfer:"srgb",primaries:"p3",luminanceCoefficients:[.2289,.6917,.0793],toReference:function(t){return t.convertSRGBToLinear().applyMatrix3(st)},fromReference:function(t){return t.applyMatrix3(at).convertLinearToSRGB()}}),lt=new Set([K,t]),ct={enabled:!0,u:K,get workingColorSpace(){return this.u},set workingColorSpace(t){if(!lt.has(t))throw new Error('Unsupported working color space, "'.concat(t,'".'));this.u=t},convert:function(t,n,e){return!1!==this.enabled&&n!==e&&n&&e?(n=ut[n].toReference,(0,ut[e].fromReference)(n(t))):t},fromWorkingColorSpace:function(t,n){return this.convert(t,this.u,n)},toWorkingColorSpace:function(t,n){return this.convert(t,n,this.u)},getPrimaries:function(t){return ut[t].primaries},getTransfer:function(t){return""===t?$:ut[t].transfer},getLuminanceCoefficients:function(t){var n=1(t=((t,n)=>{if("object"!=pt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=pt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==pt(t)?t:t+""))(i.key),i)}}var bt={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},_t={h:0,s:0,l:0},wt={h:0,s:0,l:0};function St(t,n,e){return e<0&&(e+=1),1{function i(t,n,e){if(this instanceof i)return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,n,e);throw new TypeError("Cannot call a class as a function")}return t=i,(n=[{key:"set",value:function(t,n,e){var i;return void 0===n&&void 0===e?(i=t)&&i.isColor?this.copy(i):"number"==typeof i?this.setHex(i):"string"==typeof i&&this.setStyle(i):this.setRGB(t,n,e),this}},{key:"setScalar",value:function(t){return this.r=t,this.g=t,this.b=t,this}},{key:"setHex",value:function(t){var n=1>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ct.toWorkingColorSpace(this,n),this}},{key:"setRGB",value:function(t,n,e){var i=3(t=((t,n)=>{if("object"!=xt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=xt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==xt(t)?t:t+""))(i.key),i)}}N.NAMES=bt;var Et=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}return n=t,(e=[{key:"addEventListener",value:function(t,n){void 0===this.S&&(this.S={});var e=this.S;void 0===e[t]&&(e[t]=[]),-1===e[t].indexOf(n)&&e[t].push(n)}},{key:"hasEventListener",value:function(t,n){var e;return void 0!==this.S&&void 0!==(e=this.S)[t]&&-1!==e[t].indexOf(n)}},{key:"removeEventListener",value:function(t,n){var e;void 0!==this.S&&void 0!==(t=this.S[t])&&-1!==(e=t.indexOf(n))&&t.splice(e,1)}},{key:"dispatchEvent",value:function(t){if(void 0!==this.S){var n=this.S[t.type];if(void 0!==n){t.target=this;for(var e=n.slice(0),i=0,r=e.length;i(t=((t,n)=>{if("object"!=Tt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Tt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Tt(t)?t:t+""))(i.key),i)}}function Pt(t,n,e){n=Nt(n);var i=t,n=Ot()?Reflect.construct(n,e||[],Nt(t).constructor):n.apply(t,e);if(!n||"object"!=Tt(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ot=function(){return!!t})()}function Nt(t){return(Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ct(t,n){return(Ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Lt=0,Rt=(()=>{function n(){var t;if(this instanceof n)return(t=Pt(this,n)).isMaterial=!0,Object.defineProperty(t,"id",{value:Lt++}),t.uuid=j(),t.name="",t.type="Material",t.blending=1,t.side=Y,t.vertexColors=!1,t.opacity=1,t.transparent=!1,t.alphaHash=!1,t.blendSrc=204,t.blendDst=205,t.blendEquation=100,t.blendSrcAlpha=null,t.blendDstAlpha=null,t.blendEquationAlpha=null,t.blendColor=new N(0,0,0),t.blendAlpha=0,t.depthFunc=3,t.depthTest=!0,t.depthWrite=!0,t.stencilWriteMask=255,t.stencilFunc=519,t.stencilRef=0,t.stencilFuncMask=255,t.stencilFail=tt,t.stencilZFail=tt,t.stencilZPass=tt,t.stencilWrite=!1,t.clippingPlanes=null,t.clipIntersection=!1,t.clipShadows=!1,t.shadowSide=null,t.colorWrite=!0,t.precision=null,t.polygonOffset=!1,t.polygonOffsetFactor=0,t.polygonOffsetUnits=0,t.dithering=!1,t.alphaToCoverage=!1,t.premultipliedAlpha=!1,t.forceSinglePass=!1,t.visible=!0,t.toneMapped=!0,t.userData={},t.version=0,t.A=vt,t;throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Et;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Ct(e,i),e=n,(i=[{key:"alphaTest",get:function(){return this.A},set:function(t){0(t=((t,n)=>{if("object"!=Dt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Dt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Dt(t)?t:t+""))(i.key),i)}}function It(t,n,e){n=Ut(n);var i=t,n=kt()?Reflect.construct(n,e||[],Ut(t).constructor):n.apply(t,e);if(!n||"object"!=Dt(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function kt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kt=function(){return!!t})()}function jt(){return(jt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Ut(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Ut(t){return(Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Bt(t,n){return(Bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Ht=(()=>{function a(t){var n;if(this instanceof a)return(n=It(this,a)).isPointsMaterial=!0,n.type="PointsMaterial",n.color=new N(16777215),n.map=null,n.alphaMap=null,n.size=1,n.sizeAttenuation=!0,n.fog=!0,n.setValues(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=a,e=Rt;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Bt(n,e),n=a,(e=[{key:"copy",value:function(t){var n,e,i,r,o;return n=a,e="copy",i=this,o=jt(Ut(1&(r=3)?n.prototype:n),e,i),(2&r&&"function"==typeof o?function(t){return o.apply(i,t)}:o)([t]),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}])&&Ft(n.prototype,e),t&&Ft(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function Vt(t){return(Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zt(){zt=function(){return a};var u,a={},t=Object.prototype,l=t.hasOwnProperty,c=Object.defineProperty||function(t,n,e){t[n]=e.value},n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",e=n.asyncIterator||"@@asyncIterator",r=n.toStringTag||"@@toStringTag";function o(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{o({},"")}catch(u){o=function(t,n,e){return t[n]=e}}function s(t,n,e,i){var r,o,a,s,n=n&&n.prototype instanceof y?n:y,n=Object.create(n.prototype),i=new T(i||[]);return c(n,"_invoke",{value:(r=t,o=e,a=i,s=h,function(t,n){if(s===d)throw Error("Generator is already running");if(s===m){if("throw"===t)throw n;return{value:u,done:!0}}for(a.method=t,a.arg=n;;){var e=a.delegate;if(e){e=function t(n,e){var i=e.method,r=n.iterator[i];if(r===u)return e.delegate=null,"throw"===i&&n.iterator.return&&(e.method="return",e.arg=u,t(n,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;i=f(r,n.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;r=i.arg;return r?r.done?(e[n.resultName]=r.value,e.next=n.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,p):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}(e,a);if(e){if(e===p)continue;return e}}if("next"===a.method)a.sent=a.v=a.arg;else if("throw"===a.method){if(s===h)throw s=m,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=d;e=f(r,o,a);if("normal"===e.type){if(s=a.done?m:v,e.arg===p)continue;return{value:e.arg,done:a.done}}"throw"===e.type&&(s=m,a.method="throw",a.arg=e.arg)}})}),n}function f(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h="suspendedStart",v="suspendedYield",d="executing",m="completed",p={};function y(){}function g(){}function b(){}var n={},_=(o(n,i,function(){return this}),Object.getPrototypeOf),_=_&&_(_(M([]))),w=(_&&_!==t&&l.call(_,i)&&(n=_),b.prototype=y.prototype=Object.create(n));function S(t){["next","throw","return"].forEach(function(n){o(t,n,function(t){return this._invoke(n,t)})})}function x(a,s){var n;c(this,"_invoke",{value:function(e,i){function t(){return new s(function(t,n){!function n(t,e,i,r){var o,t=f(a[t],a,e);if("throw"!==t.type)return(e=(o=t.arg).value)&&"object"==Vt(e)&&l.call(e,"__await")?s.resolve(e._).then(function(t){n("next",t,i,r)},function(t){n("throw",t,i,r)}):s.resolve(e).then(function(t){o.value=t,i(o)},function(t){return n("throw",t,i,r)});r(t.arg)}(e,i,t,n)})}return n=n?n.then(t,t):t()}})}function A(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function E(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function M(n){if(n||""===n){var e,t=n[i];if(t)return t.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length))return e=-1,(t=function t(){for(;++e(t=((t,n)=>{if("object"!=Vt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Vt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Vt(t)?t:t+""))(i.key),i)}}var Xt=(()=>{return t=function t(){var n=0Math.abs(t.z)?(this.T=-t.y,this.M=t.x,this.P=0):(this.T=0,this.M=-t.z,this.P=t.y)):(this.T=t.y*n.z-t.z*n.y,this.M=t.z*n.x-t.x*n.z,this.P=t.x*n.y-t.y*n.x),this.O=e,this.normalize()}},{key:"angleTo",value:function(t){return 2*Math.acos(Math.abs(y(this.dot(t),-1,1)))}},{key:"rotateTowards",value:function(t,n){var e=this.angleTo(t);return 0!==e&&(n=Math.min(1,n/e),this.slerp(t,n)),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this.T*=-1,this.M*=-1,this.P*=-1,this.N(),this}},{key:"dot",value:function(t){return this.T*t.T+this.M*t.M+this.P*t.P+this.O*t.O}},{key:"lengthSq",value:function(){return this.T*this.T+this.M*this.M+this.P*this.P+this.O*this.O}},{key:"length",value:function(){return Math.sqrt(this.T*this.T+this.M*this.M+this.P*this.P+this.O*this.O)}},{key:"normalize",value:function(){var t=this.length();return 0===t?(this.T=0,this.M=0,this.P=0,this.O=1):(this.T=this.T*(t=1/t),this.M=this.M*t,this.P=this.P*t,this.O=this.O*t),this.N(),this}},{key:"multiply",value:function(t){return this.multiplyQuaternions(this,t)}},{key:"premultiply",value:function(t){return this.multiplyQuaternions(t,this)}},{key:"multiplyQuaternions",value:function(t,n){var e=t.T,i=t.M,r=t.P,t=t.O,o=n.T,a=n.M,s=n.P,n=n.O;return this.T=e*n+t*o+i*s-r*a,this.M=i*n+t*a+r*o-e*s,this.P=r*n+t*s+e*a-i*o,this.O=t*n-e*o-i*a-r*s,this.N(),this}},{key:"slerp",value:function(t,n){if(0!==n){if(1===n)return this.copy(t);var e,i=this.T,r=this.M,o=this.P,a=this.O,s=a*t.O+i*t.T+r*t.M+o*t.P;s<0?(this.O=-t.O,this.T=-t.T,this.M=-t.M,this.P=-t.P,s=-s):this.copy(t),1<=s?(this.O=a,this.T=i,this.M=r,this.P=o):(t=1-s*s)<=Number.EPSILON?(this.O=(e=1-n)*a+n*this.O,this.T=e*i+n*this.T,this.M=e*r+n*this.M,this.P=e*o+n*this.P,this.normalize()):(e=Math.sqrt(t),t=Math.atan2(e,s),s=Math.sin((1-n)*t)/e,n=Math.sin(n*t)/e,this.O=a*s+this.O*n,this.T=i*s+this.T*n,this.M=r*s+this.M*n,this.P=o*s+this.P*n,this.N())}return this}},{key:"slerpQuaternions",value:function(t,n,e){return this.copy(t).slerp(n,e)}},{key:"random",value:function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),e=Math.random(),i=Math.sqrt(1-e),e=Math.sqrt(e);return this.set(i*Math.sin(t),i*Math.cos(t),e*Math.sin(n),e*Math.cos(n))}},{key:"equals",value:function(t){return t.T===this.T&&t.M===this.M&&t.P===this.P&&t.O===this.O}},{key:"fromArray",value:function(t){var n=1Number.EPSILON&&(l=Math.sqrt(l),u=Math.atan2(l,u*s),o=Math.sin(o*u)/l,a=Math.sin(a*u)/l),c=c*o+i*(u=a*s),f=f*o+v*u,h=h*o+d*u,e=e*o+r*u,o===1-a&&(c*=l=1/Math.sqrt(c*c+f*f+h*h+e*e),f*=l,h*=l,e*=l)),t[n]=c,t[n+1]=f,t[n+2]=h,t[n+3]=e)}},{key:"multiplyQuaternionsFlat",value:function(t,n,e,i,r,o){var a=e[i],s=e[i+1],u=e[i+2],e=e[i+3],i=r[o],l=r[o+1],c=r[o+2],r=r[o+3];return t[n]=a*r+e*i+s*c-u*l,t[n+1]=s*r+e*l+u*i-a*c,t[n+2]=u*r+e*c+a*l-s*i,t[n+3]=e*r-a*i-s*l-u*c,t}}],n&&Gt(t.prototype,n),e&&Gt(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,e})();function Yt(t){return(Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Wt(){Wt=function(){return a};var u,a={},t=Object.prototype,l=t.hasOwnProperty,c=Object.defineProperty||function(t,n,e){t[n]=e.value},n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",e=n.asyncIterator||"@@asyncIterator",r=n.toStringTag||"@@toStringTag";function o(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{o({},"")}catch(u){o=function(t,n,e){return t[n]=e}}function s(t,n,e,i){var r,o,a,s,n=n&&n.prototype instanceof y?n:y,n=Object.create(n.prototype),i=new T(i||[]);return c(n,"_invoke",{value:(r=t,o=e,a=i,s=h,function(t,n){if(s===d)throw Error("Generator is already running");if(s===m){if("throw"===t)throw n;return{value:u,done:!0}}for(a.method=t,a.arg=n;;){var e=a.delegate;if(e){e=function t(n,e){var i=e.method,r=n.iterator[i];if(r===u)return e.delegate=null,"throw"===i&&n.iterator.return&&(e.method="return",e.arg=u,t(n,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;i=f(r,n.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;r=i.arg;return r?r.done?(e[n.resultName]=r.value,e.next=n.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,p):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}(e,a);if(e){if(e===p)continue;return e}}if("next"===a.method)a.sent=a.v=a.arg;else if("throw"===a.method){if(s===h)throw s=m,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=d;e=f(r,o,a);if("normal"===e.type){if(s=a.done?m:v,e.arg===p)continue;return{value:e.arg,done:a.done}}"throw"===e.type&&(s=m,a.method="throw",a.arg=e.arg)}})}),n}function f(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h="suspendedStart",v="suspendedYield",d="executing",m="completed",p={};function y(){}function g(){}function b(){}var n={},_=(o(n,i,function(){return this}),Object.getPrototypeOf),_=_&&_(_(M([]))),w=(_&&_!==t&&l.call(_,i)&&(n=_),b.prototype=y.prototype=Object.create(n));function S(t){["next","throw","return"].forEach(function(n){o(t,n,function(t){return this._invoke(n,t)})})}function x(a,s){var n;c(this,"_invoke",{value:function(e,i){function t(){return new s(function(t,n){!function n(t,e,i,r){var o,t=f(a[t],a,e);if("throw"!==t.type)return(e=(o=t.arg).value)&&"object"==Yt(e)&&l.call(e,"__await")?s.resolve(e._).then(function(t){n("next",t,i,r)},function(t){n("throw",t,i,r)}):s.resolve(e).then(function(t){o.value=t,i(o)},function(t){return n("throw",t,i,r)});r(t.arg)}(e,i,t,n)})}return n=n?n.then(t,t):t()}})}function A(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function E(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function M(n){if(n||""===n){var e,t=n[i];if(t)return t.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length))return e=-1,(t=function t(){for(;++e(t=((t,n)=>{if("object"!=Yt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Yt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Yt(t)?t:t+""))(i.key),i)}}var U=(()=>{function o(){var t=0(t=((t,n)=>{if("object"!=Jt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Jt(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Jt(t)?t:t+""))(i.key),i)}}var B=(()=>{function r(){var t=0(t=((t,n)=>{if("object"!=tn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=tn(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==tn(t)?t:t+""))(i.key),i)}}var en=(()=>{return t=function t(){var n=0=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}},{key:"containsBox",value:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}},{key:"getParameter",value:function(t,n){return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}},{key:"intersectsSphere",value:function(t){return this.clampPoint(t.center,on),on.distanceToSquared(t.center)<=t.radius*t.radius}},{key:"intersectsPlane",value:function(t){var n,e=0=-t.constant}},{key:"intersectsTriangle",value:function(t){return!this.isEmpty()&&(this.getCenter(vn),dn.subVectors(this.max,vn),sn.subVectors(t.a,vn),un.subVectors(t.b,vn),ln.subVectors(t.c,vn),cn.subVectors(un,sn),fn.subVectors(ln,un),hn.subVectors(sn,ln),!!yn([0,-cn.z,cn.y,0,-fn.z,fn.y,0,-hn.z,hn.y,cn.z,0,-cn.x,fn.z,0,-fn.x,hn.z,0,-hn.x,-cn.y,cn.x,0,-fn.y,fn.x,0,-hn.y,hn.x,0],sn,un,ln,dn))&&!!yn([1,0,0,0,1,0,0,0,1],sn,un,ln,dn)&&(mn.crossVectors(cn,fn),yn([mn.x,mn.y,mn.z],sn,un,ln,dn))}},{key:"clampPoint",value:function(t,n){return n.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return this.clampPoint(t,on).distanceTo(t)}},{key:"getBoundingSphere",value:function(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(on).length()),t}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"applyMatrix4",value:function(t){return this.isEmpty()||(rn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),rn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),rn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),rn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),rn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),rn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),rn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),rn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(rn)),this}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}])&&nn(t.prototype,n),e&&nn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,e})(),rn=[new U,new U,new U,new U,new U,new U,new U,new U],on=new U,an=new en,sn=new U,un=new U,ln=new U,cn=new U,fn=new U,hn=new U,vn=new U,dn=new U,mn=new U,pn=new U;function yn(t,n,e,i,r){for(var o=0,a=t.length-3;o<=a;o+=3){pn.fromArray(t,o);var s=r.x*Math.abs(pn.x)+r.y*Math.abs(pn.y)+r.z*Math.abs(pn.z),u=n.dot(pn),l=e.dot(pn),c=i.dot(pn);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>s)return!1}return!0}var gn=bn();function bn(){for(var t=new ArrayBuffer(4),n=new Float32Array(t),t=new Uint32Array(t),e=new Uint32Array(512),i=new Uint32Array(512),r=0;r<256;++r){var o=r-127;o<-27?(e[r]=0,e[256|r]=32768,i[r]=24,i[256|r]=24):o<-14?(e[r]=1024>>-o-14,e[256|r]=1024>>-o-14|32768,i[r]=-o-1,i[256|r]=-o-1):o<=15?(e[r]=15+o<<10,e[256|r]=15+o<<10|32768,i[r]=13,i[256|r]=13):o<128?(e[r]=31744,e[256|r]=64512,i[r]=24,i[256|r]=24):(e[r]=31744,e[256|r]=64512,i[r]=13,i[256|r]=13)}for(var a=new Uint32Array(2048),s=new Uint32Array(64),u=new Uint32Array(64),l=1;l<1024;++l){for(var c=l<<13,f=0;0==(8388608&c);)c<<=1,f-=8388608;c&=-8388609,f+=947912704,a[l]=c|f}for(var h=1024;h<2048;++h)a[h]=939524096+(h-1024<<13);for(var v=1;v<31;++v)s[v]=v<<23;s[31]=1199570944,s[32]=2147483648;for(var d=33;d<63;++d)s[d]=2147483648+(d-32<<23);s[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:n,uint32View:t,baseTable:e,shiftTable:i,mantissaTable:a,exponentTable:s,offsetTable:u}}function _n(t){65504>23&511;return gn.baseTable[n]+((8388607&t)>>gn.shiftTable[n])}function wn(t){var n=t>>10;return gn.uint32View[0]=gn.mantissaTable[gn.offsetTable[n]+(1023&t)]+gn.exponentTable[n],gn.floatView[0]}var Sn={toHalfFloat:_n,fromHalfFloat:wn};function xn(t,n,e){n=En(n);var i=t,n=An()?Reflect.construct(n,e||[],En(t).constructor):n.apply(t,e);if(!n||"object"!=Pn(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function An(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(An=function(){return!!t})()}function En(t){return(En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Tn(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&Mn(t,n)}function Mn(t,n){return(Mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}function Pn(t){return(Pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function On(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function Nn(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Pn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Pn(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Pn(t)?t:t+""))(i.key),i)}}function Cn(t,n,e){return n&&Nn(t.prototype,n),e&&Nn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var s=new U,Ln=new B,H=(()=>Cn(function t(n,e){var i=2{function i(t,n,e){return On(this,i),xn(this,i,[new Uint16Array(t),n,e])}return Tn(i,H),Cn(i)})(),Dn=(()=>{function i(t,n,e){return On(this,i),xn(this,i,[new Uint32Array(t),n,e])}return Tn(i,H),Cn(i)})(),k=(()=>{function i(t,n,e){return On(this,i),xn(this,i,[new Float32Array(t),n,e])}return Tn(i,H),Cn(i)})();function Fn(t){return(Fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function In(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Fn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Fn(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Fn(t)?t:t+""))(i.key),i)}}var kn=new en,jn=new U,Un=new U,Bn=(()=>{return t=function t(){var n=0this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}},{key:"getBoundingBox",value:function(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}},{key:"applyMatrix4",value:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}},{key:"translate",value:function(t){return this.center.add(t),this}},{key:"expandByPoint",value:function(t){var n;return this.isEmpty()?(this.center.copy(t),this.radius=0):(jn.subVectors(t,this.center),(t=jn.lengthSq())>this.radius*this.radius&&(n=.5*((t=Math.sqrt(t))-this.radius),this.center.addScaledVector(jn,n/t),this.radius+=n)),this}},{key:"union",value:function(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Un.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(jn.copy(t.center).add(Un)),this.expandByPoint(jn.copy(t.center).sub(Un)))),this}},{key:"equals",value:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])&&In(t.prototype,n),e&&In(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,e})();function Hn(t){return(Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Vn(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Hn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Hn(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Hn(t)?t:t+""))(i.key),i)}}var C=(()=>{function p(t,n,e,i,r,o,a,s,u,l,c,f,h,v,d,m){if(!(this instanceof p))throw new TypeError("Cannot call a class as a function");p.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,e,i,r,o,a,s,u,l,c,f,h,v,d,m)}return t=p,(n=[{key:"set",value:function(t,n,e,i,r,o,a,s,u,l,c,f,h,v,d,m){var p=this.elements;return p[0]=t,p[4]=n,p[8]=e,p[12]=i,p[1]=r,p[5]=o,p[9]=a,p[13]=s,p[2]=u,p[6]=l,p[10]=c,p[14]=f,p[3]=h,p[7]=v,p[11]=d,p[15]=m,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new p).fromArray(this.elements)}},{key:"copy",value:function(t){var n=this.elements,t=t.elements;return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],this}},{key:"copyPosition",value:function(t){var n=this.elements,t=t.elements;return n[12]=t[12],n[13]=t[13],n[14]=t[14],this}},{key:"setFromMatrix3",value:function(t){t=t.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}},{key:"extractBasis",value:function(t,n,e){return t.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(t,n,e){return this.set(t.x,n.x,e.x,0,t.y,n.y,e.y,0,t.z,n.z,e.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(t){var n=this.elements,e=t.elements,i=1/zn.setFromMatrixColumn(t,0).length(),r=1/zn.setFromMatrixColumn(t,1).length(),t=1/zn.setFromMatrixColumn(t,2).length();return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=0,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=0,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}},{key:"makeRotationFromEuler",value:function(t){var n,e,i,r,o=this.elements,a=t.x,s=t.y,u=t.z,l=Math.cos(a),a=Math.sin(a),c=Math.cos(s),s=Math.sin(s),f=Math.cos(u),u=Math.sin(u);return"XYZ"===t.order?(e=l*f,i=l*u,r=a*f,n=a*u,o[0]=c*f,o[4]=-c*u,o[8]=s,o[1]=i+r*s,o[5]=e-n*s,o[9]=-a*c,o[2]=n-e*s,o[6]=r+i*s,o[10]=l*c):"YXZ"===t.order?(n=c*u,e=s*f,o[0]=(r=c*f)+(i=s*u)*a,o[4]=e*a-n,o[8]=l*s,o[1]=l*u,o[5]=l*f,o[9]=-a,o[2]=n*a-e,o[6]=i+r*a,o[10]=l*c):"ZXY"===t.order?(n=c*u,e=s*f,o[0]=(i=c*f)-(r=s*u)*a,o[4]=-l*u,o[8]=e+n*a,o[1]=n+e*a,o[5]=l*f,o[9]=r-i*a,o[2]=-l*s,o[6]=a,o[10]=l*c):"ZYX"===t.order?(n=l*f,e=l*u,r=a*f,i=a*u,o[0]=c*f,o[4]=r*s-e,o[8]=n*s+i,o[1]=c*u,o[5]=i*s+n,o[9]=e*s-r,o[2]=-s,o[6]=a*c,o[10]=l*c):"YZX"===t.order?(i=l*c,n=l*s,e=a*c,r=a*s,o[0]=c*f,o[4]=r-i*u,o[8]=e*u+n,o[1]=u,o[5]=l*f,o[9]=-a*f,o[2]=-s*f,o[6]=n*u+e,o[10]=i-r*u):"XZY"===t.order&&(n=l*c,e=l*s,i=a*c,r=a*s,o[0]=c*f,o[4]=-u,o[8]=s*f,o[1]=n*u+r,o[5]=l*f,o[9]=e*u-i,o[2]=i*u-e,o[6]=a*f,o[10]=r*u+n),o[3]=0,o[7]=0,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(t){return this.compose(Xn,t,Yn)}},{key:"lookAt",value:function(t,n,e){var i=this.elements;return u.subVectors(t,n),0===u.lengthSq()&&(u.z=1),u.normalize(),Wn.crossVectors(e,u),0===Wn.lengthSq()&&(1===Math.abs(e.z)?u.x+=1e-4:u.z+=1e-4,u.normalize(),Wn.crossVectors(e,u)),Wn.normalize(),Qn.crossVectors(u,Wn),i[0]=Wn.x,i[4]=Qn.x,i[8]=u.x,i[1]=Wn.y,i[5]=Qn.y,i[9]=u.y,i[2]=Wn.z,i[6]=Qn.z,i[10]=u.z,this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,n){var t=t.elements,n=n.elements,e=this.elements,i=t[0],r=t[4],o=t[8],a=t[12],s=t[1],u=t[5],l=t[9],c=t[13],f=t[2],h=t[6],v=t[10],d=t[14],m=t[3],p=t[7],y=t[11],t=t[15],g=n[0],b=n[4],_=n[8],w=n[12],S=n[1],x=n[5],A=n[9],E=n[13],T=n[2],M=n[6],P=n[10],O=n[14],N=n[3],C=n[7],L=n[11],n=n[15];return e[0]=i*g+r*S+o*T+a*N,e[4]=i*b+r*x+o*M+a*C,e[8]=i*_+r*A+o*P+a*L,e[12]=i*w+r*E+o*O+a*n,e[1]=s*g+u*S+l*T+c*N,e[5]=s*b+u*x+l*M+c*C,e[9]=s*_+u*A+l*P+c*L,e[13]=s*w+u*E+l*O+c*n,e[2]=f*g+h*S+v*T+d*N,e[6]=f*b+h*x+v*M+d*C,e[10]=f*_+h*A+v*P+d*L,e[14]=f*w+h*E+v*O+d*n,e[3]=m*g+p*S+y*T+t*N,e[7]=m*b+p*x+y*M+t*C,e[11]=m*_+p*A+y*P+t*L,e[15]=m*w+p*E+y*O+t*n,this}},{key:"multiplyScalar",value:function(t){var n=this.elements;return n[0]*=t,n[4]*=t,n[8]*=t,n[12]*=t,n[1]*=t,n[5]*=t,n[9]*=t,n[13]*=t,n[2]*=t,n[6]*=t,n[10]*=t,n[14]*=t,n[3]*=t,n[7]*=t,n[11]*=t,n[15]*=t,this}},{key:"determinant",value:function(){var t=this.elements,n=t[0],e=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],u=t[13],l=t[2],c=t[6],f=t[10],h=t[14];return t[3]*(+r*s*c-i*u*c-r*a*f+e*u*f+i*a*h-e*s*h)+t[7]*(+n*s*h-n*u*f+r*o*f-i*o*h+i*u*l-r*s*l)+t[11]*(+n*u*c-n*a*h-r*o*c+e*o*h+r*a*l-e*u*l)+t[15]*(-i*a*l-n*s*c+n*a*f+i*o*c-e*o*f+e*s*l)}},{key:"transpose",value:function(){var t=this.elements,n=t[1];return t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,this}},{key:"setPosition",value:function(t,n,e){var i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=n,i[14]=e),this}},{key:"invert",value:function(){var t=this.elements,n=t[0],e=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],c=t[9],f=t[10],h=t[11],v=t[12],d=t[13],m=t[14],p=t[15],y=c*m*u-d*f*u+d*s*h-a*m*h-c*s*p+a*f*p,g=v*f*u-l*m*u-v*s*h+o*m*h+l*s*p-o*f*p,b=l*d*u-v*c*u+v*a*h-o*d*h-l*a*p+o*c*p,_=v*c*s-l*d*s-v*a*f+o*d*f+l*a*m-o*c*m,w=n*y+e*g+i*b+r*_;return 0==w?this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0):(t[0]=y*(y=1/w),t[1]=(d*f*r-c*m*r-d*i*h+e*m*h+c*i*p-e*f*p)*y,t[2]=(a*m*r-d*s*r+d*i*u-e*m*u-a*i*p+e*s*p)*y,t[3]=(c*s*r-a*f*r-c*i*u+e*f*u+a*i*h-e*s*h)*y,t[4]=g*y,t[5]=(l*m*r-v*f*r+v*i*h-n*m*h-l*i*p+n*f*p)*y,t[6]=(v*s*r-o*m*r-v*i*u+n*m*u+o*i*p-n*s*p)*y,t[7]=(o*f*r-l*s*r+l*i*u-n*f*u-o*i*h+n*s*h)*y,t[8]=b*y,t[9]=(v*c*r-l*d*r-v*e*h+n*d*h+l*e*p-n*c*p)*y,t[10]=(o*d*r-v*a*r+v*e*u-n*d*u-o*e*p+n*a*p)*y,t[11]=(l*a*r-o*c*r-l*e*u+n*c*u+o*e*h-n*a*h)*y,t[12]=_*y,t[13]=(l*d*i-v*c*i+v*e*f-n*d*f-l*e*m+n*c*m)*y,t[14]=(v*a*i-o*d*i-v*e*s+n*d*s+o*e*m-n*a*m)*y,t[15]=(o*c*i-l*a*i+l*e*s-n*c*s-o*e*f+n*a*f)*y,this)}},{key:"scale",value:function(t){var n=this.elements,e=t.x,i=t.y,t=t.z;return n[0]*=e,n[4]*=i,n[8]*=t,n[1]*=e,n[5]*=i,n[9]*=t,n[2]*=e,n[6]*=i,n[10]*=t,n[3]*=e,n[7]*=i,n[11]*=t,this}},{key:"getMaxScaleOnAxis",value:function(){var t=this.elements,n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];return Math.sqrt(Math.max(n,t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}},{key:"makeTranslation",value:function(t,n,e){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,n,0,0,1,e,0,0,0,1),this}},{key:"makeRotationX",value:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(1,0,0,0,0,n,-t,0,0,t,n,0,0,0,0,1),this}},{key:"makeRotationY",value:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(n,0,t,0,0,1,0,0,-t,0,n,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(n,-t,0,0,t,n,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(t,n){var e=Math.cos(n),n=Math.sin(n),i=1-e,r=t.x,o=t.y,t=t.z,a=i*r,s=i*o;return this.set(a*r+e,a*o-n*t,a*t+n*o,0,a*o+n*t,s*o+e,s*t-n*r,0,a*t-n*o,s*t+n*r,i*t*t+e,0,0,0,0,1),this}},{key:"makeScale",value:function(t,n,e){return this.set(t,0,0,0,0,n,0,0,0,0,e,0,0,0,0,1),this}},{key:"makeShear",value:function(t,n,e,i,r,o){return this.set(1,e,r,0,t,1,o,0,n,i,1,0,0,0,0,1),this}},{key:"compose",value:function(t,n,e){var i=this.elements,r=n.T,o=n.M,a=n.P,n=n.O,s=r+r,u=o+o,l=a+a,c=r*s,f=r*u,r=r*l,h=o*u,o=o*l,a=a*l,s=n*s,u=n*u,n=n*l,l=e.x,v=e.y,e=e.z;return i[0]=(1-(h+a))*l,i[1]=(f+n)*l,i[2]=(r-u)*l,i[3]=0,i[4]=(f-n)*v,i[5]=(1-(c+a))*v,i[6]=(o+s)*v,i[7]=0,i[8]=(r+u)*e,i[9]=(o-s)*e,i[10]=(1-(c+h))*e,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}},{key:"decompose",value:function(t,n,e){var i=this.elements,r=zn.set(i[0],i[1],i[2]).length(),o=zn.set(i[4],i[5],i[6]).length(),a=zn.set(i[8],i[9],i[10]).length(),t=(this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Gn.copy(this),1/r),i=1/o,s=1/a;return Gn.elements[0]*=t,Gn.elements[1]*=t,Gn.elements[2]*=t,Gn.elements[4]*=i,Gn.elements[5]*=i,Gn.elements[6]*=i,Gn.elements[8]*=s,Gn.elements[9]*=s,Gn.elements[10]*=s,n.setFromRotationMatrix(Gn),e.x=r,e.y=o,e.z=a,this}},{key:"makePerspective",value:function(t,n,e,i,r,o){var a,s,u=6(t=((t,n)=>{if("object"!=qn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=qn(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==qn(t)?t:t+""))(i.key),i)}}var Kn=new C,$n=new Xt,te=(()=>{return t=function t(){var n=0(t=((t,n)=>{if("object"!=ne(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ne(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ne(t)?t:t+""))(i.key),i)}}te.DEFAULT_ORDER="XYZ";var ie=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.mask=1}return n=t,(e=[{key:"set",value:function(t){this.mask=(1<>>0}},{key:"enable",value:function(t){this.mask|=1<{if(Array.isArray(t))return ae(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||((t,n)=>{var e;if(t)return"string"==typeof t?ae(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ae(t,n):void 0})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function ae(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=re(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=re(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==re(t)?t:t+""))(i.key),i)}}function ue(t,n,e){n=ce(n);var i=t,n=le()?Reflect.construct(n,e||[],ce(t).constructor):n.apply(t,e);if(!n||"object"!=re(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(le=function(){return!!t})()}function ce(t){return(ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function fe(t,n){return(fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var he=0,ve=new U,de=new Xt,me=new C,pe=new U,ye=new U,ge=new U,be=new Xt,_e=new U(1,0,0),we=new U(0,1,0),Se=new U(0,0,1),xe={type:"added"},Ae={type:"removed"},Ee={type:"childadded",child:null},Te={type:"childremoved",child:null},Me=(()=>{function o(){var t;if(!(this instanceof o))throw new TypeError("Cannot call a class as a function");(t=ue(this,o)).isObject3D=!0,Object.defineProperty(t,"id",{value:he++}),t.uuid=j(),t.name="",t.type="Object3D",t.parent=null,t.children=[],t.up=o.DEFAULT_UP.clone();var n=new U,e=new te,i=new Xt,r=new U(1,1,1);return e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(t,{position:{configurable:!0,enumerable:!0,value:n},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new C},normalMatrix:{value:new v}}),t.matrix=new C,t.matrixWorld=new C,t.matrixAutoUpdate=o.DEFAULT_MATRIX_AUTO_UPDATE,t.matrixWorldAutoUpdate=o.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,t.matrixWorldNeedsUpdate=!1,t.layers=new ie,t.visible=!0,t.castShadow=!1,t.receiveShadow=!1,t.frustumCulled=!0,t.renderOrder=0,t.animations=[],t.userData={},t}var t,n=o,e=Et;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&fe(n,e),n=o,(e=[{key:"onBeforeShadow",value:function(){}},{key:"onAfterShadow",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(t){return this.quaternion.premultiply(t),this}},{key:"setRotationFromAxisAngle",value:function(t,n){this.quaternion.setFromAxisAngle(t,n)}},{key:"setRotationFromEuler",value:function(t){this.quaternion.setFromEuler(t,!0)}},{key:"setRotationFromMatrix",value:function(t){this.quaternion.setFromRotationMatrix(t)}},{key:"setRotationFromQuaternion",value:function(t){this.quaternion.copy(t)}},{key:"rotateOnAxis",value:function(t,n){return de.setFromAxisAngle(t,n),this.quaternion.multiply(de),this}},{key:"rotateOnWorldAxis",value:function(t,n){return de.setFromAxisAngle(t,n),this.quaternion.premultiply(de),this}},{key:"rotateX",value:function(t){return this.rotateOnAxis(_e,t)}},{key:"rotateY",value:function(t){return this.rotateOnAxis(we,t)}},{key:"rotateZ",value:function(t){return this.rotateOnAxis(Se,t)}},{key:"translateOnAxis",value:function(t,n){return ve.copy(t).applyQuaternion(this.quaternion),this.position.add(ve.multiplyScalar(n)),this}},{key:"translateX",value:function(t){return this.translateOnAxis(_e,t)}},{key:"translateY",value:function(t){return this.translateOnAxis(we,t)}},{key:"translateZ",value:function(t){return this.translateOnAxis(Se,t)}},{key:"localToWorld",value:function(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(me.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(t,n,e){t.isVector3?pe.copy(t):pe.set(t,n,e);t=this.parent;this.updateWorldMatrix(!0,!1),ye.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?me.lookAt(ye,pe,this.up):me.lookAt(pe,ye,this.up),this.quaternion.setFromRotationMatrix(me),t&&(me.extractRotation(t.matrixWorld),de.setFromRotationMatrix(me),this.quaternion.premultiply(de.invert()))}},{key:"add",value:function(t){if(1(t=((t,n)=>{if("object"!=Le(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Le(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Le(t)?t:t+""))(i.key),i)}}function De(t,n,e){n=Ie(n);var i=t,n=Fe()?Reflect.construct(n,e||[],Ie(t).constructor):n.apply(t,e);if(!n||"object"!=Le(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fe=function(){return!!t})()}function Ie(t){return(Ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ke(t,n){return(ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var je=0,i=new C,Ue=new Me,Be=new U,p=new en,He=new en,g=new U,Ve=(()=>{function y(){var t;if(this instanceof y)return(t=De(this,y)).isBufferGeometry=!0,Object.defineProperty(t,"id",{value:je++}),t.uuid=j(),t.name="",t.type="BufferGeometry",t.index=null,t.attributes={},t.morphAttributes={},t.morphTargetsRelative=!1,t.groups=[],t.boundingBox=null,t.boundingSphere=null,t.drawRange={start:0,count:1/0},t.userData={},t;throw new TypeError("Cannot call a class as a function")}var t,n=y,e=Et;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&ke(n,e),n=y,(e=[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(t){return Array.isArray(t)?this.index=new((t=>{for(var n=t.length-1;0<=n;--n)if(65535<=t[n])return 1})(t)?Dn:Rn)(t,1):this.index=t,this}},{key:"getAttribute",value:function(t){return this.attributes[t]}},{key:"setAttribute",value:function(t,n){return this.attributes[t]=n,this}},{key:"deleteAttribute",value:function(t){return delete this.attributes[t],this}},{key:"hasAttribute",value:function(t){return void 0!==this.attributes[t]}},{key:"addGroup",value:function(t,n){this.groups.push({start:t,count:n,materialIndex:2(t=((t,n)=>{if("object"!=Ge(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ge(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ge(t)?t:t+""))(i.key),i)}}function Ye(t,n,e){return n&&Xe(t.prototype,n),e&&Xe(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var We=new(Ye(function t(n,e,i){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");var r=this,o=!1,a=0,s=0,u=void 0,l=[];this.onStart=void 0,this.onLoad=n,this.onProgress=e,this.onError=i,this.record=new Map,this.itemStart=function(t){this.record.has(t)||this.record.set(t,{}),s++,!1===o&&void 0!==r.onStart&&r.onStart(t,a,s),o=!0},this.itemEnd=function(t){this.record.delete(t),a++,void 0!==r.onProgress&&r.onProgress(t,a,s),a===s&&(o=!1,void 0!==r.onLoad)&&r.onLoad()},this.itemError=function(t){this.record.delete(t),void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return u?u(t):t},this.setURLModifier=function(t){return u=t,this},this.addHandler=function(t,n){return l.push(t,n),this},this.removeHandler=function(t){t=l.indexOf(t);return-1!==t&&l.splice(t,2),this},this.getHandler=function(t){for(var n=0,e=l.length;n(t=((t,n)=>{if("object"!=Qe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Qe(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Qe(t)?t:t+""))(i.key),i)}}var Ze=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:We,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return t=n,(e=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,i){var r=this;return new Promise(function(t,n){r.load(e,t,i,n)})}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(t){return this.crossOrigin=t,this}},{key:"setWithCredentials",value:function(t){return this.withCredentials=t,this}},{key:"setPath",value:function(t){return this.path=t,this}},{key:"setResourcePath",value:function(t){return this.resourcePath=t,this}},{key:"setRequestHeader",value:function(t){return this.requestHeader=t,this}}])&&qe(t.prototype,e),i&&qe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();function Je(t){return(Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ke(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Je(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Je(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Je(t)?t:t+""))(i.key),i)}}function $e(t,n,e){n=ni(n);var i=t,n=ti()?Reflect.construct(n,e||[],ni(t).constructor):n.apply(t,e);if(!n||"object"!=Je(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ti(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ti=function(){return!!t})()}function ni(t){return(ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ei(t,n){return(ei=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Ze.DEFAULT_MATERIAL_NAME="__DEFAULT";var ii,ri=(()=>{function n(t){if(this instanceof n)return $e(this,n,[t]);throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&ei(e,i),e=n,(i=[{key:"load",value:function(n,t,e,i){void 0!==this.path&&(n=this.path+n),n=this.manager.resolveURL(n);var r,o,a,s,u,l,c,f,h=this,v=ze.get(n);return void 0!==v?(h.manager.itemStart(n),setTimeout(function(){t&&t(v),h.manager.itemEnd(n)},0),v):Ne.environment===Pe.WX?(o=t,a=i,s=ze,u=h,(r=n).includes(wx.env.USER_DATA_PATH)?(c=wx.getFileSystemManager()).readFile({filePath:r,encoding:"base64",success:function(t){var t="data:image/png;base64,".concat(t.data),n=Ne.textureHelper.createImage({url:t,onload:function(){s.add(r,n),o&&o(n),u.manager.itemEnd(r),c.unlink({filePath:r,fail:function(t){},success:function(){}})}})},fail:function(t){console.error(t),a&&a(t),u.manager.itemError(r),u.manager.itemEnd(r)}}):l=Ne.textureHelper.createImage({url:r,onload:function(){s.add(r,l),o&&o(l),u.manager.itemEnd(r)},onerror:function(t){console.error(t),a&&a(t),u.manager.itemError(r),u.manager.itemEnd(r)}}),l):((f=Ce("img")).addEventListener("load",d,!1),f.addEventListener("error",m,!1),"data:"!==n.slice(0,5)&&void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),h.manager.itemStart(n),f.src=n,f);function d(){p(),ze.add(n,this),t&&t(this),h.manager.itemEnd(n)}function m(t){p(),i&&i(t),h.manager.itemError(n),h.manager.itemEnd(n)}function p(){f.removeEventListener("load",d,!1),f.removeEventListener("error",m,!1)}}}])&&Ke(e.prototype,i),t&&Ke(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e})();function oi(t){return(oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ai(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=oi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=oi(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==oi(t)?t:t+""))(i.key),i)}}var si=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}return n=t,i=[{key:"getDataURL",value:function(t){var n;return/^data:/i.test(t.src)||"undefined"==typeof HTMLCanvasElement?t.src:2048<(n=t instanceof HTMLCanvasElement?t:((ii=void 0===ii?Ce("canvas"):ii).width=t.width,ii.height=t.height,n=ii.getContext("2d"),t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),ii)).width||2048(t=((t,n)=>{if("object"!=ui(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ui(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ui(t)?t:t+""))(i.key),i)}}var ci=0,fi=(()=>{return t=function t(){var n=0(t=((t,n)=>{if("object"!=vi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=vi(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==vi(t)?t:t+""))(i.key),i)}}function mi(t,n,e){n=yi(n);var i=t,n=pi()?Reflect.construct(n,e||[],yi(t).constructor):n.apply(t,e);if(!n||"object"!=vi(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function pi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pi=function(){return!!t})()}function yi(t){return(yi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function gi(t,n){return(gi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var bi=0,_i=(()=>{function h(){var t=0(t=((t,n)=>{if("object"!=wi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=wi(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==wi(t)?t:t+""))(i.key),i)}}function xi(t,n,e){n=Ei(n);var i=t,n=Ai()?Reflect.construct(n,e||[],Ei(t).constructor):n.apply(t,e);if(!n||"object"!=wi(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Ai(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ai=function(){return!!t})()}function Ei(t){return(Ei=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ti(t,n){return(Ti=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}_i.DEFAULT_IMAGE=null,_i.DEFAULT_MAPPING=300,_i.DEFAULT_ANISOTROPY=1;var Mi=(()=>{function n(t){if(this instanceof n)return xi(this,n,[t]);throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Ti(e,i),e=n,(i=[{key:"load",value:function(t,n,e,i){var r=new _i,o=new ri(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==n&&n(r)},e,i),r}}])&&Si(e.prototype,i),t&&Si(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Pi(t){return(Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Oi(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Pi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Pi(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Pi(t)?t:t+""))(i.key),i)}}var Ni=new U,Ci=new U,Li=new U,Ri=new U,Di=new U,Fi=new U,Ii=new U,t=(()=>{return t=function t(){var n=0(t=((t,n)=>{if("object"!=ki(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ki(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ki(t)?t:t+""))(i.key),i)}}function Ui(t,n,e){n=Vi(n);var i=t,n=Bi()?Reflect.construct(n,e||[],Vi(t).constructor):n.apply(t,e);if(!n||"object"!=ki(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Bi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bi=function(){return!!t})()}function Hi(){return(Hi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Vi(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Vi(t){return(Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function zi(t,n){return(zi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Gi=new C,Xi=new t,Yi=new Bn,Wi=new U,Qi=(()=>{function s(){var t=0r.far||o.push({distance:t,distanceToRay:Math.sqrt(s),point:e,index:n,face:null,faceIndex:null,barycoord:null,object:a}))}function Zi(t){return(Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ji(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Zi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Zi(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Zi(t)?t:t+""))(i.key),i)}}var Ki=(()=>{function i(t,n){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var e=new Ht({opacity:1,transparent:!0,depthTest:!1,size:5}),n=(this.material=e,this.geo=new Ve,(new Mi).load(n));e.map=n,e.needsUpdate=!0,this.pointsArrayLength=t.length,this.pointsArray=t,this.geo.setFromPoints(t),this.plength=t.length,this.points=new Qi(this.geo,e)}return t=i,(n=[{key:"updatePoints",value:function(t){this.geo.setFromPoints(t)}},{key:"changePositions",value:function(t,n,e,i,r){for(var o=this.geo.attributes.position,a=0;a(t=((t,n)=>{if("object"!=$i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=$i(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==$i(t)?t:t+""))(i.key),i)}}function nr(t,n,e){n=or(n);var i=t,n=er()?Reflect.construct(n,e||[],or(t).constructor):n.apply(t,e);if(!n||"object"!=$i(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function er(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(er=function(){return!!t})()}function ir(t,n,e,i){var r=rr(or(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function rr(){return(rr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=or(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function or(t){return(or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ar(t,n){return(ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var l=(()=>{function e(){var t;if(this instanceof e)return(t=nr(this,e)).isScene=!0,t.type="Scene",t.background=null,t.environment=null,t.fog=null,t.backgroundBlurriness=0,t.backgroundIntensity=1,t.backgroundRotation=new te,t.environmentIntensity=1,t.environmentRotation=new te,t.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:t})),t;throw new TypeError("Cannot call a class as a function")}var t,n=e,i=Me;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(i&&i.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),i&&ar(n,i),n=e,(i=[{key:"copy",value:function(t,n){return ir(e,"copy",this,3)([t,n]),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}},{key:"toJSON",value:function(t){t=ir(e,"toJSON",this,3)([t]);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),0(t=((t,n)=>{if("object"!=sr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=sr(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==sr(t)?t:t+""))(i.key),i)}}function lr(t,n,e){n=vr(n);var i=t,n=cr()?Reflect.construct(n,e||[],vr(t).constructor):n.apply(t,e);if(!n||"object"!=sr(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function cr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(cr=function(){return!!t})()}function fr(t,n,e,i){var r=hr(vr(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function hr(){return(hr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=vr(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function vr(t){return(vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function dr(t,n){return(dr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var mr=(()=>{function e(){var t;if(this instanceof e)return(t=lr(this,e)).isCamera=!0,t.type="Camera",t.matrixWorldInverse=new C,t.projectionMatrix=new C,t.projectionMatrixInverse=new C,t.coordinateSystem=2e3,t;throw new TypeError("Cannot call a class as a function")}var t,n=e,i=Me;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(i&&i.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),i&&dr(n,i),n=e,(i=[{key:"copy",value:function(t,n){return fr(e,"copy",this,3)([t,n]),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}},{key:"getWorldDirection",value:function(t){return fr(e,"getWorldDirection",this,3)([t]).negate()}},{key:"updateMatrixWorld",value:function(t){fr(e,"updateMatrixWorld",this,3)([t]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(t,n){fr(e,"updateWorldMatrix",this,3)([t,n]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])&&ur(n.prototype,i),t&&ur(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function pr(t){return(pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yr(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=pr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=pr(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==pr(t)?t:t+""))(i.key),i)}}function gr(t,n,e){n=Sr(n);var i=t,n=br()?Reflect.construct(n,e||[],Sr(t).constructor):n.apply(t,e);if(!n||"object"!=pr(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function br(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(br=function(){return!!t})()}function _r(t,n,e,i){var r=wr(Sr(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function wr(){return(wr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Sr(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Sr(t){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function xr(t,n){return(xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}n=(()=>{function u(){var t=0(t=((t,n)=>{if("object"!=Ar(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ar(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ar(t)?t:t+""))(i.key),i)}}function Tr(t,n,e){n=Or(n);var i=t,n=Mr()?Reflect.construct(n,e||[],Or(t).constructor):n.apply(t,e);if(!n||"object"!=Ar(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Mr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mr=function(){return!!t})()}function Pr(){return(Pr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Or(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Or(t){return(Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nr(t,n){return(Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var e=(()=>{function T(){var t=0(t=((t,n)=>{if("object"!=Cr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Cr(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Cr(t)?t:t+""))(i.key),i)}}var Dr=(()=>{function a(){var t=0(t=((t,n)=>{if("object"!=Fr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Fr(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Fr(t)?t:t+""))(i.key),i)}}var kr=new U,jr=new U,Ur=new U,Br=new U,Hr=new U,Vr=new U,zr=new U,Gr=new U,Xr=new U,Yr=new U,Wr=new Dr,Qr=new Dr,qr=new Dr,Zr=(()=>{function o(){var t=0(t=((t,n)=>{if("object"!=Jr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Jr(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Jr(t)?t:t+""))(i.key),i)}}function $r(t,n,e){n=eo(n);var i=t,n=to()?Reflect.construct(n,e||[],eo(t).constructor):n.apply(t,e);if(!n||"object"!=Jr(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function to(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(to=function(){return!!t})()}function no(){return(no="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=eo(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function eo(t){return(eo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function io(t,n){return(io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var b=(()=>{function a(t){var n;if(this instanceof a)return(n=$r(this,a)).isMeshBasicMaterial=!0,n.type="MeshBasicMaterial",n.color=new N(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.envMapRotation=new te,n.combine=0,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=a,e=Rt;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&io(n,e),n=a,(e=[{key:"copy",value:function(t){var n,e,i,r,o;return n=a,e="copy",i=this,o=no(eo(1&(r=3)?n.prototype:n),e,i),(2&r&&"function"==typeof o?function(t){return o.apply(i,t)}:o)([t]),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}])&&Kr(n.prototype,e),t&&Kr(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function ro(t){return(ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oo(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=ro(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ro(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ro(t)?t:t+""))(i.key),i)}}function ao(t,n,e){n=lo(n);var i=t,n=so()?Reflect.construct(n,e||[],lo(t).constructor):n.apply(t,e);if(!n||"object"!=ro(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function so(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(so=function(){return!!t})()}function uo(){return(uo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=lo(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function lo(t){return(lo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function co(t,n){return(co=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var fo=new C,ho=new t,vo=new Bn,mo=new U,po=new U,yo=new U,go=new U,bo=new U,_o=new U,wo=new U,So=new U,_=(()=>{function s(){var t=0Math.pow(t.far-t.near,2))return}fo.copy(r).invert(),ho.copy(t.ray).applyMatrix4(fo),null!==e.boundingBox&&!1===ho.intersectsBox(e.boundingBox)||this._computeIntersections(t,n,ho)}}},{key:"_computeIntersections",value:function(t,n,e){var i=this.geometry,r=this.material,o=i.index,a=i.attributes.position,s=i.attributes.uv,u=i.attributes.uv1,l=i.attributes.normal,c=i.groups,f=i.drawRange;if(null!==o)if(Array.isArray(r))for(var h=0,v=c.length;he.far?null:{distance:f,point:So.clone(),object:t};return d&&(v=new U,Zr.getBarycoord(wo,po,yo,go,v),r&&(d.uv=Zr.getInterpolatedAttribute(r,s,u,l,v,new B)),o&&(d.uv1=Zr.getInterpolatedAttribute(o,s,u,l,v,new B)),a&&(d.normal=Zr.getInterpolatedAttribute(a,s,u,l,v,new U),0(t=((t,n)=>{if("object"!=Ao(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ao(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ao(t)?t:t+""))(i.key),i)}}function To(t,n,e){return n&&Eo(t.prototype,n),e&&Eo(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mo(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var Po,Oo,h=To(function t(){Mo(this,t),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1});function No(t){return(No="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Co(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=No(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=No(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==No(t)?t:t+""))(i.key),i)}}function Lo(t,n,e){n=Do(n);var i=t,n=Ro()?Reflect.construct(n,e||[],Do(t).constructor):n.apply(t,e);if(!n||"object"!=No(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Ro(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ro=function(){return!!t})()}function Do(t){return(Do=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Fo(t,n){return(Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(h.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),h.FullScreenQuad=(Po=new n(-1,1,1,-1,0,1),Oo=new e(2,2),t=To(function t(n){Mo(this,t),this.L=new _(Oo,n)}),Object.defineProperty(t.prototype,"material",{get:function(){return this.L.material},set:function(t){this.L.material=t}}),Object.assign(t.prototype,{render:function(t){t.render(this.L,Po)}}),t);var f=(()=>{function a(t,n,e,i,r){var o;if(this instanceof a)return(o=Lo(this,a)).scene=t,o.camera=n,o.overrideMaterial=e,o.clearColor=i,o.clearAlpha=void 0!==r?r:0,o.clear=!0,o.clearDepth=!1,o.needsSwap=!1,o;throw new TypeError("Cannot call a class as a function")}var t,n,e=a,i=h;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Fo(e,i),e=a,t&&Co(e.prototype,t),n&&Co(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Io(t){var n,e={};for(n in t)for(var i in e[n]={},t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}return e}function d(t){for(var n={},e=0;e(t=((t,n)=>{if("object"!=ko(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ko(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ko(t)?t:t+""))(i.key),i)}}function Uo(t,n,e){n=zo(n);var i=t,n=Bo()?Reflect.construct(n,e||[],zo(t).constructor):n.apply(t,e);if(!n||"object"!=ko(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Bo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bo=function(){return!!t})()}function Ho(t,n,e,i){var r=Vo(zo(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Vo(){return(Vo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=zo(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function zo(t){return(zo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Go(t,n){return(Go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var R=(()=>{function a(t){var n;if(this instanceof a)return(n=Uo(this,a)).isShaderMaterial=!0,n.type="ShaderMaterial",n.defines={},n.uniforms={},n.uniformsGroups=[],n.vertexShader="\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",n.fragmentShader="\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n",n.linewidth=1,n.wireframe=!1,n.wireframeLinewidth=1,n.fog=!1,n.lights=!1,n.clipping=!1,n.forceSinglePass=!0,n.extensions={clipCullDistance:!1,multiDraw:!1},n.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},n.index0AttributeName=void 0,n.uniformsNeedUpdate=!1,n.glslVersion=null,void 0!==t&&n.setValues(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=a,e=Rt;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Go(n,e),n=a,(e=[{key:"copy",value:function(t){return Ho(a,"copy",this,3)([t]),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Io(t.uniforms),this.uniformsGroups=(t=>{for(var n=[],e=0;e(t=((t,n)=>{if("object"!=Xo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Xo(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Xo(t)?t:t+""))(i.key),i)}}function Wo(t,n,e){n=qo(n);var i=t,n=Qo()?Reflect.construct(n,e||[],qo(t).constructor):n.apply(t,e);if(!n||"object"!=Xo(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Qo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qo=function(){return!!t})()}function qo(t){return(qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Zo(t,n){return(Zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Jo=(()=>{function i(t,n){var e;if(this instanceof i)return(e=Wo(this,i)).textureID=void 0!==n?n:"tDiffuse",t instanceof R?(e.uniforms=t.uniforms,e.material=t):t&&(e.uniforms=L.clone(t.uniforms),e.material=new R({defines:Object.assign({},t.defines),uniforms:e.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),e.fsQuad=new h.FullScreenQuad(e.material),e;throw new TypeError("Cannot call a class as a function")}var t,n,e=i,r=h;if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&Zo(e,r),e=i,t&&Yo(e.prototype,t),n&&Yo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})(),Ko=(Object.assign(Jo.prototype,{render:function(t,n,e){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=e.texture),this.fsQuad.material=this.material,this.renderToScreen?t.setRenderTarget(null):(t.setRenderTarget(n),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil)),this.fsQuad.render(t)}}),{uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")});function $o(t){return($o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ta(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=$o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=$o(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==$o(t)?t:t+""))(i.key),i)}}function na(t,n,e){return n&&ta(t.prototype,n),e&&ta(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ea(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function ia(t,n,e){n=oa(n);var i=t,n=ra()?Reflect.construct(n,e||[],oa(t).constructor):n.apply(t,e);if(!n||"object"!=$o(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ra(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ra=function(){return!!t})()}function oa(t){return(oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function aa(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&sa(t,n)}function sa(t,n){return(sa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var ua=(()=>{function i(t,n){var e;return ea(this,i),(e=ia(this,i)).scene=t,e.camera=n,e.clear=!0,e.needsSwap=!1,e.inverse=!1,e}return aa(i,h),na(i)})(),la=(Object.assign(ua.prototype,{render:function(t,n,e){var i,r,o=t.getContext(),a=t.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),r=this.inverse?(i=0,1):(i=1,0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,i,4294967295),a.buffers.stencil.setClear(r),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP)}}),(()=>{function n(){var t;return ea(this,n),(t=ia(this,n)).needsSwap=!1,t}return aa(n,h),na(n)})());function ca(t){return(ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function fa(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=ca(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ca(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ca(t)?t:t+""))(i.key),i)}}function ha(t,n,e){n=da(n);var i=t,n=va()?Reflect.construct(n,e||[],da(t).constructor):n.apply(t,e);if(!n||"object"!=ca(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function va(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(va=function(){return!!t})()}function da(t){return(da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ma(t,n){return(ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(la.prototype,{render:function(t){t.state.buffers.stencil.setTest(!1)}});var pa=(()=>{function l(){var t,n=0(t=((t,n)=>{if("object"!=ya(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ya(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ya(t)?t:t+""))(i.key),i)}}function ba(t,n,e){n=wa(n);var i=t,n=_a()?Reflect.construct(n,e||[],wa(t).constructor):n.apply(t,e);if(!n||"object"!=ya(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function _a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_a=function(){return!!t})()}function wa(t){return(wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Sa(t,n){return(Sa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var D=(()=>{function o(){var t=0(t=((t,n)=>{if("object"!=xa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=xa(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==xa(t)?t:t+""))(i.key),i)}}var Ea=(()=>{return t=function t(){var n=!(0(t=((t,n)=>{if("object"!=Ma(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ma(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ma(t)?t:t+""))(i.key),i)}}function Oa(t,n,e){return n&&Pa(t.prototype,n),e&&Pa(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Na(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var Ca,La,Ra=Oa(function t(n,e){var i,r;Na(this,t),this.renderer=n,void 0===e?(i={minFilter:O,magFilter:O,format:J,stencilBuffer:!1},r=n.getSize(new B),this.R=n.getPixelRatio(),this.D=r.width,this.F=r.height,(e=new D(this.D*this.R,this.F*this.R,i)).texture.name="EffectComposer.rt1"):(this.R=1,this.D=e.width,this.F=e.height),this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===Jo&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Jo(Ko),this.clock=new Ea}),Da=(Object.assign(Ra.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},clearPass:function(){for(var t=0;t(t=((t,n)=>{if("object"!=Fa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Fa(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Fa(t)?t:t+""))(i.key),i)}}function ka(t,n,e){n=Ua(n);var i=t,n=ja()?Reflect.construct(n,e||[],Ua(t).constructor):n.apply(t,e);if(!n||"object"!=Fa(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ja(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ja=function(){return!!t})()}function Ua(t){return(Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ba(t,n){return(Ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(Da.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),Da.FullScreenQuad=(Ca=new n(-1,1,1,-1,0,1),La=new e(2,2),t=Oa(function t(n){Na(this,t),this.L=new _(La,n)}),Object.defineProperty(t.prototype,"material",{get:function(){return this.L.material},set:function(t){this.L.material=t}}),Object.assign(t.prototype,{dispose:function(){this.L.geometry.dispose()},render:function(t){t.render(this.L,Ca)}}),t);var Ha=(()=>{function o(t,n,e,i){var r;if(!(this instanceof o))throw new TypeError("Cannot call a class as a function");(r=ka(this,o)).scene=t,r.camera=n,r.sampleLevel=4,r.unbiased=!0,r.clearColor=void 0!==e?e:0,r.clearAlpha=void 0!==i?i:0;t=Ko;return r.copyUniforms=L.clone(t.uniforms),r.copyMaterial=new R({uniforms:r.copyUniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,premultipliedAlpha:!0,transparent:!0,blending:2,depthTest:!1,depthWrite:!1}),r.fsQuad=new Da.FullScreenQuad(r.copyMaterial),r}var t,n,e=o,i=Da;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Ba(e,i),e=o,t&&Ia(e.prototype,t),n&&Ia(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Va(t){return(Va="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function za(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Va(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Va(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Va(t)?t:t+""))(i.key),i)}}function Ga(t,n,e){n=Ya(n);var i=t,n=Xa()?Reflect.construct(n,e||[],Ya(t).constructor):n.apply(t,e);if(!n||"object"!=Va(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Xa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xa=function(){return!!t})()}function Ya(t){return(Ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Wa(t,n){return(Wa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(Ha.prototype,{dispose:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)},setSize:function(t,n){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(t,n)},render:function(t,n,e){this.sampleRenderTarget||(this.sampleRenderTarget=new D(e.width,e.height,{minFilter:O,magFilter:O,format:J}),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");for(var i=Ha.JitterVectors[Math.max(0,Math.min(this.sampleLevel,5))],r=t.autoClear,o=(t.autoClear=!1,t.getClearColor(new N).getHex()),a=t.getClearAlpha(),s=1/i.length,u=(this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,e.width),l=e.height,c=0;c{function r(t,n,e,i){if(this instanceof r)return void 0===Ha&&console.error("TAARenderPass relies on SSAARenderPass"),(t=Ga(this,r,[t,n,e,i])).sampleLevel=0,t.accumulate=!1,t;throw new TypeError("Cannot call a class as a function")}var t,n,e=r,i=Ha;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Wa(e,i),e=r,t&&za(e.prototype,t),n&&za(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function qa(t){return(qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Za(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=qa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=qa(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==qa(t)?t:t+""))(i.key),i)}}function Ja(t,n,e){return n&&Za(t.prototype,n),e&&Za(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}Qa.JitterVectors=Ha.JitterVectors,Object.assign(Qa.prototype,{render:function(t,n,e,i){if(this.accumulate){var r=Qa.JitterVectors[5],o=(this.sampleRenderTarget||(this.sampleRenderTarget=new D(e.width,e.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),this.holdRenderTarget||(this.holdRenderTarget=new D(e.width,e.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),this.accumulate&&-1===this.accumulateIndex&&(Ha.prototype.render.call(this,t,this.holdRenderTarget,e,i),this.accumulateIndex=0),t.autoClear),a=(t.autoClear=!1,1/r.length);if(0<=this.accumulateIndex&&this.accumulateIndex=r.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}a=this.accumulateIndex*a;0{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,r,o,a,s=[],u=!0,l=!1;try{if(o=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;u=!1}else for(;!(u=(i=o.call(e)).done)&&(s.push(i.value),s.length!==n);u=!0);}catch(t){l=!0,r=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}})(t,n)||ns(t,n)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function ns(t,n){var e;if(t)return"string"==typeof t?es(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?es(t,n):void 0}function es(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=$a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=$a(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==$a(t)?t:t+""))(i.key),i)}}function rs(t,n,e){return n&&is(t.prototype,n),e&&is(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var t=rs(function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.I=n,this.k=this.I.getRenderManager(),this.j=new l,this.U=null,this.Y=null,this.B=null,this.W=new b({color:"black"}),this.q=new Ka(n),this.Z=new D(4096,4096,{minFilter:O,magFilter:O,format:J,stencilBuffer:!1,generateMipmaps:!0}),this.J={},this.K="\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",this.$="\n uniform sampler2D baseTexture;\n uniform sampler2D baseMaptexture;\n uniform sampler2D bloomTexture;\n uniform sampler2D outlineTexture;\n uniform sampler2D spriteTexture;\n uniform sampler2D reflectTexture;\n uniform sampler2D reflectedTexture;\n\n varying vec2 vUv;\n\n vec4 getTexture( sampler2D texelToLinearTexture ) {\n\n return texture2D( texelToLinearTexture , vUv );\n\n }\n\n void main() {\n vec4 spriteColor = vec4( 1.0 ) * getTexture( spriteTexture );\n vec4 baseColor = vec4( 1.0 ) * getTexture( baseMaptexture );\n if(spriteColor.r != 0.0 || spriteColor.g != 0.0 || spriteColor.b != 0.0) {\n gl_FragColor = baseColor;\n } else {\n vec4 reflectedColor = getTexture(reflectedTexture);\n if(reflectedColor.a==1.0&&reflectedColor.g==1.0&&reflectedColor.b==1.0){\n gl_FragColor = baseColor;\n } else {\n vec4 reflectColor = vec4( 1.0 ) * getTexture(reflectTexture);\n if(reflectColor.r!=0.0 || reflectColor.g!=0.0 || reflectColor.b!=0.0){\n gl_FragColor = mix(reflectColor,baseColor,reflectedColor.r);\n gl_FragColor.a = baseColor.a;\n } else {\n gl_FragColor = baseColor;\n }\n }\n\n gl_FragColor = gl_FragColor + vec4( 1.0 ) * getTexture( bloomTexture );\n }\n gl_FragColor = gl_FragColor + vec4( 1.0 ) * getTexture(outlineTexture);\n }\n ",this.G()}),os=(Object.assign(t.prototype,{G:function(){var t=this.I.getRenderManager();this.U=new Ra(t.getRenderer()),this.Y=new Jo(new R({uniforms:{baseTexture:{value:null},baseMaptexture:{value:null},bloomTexture:{value:null},outlineTexture:{value:null},reflectTexture:{value:null},reflectedTexture:{value:null},spriteTexture:{value:null}},vertexShader:this.K,fragmentShader:this.$,defines:{}}),"baseTexture"),this.U.addPass(this.Y),this.V=this.V.bind(this),this.I.on("resize",this.V)},tt:function(t){this.Y.material.uniforms.spriteTexture.value=t,this.Y.material.uniforms.uniformsNeedUpdate=!0},nt:function(t){this.Y.material.uniforms.bloomTexture.value=t,this.Y.material.uniforms.uniformsNeedUpdate=!0},et:function(t){this.Y.material.uniforms.outlineTexture.value=t,this.Y.material.uniforms.uniformsNeedUpdate=!0},it:function(t,n){this.Y.material.uniforms.reflectTexture.value=t,this.Y.material.uniforms.reflectedTexture.value=n,this.Y.material.uniforms.uniformsNeedUpdate=!0},X:function(t){var n,e;this.I.getRenderManager().bloom&&this.I.getRenderManager().bloom.rt&&!this.I.getRenderManager().bloom.ot?(e=(n=this.k.getRenderer()).getRenderTarget(),n.setRenderTarget(this.Z),n.clear(),n.render(t,this.I.camera),this.Y.material.uniforms.baseMaptexture.value=this.Z.texture,this.Y.material.uniforms.uniformsNeedUpdate=!0,n.setRenderTarget(e)):(this.q.X(t),this.Y.material.uniforms.baseMaptexture.value=this.q.U.readBuffer.texture,this.Y.material.uniforms.uniformsNeedUpdate=!0),this.U.render()},st:function(t){for(var n=0;n{var e,i,r,o,a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return r=!(i=!0),{s:function(){a=a.call(t)},n:function(){var t=a.next();return i=t.done,t},e:function(t){r=!0,e=t},f:function(){try{i||null==a.return||a.return()}finally{if(r)throw e}}};if(Array.isArray(t)||(a=ns(t))||n&&t&&"number"==typeof t.length)return a&&(t=a),o=0,{s:n=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})(this.k.waterLayers);try{for(e.s();!(n=e.n()).done;){var i=ts(n.value,2),r=(i[0],i[1]);t?(r.j.visible=!0,r.dt.visible=!0):(r.j.visible=!1,r.dt.visible=!1)}}catch(t){e.e(t)}finally{e.f()}}this.k.sky&&(this.k.sky.j.visible=!!t),this.k.skyNeedTexture&&(this.k.skyNeedTexture.j.visible=!!t);var o=this.k.getGroundLayerScene(),o=(o&&(o.visible=!!t),this.k.getTileLayScene());o&&(o.visible=!!t)},ht:function(t,n,e){"Mesh"===t.type&&(e?(t.material=n[t.uuid],delete n[t.uuid]):(n[t.uuid]=t.material,t.material=this.W));for(var i=t.children,r=0;r(t=((t,n)=>{if("object"!=as(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=as(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==as(t)?t:t+""))(i.key),i)}}function us(t,n,e){return n&&ss(t.prototype,n),e&&ss(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var e=us(function t(n,e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.I=n,this.k=this.I.getRenderManager(),this.j=new l,this.U=null,this.B=null,this.J={},this.yt=e,this.V=this.V.bind(this),this.G()}),ls=(Object.assign(e.prototype,{G:function(){this.U=new Ra(this.k.getRenderer()),this.B=new f(this.j,this.I.camera,null,0,1),this.U.addPass(this.B),this.U.renderToScreen=!1,this.I.on("resize",this.V)},gt:function(t,n,e){for(var i=this.I.getBuilding(t).getFloor(parseInt(n)).getLayers(),r=0;r(t=((t,n)=>{if("object"!=cs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=cs(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==cs(t)?t:t+""))(i.key),i)}}function hs(t,n,e){return n&&fs(t.prototype,n),e&&fs(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var t=hs(function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.I=n,this._t=null,this.wt=null,this.St=null,this.xt=null}),vs=(Object.assign(t.prototype,{At:function(t){for(var n,e=this.I.getFloor(this.I.getLevel()),i=e.getLayers(T.MODEL_LAYER)[0].scene,r=[],o=0;o{if(Array.isArray(t))return ps(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||((t,n)=>{var e;if(t)return"string"==typeof t?ps(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ps(t,n):void 0})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function ps(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=ds(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ds(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ds(t)?t:t+""))(i.key),i)}}var gs=(()=>{function e(t){var n=this;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.type="effect",this.waterLayers=new Map,this.bloom=null,this.outLine=null,this.reflect=null,this.particle=null,this.sky=null,this.rain=null,this.flowlines=new Map,this.sweep=null,this.sao=null,this.fogEffect=null,this.renderScene=new l,t.getMapOptions().hdr&&t.getMapOptions().hdr.load(t,function(t){n.renderScene.environment=t}),this.mymap=t,this.isHDText=this.mymap.getMapOptions().HDText,this.postprocessing=new os(t),this.effectTool=new vs(t),this.effectTool.At(this.renderScene),this.spriteRender=new ls(t,this.postprocessing)}return t=e,(n=[{key:"render",value:function(){for(var l=this,t=(this.renderer.clear(),this.resize(),this.getTileLayScene()),n=(t&&!t.parent&&this.renderScene.add(t),this.getGroundLayerScene()),e=(n&&!n.parent&&this.renderScene.add(n),this.get3DTilesLayerSceneArr()),i=0;i{for(var n=[],e=0;e{for(var e=[],i=0;i{for(var i=0;i{void 0===n&&(n=!0);for(var e=0;e{for(var e=t.getLayers(),i=0;i(t=((t,n)=>{if("object"!=bs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=bs(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==bs(t)?t:t+""))(i.key),i)}}e=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.I=t,this.j=new l,this.Ot=null,this.Nt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TS0UqDnYQ6ZChOlkQK8VRqlgEC6Wt0KqDyaVf0MSQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIk6OToouU+L+k0CLGg+N+vLv3uHsHCK06U82+SUDVLCObSoqF4ooYfEUAEfiRQFxipp7OLeThOb7u4ePrXYxneZ/7cwwqJZMBPpF4lumGRbxOnNi0dM77xGFWlRTic+IJgy5I/Mh12eU3zhWHBZ4ZNvLZOeIwsVjpYbmHWdVQiaeJo4qqUb5QcFnhvMVZrTdY5578haGStpzjOs0IUlhEGhmIkNFADXVYiNGqkWIiS/tJD/+o48+QSyZXDYwc89iACsnxg//B727NcnzKTQolgcCLbX+MAcFdoN207e9j226fAP5n4Err+jdawMwn6c2uFj0ChraBi+uuJu8BlzvAyJMuGZIj+WkK5TLwfkbfVASGb4GBVbe3zj5OH4A8dbV0AxwcAuMVyl7zeHd/b2//nun09wPqUXLXvsrewQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+QFHAQMLuREfnwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAA9UlEQVQY002Pu0oDQRRA7517d0ISFwKaIKLgphPSqGltxEYk/2AnBNILdhba2PkBNv6BJn8QxLR2KVwEH6xBEk1G3ezMXBsDOeWpzgGYoxPbZvsxa807BgC4ibNSYhy9TdwGAvjzrglrK5oaUTDCTmx3p06O343rhzl1azK/hwC9coEOCeGMHVN38JlerZb4WxNeLCHZl6HdekjS9mZUvFdifhEJlpMvd6QUsngIKgt0WWR8IgRk1kG9zFJLJv46/phuF7S6G6d+J1rM1f2Pf8ZZZO8182uhOhUR7cGerId53q/ygAEAGlEw+t/siwgdVPPD2eYf14pkaPQAZiEAAAAASUVORK5CYII=",this.points=[],this.pointsStatus=[],this.O=t.getBound().size.x,this.Ct=t.getBound().size.y,this.Lt=1e5,this.Rt=0,this.Dt=this.Dt.bind(this),this.G(this.Lt),this.Ft()}return t=n,(e=[{key:"enable",value:function(){(this.I.getRenderManager().particle=this).I.on("beforeRender",this.Dt)}},{key:"disable",value:function(){this.I.getRenderManager().particle=null,this.I.off("beforeRender",this.Dt),this.Dt()}},{key:"dispose",value:function(){this.disable()}},{key:"setUrl",value:function(t){this.j.children[0].material.map=(new Mi).load(t),this.Nt=t}},{key:"setAmount",value:function(t){this.j.remove(this.Ot.points),this.points=[],this.pointsStatus=[];t=this.Lt*t;this.G(t)}},{key:"render",value:function(){var i=this;null!==this.Ot&&this.Ot.changePositions(.1,-.32,.1,function(t,n){return 0<=n},function(){var t=(Math.random()-.5)*i.O,n=1e3*Math.random(),e=(Math.random()-.5)*i.Ct;return new U(t,n,e)}),this.I.getRenderManager().renderer.render(this.j,this.I.camera)}}])&&_s(t.prototype,e),i&&_s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})(),Object.assign(e.prototype,{Dt:function(){this.I.enableUpdateRender()},It:function(t,n,e){for(var i=0;i(t=((t,n)=>{if("object"!=ws(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ws(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ws(t)?t:t+""))(i.key),i)}}function xs(t,n,e){n=Es(n);var i=t,n=As()?Reflect.construct(n,e||[],Es(t).constructor):n.apply(t,e);if(!n||"object"!=ws(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function As(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(As=function(){return!!t})()}function Es(t){return(Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ts(t,n){return(Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Ms=(()=>{function e(){var t;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");(t=xs(this,e)).renderTarget=new D(1,1,{minFilter:O,magFilter:O,format:J}),t.compositeMaterial=t.getCompositeMaterial(t.nMips);var n=Ko;return t.copyUniforms=L.clone(n.uniforms),t.copyUniforms.opacity.value=1,t.materialCopy=new R({uniforms:t.copyUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),t.clearColor=new N(0,0,0),t.oldClearColor=new N,t.oldClearAlpha=1,t.basic=new b,t.basic.transparent=!0,t.fsQuad=new h.FullScreenQuad(null),t}var t,n,i=e,r=h;if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");return i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),r&&Ts(i,r),i=e,t&&Ss(i.prototype,t),n&&Ss(i,n),Object.defineProperty(i,"prototype",{writable:!1}),i})();function Ps(t){return(Ps="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Os(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ps(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ps(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ps(t)?t:t+""))(i.key),i)}}function Ns(t,n,e){return n&&Os(t.prototype,n),e&&Os(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.assign(Ms.prototype,{dispose:function(){this.renderTarget.dispose()},setSize:function(t,n){t=Math.round(t/2),n=Math.round(n/2);this.renderTarget.setSize(t,n)},render:function(t,n,e,i,r){this.oldClearColor.copy(t.getClearColor(new N)),this.oldClearAlpha=t.getClearAlpha();var o=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),r&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=e.texture,t.setRenderTarget(null),this.fsQuad.render(t)),this.fsQuad.material=this.compositeMaterial,t.setRenderTarget(this.renderTarget),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTarget.texture,r&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?t.setRenderTarget(null):t.setRenderTarget(e),this.fsQuad.render(t),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=o},getCompositeMaterial:function(){return new R({uniforms:{iTime:{value:0},rainSize:{value:.1},iResolution:{value:new B(300,200)},iChannel3:{value:null}},vertexShader:"\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"\n varying vec2 vUv;\n uniform float iTime;\n uniform float rainSize;\n uniform vec2 iResolution;\n uniform vec2 iMouse;\n uniform sampler2D iChannel3;\n uniform sampler2D tDiffuse;\n\n void main() {\n float speed = fract(iTime);\n vec3 col = vec3(0.0, 0.0, 0.0);\n float aspect = iResolution.x / iResolution.y;\n\n // 屏幕uv 0~1\n vec2 q = gl_FragCoord.xy / iResolution.xy;\n q.x *= aspect;\n\n // 雨的倾斜方向, 1: 向右; -1:向左\n float rainDir = 1.;\n // 倾斜强度\n float tiltIntensity = 0.2;\n float offsetX = speed + q.y * rainDir * tiltIntensity;\n\n // 采样uv\n vec2 p = -1.0 + 2.0 * q;\n vec2 st = p * vec2(.5, 0.01) + vec2(offsetX, speed);\n\n // 整体透明度\n float opacity = .655;\n // 垂直竖线\n float f = texture2D(iChannel3, st).y;\n // 垂直竖线在水平方向上明暗变化\n f *= texture2D(iChannel3, st * 0.775).y;\n f *= opacity;\n\n col += f;\n col *= min(rainSize, 1.0);\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n "})}});var e=Ns(function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.I=n}),Cs=(Object.assign(e.prototype,{Dt:function(){this.I.enableUpdateRender()},kt:function(){return"basic"===this.I.getRenderManager().type&&this.I.setRenderManager(new gs(this.I)),this.I.getRenderManager()}}),e);function Ls(t){return(Ls="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Rs(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ls(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ls(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ls(t)?t:t+""))(i.key),i)}}e=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.jt=new Cs(t),this.Ut=-1,this.Bt=-1,this.Ht=this.jt.kt(),this.Dt=this.jt.Dt.bind(this),this.G(n)}return t=e,(n=[{key:"getRaindrops",value:function(){return this.Vt}},{key:"setRaindrops",value:function(t){this.Vt=t}},{key:"getUrl",value:function(){return this.Nt}},{key:"setUrl",value:function(t){this.Nt=t,this.zt.compositeMaterial.uniforms.iChannel3.value=(new Mi).load(t,function(t){t.wrapS=Q,t.wrapT=Q,t.anisotropy=16,t.repeat.set(4,4)})}},{key:"enable",value:function(){(this.I.getRenderManager().rain=this).I.on("beforeRender",this.Dt)}},{key:"disable",value:function(){this.I.getRenderManager().rain=null,this.I.off("beforeRender",this.Dt),this.Dt()}},{key:"dispose",value:function(){this.disable(),this.zt.dispose(),this.zt=null,this.j=null,this.Gt=null,this.Xt=null}},{key:"render",value:function(){this.V(),this.Yt+=.05,this.zt.compositeMaterial.uniforms.iTime.value=this.Yt,this.zt.compositeMaterial.uniforms.rainSize.value=this.Vt,this.Gt.render()}}])&&Rs(t.prototype,n),i&&Rs(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})(),Object.assign(e.prototype,{G:function(t){this.Nt=t.url,this.zt=new Ms,this.j=new l,this.Xt=new f(this.j,this.I.camera),this.Xt.clear=!1,this.Gt=new Ra(this.Ht.getRenderer()),this.Gt.addPass(this.Xt),this.Gt.addPass(this.zt),this.setUrl(this.Nt),this.zt.compositeMaterial.uniforms.iTime.value=.2,this.zt.compositeMaterial.uniforms.iResolution.value=new B(60,60),this.Yt=.6,this.Vt=t.raindrops},V:function(){var t,n,e;this.Gt&&(t=(n=this.Gt.renderer.domElement).clientWidth,n=n.clientHeight,e=!1,this.Ut!=t&&(e=!0,this.Ut=t),this.Bt!=n&&(e=!0,this.Bt=n),e)&&this.zt&&this.Gt.setSize(this.Ut,this.Bt)}});function Ds(t){return(Ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fs(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ds(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ds(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ds(t)?t:t+""))(i.key),i)}}function Is(t,n,e){n=Us(n);var i=t,n=ks()?Reflect.construct(n,e||[],Us(t).constructor):n.apply(t,e);if(!n||"object"!=Ds(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ks=function(){return!!t})()}function js(){return(js="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Us(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Us(t){return(Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Bs(t,n){return(Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Hs=(()=>{function l(){var t=0(t=((t,n)=>{if("object"!=Vs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Vs(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Vs(t)?t:t+""))(i.key),i)}}function Gs(t,n,e){n=Ys(n);var i=t,n=Xs()?Reflect.construct(n,e||[],Ys(t).constructor):n.apply(t,e);if(!n||"object"!=Vs(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xs=function(){return!!t})()}function Ys(t){return(Ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ws(t,n){return(Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Qs={uniforms:{luminanceValue:{value:1},turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new U},up:{value:new U(0,1,0)}},vertexShader:["uniform vec3 sunPosition;","uniform float rayleigh;","uniform float turbidity;","uniform float mieCoefficient;","uniform vec3 up;","varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunFade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","const float e = 2.71828182845904523536028747135266249775724709369995957;","const float pi = 3.141592653589793238462643383279502884197169;","const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );","const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );","const float v = 4.0;","const vec3 K = vec3( 0.686, 0.678, 0.666 );","const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );","const float cutoffAngle = 1.6110731556870734;","const float steepness = 1.5;","const float EE = 1000.0;","float sunIntensity( float zenithAngleCos ) {","\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );","\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );","}","vec3 totalMie( float T ) {","\tfloat c = ( 0.2 * T ) * 10E-18;","\treturn 0.434 * c * MieConst;","}","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tgl_Position.z = gl_Position.w;","\tvSunDirection = normalize( sunPosition );","\tvSunE = sunIntensity( dot( vSunDirection, up ) );","\tvSunFade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );","\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunFade ) );","\tvBetaR = totalRayleigh * rayleighCoefficient;","\tvBetaM = totalMie( turbidity ) * mieCoefficient;","}"].join("\n"),fragmentShader:["varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunFade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","uniform float luminanceValue;","uniform float mieDirectionalG;","uniform vec3 up;","const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );","const float pi = 3.141592653589793238462643383279502884197169;","const float n = 1.0003;","const float N = 2.545E25;","const float rayleighZenithLength = 8.4E3;","const float mieZenithLength = 1.25E3;","const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;","const float THREE_OVER_SIXTEENPI = 0.05968310365946075;","const float ONE_OVER_FOURPI = 0.07957747154594767;","float rayleighPhase( float cosTheta ) {","\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );","}","float hgPhase( float cosTheta, float g ) {","\tfloat g2 = pow( g, 2.0 );","\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );","\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );","}","const float A = 0.15;","const float B = 0.50;","const float C = 0.10;","const float D = 0.20;","const float E = 0.02;","const float F = 0.30;","const float whiteScale = 1.0748724675633854;","vec3 Uncharted2Tonemap( vec3 x ) {","\treturn ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;","}","void main() {","\tfloat zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );","\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );","\tfloat sR = rayleighZenithLength * inverse;","\tfloat sM = mieZenithLength * inverse;","\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );","\tfloat cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );","\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );","\tvec3 betaRTheta = vBetaR * rPhase;","\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );","\tvec3 betaMTheta = vBetaM * mPhase;","\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );","\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );","\tvec3 direction = normalize( vWorldPosition - cameraPos );","\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]","\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]","\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );","\tvec3 L0 = vec3( 0.1 ) * Fex;","\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );","\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;","\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );","\tvec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminanceValue, 4.0 ) ) ) * texColor );","\tvec3 color = curr * whiteScale;","\tvec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunFade ) ) ) );","\tgl_FragColor = vec4( retColor, 1.0 );","}"].join("\n")},qs=(()=>{function n(){var t;if(this instanceof n)return t=new R({fragmentShader:Qs.fragmentShader,vertexShader:Qs.vertexShader,uniforms:L.clone(Qs.uniforms),side:W}),Gs(this,n,[new Hs(1,1,1),t]);throw new TypeError("Cannot call a class as a function")}var t,e,i=n,r=_;if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");return i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),r&&Ws(i,r),i=n,t&&zs(i.prototype,t),e&&zs(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i})();function Zs(t){return(Zs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Js(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Zs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Zs(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Zs(t)?t:t+""))(i.key),i)}}function Ks(t,n,e){n=nu(n);var i=t,n=$s()?Reflect.construct(n,e||[],nu(t).constructor):n.apply(t,e);if(!n||"object"!=Zs(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function $s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($s=function(){return!!t})()}function tu(){return(tu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=nu(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function nu(t){return(nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function eu(t,n){return(eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var iu=(()=>{function N(){var t=0(t=((t,n)=>{if("object"!=ru(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ru(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ru(t)?t:t+""))(i.key),i)}}var au=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.I=t,this.j=new l,this.Wt=null,this.Qt=null,this.Qt={turbidity:10,rayleigh:3,mieCoefficient:.005,mieDirectionalG:.7,luminance:1,inclination:.49,azimuth:.25,scale:500},this.qt=4e5,this.Zt=0,this.Jt=1,this.G(),this.Ft()}return t=n,(e=[{key:"getState",value:function(){var t=this.sky.material.uniforms;return{turbidity:t.turbidity.value,rayleigh:t.rayleigh.value,luminance:t.luminanceValue.value,scale:this.sky.scale.x}}},{key:"setState",value:function(t){t.scale&&this.sky.scale.setScalar(t.scale);var n=this.sky.material.uniforms;n.turbidity.value=("number"==typeof t.turbidity?t:this.Qt).turbidity,n.rayleigh.value=("number"==typeof t.rayleigh?t:this.Qt).rayleigh,n.luminanceValue.value=("number"==typeof t.luminance?t:this.Qt).luminance,this.Kt(this.Qt.inclination)}},{key:"enable",value:function(){this.I.getRenderManager().renderScene.add(this.j),(this.I.getRenderManager().sky=this).I.enableUpdateNode()}},{key:"disable",value:function(){this.I.getRenderManager().renderScene.remove(this.j),this.I.getRenderManager().sky=null,this.I.enableUpdateNode()}},{key:"setTime",value:function(t){t=(t-6)/12;1(t=((t,n)=>{if("object"!=su(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=su(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==su(t)?t:t+""))(i.key),i)}}var lu=new U,cu=new U,fu=new v,hu=(()=>{return t=function t(){var n=0 outsideIOR when thinFilmThickness -> 0.0\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\t// Evaluate the cosTheta on the base layer (Snell law)\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\n\t\t// Handle TIR:\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\n\t\t\treturn vec3( 1.0 );\n\n\t\t}\n\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\n\t\t// First interface\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\n\t\t// Second interface\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0\n\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\n\t\t// Phase shift\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\n\t\t// Compound terms\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\n\t\t// Reflectance term for m = 0 (DC term amplitude)\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\n\t\t// Reflectance term for m > 0 (pairs of diracs)\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\n\t\t}\n\n\t\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\t\treturn max( I, vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n",bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// normalize is done to ensure that the bump map looks the same regardless of the texture's scale\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm; // normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#ifdef ALPHA_TO_COVERAGE\n\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tfloat unionClipOpacity = 1.0;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\n\t\t#endif\n\n\t\tdiffuseColor.a *= clipOpacity;\n\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\n\t#else\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tbool clipped = true;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tif ( clipped ) discard;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#elif defined( USE_COLOR )\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvColor = vec4( 1.0 );\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvColor = vec3( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR\n\n\tvColor *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.xyz *= instanceColor.xyz;\n\n#endif\n\n#ifdef USE_BATCHING_COLOR\n\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\n\tvColor.xyz *= batchingColor.xyz;\n\n#endif\n",common:"\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\n#ifdef USE_ALPHAHASH\n\n\tvarying vec3 vPosition;\n\n#endif\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\n\treturn tmp;\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\n\t\t#ifdef texture2DGradEXT\n\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering\n\n\t\t#else\n\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\n\t\t#endif\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= cubeUV_r1 ) {\n\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n",defaultnormal_vertex:"\n\nvec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = objectTangent;\n\n#endif\n\n#ifdef USE_BATCHING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = bm * transformedTangent;\n\n\t#endif\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = im * transformedTangent;\n\n\t#endif\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",colorspace_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",colorspace_pars_fragment:"\n\n// http://www.russellcottrell.com/photo/matrixCalculator.htm\n\n// Linear sRGB => XYZ => Linear Display P3\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\n\n// Linear Display P3 => XYZ => Linear sRGB\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\n\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\n\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\n\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\n\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}\n\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\n\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\t // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\n\t\t\t#else\n\n\t\t\t\treturn vec3( 0.0 );\n\n\t\t\t#endif\n\n\t\t}\n\n\t#endif\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\n\t#endif\n\n}\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_fragment:"\nLambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;\n",lights_lambert_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct LambertMaterial {\n\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = vec3(dotNL) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n\n#if defined( USE_LIGHT_PROBES )\n\n\tuniform vec3 lightProbe[ 9 ];\n\n#endif\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif ( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\tmaterial.ior = ior;\n\n\t#ifdef USE_SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_DISPERSION\n\n\tmaterial.dispersion = dispersion;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\n\t#ifdef USE_IRIDESCENCEMAP\n\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\n\t#else\n\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\n\t#endif\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\n\t#endif\n\n#endif\n\n#ifdef USE_ANISOTROPY\n\n\t#ifdef USE_ANISOTROPYMAP\n\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\n\t#else\n\n\t\tvec2 anisotropyV = anisotropyVector;\n\n\t#endif\n\n\tmaterial.anisotropy = length( anisotropyV );\n\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\n\t// Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n\n#endif\n",lights_physical_pars_fragment:'\n\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\n\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf\n#ifdef USE_ANISOTROPY\n\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\n\t\treturn saturate(v);\n\n\t}\n\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\n\t}\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\t// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\n\t\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\n\t#else\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t#endif\n\n\treturn F * ( V * D );\n\n}\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from \n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\n\tif ( material.iridescenceThickness == 0.0 ) {\n\n\t\tmaterial.iridescence = 0.0;\n\n\t} else {\n\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\n\t}\n\n\tif ( material.iridescence > 0.0 ) {\n\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\n\t}\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n\t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\n\t#else\n\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\n\t\tsampledDiffuseColor = 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 );\n\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t#if defined( USE_POINTS_UV )\n\n\t\tvec2 uv = vUv;\n\n\t#else\n\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_POINTS_UV )\n\n\tvarying vec2 vUv;\n\n#else\n\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t\tuniform mat3 uvTransform;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphinstance_vertex:"\n#ifdef USE_INSTANCING_MORPH\n\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\n\t}\n#endif\n",morphcolor_vertex:"\n#if defined( USE_MORPHCOLORS )\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tvColor *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t#if defined( USE_COLOR_ALPHA )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\n\t\t#elif defined( USE_COLOR )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\n\t\t#endif\n\n\t}\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_INSTANCING_MORPH\n\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\t#endif\n\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\n\t}\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n",normal_fragment_begin:"\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal *= faceDirection;\n\n\t#endif\n\n#endif\n\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\n\t#endif\n\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\n\t#endif\n\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 nonPerturbedNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\tnormal = normalize( tbn * mapN );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n",normal_pars_fragment:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_pars_vertex:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_vertex:"\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\n\t\treturn mat3( T * scale, B * scale, N );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n",iridescence_pars_fragment:"\n\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform sampler2D iridescenceMap;\n\n#endif\n\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform sampler2D iridescenceThicknessMap;\n\n#endif\n",opaque_fragment:"\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\nconst float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\n\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\n\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\n\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\n\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\t// the 0.9999 tweak is unimportant, very tiny empirical improvement\n\t// return vec3( vuf * Inv255, gf * PackUpscale, bf * 0.9999 );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\n\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\n\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\n\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\n\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( viewZ + near ) / ( near - far );\n}\n\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t// maps orthographic depth in [ 0, 1 ] to viewZ\n\treturn depth * ( near - far ) - near;\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\n\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t// maps perspective depth in [ 0, 1 ] to viewZ\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_BATCHING\n\n\tmvPosition = batchingMatrix * mvPosition;\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift according to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#if NUM_SPOT_LIGHT_MAPS > 0\n\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\n\t\t\t// dp = normalized distance from light to fragment position\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\t\tdp += shadowBias;\n\n\t\t\t// bd3D = base direction 3D\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t\t#else // no percentage-closer filtering\n\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t\t#endif\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n\n#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\n\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n\n#endif\n\n#if defined( USE_SHADOWMAP )\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n\n// spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\tuniform highp sampler2D boneTexture;\n\n\tmat4 getBoneMatrix( const in float i ) {\n\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn saturate( toneMappingExposure * color );\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 CineonToneMapping( vec3 color ) {\n\n\t// filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\n// Matrices for rec 2020 <> rec 709 color space conversion\n// matrix provided in row-major order so it has been transposed\n// https://www.itu.int/pub/R-REP-BT.2407-2017\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\n\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\n\n// https://iolite-engine.com/blog_posts/minimal_agx_implementation\n// Mean error^2: 3.6705141e-06\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n\n}\n\n// AgX Tone Mapping implementation based on Filament, which in turn is based\n// on Blender's implementation using rec 2020 primaries\n// https://github.com/google/filament/pull/7236\n// Inputs and outputs are encoded as Linear-sRGB.\n\nvec3 AgXToneMapping( vec3 color ) {\n\n\t// AgX constants\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\n\t// explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\n\t// LOG2_MIN = -10.0\n\t// LOG2_MAX = +6.5\n\t// MIDDLE_GRAY = 0.18\n\tconst float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )\n\tconst float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )\n\n\tcolor *= toneMappingExposure;\n\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\n\tcolor = AgXInsetMatrix * color;\n\n\t// Log2 encoding\n\tcolor = max( color, 1e-10 ); // avoid 0 or negative numbers for log2\n\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\t// Apply sigmoid\n\tcolor = agxDefaultContrastApprox( color );\n\n\t// Apply AgX look\n\t// v = agxLook(v, look);\n\n\tcolor = AgXOutsetMatrix * color;\n\n\t// Linearize\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\n\t// Gamut mapping. Simple clamp for now.\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\treturn color;\n\n}\n\n// https://modelviewer.dev/examples/tone-mapping\n\nvec3 NeutralToneMapping( vec3 color ) {\n\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\n\tcolor *= toneMappingExposure;\n\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\n\tcolor -= offset;\n\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\n\tif ( peak < StartCompression ) return color;\n\n\tfloat d = 1. - StartCompression;\n\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\n\tcolor *= newPeak / peak;\n\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\n\treturn mix( color, vec3( newPeak ), g );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n",transmission_fragment:"\n#ifdef USE_TRANSMISSION\n\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n\n#endif\n",transmission_pars_fragment:"\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\t// Mipped Bicubic Texture Filtering by N8\n\t// https://www.shadertoy.com/view/Dl2SDW\n\n\tfloat w0( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w1( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\n\t}\n\n\tfloat w2( float a ){\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w3( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\n\t}\n\n\t// g0 and g1 are the two amplitude functions\n\tfloat g0( float a ) {\n\n\t\treturn w0( a ) + w1( a );\n\n\t}\n\n\tfloat g1( float a ) {\n\n\t\treturn w2( a ) + w3( a );\n\n\t}\n\n\t// h0 and h1 are the two offset functions\n\tfloat h0( float a ) {\n\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\n\t}\n\n\tfloat h1( float a ) {\n\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\n\t}\n\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\n\t\tuv = uv * texelSize.zw + 0.5;\n\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\n\t}\n\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\n\t}\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independant scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\n\t}\n\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( isinf( attenuationDistance ) ) {\n\n\t\t\t// Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all.\n\t\t\treturn vec3( 1.0 );\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\n\t\t#ifdef USE_DISPERSION\n\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\n\t\t\t}\n\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\n\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\t// As less light is transmitted, the opacity should be increased. This simple approximation does a decent job \n\t\t// of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\n\t}\n#endif\n",uv_pars_fragment:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n",uv_pars_vertex:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n",uv_vertex:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvUv = vec3( uv, 1 ).xy;\n\n#endif\n#ifdef USE_MAP\n\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_BATCHING\n\n\t\tworldPosition = batchingMatrix * worldPosition;\n\n\t#endif\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",fengmap_map_fragment:"\n#ifdef USE_MAP\n\nvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n bool needMultiply = true;\n\tif(!isJsonModel){\n\t\tif (vMapUv.x < 0.0 || vMapUv.x > 1.0 || vMapUv.y < 0.0 || vMapUv.y > 1.0) {\n\t\t\tsampledDiffuseColor = diffuseColor;\n\t\t\tneedMultiply = false;\n\t\t}\n\t}\n\t\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\t\tsampledDiffuseColor = 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 );\n\t#endif\n\n\tif(mapMixColor){\n\t\tvec2 uvHeat=vec2((heatPosition.x - (heatCenter.x - heatSize.x/2.0)) / heatSize.x , (heatPosition.z - (heatCenter.y-heatSize.y/2.0)) / heatSize.y);\n\t\tvec4 heatColor=texture2D( map, uvHeat );\n\t\tdiffuseColor = heatColor*heatColor.a + diffuseColor*(1.0-heatColor.a);\n\t} else if(needMultiply){\n\t\tdiffuseColor *= sampledDiffuseColor;\n\t}\n#endif\n",fengmap_lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n\n#if defined( USE_LIGHT_PROBES )\n\n\tuniform vec3 lightProbe[ 9 ];\n\n#endif\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n\n}\n\n// fengmap r115\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #else\n\n if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #endif\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif ( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",fengmap_lights_lambert_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct LambertMaterial {\n\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = vec3(dotNL) * directLight.color;\n\tirradiance *= 3.1415926;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n",fengmap_lights_physical_pars_fragment:'\n\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\n\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf\n#ifdef USE_ANISOTROPY\n\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\n\t\treturn saturate(v);\n\n\t}\n\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\n\t}\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\t// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\n\t\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\n\t#else\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t#endif\n\n\treturn F * ( V * D );\n\n}\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from\n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tirradiance *= PI; // punctual light\n\n\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',fengmap_sweep_fragment:"\nif(isRect&&isEnable){\n vec2 v = vec2(v_position.x - moveP.x, v_position.z - moveP.y);\n if(isInRectW(v,se2N,sweepW) && isInRectH(v,se2RN,sweepH)){\n gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*color_a.rgb, 0.5),gl_FragColor.a);\n }\n}\n\nif(isAnnulus&&isEnable){\n if(isMaxCircle(v_position.xyz,circleC,maxR) && isMinCircle(v_position.xyz,circleC,minR)){\n if(isSweepTexture){\n vec2 uv = vec2((v_position.x-(circleC.x-maxR))/(2.0*maxR),(v_position.z-(circleC.y-maxR))/(2.0*maxR));\n vec4 tex = texture2D( sweepTexture, uv );\n tex = mapTexelToLinear( tex );\n float d2 = pow(v_position.x-circleC.x,2.0) + pow(v_position.z-circleC.y,2.0);\n float a = smoothstep(0.0, pow(maxR,2.0), d2);\n a = 1.0 - a;\n tex.a = a;\n gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*tex.rgb, 0.2),gl_FragColor.a);\n } else {\n gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*color_a.rgb, 0.5),gl_FragColor.a);\n }\n }\n\n}\n",fengmap_sweep_pars_fragment:"\n\tuniform bool isRect;\n\tuniform bool isAnnulus;\n\n\tuniform float sweepW;\n\tuniform float sweepH;\n\tuniform vec2 se2N;\n\tuniform vec2 se2RN;\n\tuniform vec2 moveP;\n\tuniform vec3 color_r;\n\n\tuniform vec2 circleC;\n\tuniform float maxR;\n\tuniform float minR;\n\tuniform vec3 color_a;\n\n\tuniform bool isSweepTexture;\n\tuniform sampler2D sweepTexture;\n\tuniform float sweepStrength;\n\n uniform bool isEnable;\n\n\tbool isInRectW(vec2 v, vec2 a, float w){\n\t\tfloat a1 = abs(dot(v,a));\n\t\treturn a1 < w;\n\t}\n\n\tbool isInRectH(vec2 v, vec2 a, float h){\n\t\tfloat a1 = abs(dot(v,a));\n\t\treturn a1 < h;\n\t}\n\n\tbool isMaxCircle(vec3 a, vec2 b, float r){\n\t\tfloat c = pow((a.x-b.x),2.0)+pow((a.z-b.y),2.0);\n\t\treturn c <= pow(r,2.0);\n\t}\n\n\tbool isMinCircle(vec3 a, vec2 b, float r){\n\t\tfloat c = pow((a.x-b.x),2.0)+pow((a.z-b.y),2.0);\n\t\treturn c > pow(r,2.0);\n\t}\n\n\tvec4 mapTexelToLinear( vec4 value ) {\n\t\treturn value;\n\t}\n",fengmap_sweep_pars_common:"\n varying vec3 v_position;\n",fengmap_sweep_vertex:"\n v_position = vec3(modelMatrix * vec4( position, 1.0 ));\n",fengmap_mask_vertex1:"\n #if NUM_MASK_POLYGON > 0\n varying vec3 maskPosition;\n #endif\n",fengmap_mask_vertex2:"\n #if NUM_MASK_POLYGON > 0\n maskPosition = vec3(modelMatrix * vec4( position, 1.0 ));\n #endif\n",fengmap_mask_fragment1:"\n #if NUM_MASK_POLYGON > 0\n varying vec3 maskPosition;\n varying float v_positionHeight;\n uniform vec2 maskPolygons[ NUM_MASK_POLYGON ];\n uniform int maskType;\n uniform bool isMask;\n uniform float maskHeight;\n uniform float maskExtrudeHeight;\n uniform vec2 boundCenter;\n\t uniform vec2 boundSize;\n uniform float maskOpacity;\n uniform float maskNodeHeight;\n bool isPointInsidePolygon(vec2 point,vec2 polygon2[NUM_MASK_POLYGON], int count) {\n if(count==1){\n return false;\n }\n if(count==2){\n return true;\n }\n <#ISPOINTINSIDEPOLYGON#>\n }\n #endif\n #if NUM_MASK_HOLE_POLYGON>0\n uniform vec2 maskHolePogygons[ NUM_MASK_HOLE_POLYGON ];\n bool isPointInsideHolePolygon(vec2 point,vec2 polygon2[NUM_MASK_HOLE_POLYGON], int count) {\n if(count==1){\n return false;\n }\n if(count==2){\n return true;\n }\n <#ISPOINTINSIDEHOLEPOLYGON#>\n }\n #endif\n",fengmap_mask_fragment2:"\n #if NUM_MASK_POLYGON > 0\n if(isMask){\n vec2 uvMesk=vec2((maskPosition.x - (boundCenter.x - boundSize.x/2.0)) / boundSize.x , (maskPosition.z - (boundCenter.y-boundSize.y/2.0)) / boundSize.y);\n bool isDiscard=false;\n \n if(maskType==0){\n if(!isPointInsidePolygon(uvMesk,maskPolygons,NUM_MASK_POLYGON)){\n isDiscard=true; \n }\n } else {\n if(isPointInsidePolygon(uvMesk,maskPolygons,NUM_MASK_POLYGON)){\n isDiscard=true; \n }\n }\n \n #if NUM_MASK_HOLE_POLYGON > 0\n if(maskType==0){\n if(!isDiscard && isPointInsideHolePolygon(uvMesk,maskHolePogygons,NUM_MASK_HOLE_POLYGON)){\n isDiscard=true; \n }\n } else {\n if(isDiscard && isPointInsideHolePolygon(uvMesk,maskHolePogygons,NUM_MASK_HOLE_POLYGON)){\n isDiscard=false; \n }\n }\n \n #endif\n if(isDiscard){\n if(maskPosition.y >= maskNodeHeight + maskHeight && maskPosition.y <= maskNodeHeight + maskHeight + maskExtrudeHeight){\n if(maskOpacity == 0.0){\n discard;\n } else {\n diffuseColor.a = maskOpacity;\n }\n }\n }\n }\n #endif\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",background_frag:"\nuniform sampler2D t2D;\nuniform float backgroundIntensity;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures\n\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n",backgroundCube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",backgroundCube_frag:"\n\n#ifdef ENVMAP_TYPE_CUBE\n\n\tuniform samplerCube envMap;\n\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\tuniform sampler2D envMap;\n\n#endif\n\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\n\t#else\n\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",cube_frag:"\nuniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\nvoid main() {\n\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n",depth_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#elif DEPTH_PACKING == 3202\n\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\n\t#elif DEPTH_PACKING == 3203\n\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\n\t#endif\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main () {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_frag:"\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshnormal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",meshnormal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_POINTS_UV\n\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n\n#endif\n\nvoid main() {\n\n\t#ifdef USE_POINTS_UV\n\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",shadow_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",fmMeshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vViewPosition;\nvarying vec3 heatPosition;\n\n// fengmap\nvarying float vIsPerspectiveCamera;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\theatPosition = vec3(modelMatrix * vec4( position, 1.0 ));\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// fengmap\n\tvIsPerspectiveCamera = isPerspectiveMatrix( projectionMatrix ) ? 1.0 : 0.0;\n}\n",fmMeshlambert_frag:"\n#define LAMBERT\n\n// fengmap\nvarying float vIsPerspectiveCamera;\n\nvarying vec3 heatPosition;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform bool mapMixColor;\nuniform vec2 heatCenter;\nuniform vec2 heatSize;\n\nuniform bool isJsonModel;\n\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvec3 rgb2hsb(vec3 c) {\n float maxVal = max(c.r, max(c.g, c.b));\n float minVal = min(c.r, min(c.g, c.b));\n float delta = maxVal - minVal;\n\n float h = 0.0;\n if (delta > 0.0) {\n if (maxVal == c.r) {\n h = mod((c.g - c.b) / delta, 6.0);\n } else if (maxVal == c.g) {\n h = (c.b - c.r) / delta + 2.0;\n } else {\n h = (c.r - c.g) / delta + 4.0;\n }\n h /= 6.0; // Normalize to range [0,1]\n }\n\n float s = (maxVal == 0.0) ? 0.0 : delta / maxVal;\n float b = maxVal;\n\n return vec3(h, s, b);\n}\n\nvec3 hsb2rgb(vec3 c) {\n float h = c.x * 6.0;\n float s = c.y;\n float b = c.z;\n\n float i = floor(h);\n float f = h - i;\n float p = b * (1.0 - s);\n float q = b * (1.0 - f * s);\n float t = b * (1.0 - (1.0 - f) * s);\n\n if (i == 0.0) return vec3(b, t, p);\n if (i == 1.0) return vec3(q, b, p);\n if (i == 2.0) return vec3(p, b, t);\n if (i == 3.0) return vec3(p, q, b);\n if (i == 4.0) return vec3(t, p, b);\n return vec3(b, p, q);\n}\n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#ifdef IGNORE_LIGHTING\n\t if(vIsPerspectiveCamera == 0.0) {\n\t\t\toutgoingLight = diffuseColor.rgb;\n\t\t}\n\t#endif\n\n\t#ifdef USE_MODEL_SIDE_GRADIENT\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\tif (dot(vec3(0.0, 1.0, 0.0), worldNormal) < 0.8) {\n\t\t\tvec3 hsb = rgb2hsb(outgoingLight);\n\t\t\thsb.y = clamp(hsb.y * 1.5, 0.0, 1.0);\n\t\t\thsb.z = clamp(hsb.z * 0.8, 0.0, 1.0);\n\t\t\toutgoingLight = mix(hsb2rgb(hsb), outgoingLight, vUv.y);\n\t\t}\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",fmMeshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n\n\t//fengmap\n\t#include \n}\n",fmMeshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",fmMeshBasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",fmMeshBasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"};function vu(t){return(vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function du(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=vu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=vu(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==vu(t)?t:t+""))(i.key),i)}}function mu(t,n,e){n=bu(n);var i=t,n=pu()?Reflect.construct(n,e||[],bu(t).constructor):n.apply(t,e);if(!n||"object"!=vu(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function pu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pu=function(){return!!t})()}function yu(t,n,e,i){var r=gu(bu(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function gu(){return(gu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=bu(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function bu(t){return(bu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _u(t,n){return(_u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var wu=new U,Su=new B,xu=new B,Au=(()=>{function a(){var t=0(t=((t,n)=>{if("object"!=Eu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Eu(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Eu(t)?t:t+""))(i.key),i)}}function Mu(t,n,e){n=Ou(n);var i=t,n=Pu()?Reflect.construct(n,e||[],Ou(t).constructor):n.apply(t,e);if(!n||"object"!=Eu(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Pu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Pu=function(){return!!t})()}function Ou(t){return(Ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nu(t,n){return(Nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Cu=(()=>{function P(t,n){var a,s,e,i,r,o,u,l,c,f,h,v,d,m,p,y,g,b,_,w,S,x,A,E,T,M;if(this instanceof P)return a=t=Mu(this,P,[t]),t.parentNode=n.parentNode,T=void 0!==(n=n||{}).textureWidth?n.textureWidth:512,M=void 0!==n.textureHeight?n.textureHeight:512,s=void 0!==n.clipBias?n.clipBias:0,e=void 0!==n.alpha?n.alpha:1,i=void 0!==n.time?n.time:0,r=void 0!==n.waterNormals?n.waterNormals:null,o=void 0!==n.sunDirection?n.sunDirection:new U(.70707,.70707,0),u=new N(void 0!==n.sunColor?n.sunColor:16777215),l=new N(void 0!==n.waterColor?n.waterColor:8355711),c=void 0!==n.eye?n.eye:new U(0,0,0),f=void 0!==n.distortionScale?n.distortionScale:20,h=void 0!==n.side?n.side:Y,n=void 0!==n.fog&&n.fog,v=new hu,d=new U,m=new U,p=new U,y=new C,g=new U(0,0,-1),b=new Dr,_=new U,w=new U,S=new Dr,x=new C,A=new Au,E=new D(T,M,{minFilter:O,magFilter:O,format:1022,stencilBuffer:!1,depthBuffer:!0}),t.renderTarget=E,X.isPowerOfTwo(T)&&X.isPowerOfTwo(M)||(E.texture.generateMipmaps=!1),T={uniforms:L.merge([F.fog,F.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new C},sunColor:{value:new N(8355711)},sunDirection:{value:new U(.70707,.70707,0)},eye:{value:new U},waterColor:{value:new N(5592405)}}]),vertexShader:["uniform mat4 textureMatrix;","uniform float time;","#include ","varying vec4 mirrorCoord;","varying vec4 worldPosition;","#include ",I.fog_pars_vertex,I.shadowmap_pars_vertex,"void main() {","\tmirrorCoord = modelMatrix * vec4( position, 1.0 );","\tworldPosition = mirrorCoord.xyzw;","\tmirrorCoord = textureMatrix * mirrorCoord;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;","\t#include ",I.fog_vertex,I.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D mirrorSampler;","uniform float alpha;","uniform float time;","uniform float size;","uniform float distortionScale;","uniform sampler2D normalSampler;","uniform vec3 sunColor;","uniform vec3 sunDirection;","uniform vec3 eye;","uniform vec3 waterColor;","varying vec4 mirrorCoord;","varying vec4 worldPosition;","#include ","vec4 getNoise( vec2 uv ) {","\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);","\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );","\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );","\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );","\tvec4 noise = texture2D( normalSampler, uv0 ) +","\t\ttexture2D( normalSampler, uv1 ) +","\t\ttexture2D( normalSampler, uv2 ) +","\t\ttexture2D( normalSampler, uv3 );","\treturn noise * 0.5 - 1.0;","}","void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {","\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );","\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );","\tspecularColor += pow( direction, shiny ) * sunColor * spec;","\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;","}",I.common,I.packing,I.bsdfs,I.fog_pars_fragment,I.lights_pars_begin,I.shadowmap_pars_fragment,I.shadowmask_pars_fragment,"void main() {","\t#include ","\tvec4 noise = getNoise( worldPosition.xz * size );","\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );","\tvec3 diffuseLight = vec3(0.0);","\tvec3 specularLight = vec3(0.0);","\tvec3 worldToEye = eye-worldPosition.xyz;","\tvec3 eyeDirection = normalize( worldToEye );","\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );","\tfloat distance = length(worldToEye);","\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;","\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );","\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );","\tfloat rf0 = 0.3;","\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );","\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;","\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);","\tvec3 outgoingLight = albedo;","\tgl_FragColor = vec4( outgoingLight, alpha );",I.tonemapping_fragment,I.fog_fragment,"}"].join("\n")},(M=new R({fragmentShader:T.fragmentShader,vertexShader:T.vertexShader,uniforms:L.clone(T.uniforms),lights:!0,side:h,fog:n,transparent:!0,depthTest:!0,depthWrite:!1})).uniforms.mirrorSampler.value=E.texture,M.uniforms.textureMatrix.value=x,M.uniforms.alpha.value=e,M.uniforms.time.value=i,M.uniforms.normalSampler.value=r,M.uniforms.sunColor.value=u,M.uniforms.waterColor.value=l,M.uniforms.sunDirection.value=o,M.uniforms.distortionScale.value=f,M.uniforms.eye.value=c,a.material=M,a.onBeforeRender=function(t,n,e){var i,r,o;m.setFromMatrixPosition(a.matrixWorld),p.setFromMatrixPosition(e.matrixWorld),y.extractRotation(a.matrixWorld),d.set(0,0,1),d.applyMatrix4(y),_.subVectors(m,p),0<_.dot(d)||(_.reflect(d).negate(),_.add(m),y.extractRotation(e.matrixWorld),g.set(0,0,-1),g.applyMatrix4(y),g.add(p),w.subVectors(m,g),w.reflect(d).negate(),w.add(m),A.position.copy(_),A.up.set(0,1,0),A.up.applyMatrix4(y),A.up.reflect(d),A.lookAt(w),A.far=e.far,A.updateMatrixWorld(),A.projectionMatrix.copy(e.projectionMatrix),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(A.projectionMatrix),x.multiply(A.matrixWorldInverse),v.setFromNormalAndCoplanarPoint(d,m),v.applyMatrix4(A.matrixWorldInverse),b.set(v.normal.x,v.normal.y,v.normal.z,v.constant),i=A.projectionMatrix,S.x=(Math.sign(b.x)+i.elements[8])/i.elements[0],S.y=(Math.sign(b.y)+i.elements[9])/i.elements[5],S.z=-1,S.w=(1+i.elements[10])/i.elements[14],b.multiplyScalar(2/b.dot(S)),i.elements[2]=b.x,i.elements[6]=b.y,i.elements[10]=b.z+1-s,i.elements[14]=b.w,c.setFromMatrixPosition(e.matrixWorld),i=t.getRenderTarget(),o=t.xr.enabled,r=t.shadowMap.autoUpdate,a.visible=!1,t.xr.enabled=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(E),!1===t.autoClear&&t.clear(),a.parentNode&&(a.parentNode.$t(!0),t.render(a.parentNode.tn,A),a.parentNode.$t(!1)),a.visible=!0,t.xr.enabled=o,t.shadowMap.autoUpdate=r,t.setRenderTarget(i),void 0!==(o=e.viewport)&&t.state.viewport(o))},t;throw new TypeError("Cannot call a class as a function")}var t,n,e=P,i=_;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Nu(e,i),e=P,t&&Tu(e.prototype,t),n&&Tu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Lu(t){return(Lu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ru(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Lu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Lu(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Lu(t)?t:t+""))(i.key),i)}}var Du=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.type="Curve",this.arcLengthDivisions=200}return n=t,(e=[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(t,n){t=this.getUtoTmapping(t);return this.getPoint(t,n)}},{key:"getPoints",value:function(){for(var t=0Number.EPSILON&&(a.normalize(),v=Math.acos(y(i[d-1].dot(i[d]),-1,1)),r[d].applyMatrix4(s.makeRotationAxis(a,v))),o[d].crossVectors(i[d],r[d]);if(!0===n){var m=Math.acos(y(r[0].dot(r[t]),-1,1));m/=t,0(t=((t,n)=>{if("object"!=Fu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Fu(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Fu(t)?t:t+""))(i.key),i)}}function ku(t,n,e){n=Hu(n);var i=t,n=ju()?Reflect.construct(n,e||[],Hu(t).constructor):n.apply(t,e);if(!n||"object"!=Fu(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ju(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ju=function(){return!!t})()}function Uu(t,n,e,i){var r=Bu(Hu(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Bu(){return(Bu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Hu(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Hu(t){return(Hu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Vu(t,n){return(Vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var zu=(()=>{function c(){var t=0(t=((t,n)=>{if("object"!=Gu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Gu(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Gu(t)?t:t+""))(i.key),i)}}function Yu(t,n,e){n=Qu(n);var i=t,n=Wu()?Reflect.construct(n,e||[],Qu(t).constructor):n.apply(t,e);if(!n||"object"!=Gu(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Wu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wu=function(){return!!t})()}function Qu(t){return(Qu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function qu(t,n){return(qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Zu=(()=>{function a(t,n,e,i,r,o){if(this instanceof a)return(t=Yu(this,a,[t,n,e,e,i,r,o])).isArcCurve=!0,t.type="ArcCurve",t;throw new TypeError("Cannot call a class as a function")}var t,n,e=a,i=zu;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&qu(e,i),e=a,t&&Xu(e.prototype,t),n&&Xu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Ju(t){return(Ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ku(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ju(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ju(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ju(t)?t:t+""))(i.key),i)}}function $u(t,n,e){n=il(n);var i=t,n=tl()?Reflect.construct(n,e||[],il(t).constructor):n.apply(t,e);if(!n||"object"!=Ju(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function tl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tl=function(){return!!t})()}function nl(t,n,e,i){var r=el(il(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function el(){return(el="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=il(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function il(t){return(il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function rl(t,n){return(rl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}function ol(){var r=0,o=0,a=0,s=0;function u(t,n,e,i){a=-3*(r=t)+3*n-2*(o=e)-i,s=2*t-2*n+e+i}return{initCatmullRom:function(t,n,e,i,r){u(n,e,r*(e-t),r*(i-n))},initNonuniformCatmullRom:function(t,n,e,i,r,o,a){t=(n-t)/r-(e-t)/(r+o)+(e-n)/o,r=(e-n)/o-(i-n)/(o+a)+(i-e)/a;u(n,e,t*=o,r*=o)},calc:function(t){var n=t*t;return r+o*t+a*n+s*(n*t)}}}var al=new U,sl=new ol,ul=new ol,ll=new ol,cl=(()=>{function a(){var t=0(t=((t,n)=>{if("object"!=dl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=dl(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==dl(t)?t:t+""))(i.key),i)}}function pl(t,n,e){n=_l(n);var i=t,n=yl()?Reflect.construct(n,e||[],_l(t).constructor):n.apply(t,e);if(!n||"object"!=dl(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yl=function(){return!!t})()}function gl(t,n,e,i){var r=bl(_l(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function bl(){return(bl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=_l(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function _l(t){return(_l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function wl(t,n){return(wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Sl=(()=>{function a(){var t=0(t=((t,n)=>{if("object"!=xl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=xl(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==xl(t)?t:t+""))(i.key),i)}}function El(t,n,e){n=Ol(n);var i=t,n=Tl()?Reflect.construct(n,e||[],Ol(t).constructor):n.apply(t,e);if(!n||"object"!=xl(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Tl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tl=function(){return!!t})()}function Ml(t,n,e,i){var r=Pl(Ol(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Pl(){return(Pl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Ol(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Ol(t){return(Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nl(t,n){return(Nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Cl=(()=>{function a(){var t=0(t=((t,n)=>{if("object"!=Ll(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ll(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ll(t)?t:t+""))(i.key),i)}}function Dl(t,n,e){n=jl(n);var i=t,n=Fl()?Reflect.construct(n,e||[],jl(t).constructor):n.apply(t,e);if(!n||"object"!=Ll(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Fl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fl=function(){return!!t})()}function Il(t,n,e,i){var r=kl(jl(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function kl(){return(kl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=jl(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function jl(t){return(jl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ul(t,n){return(Ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Bl=(()=>{function r(){var t=0(t=((t,n)=>{if("object"!=Hl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Hl(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Hl(t)?t:t+""))(i.key),i)}}function zl(t,n,e){n=Wl(n);var i=t,n=Gl()?Reflect.construct(n,e||[],Wl(t).constructor):n.apply(t,e);if(!n||"object"!=Hl(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Gl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gl=function(){return!!t})()}function Xl(t,n,e,i){var r=Yl(Wl(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Yl(){return(Yl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Wl(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Wl(t){return(Wl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ql(t,n){return(Ql=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var ql=(()=>{function r(){var t=0(t=((t,n)=>{if("object"!=Zl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Zl(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Zl(t)?t:t+""))(i.key),i)}}function Kl(t,n,e){n=ec(n);var i=t,n=$l()?Reflect.construct(n,e||[],ec(t).constructor):n.apply(t,e);if(!n||"object"!=Zl(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function $l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($l=function(){return!!t})()}function tc(t,n,e,i){var r=nc(ec(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function nc(){return(nc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=ec(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function ec(t){return(ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ic(t,n){return(ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var rc=(()=>{function o(){var t=0(t=((t,n)=>{if("object"!=oc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=oc(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==oc(t)?t:t+""))(i.key),i)}}function sc(t,n,e){n=fc(n);var i=t,n=uc()?Reflect.construct(n,e||[],fc(t).constructor):n.apply(t,e);if(!n||"object"!=oc(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uc=function(){return!!t})()}function lc(t,n,e,i){var r=cc(fc(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function cc(){return(cc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=fc(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function fc(t){return(fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function hc(t,n){return(hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var vc=(()=>{function o(){var t=0(t=((t,n)=>{if("object"!=dc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=dc(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==dc(t)?t:t+""))(i.key),i)}}function pc(t,n,e){n=_c(n);var i=t,n=yc()?Reflect.construct(n,e||[],_c(t).constructor):n.apply(t,e);if(!n||"object"!=dc(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function yc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yc=function(){return!!t})()}function gc(t,n,e,i){var r=bc(_c(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function bc(){return(bc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=_c(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function _c(t){return(_c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function wc(t,n){return(wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Sc=(()=>{function r(){var t=0e.length-2?e.length-1:i+1],e=e[i>e.length-3?e.length-1:i+2];return n.set(fl(t,r.x,o.x,a.x,e.x),fl(t,r.y,o.y,a.y,e.y)),n}},{key:"copy",value:function(t){gc(r,"copy",this,3)([t]),this.points=[];for(var n=0,e=t.points.length;n(t=((t,n)=>{if("object"!=xc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=xc(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==xc(t)?t:t+""))(i.key),i)}}function Ec(t,n,e){n=Oc(n);var i=t,n=Tc()?Reflect.construct(n,e||[],Oc(t).constructor):n.apply(t,e);if(!n||"object"!=xc(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tc=function(){return!!t})()}function Mc(t,n,e,i){var r=Pc(Oc(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Pc(){return(Pc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Oc(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Oc(t){return(Oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nc(t,n){return(Nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Cc=(()=>{function r(){var t;if(this instanceof r)return(t=Ec(this,r)).type="CurvePath",t.curves=[],t.autoClose=!1,t;throw new TypeError("Cannot call a class as a function")}var t,n=r,e=Du;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Nc(n,e),n=r,(e=[{key:"add",value:function(t){this.curves.push(t)}},{key:"closePath",value:function(){var t,n=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return n.equals(e)||(t=!0===n.isVector2?"LineCurve":"LineCurve3",this.curves.push(new o[t](e,n))),this}},{key:"getPoint",value:function(t,n){for(var e,i,r,o=t*this.getLength(),a=this.getCurveLengths(),s=0;s=o)return e=a[s]-o,r=(i=this.curves[s]).getLength(),i.getPointAt(0===r?0:1-e/r,n);s++}return null}},{key:"getLength",value:function(){var t=this.getCurveLengths();return t[t.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],n=0,e=0,i=this.curves.length;e(t=((t,n)=>{if("object"!=Lc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Lc(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Lc(t)?t:t+""))(i.key),i)}}function Dc(t,n,e){n=jc(n);var i=t,n=Fc()?Reflect.construct(n,e||[],jc(t).constructor):n.apply(t,e);if(!n||"object"!=Lc(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Fc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fc=function(){return!!t})()}function Ic(t,n,e,i){var r=kc(jc(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function kc(){return(kc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=jc(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function jc(t){return(jc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Uc(t,n){return(Uc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Bc=(()=>{function e(t){var n;if(this instanceof e)return(n=Dc(this,e)).type="Path",n.currentPoint=new B,t&&n.setFromPoints(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=e,i=Cc;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(i&&i.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),i&&Uc(n,i),n=e,(i=[{key:"setFromPoints",value:function(t){this.moveTo(t[0].x,t[0].y);for(var n=1,e=t.length;n(t=((t,n)=>{if("object"!=Hc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Hc(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Hc(t)?t:t+""))(i.key),i)}}function zc(t,n,e){n=Wc(n);var i=t,n=Gc()?Reflect.construct(n,e||[],Wc(t).constructor):n.apply(t,e);if(!n||"object"!=Hc(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gc=function(){return!!t})()}function Xc(t,n,e,i){var r=Yc(Wc(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Yc(){return(Yc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Wc(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Wc(t){return(Wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Qc(t,n){return(Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var qc=(()=>{function r(t){if(this instanceof r)return(t=zc(this,r,[t])).uuid=j(),t.type="Shape",t.holes=[],t;throw new TypeError("Cannot call a class as a function")}var t,n=r,e=Bc;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Qc(n,e),n=r,(e=[{key:"getPointsHoles",value:function(t){for(var n=[],e=0,i=this.holes.length;e{var r,o,a,s,u=[];for(r=0,o=n.length;r{for(var n=t,e=t;(n.x{var e=((t,n)=>{var e,i=n,r=-1/0,o=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=o&&r=i.x&&i.x>=c&&o!==i.x&&ef(ae.x||i.x===e.x&&((t,n)=>E(t.prev,t,n.prev)<0&&E(n.next,t,t.next)<0)(e,i)))&&(e=i,h=u),(i=i.next)!==l;);return e})(t,n);return e?(Kc(t=lf(e,t),t.next),Kc(e,e.next)):n})(u[r],e);return e})(t,n,c,s)),t.length>80*s){for(var h=e=t[0],v=i=t[1],d=s;d{for(var r=0,o=n,a=e-i;o{var r=t.prev,o=t,a=t.next;if(!(0<=E(r,o,a))){for(var s=r.x,u=o.x,l=a.x,c=r.y,f=o.y,h=a.y,v=s=y&&_&&_.z<=g;){if(b.x>=v&&b.x<=m&&b.y>=d&&b.y<=p&&b!==r&&b!==a&&ef(s,c,u,f,l,h,b.x,b.y)&&0<=E(b.prev,b,b.next))return;if(b=b.prevZ,_.x>=v&&_.x<=m&&_.y>=d&&_.y<=p&&_!==r&&_!==a&&ef(s,c,u,f,l,h,_.x,_.y)&&0<=E(_.prev,_,_.next))return;_=_.nextZ}for(;b&&b.z>=y;){if(b.x>=v&&b.x<=m&&b.y>=d&&b.y<=p&&b!==r&&b!==a&&ef(s,c,u,f,l,h,b.x,b.y)&&0<=E(b.prev,b,b.next))return;b=b.prevZ}for(;_&&_.z<=g;){if(_.x>=v&&_.x<=m&&_.y>=d&&_.y<=p&&_!==r&&_!==a&&ef(s,c,u,f,l,h,_.x,_.y)&&0<=E(_.prev,_,_.next))return;_=_.nextZ}return 1}})(t,i,r,o):(t=>{var n=t.prev,e=t,t=t.next;if(!(0<=E(n,e,t))){for(var i=n.x,r=e.x,o=t.x,a=n.y,s=e.y,u=t.y,l=i=l&&v.x<=f&&v.y>=c&&v.y<=h&&ef(i,a,r,s,o,u,v.x,v.y)&&0<=E(v.prev,v,v.next))return;v=v.next}return 1}})(t))n.push(S.i/e|0),n.push(t.i/e|0),n.push(x.i/e|0),ff(t),t=x.next,A=x.next;else if((t=x)===A){a?1===a?$c(t=((t,n,e)=>{var i=t;do{var r=i.prev,o=i.next.next}while(!rf(r,o)&&of(r,i,i.next,o)&&uf(r,o)&&uf(o,r)&&(n.push(r.i/e|0),n.push(i.i/e|0),n.push(o.i/e|0),ff(i),ff(i.next),i=t=o),(i=i.next)!==t);return Kc(i)})(Kc(t),n,e),n,e,i,r,o,2):2===a&&((t,n,e,i,r,o)=>{var a=t;do{for(var s,u=a.next.next;u!==a.prev;){if(a.i!==u.i&&((t,n)=>t.next.i!==n.i&&t.prev.i!==n.i&&!((t,n)=>{var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&of(e,e.next,t,n))return 1}while((e=e.next)!==t)})(t,n)&&(uf(t,n)&&uf(n,t)&&((t,n)=>{for(var e=t,i=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),(e=e.next)!==t;);return i})(t,n)&&(E(t.prev,t,n.prev)||E(t,n.prev,n))||rf(t,n)&&0=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function sf(t){return 0(t=((t,n)=>{if("object"!=vf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=vf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==vf(t)?t:t+""))(i.key),i)}}var mf=(()=>{function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function")}return t=n,i=[{key:"area",value:function(t){for(var n=t.length,e=0,i=n-1,r=0;r(t=((t,n)=>{if("object"!=gf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=gf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==gf(t)?t:t+""))(i.key),i)}}function _f(t,n,e){n=Af(n);var i=t,n=wf()?Reflect.construct(n,e||[],Af(t).constructor):n.apply(t,e);if(!n||"object"!=gf(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function wf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wf=function(){return!!t})()}function Sf(t,n,e,i){var r=xf(Af(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function xf(){return(xf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Af(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Af(t){return(Af=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ef(t,n){return(Ef=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Tf=(()=>{function s(){var t,n=0(t=((t,n)=>{if("object"!=Mf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Mf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Mf(t)?t:t+""))(i.key),i)}}var Of=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.I=t,this.nn=[],this.en=null,this.rn=T.MODEL_LAYER|T.EXTERNAL_MODEL_LAYER,this.on=T.EXTERNAL_MODEL_LAYER,this.j=new l,this.j.name="waterScene",this.dt=new l,this.dt.name="sprayScene",this.an=!1}return t=n,(e=[{key:"traverse",value:function(t){for(var n=0;n(t=((t,n)=>{if("object"!=Cf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Cf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Cf(t)?t:t+""))(i.key),i)}}function Rf(t,n,e){n=Ff(n);var i=t,n=Df()?Reflect.construct(n,e||[],Ff(t).constructor):n.apply(t,e);if(!n||"object"!=Cf(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Df(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Df=function(){return!!t})()}function Ff(t){return(Ff=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function If(t,n){return(If=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var w=(()=>{function l(t,n,e,i,r,o,a,s,u){if(this instanceof l)return(t=Rf(this,l,[t,n,e,i,r,o,a,s,u])).isCanvasTexture=!0,t.needsUpdate=!0,t;throw new TypeError("Cannot call a class as a function")}var t,n,e=l,i=_i;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&If(e,i),e=l,t&&Lf(e.prototype,t),n&&Lf(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function kf(t){return(kf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jf(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=kf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=kf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==kf(t)?t:t+""))(i.key),i)}}function Uf(t,n,e){return n&&jf(t.prototype,n),e&&jf(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Of=Uf(function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.pn=n.pn,this.yn=this.pn.speed,void 0===this.yn&&(this.yn=1),this.en=n,this.Tt=null,this.gn=null,this.bn=null,this._n=0,this.wn=null,this.Sn=null,this.xn=5,this.An=this.An.bind(this),this.En=1,this.Tn=[],this.Mn=document.createElement("canvas"),this.Mn.width=4096,this.Mn.height=4096}),Bf=(Object.assign(Of.prototype,{G:function(n){var e=this,t=this.en.I.getBuilding(this.en.I.getMapOptions().buildingID),i=new qc;i.moveTo(this.en.Pn[0].x-t.x,this.en.Pn[0].y-t.y);for(var r=1;r.3*this.bn.height?this.En=-1:this._n<0&&(this.En=1),this._n=this._n+this.yn*this.En,this.Nn();var t=new w(this.Mn);this.Tt.material.map.dispose(),this.Tt.material.map=t,this.Tt.material.map.needsUpdate=!0},Nn:function(){for(var t=this.bn.getContext("2d"),n=(t.clearRect(0,0,this.bn.width,this.bn.height),t.drawImage(this.wn,0,this._n,this.wn.width,this.wn.height),this.gn.getContext("2d")),e=(n.clearRect(0,0,this.gn.width,this.gn.height),this.pn.pointsInfo),i=0;i(t=((t,n)=>{if("object"!=Hf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Hf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Hf(t)?t:t+""))(i.key),i)}}var Of=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.Cn=n.color,this.Ln=n.alpha,this.F="number"==typeof n.height?n.height:0,this.Pn=n.points,this.Nt=n.url,this.pn=n.sprayInfos,this.on=n.intoLayerType,this.en=null,this.Tt=null,this.Rn=null,this.fn=!1,this.Dt=this.Dt.bind(this),this.Dn=1,this.Fn=[],this.tn=new l,this.In=null,this.kn=new Map}return t=e,(n=[{key:"color",get:function(){return this.Cn},set:function(t){this.Cn=t,this.Tt&&(this.Tt.material.uniforms.waterColor.value=new N(t))}},{key:"alpha",get:function(){return this.Ln},set:function(t){isNaN(""+t)&&(t=1),this.Ln=t,this.Tt&&(this.Tt.material.uniforms.alpha.value=t)}},{key:"height",get:function(){return this.F},set:function(t){this.F=t,this.Tt&&(this.Tt.position.y=t)}},{key:"addTo",value:function(t){var n=this.I.getRenderManager(),e=(n.waterLayers||"basic"===this.I.getRenderManager().type&&this.I.setRenderManager(new gs(this.I)),t.parent.buildingID),n=n.waterLayers.get(e+"_"+t.level);n||(n=new Nf(this.I),void 0!==this.on&&(n.on=this.on),n.un(t)),this.At(t),this.In=t,n.cn(this),this.jn(n.dt),this.tn.position.y=t.height,this.I.on("beforeRender",this.Dt)}},{key:"remove",value:function(){this.Rn&&this.Rn.mn(),this.en.vn(this)}}])&&Vf(t.prototype,n),i&&Vf(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})(),zf=(Object.assign(Of.prototype,{G:function(){var t=this.I.getBuilding(this.I.getMapOptions().buildingID),n=new qc;n.moveTo(this.Pn[0].x-t.x,this.Pn[0].y-t.y),this.Fn.push({x:this.Pn[0].x,y:this.Pn[0].y});for(var e=1;e=t.y||r.y=t.y)&&(i.x<=t.x||r.x<=t.x)&&i.x+(t.y-i.y)/(r.y-i.y)*(r.x-i.x)(t=((t,n)=>{if("object"!=Gf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Gf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Gf(t)?t:t+""))(i.key),i)}}function Yf(t,n,e){n=Qf(n);var i=t,n=Wf()?Reflect.construct(n,e||[],Qf(t).constructor):n.apply(t,e);if(!n||"object"!=Gf(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Wf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wf=function(){return!!t})()}function Qf(t){return(Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function qf(t,n){return(qf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Zf=(()=>{function f(t,n,e,i){var r;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");(r=Yf(this,f)).strength=void 0!==n?n:1,r.radius=e,r.threshold=i,r.resolution=void 0!==t?new B(t.x,t.y):new B(256,256),r.clearColor=new N(0,0,0);var o={minFilter:O,magFilter:O,format:J},a=(r.renderTargetsHorizontal=[],r.renderTargetsVertical=[],r.nMips=5,Math.round(r.resolution.x/2)),s=Math.round(r.resolution.y/2);r.renderTargetBright=new D(a,s,o),r.renderTargetBright.texture.name="UnrealBloomPass.bright",r.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u(t=((t,n)=>{if("object"!=Jf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Jf(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Jf(t)?t:t+""))(i.key),i)}}Object.assign(Zf.prototype,{dispose:function(){for(var t=0;t{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.Qn="number"==typeof(n=n||{}).strength?n.strength:.62,this.qn="number"==typeof n.radius?n.radius:.6,this.Zn="number"==typeof n.threshold?n.threshold:.4,this.rt=n.depthTest,this.ot=n.isAntiAliasing,void 0===this.ot&&(this.ot=!1),void 0===this.rt&&(this.rt=!1),this.rt||(this.ot=!1),this.Ht=null,this.Jn=new l,this.Kn=new Map,this.$n=null,this.En=1,this.te=!1,this.ne=1,this.ee=1,this.ie=1,this.re=1,this.H=null,this.G()}return t=e,(n=[{key:"isAntiAliasing",get:function(){return this.ot},set:function(t){this.ot=t,this.I.enableUpdateRender()}},{key:"getThreshold",value:function(){return this.$n.threshold}},{key:"setThreshold",value:function(t){this.$n.threshold=t,this.Zn=t,this.I.enableUpdateRender()}},{key:"getStrength",value:function(){return this.$n.strength}},{key:"setStrength",value:function(t){this.$n.strength=t,this.Qn=t,this.I.enableUpdateRender()}},{key:"getRadius",value:function(){return this.$n.radius}},{key:"setRadius",value:function(t){this.$n.radius=t,this.qn=t,this.I.enableUpdateRender()}},{key:"enable",value:function(){(this.Ht.bloom=this).I.enableUpdateRender()}},{key:"disable",value:function(){this.Ht.bloom=null,this.I.enableUpdateRender()}},{key:"add",value:function(t){if(Array.isArray(t))for(var n=0;n=this.ne&&(this.En=-1),this.re<1&&(this.En=1)),this.re=this.re+this.En*this.ie,this.$n.radius=this.qn*this.re,this.$n.strength=this.Qn*this.re,this.I.enableUpdateRender()},X:function(t,n){var e=this.Ht.renderer.toneMapping;this.Ht.renderer.toneMapping=2,this.rt||this.se(n,!1),this.updateCamera(t),this.U.render(),this.rt||this.se(n,!0),this.Ht.renderer.toneMapping=e},se:function(t,n){n?null!==this.Ht.fogEffect&&(null!==this.Ht.fogEffect.lt&&(this.Ht.renderScene.fog.density=this.Ht.fogEffect.ct),null!==this.Ht.fogEffect.ft)&&(this.Ht.renderScene.background=this.Ht.fogEffect.ft):(null!==this.Ht.renderScene.fog&&(this.Ht.renderScene.fog.density=0),this.Ht.renderScene.background=null);for(var e=0;e(t=((t,n)=>{if("object"!=th(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=th(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==th(t)?t:t+""))(i.key),i)}}function eh(t,n,e){n=oh(n);var i=t,n=ih()?Reflect.construct(n,e||[],oh(t).constructor):n.apply(t,e);if(!n||"object"!=th(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ih(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ih=function(){return!!t})()}function rh(){return(rh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=oh(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function oh(t){return(oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ah(t,n){return(ah=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var sh=(()=>{function a(t){var n;if(this instanceof a)return(n=eh(this,a)).isMeshDepthMaterial=!0,n.type="MeshDepthMaterial",n.depthPacking=3200,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.setValues(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=a,e=Rt;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&ah(n,e),n=a,(e=[{key:"copy",value:function(t){var n,e,i,r,o;return n=a,e="copy",i=this,o=rh(oh(1&(r=3)?n.prototype:n),e,i),(2&r&&"function"==typeof o?function(t){return o.apply(i,t)}:o)([t]),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}])&&nh(n.prototype,e),t&&nh(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function uh(t){return(uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lh(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=uh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=uh(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==uh(t)?t:t+""))(i.key),i)}}function ch(t,n,e){n=hh(n);var i=t,n=fh()?Reflect.construct(n,e||[],hh(t).constructor):n.apply(t,e);if(!n||"object"!=uh(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function fh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(fh=function(){return!!t})()}function hh(t){return(hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function vh(t,n){return(vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var dh=(()=>{function o(t,n,e,i){var r;if(!(this instanceof o))throw new TypeError("Cannot call a class as a function");(r=ch(this,o)).renderScene=n,r.renderCamera=e,r.selectedObjects=void 0!==i?i:[],r.visibleEdgeColor=new N(1,1,1),r.hiddenEdgeColor=new N(.1,.04,.02),r.edgeGlow=0,r.usePatternTexture=!1,r.edgeThickness=1,r.edgeStrength=3,r.downSampleRatio=2,r.pulsePeriod=0,r.resolution=void 0!==t?new B(t.x,t.y):new B(256,256);n={minFilter:O,magFilter:O,format:J},e=Math.round(r.resolution.x/r.downSampleRatio),i=Math.round(r.resolution.y/r.downSampleRatio),r.maskBufferMaterial=new b({color:16777215}),r.maskBufferMaterial.side=2,r.renderTargetMaskBuffer=new D(r.resolution.x,r.resolution.y,n),r.renderTargetMaskBuffer.texture.name="OutlinePass.mask",r.renderTargetMaskBuffer.texture.generateMipmaps=!1,r.depthMaterial=new sh,r.depthMaterial.side=2,r.depthMaterial.depthPacking=3201,r.depthMaterial.blending=0,r.prepareMaskMaterial=r.getPrepareMaskMaterial(),r.prepareMaskMaterial.side=2,r.prepareMaskMaterial.fragmentShader=((t,n)=>(n=n.isPerspectiveCamera?"perspective":"orthographic",t.replace(/DEPTH_TO_VIEW_Z/g,n+"DepthToViewZ")))(r.prepareMaskMaterial.fragmentShader,r.renderCamera),r.renderTargetDepthBuffer=new D(r.resolution.x,r.resolution.y,n),r.renderTargetDepthBuffer.texture.name="OutlinePass.depth",r.renderTargetDepthBuffer.texture.generateMipmaps=!1,r.renderTargetMaskDownSampleBuffer=new D(e,i,n),r.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",r.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,r.renderTargetBlurBuffer1=new D(e,i,n),r.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",r.renderTargetBlurBuffer1.texture.generateMipmaps=!1,r.renderTargetBlurBuffer2=new D(Math.round(e/2),Math.round(i/2),n),r.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",r.renderTargetBlurBuffer2.texture.generateMipmaps=!1,r.edgeDetectionMaterial=r.getEdgeDetectionMaterial(),r.renderTargetEdgeBuffer1=new D(e,i,n),r.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",r.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,r.renderTargetEdgeBuffer2=new D(Math.round(e/2),Math.round(i/2),n),r.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",r.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,r.separableBlurMaterial1=r.getSeperableBlurMaterial(4),r.separableBlurMaterial1.uniforms.texSize.value.set(e,i),r.separableBlurMaterial1.uniforms.kernelRadius.value=1,r.separableBlurMaterial2=r.getSeperableBlurMaterial(4),r.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(e/2),Math.round(i/2)),r.separableBlurMaterial2.uniforms.kernelRadius.value=4,r.overlayMaterial=r.getOverlayMaterial(),t=Ko;return r.copyUniforms=L.clone(t.uniforms),r.copyUniforms.opacity.value=1,r.materialCopy=new R({uniforms:r.copyUniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,blending:0,depthTest:!1,depthWrite:!1,transparent:!0}),r.enabled=!0,r.needsSwap=!1,r.oldClearColor=new N,r.oldClearAlpha=1,r.fsQuad=new h.FullScreenQuad(null),r.tempPulseColor1=new N,r.tempPulseColor2=new N,r.textureMatrix=new C,r}var t,n,e=o,i=h;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&vh(e,i),e=o,t&&lh(e.prototype,t),n&&lh(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function mh(t){return(mh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ph(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=mh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=mh(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==mh(t)?t:t+""))(i.key),i)}}function yh(t,n,e){n=bh(n);var i=t,n=gh()?Reflect.construct(n,e||[],bh(t).constructor):n.apply(t,e);if(!n||"object"!=mh(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function gh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(gh=function(){return!!t})()}function bh(t){return(bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _h(t,n){return(_h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(dh.prototype,{dispose:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()},setSize:function(t,n){this.renderTargetMaskBuffer.setSize(t,n);t=Math.round(t/this.downSampleRatio),n=Math.round(n/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(t,n),this.renderTargetBlurBuffer1.setSize(t,n),this.renderTargetEdgeBuffer1.setSize(t,n),this.separableBlurMaterial1.uniforms.texSize.value.set(t,n),t=Math.round(t/2),n=Math.round(n/2),this.renderTargetBlurBuffer2.setSize(t,n),this.renderTargetEdgeBuffer2.setSize(t,n),this.separableBlurMaterial2.uniforms.texSize.value.set(t,n)},changeVisibilityOfSelectedObjects:function(n){function t(t){t.isMesh&&(n?(t.visible=t.userData.oldVisible,delete t.userData.oldVisible):(t.userData.oldVisible=t.visible,t.visible=n))}for(var e=0;e","#include ","varying vec4 projTexCoord;","varying vec4 vPosition;","uniform mat4 textureMatrix;","void main() {","\t#include ","\t#include ","\t#include ","\t#include ","\t#include ","\tvPosition = mvPosition;","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tprojTexCoord = textureMatrix * worldPosition;","}"].join("\n"),fragmentShader:["#include ","varying vec4 vPosition;","varying vec4 projTexCoord;","uniform sampler2D depthTexture;","uniform vec2 cameraNearFar;","void main() {","\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));","\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );","\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;","\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);","}"].join("\n")})},getEdgeDetectionMaterial:function(){return new R({uniforms:{maskTexture:{value:null},texSize:{value:new B(.5,.5)},visibleEdgeColor:{value:new U(1,1,1)},hiddenEdgeColor:{value:new U(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}"})},getSeperableBlurMaterial:function(t){return new R({defines:{MAX_RADIUS:t},uniforms:{colorTexture:{value:null},texSize:{value:new B(.5,.5)},direction:{value:new B(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\t\t\t\t}"})},getOverlayMaterial:function(){return new R({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform sampler2D edgeTexture1;\t\t\t\tuniform sampler2D edgeTexture2;\t\t\t\tuniform sampler2D patternTexture;\t\t\t\tuniform float edgeStrength;\t\t\t\tuniform float edgeGlow;\t\t\t\tuniform bool usePatternTexture;\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\t\t\t\t\tif(usePatternTexture)\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\t\t\t\t\tgl_FragColor = finalColor;\t\t\t\t}",blending:2,depthTest:!1,depthWrite:!1,transparent:!0})}}),dh.BlurDirectionX=new B(1,0),dh.BlurDirectionY=new B(0,1);var wh=(()=>{function i(t,n){var e;if(this instanceof i)return(e=yh(this,i)).needsSwap=!1,e.clearColor=void 0!==t?t:0,e.clearAlpha=void 0!==n?n:0,e;throw new TypeError("Cannot call a class as a function")}var t,n=i,e=h;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&_h(n,e),n=i,(e=[{key:"render",value:function(t,n,e){var i,r;this.clearColor&&(i=t.getClearColor(new N).getHex(),r=t.getClearAlpha(),t.setClearColor(this.clearColor,this.clearAlpha)),t.setRenderTarget(this.renderToScreen?null:e),t.clear(),this.clearColor&&t.setClearColor(i,r)}}])&&ph(n.prototype,e),t&&ph(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function Sh(t,n){return(t=>{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,r,o,a,s=[],u=!0,l=!1;try{if(o=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;u=!1}else for(;!(u=(i=o.call(e)).done)&&(s.push(i.value),s.length!==n);u=!0);}catch(t){l=!0,r=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}})(t,n)||xh(t,n)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function xh(t,n){var e;if(t)return"string"==typeof t?Ah(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ah(t,n):void 0}function Ah(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=Eh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Eh(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Eh(t)?t:t+""))(i.key),i)}}var Mh=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.ue=3,void 0!==n.edgeStrength&&(this.ue=n.edgeStrength),void(this.le=0)!==n.edgeGlow&&(this.le=n.edgeGlow),this.ce=1,void 0!==n.edgeThickness&&(this.ce=n.edgeThickness),void(this.fe=0)!==n.pulsePeriod&&(this.fe=n.pulsePeriod),this.he="#FFFFFF",void 0!==n.visibleEdgeColor&&(this.he=n.visibleEdgeColor),this.ve="#FFFFFF",this.ve=void 0!==n.hiddenEdgeColor?n.hiddenEdgeColor:this.he,this.Ht=null,this.de=new Map,this.Xt=new l,this.me=new l,this.me.add(this.Xt),this.Kn=new Map,this.pe=null,this.H=null,this.ye=[],this.ge=null,this.U=null,this.G()}return t=e,(n=[{key:"enable",value:function(){(this.Ht.outLine=this).be(),this.I.on("update",this.An),this.I.on("resize",this.V),this.I.on("viewModeChanged",this._e)}},{key:"disable",value:function(){this.Ht.outLine=null,this.I.off("update",this.An),this.I.off("resize",this.V),this.I.off("viewModeChanged",this._e)}},{key:"add",value:function(t){if(this.remove(),Array.isArray(t))for(var n=0;n{var e,i,r,o,a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return r=!(i=!0),{s:function(){a=a.call(t)},n:function(){var t=a.next();return i=t.done,t},e:function(t){r=!0,e=t},f:function(){try{i||null==a.return||a.return()}finally{if(r)throw e}}};if(Array.isArray(t)||(a=xh(t))||n&&t&&"number"==typeof t.length)return a&&(t=a),o=0,{s:n=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})(this.Ht.waterLayers);try{for(n.s();!(t=n.n()).done;){var e=Sh(t.value,2);e[0];e[1].sn(!0)}}catch(t){n.e(t)}finally{n.f()}}}});function Ph(t){return(Ph="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Oh(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ph(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ph(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ph(t)?t:t+""))(i.key),i)}}var Nh=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.I=t,this.jt=new Cs(t),this.we=[],this.Se={x:0,y:0,maxR:0,radius:0,minR:0,widthR:0,length:0,distance:0,width:0,height:0,color_a:0,color_r:0,point:null,endPoint:null,startPoint:null,se2N:null,speed:1,se2RN:null},this.xe=!1,this.Ae=!1,this.Ht=this.jt.kt(),this.Ee=(new Date).getTime(),this.Dt=this.jt.Dt.bind(this),this.Te=!1,this.G()}return t=n,(e=[{key:"enable",value:function(){this.Te=!0,(this.Ht.sweep=this).I.on("beforeRender",this.Dt)}},{key:"disable",value:function(){this.Te=!1;for(var t=Array.from(this.Ht.getRenderList()),n=0;n= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")}),Lh={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new B(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new C},cameraInverseProjectionMatrix:{value:new C},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include ","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include ","vec4 getDefaultColor( const in vec2 screenPosition ) {","\t#if DIFFUSE_TEXTURE == 1","\treturn texture2D( tDiffuse, vUv );","\t#else","\treturn vec4( 1.0 );","\t#endif","}","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {","\t#if NORMAL_TEXTURE == 1","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","\t#else","\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );","\t#endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {","\tvec3 viewDelta = sampleViewPosition - centerViewPosition;","\tfloat viewDistance = length( viewDelta );","\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;","\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {","\t// precompute some variables require in getOcclusion.","\tscaleDividedByCameraFar = scale / cameraFar;","\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;","\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );","\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/","\tfloat angle = rand( vUv + randomSeed ) * PI2;","\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;","\tvec2 radiusStep = radius;","\tfloat occlusionSum = 0.0;","\tfloat weightSum = 0.0;","\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {","\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;","\t\tradius += radiusStep;","\t\tangle += ANGLE_STEP;","\t\tfloat sampleDepth = getDepth( sampleUv );","\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {","\t\t\tcontinue;","\t\t}","\t\tfloat sampleViewZ = getViewZ( sampleDepth );","\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );","\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );","\t\tweightSum += 1.0;","\t}","\tif( weightSum == 0.0 ) discard;","\treturn occlusionSum * ( intensity / weightSum );","}","void main() {","\tfloat centerDepth = getDepth( vUv );","\tif( centerDepth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = getViewZ( centerDepth );","\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );","\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );","\tgl_FragColor = getDefaultColor( vUv );","\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join("\n")},Rh={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new B(512,512)},sampleUvOffsets:{value:[new B(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include ","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {","\tvUv = uv;","\tvInvSize = 1.0 / size;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include ","#include ","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","void main() {","\tfloat depth = getDepth( vUv );","\tif( depth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = -getViewZ( depth );","\tbool rBreak = false, lBreak = false;","\tfloat weightSum = sampleWeights[0];","\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;","\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {","\t\tfloat sampleWeight = sampleWeights[i];","\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;","\t\tvec2 sampleUv = vUv + sampleUvOffset;","\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;","\t\tif( ! rBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t\tsampleUv = vUv - sampleUvOffset;","\t\tviewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;","\t\tif( ! lBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t}","\tgl_FragColor = diffuseSum / weightSum;","}"].join("\n")},Dh={createSampleWeights:function(t,n){for(var e,i,r=[],o=0;o<=t;o++)r.push((e=o,i=n,Math.exp(-e*e/(i*i*2))/(Math.sqrt(2*Math.PI)*i)));return r},createSampleOffsets:function(t,n){for(var e=[],i=0;i<=t;i++)e.push(n.clone().multiplyScalar(i));return e},configure:function(t,n,e,i){t.defines.KERNEL_RADIUS=n,t.uniforms.sampleUvOffsets.value=Dh.createSampleOffsets(n,i),t.uniforms.sampleWeights.value=Dh.createSampleWeights(n,e),t.needsUpdate=!0}},Fh={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include ","void main() {","\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );","\tgl_FragColor = vec4( vec3( depth ), opacity );","}"].join("\n")};function Ih(t){return(Ih="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function kh(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ih(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ih(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ih(t)?t:t+""))(i.key),i)}}function jh(t,n,e){n=Vh(n);var i=t,n=Uh()?Reflect.construct(n,e||[],Vh(t).constructor):n.apply(t,e);if(!n||"object"!=Ih(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Uh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Uh=function(){return!!t})()}function Bh(t,n,e,i){var r=Hh(Vh(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function Hh(){return(Hh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Vh(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Vh(t){return(Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function zh(t,n){return(zh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Gh=(()=>{function h(t,n,e,i,r,o,a,s,u){var l=9(t=((t,n)=>{if("object"!=Xh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Xh(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Xh(t)?t:t+""))(i.key),i)}}function Wh(t,n,e){n=Zh(n);var i=t,n=Qh()?Reflect.construct(n,e||[],Zh(t).constructor):n.apply(t,e);if(!n||"object"!=Xh(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qh=function(){return!!t})()}function qh(){return(qh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=Zh(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function Zh(t){return(Zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Jh(t,n){return(Jh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Kh=(()=>{function a(t){var n;if(this instanceof a)return(n=Wh(this,a)).isMeshNormalMaterial=!0,n.type="MeshNormalMaterial",n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new B(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.flatShading=!1,n.setValues(t),n;throw new TypeError("Cannot call a class as a function")}var t,n=a,e=Rt;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Jh(n,e),n=a,(e=[{key:"copy",value:function(t){var n,e,i,r,o;return n=a,e="copy",i=this,o=qh(Zh(1&(r=3)?n.prototype:n),e,i),(2&r&&"function"==typeof o?function(t){return o.apply(i,t)}:o)([t]),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}])&&Yh(n.prototype,e),t&&Yh(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function $h(t){return($h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=$h(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=$h(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==$h(t)?t:t+""))(i.key),i)}}function nv(t,n,e){n=iv(n);var i=t,n=ev()?Reflect.construct(n,e||[],iv(t).constructor):n.apply(t,e);if(!n||"object"!=$h(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function ev(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ev=function(){return!!t})()}function iv(t){return(iv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function rv(t,n){return(rv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var ov=(()=>{function a(t,n,e,i,r){var o;if(this instanceof a)return(o=nv(this,a)).scene=t,o.camera=n,o.clear=!0,o.needsSwap=!1,o.supportsDepthTextureExtension=void 0!==e&&e,o.supportsNormalTexture=void 0!==i&&i,o.originalClearColor=new N,o.oldClearColor=new N,o.oldClearAlpha=1,o.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},o.resolution=void 0!==r?new B(r.x,r.y):new B(256,256),o.saoRenderTarget=new D(o.resolution.x,o.resolution.y,{minFilter:O,magFilter:O,format:J}),o.blurIntermediateRenderTarget=o.saoRenderTarget.clone(),o.beautyRenderTarget=o.saoRenderTarget.clone(),o.normalRenderTarget=new D(o.resolution.x,o.resolution.y,{minFilter:m,magFilter:m,format:J}),o.depthRenderTarget=o.normalRenderTarget.clone(),o.supportsDepthTextureExtension&&((e=new Gh).type=1012,e.minFilter=m,e.maxFilter=m,o.beautyRenderTarget.depthTexture=e,o.beautyRenderTarget.depthBuffer=!0),o.depthMaterial=new sh,o.depthMaterial.depthPacking=3201,o.depthMaterial.blending=0,o.normalMaterial=new Kh,o.normalMaterial.blending=0,o.saoMaterial=new R({defines:Object.assign({},Lh.defines),fragmentShader:Lh.fragmentShader,vertexShader:Lh.vertexShader,uniforms:L.clone(Lh.uniforms)}),o.saoMaterial.extensions.derivatives=!0,o.saoMaterial.defines.DEPTH_PACKING=o.supportsDepthTextureExtension?0:1,o.saoMaterial.defines.NORMAL_TEXTURE=o.supportsNormalTexture?1:0,o.saoMaterial.defines.PERSPECTIVE_CAMERA=o.camera.isPerspectiveCamera?1:0,o.saoMaterial.uniforms.tDepth.value=o.supportsDepthTextureExtension?e:o.depthRenderTarget.texture,o.saoMaterial.uniforms.tNormal.value=o.normalRenderTarget.texture,o.saoMaterial.uniforms.size.value.set(o.resolution.x,o.resolution.y),o.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(o.camera.projectionMatrix),o.saoMaterial.uniforms.cameraProjectionMatrix.value=o.camera.projectionMatrix,o.saoMaterial.blending=0,o.vBlurMaterial=new R({uniforms:L.clone(Rh.uniforms),defines:Object.assign({},Rh.defines),vertexShader:Rh.vertexShader,fragmentShader:Rh.fragmentShader}),o.vBlurMaterial.defines.DEPTH_PACKING=o.supportsDepthTextureExtension?0:1,o.vBlurMaterial.defines.PERSPECTIVE_CAMERA=o.camera.isPerspectiveCamera?1:0,o.vBlurMaterial.uniforms.tDiffuse.value=o.saoRenderTarget.texture,o.vBlurMaterial.uniforms.tDepth.value=o.supportsDepthTextureExtension?e:o.depthRenderTarget.texture,o.vBlurMaterial.uniforms.size.value.set(o.resolution.x,o.resolution.y),o.vBlurMaterial.blending=0,o.hBlurMaterial=new R({uniforms:L.clone(Rh.uniforms),defines:Object.assign({},Rh.defines),vertexShader:Rh.vertexShader,fragmentShader:Rh.fragmentShader}),o.hBlurMaterial.defines.DEPTH_PACKING=o.supportsDepthTextureExtension?0:1,o.hBlurMaterial.defines.PERSPECTIVE_CAMERA=o.camera.isPerspectiveCamera?1:0,o.hBlurMaterial.uniforms.tDiffuse.value=o.blurIntermediateRenderTarget.texture,o.hBlurMaterial.uniforms.tDepth.value=o.supportsDepthTextureExtension?e:o.depthRenderTarget.texture,o.hBlurMaterial.uniforms.size.value.set(o.resolution.x,o.resolution.y),o.hBlurMaterial.blending=0,o.materialCopy=new R({uniforms:L.clone(Ko.uniforms),vertexShader:Ko.vertexShader,fragmentShader:Ko.fragmentShader,blending:0}),o.materialCopy.transparent=!0,o.materialCopy.depthTest=!1,o.materialCopy.depthWrite=!1,o.materialCopy.blending=5,o.materialCopy.blendSrc=208,o.materialCopy.blendDst=200,o.materialCopy.blendEquation=100,o.materialCopy.blendSrcAlpha=206,o.materialCopy.blendDstAlpha=200,o.materialCopy.blendEquationAlpha=100,o.depthCopy=new R({uniforms:L.clone(Fh.uniforms),vertexShader:Fh.vertexShader,fragmentShader:Fh.fragmentShader,blending:0}),o.fsQuad=new h.FullScreenQuad(null),o;throw new TypeError("Cannot call a class as a function")}var t,n,e=a,i=h;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&rv(e,i),e=a,t&&tv(e.prototype,t),n&&tv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e})();function av(t){return(av="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=av(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=av(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==av(t)?t:t+""))(i.key),i)}}ov.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4},Object.assign(ov.prototype,{constructor:ov,render:function(t,n,e){var i,r;this.renderToScreen&&(this.materialCopy.blending=0,this.materialCopy.uniforms.tDiffuse.value=e.texture,this.materialCopy.needsUpdate=!0,this.renderPass(t,this.materialCopy,null)),1!==this.params.output&&(this.oldClearColor.copy(t.getClearColor(new N)),this.oldClearAlpha=t.getClearAlpha(),i=t.autoClear,t.autoClear=!1,t.setRenderTarget(this.depthRenderTarget),t.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far,r=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near),this.vBlurMaterial.uniforms.depthCutoff.value=r,this.hBlurMaterial.uniforms.depthCutoff.value=r,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),this.prevStdDev===this.params.saoBlurStdDev&&this.prevNumSamples===this.params.saoBlurRadius||(Dh.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new B(0,1)),Dh.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new B(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),t.setClearColor(0),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(t,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(t,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(t,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(t,this.hBlurMaterial,this.saoRenderTarget,16777215,1)),r=this.materialCopy,3===this.params.output?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,r=this.depthCopy):(4===this.params.output?this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture:this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),0===this.params.output?r.blending=5:r.blending=0,this.renderPass(t,r,this.renderToScreen?null:e),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=i)},renderPass:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor(new N));var o=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.fsQuad.material=n,this.fsQuad.render(t),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(o)},renderOverride:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor(new N));var o=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,i=n.clearColor||i,r=n.clearAlpha||r,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.scene.overrideMaterial=n,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(o)},setSize:function(t,n){this.beautyRenderTarget.setSize(t,n),this.saoRenderTarget.setSize(t,n),this.blurIntermediateRenderTarget.setSize(t,n),this.normalRenderTarget.setSize(t,n),this.depthRenderTarget.setSize(t,n),this.saoMaterial.uniforms.size.value.set(t,n),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrix),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(t,n),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(t,n),this.hBlurMaterial.needsUpdate=!0}});var uv=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.j=new l,this.Ht=this.kt(),this.G(n)}return t=e,(n=[{key:"getAttribute",value:function(t){for(var n in this.Pe.params)if(n.toLowerCase()===("sao"+t).toLowerCase())return this.Pe.params[n]}},{key:"setAttribute",value:function(t,n){for(var e in this.Pe.params)e.toLowerCase()===("sao"+t).toLowerCase()&&(this.Pe.params[e]=n)}},{key:"add",value:function(t){this.j.add(t)}},{key:"enable",value:function(){this.Ht.sao=this}},{key:"disable",value:function(){this.Ht.sao=null}},{key:"render",value:function(){this.Oe.render()}}])&&sv(t.prototype,n),i&&sv(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})();Object.assign(uv.prototype,{kt:function(){return"basic"===this.I.getRenderManager().type&&this.I.setRenderManager(new gs(this.I)),this.I.getRenderManager()},G:function(t){this.Oe=new Ra(this.Ht.getRenderer()),this.Ne=new Jo(Ch),this.Ne.uniforms.resolution.value.set(1/this.I.getContainer().clientWidth,1/this.I.getContainer().clientHeight),this.B=new f(this.j,this.I.camera),this.Pe=new ov(this.j,this.I.camera,!1,!0),this.Pe.params.output=ov.OUTPUT.Default,this.Pe.params.saoBias=t.bias||-.8,this.Pe.params.saoIntensity=t.intensity||12e-5,this.Pe.params.saoScale=t.scale||30,this.Pe.params.saoKernelRadius=t.radius||30,this.Pe.params.saoMinResolution=t.minResolution||0,this.Pe.params.saoBlurRadius=t.blurRadius||4.1,this.Pe.params.saoBlurStdDev=t.blurStdDev||4,this.Pe.params.saoBlurDepthCutoff=t.blurDepthCutoff||.01,this.Oe.addPass(this.B),this.Oe.addPass(this.Pe),this.Oe.addPass(this.Ne)}});function lv(t){return(lv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function cv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=lv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=lv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==lv(t)?t:t+""))(i.key),i)}}function fv(t,n,e){n=mv(n);var i=t,n=hv()?Reflect.construct(n,e||[],mv(t).constructor):n.apply(t,e);if(!n||"object"!=lv(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function hv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hv=function(){return!!t})()}function vv(t,n,e,i){var r=dv(mv(1&i?t.prototype:t),n,e);return 2&i&&"function"==typeof r?function(t){return r.apply(e,t)}:r}function dv(){return(dv="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=mv(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function mv(t){return(mv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function pv(t,n){return(pv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var yv=(()=>{function T(){var a=0(t=((t,n)=>{if("object"!=gv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=gv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==gv(t)?t:t+""))(i.key),i)}}function _v(t,n,e){n=Sv(n);var i=t,n=wv()?Reflect.construct(n,e||[],Sv(t).constructor):n.apply(t,e);if(!n||"object"!=gv(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function wv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wv=function(){return!!t})()}function Sv(t){return(Sv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function xv(t,n){return(xv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Av=(t=>{function n(){if(this instanceof n)return _v(this,n,[{type:T.FLOW_LINE_LAYER}]);throw new TypeError("Cannot call a class as a function")}var e,i,r=n;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&xv(r,t),r=n,e&&bv(r.prototype,e),i&&bv(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r})(fengmap.FMMarkerLayer);function Ev(t){return(Ev="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ev(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ev(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ev(t)?t:t+""))(i.key),i)}}var Mv=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.Nt=n.url,this.Cn=n.color,void 0===this.Cn&&(this.Cn="#FF0000"),this.Ce=n.backgroundColor,void 0===this.Ce&&(this.Ce="#FF0000"),this.Le=n.points,this.Re=n.lineWidth,void 0===this.Re&&(this.Re=2),this.De=n.lineLength,void 0===this.De&&(this.De=500),this.yn=n.speed,void 0===this.yn&&(this.yn=1),this.Fe=n.opacity,void 0===this.Fe&&(this.Fe=1),this.Ie=n.smoothparam,void 0===this.Ie&&(this.Ie=35),this.j=new l,this.en=null,this.ke=null,this.ft=null,this.je=null,this.Ue=n.count,void 0===this.Ue&&(this.Ue=5),this.Be=null,this.fn=!1,this.V=this.V.bind(this),this.Dt=this.Dt.bind(this),this.He=this.He.bind(this),this.vertexShader="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",this.fragmentShader="\n uniform float time;\n uniform float repeat;\n varying vec2 vUv;\n uniform sampler2D textureMap;\n uniform sampler2D background;\n void main( void ) {\n vec4 backcolor=texture2D(background,vUv);\n if(backcolor.a==0.0) discard;\n vec4 colora = texture2D( textureMap, vec2(fract( vUv.x + time )*repeat, vUv.y));\n colora.r = colora.r * colora.a * 10.0;\n colora.g = colora.g * colora.a * 10.0;\n colora.b = colora.b * colora.a * 10.0;\n gl_FragColor = vec4(vec3(mix(colora,backcolor,1.0-colora.a)),1.0);\n }\n "}return t=e,(n=[{key:"parent",get:function(){return this.en}},{key:"getUrl",value:function(){return this.Nt}},{key:"setUrl",value:function(t){var n=this;this.Nt=t,this.Ve(function(t){t=new w(t);t.wrapS=t.wrapT=Q,t.repeat.set(n.Ue,1),t.needsUpdate=!0,n.je.uniforms.textureMap.value=t})}},{key:"getColor",value:function(){return this.Cn}},{key:"setColor",value:function(t){var n=this;this.Cn=t,this.Nt=void 0,this.Ve(function(t){t=new w(t);t.wrapS=t.wrapT=Q,t.repeat.set(n.Ue,1),t.needsUpdate=!0,n.je.uniforms.textureMap.value=t})}},{key:"getBackgroundColor",value:function(){return this.Ce}},{key:"setBackgroundColor",value:function(t){this.Ce=t,this.je.uniforms.background.value=new w(this.ze())}},{key:"getLineWidth",value:function(){return this.Re}},{key:"setLineWidth",value:function(t){this.Re=t,this.en.scene.remove(this.ke),this.Ge()}},{key:"getSpeed",value:function(){return this.yn}},{key:"setSpeed",value:function(t){this.yn=t,this.ke.userData.speed=t}},{key:"addTo",value:function(t){fengmap.FMMarkerFun.LAYER_CLASS.get(T.FLOW_LINE_LAYER)||fengmap.FMMarkerFun.LAYER_CLASS.set(T.FLOW_LINE_LAYER,Av);var n=t.parent.buildingID;this.Be=n+"_"+t.level,this.fn||this.G(t)}},{key:"remove",value:function(){this.mn()}},{key:"dispose",value:function(){this.remove()}}])&&Tv(t.prototype,n),i&&Tv(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})();Object.assign(Mv.prototype,{Dt:function(){this.je&&(this.je.uniforms.time.value-=this.yn/1e3,this.I.enableUpdateNode())},G:function(t){this.Ge(t),this.fn=!0},Ge:function(a){var s=this;this.Ve(function(t){for(var t=new w(t),n=(s.ft=t,s.Xe(s.Le,s.Re/4)),t=(t.wrapS=t.wrapT=Q,t.repeat.set(s.Ue,1),t.needsUpdate=!0,new R({uniforms:{time:{value:0},repeat:{value:s.Ue},textureMap:{value:t},background:{value:new w(s.ze())}},transparent:!0,depthWrite:!0,depthTest:!0,side:W,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader})),e=(s.je=t,new Cc),i=0;i(t=((t,n)=>{if("object"!=Pv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Pv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Pv(t)?t:t+""))(i.key),i)}}function Nv(t,n,e){n=Lv(n);var i=t,n=Cv()?Reflect.construct(n,e||[],Lv(t).constructor):n.apply(t,e);if(!n||"object"!=Pv(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Cv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Cv=function(){return!!t})()}function Lv(t){return(Lv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Rv(t,n){return(Rv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Dv=(t=>{function n(){if(this instanceof n)return Nv(this,n,[{type:T.FIRE_MARKER}]);throw new TypeError("Cannot call a class as a function")}var e,i,r=n;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&Rv(r,t),r=n,e&&Ov(r.prototype,e),i&&Ov(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r})(fengmap.FMMarkerLayer),Fv={FOV:35,CAMERA_NEAR:1,CAMERA_FAR:1e5,ZOOM_UPPER_BOUND:30,TILT_UPPER_BOUND:90,THOUSAND:1e3,DEG2RAD:.0174532,RAD2DEG:57.2957795,DRAW_TIME:500,EPS:.001},Iv=(Object.freeze(Fv),Fv);function kv(t){return(kv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=kv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=kv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==kv(t)?t:t+""))(i.key),i)}}var Uv=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}return n=t,i=[{key:"round",value:function(t){return 0>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&o]+t[o>>8&255]+t[o>>16&255]+t[o>>24&255];return t.length=0,e.toUpperCase()}},{key:"findNearNthPowerOfTwo",value:function(t){t-=1;return(t=(t=(t=(t=(t|=t>>1)|t>>2)|t>>4)|t>>8)|t>>16)<0?1:1+t}},{key:"rgbToArray",value:function(t){var n=new N;return n.setStyle(t),[n.r,n.g,n.b]}},{key:"toRgba",value:function(t){var n;return void 0===t?t:"number"!=typeof t?3<=(n=t.split(",")).length?"rgba("+parseInt(n[0])+","+parseInt(n[1])+","+parseInt(n[2])+",1)":t:"rgba("+parseInt(255*new N(t).r)+","+parseInt(255*new N(t).g)+","+parseInt(255*new N(t).b)+",1)"}},{key:"toColor",value:function(t){var n;return"number"==typeof t?t:3<=(n=t.split(",")).length?parseInt(n[0])<<16|parseInt(n[1])<<8|parseInt(n[2]):(console.error("color format error",t),0)}},{key:"cov",value:function(t){for(var n=[],e=[0,0],i=[],r=0;r(t=((t,n)=>{if("object"!=Bv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Bv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Bv(t)?t:t+""))(i.key),i)}}var Fv=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.Ye=(t=t||{}).src,this.We=t.dest,this.en=null,this.Qe=[],this.Ee=0,this.qe=0,this.Ze=0,this.Je=Iv.THOUSAND,this.Ke=!1,this.$e=!1,this.ti=!0,this.An=null,this.ni=null,this.ei=Uv.generateUUID()}return t=n,(e=[{key:"play",value:function(){return this.ii()}},{key:"pause",value:function(){return this.$e=!0,this}},{key:"resume",value:function(){return this.$e=!1,this.Ee+=this.Ze,this.Ze=0,this}},{key:"stop",value:function(){return this.ti=!0,this}},{key:"finish",value:function(){return this.ti=!0,this.ni&&this.ni(),this.Qe=[],this}},{key:"setSrc",value:function(t){return this.ri(t)}},{key:"setDest",value:function(t){return this.oi(t)}},{key:"setDuration",value:function(t){return this.ai(t)}},{key:"setUpdate",value:function(t){return this.si(t)}},{key:"setCallback",value:function(t){return this.ui(t)}},{key:"inverse",value:function(){return this.li()}},{key:"setDelay",value:function(t){return this.ci(t)}}])&&Hv(t.prototype,e),i&&Hv(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})(),Vv=(Object.assign(Fv.prototype,{mn:function(){for(var t in this)this[""+t]=null,delete this[""+t]},ri:function(t){return this.Ye=t,this},oi:function(t){return this.We=t,this},ai:function(t){return this.Je=t*Iv.THOUSAND,this},ci:function(t){return this.qe=t*Iv.THOUSAND,this},si:function(t){return this.An=t,this},ui:function(t){return this.ni=t,this},fi:function(t){return this.Ke=t,this},ii:function(){return this.ti=!1,this.en&&(this.Ee=this.en.hi),this},vi:function(){var t=new this.constructor({src:this.Ye,dest:this.We});return t.Ee=this.Ee,t.qe=this.qe,t.Je=this.Je,t.Ke=this.Ke,t.An=this.An,t.ni=this.ni,t},li:function(){var t=this.We.concat(),n=this.Ye.concat();return this.Ye=t,this.We=n,this}}),Fv);function zv(t){return(zv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Gv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=zv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=zv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==zv(t)?t:t+""))(i.key),i)}}function Xv(t,n,e){return n&&Gv(t.prototype,n),e&&Gv(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Fv=Xv(function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.nn=new Map,this.di=[],this.hi=(new Date).getTime(),this.mi=new Map,this.pi=null,this.yi=this.yi.bind(this),this.gi=0,this.bi()}),Yv=(Object.assign(Fv.prototype,{cn:function(t){if(Array.isArray(t)){this.nn.set(t[0].ei,t[0]),t[0].en=this;for(var n=1;n= 1.0 || st.y <= 0.0 || st.y >= 1.0) return vec4(0.0);","p.y -= (seed + time) * scale.w;","p *= scale.xyz;","st.y += sqrt(st.y) * magnitude * turbulence(p);","if(st.y <= 0.0 || st.y >= 1.0) return vec4(0.0);","return texture2D(fireTex, st);","}","vec3 localize(vec3 p) {","return (invModelMatrix * vec4(p, 1.0)).xyz;","}","void main() {","vec3 rayPos = vWorldPos;","vec3 rayDir = normalize(rayPos - cameraPosition);","float rayLen = 0.0288 * length(scale.xyz);","vec4 col = vec4(0.0);","for(int i = 0; i < ITERATIONS; i++) {","rayPos += rayDir * rayLen;","vec3 lp = localize(rayPos);","lp.y += 0.5;","lp.xz *= 2.0;","col += samplerFire(lp, noiseScale);","}","col.a = col.r;","gl_FragColor = col;","}"].join("\n")};function Qv(t){return(Qv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qv(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Qv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Qv(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Qv(t)?t:t+""))(i.key),i)}}function Zv(t,n,e){n=Kv(n);var i=t,n=Jv()?Reflect.construct(n,e||[],Kv(t).constructor):n.apply(t,e);if(!n||"object"!=Qv(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Jv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Jv=function(){return!!t})()}function Kv(t){return(Kv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function $v(t,n){return($v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var td=(()=>{function i(t,n){var e;if(this instanceof i)return e=new R({defines:Wv.defines,uniforms:L.clone(Wv.uniforms),vertexShader:Wv.vertexShader,fragmentShader:Wv.fragmentShader,transparent:!0,depthWrite:!1,depthTest:!0}),t.magFilter=t.minFilter=O,t.wrapS=t.wrapT=q,e.uniforms.fireTex.value=t,e.uniforms.color.value=new N(n),e.uniforms.invModelMatrix.value=new C,e.uniforms.scale.value=new U(1,1,1),e.uniforms.seed.value=19.19*Math.random(),Zv(this,i,[new Hs(1,1,1),e]);throw new TypeError("Cannot call a class as a function")}var t,n=i,e=_;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&$v(n,e),n=i,(e=[{key:"update",value:function(t){var n=this.material.uniforms.invModelMatrix.value;this.updateMatrixWorld(),n.copy(this.matrixWorld.clone().invert()),void 0!==t&&(this.material.uniforms.time.value=t),this.material.uniforms.invModelMatrix.value=n,this.material.uniforms.scale.value=this.scale}}])&&qv(n.prototype,e),t&&qv(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function nd(t){return(t=>{if(Array.isArray(t))return ed(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||((t,n)=>{var e;if(t)return"string"==typeof t?ed(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ed(t,n):void 0})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function ed(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e 0.5 )","vColor = vec4( customColor, customOpacity );","else","vColor = vec4(0.0, 0.0, 0.0, 0.0);","vAngle = customAngle;","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","gl_PointSize = customSize * ( 300.0 / length( mvPosition.xyz ) );","gl_Position = projectionMatrix * mvPosition;","}"].join("\n"),rd=["uniform sampler2D particleTexture;","varying vec4 vColor;","varying float vAngle;","void main()","{","gl_FragColor = vColor;","float c = cos(vAngle);","float s = sin(vAngle);","vec2 rotatedUV = vec2(c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,","c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5);","vec4 rotatedTexture = texture2D( particleTexture, rotatedUV );","gl_FragColor = gl_FragColor * rotatedTexture;","}"].join("\n");function od(t,n){this.times=t||[],this.values=n||[]}function ad(){this.position=new U,this.velocity=new U,this.acceleration=new U,this.angle=0,this.angleVelocity=0,this.angleAcceleration=0,this.size=16,this.color=new N,this.opacity=1,this.age=0,this.alive=0}od.prototype.lerp=function(t){for(var n,e=0,i=this.times.length;ethis.times[e];)e++;return 0==e?this.values[0]:e==i?this.values[i-1]:(n=(t-this.times[e-1])/(this.times[e]-this.times[e-1]),this.values[0]instanceof U?this.values[e-1].clone().lerp(this.values[e],n):this.values[e-1]+n*(this.values[e]-this.values[e-1]))},ad.prototype.update=function(t){this.position.add(this.velocity.clone().multiplyScalar(t)),this.velocity.add(this.acceleration.clone().multiplyScalar(t)),this.angle+=.01745329251*this.angleVelocity*t,this.angleVelocity+=.01745329251*this.angleAcceleration*t,this.age+=t,0(t=((t,n)=>{if("object"!=ld(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ld(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ld(t)?t:t+""))(i.key),i)}}ud.prototype.setValues=function(t){if(void 0!==t){for(var n in this.sizeTween=new od,this.colorTween=new od,this.opacityTween=new od,t)this[n]=t[n];ad.prototype.sizeTween=this.sizeTween,ad.prototype.colorTween=this.colorTween,ad.prototype.opacityTween=this.opacityTween,this.particleArray=[],this.emitterAge=0,this.emitterAlive=!0,this.particleCount=this.particlesPerSecond*Math.min(this.particleDeathAge,this.emitterDeathAge),this.particleGeometry={vertices:[]},this.particleMaterial=new R({uniforms:{particleTexture:{value:this.particleTexture}},vertexShader:id,fragmentShader:rd,blending:1,depthTest:!0,depthWrite:!1,side:2,transparent:!0,opacity:1}),this.particleMesh=new Qi}},ud.prototype.randomValue=function(t,n){return t+n*(Math.random()-.5)},ud.prototype.randomVector3=function(t,n){var e=new U(Math.random()-.5,Math.random()-.5,Math.random()-.5);return(new U).addVectors(t,(new U).multiplyVectors(n,e))},ud.prototype.createParticle=function(){var t,n,e=new ad,i=new U,r=(this.positionStyle==sd.CUBE&&(e.position=this.randomVector3(i,this.positionSpread)),this.positionStyle==sd.SPHERE&&(n=2*Math.random()-1,t=6.2832*Math.random(),r=Math.sqrt(1-n*n),r=new U(r*Math.cos(t),r*Math.sin(t),n),e.position=(new U).addVectors(i,r.multiplyScalar(this.positionRadius))),this.velocityStyle==sd.CUBE&&(e.velocity=this.randomVector3(this.velocityBase,this.velocitySpread)),this.velocityStyle==sd.SPHERE&&(t=(new U).subVectors(e.position,i),n=this.randomValue(this.speedBase,this.speedSpread),e.velocity=t.normalize().multiplyScalar(n)),e.acceleration=this.randomVector3(this.accelerationBase,this.accelerationSpread),e.angle=this.randomValue(this.angleBase,this.angleSpread),e.angleVelocity=this.randomValue(this.angleVelocityBase,this.angleVelocitySpread),e.angleAcceleration=this.randomValue(this.angleAccelerationBase,this.angleAccelerationSpread),e.size=this.randomValue(this.sizeBase,this.sizeSpread),this.randomVector3(this.colorBase,this.colorSpread));return e.color=(new N).setHSL(r.x,r.y,r.z),e.opacity=this.randomValue(this.opacityBase,this.opacitySpread),e.age=0,e.alive=0,e},ud.prototype.initialize=function(){for(var t=[],n=[],e=[],i=[],r=[],o=0;othis.particleDeathAge&&(this.particleArray[s].alive=0,n.push(s)),e.push(this.particleArray[s].alive),i.push.apply(i,nd(this.particleArray[s].color.toArray())),r.push(this.particleArray[s].opacity),o.push(this.particleArray[s].size),a.push(this.particleArray[s].angle));if(this.bufferGeometry.getAttribute("position").copyArray(this.particleGeometry.vertices),this.bufferGeometry.getAttribute("customVisible").copyArray(e),this.bufferGeometry.getAttribute("customColor").copyArray(i),this.bufferGeometry.getAttribute("customOpacity").copyArray(r),this.bufferGeometry.getAttribute("customSize").copyArray(o),this.bufferGeometry.getAttribute("customAngle").copyArray(a),this.bufferGeometry.getAttribute("position").needsUpdate=!0,this.bufferGeometry.getAttribute("customVisible").needsUpdate=!0,this.bufferGeometry.getAttribute("customColor").needsUpdate=!0,this.bufferGeometry.getAttribute("customOpacity").needsUpdate=!0,this.bufferGeometry.getAttribute("customSize").needsUpdate=!0,this.bufferGeometry.getAttribute("customAngle").needsUpdate=!0,this.emitterAlive){if(this.emitterAgethis.particleCount&&(l=this.particleCount);for(s=u;sthis.emitterDeathAge&&(this.emitterAlive=!1)}},ud.prototype.destroy=function(){this.scene.remove(this.particleMesh),this.isShow=!1},ud.prototype.show=function(){this.scene.add(this.particleMesh),this.isShow=!0},ud.prototype.hide=function(){this.scene.remove(this.particleMesh),this.isShow=!1};var fd=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.Ai=t,this.Ei=this.Ai.smokeDensity,void 0===this.Ei&&(this.Ei=30),this.Ti=new Ea,this.Mi=new U(this.Ai.x,this.Ai.y,this.Ai.z),this.Pi=null,this.Oi=null,this.j=null,this.Ni=null,this.Ci="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5wEMBTcTolE0kwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAJKUlEQVRYw41XTW4bRxOtqu6eGXIoSlTiID824I29kK6QhS+Qba5D3UcXyMIL5QBeBRYQBDCMGLAQK/ohRc50d/19C1FG4jjB94DBNAYYvNfVVa+6EP4d6O5wcnKCAEA//PADdl2Hv//+O04mE2zbFgEAHj9+DKrqzOzPnj3zV69e+d3dnb948cIAwAEAENH/leRzH90dT05O8MWLF3R5eUkAEJ4/f07v378Pk8mESim0WCw+/tv3vTOzlVKs6zodhsHm87leXl7ag5B/E/GpAFwul3h8fIw3Nzf0/PnzAADxr4+qBncPs9mMEBHbtnVVtRCCppQ0xijjOEpKSfq+l6urK33z5o29fv3aT05O/iEkfkoOAAQA9M0330QRSW3bNrXWJqXUiEgTQkgxxuDuoWkaVFUXETUzZWZumqYCQK211pxzBQA+OjqSR48eGQCYu//tSOKn5IeHh+HDhw/pq6++alJKbdM0HQBMAKCLMXbu3tZaU9M0wczQ3b2UoiEERsQiIpmIMgCMMcZcay1d19XvvvuOz87O4Ozs7G8i8OHMT09P6eLiIoYQ0t7eXnt4eNi1bTtNKfUhhJ6IenfvRaRT1ZaIQtM0FGM0EVFELDHGHELYuvu2lLLdrYcQQu77vjRNw8+ePRMAsAcBEQDwxx9/pKOjozCbzeLBwUEzmUy6GOMMAPaIaF5rnccY5wAwI6JpjLETkWhmhIjWtq2klLKZDQCwMbN1jLEdxzGmlGgymQAA+DAMfnp66rtNGyJ6XC6XeHFxQfP5PBweHqa2bbsYY9913V6McaGqCwBYiMiBu+8R0Ww6nbZN0yR3pxCCpZQ4hFBEZKOqdyIyyTk3pZTAzDCOo08mE2dme/z4sf3yyy9+cnLiAODx/Pwcv//+e+r7Ps7n86Zt287MZu6+DwCLlNKXZvYlMy/MbH86nfYi0qWUEgCQuxszMwBkANgCwMrMWmYO7g4iYoho4ziKmclqtdInT57YYrEwAMB4dHSEXdeF+XyeiKh192nbtjNVPXD3L0IIX7r7I1U9VNV9EelDCB0AREQkZjYiEjPLRLRl5lZEoruDu7uIKBHxMAy11sohBPnjjz8UAGy5XHoEAAr3iETUhhAmiDiLMc5DCAtm/kJEvjCzQwCY7wS0RBTdnXYJJQBQ3L0VkTiOI4qI1VqFmTMzj2Y25pwzM5emacJ8Ppf3799DfPr0KQFACCFEd29qrZMYY+/ue4g4Tyntxxj3iWi/1rpHRNMQQrsTjH4PUdXGzIKq4s4T6niPjYhs3H3j7ltVjXd3dyGEQMfHxxj7vkcAIBFJZta0bdsy80RV+1rrLMa4F0LYc/eZu/dmNnH3VEqJTdMgALiIiKoGEUEz81IK53tscs49AEyYuXX3RkQSEdHbt28JADB2XYcAQLXWgIjR3RsAaImoM7MJM3fM3JlZa2atqjabzSaFEAjv4eM4krsjABgz8zAMXSmlE5EJInYi0jJzU0qJIYSQc6bZbIa//fYbxtvbW+z7nlJKVGsN4zhGVU0hhISISUQaZk6ImBAxAkBIKYXpdEoAgLtOiMxsZhaZObl7AoAGAFKtNQ3DkMwsqmpgZtpsNnR5eYkAAHG9XmPf98DMGEIgIqJaK9VaSVUJEcndP75TShRjRFXFWiuaGZRSsJRCqkq70iQzIzMjEaFSCjEzmRmpKm63W6i1YowR4nw+dwAAM3NEdEQ0MzN3dzPzh7W7u6o6Ebmq+mazgRCCuzuM4+hm5gDgu+bkqmru7iEETylZztmGYfBhGDylBHd3d75YLCAeHBx4ztmJyJhZ3V2JSHalxSIiiChmJgAgzBxLKSgiAAC4E6kAoO4uZialFAEAiTFy0zRSaxVE1JyzmpmVUrxt2/tekHP2cRyt73s1M2FmRsRqZtnMMgBkIspEVEQk1VqDmcFut+juTkRKRFxrrSJSHv4DgOzuuZRSa62ccxZV1RCC3d7e+rt37zxut1sHAB3HUUMI1cyKiIwiMqjq1sy2ZjZt27aJMZKqgt4jqiruupqYWc05DyKyRcRtjHELAFsRGURkLKUURKzjOKqZ6Z9//ulPnjzx2Pe9XVxc2HQ65RBCdfdRVQdm3tRa10Q0JaJGVcMuV0xVW2aOiIi73BAAKGa2VdU1AKzcfWVm61rrZr1eD8w8MnMVEWZmOzg4sNPTU4g3Nzdea30494qIIwBsRGTFzB0iNuG+PMDMNOdcc86d+72N75qREFFGxC0irojoWlWv3f3WzFallE3OeSyl1BCC5Jz1+vraAMDjYrGwpml0vV5zCKHslG5KKY27p53fwy7JSq11lnPuaq3p4T4gIgwAOaW0MbM1AFwDwJ8ppWtmXonIhpnHnHMxM6616mw2u2/Hr1+/9m+//Vavr69lPp9XZh5rrVFVw44AhmEwM6vuPuwsuttZNzGzMTMTUQ4hbAFgTUS3KaVrRLxW1dXOkkcRqU3TyGaz0VevXhkAQDg7O4M3b97Ar7/+ikQEIgLu95cWRHQRMXeXnb9XZs6llNHdN6p6V0pZ1VpXqnpTa72utV6p6jUi3gDALTOvh2HYllLGYRhKCEG+/vprPT8/v48AIvpyufTDw0MFAByGocQY0cyg6zoDAEkplV0236nqhIgaZk4AgETkMUZW1Wpm465qNma2EZFNjHEAgJGICgDIOI76008/+ceh5TNX8jgMQ1LVdm9vrwOAbrvdTt19sl6vO2buVDU9+DoRmYioiLCq5lJKDiGMKaUhxpiZORNRWa1WDADy888/P0xMfxPwcRoCAHr79m18+vRp7LourdfrxszacRzbYRgaZk4iklSVttstIqLbPXgcR1bVqqpFREpKqYYQGADkc+T/mIz+KuIhGruGFVU13d7exs1mEwEgMDON44jM7KpqqqrDMIiqyi7TZX9/X8ZxlEePHtnnyD+djD4OC8vl0o6Pj/3ly5fetq0eHh7Ku3fveLVahaZpaBxHurq6IgCA7XYLKSUbx9G22611Xafr9Vr7vlcAsPPz878S+/81nP41GsfHx/jy5Uu6ubnBDx8+0N7eHpVSsNaKl5eXAABwdXXlROQXFxcGAA+E/0n82Qh8Jhq+E+nL5RIAAD98+ICbzQYBAM7Pz/+m+ROy/yR+wP8AibG5JpmwKwsAAAAASUVORK5CYII="}return t=n,(e=[{key:"init",value:function(t){var n=this;this.j=t,(new Mi).load(this.Ci,function(t){n.Oi=t,n.createSmoke()})}},{key:"createSmoke",value:function(){this.Pi&&this.Pi.destroy(),this.Ni=(new Date).getTime(),this.Pi=new ud(this.j);var t=this.Ei;1===t&&(t=2),this.Pi.setValues({positionStyle:sd.SPHERE,positionBase:this.Mi,positionRadius:3,velocityStyle:sd.CUBE,velocityBase:new U(0,20,0),velocitySpread:new U(8,15,8),accelerationBase:new U(0,-10,0),particleTexture:this.Oi,angleBase:0,angleSpread:720,angleVelocityBase:0,angleVelocitySpread:720,sizeTween:new od([0,.8,1.5],[10,80,50]),opacityTween:new od([0,.4,1.5],[0,.9,0]),colorTween:new od([.3,1.2],[new U(0,0,.6),new U(0,0,.3)]),worldEffectTween:new od([.5,1.5],[new U(0,0,0),new U(-1,0,-.2)]),particlesPerSecond:t,particleDeathAge:t,emitterDeathAge:60}),this.Pi.initialize(),this.Pi.particleMesh.renderOrder=1,this.Pi.particleMesh.isNoPickup=!0}},{key:"update",value:function(){var t=this.Ti.getDelta();((new Date).getTime()-this.Ni)/1e3<60?this.Pi&&this.Pi.update(.5*t):this.j&&this.Mi&&this.createSmoke()}}])&&cd(t.prototype,e),i&&cd(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();function hd(t){return(hd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vd(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=hd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=hd(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==hd(t)?t:t+""))(i.key),i)}}var Fv=(()=>{function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.Li={x:Number.MAX_VALUE,y:Number.MAX_VALUE},this.Ri={x:-Number.MAX_VALUE,y:-Number.MAX_VALUE}}return n=t,(e=[{key:"min",get:function(){return this.Li}},{key:"max",get:function(){return this.Ri}},{key:"center",get:function(){var t={x:Number.NaN,y:Number.NaN};return this.valid()&&(t.x=(this.min.x+this.max.x)/2,t.y=(this.min.y+this.max.y)/2),t}},{key:"size",get:function(){var t={x:Number.NaN,y:Number.NaN};return this.valid()&&(t.x=this.max.x-this.min.x,t.y=this.max.y-this.min.y),t}},{key:"copy",value:function(t){return this.Ri.x=t.max.x,this.Ri.y=t.max.y,this.Li.x=t.min.x,this.Li.y=t.min.y,this}},{key:"clone",value:function(){return(new t).copy(this)}},{key:"reset",value:function(){this.Li={x:Number.MAX_VALUE,y:Number.MAX_VALUE},this.Ri={x:-Number.MAX_VALUE,y:-Number.MAX_VALUE}}},{key:"toObject",value:function(){return{min:this.min,max:this.max,center:this.center,size:this.size}}},{key:"expand",value:function(t){this.Di(t)}},{key:"expandByCoords",value:function(t){this.Fi(t)}},{key:"valid",value:function(){return this.Ii()}},{key:"isCross",value:function(t){var n=!0;return t.max.xthis.max.x&&(n=!1),t.max.ythis.max.y?!1:n}}])&&vd(n.prototype,e),i&&vd(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,e,i})(),dd=(Object.assign(Fv.prototype,{Ii:function(){return!(this.min.x>this.max.x||this.min.y>this.max.y)},Di:function(t){t&&t.valid()&&(t.min.xthis.max.x&&(this.max.x=t.max.x),t.max.y>this.max.y)&&(this.max.y=t.max.y)},Fi:function(t){var n=this;t&&0!=t.length&&t.forEach(function(t){t.xn.max.x&&(n.max.x=t.x),t.y>n.max.y&&(n.max.y=t.y)})}}),Fv);function md(t){return(md="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function pd(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=md(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=md(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==md(t)?t:t+""))(i.key),i)}}Fv=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.Ai=t,this.en=null,this.I=null,this.T=this.Ai.x,this.M=this.Ai.y,this.F=this.Ai.height,void 0===this.F&&(this.F=0),this.ki=null,this.ji=null,this.Ui=null,this.Bi=null,this.Hi=new Yv,this.Vi=new Ea,this.zi=4,this.Gi=9.5,this.Xi=!0,this.Yi=null,void 0!==this.Ai.flameSize&&(this.Gi=this.Ai.flameSize),this.Wi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAgCAYAAAAbifjMAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5wEMBgInI5K8yQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAClUlEQVRIx5WVXW7bQAyEv11xJcuyY7QP7RXy0Jv3QjlEgaZJHHn/+8AV5ChNmgggYMDLITkz3DWT42cu3MYCpULlU9+dnEZuQ+bHJULIEPPnQOT7EeYET15jDgr0URD5doJLhN0MYsEawH8cRI4TjAl6B65TgFqheIjlAwDSQdeBvUrOBVKBEiD/pw3JHXSAszChySFrpAyX9P4oUioYC8aAczCNcErgI4TUAN8ZRULS2TurMTg4jgrgk3ZRAqQ32pDZQxZwoiqIgbGH0wghKkCuMMd/8yGPz5q8c9ALDI2TaYC0V4CU1aWXCNtp5P7cABrI2MNoFeQwaHIsWr0U8Bt/yONZJewbwNRDdLAXVeYwqL1jWse59oc8ebBWo+/AOwg9lEGTpYPjThUJSzdhHUV8bDICwUKMSl7JQFUu+gbyHJWHmFTaCkiuQFa0VFqbLdmgne2NcnQY4OxVkbgA1AqYRkxVtheWOqPVxSrReweja6MmPWvhJasViFUPnIOuuI/6Ry8NoHnGABajNmYDkipc8jp3LmqyoanTtRy75G4wKI2TkFT7XPSwsxrWLB288VV0xlSbEwuYqpVt69oAdiGtvgNU60ryos7S8SsSrz/TlOisHqzNzrWsoPatZIsy3Tebi9HEnNttVTYkbpOdhV0Hk8DYNrQkdWnM6xsivVEj1k3lUeCmh2MPewu2qJzzclO1BJlcW9VlOZrWhwZw46A3kJuxnqPuQV46+DqsAEv1pfW9wGB0sc4BHjw8tRcsLwW/9Fesm+Z7s7otJH25fnu4j/o7XckuYnTjzIbR5Z2cM5wjPCQ4tzXO1zfSH6+XxqJ7rasDQ7vCLgkuBXyBtPGN/Jq56+y6UC8sXHQHYtUor0139xfT44J2OsN7dwAAAABJRU5ErkJggg==",this.An=this.An.bind(this)}return t=n,(e=[{key:"addTo",value:function(t){fengmap.FMMarkerFun.LAYER_CLASS.get(T.FIRE_MARKER)||fengmap.FMMarkerFun.LAYER_CLASS.set(T.FIRE_MARKER,Dv),this.G(t)}},{key:"remove",value:function(){this.en&&(this.stop(),this.en.scene.remove(this.ki),this.ji.Pi.destroy(),this.ji.Pi.particleMesh.geometry.dispose(),this.ji.Pi.particleMesh.material=void 0,this.ji.Pi.particleMesh.geometry=void 0,this.ji.Pi.particleMesh=void 0,this.ki.geometry.dispose(),this.ki.material.dispose(),this.ki.geometry=void 0,this.ki=void 0,this.I.off("update",this.An))}},{key:"stop",value:function(){this.Ui&&(this.Hi.vn(this.Ui),this.Ui=null)}},{key:"moveTo",value:function(t){var n=this,e=t.duration||.5;t.animate?(this.Ui||(this.Ui=new Vv),this.Ui.ri([this.T,this.M]),this.Ui.oi([t.x,t.y]),this.Ui.ai(e).si(function(t){n.T=t.destination[0],n.M=t.destination[1],n.Qi()}).ui(function(){n.T=t.x,n.M=t.y,n.Qi(),t.finish&&t.finish()}),this.Hi.cn(this.Ui.ii())):(this.T=t.x,this.M=t.y,this.Qi())}},{key:"x",get:function(){return this.T}},{key:"y",get:function(){return this.M}},{key:"height",get:function(){return this.F},set:function(t){this.F=t,this.ki.position.y=this.F+2.5,this.ji.Pi.particleMesh.position.y=this.F+2.5,this.ji.Mi.y=this.F+2.5,this.ji.Pi.positionBase.y=this.F+2.5,this.I.enableUpdateRender()}},{key:"flameSize",get:function(){return this.Gi},set:function(t){this.Gi=t,this.ki.material.uniforms.magnitude.value=10-t,this.I.enableUpdateRender()}},{key:"smokeDensity",get:function(){return void 0===this.Ai.smokeDensity?30:this.Ai.smokeDensity},set:function(t){this.Ai.smokeDensity=t,this.ji.Ei=t,this.ji.createSmoke(),this.I.enableUpdateRender()}},{key:"level",get:function(){return this.Bi}},{key:"type",get:function(){return T.FIRE_MARKER}},{key:"visible",get:function(){return this.Xi},set:function(t){this.Xi!==t&&(this.Xi=t,(this.ki.visible=t)?this.ji.createSmoke():this.ji.Pi.destroy())}},{key:"bound",get:function(){return null===this.Yi&&(this.Yi=new dd,void 0!==this.T)&&void 0!==this.M&&this.Yi.expandByCoords([{x:this.T,y:this.M}]),this.Yi.clone()}}])&&pd(t.prototype,e),i&&pd(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})(),Object.assign(Fv.prototype,{G:function(t){var n=this,t=(this.I=t.parent.parent,this.Bi=t.level,t.getOrCreateLayer(T.FIRE_MARKER));this.en=t;(new Mi).load(this.Wi,function(t){n.ki=new td(t),n.ki.material.uniforms.magnitude.value=10-n.Gi,n.ki.position.set(n.T-n.I.x,n.F+2.5,-n.M+n.I.y),n.ki.scale.set(4,5,4),n.en.scene.add(n.ki),n.ki.isNoPickup=!0});t={x:this.T-this.I.x,y:this.F+2.5,z:-this.M+this.I.y,smokeDensity:this.Ai.smokeDensity};this.ji=new fd(t),this.ji.init(this.en.scene),this.I.on("update",this.An)},An:function(){var t=this.Vi.getElapsedTime()*this.zi;null!==this.ki&&this.ki.update(t),this.ji.update(),this.I.enableUpdateRender()},Qi:function(){this.ki.position.x=this.T-this.I.x,this.ki.position.z=-this.M+this.I.y,this.ji.Pi.particleMesh.position.x=this.T-this.I.x,this.ji.Pi.particleMesh.position.z=-this.M+this.I.y,this.ji.Mi.x=this.T-this.I.x,this.ji.Mi.z=-this.M+this.I.y,this.ji.Pi.positionBase.x=this.T-this.I.x,this.ji.Pi.positionBase.z=-this.M+this.I.y,this.I.enableUpdateRender()}});function yd(t){return(yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gd(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=yd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=yd(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==yd(t)?t:t+""))(i.key),i)}}function bd(t,n,e){n=wd(n);var i=t,n=_d()?Reflect.construct(n,e||[],wd(t).constructor):n.apply(t,e);if(!n||"object"!=yd(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function _d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_d=function(){return!!t})()}function wd(t){return(wd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Sd(t,n){return(Sd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var xd=(()=>{function c(t,n,e,i,r,o,a,s,u,l){if(this instanceof c)return(t=bd(this,c,[t=void 0!==t?t:[],n=void 0!==n?n:301,e,i,r,o,a,s,u,l])).isCubeTexture=!0,t.flipY=!1,t;throw new TypeError("Cannot call a class as a function")}var t,n=c,e=_i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Sd(n,e),n=c,(e=[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}])&&gd(n.prototype,e),t&&gd(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function Ad(t){return(Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ed(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Ad(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ad(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ad(t)?t:t+""))(i.key),i)}}function Td(t,n,e){n=Pd(n);var i=t,n=Md()?Reflect.construct(n,e||[],Pd(t).constructor):n.apply(t,e);if(!n||"object"!=Ad(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Md(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Md=function(){return!!t})()}function Pd(t){return(Pd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Od(t,n){return(Od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Nd=(()=>{function n(t){if(this instanceof n)return Td(this,n,[t]);throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Od(e,i),e=n,(i=[{key:"load",value:function(t,e,n,i){var r=new xd,o=(r.colorSpace="srgb",new ri(this.manager)),a=(o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),0);for(var s=0;s{o.load(t[n],function(t){r.images[n]=t,6===++a&&(r.needsUpdate=!0,e)&&e(r)},void 0,i)})(s);return r}}])&&Ed(e.prototype,i),t&&Ed(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e})();function Cd(t){return(Cd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ld(t,n){var e,i,r,o,a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return r=!(i=!0),{s:function(){a=a.call(t)},n:function(){var t=a.next();return i=t.done,t},e:function(t){r=!0,e=t},f:function(){try{i||null==a.return||a.return()}finally{if(r)throw e}}};if(Array.isArray(t)||(a=Dd(t))||n&&t&&"number"==typeof t.length)return a&&(t=a),o=0,{s:n=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Rd(t,n){return(t=>{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,r,o,a,s=[],u=!0,l=!1;try{if(o=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;u=!1}else for(;!(u=(i=o.call(e)).done)&&(s.push(i.value),s.length!==n);u=!0);}catch(t){l=!0,r=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}})(t,n)||Dd(t,n)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function Dd(t,n){var e;if(t)return"string"==typeof t?Fd(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Fd(t,n):void 0}function Fd(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=Cd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Cd(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Cd(t)?t:t+""))(i.key),i)}}function kd(t,n,e){n=Ud(n);var i=t,n=jd()?Reflect.construct(n,e||[],Ud(t).constructor):n.apply(t,e);if(!n||"object"!=Cd(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function jd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(jd=function(){return!!t})()}function Ud(t){return(Ud=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Bd(t,n){return(Bd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Hd=(()=>{function r(t,n,e){var i;if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");(i=kd(this,r)).type="CubeCamera",i.renderTarget=e,i.coordinateSystem=null,i.activeMipmapLevel=0;e=new Au(-90,1,t,n),e.layers=i.layers,i.add(e),e=new Au(-90,1,t,n),e.layers=i.layers,i.add(e),e=new Au(-90,1,t,n),e.layers=i.layers,i.add(e),e=new Au(-90,1,t,n),e.layers=i.layers,i.add(e),e=new Au(-90,1,t,n),e.layers=i.layers,i.add(e),e=new Au(-90,1,t,n);return e.layers=i.layers,i.add(e),i}var t,n=r,e=Me;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Bd(n,e),n=r,(e=[{key:"updateCoordinateSystem",value:function(){var t,n=this.coordinateSystem,e=this.children.concat(),i=Rd(e,6),r=i[0],o=i[1],a=i[2],s=i[3],u=i[4],i=i[5],l=Ld(e);try{for(l.s();!(t=l.n()).done;){var c=t.value;this.remove(c)}}catch(t){l.e(t)}finally{l.f()}if(2e3===n)r.up.set(0,1,0),r.lookAt(1,0,0),o.up.set(0,1,0),o.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),i.up.set(0,1,0);else{if(2001!==n)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+n);r.up.set(0,-1,0),r.lookAt(-1,0,0),o.up.set(0,-1,0),o.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),i.up.set(0,-1,0)}i.lookAt(0,0,-1);var f,h=Ld(e);try{for(h.s();!(f=h.n()).done;){var v=f.value;this.add(v),v.updateMatrixWorld()}}catch(t){h.e(t)}finally{h.f()}}},{key:"update",value:function(t,n){null===this.parent&&this.updateMatrixWorld();var e=this.renderTarget,i=this.activeMipmapLevel,r=(this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem()),Rd(this.children,6)),o=r[0],a=r[1],s=r[2],u=r[3],l=r[4],r=r[5],c=t.getRenderTarget(),f=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),v=t.xr.enabled,d=(t.xr.enabled=!1,e.texture.generateMipmaps);e.texture.generateMipmaps=!1,t.setRenderTarget(e,0,i),t.render(n,o),t.setRenderTarget(e,1,i),t.render(n,a),t.setRenderTarget(e,2,i),t.render(n,s),t.setRenderTarget(e,3,i),t.render(n,u),t.setRenderTarget(e,4,i),t.render(n,l),e.texture.generateMipmaps=d,t.setRenderTarget(e,5,i),t.render(n,r),t.setRenderTarget(c,f,h),t.xr.enabled=v,e.texture.needsPMREMUpdate=!0}}])&&Id(n.prototype,e),t&&Id(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function Vd(t){return(Vd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zd(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Vd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Vd(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Vd(t)?t:t+""))(i.key),i)}}function Gd(t,n,e){n=Yd(n);var i=t,n=Xd()?Reflect.construct(n,e||[],Yd(t).constructor):n.apply(t,e);if(!n||"object"!=Vd(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Xd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xd=function(){return!!t})()}function Yd(t){return(Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Wd(t,n){return(Wd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Qd=(()=>{function r(){var t=0\n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",o=new Hs(5,5,5),e=new R({name:"CubemapFromEquirect",uniforms:Io(e),vertexShader:i,fragmentShader:r,side:W,blending:0}),i=(e.uniforms.tEquirect.value=n,new _(o,e)),r=n.minFilter;return 1008===n.minFilter&&(n.minFilter=O),new Hd(1,10,this).update(t,i),n.minFilter=r,i.geometry.dispose(),i.material.dispose(),this}},{key:"clear",value:function(t,n,e,i){for(var r=t.getRenderTarget(),o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(n,e,i);t.setRenderTarget(r)}}])&&zd(n.prototype,e),t&&zd(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function qd(t){return(qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Zd(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=qd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=qd(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==qd(t)?t:t+""))(i.key),i)}}var Jd=[.125,.215,.35,.446,.526,.582],Kd=new n,$d=new N,tm=null,nm=0,em=0,im=!1,n=(1+Math.sqrt(5))/2,rm=1/n,om=[new U(-n,rm,0),new U(n,rm,0),new U(-rm,0,n),new U(rm,0,n),new U(0,n,-rm),new U(0,n,rm),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)],am=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.qi=t,this.Zi=null,this.Ji=0,this.Ki=0,this.$i=[],this.tr=[],this.nr=[],this.er=null,this.ir=null,this.rr=null,this._compileMaterial(this.er)}return t=n,(e=[{key:"fromScene",value:function(t){var n=1{for(var n=[],e=[],i=[],r=t,o=t-4+1+Jd.length,a=0;a\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1}))),o}},{key:"_compileMaterial",value:function(t){t=new _(this.$i[0],t);this.qi.compile(t,Kd)}},{key:"_sceneToCubeUV",value:function(t,n,e,i){var r=new Au(90,1,n,e),o=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],s=this.qi,n=s.autoClear,e=s.toneMapping,u=(s.getClearColor($d),s.toneMapping=0,s.autoClear=!1,new b({name:"PMREM.Background",side:W,depthWrite:!1,depthTest:!1})),l=new _(new Hs,u),c=!1,f=t.background;f?f.isColor&&(u.color.copy(f),c=!(t.background=null)):(u.color.copy($d),c=!0);for(var h=0;h<6;h++){var v=h%3,d=(0==v?(r.up.set(0,o[h],0),r.lookAt(a[h],0,0)):1==v?(r.up.set(0,0,o[h]),r.lookAt(0,a[h],0)):(r.up.set(0,o[h],0),r.lookAt(0,0,a[h])),this.Ki);um(i,v*d,2\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function cm(){return new R({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:fm(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function fm(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}var hm={basic:{uniforms:d([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.fog]),vertexShader:I.meshbasic_vert,fragmentShader:I.meshbasic_frag},lambert:{uniforms:d([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new N(0)}}]),vertexShader:I.meshlambert_vert,fragmentShader:I.meshlambert_frag},phong:{uniforms:d([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new N(0)},specular:{value:new N(1118481)},shininess:{value:30}}]),vertexShader:I.meshphong_vert,fragmentShader:I.meshphong_frag},standard:{uniforms:d([F.common,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.roughnessmap,F.metalnessmap,F.fog,F.lights,{emissive:{value:new N(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:I.meshphysical_vert,fragmentShader:I.meshphysical_frag},toon:{uniforms:d([F.common,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.gradientmap,F.fog,F.lights,{emissive:{value:new N(0)}}]),vertexShader:I.meshtoon_vert,fragmentShader:I.meshtoon_frag},matcap:{uniforms:d([F.common,F.bumpmap,F.normalmap,F.displacementmap,F.fog,{matcap:{value:null}}]),vertexShader:I.meshmatcap_vert,fragmentShader:I.meshmatcap_frag},points:{uniforms:d([F.points,F.fog]),vertexShader:I.points_vert,fragmentShader:I.points_frag},dashed:{uniforms:d([F.common,F.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:I.linedashed_vert,fragmentShader:I.linedashed_frag},depth:{uniforms:d([F.common,F.displacementmap]),vertexShader:I.depth_vert,fragmentShader:I.depth_frag},normal:{uniforms:d([F.common,F.bumpmap,F.normalmap,F.displacementmap,{opacity:{value:1}}]),vertexShader:I.meshnormal_vert,fragmentShader:I.meshnormal_frag},sprite:{uniforms:d([F.sprite,F.fog]),vertexShader:I.sprite_vert,fragmentShader:I.sprite_frag},background:{uniforms:{uvTransform:{value:new v},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:I.background_vert,fragmentShader:I.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new v}},vertexShader:I.backgroundCube_vert,fragmentShader:I.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:I.cube_vert,fragmentShader:I.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:I.equirect_vert,fragmentShader:I.equirect_frag},distanceRGBA:{uniforms:d([F.common,F.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:I.distanceRGBA_vert,fragmentShader:I.distanceRGBA_frag},shadow:{uniforms:d([F.lights,F.fog,{color:{value:new N(0)},opacity:{value:1}}]),vertexShader:I.shadow_vert,fragmentShader:I.shadow_frag}};function vm(t){return(vm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function dm(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=vm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=vm(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==vm(t)?t:t+""))(i.key),i)}}hm.physical={uniforms:d([hm.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new v},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new v},clearcoatNormalScale:{value:new B(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new v},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new v},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new v},sheen:{value:0},sheenColor:{value:new N(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new v},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new v},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new v},transmissionSamplerSize:{value:new B},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new v},attenuationDistance:{value:0},attenuationColor:{value:new N(0)},specularColor:{value:new N(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new v},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new v},anisotropyVector:{value:new B},anisotropyMap:{value:null},anisotropyMapTransform:{value:new v}}]),vertexShader:I.meshphysical_vert,fragmentShader:I.meshphysical_frag},hm.fmStandard={uniforms:d([hm.standard.uniforms,{sweepW:{value:0},sweepH:{value:0},se2N:{value:new B(0,0)},se2RN:{value:new B(0,0)},moveP:{value:new B(0,0)},color_r:{value:new N(16711935)},color_a:{value:new N(16776960)},isRect:{value:!1},isAnnulus:{value:!1},isEnable:{value:!1},circleC:{value:new B(0,0)},maxR:{value:0},minR:{value:0},isSweepTexture:{value:!1},sweepTexture:{value:null},sweepStrength:{value:1}},{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskOpacity:{value:null}},{maskNodeHeight:{value:0}}]),vertexShader:I.fmMeshphysical_vert,fragmentShader:I.fmMeshphysical_frag},hm.fmLambert={uniforms:d([hm.lambert.uniforms,{mapMixColor:{value:!1}},{heatCenter:{value:new B(0,0)}},{heatSize:{value:new B(0,0)}},{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskOpacity:{value:null}},{maskNodeHeight:{value:0}},{isJsonModel:{value:!1}}]),vertexShader:I.fmMeshlambert_vert,fragmentShader:I.fmMeshlambert_frag},hm.fmbasic={uniforms:d([hm.basic.uniforms,{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskNodeHeight:{value:0}},{maskOpacity:{value:null}}]),vertexShader:I.fmMeshBasic_vert,fragmentShader:I.fmMeshBasic_frag};var mm=(()=>{function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var t=Io(hm.backgroundCube.uniforms);t.exposure={value:1},t.opacity={value:1},t.renderType={value:2},t.renderOutType={value:1},t.projectionMatrixFixZoom={value:[]},this.boxMesh=new _(new Hs(1,1,1),new R({type:"BackgroundCubeMaterial",uniforms:t,vertexShader:"\n varying vec3 vWorldDirection;\n #include \n // 固定zoom的缩放,仅用于正交相机\n uniform mat4 projectionMatrixFixZoom;\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include \n #include \n\n if (isPerspectiveMatrix(projectionMatrix)) {\n gl_Position = projectionMatrix * mvPosition;\n } else {\n gl_Position = projectionMatrixFixZoom * mvPosition;\n }\n gl_Position.z = gl_Position.w; // set z to camera.far\n }",fragmentShader:"\n \n #ifdef ENVMAP_TYPE_CUBE\n\n uniform samplerCube envMap;\n\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n\n uniform sampler2D envMap;\n\n #endif\n\n uniform float flipEnvMap;\n uniform float backgroundBlurriness;\n uniform float backgroundIntensity;\n uniform mat3 backgroundRotation;\n\n\n uniform float opacity;\n uniform float exposure;\n uniform float renderType;\n uniform float renderOutType;\n varying vec3 vWorldDirection;\n #include \n void main() {\n \n #ifdef ENVMAP_TYPE_CUBE\n\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\n #else\n\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n #endif\n\n texColor.rgb *= backgroundIntensity;\n\n gl_FragColor = texColor;\n\n gl_FragColor.a *= opacity;\n if(renderType==1.0){\n gl_FragColor.rgb=exposure*gl_FragColor.rgb;\n } else if(renderType==2.0){\n gl_FragColor.rgb=exposure*gl_FragColor.rgb;\n saturate( ( gl_FragColor * ( 2.51 * gl_FragColor + 0.03 ) ) / ( gl_FragColor * ( 2.43 * gl_FragColor + 0.59 ) + 0.14 ) );\n }\n if(renderOutType==1.0){\n gl_FragColor=vec4( mix( pow( gl_FragColor.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), gl_FragColor.rgb * 12.92, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.0031308 ) ) ) ), gl_FragColor.a );\n }\n }",side:W,depthTest:!1,depthWrite:!1,fog:!1})),this.boxMesh.frustumCulled=!1,this.boxMesh.geometry.deleteAttribute("normal"),this.boxMesh.geometry.deleteAttribute("uv"),this.boxMesh.onBeforeRender=function(t,n,e){this.matrixWorld.copyPosition(e.matrixWorld)},Object.defineProperty(this.boxMesh.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),this.tempMatix=new C}return t=n,(e=[{key:"setTexture",value:function(t){this.boxMesh.material.uniforms.envMap.value=t,this.boxMesh.material.uniforms.flipEnvMap.value=t.isCubeTexture?-1:1,this.boxMesh.material.needsUpdate=!0,this.ft=t}},{key:"setOrthographicScale",value:function(t,n){var e;"OrthographicCamera"===t.type&&(e=t.zoom,t.zoom=n,t.updateProjectionMatrix(),this.tempMatix.copy(t.projectionMatrix),this.boxMesh.material.uniforms.projectionMatrixFixZoom.value=this.tempMatix,t.zoom=e,t.updateProjectionMatrix())}}])&&dm(t.prototype,e),i&&dm(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();function pm(t){return(pm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ym(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=pm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=pm(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==pm(t)?t:t+""))(i.key),i)}}function gm(t,n,e){n=_m(n);var i=t,n=bm()?Reflect.construct(n,e||[],_m(t).constructor):n.apply(t,e);if(!n||"object"!=pm(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function bm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(bm=function(){return!!t})()}function _m(t){return(_m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function wm(t,n){return(wm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}Object.assign(mm.prototype,{mn:function(){this.tempMatix=null,this.boxMesh&&(this.boxMesh.geometry.dispose(),this.boxMesh.material.dispose(),this.ft&&this.ft.dispose(),this.boxMesh=null)}});var Sm={},xm=(()=>{function n(t){if(this instanceof n)return gm(this,n,[t]);throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&wm(e,i),e=n,(i=[{key:"load",value:function(a,t,n,e){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a),a=this.manager.resolveURL(a);var s=this,i=ze.get(a);if(void 0!==i)return setTimeout(function(){t&&t(i)},0),i;if(void 0===Sm[a]){var r=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){var o=r[1],u=!!r[2],l=r[3],l=decodeURIComponent(l);u&&(l=atob(l));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":for(var f=new Uint8Array(l.length),h=0;h(t=((t,n)=>{if("object"!=Am(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Am(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Am(t)?t:t+""))(i.key),i)}}function Tm(t,n,e){n=Pm(n);var i=t,n=Mm()?Reflect.construct(n,e||[],Pm(t).constructor):n.apply(t,e);if(!n||"object"!=Am(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Mm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mm=function(){return!!t})()}function Pm(t){return(Pm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Om(t,n){return(Om=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Nm=(()=>{function d(){var t=0(t=((t,n)=>{if("object"!=Cm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Cm(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Cm(t)?t:t+""))(i.key),i)}}function Rm(t,n,e){n=Fm(n);var i=t,n=Dm()?Reflect.construct(n,e||[],Fm(t).constructor):n.apply(t,e);if(!n||"object"!=Cm(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Dm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Dm=function(){return!!t})()}function Fm(t){return(Fm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Im(t,n){return(Im=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var km=(()=>{function n(t){if(this instanceof n)return Rm(this,n,[t]);throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Im(e,i),e=n,(i=[{key:"load",value:function(t,e,n,i){var r=this,o=new Nm,a=new xm(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(t){var n;try{n=r.parse(t)}catch(t){if(void 0===i)return void console.error(t);i(t)}void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:q,o.wrapT=void 0!==n.wrapT?n.wrapT:q,o.magFilter=void 0!==n.magFilter?n.magFilter:O,o.minFilter=void 0!==n.minFilter?n.minFilter:O,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(o.colorSpace=n.colorSpace),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=1008),1===n.mipmapCount&&(o.minFilter=O),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,e&&e(o,n)},n,i),o}}])&&Lm(e.prototype,i),t&&Lm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e})();function jm(t){return(jm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Um(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=jm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=jm(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==jm(t)?t:t+""))(i.key),i)}}function Bm(t,n,e){n=zm(n);var i=t,n=Hm()?Reflect.construct(n,e||[],zm(t).constructor):n.apply(t,e);if(!n||"object"!=jm(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Hm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hm=function(){return!!t})()}function Vm(){return(Vm="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var i=((t,n)=>{for(;!{}.hasOwnProperty.call(t,n)&&null!==(t=zm(t)););return t})(t,n);if(i)return(i=Object.getOwnPropertyDescriptor(i,n)).get?i.get.call(arguments.length<3?t:e):i.value}).apply(null,arguments)}function zm(t){return(zm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Gm(t,n){return(Gm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Xm=(()=>{function l(t){if(this instanceof l)return(t=Bm(this,l,[t])).type=Z,t;throw new TypeError("Cannot call a class as a function")}var t,n=l,e=km;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Gm(n,e),n=l,(e=[{key:"parse",value:function(t){var n,e,i,r,o,a,s,u,l,c,f,h,b=1,v=2,_=3,w=4,S=function(t,n){switch(t){case b:throw new Error("THREE.RGBELoader: Read Error: "+(n||""));case v:throw new Error("THREE.RGBELoader: Write Error: "+(n||""));case _:throw new Error("THREE.RGBELoader: Bad File Format: "+(n||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(n||""))}},d=1,m=2,p=4,y="\n",g=function(t,n,e){n=n||1024;for(var i=t.pos,r=-1,o=0,a="",s=String.fromCharCode.apply(null,new Uint16Array(t.subarray(i,i+128)));(r=s.indexOf(y))<0&&o{var n,e,i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((t.pos>=t.byteLength||!(n=g(t)))&&S(b,"no header found"),(e=n.match(/^#\?(\S+)/))||S(_,"bad initial token"),s.valid|=d,s.programtype=e[1],s.string+=n+"\n";;){if(!1===(n=g(t)))break;if(s.string+=n+"\n","#"===n.charAt(0))s.comments+=n+"\n";else if((e=n.match(i))&&(s.gamma=parseFloat(e[1])),(e=n.match(r))&&(s.exposure=parseFloat(e[1])),(e=n.match(o))&&(s.valid|=m,s.format=e[1]),(e=n.match(a))&&(s.valid|=p,s.height=parseInt(e[1],10),s.width=parseInt(e[2],10)),s.valid&m&&s.valid&p)break}return s.valid&m||S(_,"missing format specifier"),s.valid&p||S(_,"missing image size specifier"),s})(t)),A=x.width,E=x.height,T=((t,n,e)=>{var i=n;if(i<8||32767t.byteLength&&S(b),u[0]=t[a++],u[1]=t[a++],u[2]=t[a++],u[3]=t[a++],2==u[0]&&2==u[1]&&(u[2]<<8|u[3])==i||S(_,"bad rgbe scanline format");for(var f=0,h=void 0;f(t=((t,n)=>{if("object"!=Ym(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Ym(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Ym(t)?t:t+""))(i.key),i)}}function Qm(t,n,e){n=Zm(n);var i=t,n=qm()?Reflect.construct(n,e||[],Zm(t).constructor):n.apply(t,e);if(!n||"object"!=Ym(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function qm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qm=function(){return!!t})()}function Zm(t){return(Zm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Jm(t,n){return(Jm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Km=(()=>{function n(t){if(this instanceof n)return(t=Qm(this,n,[t])).hdrLoader=new Xm,t.type=Z,t;throw new TypeError("Cannot call a class as a function")}var t,e=n,i=Ze;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");return e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&Jm(e,i),e=n,(i=[{key:"load",value:function(r,t,n,e){var o=new xd;switch(o.type=this.type,o.type){case FloatType:case Z:o.colorSpace=K,o.minFilter=O,o.magFilter=O,o.generateMipmaps=!1}var a=this,s=0;for(var i=0;i{new xm(a.manager).setPath(a.path).setResponseType("arraybuffer").setWithCredentials(a.withCredentials).load(r[n],function(t){s++;var t=a.hdrLoader.parse(t);t&&(void 0!==t.data&&((t=new Nm(t.data,t.width,t.height)).type=o.type,t.colorSpace=o.colorSpace,t.format=o.format,t.minFilter=o.minFilter,t.magFilter=o.magFilter,t.generateMipmaps=o.generateMipmaps,o.images[n]=t),6===s)&&(o.needsUpdate=!0,e)&&e(o)},t,i)})(i,t,n,e);return o}},{key:"setDataType",value:function(t){return this.type=t,this.hdrLoader.setDataType(t),this}}])&&Wm(e.prototype,i),t&&Wm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e})();function $m(t,n,e){return(n=ep(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function tp(t){return(tp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function np(t,n){for(var e=0;e{if("object"!=tp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=tp(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==tp(t)?t:t+""}n=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.SkyBoxType={cube6HDR:0,cube6Normal:1,cube1HDR:2,cube1Normal:3},this.I=t,this.ar=!0,this.sr=1,this.Dn=2e3,this.ur=!1,this.j=null,this.lr=null,this.cr=[],this.hr=!1,this.vr=null,this.dr=null,this.mr=this.pr(),this.yr=this.gr(),"basic"===this.I.getRenderManager().type&&this.I.setRenderManager(new gs(this.I)),this.Ht=this.I.getRenderManager()}return t=n,(e=[{key:"isHDR",get:function(){return this.hr}},{key:"exposure",get:function(){return this.sr},set:function(t){null!==this.vr&&(this.sr=t,this.vr.boxMesh.material.uniforms.exposure.value=t,this.vr.boxMesh.material.uniformsNeedUpdate=!0,this.I.enableUpdateNode())}},{key:"imagePath",get:function(){return this.lr},set:function(t){this.lr=t,this.vr&&(this.br(),this.I.enableUpdateNode())}},{key:"scale",get:function(){return this.Dn},set:function(t){this.Dn=t,this.vr&&(this.vr.setOrthographicScale(this.I.camera,this.Dn),this.I.enableUpdateNode())}},{key:"imageNames",get:function(){return this.cr},set:function(t){var n=t[0],n=n.slice(n.match(/(?=\.)/).index+1).toLocaleLowerCase();this.hr="hdr"===n,this.cr=t,this.vr&&(this.br(),this.I.enableUpdateNode())}},{key:"enable",value:function(){this.ar=!0,(this.I.getRenderManager().skyNeedTexture=this).j&&this.I.getRenderManager().renderScene.add(this.j),this.I.enableUpdateNode()}},{key:"disable",value:function(){this.ar=!1,this.I.getRenderManager().skyNeedTexture=null,this.j&&this.I.getRenderManager().renderScene.remove(this.j),this.I.enableUpdateNode()}},{key:"setState",value:function(t){var n=t.imagePath,e=t.imageNames,i=t.exposure,t=t.scale;n&&(this.imagePath=n),e&&(this.imageNames=e),(n||e)&&this.br(),void 0!==i&&(this.exposure=i),void 0!==t&&(this.scale=t),this.I.enableUpdateNode()}},{key:"getState",value:function(){return{exposure:this.sr,imageNames:this.cr,imagePath:this.lr,scale:this.Dn}}},{key:"dispose",value:function(){this.disable(),this.vr&&this.vr.mn(),this.lr=null,this.cr=[],this.vr=null,this.mr=null,this.yr=null,this.ur=!1}}])&&np(t.prototype,e),i&&np(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})(),Object.assign(n.prototype,{pr:function(){var t=this;return $m($m($m($m({},this.SkyBoxType.cube6HDR,function(){t.vr.boxMesh.material.uniforms.exposure.value=t.exposure,t.vr.boxMesh.material.uniforms.renderType.value=1,t.vr.boxMesh.material.uniforms.renderOutType.value=1,t.vr.boxMesh.material.uniformsNeedUpdate=!0}),this.SkyBoxType.cube6Normal,function(){t.vr.boxMesh.material.uniforms.renderType.value=3,t.vr.boxMesh.material.uniforms.renderOutType.value=2,t.vr.boxMesh.material.uniformsNeedUpdate=!0}),this.SkyBoxType.cube1HDR,function(){t.vr.boxMesh.material.uniforms.exposure.value=t.exposure,t.vr.boxMesh.material.uniforms.renderType.value=2,t.vr.boxMesh.material.uniforms.renderOutType.value=1,t.vr.boxMesh.material.uniformsNeedUpdate=!0}),this.SkyBoxType.cube1Normal,function(){t.vr.boxMesh.material.uniforms.renderType.value=4,t.vr.boxMesh.material.uniforms.renderOutType.value=3,t.vr.boxMesh.material.uniformsNeedUpdate=!0})},gr:function(){var i=this;return $m($m($m($m({},this.SkyBoxType.cube6HDR,function(){(new Km).setPath(i.lr).setDataType(1009).load(i.cr,function(t){t.magFilter=O,t.needsUpdate=!0,i._r(t),i.ur=!0})}),this.SkyBoxType.cube6Normal,function(){var n=[];i.imageNames.forEach(function(t){n.push(i.lr+t)}),(new Nd).load(n,function(t){t.mapping=301,i._r(t),i.ur=!0})}),this.SkyBoxType.cube1HDR,function(){var e=new am(i.I.getRenderManager().renderer);e.compileEquirectangularShader(),(new Xm).setPath(i.lr).load(i.cr[0],function(t){var n=e.fromEquirectangular(t);t.dispose(),e.dispose(),i._r(n.texture),i.ur=!0})}),this.SkyBoxType.cube1Normal,function(){(new Mi).load(i.lr+i.cr[0],function(t){t.mapping=300;t=new Qd(1024,{generateMipmaps:!0,minFilter:1008,magFilter:O}).fromEquirectangularTexture(i.I.getRenderManager().renderer,t);i._r(t),i.ur=!0})})},_r:function(t){t.colorSpace=mt,this.vr&&this.vr.mn(),this.vr=new mm,this.vr.setTexture(t),0(t=((t,n)=>{if("object"!=ip(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=ip(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==ip(t)?t:t+""))(i.key),i)}}n=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.url=t.url,this.exposure=t.exposure,void 0===this.exposure&&(this.exposure=.5)}return t=n,(e=[{key:"load",value:function(r,o){var a=this;(new Xm).load(this.url,function(t){var n=r.getRenderManager().renderer,e=n.toneMapping,i=(n.toneMapping=2,n.toneMappingExposure=a.exposure,new am(n)),i=(i.compileEquirectangularShader(),i.fromEquirectangular(t).texture);o&&o(i),n.toneMapping=e})}}])&&rp(t.prototype,e),i&&rp(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();function op(t){return(op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ap(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=op(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=op(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==op(t)?t:t+""))(i.key),i)}}var sp=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.Cn=t.Cn,this.Nt=n.url,this.Lt=n.count;n=n.getRenderNode();this.wr=n.material.uniforms.isGradient.value,this.Sr=n.material.uniforms.gradientLength.value,this.Ar=n.material.uniforms.direction.value,this.Er=n.material.uniforms.gradientPercent.value,this.Tr=n.material.uniforms.gradientColor.value,this.Mr=t.Mr,this.yn=t.yn,null==this.yn&&(this.yn=0),void(this.Pr=0)!==t.Pr&&"y"===t.Pr&&(this.Pr=1),0===this.Pr&&(this.yn=this.yn/this.Lt),void 0===this.Mr&&(this.Mr=1),this.Or=null,this.Nr=null,this.Cr="\n #include \n #include \n varying vec2 vUv;\n varying vec3 fNormal;\n varying vec3 vPosition;\n void main(){\n vUv = uv;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include \n }\n ",this.Lr="\n uniform float time;\n uniform float luminanceWall;\n uniform float repeat;\n varying vec2 vUv;\n uniform sampler2D flowTexturefront;\n uniform sampler2D flowTextureback;\n uniform sampler2D bgTexture;\n uniform float direct;\n uniform float isBgColor;\n\n uniform bool isGradient;\n uniform int direction;//0为x轴,1为y\n uniform int gradientLength;\n uniform float gradientPercent[{num}];\n uniform vec4 gradientColor[{num}];\n\n #include \n\n vec4 getColor(vec2 uv){\n int begin=0;\n int end=0;\n float value=uv.x;\n if(direction==1){\n if(uv.y<=0.5){\n value=(0.5-uv.y)/0.5;\n } else {\n value=(uv.y-0.5)/0.5;\n }\n }\n vec4 colorBegin=gradientColor[0];//gradientColor[begin];\n vec4 colorEnd=gradientColor[0];\n float beginPercent=gradientPercent[0];\n float endPercent=gradientPercent[0];\n if(direction==1){\n for(int i=0;i<{num};i++){\n if(value>gradientPercent[i]){\n colorBegin=gradientColor[i];\n colorEnd=gradientColor[i];\n beginPercent=gradientPercent[i];\n endPercent=gradientPercent[i];\n if(i+1<={num}-1){\n colorEnd=gradientColor[i+1];\n endPercent=gradientPercent[i+1];\n }\n }\n }\n } else {\n for(int i=0;i<{num};i++){\n if(value>gradientPercent[i]){\n colorBegin=gradientColor[i];\n colorEnd=gradientColor[i];\n beginPercent=gradientPercent[i];\n endPercent=gradientPercent[i];\n if(i+1<={num}-1){\n colorEnd=gradientColor[i+1];\n endPercent=gradientPercent[i+1];\n }\n }\n }\n }\n \n float perCent=0.0;\n if(direction==0){\n perCent=(uv.x-beginPercent)/(endPercent-beginPercent);\n return mix(colorBegin,colorEnd,perCent);\n } else {\n if(uv.y<=0.5){\n perCent=(((0.5-uv.y)/0.5)-beginPercent)/(endPercent-beginPercent);\n return mix(colorBegin,colorEnd,perCent);\n } else {\n perCent=(((uv.y-0.5)/0.5)-beginPercent)/(endPercent-beginPercent);\n return mix(colorBegin,colorEnd,perCent);\n }\n }\n \n }\n void main( void ) {\n #include \n vec2 position = vUv;\n if(direct==1.0){\n vec4 colora = texture2D( flowTextureback, vec2( vUv.x*repeat, fract(vUv.y + time )));\n if(vUv.y>0.5){\n colora = texture2D( flowTexturefront, vec2( vUv.x*repeat, fract(vUv.y - time )));\n }\n if(!isGradient){\n if(isBgColor==1.0){\n vec4 colorb = texture2D( bgTexture , position.xy);\n colora.r = colora.r * colorb.a * luminanceWall;\n colora.g = colora.g * colorb.a * luminanceWall;\n colora.b = colora.b * colorb.a * luminanceWall;\n\n colorb.r = colorb.r * colorb.a * luminanceWall;\n colorb.g = colorb.g * colorb.a * luminanceWall;\n colorb.b = colorb.b * colorb.a * luminanceWall;\n\n gl_FragColor = colorb + colora; \n } else {\n gl_FragColor = colora; \n } \n } else {\n vec4 gradientColor=getColor(vUv);\n vec4 resultColor=mix(colora,gradientColor,1.0-colora.a);\n resultColor.r = resultColor.r * resultColor.a * luminanceWall;\n resultColor.g = resultColor.g * resultColor.a * luminanceWall;\n resultColor.b = resultColor.b * resultColor.a * luminanceWall;\n\n gl_FragColor = resultColor;\n }\n } else {\n vec4 colora = texture2D( flowTextureback, vec2( fract( vUv.x - time )*repeat, vUv.y));\n if(vUv.y>0.5){\n colora = texture2D( flowTexturefront, vec2( fract( vUv.x - time )*repeat, vUv.y));\n }\n if(!isGradient){\n if(isBgColor==1.0){\n vec4 colorb = texture2D( bgTexture , position.xy);\n \n colora.r = colora.r * colorb.a* luminanceWall;\n colora.g = colora.g * colorb.a* luminanceWall;\n colora.b = colora.b * colorb.a* luminanceWall;\n\n colorb.r = colorb.r * colorb.a * luminanceWall;\n colorb.g = colorb.g * colorb.a * luminanceWall;\n colorb.b = colorb.b * colorb.a * luminanceWall;\n gl_FragColor = colorb + colora;\n } else {\n colora.r = colora.r * colora.a * luminanceWall;\n colora.g = colora.g * colora.a * luminanceWall;\n colora.b = colora.b * colora.a * luminanceWall;\n gl_FragColor = colora; \n } \n } else {\n vec4 gradientColor=getColor(vUv);\n vec4 resultColor=vec4(0.0);\n if(colora.a!=0.0){\n resultColor=colora;\n } else {\n resultColor=gradientColor;\n }\n \n resultColor.r = resultColor.r * resultColor.a * luminanceWall;\n resultColor.g = resultColor.g * resultColor.a * luminanceWall;\n resultColor.b = resultColor.b * resultColor.a * luminanceWall;\n\n gl_FragColor = resultColor;\n }\n }\n }\n "}return t=e,(n=[{key:"init",value:function(i){var r=this,c=this;function o(t){var n=document.createElement("canvas"),e=(n.width=t.width,n.height=t.height,n.getContext("2d"));return e.translate(n.width,0),e.scale(-1,1),e.drawImage(t,0,0,n.width,n.height),n}function a(t,e){if(!t){for(var n=(t=>{var n=t.toLowerCase();if(n&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(n)){if(4===n.length){for(var e="#",i=1;i<4;i+=1)e+=n.slice(i,i+1).concat(n.slice(i,i+1));n=e}for(var r=[],i=1;i<7;i+=2)r.push(parseInt("0x"+n.slice(i,i+2)));return r}return n})(c.Cn),i=document.createElement("canvas"),r=(i.width=1024,i.height=2048,i.getContext("2d")),o=r.createLinearGradient(0,0,0,1024),a=.3,s=0;s<=1e3;s++)o.addColorStop(s/1e3,"rgba("+n[0]+", "+n[1]+","+n[2]+", "+a+")"),a+=7e-4;r.fillStyle=o,r.fillRect(0,0,1024,1024);for(var o=r.createLinearGradient(0,1024,0,2048),a=1,u=0;u<=1e3;u++)o.addColorStop(u/1e3,"rgba("+n[0]+", "+n[1]+","+n[2]+", "+a+")"),a-=7e-4;return r.fillStyle=o,r.fillRect(0,1024,1024,1024),i}var l=new Image;l.crossOrigin="Anonymous",l.onload=function(){var t=document.createElement("canvas"),n=(t.width=512,t.height=512,t.getContext("2d"));n.drawImage(l,0,0,512,256),n.drawImage(l,0,256,512,256),e&&e(t)},l.src=t}a(this.Nt,function(t){r.Or=new w(o(t)),r.Or.wrapS=r.Or.wrapT=Q,r.Nr=new w(o((t=t,(e=document.createElement("canvas")).width=512,e.height=512,(n=e.getContext("2d")).translate(256,256),n.rotate(Math.PI),n.drawImage(t,-256,-256),o(e)))),r.Nr.wrapS=r.Nr.wrapT=Q;var n=null,t=0,e=(void 0!==r.Cn&&(n=new w(a()),t=1),r.Lr.replace(/{num}/g,""+r.Sr)),n=new R({uniforms:{time:{value:0},luminanceWall:{value:r.Mr},flowTexturefront:{value:r.Or},flowTextureback:{value:r.Nr},bgTexture:{value:n},isBgColor:{value:t},direct:{value:r.Pr},repeat:{value:r.Lt},isGradient:{value:r.wr},direction:{value:r.Ar},gradientLength:{value:r.Sr},gradientPercent:{value:r.Er},gradientColor:{value:r.Tr}},transparent:!0,depthWrite:!0,depthTest:!0,side:Y,vertexShader:r.Cr,fragmentShader:e});i(n)})}}])&&ap(t.prototype,n),i&&ap(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})();function up(t){return(up="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lp(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=up(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=up(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==up(t)?t:t+""))(i.key),i)}}var cp=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.Cn=t.Cn,this.Nt=n.url,this.Lt=n.count,this.Mr=t.Mr,this.yn=t.yn,this.yn=this.yn/this.Lt,this.ft=null,this.Cr="\n #include \n #include \n varying vec2 vUv;\n void main(){\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include \n }\n ",this.Lr="\n uniform float time;\n uniform float luminanceLine;\n uniform float repeat;\n varying vec2 vUv;\n uniform sampler2D textureMap;\n uniform sampler2D background;\n uniform bool isbackground;\n #include \n void main( void ) {\n #include \n vec4 backcolor=texture2D(background,vUv);\n vec4 colora = texture2D( textureMap, vec2(fract( vUv.x + time )*repeat, vUv.y));\n colora.r = colora.r * colora.a * luminanceLine;\n colora.g = colora.g * colora.a * luminanceLine;\n colora.b = colora.b * colora.a * luminanceLine;\n if(isbackground){\n gl_FragColor = vec4(vec3(mix(colora,backcolor,1.0-colora.a)),1.0);\n } else {\n gl_FragColor = colora;\n }\n }\n "}return t=e,(n=[{key:"init",value:function(e){var t,i,r,o=this,a=this;t=this.Nt,i=function(t){o.ft=new w(t);var t=null,n=!(o.ft.wrapS=o.ft.wrapT=Q),t=(void 0!==o.Cn&&(t=new w(a.getBackgroundCanvas()),n=!0),new R({uniforms:{time:{value:0},luminanceLine:{value:o.Mr},textureMap:{value:o.ft},background:{value:t},isbackground:{value:n},repeat:{value:o.Lt}},transparent:!0,depthWrite:!0,depthTest:!0,side:2,vertexShader:o.Cr,fragmentShader:o.Lr}));e(t)},(r=new Image).crossOrigin="Anonymous",r.onload=function(){var t=document.createElement("canvas"),n=(t.width=512,t.height=512,t.getContext("2d"));n.drawImage(r,0,0,r.width,r.height/2,0,256,512,256),n.drawImage(r,0,r.height/2,r.width,r.height/2,0,0,512,256),i&&i(t)},r.src=t}},{key:"getBackgroundCanvas",value:function(){var t=document.createElement("canvas"),n=(t.width=128,t.height=128,t.getContext("2d"));return n.rect(0,0,128,128),n.fillStyle=new N(this.Cn).getStyle(),n.fill(),t}}])&&lp(t.prototype,n),i&&lp(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})();function fp(t){return(fp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hp(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=fp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=fp(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==fp(t)?t:t+""))(i.key),i)}}var vp=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.Rr="FMFlowEffect",this.Dr=null,this.Fr=null,this.Cn=t.color,this.Nt=t.url,this.Lt=t.count,this.Mr=t.strength,this.yn=t.speed,null==this.yn&&(this.yn=0),this.Pr=t.direct,void 0===this.Pr&&(this.Pr="x")}return t=n,(e=[{key:"type",get:function(){return this.Rr}},{key:"direct",get:function(){return this.Pr},set:function(t){this.Pr=t}},{key:"speed",get:function(){return this.yn},set:function(t){this.yn=t}},{key:"add",value:function(t){if(Array.isArray(t))for(var n=0;n(t=((t,n)=>{if("object"!=dp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=dp(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==dp(t)?t:t+""))(i.key),i)}}var pp=(()=>{function n(t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.Rr="FMDiffusion",this.Cn=t.color,this.Ir=t.maxScale,void 0===this.Ir&&(this.Ir=10),this.yn=t.speed,void 0===this.yn&&(this.yn=1),this.kr=!1,void 0!==this.Cn&&(this.kr=!0),this.Cr="\n #include \n #include \n varying vec3 vPosition;\n varying vec3 vNormal;\n varying vec2 vUv;\n\n void main() {\n\n vPosition = vec3(modelMatrix * vec4( position, 1.0 ));\n vNormal = normal;\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n #include \n\n }\n ",this.Lr="\n varying vec3 vPosition;\n varying vec3 vNormal;\n varying vec2 vUv;\n\n uniform vec3 color;\n uniform bool iscolor;\n uniform float opacity;\n uniform bool isTexture;\n uniform sampler2D textureMap;\n #include \n\n void main() {\n #include \n\n vec3 viewDir = normalize(cameraPosition - vPosition);\n\n float res = max(dot(viewDir,vNormal),0.20);\n\n float alpha = (1.0 - res);\n\n alpha *= alpha;\n if(!isTexture){\n gl_FragColor = 1.0*vec4(color, alpha * opacity);\n } else {\n vec4 tex = texture2D( textureMap, vUv );\n if(!iscolor){\n gl_FragColor = 1.0*vec4(tex.rgb, alpha * opacity*tex.a);\n } else {\n gl_FragColor = 1.0*vec4(tex.rgb+color, alpha * opacity*tex.a);\n }\n }\n }\n "}return t=n,(e=[{key:"type",get:function(){return this.Rr}},{key:"maxScale",get:function(){return this.Ir},set:function(t){this.Ir=t}},{key:"speed",get:function(){return this.yn},set:function(t){this.yn=t}},{key:"getMaterial",value:function(t,n){var e,i,r,o=this;void 0!==t.url?(e=t.url,i=function(t){t=new w(t),t=new R({uniforms:{color:{value:new N(o.Cn)},opacity:{value:1},textureMap:{value:t},isTexture:{value:!0},iscolor:{value:o.kr}},transparent:!0,depthTest:!0,depthWrite:!1,vertexShader:o.Cr,fragmentShader:o.Lr});n(t)},(r=new Image).crossOrigin="Anonymous",r.onload=function(){var t=document.createElement("canvas");t.width=512,t.height=512,t.getContext("2d").drawImage(r,0,0,512,512),i&&i(t)},r.src=e):(void 0===(e=this.Cn)&&(e=t.color),t=new R({uniforms:{color:{value:new N(e)},opacity:{value:1},texture:{value:null},isTexture:{value:!1},iscolor:{value:!0}},transparent:!0,depthTest:!0,depthWrite:!1,vertexShader:this.Cr,fragmentShader:this.Lr}),n(t))}},{key:"add",value:function(t){if(Array.isArray(t))for(var n=0;nthis.Ir-.4*this.Ir&&(t.material.uniforms.opacity.value-=.005),t.scale.x>this.Ir&&(t.scale.x=.1,t.scale.y=.1,t.scale.z=.1,t.material.uniforms.opacity.value=.8)}}])&&mp(t.prototype,e),i&&mp(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();function yp(t){return(yp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gp(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=yp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=yp(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==yp(t)?t:t+""))(i.key),i)}}var bp=(()=>{function r(t){var n=1(t=((t,n)=>{if("object"!=_p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=_p(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==_p(t)?t:t+""))(i.key),i)}}var Sp=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.jr=(n=void 0===n?{}:n).color,void 0===this.jr&&(this.jr="#CCE0FF"),this.ct=n.density,void 0===this.ct&&(this.ct=25e-5),this.Te=!1,this.lt=null,this.ft=null,this.An=this.An.bind(this)}return t=e,(n=[{key:"color",get:function(){return this.jr},set:function(t){this.jr=t,this.Ur("color")}},{key:"density",get:function(){return this.ct},set:function(t){this.ct=t,this.Ur("density")}},{key:"enable",value:function(){this.Te=!0,this.ar(this.Te),this.I.on("update",this.An)}},{key:"disable",value:function(){this.Te=!1,this.ar(this.Te),this.I.off("update",this.An),this.ut(!1)}}])&&wp(t.prototype,n),i&&wp(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i})(),xp=(Object.assign(Sp.prototype,{ar:function(t){var n=this,e=this.I.getRenderManager();"basic"===e.type&&this.I.setRenderManager(new gs(this.I)),t?null!==(e.fogEffect=this).lt?(e.renderScene.fog=this.lt.clone(),e.renderScene.background=this.ft.clone()):this.ze(function(t){t=new w(t);n.lt=new bp(new N(n.jr),n.ct),n.ft=t,e.renderScene.fog=new bp(new N(n.jr),n.ct),e.renderScene.background=t,n.I.enableUpdateRender()}):(e.fogEffect=null,e.renderScene.fog=null,e.renderScene.background=null,this.I.enableUpdateRender())},An:function(){this.ut(!0)},ze:function(e){var t,n,i,r,o=this,a=this.I.getMapOptions().container.style.backgroundImage;""===a?((t=document.createElement("canvas")).height=1024,t.width=1024,n=t.getContext("2d"),""!==(i=this.I.getMapOptions().container.style.backgroundColor)&&(n.fillStyle=i,n.fillRect(0,0,t.width,t.height)),n.globalAlpha=.8,n.fillStyle=this.jr,n.fillRect(0,0,t.width,t.height),e&&e(t)):(a=(a=a.substring(a.indexOf("(")+1,a.indexOf(")"))).replaceAll('"',""),(r=new Image).crossOrigin="Anonymous",r.onload=function(){var t=document.createElement("canvas"),n=(t.height=1024,t.width=1024,t.getContext("2d"));n.drawImage(r,0,0,t.width,t.height),n.globalAlpha=.8,n.fillStyle=o.jr,n.fillRect(0,0,t.width,t.height),e&&e(t)},r.src=a)},ut:function(t){for(var n=this.I.getVisibleLevels(),e=0;e\n\t\tfloat pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {\n\t\t\t//x0: point, x1: linePointA, x2: linePointB\n\t\t\t//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html\n\t\t\treturn length(cross(x0-x1,x0-x2))/length(x2-x1);\n\t\t}\n\t\tfloat pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){\n\t\t\t// https://mathworld.wolfram.com/Point-PlaneDistance.html\n\t\t\t//// https://en.wikipedia.org/wiki/Plane_(geometry)\n\t\t\t//// http://paulbourke.net/geometry/pointlineplane/\n\t\t\tfloat a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;\n\t\t\tfloat x0=point.x,y0=point.y,z0=point.z;\n\t\t\tfloat x=planePoint.x,y=planePoint.y,z=planePoint.z;\n\t\t\tfloat d=-(a*x+b*y+c*z);\n\t\t\tfloat distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);\n\t\t\treturn distance;\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#ifdef PERSPECTIVE_CAMERA\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view\n\t\t}\n\t\tvec3 getViewNormal( const in vec2 uv ) {\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, uv ).xyz );\n\t\t}\n\t\tvec2 viewPositionToXY(vec3 viewPosition){\n\t\t\tvec2 xy;\n\t\t\tvec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);\n\t\t\txy=clip.xy;//clip\n\t\t\tfloat clipW=clip.w;\n\t\t\txy/=clipW;//NDC\n\t\t\txy=(xy+1.)/2.;//uv\n\t\t\txy*=resolution;//screen\n\t\t\treturn xy;\n\t\t}\n\t\tvoid main(){\n\t\t\t#ifdef SELECTIVE\n\t\t\t\tfloat metalness=texture2D(tMetalness,vUv).r;\n\t\t\t\tif(metalness==0.) return;\n\t\t\t#endif\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\tif(-viewZ>=cameraFar) return;\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];\n\t\t\tvec3 viewPosition=getViewPosition( vUv, depth, clipW );\n\n\t\t\tvec2 d0=gl_FragCoord.xy;\n\t\t\tvec2 d1;\n\n\t\t\tvec3 viewNormal=getViewNormal( vUv );\n\n\t\t\t#ifdef PERSPECTIVE_CAMERA\n\t\t\t\tvec3 viewIncidentDir=normalize(viewPosition);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidentDir,viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 viewIncidentDir=vec3(0,0,-1);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidentDir,viewNormal);\n\t\t\t#endif\n\n\t\t\tfloat maxReflectRayLen=maxDistance/dot(-viewIncidentDir,viewNormal);\n\t\t\t// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html\n\t\t\t// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen=cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen==dot(a,b)\n\t\t\t// maxReflectRayLen==maxDistance/dot(a,b)\n\n\t\t\tvec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;\n\t\t\t#ifdef PERSPECTIVE_CAMERA\n\t\t\t\tif(d1viewPosition.z>-cameraNear){\n\t\t\t\t\t//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx\n\t\t\t\t\tfloat t=(-cameraNear-viewPosition.z)/viewReflectDir.z;\n\t\t\t\t\td1viewPosition=viewPosition+viewReflectDir*t;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\td1=viewPositionToXY(d1viewPosition);\n\n\t\t\tfloat totalLen=length(d1-d0);\n\t\t\tfloat xLen=d1.x-d0.x;\n\t\t\tfloat yLen=d1.y-d0.y;\n\t\t\tfloat totalStep=max(abs(xLen),abs(yLen));\n\t\t\tfloat xSpan=xLen/totalStep;\n\t\t\tfloat ySpan=yLen/totalStep;\n\t\t\tfor(float i=0.;i=totalStep) break;\n\t\t\t\tvec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);\n\t\t\t\tif(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;\n\t\t\t\tfloat s=length(xy-d0)/totalLen;\n\t\t\t\tvec2 uv=xy/resolution;\n\n\t\t\t\tfloat d = getDepth(uv);\n\t\t\t\tfloat vZ = getViewZ( d );\n\t\t\t\tif(-vZ>=cameraFar) continue;\n\t\t\t\tfloat cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];\n\t\t\t\tvec3 vP=getViewPosition( uv, d, cW );\n\n\t\t\t\t#ifdef PERSPECTIVE_CAMERA\n\t\t\t\t\t// https://comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf\n\t\t\t\t\tfloat recipVPZ=1./viewPosition.z;\n\t\t\t\t\tfloat viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));\n\t\t\t\t#else\n\t\t\t\t\tfloat viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);\n\t\t\t\t#endif\n\n\t\t\t\t// if(viewReflectRayZ>vZ) continue; // will cause "npm run make-screenshot webgl_postprocessing_ssr" high probability hang.\n\t\t\t\t// https://github.com/mrdoob/three.js/pull/21539#issuecomment-821061164\n\t\t\t\tif(viewReflectRayZ<=vZ){\n\n\t\t\t\t\tbool hit;\n\t\t\t\t\t#ifdef INFINITE_THICK\n\t\t\t\t\t\thit=true;\n\t\t\t\t\t#else\n\t\t\t\t\t\tfloat away=pointToLineDistance(vP,viewPosition,d1viewPosition);\n\n\t\t\t\t\t\tfloat minThickness;\n\t\t\t\t\t\tvec2 xyNeighbor=xy;\n\t\t\t\t\t\txyNeighbor.x+=1.;\n\t\t\t\t\t\tvec2 uvNeighbor=xyNeighbor/resolution;\n\t\t\t\t\t\tvec3 vPNeighbor=getViewPosition(uvNeighbor,d,cW);\n\t\t\t\t\t\tminThickness=vPNeighbor.x-vP.x;\n\t\t\t\t\t\tminThickness*=3.;\n\t\t\t\t\t\tfloat tk=max(minThickness,thickness);\n\n\t\t\t\t\t\thit=away<=tk;\n\t\t\t\t\t#endif\n\n\t\t\t\t\tif(hit){\n\t\t\t\t\t\tvec3 vN=getViewNormal( uv );\n\t\t\t\t\t\tif(dot(viewReflectDir,vN)>=0.) continue;\n\t\t\t\t\t\tfloat distance=pointPlaneDistance(vP,viewPosition,viewNormal);\n\t\t\t\t\t\tif(distance>maxDistance) break;\n\t\t\t\t\t\tfloat op=opacity;\n\t\t\t\t\t\t#ifdef DISTANCE_ATTENUATION\n\t\t\t\t\t\t\tfloat ratio=1.-(distance/maxDistance);\n\t\t\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\t#ifdef FRESNEL\n\t\t\t\t\t\t\tfloat fresnelCoe=(dot(viewIncidentDir,viewReflectDir)+1.)/2.;\n\t\t\t\t\t\t\top*=fresnelCoe;\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\tvec4 reflectColor=texture2D(tDiffuse,uv);\n\t\t\t\t\t\tgl_FragColor.xyz=reflectColor.xyz;\n\t\t\t\t\t\tgl_FragColor.a=op;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'}),Ap={PERSPECTIVE_CAMERA:1},Ep={tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},Tp="\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}\n\n\t",Mp="\n\n\t\tuniform sampler2D tDepth;\n\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\n\t\tvarying vec2 vUv;\n\n\t\t#include \n\n\t\tfloat getLinearDepth( const in vec2 uv ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, uv ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, uv ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tfloat depth = getLinearDepth( vUv );\n\t\t\tfloat d = 1.0 - depth;\n\t\t\t// d=(d-.999)*1000.;\n\t\t\tgl_FragColor = vec4( vec3( d ), 1.0 );\n\n\t\t}\n\n\t",Pp={uniforms:{tDiffuse:{value:null},resolution:{value:new B},opacity:{value:.5}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}\n\n\t",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec2 resolution;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t//reverse engineering from PhotoShop blur filter, then change coefficient\n\n\t\t\tvec2 texelSize = ( 1.0 / resolution );\n\n\t\t\tvec4 c=texture2D(tDiffuse,vUv);\n\n\t\t\tvec2 offset;\n\n\t\t\toffset=(vec2(-1,0))*texelSize;\n\t\t\tvec4 cl=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(1,0))*texelSize;\n\t\t\tvec4 cr=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,-1))*texelSize;\n\t\t\tvec4 cb=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,1))*texelSize;\n\t\t\tvec4 ct=texture2D(tDiffuse,vUv+offset);\n\n\t\t\t// float coeCenter=.5;\n\t\t\t// float coeSide=.125;\n\t\t\tfloat coeCenter=.2;\n\t\t\tfloat coeSide=.2;\n\t\t\tfloat a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;\n\t\t\tvec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;\n\t\t\tgl_FragColor=vec4(rgb,a);\n\n\t\t}\n\t"};function Op(t){return(Op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Np(t,n){for(var e=0;e(t=((t,n)=>{if("object"!=Op(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Op(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Op(t)?t:t+""))(i.key),i)}}function Cp(t,n,e){n=Rp(n);var i=t,n=Lp()?Reflect.construct(n,e||[],Rp(t).constructor):n.apply(t,e);if(!n||"object"!=Op(n)&&"function"!=typeof n){if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(n=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n}function Lp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Lp=function(){return!!t})()}function Rp(t){return(Rp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Dp(t,n){return(Dp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t})(t,n)}var Fp=(()=>{function l(t){var n,e=t.renderer,i=t.scene,r=t.camera,o=t.width,a=t.height,s=t.selects,u=t.bouncing,u=void 0!==u&&u,t=t.groundReflector;if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");(n=Cp(this,l)).width=void 0!==o?o:512,n.height=void 0!==a?a:512,n.clear=!0,n.renderer=e,n.scene=i,n.camera=r,n.groundReflector=t,n.opacity=xp.uniforms.opacity.value,n.output=0,n.maxDistance=xp.uniforms.maxDistance.value,n.thickness=xp.uniforms.thickness.value,n.tempColor=new N,n.Br=s,n.selective=Array.isArray(n.Br),Object.defineProperty(n,"selects",{get:function(){return this.Br},set:function(t){this.Br!==t&&(this.Br=t,Array.isArray(t)?(this.selective=!0,this.ssrMaterial.defines.SELECTIVE=!0):(this.selective=!1,this.ssrMaterial.defines.SELECTIVE=!1),this.ssrMaterial.needsUpdate=!0)}}),n.Hr=u,Object.defineProperty(n,"bouncing",{get:function(){return this.Hr},set:function(t){this.Hr!==t&&(this.Hr=t,this.ssrMaterial.uniforms.tDiffuse.value=(t?this.prevRenderTarget:this.beautyRenderTarget).texture)}}),n.blur=!0,n.Vr=xp.defines.DISTANCE_ATTENUATION,Object.defineProperty(n,"distanceAttenuation",{get:function(){return this.Vr},set:function(t){this.Vr!==t&&(this.Vr=t,this.ssrMaterial.defines.DISTANCE_ATTENUATION=t,this.ssrMaterial.needsUpdate=!0)}}),n.zr=xp.defines.SSR,Object.defineProperty(n,"fresnel",{get:function(){return this.zr},set:function(t){this.zr!==t&&(this.zr=t,this.ssrMaterial.defines.FRESNEL=t,this.ssrMaterial.needsUpdate=!0)}}),n.Gr=xp.defines.INFINITE_THICK,Object.defineProperty(n,"infiniteThick",{get:function(){return this.Gr},set:function(t){this.Gr!==t&&(this.Gr=t,this.ssrMaterial.defines.INFINITE_THICK=t,this.ssrMaterial.needsUpdate=!0)}});o=new Gh;return o.type=1012,o.minFilter=m,n.beautyRenderTarget=new D(n.width,n.height,{minFilter:o.magFilter=m,magFilter:m,depthTexture:o,depthBuffer:!0}),n.prevRenderTarget=new D(n.width,n.height,{minFilter:m,magFilter:m}),n.normalRenderTarget=new D(n.width,n.height,{minFilter:m,magFilter:m,type:Z}),n.metalnessRenderTarget=new D(n.width,n.height,{minFilter:m,magFilter:m}),n.ssrRenderTarget=new D(n.width,n.height,{minFilter:m,magFilter:m}),n.blurRenderTarget=n.ssrRenderTarget.clone(),n.blurRenderTarget2=n.ssrRenderTarget.clone(),n.ssrMaterial=new R({defines:Object.assign({},xp.defines,{MAX_STEP:Math.sqrt(n.width*n.width+n.height*n.height)}),uniforms:L.clone(xp.uniforms),vertexShader:xp.vertexShader,fragmentShader:xp.fragmentShader,blending:0}),n.ssrMaterial.uniforms.tDiffuse.value=n.beautyRenderTarget.texture,n.ssrMaterial.uniforms.tNormal.value=n.normalRenderTarget.texture,n.ssrMaterial.defines.SELECTIVE=n.selective,n.ssrMaterial.needsUpdate=!0,n.ssrMaterial.uniforms.tMetalness.value=n.metalnessRenderTarget.texture,n.ssrMaterial.uniforms.tDepth.value=n.beautyRenderTarget.depthTexture,n.ssrMaterial.uniforms.cameraNear.value=n.camera.near,n.ssrMaterial.uniforms.cameraFar.value=n.camera.far,n.ssrMaterial.uniforms.thickness.value=n.thickness,n.ssrMaterial.uniforms.resolution.value.set(n.width,n.height),n.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(n.camera.projectionMatrix),n.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(n.camera.projectionMatrixInverse),n.normalMaterial=new Kh,n.normalMaterial.blending=0,n.metalnessOnMaterial=new b({color:"white"}),n.metalnessOffMaterial=new b({color:"black"}),n.blurMaterial=new R({defines:Object.assign({},Pp.defines),uniforms:L.clone(Pp.uniforms),vertexShader:Pp.vertexShader,fragmentShader:Pp.fragmentShader}),n.blurMaterial.uniforms.tDiffuse.value=n.ssrRenderTarget.texture,n.blurMaterial.uniforms.resolution.value.set(n.width,n.height),n.blurMaterial2=new R({defines:Object.assign({},Pp.defines),uniforms:L.clone(Pp.uniforms),vertexShader:Pp.vertexShader,fragmentShader:Pp.fragmentShader}),n.blurMaterial2.uniforms.tDiffuse.value=n.blurRenderTarget.texture,n.blurMaterial2.uniforms.resolution.value.set(n.width,n.height),n.depthRenderMaterial=new R({defines:Object.assign({},Ap),uniforms:L.clone(Ep),vertexShader:Tp,fragmentShader:Mp,blending:0}),n.depthRenderMaterial.uniforms.tDepth.value=n.beautyRenderTarget.depthTexture,n.depthRenderMaterial.uniforms.cameraNear.value=n.camera.near,n.depthRenderMaterial.uniforms.cameraFar.value=n.camera.far,n.copyMaterial=new R({uniforms:L.clone(Ko.uniforms),vertexShader:Ko.vertexShader,fragmentShader:Ko.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:204,blendDst:205,blendEquation:100,blendSrcAlpha:204,blendDstAlpha:205,blendEquationAlpha:100}),n.fsQuad=new h.FullScreenQuad(null),n.originalClearColor=new N,n}var t,n=l,e=h;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Dp(n,e),n=l,(e=[{key:"dispose",value:function(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}},{key:"render",value:function(t,n){switch(t.setRenderTarget(this.beautyRenderTarget),t.clear(),this.groundReflector&&(this.groundReflector.visible=!1,this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),t.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,0,0),this.selective&&this.renderMetalness(t,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.renderPass(t,this.ssrMaterial,this.ssrRenderTarget),this.blur&&(this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.renderPass(t,this.blurMaterial2,this.blurRenderTarget2)),this.output){case l.OUTPUT.Default:this.bouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=1,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=0):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=1),this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n);break;case l.OUTPUT.SSR:this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n),this.bouncing&&(this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=1,this.renderPass(t,this.copyMaterial,this.prevRenderTarget));break;case l.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n);break;case l.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:n);break;case l.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n);break;case l.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:n);break;default:console.warn("THREE.SSRPass: Unknown output type.")}}},{key:"renderPass",value:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor(this.tempColor));var o=t.getClearAlpha(this.tempColor),a=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.fsQuad.material=n,this.fsQuad.render(t),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(o)}},{key:"renderOverride",value:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor(this.tempColor));var o=t.getClearAlpha(this.tempColor),a=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,i=n.clearColor||i,r=n.clearAlpha||r,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.scene.overrideMaterial=n,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(o)}},{key:"renderMetalness",value:function(t,n,e,i,r){var o=this,a=(this.originalClearColor.copy(t.getClearColor(this.tempColor)),t.getClearAlpha(this.tempColor)),s=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,i=n.clearColor||i,r=n.clearAlpha||r,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.scene.traverseVisible(function(t){t.Xr=t.material,o.Br.includes(t)?t.material=o.metalnessOnMaterial:t.material=o.metalnessOffMaterial}),t.render(this.scene,this.camera),this.scene.traverseVisible(function(t){t.material=t.Xr}),t.autoClear=s,t.setClearColor(this.originalClearColor),t.setClearAlpha(a)}},{key:"setSize",value:function(t,n){this.width=t,this.height=n,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(t*t+n*n),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(t,n),this.prevRenderTarget.setSize(t,n),this.ssrRenderTarget.setSize(t,n),this.normalRenderTarget.setSize(t,n),this.metalnessRenderTarget.setSize(t,n),this.blurRenderTarget.setSize(t,n),this.blurRenderTarget2.setSize(t,n),this.ssrMaterial.uniforms.resolution.value.set(t,n),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(t,n),this.blurMaterial2.uniforms.resolution.value.set(t,n)}}])&&Np(n.prototype,e),t&&Np(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})();function Ip(t,n){return(t=>{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,r,o,a,s=[],u=!0,l=!1;try{if(o=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;u=!1}else for(;!(u=(i=o.call(e)).done)&&(s.push(i.value),s.length!==n);u=!0);}catch(t){l=!0,r=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}})(t,n)||jp(t,n)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function kp(t,n){var e,i,r,o,a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return r=!(i=!0),{s:function(){a=a.call(t)},n:function(){var t=a.next();return i=t.done,t},e:function(t){r=!0,e=t},f:function(){try{i||null==a.return||a.return()}finally{if(r)throw e}}};if(Array.isArray(t)||(a=jp(t))||n&&t&&"number"==typeof t.length)return a&&(t=a),o=0,{s:n=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function jp(t,n){var e;if(t)return"string"==typeof t?Up(t,n):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Up(t,n):void 0}function Up(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);e(t=((t,n)=>{if("object"!=Bp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);if("object"!=Bp(e=e.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==Bp(t)?t:t+""))(i.key),i)}}Fp.OUTPUT={Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7};var Vp=(()=>{function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.I=t,this.Yr=n.targets,void 0===this.Yr&&(this.Yr=[]),this.Wr=n.reflectivity,void 0===this.Wr&&(this.Wr=.5),this.Qr=n.maxDistance,void 0===this.Qr&&(this.Qr=30),this.Ht=null,this.U=null,this.qr=null,this.Zr=new l,this.Jr=new l,this._t=null,this.wt=null,this.St=null,this.Kr=null,this.$r=new Map,this.no=new Map,this.no.set("0",new b({color:new N(0,0,0)})),this.no.set("0.1",new b({color:new N(.1,0,0)})),this.no.set("0.2",new b({color:new N(.2,0,0)})),this.no.set("0.3",new b({color:new N(.3,0,0)})),this.no.set("0.4",new b({color:new N(.4,0,0)})),this.no.set("0.5",new b({color:new N(.5,0,0)})),this.no.set("0.6",new b({color:new N(.6,0,0)})),this.no.set("0.7",new b({color:new N(.7,0,0)})),this.no.set("0.8",new b({color:new N(.8,0,0)})),this.no.set("0.9",new b({color:new N(.9,0,0)})),this.no.set("1",new b({color:new N(1,0,0)})),this.eo=new Map,this.eo.set("0",new b({color:new N(0,0,0)})),this.eo.set("0.1",new b({color:new N(.1,0,0)})),this.eo.set("0.2",new b({color:new N(.2,0,0)})),this.eo.set("0.3",new b({color:new N(.3,0,0)})),this.eo.set("0.4",new b({color:new N(.4,0,0)})),this.eo.set("0.5",new b({color:new N(.5,0,0)})),this.eo.set("0.6",new b({color:new N(.6,0,0)})),this.eo.set("0.7",new b({color:new N(.7,0,0)})),this.eo.set("0.8",new b({color:new N(.8,0,0)})),this.eo.set("0.9",new b({color:new N(.9,0,0)})),this.eo.set("1",new b({color:new N(1,0,0)})),this.io=new b({color:"white"}),this.ro=new b({color:"white"}),this.oo=new b({color:"black"}),this.J={},this.Pt=null,this.G(),this.ao()}return t=e,(n=[{key:"add",value:function(t,n,e){var i=this;if(Array.isArray(t))for(var r=0;r>8&255]+Zi[t>>16&255]+Zi[t>>24&255]+"-"+Zi[255&e]+Zi[e>>8&255]+"-"+Zi[e>>16&15|64]+Zi[e>>24&255]+"-"+Zi[63&i|128]+Zi[i>>8&255]+"-"+Zi[i>>16&255]+Zi[i>>24&255]+Zi[255&s]+Zi[s>>8&255]+Zi[s>>16&255]+Zi[s>>24&255]).toLowerCase()}function Qi(t,e,i){return Math.max(e,Math.min(i,t))}function ts(t,e){return(t%e+e)%e}function es(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)}function is(t,e,i){return t!==e?(i-t)/(e-t):0}function ss(t,e,i){return(1-i)*t+i*e}function rs(t,e,i,s){return ss(t,e,1-Math.exp(-i*s))}function ns(t,e=1){return e-Math.abs(ts(t,2*e)-e)}function as(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*(3-2*t)}function hs(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function os(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ls(t,e){return t+Math.random()*(e-t)}function us(t){return t*(.5-Math.random())}function cs(t){void 0!==t&&(qi=t);t=qi+=1831565813,t=Math.imul(t^t>>>15,1|t);return(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function fs(t){return t*Ki}function ds(t){return t*Ji}function vs(t){return 0==(t&t-1)&&0!==t}function ps(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ms(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function gs(t,e,i,s,r){var n=Math.cos,a=Math.sin,h=n(i/2),o=a(i/2),l=n((e+s)/2),u=a((e+s)/2),c=n((e-s)/2),f=a((e-s)/2),d=n((s-e)/2),v=a((s-e)/2);switch(r){case"XYX":t.set(h*u,o*c,o*f,h*l);break;case"YZY":t.set(o*f,h*u,o*c,h*l);break;case"ZXZ":t.set(o*c,o*f,h*u,h*l);break;case"XZX":t.set(h*u,o*v,o*d,h*l);break;case"YXY":t.set(o*d,h*u,o*v,h*l);break;case"ZYZ":t.set(o*v,o*d,h*u,h*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function _s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function n(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}let ws={DEG2RAD:Ki,RAD2DEG:Ji,generateUUID:$i,clamp:Qi,euclideanModulo:ts,mapLinear:es,inverseLerp:is,lerp:ss,damp:rs,pingpong:ns,smoothstep:as,smootherstep:hs,randInt:os,randFloat:ls,randFloatSpread:us,seededRandom:cs,degToRad:fs,radToDeg:ds,isPowerOfTwo:vs,ceilPowerOfTwo:ps,floorPowerOfTwo:ms,setQuaternionFromProperEuler:gs,normalize:n,denormalize:_s};class Ms{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this.t=t,this.o=e,this.p=i,this._=s}static slerpFlat(t,e,i,s,r,n,a){let h=i[s+0],o=i[s+1],l=i[s+2],u=i[s+3];var i=r[n+0],s=r[n+1],c=r[n+2],r=r[n+3];if(0===a)t[e+0]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u;else if(1===a)t[e+0]=i,t[e+1]=s,t[e+2]=c,t[e+3]=r;else{if(u!==r||h!==i||o!==s||l!==c){let t=1-a;var n=h*i+o*s+l*c+u*r,f=0<=n?1:-1,d=1-n*n,n=(d>Number.EPSILON&&(d=Math.sqrt(d),n=Math.atan2(d,n*f),t=Math.sin(t*n)/d,a=Math.sin(a*n)/d),a*f);h=h*t+i*n,o=o*t+s*n,l=l*t+c*n,u=u*t+r*n,t===1-a&&(d=1/Math.sqrt(h*h+o*o+l*l+u*u),h*=d,o*=d,l*=d,u*=d)}t[e]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u}}static multiplyQuaternionsFlat(t,e,i,s,r,n){var a=i[s],h=i[s+1],o=i[s+2],i=i[s+3],s=r[n],l=r[n+1],u=r[n+2],r=r[n+3];return t[e]=a*r+i*s+h*u-o*l,t[e+1]=h*r+i*l+o*s-a*u,t[e+2]=o*r+i*u+a*l-h*s,t[e+3]=i*r-a*s-h*l-o*u,t}get x(){return this.t}set x(t){this.t=t,this.M()}get y(){return this.o}set y(t){this.o=t,this.M()}get z(){return this.p}set z(t){this.p=t,this.M()}get w(){return this._}set w(t){this._=t,this.M()}set(t,e,i,s){return this.t=t,this.o=e,this.p=i,this._=s,this.M(),this}clone(){return new this.constructor(this.t,this.o,this.p,this._)}copy(t){return this.t=t.x,this.o=t.y,this.p=t.z,this._=t.w,this.M(),this}setFromEuler(t,e=!0){var i=t.t,s=t.o,r=t.p,n=t.S,t=Math.cos,a=Math.sin,h=t(i/2),o=t(s/2),l=t(r/2),u=a(i/2),c=a(s/2),f=a(r/2);switch(n){case"XYZ":this.t=u*o*l+h*c*f,this.o=h*c*l-u*o*f,this.p=h*o*f+u*c*l,this._=h*o*l-u*c*f;break;case"YXZ":this.t=u*o*l+h*c*f,this.o=h*c*l-u*o*f,this.p=h*o*f-u*c*l,this._=h*o*l+u*c*f;break;case"ZXY":this.t=u*o*l-h*c*f,this.o=h*c*l+u*o*f,this.p=h*o*f+u*c*l,this._=h*o*l-u*c*f;break;case"ZYX":this.t=u*o*l-h*c*f,this.o=h*c*l+u*o*f,this.p=h*o*f-u*c*l,this._=h*o*l+u*c*f;break;case"YZX":this.t=u*o*l+h*c*f,this.o=h*c*l+u*o*f,this.p=h*o*f-u*c*l,this._=h*o*l-u*c*f;break;case"XZY":this.t=u*o*l-h*c*f,this.o=h*c*l-u*o*f,this.p=h*o*f+u*c*l,this._=h*o*l+u*c*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this.M(),this}setFromAxisAngle(t,e){var e=e/2,i=Math.sin(e);return this.t=t.x*i,this.o=t.y*i,this.p=t.z*i,this._=Math.cos(e),this.M(),this}setFromRotationMatrix(t){var t=t.elements,e=t[0],i=t[4],s=t[8],r=t[1],n=t[5],a=t[9],h=t[2],o=t[6],t=t[10],l=e+n+t;return 0Math.abs(t.z)?(this.t=-t.y,this.o=t.x,this.p=0):(this.t=0,this.o=-t.z,this.p=t.y)):(this.t=t.y*e.z-t.z*e.y,this.o=t.z*e.x-t.x*e.z,this.p=t.x*e.y-t.y*e.x),this._=i,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Qi(this.dot(t),-1,1)))}rotateTowards(t,e){var i=this.angleTo(t);return 0!==i&&(e=Math.min(1,e/i),this.slerp(t,e)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this.t*=-1,this.o*=-1,this.p*=-1,this.M(),this}dot(t){return this.t*t.t+this.o*t.o+this.p*t.p+this._*t._}lengthSq(){return this.t*this.t+this.o*this.o+this.p*this.p+this._*this._}length(){return Math.sqrt(this.t*this.t+this.o*this.o+this.p*this.p+this._*this._)}normalize(){var t=this.length();return 0===t?(this.t=0,this.o=0,this.p=0,this._=1):(this.t=this.t*(t=1/t),this.o=this.o*t,this.p=this.p*t,this._=this._*t),this.M(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){var i=t.t,s=t.o,r=t.p,t=t._,n=e.t,a=e.o,h=e.p,e=e._;return this.t=i*e+t*n+s*h-r*a,this.o=s*e+t*a+r*n-i*h,this.p=r*e+t*h+i*a-s*n,this._=t*e-i*n-s*a-r*h,this.M(),this}slerp(e,i){if(0!==i){if(1===i)return this.copy(e);var s,r,n=this.t,a=this.o,h=this.p,o=this._;let t=o*e._+n*e.t+a*e.o+h*e.p;t<0?(this._=-e._,this.t=-e.t,this.o=-e.o,this.p=-e.p,t=-t):this.copy(e),1<=t?(this._=o,this.t=n,this.o=a,this.p=h):(e=1-t*t)<=Number.EPSILON?(this._=(s=1-i)*o+i*this._,this.t=s*n+i*this.t,this.o=s*a+i*this.o,this.p=s*h+i*this.p,this.normalize()):(s=Math.sqrt(e),e=Math.atan2(s,t),r=Math.sin((1-i)*e)/s,i=Math.sin(i*e)/s,this._=o*r+this._*i,this.t=n*r+this.t*i,this.o=a*r+this.o*i,this.p=h*r+this.p*i,this.M())}return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),i=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),i*Math.sin(e),i*Math.cos(e))}equals(t){return t.t===this.t&&t.o===this.o&&t.p===this.p&&t._===this._}fromArray(t,e=0){return this.t=t[e],this.o=t[e+1],this.p=t[e+2],this._=t[e+3],this.M(),this}toArray(t=[],e=0){return t[e]=this.t,t[e+1]=this.o,t[e+2]=this.p,t[e+3]=this._,t}fromBufferAttribute(t,e){return this.t=t.getX(e),this.o=t.getY(e),this.p=t.getZ(e),this._=t.getW(e),this.M(),this}toJSON(){return this.toArray()}T(t){return this.M=t,this}M(){}*[Symbol.iterator](){yield this.t,yield this.o,yield this.p,yield this._}}class Gt{constructor(t=0,e=0,i=0){Gt.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Es.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Es.setFromAxisAngle(t,e))}applyMatrix3(t){var e=this.x,i=this.y,s=this.z,t=t.elements;return this.x=t[0]*e+t[3]*i+t[6]*s,this.y=t[1]*e+t[4]*i+t[7]*s,this.z=t[2]*e+t[5]*i+t[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){var e=this.x,i=this.y,s=this.z,t=t.elements,r=1/(t[3]*e+t[7]*i+t[11]*s+t[15]);return this.x=(t[0]*e+t[4]*i+t[8]*s+t[12])*r,this.y=(t[1]*e+t[5]*i+t[9]*s+t[13])*r,this.z=(t[2]*e+t[6]*i+t[10]*s+t[14])*r,this}applyQuaternion(t){var e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,t=t.w,h=2*(n*s-a*i),o=2*(a*e-r*s),l=2*(r*i-n*e);return this.x=e+t*h+n*l-a*o,this.y=i+t*o+a*h-r*l,this.z=s+t*l+r*o-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){var e=this.x,i=this.y,s=this.z,t=t.elements;return this.x=t[0]*e+t[4]*i+t[8]*s,this.y=t[1]*e+t[5]*i+t[9]*s,this.z=t[2]*e+t[6]*i+t[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){var i=t.x,s=t.y,t=t.z,r=e.x,n=e.y,e=e.z;return this.x=s*e-t*n,this.y=t*r-i*e,this.z=i*n-s*r,this}projectOnVector(t){var e=t.lengthSq();return 0===e?this.set(0,0,0):(e=t.dot(this)/e,this.copy(t).multiplyScalar(e))}projectOnPlane(t){return ys.copy(this).projectOnVector(t),this.sub(ys)}reflect(t){return this.sub(ys.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:(t=this.dot(t)/e,Math.acos(Qi(t,-1,1)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){var e=this.x-t.x,i=this.y-t.y,t=this.z-t.z;return e*e+i*i+t*t}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){var s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){t=t.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),t=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=t,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t.t,this.y=t.o,this.z=t.p,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){var t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ys=new Gt,Es=new Ms;class Ht{constructor(t,e,i,s,r,n,a,h,o,l,u,c,f,d,v,p){Ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,h,o,l,u,c,f,d,v,p)}set(t,e,i,s,r,n,a,h,o,l,u,c,f,d,v,p){var m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=s,m[1]=r,m[5]=n,m[9]=a,m[13]=h,m[2]=o,m[6]=l,m[10]=u,m[14]=c,m[3]=f,m[7]=d,m[11]=v,m[15]=p,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 Ht).fromArray(this.elements)}copy(t){var e=this.elements,t=t.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this}copyPosition(t){var e=this.elements,t=t.elements;return e[12]=t[12],e[13]=t[13],e[14]=t[14],this}setFromMatrix3(t){t=t.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(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){var e=this.elements,i=t.elements,s=1/xs.setFromMatrixColumn(t,0).length(),r=1/xs.setFromMatrixColumn(t,1).length(),t=1/xs.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*t,e[9]=i[9]*t,e[10]=i[10]*t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){var e,i,s,r,n=this.elements,a=t.x,h=t.y,o=t.z,l=Math.cos(a),a=Math.sin(a),u=Math.cos(h),h=Math.sin(h),c=Math.cos(o),o=Math.sin(o);return"XYZ"===t.order?(i=l*c,s=l*o,r=a*c,e=a*o,n[0]=u*c,n[4]=-u*o,n[8]=h,n[1]=s+r*h,n[5]=i-e*h,n[9]=-a*u,n[2]=e-i*h,n[6]=r+s*h,n[10]=l*u):"YXZ"===t.order?(e=u*o,i=h*c,n[0]=(r=u*c)+(s=h*o)*a,n[4]=i*a-e,n[8]=l*h,n[1]=l*o,n[5]=l*c,n[9]=-a,n[2]=e*a-i,n[6]=s+r*a,n[10]=l*u):"ZXY"===t.order?(e=u*o,i=h*c,n[0]=(s=u*c)-(r=h*o)*a,n[4]=-l*o,n[8]=i+e*a,n[1]=e+i*a,n[5]=l*c,n[9]=r-s*a,n[2]=-l*h,n[6]=a,n[10]=l*u):"ZYX"===t.order?(e=l*c,i=l*o,r=a*c,s=a*o,n[0]=u*c,n[4]=r*h-i,n[8]=e*h+s,n[1]=u*o,n[5]=s*h+e,n[9]=i*h-r,n[2]=-h,n[6]=a*u,n[10]=l*u):"YZX"===t.order?(s=l*u,e=l*h,i=a*u,r=a*h,n[0]=u*c,n[4]=r-s*o,n[8]=i*o+e,n[1]=o,n[5]=l*c,n[9]=-a*c,n[2]=-h*c,n[6]=e*o+i,n[10]=s-r*o):"XZY"===t.order&&(e=l*u,i=l*h,s=a*u,r=a*h,n[0]=u*c,n[4]=-o,n[8]=h*c,n[1]=e*o+r,n[5]=l*c,n[9]=i*o-s,n[2]=s*o-i,n[6]=a*c,n[10]=r*o+e),n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ss,t,Ts)}lookAt(t,e,i){var s=this.elements;return Ls.subVectors(t,e),0===Ls.lengthSq()&&(Ls.z=1),Ls.normalize(),As.crossVectors(i,Ls),0===As.lengthSq()&&(1===Math.abs(i.z)?Ls.x+=1e-4:Ls.z+=1e-4,Ls.normalize(),As.crossVectors(i,Ls)),As.normalize(),Rs.crossVectors(Ls,As),s[0]=As.x,s[4]=Rs.x,s[8]=Ls.x,s[1]=As.y,s[5]=Rs.y,s[9]=Ls.y,s[2]=As.z,s[6]=Rs.z,s[10]=Ls.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){var t=t.elements,e=e.elements,i=this.elements,s=t[0],r=t[4],n=t[8],a=t[12],h=t[1],o=t[5],l=t[9],u=t[13],c=t[2],f=t[6],d=t[10],v=t[14],p=t[3],m=t[7],g=t[11],t=t[15],_=e[0],w=e[4],M=e[8],y=e[12],E=e[1],x=e[5],b=e[9],S=e[13],T=e[2],A=e[6],R=e[10],L=e[14],C=e[3],N=e[7],I=e[11],e=e[15];return i[0]=s*_+r*E+n*T+a*C,i[4]=s*w+r*x+n*A+a*N,i[8]=s*M+r*b+n*R+a*I,i[12]=s*y+r*S+n*L+a*e,i[1]=h*_+o*E+l*T+u*C,i[5]=h*w+o*x+l*A+u*N,i[9]=h*M+o*b+l*R+u*I,i[13]=h*y+o*S+l*L+u*e,i[2]=c*_+f*E+d*T+v*C,i[6]=c*w+f*x+d*A+v*N,i[10]=c*M+f*b+d*R+v*I,i[14]=c*y+f*S+d*L+v*e,i[3]=p*_+m*E+g*T+t*C,i[7]=p*w+m*x+g*A+t*N,i[11]=p*M+m*b+g*R+t*I,i[15]=p*y+m*S+g*L+t*e,this}multiplyScalar(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){var t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],h=t[9],o=t[13],l=t[2],u=t[6],c=t[10],f=t[14];return t[3]*(+r*h*u-s*o*u-r*a*c+i*o*c+s*a*f-i*h*f)+t[7]*(+e*h*f-e*o*c+r*n*c-s*n*f+s*o*l-r*h*l)+t[11]*(+e*o*u-e*a*f-r*n*u+i*n*f+r*a*l-i*o*l)+t[15]*(-s*a*l-e*h*u+e*a*c+s*n*u-i*n*c+i*h*l)}transpose(){var t=this.elements,e=t[1];return t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){var s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){var t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],h=t[6],o=t[7],l=t[8],u=t[9],c=t[10],f=t[11],d=t[12],v=t[13],p=t[14],m=t[15],g=u*p*o-v*c*o+v*h*f-a*p*f-u*h*m+a*c*m,_=d*c*o-l*p*o-d*h*f+n*p*f+l*h*m-n*c*m,w=l*v*o-d*u*o+d*a*f-n*v*f-l*a*m+n*u*m,M=d*u*h-l*v*h-d*a*c+n*v*c+l*a*p-n*u*p,y=e*g+i*_+s*w+r*M;return 0==y?this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0):(t[0]=g*(g=1/y),t[1]=(v*c*r-u*p*r-v*s*f+i*p*f+u*s*m-i*c*m)*g,t[2]=(a*p*r-v*h*r+v*s*o-i*p*o-a*s*m+i*h*m)*g,t[3]=(u*h*r-a*c*r-u*s*o+i*c*o+a*s*f-i*h*f)*g,t[4]=_*g,t[5]=(l*p*r-d*c*r+d*s*f-e*p*f-l*s*m+e*c*m)*g,t[6]=(d*h*r-n*p*r-d*s*o+e*p*o+n*s*m-e*h*m)*g,t[7]=(n*c*r-l*h*r+l*s*o-e*c*o-n*s*f+e*h*f)*g,t[8]=w*g,t[9]=(d*u*r-l*v*r-d*i*f+e*v*f+l*i*m-e*u*m)*g,t[10]=(n*v*r-d*a*r+d*i*o-e*v*o-n*i*m+e*a*m)*g,t[11]=(l*a*r-n*u*r-l*i*o+e*u*o+n*i*f-e*a*f)*g,t[12]=M*g,t[13]=(l*v*s-d*u*s+d*i*c-e*v*c-l*i*p+e*u*p)*g,t[14]=(d*a*s-n*v*s-d*i*h+e*v*h+n*i*p-e*a*p)*g,t[15]=(n*u*s-l*a*s+l*i*h-e*u*h-n*i*c+e*a*c)*g,this)}scale(t){var e=this.elements,i=t.x,s=t.y,t=t.z;return e[0]*=i,e[4]*=s,e[8]*=t,e[1]*=i,e[5]*=s,e[9]*=t,e[2]*=i,e[6]*=s,e[10]*=t,e[3]*=i,e[7]*=s,e[11]*=t,this}getMaxScaleOnAxis(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];return Math.sqrt(Math.max(e,t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){var e=Math.cos(t),t=Math.sin(t);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this}makeRotationY(t){var e=Math.cos(t),t=Math.sin(t);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this}makeRotationZ(t){var e=Math.cos(t),t=Math.sin(t);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){var i=Math.cos(e),e=Math.sin(e),s=1-i,r=t.x,n=t.y,t=t.z,a=s*r,h=s*n;return this.set(a*r+i,a*n-e*t,a*t+e*n,0,a*n+e*t,h*n+i,h*t-e*r,0,a*t-e*n,h*t+e*r,s*t*t+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){var s=this.elements,r=e.t,n=e.o,a=e.p,e=e._,h=r+r,o=n+n,l=a+a,u=r*h,c=r*o,r=r*l,f=n*o,n=n*l,a=a*l,h=e*h,o=e*o,e=e*l,l=i.x,d=i.y,i=i.z;return s[0]=(1-(f+a))*l,s[1]=(c+e)*l,s[2]=(r-o)*l,s[3]=0,s[4]=(c-e)*d,s[5]=(1-(u+a))*d,s[6]=(n+h)*d,s[7]=0,s[8]=(r+o)*i,s[9]=(n-h)*i,s[10]=(1-(u+f))*i,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){var s=this.elements;let r=xs.set(s[0],s[1],s[2]).length();var n=xs.set(s[4],s[5],s[6]).length(),a=xs.set(s[8],s[9],s[10]).length(),t=(this.determinant()<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],bs.copy(this),1/r),s=1/n,h=1/a;return bs.elements[0]*=t,bs.elements[1]*=t,bs.elements[2]*=t,bs.elements[4]*=s,bs.elements[5]*=s,bs.elements[6]*=s,bs.elements[8]*=h,bs.elements[9]*=h,bs.elements[10]*=h,e.setFromRotationMatrix(bs),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=Xi){var h=this.elements,o=2*r/(e-t),l=2*r/(i-s),e=(e+t)/(e-t),t=(i+s)/(i-s);let u,c;if(a===Xi)u=-(n+r)/(n-r),c=-2*n*r/(n-r);else{if(a!==Yi)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);u=-n/(n-r),c=-n*r/(n-r)}return h[0]=o,h[4]=0,h[8]=e,h[12]=0,h[1]=0,h[5]=l,h[9]=t,h[13]=0,h[2]=0,h[6]=0,h[10]=u,h[14]=c,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=Xi){var h=this.elements,o=1/(e-t),l=1/(i-s),u=1/(n-r),e=(e+t)*o,t=(i+s)*l;let c,f;if(a===Xi)c=(n+r)*u,f=-2*u;else{if(a!==Yi)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);c=r*u,f=-1*u}return h[0]=2*o,h[4]=0,h[8]=0,h[12]=-e,h[1]=0,h[5]=2*l,h[9]=0,h[13]=-t,h[2]=0,h[6]=0,h[10]=f,h[14]=-c,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){var e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(e,i=0){for(let t=0;t<16;t++)this.elements[t]=e[t+i];return this}toArray(t=[],e=0){var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let xs=new Gt,bs=new Ht,Ss=new Gt(0,0,0),Ts=new Gt(1,1,1),As=new Gt,Rs=new Gt,Ls=new Gt;class Cs{addEventListener(t,e){void 0===this.A&&(this.A={});var i=this.A;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){var i;return void 0!==this.A&&void 0!==(i=this.A)[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){var i;void 0!==this.A&&void 0!==(t=this.A[t])&&-1!==(i=t.indexOf(e))&&t.splice(i,1)}dispatchEvent(i){if(void 0!==this.A){var t=this.A[i.type];if(void 0!==t){i.target=this;var s=t.slice(0);for(let t=0,e=s.length;t>>0}enable(t){this.mask|=1<({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()})),l.maxInstanceCount=this.L,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.geometryCount=this._geometryCount,l.matricesTexture=this._matricesTexture.toJSON(i),null!==this._colorsTexture&&(l.colorsTexture=this._colorsTexture.toJSON(i)),null!==this.boundingSphere&&(l.boundingSphere={center:l.boundingSphere.center.toArray(),radius:l.boundingSphere.radius}),null!==this.boundingBox)&&(l.boundingBox={min:l.boundingBox.min.toArray(),max:l.boundingBox.max.toArray()}),this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(i).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(l.environment=this.environment.toJSON(i).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=u(i.geometries,this.geometry);var c=this.geometry.parameters;if(void 0!==c&&void 0!==c.shapes){var f=c.shapes;if(Array.isArray(f))for(let t=0,e=f.length;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,nr),nr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return i=0=-t.constant}intersectsTriangle(t){return!this.isEmpty()&&(this.getCenter(dr),vr.subVectors(this.max,dr),hr.subVectors(t.a,dr),or.subVectors(t.b,dr),lr.subVectors(t.c,dr),ur.subVectors(or,hr),cr.subVectors(lr,or),fr.subVectors(hr,lr),!!gr([0,-ur.z,ur.y,0,-cr.z,cr.y,0,-fr.z,fr.y,ur.z,0,-ur.x,cr.z,0,-cr.x,fr.z,0,-fr.x,-ur.y,ur.x,0,-cr.y,cr.x,0,-fr.y,fr.x,0],hr,or,lr,vr))&&!!gr([1,0,0,0,1,0,0,0,1],hr,or,lr,vr)&&(pr.crossVectors(ur,cr),gr([pr.x,pr.y,pr.z],hr,or,lr,vr))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,nr).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(nr).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(rr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),rr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),rr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),rr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),rr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),rr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),rr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),rr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(rr)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let rr=[new Gt,new Gt,new Gt,new Gt,new Gt,new Gt,new Gt,new Gt],nr=new Gt,ar=new sr,hr=new Gt,or=new Gt,lr=new Gt,ur=new Gt,cr=new Gt,fr=new Gt,dr=new Gt,vr=new Gt,pr=new Gt,mr=new Gt;function gr(i,s,r,n,a){for(let t=0,e=i.length-3;t<=e;t+=3){mr.fromArray(i,t);var h=a.x*Math.abs(mr.x)+a.y*Math.abs(mr.y)+a.z*Math.abs(mr.z),o=s.dot(mr),l=r.dot(mr),u=n.dot(mr);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>h)return!1}return!0}let _r=new sr,wr=new Gt,Mr=new Gt;class yr{constructor(t=new Gt,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(i,t){var s=this.center;void 0!==t?s.copy(t):_r.setFromPoints(i).getCenter(s);let r=0;for(let t=0,e=i.length;tthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){var e;return this.isEmpty()?(this.center.copy(t),this.radius=0):(wr.subVectors(t,this.center),(t=wr.lengthSq())>this.radius*this.radius&&(e=.5*((t=Math.sqrt(t))-this.radius),this.center.addScaledVector(wr,e/t),this.radius+=e)),this}union(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Mr.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(wr.copy(t.center).add(Mr)),this.expandByPoint(wr.copy(t.center).sub(Mr)))),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}let Er=new Gt,xr=new Gt,br=new _;class Sr{constructor(t=new Gt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){i=Er.subVectors(i,e).cross(xr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){var i=t.delta(Er),s=this.normal.dot(i);return 0===s?0===this.distanceToPoint(t.start)?e.copy(t.start):null:(s=-(t.start.dot(this.normal)+this.constant)/s)<0||1{e.includes(t)||e.push(t)}),e}static uniqWithArrayTwo(i){if(i.length<1)return[];i=JSON.parse(JSON.stringify(i));let s=[];for(let e=0;e!s.includes(t)),i[e]=t,s=s.concat(t)}return i.filter(t=>0t,fromReference:t=>t},[bi]:{transfer:Li,primaries:Ci,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Ai]:{transfer:Ri,primaries:Ni,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(Dr),fromReference:t=>t.applyMatrix3(Pr)},[Ti]:{transfer:Li,primaries:Ni,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(Dr),fromReference:t=>t.applyMatrix3(Pr).convertLinearToSRGB()}},Ur=new Set([Si,Ai]),zt={enabled:!0,C:Si,get workingColorSpace(){return this.C},set workingColorSpace(t){if(!Ur.has(t))throw new Error(`Unsupported working color space, "${t}".`);this.C=t},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(e=Or[e].toReference,(0,Or[i].fromReference)(e(t))):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.C,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.C)},getPrimaries:function(t){return Or[t].primaries},getTransfer:function(t){return t===xi?Ri:Or[t].transfer},getLuminanceCoefficients:function(t,e=this.C){return t.fromArray(Or[e].luminanceCoefficients)}};function Fr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Br(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let kr=.001,Gr=Si,Hr=Si,Vr=!1,zr=!1;function Wr(){return Vr}function jr(t){Vr=t}function Xr(){return Hr}function Yr(t){Hr=t}function Zr(){return kr}function qr(t){kr=t}function Kr(){return zr}function Jr(t){zr=t}let $r={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},Qr={h:0,s:0,l:0},tn={h:0,s:0,l:0};function en(t,e,i){return i<0&&(i+=1),1>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,zt.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=zt.workingColorSpace){return this.r=t,this.g=e,this.b=i,zt.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=zt.workingColorSpace){return t=ts(t,1),e=Qi(e,0,1),i=Qi(i,0,1),0===e?this.r=this.g=this.b=i:(this.r=en(e=2*i-(i=i<=.5?i*(1+e):i+e-i*e),i,t+1/3),this.g=en(e,i,t),this.b=en(e,i,t-1/3)),zt.toWorkingColorSpace(this,s),this}setStyle(e,i=Gr){function s(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(a=/^(\w+)\(([^\)]*)\)/.exec(e)){let t;var r=a[1],n=a[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return s(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,i);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return s(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,i);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return s(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,i);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(e)){var r=a[1],a=r.length;if(3===a)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,i);if(6===a)return this.setHex(parseInt(r,16),i);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&0>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&s|128]+e[s>>8&255]+"-"+e[s>>16&255]+e[s>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255];return e.length=0,t.toUpperCase()}static findNearNthPowerOfTwo(t){t-=1;return(t=(t=(t=(t=(t|=t>>1)|t>>2)|t>>4)|t>>8)|t>>16)<0?1:1+t}static rgbToArray(t){var e=new Wt;return e.setStyle(t),[e.r,e.g,e.b]}static toRgba(t){var e;return void 0===t?t:"number"!=typeof t?3<=(e=t.split(",")).length?"rgba("+parseInt(e[0])+","+parseInt(e[1])+","+parseInt(e[2])+",1)":t:"rgba("+parseInt(255*new Wt(t).r)+","+parseInt(255*new Wt(t).g)+","+parseInt(255*new Wt(t).b)+",1)"}static toColor(t){var e;return"number"==typeof t?t:3<=(e=t.split(",")).length?parseInt(e[0])<<16|parseInt(e[1])<<8|parseInt(e[2]):(console.error("color format error",t),0)}static cov(r){var t=[],e=[0,0],n=[];for(let t=0;tthis.nt.rt[1]||ethis.st.setZoom({animate:!1,zoom:t.destination[0]})).$(()=>this.st.ot.ht(i)),this.st.ot.lt(i.X()))},ut(){var t=this.st.ct.isPerspectiveCamera?this.ft():this.dt();return this.vt(t)},gt(t,e){this.st.ot.ht(e),this._t({zoom:t.zoom,animate:!1,finish:t.finish})},_t(i){this.nt.zoom=i.zoom;var t=Number.isFinite(i.duration)?i.duration:.5,s=this.wt(this.nt.zoom);let r=this.Mt(s),n=this.yt.object.position.distanceTo(this.yt.target),e=(new Gt).copy(this.yt.object.position).sub(this.yt.target).normalize(),a=(new Gt).copy(e).multiplyScalar(r-n);if(this.st.ct.isPerspectiveCamera)if("animate"in i&&!i.animate)this.yt.update({offset:a,dirction:r-n}),i.finish&&i.finish();else{let e=new nn({src:[0,0,0],dest:[a.x,a.y,a.z]});e.K(t).J(t=>{"PerspectiveCamera"===this.st.ct.type?this.yt.update({offset:new Gt(t.delta[0],t.delta[1],t.delta[2]),dirction:r-n}):this.gt(i,e)}).$(()=>{this.st.ot.ht(e),i.finish&&i.finish()}),this.st.ot.lt(e.X())}else if("animate"in i&&!i.animate){var h=this.Et(s);this.st.ct.zoom=1/h,this.st.ct.updateProjectionMatrix(),this.st.bt.xt(),this.yt.update({offset:a}),i.finish&&i.finish()}else{let e=new nn({src:[this.dt()],dest:[s]});e.K(t).J(t=>{"OrthographicCamera"===this.st.ct.type?(t=this.Et(t.destination[0]),this.st.ct.zoom=1/t,this.st.ct.updateProjectionMatrix(),this.st.bt.xt(),this.st.enableUpdateRender(),this.st.St()):this.gt(i,e)}).$(()=>{this.yt.update({offset:a,dirction:r-n}),this.st.ot.ht(e),i.finish&&i.finish()}),this.st.ot.lt(e.X())}},Tt(t){this.nt.rt=t,this.At(),this.yt.update()},At(){var t=this.wt(this.nt.rt[0]),e=this.wt(this.nt.rt[1]);this.yt.maxDistance=this.Mt(t),this.yt.minDistance=this.Mt(e),this.yt.minZoom=1/this.Et(t),this.yt.maxZoom=1/this.Et(e)},wt(t){var e=this.Rt.length-1,i=(--t,t=Math.max(0,Math.min(t,e)),Math.floor(t)),t=t-i,s=Math.max(0,Math.min(i,e)),e=Math.max(0,Math.min(i+1,e)),s=this.Rt[s]-this.Rt[e];return this.Rt[i]-s*t},vt(e){let i=0,s=.1,r=!1;for(let t=0;tthis.Rt[t+1]){i=t,s=(this.Rt[t]-e)/(this.Rt[t]-this.Rt[t+1]),r=!0;break}let t=null;var n;return t=r?parseFloat((i+1+s).toFixed(2)):(n=this.Rt.length-1,e<=this.Rt[n]?1+n:1)},Mt(t){return t/100*(this.st.bt.renderer.domElement.clientHeight/Ir.getMapScaleInfo())/2/Math.tan(u.FOV/2*u.DEG2RAD)},ft(){return(new Gt).copy(this.yt.object.position).sub(this.yt.target).length()*(100*Math.tan(u.FOV/2*u.DEG2RAD)*2/(this.st.bt.renderer.domElement.clientHeight/Ir.getMapScaleInfo()))},dt(){var t=this.st.ct.top,e=this.st.ct.bottom;return Math.abs(t-e)*Ir.getMapScaleInfo()*100/this.st.bt.renderer.domElement.clientHeight/this.st.ct.zoom},Et(t){var e=this.st.Lt.top,i=this.st.Lt.bottom;return t/(Math.abs(e-i)*Ir.getMapScaleInfo()*100/this.st.bt.renderer.domElement.clientHeight)}})}function hn(t){Object.assign(t.prototype,{Ct(t){let e=this.yt,i=t.finish;var s;"animate"in t&&!t.animate?(e.update({phi:(u.TILT_UPPER_BOUND-t.tilt)*u.DEG2RAD}),e.update(),i&&i()):(null===this.Nt&&(this.Nt=new nn),s=Number.isFinite(t.duration)?t.duration:.5,this.Nt.Y([this.st.getTilt()]).Z([t.tilt]).K(s).J(t=>{e.update({phi:(u.TILT_UPPER_BOUND-t.destination[0])*u.DEG2RAD})}).$(()=>{e.update({phi:(u.TILT_UPPER_BOUND-t.tilt)*u.DEG2RAD}),e.update(),this.st.ot.ht(this.Nt),i&&i()}),this.st.ot.lt(this.Nt.X()))},It(){let t=rn.round(-this.yt.getAzimuthalAngle()*u.RAD2DEG);return 360<(t=t<0?360+t:t)&&(t%=360),t},Pt(t,e){let i=-t%360*u.DEG2RAD,s=(i=!1===e?-t*u.DEG2RAD:i)-this.yt.getAzimuthalAngle();return s=0!==s&&e?Math.sin(s)/Math.abs(Math.sin(s))*Math.acos(Math.cos(s)):s},Dt(i){let s=void 0!==i.loop&&i.loop;var t=void 0!==i.direction?i.direction:0,e=void 0===i.minimumAngleTransformation||i.minimumAngleTransformation,r=this.yt.getAzimuthalAngle();let n;if(n=s?0===t?r-2*Math.PI:2*Math.PI+r:r+this.Pt(i.rotation,e),!("animate"in i)||i.animate){let t=i&&i.duration&&Number.isFinite(i.duration)?i.duration:.5,e=new nn({src:[r],dest:[n]});return e.K(t).Ot(s).J(t=>{this.yt.update({theta:t.destination[0]})}).$(()=>{s||this.st.ot.ht(e),i.finish&&i.finish()}),this.st.ot.lt(e.X()),e}this.yt.update({theta:n}),i.finish&&i.finish()}})}function on(t){Object.assign(t.prototype,{Ut(){var t=this.yt.target,e=this.st.Ft[0];return{x:parseFloat((e.x+t.x).toFixed(4)),y:parseFloat((e.y-t.z).toFixed(4))}},Bt(i){let s=this.yt,t=this.st.Ft[0],r=i.x-t.x,n=-i.y+t.y,a=s.target.x,h=s.target.z,e=i.height,o=!!e&&Number.isFinite(e),l,u;if(o?(u=s.target.y,l=e):u=l=0,"animate"in i&&i.animate){let t=Number.isFinite(i.duration)?i.duration:.5,e=new nn({src:[a,u,h],dest:[r,l,n]});e.K(t).J(t=>{s.panAdd({x:t.delta[0],y:t.delta[1],z:t.delta[2]}),s.update(),this.st.bt.xt()}).$(()=>{this.st.ot.ht(e),this.st.bt.xt(),i.finish&&i.finish()}),this.st.ot.lt(e.X())}else s.panAdd({x:r-a,y:l-u,z:n-h}),s.update(),i.finish&&i.finish(),this.st.bt.xt()},kt(e,i){let s=this.yt,t=()=>{this.nt.Gt(e.Ht).level=i.level,this.st.bt.Vt(),this.st.Wt.zt();var t={type:"levelChanged",level:i.level};e!==this.st.jt&&(t.buildingID=e.Ht),this.st.Yt.Xt(t),this.enableDragRange&&s.saveState(),this.st.bt.xt(),this.st.Zt(),i.finish&&i.finish(i.level)};e===this.st.jt||this.st.qt?this.Kt(e,{level:i.level,animate:i.animate,duration:i.duration,callback:i.callback,finish:()=>{t()}}):t()},Kt(t,e){var i=void 0!==e.duration?e.duration:.5,s=void 0===e.animate||e.animate;let r=this.yt;var n=r.target.y;let a=t.getFloor(e.level).Jt,h={type:"updateCameraHeight"};s?(null===this.$t&&(this.$t=new nn),this.$t.Y([n]).Z([a]).K(i).J(t=>{this.st.Yt.Xt(h),r.panUp(t.delta[0]),r.update()}).$(()=>{r.panUp(a-r.target.y),r.update(),e.finish&&e.finish()}),this.st.ot.lt(this.$t.X()),e.callback&&e.callback(this.$t)):(r.panUp(a-n),r.update(),e.callback&&e.callback(null),e.finish&&e.finish())}})}Object.assign(nn.prototype,{Qt(){for(var t in this)this[""+t]=null,delete this[""+t]},Y(t){return this.N=t,this},Z(t){return this.I=t,this},K(t){return this.B=t*u.THOUSAND,this},et(t){return this.U=t*u.THOUSAND,this},J(t){return this.V=t,this},$(t){return this.W=t,this},Ot(t){return this.k=t,this},X(){return this.H=!1,this.P&&(this.O=this.P.te),this},ee(){var t=new this.constructor({src:this.N,dest:this.I});return t.O=this.O,t.U=this.U,t.B=this.B,t.k=this.k,t.V=this.V,t.W=this.W,t},tt(){var t=this.I.concat(),e=this.N.concat();return this.N=t,this.I=e,this}});class ln{constructor(t,e){this.start=t??0,this.stop=e??0}}function C(t){return null!=t}class un{constructor(t=null,e=null){this.center=t?.clone(),this.radius=e}get valid(){return null!==this.center&&null!==this.radius}reset(){this.center=null,this.radius=null}static computePlaneDistances(t,e,i,s){C(s)||(s=new ln);var r=new Gt,e=(r.subVectors(t.center,e),i.dot(r));return s.start=e-t.radius,s.stop=e+t.radius,s}static clone(t,e){if(C(t))return C(e)?(e.center=t.center.clone(),e.radius=t.radius,e):new un(t.center,t.radius)}static expand(t,e,i){i=un.clone(t,i);t=e.distance(i.center);return t>i.radius&&(i.radius=t),i}static union(t,e,i){C(i)||(i=new un);var s=t.center,r=t.radius,n=e.center,a=e.radius,h=new Gt,n=(h.subVectors(n,s),h.length());return n+a<=r?un.clone(t,i):n+r<=a?un.clone(e,i):(t=.5*(r+n+a),(e=h.clone()).multiplyScalar((t-r)/n),e.add(s),i.center=e.clone(),i.radius=t),i}static equals(t,e){return t===e||C(t)&&C(e)&&t.equals(e.center)&&t.radius===e.radius}}class cn{constructor(t){this.yt=t,this.ie=new ln,this.se=new un}static getMeshBoudinggSphere(t){var t=(new sr).setFromObject(t),e=new Gt,i=(t.getCenter(e),new Gt),t=(t.getSize(i),.5*i.length());return new un(e,t)}static getSceneBoudingSphere(t,i){t.traverse(t=>{let e;"Mesh"===t.type||"SkinnedMesh"===t.type?e=cn.getMeshBoudinggSphere(t):"Scene"!==t.type&&"Group"!==t.type&&"DirectionalLight"!==t.type&&"AmbientLight"!==t.type&&(e=new un(t.position,0)),!e||isNaN(e.radius)||isNaN(e.center.x)||isNaN(e.center.y)||isNaN(e.center.z)||(i.valid||un.clone(e,i),un.union(e,i,i))})}reset(){this.re()}update(t){this.ne(t)}}Object.assign(cn.prototype,{ae(){var t,e,i;!this.se.valid||this.se.radius<=0||({target:i,object:t}=this.yt,(t.far>u.CAMERA_FAR||void 0===t.userData.far)&&(t.userData.far=Math.max(t.far,t.userData.far??0)),void 0===t.userData.near&&(t.userData.near=t.near),e=t.position,i=i.clone().sub(e).normalize(),un.computePlaneDistances(this.se,e,i,this.ie),this.ie.start>=this.ie.stop)||(t.near=Math.max(this.ie.start,t.userData.near),t.far=this.ie.stop,t.updateProjectionMatrix())},re(){this.se.reset()},ne(t){t.forEach(t=>{t&&cn.getSceneBoudingSphere(t,this.se)}),this.ae()}});class fn{constructor(t,e){this.he=t,this.oe=e}}Object.assign(fn.prototype,{le(t){return!1},ue(t,e){}});let dn={NONE:0,POINT:1,LINE:2,POLYGON:4,MULTIPOINT:8,MULTILINE:16,MULTIPOLYGON:32,GROUP:64,EXTENT:1024,EXTERNALMODEL:2048,MODEL:4096,FACILITY:8192,LABEL:16384,EXTENTGROUP:1<<20,EXTERNALMODELGROUP:1<<21,MODELGROUP:1<<22,FACILITYGROUP:1<<23,LABELGROUP:1<<24},vn=(Object.freeze(dn),{triangulate:function(h,o,l){l=l||2;var u=o&&o.length,c=u?o[0]*l:h.length;let f=pn(h,0,c,l,!0);var d=[];if(f&&f.next!==f.prev){let e,i,s,r,n,a,t;if(u&&(f=En(h,o,f,l)),h.length>80*l){e=s=h[0],i=r=h[1];for(let t=l;ts&&(s=n),a>r&&(r=a);t=0!==(t=Math.max(s-e,r-i))?1/t:0}gn(f,d,l,e,i,t)}return d}});function pn(t,e,i,s,r){let n,a;if(r===0=e;n-=s)a=Vn(n,t[n],t[n+1],a);return a&&Dn(a,a.next)&&(zn(a),a=a.next),a}function mn(t,e){if(!t)return t;e=e||t;let i=t,s;do{if(s=!1,i.steiner||!Dn(i,i.next)&&0!==Pn(i.prev,i,i.next))i=i.next;else{if(zn(i),(i=e=i.prev)===i.next)break;s=!0}}while(s||i!==e);return e}function gn(s,r,n,a,h,o,l){if(s){!l&&o&&An(s,a,h,o);let t=s,e,i;for(;s.prev!==s.next;)if(e=s.prev,i=s.next,o?wn(s,a,h,o):_n(s))r.push(e.i/n),r.push(s.i/n),r.push(i.i/n),zn(s),s=i.next,t=i.next;else if((s=i)===t){l?1===l?gn(s=Mn(mn(s),r,n),r,n,a,h,o,2):2===l&&yn(s,r,n,a,h,o):gn(mn(s),r,n,a,h,o,1);break}}}function _n(t){var e=t.prev,i=t,s=t.next;if(0<=Pn(e,i,s))return!1;let r=t.next.next;for(;r!==t.prev;){if(Nn(e.x,e.y,i.x,i.y,s.x,s.y,r.x,r.y)&&0<=Pn(r.prev,r,r.next))return!1;r=r.next}return!0}function wn(t,e,i,s){var r=t.prev,n=t,a=t.next;if(0<=Pn(r,n,a))return!1;var h=(r.xn.x?r.x>a.x?r:a:n.x>a.x?n:a).x,u=(r.y>n.y?r.y>a.y?r:a:n.y>a.y?n:a).y,c=Ln(h,o,e,i,s),f=Ln(l,u,e,i,s);let d=t.prevZ,v=t.nextZ;for(;d&&d.z>=c&&v&&v.z<=f;){if(d!==t.prev&&d!==t.next&&Nn(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=Pn(d.prev,d,d.next))return!1;if(d=d.prevZ,v!==t.prev&&v!==t.next&&Nn(r.x,r.y,n.x,n.y,a.x,a.y,v.x,v.y)&&0<=Pn(v.prev,v,v.next))return!1;v=v.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Nn(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=Pn(d.prev,d,d.next))return!1;d=d.prevZ}for(;v&&v.z<=f;){if(v!==t.prev&&v!==t.next&&Nn(r.x,r.y,n.x,n.y,a.x,a.y,v.x,v.y)&&0<=Pn(v.prev,v,v.next))return!1;v=v.nextZ}return!0}function Mn(t,e,i){let s=t;do{var r=s.prev,n=s.next.next;!Dn(r,n)&&On(r,s,s.next,n)&&kn(r,n)&&kn(n,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(n.i/i),zn(s),zn(s.next),s=t=n),s=s.next}while(s!==t);return mn(s)}function yn(t,e,i,s,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){var h;if(a.i!==t.i&&In(a,t))return h=Hn(a,t),a=mn(a,a.next),h=mn(h,h.next),gn(a,e,i,s,r,n),void gn(h,e,i,s,r,n);t=t.next}}while((a=a.next)!==t)}function En(t,e,i,s){var r=[];let n,a,h,o,l;for(n=0,a=e.length;n=s.next.y&&s.next.y!==s.y){var e=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(e<=r&&e>a){if((a=e)===r){if(n===s.y)return s;if(n===s.next.y)return s.next}h=s.x=s.x&&s.x>=l&&r!==s.x&&Nn(nh.x||s.x===h.x&&Tn(h,s)))&&(h=s,t=e),(s=s.next)!==o;);}return h}function Tn(t,e){return Pn(t.prev,t,e.prev)<0&&Pn(e.next,t,t.next)<0}function An(t,e,i,s){let r=t;for(;null===r.z&&(r.z=Ln(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,(r=r.next)!==t;);r.prevZ.nextZ=null,r.prevZ=null,Rn(r)}function Rn(t){let e,i,s,r,n,a,h,o,l=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,s=i,h=0,e=0;e=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Fn(t){return 0n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),(i=i.next)!==t;);return s}function Hn(t,e){var i=new Wn(t.i,t.x,t.y),s=new Wn(e.i,e.x,e.y),r=t.next,n=e.prev;return(t.next=e).prev=t,(i.next=r).prev=i,(s.next=i).prev=s,(n.next=s).prev=n,s}function Vn(t,e,i,s){t=new Wn(t,e,i);return s?(t.next=s.next,(t.prev=s).next.prev=t,s.next=t):(t.prev=t).next=t,t}function zn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Wn(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function jn(i,s,r,n){let a=0;for(let t=s,e=r-n;t-Kn},pe(t){return t>Kn},me(t){return t<-Kn},ge(t,e,i){e=(t.x-i.x)*(e.y-i.y)-(e.x-i.x)*(t.y-i.y);return Math.abs(e)=Math.min(a,t)&&o>r.x&&o!==a&&(o===t&&0<(h-r.y)*(e-r.y)?n+=2:n++):o<=Math.max(a,t)&&o>=Math.min(a,t)&&o>r.x&&(o===t&&0<(h-r.y)*(e-r.y)?n+=2:n++)}}return 0i.y!=o.y>i.y&&i.x<(o.x-h.x)*(i.y-h.y)/(o.y-h.y)+h.x&&(n=!n,h.y>o.y?a++:a--),r=t}return 0!=a},isPolygonInPolygon(t,e){var i=Object.assign([],t),s=Object.assign([],e);i.push(i[0]),s.push(s[0]);for(let t=0;ti.x||i.yr||t.ye)},be(t,e,i){var s=Math.min(i.x,e.x),r=Math.max(i.x,e.x),n=Math.min(i.y,e.y),i=Math.max(i.y,e.y);return!(t.xr||t.yi)},Se(e,i,s){let r=!1;var n,a;for(let t=0;t=e.y||a.y=e.y)&&(n.x<=e.x||a.x<=e.x)&&n.x+(e.y-n.y)/(a.y-n.y)*(a.x-n.x)a||(a-n<$n?t.y>=f&&t.y<=v||t.y>=v&&t.y<=f?(r.x=t.x,r.y=t.y,0):fa||(Math.abs(a-n<$n)?t.y>=f&&t.y<=v||t.y>=v&&t.y<=f?(r.x=t.x,r.y=t.y,0):fv?(r.x=d,r.y=v,0):!(vf)||(r.x=c,r.y=f,0):(r.y=p=(v-f)/(d-c)*(l-c)+f,r.x=l,uKn&&n*a>Kn)},ti(s,r,n){var a=n.length,h={isintersect:!1,start:null,end:null,type:0,outer:null},o=[];if(this.Qe(s,n)&&(h.start=s),this.Qe(r,n)&&(h.end=r),null!=h.start&&null!=h.end)h.isintersect=!0,h.type=1;else{let e=(n[1].x+n[2].x)/2,i=(n[1].y+n[2].y)/2;for(let t=1;tthis.distanceOfTwoPoints(a[0].point,i)?a[0]:a[1]).point,n.isintersect=!0)}return n},ii(r,t){if(0==t.length)return[r];var e,i,s=this.si(t),n=[];s.sort(function(t,e){var i=(t.ri.x-r.ri.x)*(t.ri.x-r.ri.x)+(t.ri.y-r.ri.y)*(t.ri.y-r.ri.y),s=(e.ri.x-r.ri.x)*(e.ri.x-r.ri.x)+(e.ri.y-r.ri.y)*(e.ri.y-r.ri.y),t=(t.ni.x-r.ri.x)*(t.ni.x-r.ri.x)+(t.ni.y-r.ri.y)*(t.ni.y-r.ri.y),e=(e.ni.x-r.ri.x)*(e.ni.x-r.ri.x)+(e.ni.y-r.ri.y)*(e.ni.y-r.ri.y);return(i=t.length){if(e.push(i),t.splice(0,1),t.length<1)break;i=t[0],s=1}if(1===t.length){e.push(i);break}this.we(i.ri,i.ni,t[s].ri)?(this.we(i.ri,i.ni,t[s].ni)||(i.ni=t[s].ni),t.splice(s,1)):this.we(i.ri,i.ni,t[s].ni)?(i.ri=t[s].ri,t.splice(s,1)):this.we(t[s].ri,t[s].ni,i.ri)?(i=(this.we(t[s].ri,t[s].ni,i.ni)||(t[s].ni=i.ni),t[s]),t.splice(s,1)):this.we(t[s].ri,t[s].ni,i.ni)?(t[s].ri=i.ri,i=t[s],t.splice(s,1)):s++}return e},we(t,e,i){let s=t.x-i.x,r=t.y-i.y,n=e.x-i.x,a=e.y-i.y;var h=this.distanceOfTwoPoints(t,i),i=this.distanceOfTwoPoints(e,i),t=this.distanceOfTwoPoints(t,e);return s*a-r*n<1e-5&&h+i-t<.001},li(t,e,i){let s=e.x-t.x,r=e.y-t.y;t=Math.sqrt(s*s+r*r);return{x:e.x+s/t*i,y:e.y+r/t*i}},ui(e){let i=null,s=0,t=0,r=0;for(let t=0;ti)&&(i=e[t].x,s=t);var n=new Gt(e[s].x,e[s].y,0),a=(t=0===s?e.length-1:s-1,r=s===e.length-1?0:s+1,new Gt(e[t].x,e[t].y,0)),h=new Gt(e[r].x,e[r].y,0),a=(new Gt).copy(n).sub(a),h=(new Gt).copy(h).sub(n);return 0this.max.x&&(e=!1),t.max.ythis.max.y?!1:e}}Object.assign(ia.prototype,{pi(){return!(this.min.x>this.max.x||this.min.y>this.max.y)},di(t){t&&t.valid()&&(t.min.xthis.max.x&&(this.max.x=t.max.x),t.max.y>this.max.y)&&(this.max.y=t.max.y)},vi(t){t&&0!=t.length&&t.forEach(t=>{t.xthis.max.x&&(this.max.x=t.x),t.y>this.max.y&&(this.max.y=t.y)})}});class sa extends fn{constructor(t,e){super(t,e),this.mi=new ia,this.gi=null}}Object.assign(sa.prototype,{le(t){return t.getType()!=dn.MODEL?this._i(t):this.wi(t)},wi(t){return!0},Mi(t){t=t.getBound();return!!G.Me(this.mi.ci,this.mi.fi,t.min,t.max)},ue(t,e){var r=t.getCoordinates();if(t.getType()!==dn.MODEL)e.Ae=Math.sqrt(G.Re(r[0],this.yi));else{let s=Number.MAX_VALUE;for(let i=0,t=r.length;in&&(s=n)}e.Ae=Math.sqrt(s)}},_i(t){t=t.getCoordinates()[0];return!!G.Ee(t,this.mi.ci,this.mi.fi)&&("circle"===this.gi?G.Re(t,this.yi){function e(t){return 180*t/Math.PI}function c(t){return e(Math.atan2(t[1][1]-t[0][1],t[1][0]-t[0][0]))}function f(t,e){return(t=>{if(Array.isArray(t))return t})(t)||((t,e)=>{var i=[],s=!0,r=!1,n=void 0;try{for(var a,h=t[Symbol.iterator]();!(s=(a=h.next()).done)&&(i.push(a.value),!e||i.length!==e);s=!0);}catch(t){r=!0,n=t}finally{try{s||null==h.return||h.return()}finally{if(r)throw n}}return i})(t,e)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance")})()}function s(t){return(t=>{if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e{if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance")})()}function d(t){var e=1t[0][1]?t:[t[1],t[0]]}function E(t,e){var i=2{for(var e=t.length-1;0{this.mi.vi(t)})},Li(t){t._support(this)==ca.PUSH&&t._result.push(this)}});let va={NO_RIGHT_CLICK:2,NORMAL:4};Object.freeze(va);class pa{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Qi(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}function ma(t,e){e=na.coordsScreenToMap(t.st,{x:e.x,y:e.y});return{x:e.x-t.st.x,y:e.z,z:t.st.y-e.y}}let ga=1e-5,_a=Math.PI/180;function wa(t,e,i){return Math.max(e,Math.min(i,t))}function Ma(t,e=ga){return Math.abs(t)o&&(l=o,i.value=(l-o)/n),l}function xa(t,e,i,s,r=1/0,n,a){var h=2/(s=Math.max(1e-4,s)),o=h*n,o=1/(1+o+.48*o*o+.235*o*o*o),l=e.x,u=e.y,e=e.z;let c=t.x-l,f=t.y-u,d=t.z-e;var v=l,p=u,m=e,r=r*s,s=c*c+f*f+d*d,s=(r*r{this.zoomCenterCusorReady=!0,this.zoomCenterType==La.MOUSE&&(this.Ii=0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.dollySpeed=1,this.Pi={value:0},this.Di=new Gt,this.Oi=new Gt,this.Ui={value:0},this.Ci=new DOMRect,this.Fi=new ct,this.Bi=(new Ms).setFromUnitVectors(this.object.up,Na),this.ki=this.Bi.clone().invert(),this.Gi=new sr(new Gt(-1/0,-1/0,-1/0),new Gt(1/0,1/0,1/0)),this.Hi(!1))},this.Vi=()=>{var t;this.zoomCenterType==La.MOUSE&&(t=ma(this,{x:this.domElement.clientWidth/2,y:this.domElement.clientHeight/2}),this.Oi.set(t.x,t.y,t.z),this.setOrbitPoint(t.x,t.y,t.z))},this.zi=t=>{ba(o.object)&&(o.timer&&clearTimeout(o.timer),o.timer=setTimeout(()=>{o.dollyPoint=Ta(t,o),o.setOrbitPoint(o.dollyPoint.x,o.dollyPoint.y,o.dollyPoint.z,!0),o.dollyPoint=null,o.update()},500),o.dollyPoint||(o.dollyPoint=Ta(t,o),o.setOrbitPoint(o.dollyPoint.x,o.dollyPoint.y,o.dollyPoint.z,!0),o.update())),o.Wi(o.Ci);var e=Ca?-1:-3,e=1===t.deltaMode||t.ctrlKey?t.deltaY/e:t.deltaY/(10*e),i=(t.clientX-o.Ci.x)/o.Ci.width*2-1,s=(t.clientY-o.Ci.y)/o.Ci.height*-2+1;o.object.isOrthographicCamera?(o.ji(-e,i,s),o.Xi=!0):(o.Yi(-e,i,s),o.Zi=!0),o.update()},this.Hi=()=>{this.zoomCenterType==La.MOUSE&&(this.qi=!0,this.Ki=this.target,this.Ji=this.target,this.$i=(new pa).setFromVector3(Ia.copy(this.object.position).sub(this.Ki).applyQuaternion(this.Bi)),this.Qi=this.$i.clone(),this.ts=this.$i.radius,this.es=new Gt,this.ss=this.es.clone(),this.rs=0,this.ns=this.object.zoom,this.hs=this.ns,this.ls=this.ns)},this.us=(t,e,i)=>{var s,r,n=e.lengthSq();return 0===n?t:(s=Pa.copy(e).add(t),0===(r=(s=this.Gi.clampPoint(s,Da).sub(s)).lengthSq())?t.add(e):r===n?t:0===i?t.add(e).add(s):(n=1+i*r/e.dot(s),t.add(Pa.copy(e).multiplyScalar(n)).add(s.multiplyScalar(1-i))))},this.Wi=t=>{var e=this.domElement.getBoundingClientRect();return t.x=e.left,t.y=e.top,t.width=e.width,t.height=e.height,t},this.moveTo=(t,e,i,s=!1)=>{this.cs=!1;t=Ia.set(t,e,i).sub(this.Ji),this.us(this.Ji,t,this.boundaryFriction),this.qi=!0,s||this.Ki.copy(this.Ji),e=!s||ya(this.Ki.x,this.Ji.x,this.restThreshold)&&ya(this.Ki.y,this.Ji.y,this.restThreshold)&&ya(this.Ki.z,this.Ji.z,this.restThreshold);return this.ds(e)},this.setFocalOffset=(t,e,i,s=!1)=>{this.vs=!1,this.ss.set(t,e,i),this.qi=!0,s||this.es.copy(this.ss);t=!s||ya(this.es.x,this.ss.x,this.restThreshold)&&ya(this.es.y,this.ss.y,this.restThreshold)&&ya(this.es.z,this.ss.z,this.restThreshold);return this.ds(t)},this.ds=t=>t?Promise.resolve():(this.ps=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{let e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)})),this.gs=t=>t.setFromSpherical(this.$i).divideScalar(this.$i.radius).applyQuaternion(this.ki),this._s=t=>this.gs(t).negate(),this.ws=(t,e=!1)=>{this.Qi.radius=t,this.qi=!0,e||(this.$i.radius=this.Qi.radius);t=!e||ya(this.$i.radius,this.Qi.radius,this.restThreshold);return this.ds(t)},this.dollyTo=(t,e=!1)=>(this.Zi=!1,this.Ms=0,this.Ii=0,this.ws(wa(t,this.minDistance,this.maxDistance),e)),this.setOrbitPoint=(t,e,i)=>{var s,r=Ia.set(t,e,i);r.length()>=this.maxDistance||(this.object.updateMatrixWorld(),Ua.setFromMatrixColumn(this.object.matrixWorldInverse,0),Fa.setFromMatrixColumn(this.object.matrixWorldInverse,1),Ba.setFromMatrixColumn(this.object.matrixWorldInverse,2),s=r.distanceTo(this.object.position),r=r.sub(this.object.position),Ua.multiplyScalar(r.x),Fa.multiplyScalar(r.y),Ba.multiplyScalar(r.z),Ia.copy(Ua).add(Fa).add(Ba),Ia.z=Ia.z+s,this.dollyTo(s,!1),this.setFocalOffset(-Ia.x,Ia.y,-Ia.z,!1),this.moveTo(t,e,i,!1))},this.Yi=(t,e,i)=>{var s=Math.pow(.95,-t*this.dollySpeed),r=this.Qi.radius,s=wa(this.Qi.radius*s,this.minDistance,this.maxDistance);this.ws(s,!0),this.dollyToCursor&&(this.Ii+=s-r,this.Fi.set(e,i)),this.Ms=Math.sign(-t)},this.zoomTo=(t,e=!1)=>{this.Xi=!1,this.hs=wa(t,this.minZoom,this.maxZoom),this.qi=!0,e||(this.ns=this.hs);t=!e||ya(this.ns,this.hs,this.restThreshold);return this.rs=0,this.ds(t)},this.ji=(t,e,i)=>{var t=Math.pow(.95,t*this.dollySpeed),s=this.ns,t=this.ns*t;this.zoomTo(t,!0),this.dollyToCursor&&(this.rs+=t-s,this.Fi.set(e,i))},this.dolly=(t,e)=>this.dollyTo(this.Qi.radius-t,e),this.ys=(t,e)=>{var i,s,r,n,a,h;this.zoomCenterType==La.MOUSE&&this.zoomCenterCusorReady&&(a=this.Qi.radius-this.$i.radius,h=this.hs-this.ns,Ma((n=ka.subVectors(this.ss,this.es)).x)&&Ma(n.y)&&Ma(n.z)?(this.Di.set(0,0,0),this.es.copy(this.ss)):(n=this.vs?this.draggingSmoothTime:this.smoothTime,xa(this.es,this.ss,this.Di,n,this.maxSpeed,.01,this.es),this.qi=!0),Ma(a)?(this.Pi.value=0,this.$i.radius=this.Qi.radius):(n=this.Zi?this.draggingSmoothTime:this.smoothTime,this.$i.radius=Ea(this.$i.radius,this.Qi.radius,this.Pi,n,this.maxSpeed,.01),this.qi=!0),Ma(h)?(this.Ui.value=0,this.ns=this.hs):(a=this.Xi?this.draggingSmoothTime:this.smoothTime,this.ns=Ea(this.ns,this.hs,this.Ui,a,1/0,.01)),ba(n=this.object)&&0!==this.Ii?(h=this.$i.radius-this.ts,a=this._s(Oa),0===(r=Ia.copy(a).cross(n.up).normalize()).lengthSq()&&(r.x=1),a=Pa.crossVectors(r,a),i=this.Qi.radius*Math.tan(n.getEffectiveFOV()*_a*.5),s=(this.Qi.radius-h-this.Qi.radius)/this.Qi.radius,r=Da.copy(this.Ji).add(r.multiplyScalar(this.Fi.x*i*n.aspect)).add(a.multiplyScalar(this.Fi.y*i)),a=Ia.copy(this.Ji).lerp(r,s),this.Gi.clampPoint(a,a),this.Ji.copy(a),this.Ii-=h,Ma(this.Ii)&&(this.Ii=0)):Sa(n)&&0!==this.rs&&(i=this.ns-this.ls,r=Ia.set(this.Fi.x,this.Fi.y,(n.near+n.far)/(n.near-n.far)).unproject(n),s=Pa.set(0,0,-1).applyQuaternion(n.quaternion),a=Da.copy(r).add(s.multiplyScalar(-r.dot(n.up))),h=-(this.ns-i-this.ns)/this.ns,s=this._s(Oa),r=this.Ji.dot(s),a=(n=Ia.copy(this.Ji).lerp(a,h)).dot(s),h=s.multiplyScalar(a-r),n.sub(h),this.Gi.clampPoint(n,n),this.Ji.copy(n),this.Ki.copy(this.Ji),this.rs-=i,Ma(this.rs))&&(this.rs=0),ba(this.object)||this.object.zoom!==this.ns&&(this.object.zoom=this.ns,this.object.updateProjectionMatrix(),this.qi=!0),this.$i.theta+=t.theta,this.$i.phi+=t.phi,this.$i.theta=Math.max(o.minAzimuthAngle,Math.min(o.maxAzimuthAngle,this.$i.theta)),e&&void 0!==e.theta&&(this.$i.theta=Math.max(o.minAzimuthAngle,Math.min(o.maxAzimuthAngle,e.theta))),this.$i.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,this.$i.phi)),e&&void 0!==e.phi&&(this.$i.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,e.phi))),e&&(this.qi=!0),this.$i.makeSafe(),this.object.position.setFromSpherical(this.$i).add(this.Ki),o.object.lookAt(this.Ki),Ma(this.es.x)&&Ma(this.es.y)&&Ma(this.es.z)||(Ua.setFromMatrixColumn(this.object.matrix,0),Fa.setFromMatrixColumn(this.object.matrix,1),Ba.setFromMatrixColumn(this.object.matrix,2),Ua.multiplyScalar(this.es.x),Fa.multiplyScalar(-this.es.y),Ba.multiplyScalar(this.es.z),Ia.copy(Ua).add(Fa).add(Ba),this.object.position.add(Ia),this.object.updateMatrixWorld()),this.qi,this.ts=this.$i.radius,this.ls=this.ns,this.qi=!1)},this.Es=()=>{this.isDamping&&(v.theta>f||v.phi>f||m.length()>f?(this.update(),this.st.enableUpdateRender()):(this.isDamping=!1,this.update()))},this.Es=this.Es.bind(this),this.st.on("beforeRender",this.Es),this.getPolarAngle=function(){return(this.zoomCenterType==La.MOUSE?this.$i:d).phi},this.getAzimuthalAngle=function(){return(this.zoomCenterType==La.MOUSE?this.$i:d).theta},this.panAdd=function(t){m.add(t)},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.resetState=function(){c=u.NONE},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(k),o.update(),c=u.NONE},this.updateCheck=function(){if(this.st.bi&&this.st.bi.enableDragRange)if(this.st.bi.xs())this.saveMapState();else{let t=this.mapStateArray.length-1;for(;0<=t;){var e=this.mapStateArray[t];if(e.viewMode=this.st.getViewMode(),this.updateState(e),this.st.bi.xs())break;t--}var i,s;t<0&&(s=(i=this.st.getBuilding(this.st.bi.nt.bs)).getFloor(i.level).bound.center,this.st.setCenter({x:s.x,y:s.y}),this.st.getMapOptions().followFocus||this.st.bi.nt.bs===this.st.getMapOptions().mapID||this.st.bi.Kt(i,{level:i.level,animate:!1}))}},this.updateState=function(t){this.st.bi.pauseDamping(),this.st.setCenter({animate:!1,x:t.center.x,y:t.center.y,finish:()=>{this.st.setRotation({animate:!1,rotation:t.rotation,finish:()=>{this.st.setTilt({animate:!1,tilt:t.tiltAngle,finish:()=>{this.st.setZoom({animate:!1,zoom:t.zoom})}})}})}})},this.saveMapState=function(){var t=this.st.getState();(t=>{let e=!0;for(var i in t)if(""+i=="center"){var s=t[i];if(isNaN(parseFloat(""+s.x))||isNaN(parseFloat(""+s.y))){e=!1;break}}else if(("rotation"===i||"tiltAngle"===i)&&isNaN(parseFloat(""+t[i]))){e=!1;break}return e})(t)&&(200<=this.mapStateArray.length&&this.mapStateArray.splice(0,1),this.mapStateArray.push(t))},this.getTarget=function(t,e){var i,s;return 0===this.st.Ft.length?t:(i=this.st.getMapOptions().screenLockCoords,s={x:this.st.getContainer().clientWidth/2,y:this.st.getContainer().clientHeight/2},i={x:this.st.getContainer().clientWidth*i.x,y:this.st.getContainer().clientHeight*i.y},(s=na.coordsScreenToMap(this.st,s,e)).x=s.x-this.st.x,s.y=-s.y+this.st.y,(i=na.coordsScreenToMap(this.st,i,e)).x=i.x-this.st.x,i.y=-i.y+this.st.y,e=i.x-s.x,i=i.y-s.y,s=t.clone(),isNaN(e)||isNaN(i)||1e3f||8*(1-a.dot(o.object.quaternion))>f||h!==o.object.zoom)||(o.dispatchEvent(k),n.copy(o.object.position),a.copy(o.object.quaternion),h=o.object.zoom,g=!1))}),this.dispose=function(){o.domElement.removeEventListener("contextmenu",rt,!1),o.domElement.removeEventListener("mousedown",$,!1),o.domElement.removeEventListener("wheel",Q,!1),o.domElement.removeEventListener("touchstart",et,!1),o.domElement.removeEventListener("touchend",st,!1),o.domElement.removeEventListener("touchmove",it,!1),nt.document.removeEventListener("mousemove",D,!1),nt.document.removeEventListener("mouseup",O,!1),o.domElement.removeEventListener("keydown",tt,!1)};var s,r,B,n,a,h,o=this,k={type:"change"},l={type:"start"},i={type:"end"},u={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},c=u.NONE,f=1e-6,d=new pa,v=new pa,p=1,m=new Gt,g=!1,_=new ct,w=new ct,M=new ct,y=new ct,E=new ct,x=new ct,b=new ct,S=new ct,T=new ct,G=null;function H(){return Math.pow(.95,o.zoomSpeed)}function A(t){o.enableRotateLeft&&(v.theta-=t)}function V(t){o.enableRotateUp&&(v.phi-=t)}R=new Gt;var R,L,C,z=function(t,e){R.setFromMatrixColumn(e,0),R.multiplyScalar(-t),m.add(R)},W=(L=new Gt,function(t,e){!0===o.screenSpacePanning?L.setFromMatrixColumn(e,1):(L.setFromMatrixColumn(e,0),L.crossVectors(o.object.up,L)),L.multiplyScalar(t),m.add(L)}),N=(this.panUp=t=>{var e=new Gt(0,1,0);e.multiplyScalar(t),m.add(e)},C=new Gt,function(t,e){var i,s=o.domElement;o.object.isPerspectiveCamera?(i=o.object.position,C.copy(i).sub(o.target),i=C.length(),i*=Math.tan(o.object.fov/2*Math.PI/180),z(2*t*i/s.clientHeight,o.object.matrix),W(2*e*i/s.clientHeight,o.object.matrix)):o.object.isOrthographicCamera?(z(t*(o.object.right-o.object.left)/o.object.zoom/s.clientWidth,o.object.matrix),W(e*(o.object.top-o.object.bottom)/o.object.zoom/s.clientHeight,o.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)});function I(t){o.object.isPerspectiveCamera?p/=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*t)),o.object.updateProjectionMatrix(),p/=t,g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function P(t){o.object.isPerspectiveCamera?p*=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/t)),o.object.updateProjectionMatrix(),p*=t,g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function e(t){_.set(t.clientX,t.clientY)}function j(t){y.set(t.clientX,t.clientY)}function X(t){var e,i;1==t.touches.length?_.set(t.touches[0].pageX,t.touches[0].pageY):(e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY),_.set(e,i),e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,o.rotateLeftStart.set(e,i))}function Y(t){var e;1==t.touches.length?y.set(t.touches[0].pageX,t.touches[0].pageY):(e=.5*(t.touches[0].pageX+t.touches[1].pageX),t=.5*(t.touches[0].pageY+t.touches[1].pageY),y.set(e,t))}function Z(t){var e=t.touches[0].pageX-t.touches[1].pageX,t=t.touches[0].pageY-t.touches[1].pageY,e=Math.sqrt(e*e+t*t);b.set(0,e)}function q(t){1==t.touches.length?w.set(t.touches[0].pageX,t.touches[0].pageY):(i=.5*(t.touches[0].pageX+t.touches[1].pageX),e=.5*(t.touches[0].pageY+t.touches[1].pageY),w.set(i,e),i=t.touches[0].pageX-t.touches[1].pageX,e=t.touches[0].pageY-t.touches[1].pageY,o.rotateLeftEnd.set(i,e),t=o.rotateLeftStart.angle(),A((-o.rotateLeftEnd.angle()+t)*o.rotateSpeed),o.rotateLeftStart.copy(o.rotateLeftEnd)),M.subVectors(w,_).multiplyScalar(o.rotateSpeed);var e,i=o.domElement;V(2*Math.PI*M.y/i.clientHeight),_.copy(w)}function K(t){var e;1==t.touches.length?(E.set(t.touches[0].pageX,t.touches[0].pageY),E.x<0&&E.copy(y)):(e=.5*(t.touches[0].pageX+t.touches[1].pageX),t=.5*(t.touches[0].pageY+t.touches[1].pageY),E.set(e,t)),x.subVectors(E,y).multiplyScalar(o.panSpeed),N(x.x,x.y),y.copy(E)}function J(t){var e,i;t.touches[0]&&t.touches[1]&&(i=t.touches[0].pageX-t.touches[1].pageX,e=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(i*i+e*e),S.set(0,i),T.set(0,Math.pow(S.y/b.y,o.zoomSpeed)),o.zoomCenterType==La.MOUSE&&o.zoomCenterCusorReady?(o.lastScreenPoint||(o.lastScreenPoint=Aa(t)),e=o.lastScreenPoint,i=T.y*ba(o.object)?35:50,o.zi({clientX:e.x,clientY:e.y,deltaMode:0,deltaY:1{o.activeing=!1},100),t.preventDefault(),t.stopPropagation(),o.dispatchEvent(l),t=t,e=Math.pow(.95,o.zoomSpeed*o.zoomSpeedParam),o.zoomCenterType==La.MOUSE&&o.zoomCenterCusorReady?o.zi(t):(t.deltaY<0?P(e):0I(t),this.dollyOut=t=>P(t),o.domElement.addEventListener("contextmenu",rt,!1),o.domElement.addEventListener("mousedown",$,!1),o.domElement.addEventListener("wheel",Q,!1),o.domElement.addEventListener("touchstart",et,!1),o.domElement.addEventListener("touchend",st,!1),o.domElement.addEventListener("touchmove",it,!1),o.domElement.addEventListener("keydown",tt,!1),-1===o.domElement.tabIndex&&(o.domElement.tabIndex=0),o.isDamping=!0,this.update(),this.updateCheck(),this.removeEvent=function(){o.domElement.removeEventListener("contextmenu",rt,!1),o.domElement.removeEventListener("mousedown",$,!1),o.domElement.removeEventListener("wheel",Q,!1),o.domElement.removeEventListener("touchstart",et,!1),o.domElement.removeEventListener("touchend",st,!1),o.domElement.removeEventListener("touchmove",it,!1),o.domElement.removeEventListener("keydown",tt,!1),nt.document.removeEventListener("mousemove",D,!1),nt.document.removeEventListener("mouseup",O,!1)}},Ha=(Ga.prototype=Object.create(Cs.prototype),Ga.prototype.constructor=Ga,function(t,e,i){Ga.call(this,t,e,i),this.mouseButtons.LEFT=at.PAN,this.mouseButtons.RIGHT=at.ROTATE,this.touches.ONE=ht.PAN,this.touches.TWO=ht.DOLLY_ROTATE,this.Ss=null});Ha.prototype=Object.create(Cs.prototype),Ha.prototype.constructor=Ha,Object.assign(Ha.prototype,{setMouseMiddleButtonRotation(){this.mouseButtons.RIGHT=at.NONE,this.mouseButtons.MIDDLE=at.ROTATE},dispose(){this.removeEvent(),this.object=null,this.domElement=null,this.st.off("beforeRender",this.st.Es),this.st=null},pauseDamping(){this.Ss={dampingFactor:this.dampingFactor,enableDamping:this.enableDamping},this.enableDamping=!1,this.dampingFactor=1},resumeDamping(){this.Ss&&(this.enableDamping=this.Ss.enableDamping,this.dampingFactor=this.Ss.dampingFactor)}});class Va{constructor(t,e,i){this.st=t,this.nt=i,this.Rt=[295829355.45,147914677.73,73957338.86,36978669.43,18489334.72,9244667.36,4622333.68,2311166.84,1155583.42,577791.71,288895.85,144447.93,72223.96,36111.98,18056,9028,4514,2257,1128,564,282,141,70,35,17,8,4,2,1],this.Ft=[],this.Ts=new Map,this.$t=null,this.As=this.nt.Rs,this.Nt=null,this.yt=new Ha(this.st.ct,e,this.st),this.yt.enableDamping=this.st.Ls.enableDamping,this.yt.dampingFactor=.08,this.st.Ls.interaction.mouseMode===va.NO_RIGHT_CLICK&&this.yt.setMouseMiddleButtonRotation(),this.Cs=null,this.yt.addEventListener("change",()=>{this.W(),this.st.Yt.Xt({type:"viewChanged"}),this.st.bt.Ns=1,null!==this.Cs&&clearTimeout(this.Cs),this.Cs=setTimeout(()=>{this.st.bt.Ns=0,this.st.enableUpdateRender()},10)}),this.st.Ls.interaction.zoomCenterType==La.CENTER?this.Is=new cn(this.yt,this.st.Ps,this.st.Lt):(this.st.Ps.far=1e8,this.st.Lt.far=1e8,this.st.Ps.updateProjectionMatrix(),this.st.Lt.updateProjectionMatrix());t=!this.st.Ls.interaction.lock;this.yt.enableZoom=t,this.yt.enablePan=t,this.yt.enableRotate=t,this.yt.enableRotateLeft=t,this.yt.enableRotateUp=t,this.Ds=t,this.Os=t,this.Us=t,this.Fs=t,this.Bs=this.yt.useRange,this.ks={},this.Gs=this.Gs.bind(this)}get enableZoom(){return this.Ds}set enableZoom(t){this.Ds=t,this.yt.enableZoom=t}get enableDragRange(){return this.Bs}set enableDragRange(t){this.Bs=t}get enableDrag(){return this.Os}set enableDrag(t){this.Os=t,this.yt.enablePan=t}get enableRotate(){return this.Us}set enableRotate(t){this.Us=t,this.yt.enableRotateLeft=t}get enableTilt(){return this.Fs}set enableTilt(t){this.Fs=t,this.yt.enableRotateUp=t}get enableDamping(){return this.yt.enableDamping}set enableDamping(t){this.yt.enableDamping=t}get controls(){return this.yt}set controls(t){this.yt=t}get autoCameraNearFar(){return this.Is}get mouseMode(){return this.st.Ls.mouseMode}set zoomSpeed(t){this.yt.zoomSpeedParam=t}get zoomSpeed(){return this.yt.zoomSpeedParam}copyControls(t){t=new Ha(t,this.yt.domElement,this.st);return t.target=(new Gt).copy(this.yt.target),t.maxDistance=this.yt.maxDistance,t.minDistance=this.yt.minDistance,t.minZoom=this.yt.minZoom,t.maxZoom=this.yt.maxZoom,t.minPolarAngle=this.yt.minPolarAngle,t.maxPolarAngle=this.yt.maxPolarAngle,t.update({theta:this.yt.getAzimuthalAngle()}),t}pauseDamping(){this.yt&&this.yt.pauseDamping()}resumeDamping(){this.yt&&this.yt.pauseDamping()}}Object.assign(Va.prototype,{Qt(){for(var t in clearTimeout(this.Cs),this.yt.dispose(),this)this[""+t]=null,delete this[""+t]},Hs(){var t,e=this.wt(this.nt.zoom),i=this.Mt(e),s=this.nt.yi,r=this.st.Wt.Vs(this.st.jt.Ht,this.st.jt.level);r?(s.y=r.Jt,this.yt.target=(new Gt).copy(s),this.yt.object.lookAt(s),this.At(),this.nt.Rs===Lr.MODE_3D?(r=(u.TILT_UPPER_BOUND-this.nt.zs)*u.DEG2RAD,t=i*Math.cos(r),r=i*Math.sin(r),this.yt.object.position.set(s.x,s.y+t,s.z+r),this.yt.minPolarAngle=(u.TILT_UPPER_BOUND-this.st.Ls.maxTiltAngle)*u.DEG2RAD,this.yt.maxPolarAngle=(u.TILT_UPPER_BOUND-this.st.Ls.minTiltAngle)*u.DEG2RAD):(t=this.Et(e),this.yt.minPolarAngle=0,this.yt.maxPolarAngle=0,this.yt.object.position.set(s.x,s.y+i,s.z),this.yt.object.zoom=1/t,this.yt.object.updateProjectionMatrix()),this.yt.Ni(),r=this.Pt(this.nt.Ws),this.yt.update({theta:this.yt.getAzimuthalAngle()+r})):(e={type:"info",InfoMode:Cr.DEFAULT_LEVEL_ERROR},this.st.js.error.push(e),this.st.Yt.Xt(e))},Xs(t){this.yt.target=t,this.yt.update()},Ys(s){if(this.As===s.mode)s.mode===this.st.getViewMode()&&s.finish&&s.finish();else{this.As=s.mode;let i=this.yt,t=(i.Vi(),s.duration);var e,r;void 0===t&&(t=1),this.Nt&&!1===this.Nt.H&&this.Nt.finish(),s.mode===Lr.MODE_2D?(i.minPolarAngle=-90*u.DEG2RAD,this.nt.zs=this.st.getTilt(),this.Ct({animate:void 0===s.animate||s.animate,duration:t,tilt:90,finish:()=>{i.maxPolarAngle=0;var t=this.st.Lt,e=this.ft(),e=this.Et(e);t.quaternion.copy(i.object.quaternion),t.position.copy(i.object.position),t.zoom=1/e,t.updateProjectionMatrix(),i.object=t,this.yt.Hi(),i.update(),this.st.ct=t,this.st.bt.xt(),this.st.Yt.Xt({type:"viewModeChanged"}),s.finish&&s.finish()}})):s.mode===Lr.MODE_3D&&(i.maxPolarAngle=(u.TILT_UPPER_BOUND-this.st.Ls.minTiltAngle)*u.DEG2RAD,e=this.st.Ps,r=this.dt(),r=this.Mt(r),e.quaternion.copy(i.object.quaternion),e.position.copy(i.object.position),e.position.setY(i.target.y+r),e.updateMatrix(),i.object=e,this.yt.Hi(),i.update(),this.st.ct=e,this.st.bt.xt(),this.Ct({animate:void 0===s.animate||s.animate,duration:t,tilt:this.nt.zs,finish:s.finish}),this.st.Yt.Xt({type:"viewModeChanged"}))}},lt(t){this.Ft.push(...t)},W(){for(let t=0;t{var i=[];for(let t=0;tthis.ks.num&&(t=this.ks.num-this.ks.counter);var i,s=this.ks.num-this.ks.counter,r=(this.ks.targetX-this.yt.target.x)/s,n=(this.ks.targetZ-this.yt.target.z)/s,a=this.wt(this.ks.state.zoom),h=this.Mt(a),o=this.yt.object.position.distanceTo(this.yt.target),l=(new Gt).copy(this.yt.object.position).sub(this.yt.target).normalize(),l=(new Gt).copy(l).multiplyScalar(h-o),r=(this.yt.panAdd({x:r*t,y:0,z:n*t}),this.yt.getAzimuthalAngle()),n=(u.TILT_UPPER_BOUND-(this.ks.tilt+t*this.ks.perTilt))*u.DEG2RAD;this.ks.tilt=this.ks.tilt+t*this.ks.perTilt,"OrthographicCamera"===this.st.ct.type&&(a=(i=this.dt())+(a-i)/s*t,i=this.Et(a),this.st.ct.zoom=1/i,this.st.ct.updateProjectionMatrix(),this.st.St()),this.yt.update({dirction:h-o,offset:new Gt(l.x/s*t,l.y/s*t,l.z/s*t)}),this.yt.update({theta:r+this.ks.disRotation*t}),this.yt.update({phi:n}),this.st.bt.xt(),this.ks.counter=this.ks.counter+t,this.ks.frameTime=e}else this.st.ot.Ks(this.Gs),"2d"===this.ks.modeUpdateType&&this.st.setViewMode({mode:this.ks.state.viewMode,animate:!1}),this.st.setVisibleLevels(this.ks.state.visibleLevels,()=>{let e=this.ks.state.focusBuildingState;if(null===e&&this.st.setLevel({level:this.ks.state.level,animate:!0,finish:()=>{this.ks.options.finish&&this.ks.options.finish()}}),this.st.qt=this.st.getMapOptions().followFocus,null!==e){let t=this.st.getBuilding(e.buildingID);e.buildingID===this.ks.state.viewBuildingID&&this.ks.state.viewBuildingID!==this.st.nt.bs?t.setVisibleLevels(e.visibleLevels,()=>{t.setLevel({level:e.level,animate:!1,finish:()=>{this.st.enterBuilding({buildingID:this.ks.state.viewBuildingID,noCenter:!0,finish:()=>{this.ks.options.finish&&this.ks.options.finish()}})}})}):t.setVisibleLevels(e.visibleLevels,()=>{t.setLevel({level:e.level,animate:!0,finish:()=>{this.ks.options.finish&&this.ks.options.finish()}})})}}),this.resumeDamping()},Js(t,e,i){this.st.ot.Ks(this.Gs),this.pauseDamping(),null!==t.focusBuildingState?this.st.nt.bs!==this.st.getMapOptions().mapID&&this.st.exitBuilding({buildingID:this.st.nt.bs,noCenter:!0,finish:()=>{this.st.setLevel({level:t.level,animate:!1})}}):this.st.nt.bs!==this.st.getMapOptions().mapID?this.st.exitBuilding({buildingID:this.st.nt.bs,noCenter:!0,finish:()=>{this.st.setLevel({level:t.level,animate:!1})}}):null!==i.focusBuildingState&&this.st.exitBuilding({buildingID:i.focusBuildingState.buildingID,noCenter:!0,finish:()=>{this.st.setLevel({level:t.level,animate:!1})}}),this.st.qt=!1,this.ks={},this.ks.options=e,this.ks.targetX=t.center.x-this.st.x,this.ks.targetZ=-t.center.y+this.st.y,this.ks.num=1e3*e.duration,this.ks.counter=0;var s,i=this.Pt(t.rotation,!0),e=(this.ks.disRotation=i/this.ks.num,t.tiltAngle=ws.clamp(t.tiltAngle,this.st.Ls.minTiltAngle,this.st.Ls.maxTiltAngle),this.ks.state=t,this.st.getTilt()),i=(t.tiltAngle-e)/this.ks.num;this.ks.tilt=e,this.ks.perTilt=i;let r="no";this.st.getViewMode()!==t.viewMode&&(t.viewMode===Lr.MODE_3D?(r="3d",this.yt.maxPolarAngle=(u.TILT_UPPER_BOUND-this.st.Ls.minTiltAngle)*u.DEG2RAD,i=this.st.Ps,s=this.dt(),s=this.Mt(s),i.quaternion.copy(this.yt.object.quaternion),i.position.copy(this.yt.object.position),i.position.setY(this.yt.target.y+s),i.updateMatrix(),this.yt.object=i,this.yt.update(),this.st.ct=i,this.As=Lr.MODE_3D):(r="2d",this.ks.perTilt=(90-e)/this.ks.num)),this.ks.frameTime=(new Date).getTime(),this.ks.modeUpdateType=r,this.st.getFloorSpace()!==t.floorSpace&&this.st.setFloorSpace(t.floorSpace),this.st.ot.$s(this.Gs)}}),an(Va),hn(Va),on(Va);let za=new Gt,Wa=new Gt,ja=new Gt,Xa=new Gt,Ya=new Gt,Za=new Gt,qa=new Gt;class Ka{constructor(t=new Gt,e=new Gt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,za)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);t=e.dot(this.direction);return t<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,t)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){var e=za.subVectors(t,this.origin).dot(this.direction);return(e<0?this.origin:(za.copy(this.origin).addScaledVector(this.direction,e),za)).distanceToSquared(t)}distanceSqToSegment(t,e,i,s){Wa.copy(t).add(e).multiplyScalar(.5),ja.copy(e).sub(t).normalize(),Xa.copy(this.origin).sub(Wa);var t=.5*t.distanceTo(e),e=-this.direction.dot(ja),r=Xa.dot(this.direction),n=-Xa.dot(ja),a=Xa.lengthSq(),h=Math.abs(1-e*e);let o,l,u,c;return u=0=-c?l<=c?(h=1/h,o*=h,l*=h,o*(o+e*l+2*r)+l*(e*o+l+2*n)+a):(l=t,-(o=Math.max(0,-(e*l+r)))*o+l*(l+2*n)+a):(l=-t,-(o=Math.max(0,-(e*l+r)))*o+l*(l+2*n)+a):l<=-c?(o=Math.max(0,-(-e*t+r)),l=0n||r>s||((r>i||isNaN(i))&&(i=r),(nh)||a>s||((a>i||i!=i)&&(i=a),(s=hn||(s=-a*Xa.dot(qa))<0?null:this.at(s/n,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}let Ja=new Ht;class $a{constructor(t,e,i=0,s=1/0){this.ray=new Ka(t,e),this.near=i,this.far=s,this.camera=null,this.layers=new Ds,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Ja.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Ja),this}intersectObject(t,e=!0,i=[]){return th(t,this,i,e),i.sort(Qa),i}intersectObjects(i,s=!0,r=[]){for(let t=0,e=i.length;t{this.remove(t),t.dispose()}),this.parent&&this.parent.remove(this),this)this[""+t]&&this[""+t].Qt&&this[""+t].Qt(),this[""+t]&&this[""+t].dispose&&this[""+t].dispose(),this[""+t]=null,delete this[""+t]}getBelongedBuildingID(){let e=null;if(this.sr)e=this;else if(this.rr)e=this.parent;else if(this.nr){var t=this.parent;e=t.parent}else if(this.ar){let t=null;t=this.type==p.DOM_MARKER?this.hr:this.parent.parent,e=t.parent}if(e)return(t=e).lr?null:t.buildingID}}Object.assign(ih.prototype,{ur(t){let e=this;for(;e;){if(e instanceof t)return e;e=e.P}return null}});class sh extends ih{constructor(t){super(),this.Ht=t.bid,this.cr=t.bcode,this.dr=t.mid,this.vr=t.name,this.pr=t.ename,this.mr=t.alias,this.t=t.x,this.o=t.y,this.gr=t.levels,this._r=[],this.wr=!0,this.ir=void 0,this.Mr=void 0,this.lr=!1,this.sr=!0,this.yr=t.groundLevel,this.Er=null}getBelongedBuildingID(){}get type(){return this.Ti}get x(){return this.t}get y(){return this.o}get bound(){return!0===this.needUpdateBound&&(this.mi.reset(),void 0!==this.R&&this.mi.copy(this.R),this.Ft.forEach(t=>{this.mi.expand(t.bound)}),this.needUpdateBound=!1),this.mi.clone()}get buildingID(){return this.Ht}get bcode(){return this.cr}get name(){return this.vr}get eName(){return this.pr}get alias(){return this.mr}get floorSpace(){return this.P.nt.Gt(this.Ht).floorSpace}set floorSpace(t){this.P.nt.Gt(this.Ht).floorSpace=t,this.traverse(t=>{t.br({animate:!1}),null===this.Er&&null!==t.Sr&&t.Sr.Tr()}),this.P.bi.Kt(this,{level:this.level,animate:!1,finish:()=>{this.wr&&(this.parent.bt.xt(),this.parent.bt.Vt(),this.parent.bt.render())}})}get level(){return this.P.nt.Gt(this.Ht).level}get visibleLevels(){return this.P.nt.Gt(this.Ht).visibleLevels}get isGroundLevel(){var t=this.P.nt.Gt(this.Ht);return t.visibleLevelsBak.length!==t.visibleLevels.length}getFloor(e){let i=null;return this.traverse(t=>{t.Ar===e&&(i=t)}),i}getFloorInfos(){return this.Rr()}setLevel(t){this.P.Wt.Lr(this,t)}setVisibleLevels(t,e,i){var s=[...t];i||(this.P.nt.Gt(this.Ht).visibleLevelsBak=[...t],null!==this.Er&&(this.floorSpace=this.Er,this.Er=null)),void 0!==this.yr&&this.P.nt.bs!==this.Ht&&2===s.length&&0<=s.indexOf(this.yr)?s.splice(s.indexOf(this.yr),1):void 0!==this.yr&&this.P.nt.bs===this.Ht&&1===s.length&&s.indexOf(this.yr)<0&&s.push(this.yr),this.P.Wt.Cr({levels:s,building:this},e)}getVisibleLevels(){return this.visibleLevels}setFloorSpace(e){if(!("animate"in e)||e.animate){this.Nr||(this.Nr=new nn);var i=Number.isFinite(e.duration)?e.duration:.5;let t=e.finish;return this.wr=!1,this.Nr.Y([this.floorSpace]).Z([e.floorSpace]).K(i).J(t=>{this.floorSpace=t.destination[0]}).$(()=>{this.wr=!0,this.P.ot.ht(this.Nr),t&&t()}),this.P.ot.lt(this.Nr.X()),this.Nr}this.floorSpace=e.floorSpace}getFloorSpace(){return this.floorSpace}}function rh(e,i){if(e.userData.sourceMaterial||(e.userData.sourceMaterial=e.material),Array.isArray(e.material))for(let t=0;t{"Mesh"===t.type&&nh(t)}),t.Pr()))}Object.assign(sh.prototype,{Rr(){0===this._r.length&&(t=this.P.Or.Dr.get(this.dr))&&(this._r=[],t.Ft.forEach(t=>{this._r.push(t)}));var t,i={alias:"alias",floorId:"floorID",gid:"level",gname:"name"},s=Object.keys(i),r=[];for(let e=0;et!==p.EXTENT&&t!==p.EXTERNAL_MODEL&&t!==p.MODEL&&t!==p.LABEL&&t!==p.FACILITY)(i[t].type)?(void 0!==i[t].ir?(void 0===i[t].oldOpacity&&(i[t].oldOpacity=i[t].opacity),i[t].opacity=i[t].ir):void 0!==i[t].oldOpacity&&(i[t].opacity=i[t].oldOpacity),void 0!==i[t].renderType&&i[t].update()):i[t].Pr()}},Br(t){if(null===this._focusOptions)return this._focusOpacity;let e=null;return e=null!==(e=this._focusOptions.levels&&!i(this._focusOptions.levels,t.parent.level)?this._focusOptions.opacity:e)||void 0===this._focusOptions.typeID||i(this._focusOptions.typeID,t.typeID)?e:this._focusOptions.opacity;function i(e,i){let s=!1;for(let t=0;t{var i=t.array,s=t.usage,r=i.byteLength,n=c.createBuffer();c.bindBuffer(e,n),c.bufferData(e,i,s),t.onUploadCallback();let a;if(i instanceof Float32Array)a=c.FLOAT;else if(i instanceof Uint16Array)a=t.isFloat16BufferAttribute?c.HALF_FLOAT:c.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=c.SHORT;else if(i instanceof Uint32Array)a=c.UNSIGNED_INT;else if(i instanceof Int32Array)a=c.INT;else if(i instanceof Int8Array)a=c.BYTE;else{if(!(i instanceof Uint8Array||i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=c.UNSIGNED_BYTE}return{buffer:n,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:r}})(t,e));else if(i.versiont.start-e.start);let e=0;for(let t=1;tMath.pow(s.changedTouches[0].radiusX,2))return;this.O=(new Date).getTime()}var r=this.Yr(s);for(let t=0;t{var s,r,n=[];for(let t=0;t{t=new Wt(t.destination[0],t.destination[1],t.destination[2]);e&&e.material&&(e.material.color=t),this.st.enableUpdateRender()}).$(()=>{this.Ts.stop(),this.st.ot.ht(this.Ts),e&&e.material&&(e.material.color=t),this.st.enableUpdateRender()}),this.st.ot.lt(this.Ts.X())}else i[t].Ti===p.EXTERNAL_MODEL&&("Mesh"===e.type?rh(e,this.nt.highlightColor):"Scene"!==e.type&&"Group"!=e.type||e.traverse(t=>{"Mesh"===t.type&&rh(t,this.nt.highlightColor)}));return void this.st.enableUpdateRender()}break}this.Ts&&(this.Ts.stop(),this.st.ot.ht(this.Ts)),ah(this.Gr),this.Gr=null,this.st.enableUpdateRender()},Zr(e){var s=[];for(let t=0;t{e=e.split("%A%B%C%D")[0];let i=a.get(e);if(i||(i=[],a.set(e,i),h.unshift(e)),t.visible){var s=this.Vr.intersectObject(t,!0);for(let t=0;t(t.far-t.near)**2)return}ro.copy(r).invert(),no.copy(t.ray).applyMatrix4(ro),null!==i.boundingBox&&!1===no.intersectsBox(i.boundingBox)||this.ln(t,e,no)}}ln(i,s,r){let n;var t=this.geometry,a=this.material,h=t.index,o=t.attributes.position,l=t.attributes.uv,u=t.attributes.uv1,c=t.attributes.normal,f=t.groups,d=t.drawRange;if(null!==h)if(Array.isArray(a))for(let t=0,e=f.length;ti.far?null:{distance:s,point:po.clone(),object:t}}function go(t,e,i,s,r,n,a,h,o,l){t.getVertexPosition(h,oo),t.getVertexPosition(o,lo),t.getVertexPosition(l,uo);t=mo(t,e,i,s,oo,lo,uo,vo);return t&&(e=new Gt,io.getBarycoord(vo,oo,lo,uo,e),r&&(t.uv=io.getInterpolatedAttribute(r,h,o,l,e,new ct)),n&&(t.uv1=io.getInterpolatedAttribute(n,h,o,l,e,new ct)),a&&(t.normal=io.getInterpolatedAttribute(a,h,o,l,e,new Gt),0 outsideIOR when thinFilmThickness -> 0.0 + float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); + // Evaluate the cosTheta on the base layer (Snell law) + float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); + + // Handle TIR: + float cosTheta2Sq = 1.0 - sinTheta2Sq; + if ( cosTheta2Sq < 0.0 ) { + + return vec3( 1.0 ); + + } + + float cosTheta2 = sqrt( cosTheta2Sq ); + + // First interface + float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); + float R12 = F_Schlick( R0, 1.0, cosTheta1 ); + float T121 = 1.0 - R12; + float phi12 = 0.0; + if ( iridescenceIOR < outsideIOR ) phi12 = PI; + float phi21 = PI - phi12; + + // Second interface + vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0 + 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; + + // Phase shift + float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; + vec3 phi = vec3( phi21 ) + phi23; + + // Compound terms + vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); + vec3 r123 = sqrt( R123 ); + vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); + + // Reflectance term for m = 0 (DC term amplitude) + vec3 C0 = R12 + Rs; + I = C0; + + // Reflectance term for m > 0 (pairs of diracs) + 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; + + } + + // Since out of gamut colors might be produced, negative color values are clamped to 0. + return max( I, vec3( 0.0 ) ); + + } + +#endif + +`,Io=` +#ifdef USE_BUMPMAP + + uniform sampler2D bumpMap; + uniform float bumpScale; + + // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen + // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf + + // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2) + + vec2 dHdxy_fwd() { + + vec2 dSTdx = dFdx( vBumpMapUv ); + vec2 dSTdy = dFdy( vBumpMapUv ); + + float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; + + return vec2( dBx, dBy ); + + } + + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { + + // normalize is done to ensure that the bump map looks the same regardless of the texture's scale + vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); + vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); + vec3 vN = surf_norm; // normalized + + 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 +`,Po=` +#if NUM_CLIPPING_PLANES > 0 + + vec4 plane; + + #ifdef ALPHA_TO_COVERAGE + + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + + if ( clipOpacity == 0.0 ) discard; + + } + #pragma unroll_loop_end + + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + + float unionClipOpacity = 1.0; + + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + + } + #pragma unroll_loop_end + + clipOpacity *= 1.0 - unionClipOpacity; + + #endif + + diffuseColor.a *= clipOpacity; + + if ( diffuseColor.a == 0.0 ) discard; + + #else + + #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 + +#endif +`,Do=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; + +#endif +`,Oo=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + +#endif +`,Uo=` +#if NUM_CLIPPING_PLANES > 0 + + vClipPosition = - mvPosition.xyz; + +#endif +`,Fo=` +#if defined( USE_COLOR_ALPHA ) + + diffuseColor *= vColor; + +#elif defined( USE_COLOR ) + + diffuseColor.rgb *= vColor; + +#endif +`,Bo=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) + + varying vec3 vColor; + +#endif +`,ko=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + + varying vec3 vColor; + +#endif +`,Go=` +#if defined( USE_COLOR_ALPHA ) + + vColor = vec4( 1.0 ); + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + + vColor = vec3( 1.0 ); + +#endif + +#ifdef USE_COLOR + + vColor *= color; + +#endif + +#ifdef USE_INSTANCING_COLOR + + vColor.xyz *= instanceColor.xyz; + +#endif + +#ifdef USE_BATCHING_COLOR + + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + + vColor.xyz *= batchingColor.xyz; + +#endif +`,Ho=` +#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 +// may have defined saturate() already +#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 v ) { return dot( v, vec3( 0.3333333 ) ); } + +// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range. +// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ +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; +}; + +#ifdef USE_ALPHAHASH + + varying vec3 vPosition; + +#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 ) { + + // dir can be either a direction vector or a normal vector + // upper-left 3x3 of matrix is assumed to be orthogonal + + 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; + +} + +bool isPerspectiveMatrix( mat4 m ) { + + return m[ 2 ][ 3 ] == - 1.0; + +} + +vec2 equirectUv( in vec3 dir ) { + + // dir is assumed to be unit length + + 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 ); + +} + +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + + return RECIPROCAL_PI * diffuseColor; + +} // validated + +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + + // Original approximation by Christophe Schlick '94 + // float fresnel = pow( 1.0 - dotVH, 5.0 ); + + // Optimized variant (presented by Epic at SIGGRAPH '13) + // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); + +} // validated + +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + + // Original approximation by Christophe Schlick '94 + // float fresnel = pow( 1.0 - dotVH, 5.0 ); + + // Optimized variant (presented by Epic at SIGGRAPH '13) + // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); + +} // validated +`,Vo=` +#ifdef ENVMAP_TYPE_CUBE_UV + + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + + // These shader functions convert between the UV coordinates of a single face of + // a cubemap, the 0-5 integer index of a cube face, and the direction vector for + // sampling a textureCube (not generally normalized ). + + 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; + + } + + // RH coordinate system; PMREM face-indexing convention + vec2 getUV( vec3 direction, float face ) { + + vec2 uv; + + if ( face == 0.0 ) { + + uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x + + } else if ( face == 1.0 ) { + + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y + + } else if ( face == 2.0 ) { + + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z + + } else if ( face == 3.0 ) { + + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x + + } else if ( face == 4.0 ) { + + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y + + } else { + + uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg 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 ); + + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071 + + 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; // disable anisotropic filtering + + #else + + return texture2D( envMap, uv ).rgb; + + #endif + + } + + // These defines must match with PMREMGenerator + + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + + float roughnessToMip( float roughness ) { + + float mip = 0.0; + + if ( roughness >= cubeUV_r1 ) { + + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + + } else if ( roughness >= cubeUV_r4 ) { + + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + + } else if ( roughness >= cubeUV_r5 ) { + + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + + } else if ( roughness >= cubeUV_r6 ) { + + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + + } else { + + mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25 + } + + return mip; + + } + + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + + float mip = clamp( roughnessToMip( roughness ), cubeUV_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 +`,zo=` + +vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + + vec3 transformedTangent = objectTangent; + +#endif + +#ifdef USE_BATCHING + + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + + #ifdef USE_TANGENT + + transformedTangent = bm * transformedTangent; + + #endif + +#endif + +#ifdef USE_INSTANCING + + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + + #ifdef USE_TANGENT + + transformedTangent = im * transformedTangent; + + #endif + +#endif + +transformedNormal = normalMatrix * transformedNormal; + +#ifdef FLIP_SIDED + + transformedNormal = - transformedNormal; + +#endif + +#ifdef USE_TANGENT + + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + + #ifdef FLIP_SIDED + + transformedTangent = - transformedTangent; + + #endif + +#endif +`,Wo=` +#ifdef USE_DISPLACEMENTMAP + + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; + +#endif +`,jo=` +#ifdef USE_DISPLACEMENTMAP + + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); + +#endif +`,Xo=` +#ifdef USE_EMISSIVEMAP + + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + + totalEmissiveRadiance *= emissiveColor.rgb; + +#endif +`,Yo=` +#ifdef USE_EMISSIVEMAP + + uniform sampler2D emissiveMap; + +#endif +`,Zo=` +gl_FragColor = linearToOutputTexel( gl_FragColor ); +`,qo=` + +// http://www.russellcottrell.com/photo/matrixCalculator.htm + +// Linear sRGB => XYZ => Linear Display P3 +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); + +// Linear Display P3 => XYZ => Linear sRGB +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); + +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} + +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} + +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} + +vec4 sRGBTransferOETF( 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 ); +} + +`,Ko=` +#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 ); + + } + + // Transforming Normal Vectors with the Inverse Transformation + 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, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + + #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 +`,Jo=` +#ifdef USE_ENVMAP + + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif +`,$o=` +#ifdef USE_ENVMAP + + uniform float reflectivity; + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif + +#endif +`,Qo=` +#ifdef USE_ENVMAP + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + + #else + + varying vec3 vReflect; + uniform float refractionRatio; + + #endif + +#endif +`,tl=` +#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 +`,el=` +#ifdef USE_FOG + + vFogDepth = - mvPosition.z; + +#endif +`,il=` +#ifdef USE_FOG + + varying float vFogDepth; + +#endif +`,sl=` +#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 +`,rl=` +#ifdef USE_FOG + + uniform vec3 fogColor; + varying float vFogDepth; + + #ifdef FOG_EXP2 + + uniform float fogDensity; + + #else + + uniform float fogNear; + uniform float fogFar; + + #endif + +#endif +`,nl=` + +#ifdef USE_GRADIENTMAP + + uniform sampler2D gradientMap; + +#endif + +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + + // dotNL will be from -1.0 to 1.0 + 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 + + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + + #endif + +} +`,al=` +#ifdef USE_LIGHTMAP + + uniform sampler2D lightMap; + uniform float lightMapIntensity; + +#endif +`,hl=` +LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength; +`,ol=` +varying vec3 vViewPosition; + +struct LambertMaterial { + + vec3 diffuseColor; + float specularStrength; + +}; + +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = vec3(dotNL) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert +`,ll=` +uniform bool receiveShadow; +uniform vec3 ambientLightColor; + +#if defined( USE_LIGHT_PROBES ) + + uniform vec3 lightProbe[ 9 ]; + +#endif + +// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere +// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + + // normal is assumed to have unit length + + float x = normal.x, y = normal.y, z = normal.z; + + // band 0 + vec3 result = shCoefficients[ 0 ] * 0.886227; + + // band 1 + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + + // band 2 + 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 ) { + + // based upon Frostbite 3 Moving to Physically-based Rendering + // page 32, equation 26: E[window1] + // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + + if ( cutoffDistance > 0.0 ) { + + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + + } + + return distanceFalloff; + +} + +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, 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 ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + + vec3 lVector = pointLight.position - geometryPosition; + + 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 ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + + vec3 lVector = spotLight.position - geometryPosition; + + 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; + }; + + // Pre-computed values of LinearTransformedCosine approximation of BRDF + // BRDF approximation Texture is 64x64 + uniform sampler2D ltc_1; // RGBA Float + uniform sampler2D ltc_2; // RGBA Float + + 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 +`,ul=` +#ifdef USE_ENVMAP + + vec3 getIBLIrradiance( const in vec3 normal ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * 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 ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + vec3 reflectVec = reflect( - viewDir, normal ); + + // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane. + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + + return envMapColor.rgb * envMapIntensity; + + #else + + return vec3( 0.0 ); + + #endif + + } + + #ifdef USE_ANISOTROPY + + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + + return getIBLRadiance( viewDir, bentNormal, roughness ); + + #else + + return vec3( 0.0 ); + + #endif + + } + + #endif + +#endif +`,cl=` +ToonMaterial material; +material.diffuseColor = diffuseColor.rgb; +`,fl=` +varying vec3 vViewPosition; + +struct ToonMaterial { + + vec3 diffuseColor; + +}; + +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 +`,dl=` +BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength; +`,vl=` +varying vec3 vViewPosition; + +struct BlinnPhongMaterial { + + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; + +}; + +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; + +} + +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 +`,pl=` +PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); + +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); + +material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap. +material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); + +#ifdef IOR + + material.ior = ior; + + #ifdef USE_SPECULAR + + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + + #ifdef USE_SPECULAR_COLORMAP + + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + + #endif + + #ifdef USE_SPECULAR_INTENSITYMAP + + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + + #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( ( material.ior - 1.0 ) / ( material.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, vClearcoatMapUv ).x; + + #endif + + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + + #endif + + material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model + material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); + +#endif + +#ifdef USE_DISPERSION + + material.dispersion = dispersion; + +#endif + +#ifdef USE_IRIDESCENCE + + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + + #ifdef USE_IRIDESCENCEMAP + + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + + #endif + + #ifdef USE_IRIDESCENCE_THICKNESSMAP + + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + + #else + + material.iridescenceThickness = iridescenceThicknessMaximum; + + #endif + +#endif + +#ifdef USE_SHEEN + + material.sheenColor = sheenColor; + + #ifdef USE_SHEEN_COLORMAP + + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + + #endif + + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + + #ifdef USE_SHEEN_ROUGHNESSMAP + + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + + #endif + +#endif + +#ifdef USE_ANISOTROPY + + #ifdef USE_ANISOTROPYMAP + + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + + #else + + vec2 anisotropyV = anisotropyVector; + + #endif + + material.anisotropy = length( anisotropyV ); + + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + + // Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy. + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; + +#endif +`,ml=` + +struct PhysicalMaterial { + + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + + #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 + + #ifdef IOR + float ior; + #endif + + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif + +}; + +// temporary +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); + +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 ); +} + +// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 +// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +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 ); + +} + +// Microfacet Models for Refraction through Rough Surfaces - equation (33) +// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html +// alpha is "roughness squared" in Disney’s reparameterization +float D_GGX( const in float alpha, const in float dotNH ) { + + float a2 = pow2( alpha ); + + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1 + + return RECIPROCAL_PI * a2 / pow2( denom ); + +} + +// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf +#ifdef USE_ANISOTROPY + + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + + return saturate(v); + + } + + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + + } + +#endif + +#ifdef USE_CLEARCOAT + + // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + + float alpha = pow2( roughness ); // UE4's 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 ); + + } + +#endif + +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + + float alpha = pow2( roughness ); // UE4's 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 ); + + #ifdef USE_IRIDESCENCE + + F = mix( F, material.iridescenceFresnel, material.iridescence ); + + #endif + + #ifdef USE_ANISOTROPY + + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + + #else + + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + + float D = D_GGX( alpha, dotNH ); + + #endif + + return F * ( V * D ); + +} + +// Rect Area Light + +// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines +// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt +// code: https://github.com/selfshadow/ltc_code/ + +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 ) ); + + // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) ) + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + + uv = uv * LUT_SCALE + LUT_BIAS; + + return uv; + +} + +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + + // Real-Time Area Lighting: a Journey from Research to Production (p.102) + // An approximation of the form factor of a horizon-clipped rectangle. + + 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 ); + + // rational polynomial approximation to theta / sin( theta ) / 2PI + 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 ] ) { + + // bail if point is on back side of plane of light + // assumes ccw winding order of light vertices + 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 ); + + // construct orthonormal basis around N + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system + + // compute transform + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + + // transform rect + 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 ); + + // project rect onto sphere + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + + // calculate vector form factor + 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 ] ); + + // adjust for horizon clipping + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + +/* + // alternate method of adjusting for horizon clipping (see referece) + // refactoring required + float len = length( vectorFormFactor ); + float z = vectorFormFactor.z / len; + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + // tabulated horizon-clipped sphere, apparently... + vec2 uv = vec2( z * 0.5 + 0.5, len ); + uv = uv * LUT_SCALE + LUT_BIAS; + + float scale = texture2D( ltc_2, uv ).w; + + float result = len * scale; +*/ + + return vec3( result ); + +} + +// End Rect Area Light + +#if defined( USE_SHEEN ) + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float D_Charlie( float roughness, float dotNH ) { + + float alpha = pow2( roughness ); + + // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16 + + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); + +} + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float V_Neubelt( float dotNV, float dotNL ) { + + // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" + 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 + +// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from +// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found +// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing +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 ); + +} + +// Analytical approximation of the DFG LUT, one half of the +// split-sum approximation used in indirect specular lighting. +// via 'environmentBRDF' from "Physically Based Shading on Mobile" +// https://www.unrealengine.com/blog/physically-based-shading-on-mobile +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; + +} + +// Fdez-Agüera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting" +// Approximates multiscattering in order to preserve energy. +// http://www.jcgt.org/published/0008/01/03/ +#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; // 1/21 + 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + 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; // counterclockwise; light shines in local neg z direction + 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 ) + ); + + // LTC Fresnel Approximation by Stephen Hill + // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf + 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + + vec3 irradiance = dotNL * directLight.color; + + #ifdef USE_CLEARCOAT + + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + + vec3 ccIrradiance = dotNLcc * directLight.color; + + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + #endif + + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} + +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + + #ifdef USE_CLEARCOAT + + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + + #endif + + // Both indirect specular and indirect diffuse light accumulate here + + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + + #ifdef USE_IRIDESCENCE + + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + + #else + + computeMultiscattering( geometryNormal, geometryViewDir, 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 + +// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +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 ); + +} +`,gl=` +/** + * This is a template that can be used to light a material, it uses pluggable + * RenderEquations (RE)for specific lighting scenarios. + * + * Instructions for use: + * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined + * - Create a material parameter that is to be passed as the third parameter to your lighting functions. + * + * TODO: + * - Add area light support. + * - Add sphere light support. + * - Add diffuse light probe (irradiance cubemap) support. + */ + +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); + +vec3 geometryClearcoatNormal = vec3( 0.0 ); + +#ifdef USE_CLEARCOAT + + geometryClearcoatNormal = clearcoatNormal; + +#endif + +#ifdef USE_IRIDESCENCE + + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + + 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 ); + + // Iridescence F0 approximation + 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, geometryPosition, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + + #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, geometryPosition, directLight ); + + // spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none] + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + + #undef SPOT_LIGHT_MAP_INDEX + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if defined( RE_IndirectDiffuse ) + + vec3 iblIrradiance = vec3( 0.0 ); + + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + + #if defined( USE_LIGHT_PROBES ) + + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + + #endif + + #if ( NUM_HEMI_LIGHTS > 0 ) + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + + } + #pragma unroll_loop_end + + #endif + +#endif + +#if defined( RE_IndirectSpecular ) + + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); + +#endif +`,_l=` +#if defined( RE_IndirectDiffuse ) + + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + + irradiance += lightMapIrradiance; + + #endif + + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + + iblIrradiance += getIBLIrradiance( geometryNormal ); + + #endif + +#endif + +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + + #ifdef USE_ANISOTROPY + + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + + #else + + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + + #endif + + #ifdef USE_CLEARCOAT + + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + + #endif + +#endif +`,wl=` +#if defined( RE_IndirectDiffuse ) + + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + +#endif + +#if defined( RE_IndirectSpecular ) + + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + +#endif +`,Ml=` +#if defined( USE_LOGDEPTHBUF ) + + // Doing a strict comparison with == 1.0 can cause noise artifacts + // on some platforms. See issue #17623. + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; + +#endif +`,yl=` +#if defined( USE_LOGDEPTHBUF ) + + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; + +#endif +`,El=` +#ifdef USE_LOGDEPTHBUF + + varying float vFragDepth; + varying float vIsPerspective; + +#endif +`,xl=` +#ifdef USE_LOGDEPTHBUF + + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + +#endif +`,bl=` +#ifdef USE_MAP + + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + + #ifdef DECODE_VIDEO_TEXTURE + + // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516) + + 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 +`,Sl=` +#ifdef USE_MAP + + uniform sampler2D map; + +#endif +`,Tl=` +#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + #if defined( USE_POINTS_UV ) + + vec2 uv = vUv; + + #else + + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + + #endif + +#endif + +#ifdef USE_MAP + + diffuseColor *= texture2D( map, uv ); + +#endif + +#ifdef USE_ALPHAMAP + + diffuseColor.a *= texture2D( alphaMap, uv ).g; + +#endif +`,Al=` +#if defined( USE_POINTS_UV ) + + varying vec2 vUv; + +#else + + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + uniform mat3 uvTransform; + + #endif + +#endif + +#ifdef USE_MAP + + uniform sampler2D map; + +#endif + +#ifdef USE_ALPHAMAP + + uniform sampler2D alphaMap; + +#endif +`,Rl=` +float metalnessFactor = metalness; + +#ifdef USE_METALNESSMAP + + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + + // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture + metalnessFactor *= texelMetalness.b; + +#endif +`,Ll=` +#ifdef USE_METALNESSMAP + + uniform sampler2D metalnessMap; + +#endif +`,Cl=` +#ifdef USE_INSTANCING_MORPH + + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + + } +#endif +`,Nl=` +#if defined( USE_MORPHCOLORS ) + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting + 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 +`,Il=` +#ifdef USE_MORPHNORMALS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting + objectNormal *= morphTargetBaseInfluence; + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + + } + +#endif +`,Pl=` +#ifdef USE_MORPHTARGETS + + #ifndef USE_INSTANCING_MORPH + + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + + #endif + + 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 ); + + } + +#endif +`,Dl=` +#ifdef USE_MORPHTARGETS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting + transformed *= morphTargetBaseInfluence; + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + + } + +#endif +`,Ol=` +float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; + +#ifdef FLAT_SHADED + + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); + +#else + + vec3 normal = normalize( vNormal ); + + #ifdef DOUBLE_SIDED + + normal *= faceDirection; + + #endif + +#endif + +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + + #ifdef USE_TANGENT + + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + + #else + + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + + #endif + + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + + #endif + +#endif + +#ifdef USE_CLEARCOAT_NORMALMAP + + #ifdef USE_TANGENT + + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + + #else + + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + + #endif + + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + + #endif + +#endif + +// non perturbed normal for clearcoat among others + +vec3 nonPerturbedNormal = normal; + +`,Ul=` + +#ifdef USE_NORMALMAP_OBJECTSPACE + + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals + + #ifdef FLIP_SIDED + + normal = - normal; + + #endif + + #ifdef DOUBLE_SIDED + + normal = normal * faceDirection; + + #endif + + normal = normalize( normalMatrix * normal ); + +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + + normal = normalize( tbn * mapN ); + +#elif defined( USE_BUMPMAP ) + + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); + +#endif +`,Fl=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`,Bl=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`,kl=` +#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED + + vNormal = normalize( transformedNormal ); + + #ifdef USE_TANGENT + + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + + #endif + +#endif +`,Gl=` +#ifdef USE_NORMALMAP + + uniform sampler2D normalMap; + uniform vec2 normalScale; + +#endif + +#ifdef USE_NORMALMAP_OBJECTSPACE + + uniform mat3 normalMatrix; + +#endif + +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + + // Normal Mapping Without Precomputed Tangents + // http://www.thetenthplanet.de/archives/1180 + + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + + vec3 N = surf_norm; // normalized + + 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 : inversesqrt( det ); + + return mat3( T * scale, B * scale, N ); + + } + +#endif +`,Hl=` +#ifdef USE_CLEARCOAT + + vec3 clearcoatNormal = nonPerturbedNormal; + +#endif +`,Vl=` +#ifdef USE_CLEARCOAT_NORMALMAP + + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); + +#endif +`,zl=` + +#ifdef USE_CLEARCOATMAP + + uniform sampler2D clearcoatMap; + +#endif + +#ifdef USE_CLEARCOAT_NORMALMAP + + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; + +#endif + +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + uniform sampler2D clearcoatRoughnessMap; + +#endif +`,Wl=` + +#ifdef USE_IRIDESCENCEMAP + + uniform sampler2D iridescenceMap; + +#endif + +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + uniform sampler2D iridescenceThicknessMap; + +#endif +`,jl=` +#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif + +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif + +gl_FragColor = vec4( outgoingLight, diffuseColor.a ); +`,Xl=` +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.; // fraction -> 0..1 (including 1) +const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1) +const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; + +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); + +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); + +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} + +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + // the 0.9999 tweak is unimportant, very tiny empirical improvement + // return vec3( vuf * Inv255, gf * PackUpscale, bf * 0.9999 ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} + +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} + +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} + +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} + +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} + +vec4 pack2HalfToRGBA( const in 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( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} + +// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera + +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + // -near maps to 0; -far maps to 1 + return ( viewZ + near ) / ( near - far ); +} + +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + // maps orthographic depth in [ 0, 1 ] to viewZ + return depth * ( near - far ) - near; +} + +// NOTE: https://twitter.com/gonnavis/status/1377183786949959682 + +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + // -near maps to 0; -far maps to 1 + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} + +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + // maps perspective depth in [ 0, 1 ] to viewZ + return ( near * far ) / ( ( far - near ) * depth - far ); +} +`,Yl=` +#ifdef PREMULTIPLIED_ALPHA + + // Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. + gl_FragColor.rgb *= gl_FragColor.a; + +#endif +`,Zl=` +vec4 mvPosition = vec4( transformed, 1.0 ); + +#ifdef USE_BATCHING + + mvPosition = batchingMatrix * mvPosition; + +#endif + +#ifdef USE_INSTANCING + + mvPosition = instanceMatrix * mvPosition; + +#endif + +mvPosition = modelViewMatrix * mvPosition; + +gl_Position = projectionMatrix * mvPosition; +`,ql=` +#ifdef DITHERING + + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); + +#endif +`,Kl=` +#ifdef DITHERING + + // based on https://www.shadertoy.com/view/MslGR8 + vec3 dithering( vec3 color ) { + //Calculate grid position + float grid_position = rand( gl_FragCoord.xy ); + + //Shift the individual colors differently, thus making it even harder to see the dithering pattern + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + + //modify shift according to grid position. + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + + //shift the color by dither_shift + return color + dither_shift_RGB; + } + +#endif +`,Jl=` +float roughnessFactor = roughness; + +#ifdef USE_ROUGHNESSMAP + + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + + // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture + roughnessFactor *= texelRoughness.g; + +#endif +`,$l=` +#ifdef USE_ROUGHNESSMAP + + uniform sampler2D roughnessMap; + +#endif +`,Ql=` +#if NUM_SPOT_LIGHT_COORDS > 0 + + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; + +#endif + +#if NUM_SPOT_LIGHT_MAPS > 0 + + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; + +#endif + +#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 shadowIntensity; + 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 ]; + + struct SpotLightShadow { + float shadowIntensity; + 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 shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): create uniforms for area 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 ); // Hard Shadow + + 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 ); // Chebeyshevs inequality + softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed + occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + + } + return occlusion; + + } + + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + + float shadow = 1.0; + + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + + 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 // no percentage-closer filtering: + + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + + #endif + + } + + return mix( 1.0, shadow, shadowIntensity ); + + } + + // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D + // vector suitable for 2D texture mapping. This code uses the following layout for the + // 2D texture: + // + // xzXZ + // y Y + // + // Y - Positive y direction + // y - Negative y direction + // X - Positive x direction + // x - Negative x direction + // Z - Positive z direction + // z - Negative z direction + // + // Source and test bed: + // https://gist.github.com/tschw/da10c43c467ce8afd0c4 + + vec2 cubeToUV( vec3 v, float texelSizeY ) { + + // Number of texels to avoid at the edge of each square + + vec3 absV = abs( v ); + + // Intersect unit cube + + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + + // Apply scale to avoid seams + + // two texels less per square (one texel will do for NEAREST) + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + + // Unwrap + + // space: -1 ... 1 range for each square + // + // #X## dim := ( 4 , 2 ) + // # # center := ( 1 , 1 ) + + 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; + + } + + // Transform to UV space + + // scale := 0.5 / dim + // translate := ( center + 0.5 ) / dim + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + + } + + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + + float shadow = 1.0; + + // for point lights, the uniform @vShadowCoord is re-purposed to hold + // the vector from the light to the world-space position of the fragment. + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + + // dp = normalized distance from light to fragment position + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? + dp += shadowBias; + + // bd3D = base direction 3D + vec3 bd3D = normalize( lightToPosition ); + + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + + shadow = ( + 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 // no percentage-closer filtering + + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + + #endif + + } + + return mix( 1.0, shadow, shadowIntensity ); + + } + +#endif +`,tu=` + +#if NUM_SPOT_LIGHT_COORDS > 0 + + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; + +#endif + +#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 shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + struct SpotLightShadow { + float shadowIntensity; + 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 shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): uniforms for area light shadows + + #endif + */ + +#endif +`,eu=` + +#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + + // Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne. + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; + +#endif + +#if defined( USE_SHADOWMAP ) + + #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_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 + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update vAreaShadowCoord with area light info + + #endif + */ + +#endif + +// spot lights can be evaluated without active shadow mapping (when SpotLight.map is used) + +#if NUM_SPOT_LIGHT_COORDS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + +#endif + + +`,iu=` +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.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ 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.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update shadow for Area light + + #endif + */ + + #endif + + return shadow; + +} +`,su=` +#ifdef USE_SKINNING + + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); + +#endif +`,ru=` +#ifdef USE_SKINNING + + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + + uniform highp sampler2D boneTexture; + + mat4 getBoneMatrix( const in float i ) { + + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + + return mat4( v1, v2, v3, v4 ); + + } + +#endif +`,nu=` +#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 +`,au=` +#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 +`,hu=` +float specularStrength; + +#ifdef USE_SPECULARMAP + + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; + +#else + + specularStrength = 1.0; + +#endif +`,ou=` +#ifdef USE_SPECULARMAP + + uniform sampler2D specularMap; + +#endif +`,lu=` +#if defined( TONE_MAPPING ) + + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); + +#endif +`,uu=` +#ifndef saturate +// may have defined saturate() already +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif + +uniform float toneMappingExposure; + +// exposure only +vec3 LinearToneMapping( vec3 color ) { + + return saturate( toneMappingExposure * color ); + +} + +// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf +vec3 ReinhardToneMapping( vec3 color ) { + + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); + +} + +// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ +vec3 CineonToneMapping( vec3 color ) { + + // filmic operator by Jim Hejl and Richard Burgess-Dawson + 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 ) ); + +} + +// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs +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; + +} + +// this implementation of ACES is modified to accommodate a brighter viewing environment. +// the scale factor of 1/0.6 is subjective. see discussion in #19621. + +vec3 ACESFilmicToneMapping( vec3 color ) { + + // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source + vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + + // ODT_SAT => XYZ => D60_2_D65 => sRGB + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source + vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + + color *= toneMappingExposure / 0.6; + + color = ACESInputMat * color; + + // Apply RRT and ODT + color = RRTAndODTFit( color ); + + color = ACESOutputMat * color; + + // Clamp to [0, 1] + return saturate( color ); + +} + +// Matrices for rec 2020 <> rec 709 color space conversion +// matrix provided in row-major order so it has been transposed +// https://www.itu.int/pub/R-REP-BT.2407-2017 +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); + +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); + +// https://iolite-engine.com/blog_posts/minimal_agx_implementation +// Mean error^2: 3.6705141e-06 +vec3 agxDefaultContrastApprox( vec3 x ) { + + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; + +} + +// AgX Tone Mapping implementation based on Filament, which in turn is based +// on Blender's implementation using rec 2020 primaries +// https://github.com/google/filament/pull/7236 +// Inputs and outputs are encoded as Linear-sRGB. + +vec3 AgXToneMapping( vec3 color ) { + + // AgX constants + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + + // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + + // LOG2_MIN = -10.0 + // LOG2_MAX = +6.5 + // MIDDLE_GRAY = 0.18 + const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY ) + const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY ) + + color *= toneMappingExposure; + + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + + color = AgXInsetMatrix * color; + + // Log2 encoding + color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 + color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + + color = clamp( color, 0.0, 1.0 ); + + // Apply sigmoid + color = agxDefaultContrastApprox( color ); + + // Apply AgX look + // v = agxLook(v, look); + + color = AgXOutsetMatrix * color; + + // Linearize + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + + // Gamut mapping. Simple clamp for now. + color = clamp( color, 0.0, 1.0 ); + + return color; + +} + +// https://modelviewer.dev/examples/tone-mapping + +vec3 NeutralToneMapping( vec3 color ) { + + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + + color *= toneMappingExposure; + + float x = min( color.r, min( color.g, color.b ) ); + + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + + color -= offset; + + float peak = max( color.r, max( color.g, color.b ) ); + + if ( peak < StartCompression ) return color; + + float d = 1. - StartCompression; + + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + + color *= newPeak / peak; + + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + + return mix( color, vec3( newPeak ), g ); + +} + +vec3 CustomToneMapping( vec3 color ) { return color; } +`,cu=` +#ifdef USE_TRANSMISSION + + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + + #ifdef USE_TRANSMISSIONMAP + + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + + #endif + + #ifdef USE_THICKNESSMAP + + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + + #endif + + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); + +#endif +`,fu=` +#ifdef USE_TRANSMISSION + + // Transmission code is based on glTF-Sampler-Viewer + // https://github.com/KhronosGroup/glTF-Sample-Viewer + + 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; + + // Mipped Bicubic Texture Filtering by N8 + // https://www.shadertoy.com/view/Dl2SDW + + float w0( float a ) { + + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + + } + + float w1( float a ) { + + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + + } + + float w2( float a ){ + + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + + } + + float w3( float a ) { + + return ( 1.0 / 6.0 ) * ( a * a * a ); + + } + + // g0 and g1 are the two amplitude functions + float g0( float a ) { + + return w0( a ) + w1( a ); + + } + + float g1( float a ) { + + return w2( a ) + w3( a ); + + } + + // h0 and h1 are the two offset functions + float h0( float a ) { + + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + + } + + float h1( float a ) { + + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + + } + + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + + uv = uv * texelSize.zw + 0.5; + + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + + } + + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + + } + + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + + // Direction of refracted light. + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + + // Compute rotation-independant scaling of the model matrix. + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + + // The thickness is specified in local space. + return normalize( refractionVector ) * thickness * modelScale; + + } + + float applyIorToRoughness( const in float roughness, const in float ior ) { + + // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and + // an IOR of 1.5 results in the default amount of microfacet refraction. + 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 lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + + } + + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + + if ( isinf( attenuationDistance ) ) { + + // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all. + return vec3( 1.0 ); + + } else { + + // Compute light attenuation using Beer's law. + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law + return transmittance; + + } + + } + + 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 dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + + vec4 transmittedLight; + vec3 transmittance; + + #ifdef USE_DISPERSION + + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + + for ( int i = 0; i < 3; i ++ ) { + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + // Sample framebuffer to get pixel the refracted ray hits. + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + + } + + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + // Sample framebuffer to get pixel the refracted ray hits. + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + + // Get the specular component. + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + + // As less light is transmitted, the opacity should be increased. This simple approximation does a decent job + // of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color. + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + + } +#endif +`,du=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + varying vec2 vUv; + +#endif +#ifdef USE_MAP + + varying vec2 vMapUv; + +#endif +#ifdef USE_ALPHAMAP + + varying vec2 vAlphaMapUv; + +#endif +#ifdef USE_LIGHTMAP + + varying vec2 vLightMapUv; + +#endif +#ifdef USE_AOMAP + + varying vec2 vAoMapUv; + +#endif +#ifdef USE_BUMPMAP + + varying vec2 vBumpMapUv; + +#endif +#ifdef USE_NORMALMAP + + varying vec2 vNormalMapUv; + +#endif +#ifdef USE_EMISSIVEMAP + + varying vec2 vEmissiveMapUv; + +#endif +#ifdef USE_METALNESSMAP + + varying vec2 vMetalnessMapUv; + +#endif +#ifdef USE_ROUGHNESSMAP + + varying vec2 vRoughnessMapUv; + +#endif +#ifdef USE_ANISOTROPYMAP + + varying vec2 vAnisotropyMapUv; + +#endif +#ifdef USE_CLEARCOATMAP + + varying vec2 vClearcoatMapUv; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + varying vec2 vClearcoatNormalMapUv; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + varying vec2 vClearcoatRoughnessMapUv; + +#endif +#ifdef USE_IRIDESCENCEMAP + + varying vec2 vIridescenceMapUv; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + varying vec2 vIridescenceThicknessMapUv; + +#endif +#ifdef USE_SHEEN_COLORMAP + + varying vec2 vSheenColorMapUv; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + varying vec2 vSheenRoughnessMapUv; + +#endif +#ifdef USE_SPECULARMAP + + varying vec2 vSpecularMapUv; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + varying vec2 vSpecularColorMapUv; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + varying vec2 vSpecularIntensityMapUv; + +#endif +#ifdef USE_TRANSMISSIONMAP + + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; + +#endif +#ifdef USE_THICKNESSMAP + + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; + +#endif +`,vu=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + varying vec2 vUv; + +#endif +#ifdef USE_MAP + + uniform mat3 mapTransform; + varying vec2 vMapUv; + +#endif +#ifdef USE_ALPHAMAP + + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; + +#endif +#ifdef USE_LIGHTMAP + + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; + +#endif +#ifdef USE_AOMAP + + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; + +#endif +#ifdef USE_BUMPMAP + + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; + +#endif +#ifdef USE_NORMALMAP + + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; + +#endif +#ifdef USE_DISPLACEMENTMAP + + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; + +#endif +#ifdef USE_EMISSIVEMAP + + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; + +#endif +#ifdef USE_METALNESSMAP + + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; + +#endif +#ifdef USE_ROUGHNESSMAP + + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; + +#endif +#ifdef USE_ANISOTROPYMAP + + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; + +#endif +#ifdef USE_CLEARCOATMAP + + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; + +#endif +#ifdef USE_SHEEN_COLORMAP + + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; + +#endif +#ifdef USE_IRIDESCENCEMAP + + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; + +#endif +#ifdef USE_SPECULARMAP + + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; + +#endif +#ifdef USE_TRANSMISSIONMAP + + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; + +#endif +#ifdef USE_THICKNESSMAP + + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; + +#endif +`,pu=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + vUv = vec3( uv, 1 ).xy; + +#endif +#ifdef USE_MAP + + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ALPHAMAP + + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_LIGHTMAP + + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_AOMAP + + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_BUMPMAP + + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_NORMALMAP + + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_DISPLACEMENTMAP + + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_EMISSIVEMAP + + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_METALNESSMAP + + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ROUGHNESSMAP + + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ANISOTROPYMAP + + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_CLEARCOATMAP + + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_IRIDESCENCEMAP + + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SHEEN_COLORMAP + + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SPECULARMAP + + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_TRANSMISSIONMAP + + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_THICKNESSMAP + + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; + +#endif +`,mu=` +#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + + vec4 worldPosition = vec4( transformed, 1.0 ); + + #ifdef USE_BATCHING + + worldPosition = batchingMatrix * worldPosition; + + #endif + + #ifdef USE_INSTANCING + + worldPosition = instanceMatrix * worldPosition; + + #endif + + worldPosition = modelMatrix * worldPosition; + +#endif +`;let gu=` +varying vec2 vUv; +uniform mat3 uvTransform; + +void main() { + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + + gl_Position = vec4( position.xy, 1.0, 1.0 ); + +} +`,_u=` +uniform sampler2D t2D; +uniform float backgroundIntensity; + +varying vec2 vUv; + +void main() { + + vec4 texColor = texture2D( t2D, vUv ); + + #ifdef DECODE_VIDEO_TEXTURE + + // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures + + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + + #endif + + texColor.rgb *= backgroundIntensity; + + gl_FragColor = texColor; + + #include + #include + +} +`,wu=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + gl_Position.z = gl_Position.w; // set z to camera.far + +} +`,Mu=` + +#ifdef ENVMAP_TYPE_CUBE + + uniform samplerCube envMap; + +#elif defined( ENVMAP_TYPE_CUBE_UV ) + + uniform sampler2D envMap; + +#endif + +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; + +varying vec3 vWorldDirection; + +#include + +void main() { + + #ifdef ENVMAP_TYPE_CUBE + + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + + #elif defined( ENVMAP_TYPE_CUBE_UV ) + + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + + #else + + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + + #endif + + texColor.rgb *= backgroundIntensity; + + gl_FragColor = texColor; + + #include + #include + +} +`,yu=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + gl_Position.z = gl_Position.w; // set z to camera.far + +} +`,Eu=` +uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; + +varying vec3 vWorldDirection; + +void main() { + + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + + #include + #include + +} +`,xu=` +#include +#include +#include +#include +#include +#include +#include +#include + +// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible. +// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for +// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1. +varying vec2 vHighPrecisionZW; + +void main() { + + #include + + #include + #include + + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vHighPrecisionZW = gl_Position.zw; + +} +`,bu=` +#if DEPTH_PACKING == 3200 + + uniform float opacity; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +varying vec2 vHighPrecisionZW; + +void main() { + + vec4 diffuseColor = vec4( 1.0 ); + #include + + #if DEPTH_PACKING == 3200 + + diffuseColor.a = opacity; + + #endif + + #include + #include + #include + #include + + #include + + // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values. + 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 ); + + #elif DEPTH_PACKING == 3202 + + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + + #elif DEPTH_PACKING == 3203 + + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + + #endif + +} +`,Su=` +#define DISTANCE + +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + #include + + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vWorldPosition = worldPosition.xyz; + +} +`,Tu=` +#define DISTANCE + +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main () { + + vec4 diffuseColor = vec4( 1.0 ); + #include + + #include + #include + #include + #include + + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); // clamp to [ 0, 1 ] + + gl_FragColor = packDepthToRGBA( dist ); + +} +`,Au=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + +} +`,Ru=` +uniform sampler2D tEquirect; + +varying vec3 vWorldDirection; + +#include + +void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + #include + #include + +} +`,Lu=` +uniform float scale; +attribute float lineDistance; + +varying float vLineDistance; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vLineDistance = scale * lineDistance; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + +} +`,Cu=` +uniform vec3 diffuse; +uniform float opacity; + +uniform float dashSize; +uniform float totalSize; + +varying float vLineDistance; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + if ( mod( vLineDistance, totalSize ) > dashSize ) { + + discard; + + } + + vec3 outgoingLight = vec3( 0.0 ); + + #include + #include + #include + + outgoingLight = diffuseColor.rgb; // simple shader + + #include + #include + #include + #include + #include + +} +`,Nu=` +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + + #include + #include + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,Iu=` +uniform vec3 diffuse; +uniform float opacity; + +#ifndef FLAT_SHADED + + varying vec3 vNormal; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + #include + #include + #include + #include + #include + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + + // accumulation (baked indirect lighting only) + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + + #else + + reflectedLight.indirectDiffuse += vec3( 1.0 ); + + #endif + + // modulation + #include + + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + + vec3 outgoingLight = reflectedLight.indirectDiffuse; + + #include + + #include + #include + #include + #include + #include + #include + +} +`,Pu=` +#define LAMBERT + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + +} +`,Du=` +#define LAMBERT + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + #include +} +`,Ou=` +#define MATCAP + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + +} +`,Uu=` +#define MATCAP + +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + 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; // 0.495 to remove artifacts caused by undersized matcap disks + + #ifdef USE_MATCAP + + vec4 matcapColor = texture2D( matcap, uv ); + + #else + + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing + + #endif + + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + + #include + #include + #include + #include + #include + #include + +} +`,Fu=` +#define NORMAL + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + + vViewPosition = - mvPosition.xyz; + +#endif + +} +`,Bu=` +#define NORMAL + +uniform float opacity; + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + + #include + #include + #include + #include + + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + + #ifdef OPAQUE + + gl_FragColor.a = 1.0; + + #endif + +} +`,ku=` +#define PHONG + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + +} +`,Gu=` +#define PHONG + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + #include + +} +`,Hu=` +#define STANDARD + +varying vec3 vViewPosition; + +#ifdef USE_TRANSMISSION + + varying vec3 vWorldPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +#ifdef USE_TRANSMISSION + + vWorldPosition = worldPosition.xyz; + +#endif +} +`,Vu=` +#define STANDARD + +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; + +#ifdef IOR + uniform float ior; +#endif + +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif + +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif + +#ifdef USE_DISPERSION + uniform float dispersion; +#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_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif + +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + + #include + + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + + #ifdef USE_SHEEN + + // Sheen energy compensation approximation calculation can be found at the end of + // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + + #ifdef USE_CLEARCOAT + + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + + #endif + + #include + #include + #include + #include + #include + #include + +} +`,zu=` +#define TOON + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +} +`,Wu=` +#define TOON + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + +} +`,ju=` +uniform float size; +uniform float scale; + +#include +#include +#include +#include +#include +#include + +#ifdef USE_POINTS_UV + + varying vec2 vUv; + uniform mat3 uvTransform; + +#endif + +void main() { + + #ifdef USE_POINTS_UV + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + + #endif + + #include + #include + #include + #include + #include + #include + + gl_PointSize = size; + + #ifdef USE_SIZEATTENUATION + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + + #endif + + #include + #include + #include + #include + +} +`,Xu=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + vec3 outgoingLight = vec3( 0.0 ); + + #include + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + #include + +} +`,Yu=` +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,Zu=` +uniform vec3 color; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + + #include + #include + #include + +} +`,qu=` +uniform float rotation; +uniform vec2 center; + +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 mvPosition = modelViewMatrix[ 3 ]; + + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + + #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 + #include + #include + +} +`,Ku=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + + vec3 outgoingLight = vec3( 0.0 ); + + #include + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + +} +`,Ju=` +#define LAMBERT + +varying vec3 vViewPosition; +varying vec3 heatPosition; + +// fengmap +varying float vIsPerspectiveCamera; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + heatPosition = vec3(modelMatrix * vec4( position, 1.0 )); + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + + // fengmap + vIsPerspectiveCamera = isPerspectiveMatrix( projectionMatrix ) ? 1.0 : 0.0; +} +`,$u=` +#define LAMBERT + +// fengmap +varying float vIsPerspectiveCamera; + +varying vec3 heatPosition; +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +uniform bool mapMixColor; +uniform vec2 heatCenter; +uniform vec2 heatSize; + +uniform bool isJsonModel; + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +vec3 rgb2hsb(vec3 c) { + float maxVal = max(c.r, max(c.g, c.b)); + float minVal = min(c.r, min(c.g, c.b)); + float delta = maxVal - minVal; + + float h = 0.0; + if (delta > 0.0) { + if (maxVal == c.r) { + h = mod((c.g - c.b) / delta, 6.0); + } else if (maxVal == c.g) { + h = (c.b - c.r) / delta + 2.0; + } else { + h = (c.r - c.g) / delta + 4.0; + } + h /= 6.0; // Normalize to range [0,1] + } + + float s = (maxVal == 0.0) ? 0.0 : delta / maxVal; + float b = maxVal; + + return vec3(h, s, b); +} + +vec3 hsb2rgb(vec3 c) { + float h = c.x * 6.0; + float s = c.y; + float b = c.z; + + float i = floor(h); + float f = h - i; + float p = b * (1.0 - s); + float q = b * (1.0 - f * s); + float t = b * (1.0 - (1.0 - f) * s); + + if (i == 0.0) return vec3(b, t, p); + if (i == 1.0) return vec3(q, b, p); + if (i == 2.0) return vec3(p, b, t); + if (i == 3.0) return vec3(p, q, b); + if (i == 4.0) return vec3(t, p, b); + return vec3(b, p, q); +} + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #ifdef IGNORE_LIGHTING + if(vIsPerspectiveCamera == 0.0) { + outgoingLight = diffuseColor.rgb; + } + #endif + + #ifdef USE_MODEL_SIDE_GRADIENT + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + if (dot(vec3(0.0, 1.0, 0.0), worldNormal) < 0.8) { + vec3 hsb = rgb2hsb(outgoingLight); + hsb.y = clamp(hsb.y * 1.5, 0.0, 1.0); + hsb.z = clamp(hsb.z * 0.8, 0.0, 1.0); + outgoingLight = mix(hsb2rgb(hsb), outgoingLight, vUv.y); + } + #endif + + #include + #include + #include + #include + #include + #include + #include +} +`,Qu=` +#define STANDARD + +varying vec3 vViewPosition; + +#ifdef USE_TRANSMISSION + + varying vec3 vWorldPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +#ifdef USE_TRANSMISSION + + vWorldPosition = worldPosition.xyz; + +#endif + + //fengmap + #include +} +`,tc=` +#define STANDARD + +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; + +#ifdef IOR + uniform float ior; +#endif + +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif + +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif + +#ifdef USE_DISPERSION + uniform float dispersion; +#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_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif + +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + + #include + + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + + #ifdef USE_SHEEN + + // Sheen energy compensation approximation calculation can be found at the end of + // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + + #ifdef USE_CLEARCOAT + + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + + #endif + + #include + #include + #include + #include + #include + #include + #include +} +`,ec=` +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + + #include + #include + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,ic=` +uniform vec3 diffuse; +uniform float opacity; + +#ifndef FLAT_SHADED + + varying vec3 vNormal; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + + // accumulation (baked indirect lighting only) + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + + #else + + reflectedLight.indirectDiffuse += vec3( 1.0 ); + + #endif + + // modulation + #include + + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + + vec3 outgoingLight = reflectedLight.indirectDiffuse; + + #include + + #include + #include + #include + #include + #include + #include + +} +`;var sc=` + +struct PhysicalMaterial { + + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + + #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 + + #ifdef IOR + float ior; + #endif + + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif + +}; + +// temporary +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); + +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 ); +} + +// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 +// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +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 ); + +} + +// Microfacet Models for Refraction through Rough Surfaces - equation (33) +// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html +// alpha is "roughness squared" in Disney’s reparameterization +float D_GGX( const in float alpha, const in float dotNH ) { + + float a2 = pow2( alpha ); + + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1 + + return RECIPROCAL_PI * a2 / pow2( denom ); + +} + +// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf +#ifdef USE_ANISOTROPY + + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + + return saturate(v); + + } + + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + + } + +#endif + +#ifdef USE_CLEARCOAT + + // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + + float alpha = pow2( roughness ); // UE4's 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 ); + + } + +#endif + +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + + float alpha = pow2( roughness ); // UE4's 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 ); + + #ifdef USE_IRIDESCENCE + + F = mix( F, material.iridescenceFresnel, material.iridescence ); + + #endif + + #ifdef USE_ANISOTROPY + + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + + #else + + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + + float D = D_GGX( alpha, dotNH ); + + #endif + + return F * ( V * D ); + +} + +// Rect Area Light + +// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines +// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt +// code: https://github.com/selfshadow/ltc_code/ + +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 ) ); + + // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) ) + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + + uv = uv * LUT_SCALE + LUT_BIAS; + + return uv; + +} + +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + + // Real-Time Area Lighting: a Journey from Research to Production (p.102) + // An approximation of the form factor of a horizon-clipped rectangle. + + 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 ); + + // rational polynomial approximation to theta / sin( theta ) / 2PI + 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 ] ) { + + // bail if point is on back side of plane of light + // assumes ccw winding order of light vertices + 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 ); + + // construct orthonormal basis around N + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system + + // compute transform + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + + // transform rect + 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 ); + + // project rect onto sphere + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + + // calculate vector form factor + 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 ] ); + + // adjust for horizon clipping + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + +/* + // alternate method of adjusting for horizon clipping (see referece) + // refactoring required + float len = length( vectorFormFactor ); + float z = vectorFormFactor.z / len; + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + // tabulated horizon-clipped sphere, apparently... + vec2 uv = vec2( z * 0.5 + 0.5, len ); + uv = uv * LUT_SCALE + LUT_BIAS; + + float scale = texture2D( ltc_2, uv ).w; + + float result = len * scale; +*/ + + return vec3( result ); + +} + +// End Rect Area Light + +#if defined( USE_SHEEN ) + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float D_Charlie( float roughness, float dotNH ) { + + float alpha = pow2( roughness ); + + // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16 + + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); + +} + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float V_Neubelt( float dotNV, float dotNL ) { + + // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" + 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 + +// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from +// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found +// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing +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 ); + +} + +// Analytical approximation of the DFG LUT, one half of the +// split-sum approximation used in indirect specular lighting. +// via 'environmentBRDF' from "Physically Based Shading on Mobile" +// https://www.unrealengine.com/blog/physically-based-shading-on-mobile +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; + +} + +// Fdez-Agüera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting" +// Approximates multiscattering in order to preserve energy. +// http://www.jcgt.org/published/0008/01/03/ +#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; // 1/21 + 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + 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; // counterclockwise; light shines in local neg z direction + 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 ) + ); + + // LTC Fresnel Approximation by Stephen Hill + // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf + 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + + vec3 irradiance = dotNL * directLight.color; + #ifndef PHYSICALLY_CORRECT_LIGHTS + + irradiance *= PI; // punctual light + + + #endif + #ifdef USE_CLEARCOAT + + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + + vec3 ccIrradiance = dotNLcc * directLight.color; + + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + #endif + + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} + +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + + #ifdef USE_CLEARCOAT + + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + + #endif + + // Both indirect specular and indirect diffuse light accumulate here + + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + + #ifdef USE_IRIDESCENCE + + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + + #else + + computeMultiscattering( geometryNormal, geometryViewDir, 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 + +// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +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 ); + +} +`,rc=` +uniform bool receiveShadow; +uniform vec3 ambientLightColor; + +#if defined( USE_LIGHT_PROBES ) + + uniform vec3 lightProbe[ 9 ]; + +#endif + +// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere +// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + + // normal is assumed to have unit length + + float x = normal.x, y = normal.y, z = normal.z; + + // band 0 + vec3 result = shCoefficients[ 0 ] * 0.886227; + + // band 1 + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + + // band 2 + 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; + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + return irradiance; + +} + +// fengmap r115 +float punctualLightIntensityToIrradianceFactor( 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 getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + + // based upon Frostbite 3 Moving to Physically-based Rendering + // page 32, equation 26: E[window1] + // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + + if ( cutoffDistance > 0.0 ) { + + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + + } + + return distanceFalloff; + +} + +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, 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 ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + + vec3 lVector = pointLight.position - geometryPosition; + + light.direction = normalize( lVector ); + + float lightDistance = length( lVector ); + + light.color = pointLight.color; + light.color *= punctualLightIntensityToIrradianceFactor( 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 ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + + vec3 lVector = spotLight.position - geometryPosition; + + 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 *= punctualLightIntensityToIrradianceFactor( 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; + }; + + // Pre-computed values of LinearTransformedCosine approximation of BRDF + // BRDF approximation Texture is 64x64 + uniform sampler2D ltc_1; // RGBA Float + uniform sampler2D ltc_2; // RGBA Float + + 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 +`,nc=` +varying vec3 vViewPosition; + +struct LambertMaterial { + + vec3 diffuseColor; + float specularStrength; + +}; + +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = vec3(dotNL) * directLight.color; + irradiance *= 3.1415926; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert +`,ac=` +#ifdef USE_MAP + +vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + bool needMultiply = true; + if(!isJsonModel){ + if (vMapUv.x < 0.0 || vMapUv.x > 1.0 || vMapUv.y < 0.0 || vMapUv.y > 1.0) { + sampledDiffuseColor = diffuseColor; + needMultiply = false; + } + } + + + #ifdef DECODE_VIDEO_TEXTURE + // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516) + 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 + + if(mapMixColor){ + vec2 uvHeat=vec2((heatPosition.x - (heatCenter.x - heatSize.x/2.0)) / heatSize.x , (heatPosition.z - (heatCenter.y-heatSize.y/2.0)) / heatSize.y); + vec4 heatColor=texture2D( map, uvHeat ); + diffuseColor = heatColor*heatColor.a + diffuseColor*(1.0-heatColor.a); + } else if(needMultiply){ + diffuseColor *= sampledDiffuseColor; + } +#endif +`,hc=` +if(isRect&&isEnable){ + vec2 v = vec2(v_position.x - moveP.x, v_position.z - moveP.y); + if(isInRectW(v,se2N,sweepW) && isInRectH(v,se2RN,sweepH)){ + gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*color_a.rgb, 0.5),gl_FragColor.a); + } +} + +if(isAnnulus&&isEnable){ + if(isMaxCircle(v_position.xyz,circleC,maxR) && isMinCircle(v_position.xyz,circleC,minR)){ + if(isSweepTexture){ + vec2 uv = vec2((v_position.x-(circleC.x-maxR))/(2.0*maxR),(v_position.z-(circleC.y-maxR))/(2.0*maxR)); + vec4 tex = texture2D( sweepTexture, uv ); + tex = mapTexelToLinear( tex ); + float d2 = pow(v_position.x-circleC.x,2.0) + pow(v_position.z-circleC.y,2.0); + float a = smoothstep(0.0, pow(maxR,2.0), d2); + a = 1.0 - a; + tex.a = a; + gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*tex.rgb, 0.2),gl_FragColor.a); + } else { + gl_FragColor = vec4(mix(gl_FragColor.rgb, sweepStrength*color_a.rgb, 0.5),gl_FragColor.a); + } + } + +} +`,oc=` + uniform bool isRect; + uniform bool isAnnulus; + + uniform float sweepW; + uniform float sweepH; + uniform vec2 se2N; + uniform vec2 se2RN; + uniform vec2 moveP; + uniform vec3 color_r; + + uniform vec2 circleC; + uniform float maxR; + uniform float minR; + uniform vec3 color_a; + + uniform bool isSweepTexture; + uniform sampler2D sweepTexture; + uniform float sweepStrength; + + uniform bool isEnable; + + bool isInRectW(vec2 v, vec2 a, float w){ + float a1 = abs(dot(v,a)); + return a1 < w; + } + + bool isInRectH(vec2 v, vec2 a, float h){ + float a1 = abs(dot(v,a)); + return a1 < h; + } + + bool isMaxCircle(vec3 a, vec2 b, float r){ + float c = pow((a.x-b.x),2.0)+pow((a.z-b.y),2.0); + return c <= pow(r,2.0); + } + + bool isMinCircle(vec3 a, vec2 b, float r){ + float c = pow((a.x-b.x),2.0)+pow((a.z-b.y),2.0); + return c > pow(r,2.0); + } + + vec4 mapTexelToLinear( vec4 value ) { + return value; + } +`,lc=` + varying vec3 v_position; +`,uc=` + v_position = vec3(modelMatrix * vec4( position, 1.0 )); +`,cc=` + #if NUM_MASK_POLYGON > 0 + varying vec3 maskPosition; + #endif +`,fc=` + #if NUM_MASK_POLYGON > 0 + maskPosition = vec3(modelMatrix * vec4( position, 1.0 )); + #endif +`,dc=` + #if NUM_MASK_POLYGON > 0 + varying vec3 maskPosition; + varying float v_positionHeight; + uniform vec2 maskPolygons[ NUM_MASK_POLYGON ]; + uniform int maskType; + uniform bool isMask; + uniform float maskHeight; + uniform float maskExtrudeHeight; + uniform vec2 boundCenter; + uniform vec2 boundSize; + uniform float maskOpacity; + uniform float maskNodeHeight; + bool isPointInsidePolygon(vec2 point,vec2 polygon2[NUM_MASK_POLYGON], int count) { + if(count==1){ + return false; + } + if(count==2){ + return true; + } + <#ISPOINTINSIDEPOLYGON#> + } + #endif + #if NUM_MASK_HOLE_POLYGON>0 + uniform vec2 maskHolePogygons[ NUM_MASK_HOLE_POLYGON ]; + bool isPointInsideHolePolygon(vec2 point,vec2 polygon2[NUM_MASK_HOLE_POLYGON], int count) { + if(count==1){ + return false; + } + if(count==2){ + return true; + } + <#ISPOINTINSIDEHOLEPOLYGON#> + } + #endif +`,vc=` + #if NUM_MASK_POLYGON > 0 + if(isMask){ + vec2 uvMesk=vec2((maskPosition.x - (boundCenter.x - boundSize.x/2.0)) / boundSize.x , (maskPosition.z - (boundCenter.y-boundSize.y/2.0)) / boundSize.y); + bool isDiscard=false; + + if(maskType==0){ + if(!isPointInsidePolygon(uvMesk,maskPolygons,NUM_MASK_POLYGON)){ + isDiscard=true; + } + } else { + if(isPointInsidePolygon(uvMesk,maskPolygons,NUM_MASK_POLYGON)){ + isDiscard=true; + } + } + + #if NUM_MASK_HOLE_POLYGON > 0 + if(maskType==0){ + if(!isDiscard && isPointInsideHolePolygon(uvMesk,maskHolePogygons,NUM_MASK_HOLE_POLYGON)){ + isDiscard=true; + } + } else { + if(isDiscard && isPointInsideHolePolygon(uvMesk,maskHolePogygons,NUM_MASK_HOLE_POLYGON)){ + isDiscard=false; + } + } + + #endif + if(isDiscard){ + if(maskPosition.y >= maskNodeHeight + maskHeight && maskPosition.y <= maskNodeHeight + maskHeight + maskExtrudeHeight){ + if(maskOpacity == 0.0){ + discard; + } else { + diffuseColor.a = maskOpacity; + } + } + } + } + #endif +`;let b={alphahash_fragment:_o,alphahash_pars_fragment:wo,alphamap_fragment:Mo,alphamap_pars_fragment:yo,alphatest_fragment:Eo,alphatest_pars_fragment:xo,aomap_fragment:bo,aomap_pars_fragment:So,batching_pars_vertex:To,batching_vertex:Ao,begin_vertex:Ro,beginnormal_vertex:Lo,bsdfs:Co,iridescence_fragment:No,bumpmap_pars_fragment:Io,clipping_planes_fragment:Po,clipping_planes_pars_fragment:Do,clipping_planes_pars_vertex:Oo,clipping_planes_vertex:Uo,color_fragment:Fo,color_pars_fragment:Bo,color_pars_vertex:ko,color_vertex:Go,common:Ho,cube_uv_reflection_fragment:Vo,defaultnormal_vertex:zo,displacementmap_pars_vertex:Wo,displacementmap_vertex:jo,emissivemap_fragment:Xo,emissivemap_pars_fragment:Yo,colorspace_fragment:Zo,colorspace_pars_fragment:qo,envmap_fragment:Ko,envmap_common_pars_fragment:Jo,envmap_pars_fragment:$o,envmap_pars_vertex:Qo,envmap_physical_pars_fragment:ul,envmap_vertex:tl,fog_vertex:el,fog_pars_vertex:il,fog_fragment:sl,fog_pars_fragment:rl,gradientmap_pars_fragment:nl,lightmap_pars_fragment:al,lights_lambert_fragment:hl,lights_lambert_pars_fragment:ol,lights_pars_begin:ll,lights_toon_fragment:cl,lights_toon_pars_fragment:fl,lights_phong_fragment:dl,lights_phong_pars_fragment:vl,lights_physical_fragment:pl,lights_physical_pars_fragment:ml,lights_fragment_begin:gl,lights_fragment_maps:_l,lights_fragment_end:wl,logdepthbuf_fragment:Ml,logdepthbuf_pars_fragment:yl,logdepthbuf_pars_vertex:El,logdepthbuf_vertex:xl,map_fragment:bl,map_pars_fragment:Sl,map_particle_fragment:Tl,map_particle_pars_fragment:Al,metalnessmap_fragment:Rl,metalnessmap_pars_fragment:Ll,morphinstance_vertex:Cl,morphcolor_vertex:Nl,morphnormal_vertex:Il,morphtarget_pars_vertex:Pl,morphtarget_vertex:Dl,normal_fragment_begin:Ol,normal_fragment_maps:Ul,normal_pars_fragment:Fl,normal_pars_vertex:Bl,normal_vertex:kl,normalmap_pars_fragment:Gl,clearcoat_normal_fragment_begin:Hl,clearcoat_normal_fragment_maps:Vl,clearcoat_pars_fragment:zl,iridescence_pars_fragment:Wl,opaque_fragment:jl,packing:Xl,premultiplied_alpha_fragment:Yl,project_vertex:Zl,dithering_fragment:ql,dithering_pars_fragment:Kl,roughnessmap_fragment:Jl,roughnessmap_pars_fragment:$l,shadowmap_pars_fragment:Ql,shadowmap_pars_vertex:tu,shadowmap_vertex:eu,shadowmask_pars_fragment:iu,skinbase_vertex:su,skinning_pars_vertex:ru,skinning_vertex:nu,skinnormal_vertex:au,specularmap_fragment:hu,specularmap_pars_fragment:ou,tonemapping_fragment:lu,tonemapping_pars_fragment:uu,transmission_fragment:cu,transmission_pars_fragment:fu,uv_pars_fragment:du,uv_pars_vertex:vu,uv_vertex:pu,worldpos_vertex:mu,fengmap_map_fragment:ac,fengmap_lights_pars_begin:rc,fengmap_lights_lambert_pars_fragment:nc,fengmap_lights_physical_pars_fragment:sc,fengmap_sweep_fragment:hc,fengmap_sweep_pars_fragment:oc,fengmap_sweep_pars_common:lc,fengmap_sweep_vertex:uc,fengmap_mask_vertex1:cc,fengmap_mask_vertex2:fc,fengmap_mask_fragment1:dc,fengmap_mask_fragment2:vc,background_vert:gu,background_frag:_u,backgroundCube_vert:wu,backgroundCube_frag:Mu,cube_vert:yu,cube_frag:Eu,depth_vert:xu,depth_frag:bu,distanceRGBA_vert:Su,distanceRGBA_frag:Tu,equirect_vert:Au,equirect_frag:Ru,linedashed_vert:Lu,linedashed_frag:Cu,meshbasic_vert:Nu,meshbasic_frag:Iu,meshlambert_vert:Pu,meshlambert_frag:Du,meshmatcap_vert:Ou,meshmatcap_frag:Uu,meshnormal_vert:Fu,meshnormal_frag:Bu,meshphong_vert:ku,meshphong_frag:Gu,meshphysical_vert:Hu,meshphysical_frag:Vu,meshtoon_vert:zu,meshtoon_frag:Wu,points_vert:ju,points_frag:Xu,shadow_vert:Yu,shadow_frag:Zu,sprite_vert:qu,sprite_frag:Ku,fmMeshlambert_vert:Ju,fmMeshlambert_frag:$u,fmMeshphysical_vert:Qu,fmMeshphysical_frag:tc,fmMeshBasic_vert:ec,fmMeshBasic_frag:ic},P={common:{diffuse:{value:new Wt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _},alphaMap:{value:null},alphaMapTransform:{value:new _},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _}},envmap:{envMap:{value:null},envMapRotation:{value:new _},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _},normalScale:{value:new ct(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Wt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Wt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _},alphaTest:{value:0},uvTransform:{value:new _}},sprite:{diffuse:{value:new Wt(16777215)},opacity:{value:1},center:{value:new ct(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _},alphaMap:{value:null},alphaMapTransform:{value:new _},alphaTest:{value:0}}},pc={basic:{uniforms:Uh([P.common,P.specularmap,P.envmap,P.aomap,P.lightmap,P.fog]),vertexShader:b.meshbasic_vert,fragmentShader:b.meshbasic_frag},lambert:{uniforms:Uh([P.common,P.specularmap,P.envmap,P.aomap,P.lightmap,P.emissivemap,P.bumpmap,P.normalmap,P.displacementmap,P.fog,P.lights,{emissive:{value:new Wt(0)}}]),vertexShader:b.meshlambert_vert,fragmentShader:b.meshlambert_frag},phong:{uniforms:Uh([P.common,P.specularmap,P.envmap,P.aomap,P.lightmap,P.emissivemap,P.bumpmap,P.normalmap,P.displacementmap,P.fog,P.lights,{emissive:{value:new Wt(0)},specular:{value:new Wt(1118481)},shininess:{value:30}}]),vertexShader:b.meshphong_vert,fragmentShader:b.meshphong_frag},standard:{uniforms:Uh([P.common,P.envmap,P.aomap,P.lightmap,P.emissivemap,P.bumpmap,P.normalmap,P.displacementmap,P.roughnessmap,P.metalnessmap,P.fog,P.lights,{emissive:{value:new Wt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:b.meshphysical_vert,fragmentShader:b.meshphysical_frag},toon:{uniforms:Uh([P.common,P.aomap,P.lightmap,P.emissivemap,P.bumpmap,P.normalmap,P.displacementmap,P.gradientmap,P.fog,P.lights,{emissive:{value:new Wt(0)}}]),vertexShader:b.meshtoon_vert,fragmentShader:b.meshtoon_frag},matcap:{uniforms:Uh([P.common,P.bumpmap,P.normalmap,P.displacementmap,P.fog,{matcap:{value:null}}]),vertexShader:b.meshmatcap_vert,fragmentShader:b.meshmatcap_frag},points:{uniforms:Uh([P.points,P.fog]),vertexShader:b.points_vert,fragmentShader:b.points_frag},dashed:{uniforms:Uh([P.common,P.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:b.linedashed_vert,fragmentShader:b.linedashed_frag},depth:{uniforms:Uh([P.common,P.displacementmap]),vertexShader:b.depth_vert,fragmentShader:b.depth_frag},normal:{uniforms:Uh([P.common,P.bumpmap,P.normalmap,P.displacementmap,{opacity:{value:1}}]),vertexShader:b.meshnormal_vert,fragmentShader:b.meshnormal_frag},sprite:{uniforms:Uh([P.sprite,P.fog]),vertexShader:b.sprite_vert,fragmentShader:b.sprite_frag},background:{uniforms:{uvTransform:{value:new _},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:b.background_vert,fragmentShader:b.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _}},vertexShader:b.backgroundCube_vert,fragmentShader:b.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:b.cube_vert,fragmentShader:b.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:b.equirect_vert,fragmentShader:b.equirect_frag},distanceRGBA:{uniforms:Uh([P.common,P.displacementmap,{referencePosition:{value:new Gt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:b.distanceRGBA_vert,fragmentShader:b.distanceRGBA_frag},shadow:{uniforms:Uh([P.lights,P.fog,{color:{value:new Wt(0)},opacity:{value:1}}]),vertexShader:b.shadow_vert,fragmentShader:b.shadow_frag}},mc=(pc.physical={uniforms:Uh([pc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _},clearcoatNormalScale:{value:new ct(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _},sheen:{value:0},sheenColor:{value:new Wt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _},transmissionSamplerSize:{value:new ct},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _},attenuationDistance:{value:0},attenuationColor:{value:new Wt(0)},specularColor:{value:new Wt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _},anisotropyVector:{value:new ct},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _}}]),vertexShader:b.meshphysical_vert,fragmentShader:b.meshphysical_frag},pc.fmStandard={uniforms:Uh([pc.standard.uniforms,{sweepW:{value:0},sweepH:{value:0},se2N:{value:new ct(0,0)},se2RN:{value:new ct(0,0)},moveP:{value:new ct(0,0)},color_r:{value:new Wt(16711935)},color_a:{value:new Wt(16776960)},isRect:{value:!1},isAnnulus:{value:!1},isEnable:{value:!1},circleC:{value:new ct(0,0)},maxR:{value:0},minR:{value:0},isSweepTexture:{value:!1},sweepTexture:{value:null},sweepStrength:{value:1}},{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskOpacity:{value:null}},{maskNodeHeight:{value:0}}]),vertexShader:b.fmMeshphysical_vert,fragmentShader:b.fmMeshphysical_frag},pc.fmLambert={uniforms:Uh([pc.lambert.uniforms,{mapMixColor:{value:!1}},{heatCenter:{value:new ct(0,0)}},{heatSize:{value:new ct(0,0)}},{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskOpacity:{value:null}},{maskNodeHeight:{value:0}},{isJsonModel:{value:!1}}]),vertexShader:b.fmMeshlambert_vert,fragmentShader:b.fmMeshlambert_frag},pc.fmbasic={uniforms:Uh([pc.basic.uniforms,{isMask:{value:!1}},{maskType:{value:0}},{maskPolygons:{value:[]}},{maskHolePogygons:{value:[]}},{maskHeight:{value:0}},{maskExtrudeHeight:{value:0}},{boundCenter:{value:null}},{boundSize:{value:null}},{maskNodeHeight:{value:0}},{maskOpacity:{value:null}}]),vertexShader:b.fmMeshBasic_vert,fragmentShader:b.fmMeshBasic_frag},{r:0,b:0,g:0}),gc=new Ps,_c=new Ht;function wc(s,i,r,n,a,t,h){let o=new Wt(0),l=!0===t?0:1,u,c,f=null,d=0,v=null;function p(t){let e=!0===t.isScene?t.background:null;return e&&e.isTexture&&(t=0{let s=!0===i.wireframe,r=N[t.id],n=(void 0===r&&(r={},N[t.id]=r),r[e.id]),a=(void 0===n&&(n={},r[e.id]=n),n[s]);return void 0===a&&(a=O(L.createVertexArray()),n[s]=a),a})(a,n,t);if(I!==e&&D((I=e).object),e=((e,t,i,s)=>{let r=I.attributes,n=t.attributes,a=0,h=i.getAttributes();for(var o in h)if(0<=h[o].location){var l=r[o];let t=n[o];if(void 0===t&&("instanceMatrix"===o&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===o)&&e.instanceColor&&(t=e.instanceColor),void 0===l)return!0;if(l.attribute!==t)return!0;if(t&&l.data!==t.data)return!0;a++}return I.attributesNum!==a||I.index!==s})(r,a,n,h)){var o,l=r,u=n,c=h;let e={},i=a.attributes,s=0,t=u.getAttributes();for(o in t)if(0<=t[o].location){let t=i[o];void 0===t&&("instanceMatrix"===o&&l.instanceMatrix&&(t=l.instanceMatrix),"instanceColor"===o)&&l.instanceColor&&(t=l.instanceColor);var f={};(f.attribute=t)&&t.data&&(f.data=t.data),e[o]=f,s++}I.attributes=e,I.attributesNum=s,I.index=c}if(null!==h&&C.update(h,L.ELEMENT_ARRAY_BUFFER),e||P){P=!1;var i=r,u=t,c=n,s=a;U();var d,v=s.attributes,p=c.getAttributes(),m=u.defaultAttributeValues;for(d in p){var g=p[d];if(0<=g.location){let e=v[d];if(void 0!==(e=void 0===e&&("instanceMatrix"===d&&i.instanceMatrix&&(e=i.instanceMatrix),"instanceColor"===d)&&i.instanceColor?i.instanceColor:e)){var _=e.normalized,w=e.itemSize,M=C.get(e);if(void 0!==M){var y=M.buffer,E=M.type,x=M.bytesPerElement,b=E===L.INT||E===L.UNSIGNED_INT||e.gpuType===he;if(e.isInterleavedBufferAttribute){var S=e.data,T=S.stride,A=e.offset;if(S.isInstancedInterleavedBuffer){for(let t=0;t + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},s=new Nh(5,5,5),i=new Vh({name:"CubemapFromEquirect",uniforms:Oh(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Yt,blending:q}),s=(i.uniforms.tEquirect.value=e,new L(s,i)),i=e.minFilter;return e.minFilter===ee&&(e.minFilter=V),new Dc(1,10,this).update(t,s),e.minFilter=i,s.geometry.dispose(),s.material.dispose(),this}clear(e,i,s,r){var t=e.getRenderTarget();for(let t=0;t<6;t++)e.setRenderTarget(this,t),e.clear(i,s,r);e.setRenderTarget(t)}}function Fc(i){let s=new WeakMap;function r(t,e){return e===Ut?t.mapping=Dt:e===Ft&&(t.mapping=Ot),t}function n(t){var t=t.target,e=(t.removeEventListener("dispose",n),s.get(t));void 0!==e&&(s.delete(t),e.dispose())}return{get:function(t){if(t&&t.isTexture){var e=t.mapping;if(e===Ut||e===Ft)return s.has(t)?r(s.get(t).texture,t.mapping):(e=t.image)&&0Gc&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to `+Gc),[]);let v=0;for(let t=0;tr-Bc?s-r+Bc:0),4*(this.vn-t),3*t,2*t),h.setRenderTarget(e),h.render(l,Hc)}}function Jc(i){var s=[],r=[],n=[];let a=i;var t=i-Bc+1+kc.length;for(let e=0;ei-Bc?t=kc[e-i+Bc-1]:0===e&&(t=0),n.push(t);var h=1/(h-2),o=-h,h=1+h,l=[o,o,h,o,h,h,o,o,h,h,o,h],u=new Float32Array(108),c=new Float32Array(72),f=new Float32Array(36);for(let t=0;t<6;t++){var d=t%3*2/3-1,v=2Bc&&a--}return{lodPlanes:s,sizeLods:r,sigmas:n}}function $c(t,e,i){t=new Nc(t,e,i);return t.texture.mapping=Bt,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Qc(t,e,i,s,r){t.viewport.set(e,i,s,r),t.scissor.set(e,i,s,r)}function tf(t,e,i){var s=new Float32Array(Gc),r=new Gt(0,1,0);return new Vh({name:"SphericalGaussianBlur",defines:{n:Gc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:rf(),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 + + 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:q,depthTest:!1,depthWrite:!1})}function ef(){return new Vh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:q,depthTest:!1,depthWrite:!1})}function sf(){return new Vh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rf(),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:q,depthTest:!1,depthWrite:!1})}function rf(){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 nf(n){let a=new WeakMap,h=null;function o(t){var t=t.target,e=(t.removeEventListener("dispose",o),a.get(t));void 0!==e&&(a.delete(t),e.dispose())}return{get:function(e){if(e&&e.isTexture){var i=e.mapping,s=i===Ut||i===Ft,i=i===Dt||i===Ot;if(s||i){let t=a.get(e);var r=void 0!==t?t.texture.pmremVersion:0;return e.isRenderTargetTexture&&e.pmremVersion!==r?(null===h&&(h=new Kc(n)),(t=s?h.fromEquirectangular(e,t):h.fromCubemap(e,t)).texture.pmremVersion=e.pmremVersion,a.set(e,t),t.texture):void 0!==t?t.texture:(r=e.image,s&&r&&0{let i=0;for(let t=0;t<6;t++)void 0!==e[t]&&i++;return 6===i})(r)?(null===h&&(h=new Kc(n)),(t=s?h.fromEquirectangular(e):h.fromCubemap(e)).texture.pmremVersion=e.pmremVersion,a.set(e,t),e.addEventListener("dispose",o),t.texture):null)}}return e},dispose:function(){a=new WeakMap,null!==h&&(h.dispose(),h=null)}}}function af(i){let s={};function r(t){if(void 0!==s[t])return s[t];let e;switch(t){case"WEBGL_depth_texture":e=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":e=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=i.getExtension(t)}return s[t]=e}return{has:function(t){return null!==r(t)},init:function(){r("EXT_color_buffer_float"),r("WEBGL_clip_cull_distance"),r("OES_texture_float_linear"),r("EXT_color_buffer_half_float"),r("WEBGL_multisampled_render_to_texture"),r("WEBGL_render_shared_exponent")},get:function(t){var e=r(t);return null===e&&wh("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function hf(a,f,n,h){let o={},d=new WeakMap;function l(t){var e,i,s=t.target;for(e in null!==s.index&&f.remove(s.index),s.attributes)f.remove(s.attributes[e]);for(i in s.morphAttributes){var r=s.morphAttributes[i];for(let t=0,e=r.length;tE.maxTextureSize&&(s=Math.ceil(i/E.maxTextureSize),i=E.maxTextureSize);var v=new Float32Array(i*s*4*a);let r=new uf(v,i,s,a);r.type=le,r.needsUpdate=!0;var p=4*e;for(let t=0;t":" "} ${a}: `+s[t])}return r.join("\n")}function Td(t){var e=zt.getPrimaries(zt.workingColorSpace),i=zt.getPrimaries(t);let s;switch(e===i?s="":e===Ni&&i===Ci?s="LinearDisplayP3ToLinearSRGB":e===Ci&&i===Ni&&(s="LinearSRGBToLinearDisplayP3"),t){case Si:case Ai:return[s,"LinearTransferOETF"];case bi:case Ti:return[s,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[s,"LinearTransferOETF"]}}function Ad(t,e,i){var s=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();return s&&""===r?"":(s=/ERROR: 0:(\d+)/.exec(r))?(s=parseInt(s[1]),i.toUpperCase()+"\n\n"+r+"\n\n"+Sd(t.getShaderSource(e),s)):r}function Rd(t,e){e=Td(e);return`vec4 ${t}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function Ld(t,e){let i;switch(e){case S:i="Linear";break;case T:i="Reinhard";break;case A:i="Cineon";break;case R:i="ACESFilmic";break;case U:i="AgX";break;case F:i="Neutral";break;case O:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}let Cd=new Gt;function Nd(){return zt.getLuminanceCoefficients(Cd),["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${Cd.x.toFixed(4)}, ${Cd.y.toFixed(4)}, ${Cd.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Id(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Od).join("\n")}function Pd(t){var e,i=[];for(e in t){var s=t[e];!1!==s&&i.push("#define "+e+" "+s)}return i.join("\n")}function Dd(i,s){var r={},t=i.getProgramParameter(s,i.ACTIVE_ATTRIBUTES);for(let e=0;e",e.maskParam).replace("<#ISPOINTINSIDEHOLEPOLYGON#>",e.maskHoleParam)}let Gd=/^[ \t]*#include +<([\w\d./]+)>/gm;function Hd(t){return t.replace(Gd,zd)}let Vd=new Map;function zd(t,e){let i=b[e];if(void 0===i){var s=Vd.get(e);if(void 0===s)throw new Error("Can not resolve #include <"+e+">");i=b[s],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,s)}return Hd(i)}let Wd=/#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 jd(t){return t.replace(Wd,Xd)}function Xd(t,e,i,s){let r="";for(let t=parseInt(e);t=i.length?(s=new h0,i.push(s)):s=i[e],s},dispose:function(){r=new WeakMap}}}function l0(){let i={};return{get:function(t){if(void 0!==i[t.id])return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new Gt,color:new Wt};break;case"SpotLight":e={position:new Gt,direction:new Gt,color:new Wt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new Gt,color:new Wt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new Gt,skyColor:new Wt,groundColor:new Wt};break;case"RectAreaLight":e={color:new Wt,position:new Gt,halfWidth:new Gt,halfHeight:new Gt}}return i[t.id]=e}}}function u0(){let i={};return{get:function(t){if(void 0!==i[t.id])return i[t.id];let e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct,shadowCameraNear:1,shadowCameraFar:1e3}}return i[t.id]=e}}}let c0=0;function f0(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function d0(e){let T=new l0,A=u0(),R={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)R.probe.push(new Gt);let d=new Gt,v=new Ht,p=new Ht;return{setup:function(i){let s=0,r=0,n=0;for(let t=0;t<9;t++)R.probe[t].set(0,0,0);let a=0,h=0,o=0,l=0,u=0,c=0,f=0,d=0,v=0,p=0,m=0;i.sort(f0);for(let t=0,e=i.length;t=i.length?(s=new v0(r),i.push(s)):s=i[e],s},dispose:function(){n=new WeakMap}}}class m0 extends Dh{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=wi,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class g0 extends Dh{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}let _0=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +} +`,w0=` +uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; + +#include + +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 M0(m,g,t){let _=new Rr,w=new ct,M=new ct,y=new Vt,a=new m0({depthPacking:Mi}),h=new g0,o={},E=t.maxTextureSize,l={[Xt]:Yt,[Yt]:Xt,[Zt]:Zt},x=new Vh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ct},radius:{value:4}},vertexShader:_0,fragmentShader:w0}),b=x.clone();b.defines.HORIZONTAL_PASS=1;t=new Ch;t.setAttribute("position",new N(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let S=new L(t,x),T=this,A=(this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i,this.type);function R(i,s,t,e){let r=null;i=!0===t.isPointLight?i.customDistanceMaterial:i.customDepthMaterial;if(void 0!==i)r=i;else if(r=!0===t.isPointLight?h:a,m.localClippingEnabled&&!0===s.clipShadows&&Array.isArray(s.clippingPlanes)&&0!==s.clippingPlanes.length||s.displacementMap&&0!==s.displacementScale||s.alphaMap&&0E||w.y>E)&&(w.x>E&&(M.x=Math.floor(E/d.x),w.x=M.x*d.x,u.mapSize.x=M.x),w.y>E)&&(M.y=Math.floor(E/d.y),w.y=M.y*d.y,u.mapSize.y=M.y),null!==u.map&&!0!=h&&!0!=o||(d=this.type!==D?{minFilter:$t,magFilter:$t}:{},null!==u.map&&u.map.dispose(),u.map=new Nc(w.x,w.y,d),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()),m.setRenderTarget(u.map),m.clear(),u.getViewportCount());for(let t=0;ti||n.height>i?i/Math.max(n.width,n.height):s)<1?"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(i=Math.floor(s*n.width),r=Math.floor(s*n.height),void 0===h&&(h=l(i,r)),(e=e?l(i,r):h).width=i,e.height=r,e.getContext("2d").drawImage(t,0,0,i,r),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+n.width+"x"+n.height+") to ("+i+"x"+r+")."),e):("data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+n.width+"x"+n.height+")."),t):t}function L(t){return t.generateMipmaps&&t.minFilter!==$t&&t.minFilter!==V}function C(t){x.generateMipmap(t)}function N(t,e,i,s,r=!1){if(null!==t){if(void 0!==x[t])return x[t];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let n=e;return e===x.RED&&(i===x.FLOAT&&(n=x.R32F),i===x.HALF_FLOAT&&(n=x.R16F),i===x.UNSIGNED_BYTE)&&(n=x.R8),e===x.RED_INTEGER&&(i===x.UNSIGNED_BYTE&&(n=x.R8UI),i===x.UNSIGNED_SHORT&&(n=x.R16UI),i===x.UNSIGNED_INT&&(n=x.R32UI),i===x.BYTE&&(n=x.R8I),i===x.SHORT&&(n=x.R16I),i===x.INT)&&(n=x.R32I),e===x.RG&&(i===x.FLOAT&&(n=x.RG32F),i===x.HALF_FLOAT&&(n=x.RG16F),i===x.UNSIGNED_BYTE)&&(n=x.RG8),e===x.RG_INTEGER&&(i===x.UNSIGNED_BYTE&&(n=x.RG8UI),i===x.UNSIGNED_SHORT&&(n=x.RG16UI),i===x.UNSIGNED_INT&&(n=x.RG32UI),i===x.BYTE&&(n=x.RG8I),i===x.SHORT&&(n=x.RG16I),i===x.INT)&&(n=x.RG32I),e===x.RGB_INTEGER&&(i===x.UNSIGNED_BYTE&&(n=x.RGB8UI),i===x.UNSIGNED_SHORT&&(n=x.RGB16UI),i===x.UNSIGNED_INT&&(n=x.RGB32UI),i===x.BYTE&&(n=x.RGB8I),i===x.SHORT&&(n=x.RGB16I),i===x.INT)&&(n=x.RGB32I),e===x.RGBA_INTEGER&&(i===x.UNSIGNED_BYTE&&(n=x.RGBA8UI),i===x.UNSIGNED_SHORT&&(n=x.RGBA16UI),i===x.UNSIGNED_INT&&(n=x.RGBA32UI),i===x.BYTE&&(n=x.RGBA8I),i===x.SHORT&&(n=x.RGBA16I),i===x.INT)&&(n=x.RGBA32I),e===x.RGB&&i===x.UNSIGNED_INT_5_9_9_9_REV&&(n=x.RGB9_E5),(n=e===x.RGBA&&(t=r?Ri:zt.getTransfer(s),i===x.FLOAT&&(n=x.RGBA32F),i===x.HALF_FLOAT&&(n=x.RGBA16F),i===x.UNSIGNED_BYTE&&(n=t===Li?x.SRGB8_ALPHA8:x.RGBA8),i===x.UNSIGNED_SHORT_4_4_4_4&&(n=x.RGBA4),i===x.UNSIGNED_SHORT_5_5_5_1)?x.RGB5_A1:n)!==x.R16F&&n!==x.R32F&&n!==x.RG16F&&n!==x.RG32F&&n!==x.RGBA16F&&n!==x.RGBA32F||a.get("EXT_color_buffer_float"),n}function I(t,e){let i;return t?null===e||e===oe||e===de?i=x.DEPTH24_STENCIL8:e===le?i=x.DEPTH32F_STENCIL8:e===ae&&(i=x.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===e||e===oe||e===de?i=x.DEPTH_COMPONENT24:e===le?i=x.DEPTH_COMPONENT32F:e===ae&&(i=x.DEPTH_COMPONENT16),i}function P(t,e){return!0===L(t)||t.isFramebufferTexture&&t.minFilter!==$t&&t.minFilter!==V?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&0>=1,i>>=1}}else if(0>n),h=Math.max(1,e.height>>n),r===x.TEXTURE_3D||r===x.TEXTURE_2D_ARRAY?b.texImage3D(r,n,u,a,h,e.depth,0,o,l,null):b.texImage2D(r,n,u,a,h,0,o,l,null)),b.bindFramebuffer(x.FRAMEBUFFER,t),O(e)?c.framebufferTexture2DMultisampleEXT(x.FRAMEBUFFER,s,r,S.get(i).Vn,0,E(e)):(r===x.TEXTURE_2D||r>=x.TEXTURE_CUBE_MAP_POSITIVE_X&&r<=x.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&x.framebufferTexture2D(x.FRAMEBUFFER,s,r,S.get(i).Vn,n),b.bindFramebuffer(x.FRAMEBUFFER,null)}function _(t,e,i){if(x.bindRenderbuffer(x.RENDERBUFFER,t),e.depthBuffer){var s=e.depthTexture,s=s&&s.isDepthTexture?s.type:null,s=I(e.stencilBuffer,s),r=e.stencilBuffer?x.DEPTH_STENCIL_ATTACHMENT:x.DEPTH_ATTACHMENT,n=E(e);O(e)?c.renderbufferStorageMultisampleEXT(x.RENDERBUFFER,n,s,e.width,e.height):i?x.renderbufferStorageMultisample(x.RENDERBUFFER,n,s,e.width,e.height):x.renderbufferStorage(x.RENDERBUFFER,s,e.width,e.height),x.framebufferRenderbuffer(x.FRAMEBUFFER,r,x.RENDERBUFFER,t)}else{var a=e.textures;for(let t=0;t{delete s.Xn,delete s.Yn,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),s.Yn=t}s.Xn=e}if(i.depthTexture&&!s.Zn){if(t)throw new Error("target.depthTexture not supported in Cube render targets");var n=s.Fn,a=i;if(a&&a.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(b.bindFramebuffer(x.FRAMEBUFFER,n),!a.depthTexture||!a.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");S.get(a.depthTexture).Vn&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0),F(a.depthTexture,0);var n=S.get(a.depthTexture).Vn,h=E(a);if(a.depthTexture.format===Me)O(a)?c.framebufferTexture2DMultisampleEXT(x.FRAMEBUFFER,x.DEPTH_ATTACHMENT,x.TEXTURE_2D,n,0,h):x.framebufferTexture2D(x.FRAMEBUFFER,x.DEPTH_ATTACHMENT,x.TEXTURE_2D,n,0);else{if(a.depthTexture.format!==ye)throw new Error("Unknown depthTexture format");O(a)?c.framebufferTexture2DMultisampleEXT(x.FRAMEBUFFER,x.DEPTH_STENCIL_ATTACHMENT,x.TEXTURE_2D,n,0,h):x.framebufferTexture2D(x.FRAMEBUFFER,x.DEPTH_STENCIL_ATTACHMENT,x.TEXTURE_2D,n,0)}}else if(t){s.Bn=[];for(let t=0;t<6;t++)b.bindFramebuffer(x.FRAMEBUFFER,s.Fn[t]),void 0===s.Bn[t]?(s.Bn[t]=x.createRenderbuffer(),_(s.Bn[t],i,!1)):(e=i.stencilBuffer?x.DEPTH_STENCIL_ATTACHMENT:x.DEPTH_ATTACHMENT,r=s.Bn[t],x.bindRenderbuffer(x.RENDERBUFFER,r),x.framebufferRenderbuffer(x.FRAMEBUFFER,e,x.RENDERBUFFER,r))}else b.bindFramebuffer(x.FRAMEBUFFER,s.Fn),void 0===s.Bn?(s.Bn=x.createRenderbuffer(),_(s.Bn,i,!1)):(a=i.stencilBuffer?x.DEPTH_STENCIL_ATTACHMENT:x.DEPTH_ATTACHMENT,h=s.Bn,x.bindRenderbuffer(x.RENDERBUFFER,h),x.framebufferRenderbuffer(x.FRAMEBUFFER,a,x.RENDERBUFFER,h));b.bindFramebuffer(x.FRAMEBUFFER,null)}let M=[],y=[];function E(t){return Math.min(T.maxSamples,t.samples)}function O(t){var e=S.get(t);return 0=T.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+T.maxTextures),s+=1,t},this.resetTextureUnits=function(){s=0},this.setTexture2D=F,this.setTexture2DArray=function(t,e){var i=S.get(t);0= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class P0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){var s;null===this.texture&&(s=new c,t.properties.get(s).Vn=e.texture,e.depthNear==i.depthNear&&e.depthFar==i.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s)}getMesh(t){return null!==this.texture&&null===this.mesh&&(t=t.cameras[0].viewport,t=new Vh({vertexShader:N0,fragmentShader:I0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}}),this.mesh=new L(new Ih(20,20),t)),this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class D0 extends Cs{constructor(o,r){super();let l=this,g=null,n=1,u=null,e="local-floor",i=1,c=null,f=null,d=null,v=null,p=null,m=null,_=new P0,a=r.getContextAttributes(),t=null,w=null,M=[],y=[],h=new ct,E=null,x=new er,b=(x.layers.enable(1),x.viewport=new Vt,new er),S=(b.layers.enable(2),b.viewport=new Vt,[x,b]),T=new A0,A=(T.layers.enable(1),T.layers.enable(2),null),R=null;function L(t){var e=y.indexOf(t.inputSource);-1!==e&&void 0!==(e=M[e])&&(e.update(t.inputSource,t.frame,c||u),e.dispatchEvent({type:t.type,data:t.inputSource}))}function C(){g.removeEventListener("select",L),g.removeEventListener("selectstart",L),g.removeEventListener("selectend",L),g.removeEventListener("squeeze",L),g.removeEventListener("squeezestart",L),g.removeEventListener("squeezeend",L),g.removeEventListener("end",C),g.removeEventListener("inputsourceschange",N);for(let t=0;t=y.length){y.push(r),e=t;break}if(null===y[t]){y[t]=r,e=t;break}}if(-1===e)break}var n=M[e];n&&n.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=M[t];return void 0===e&&(e=new C0,M[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=M[t];return void 0===e&&(e=new C0,M[t]=e),e.getGripSpace()},this.getHand=function(t){let e=M[t];return void 0===e&&(e=new C0,M[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){n=t,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){e=t,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||u},this.setReferenceSpace=function(t){c=t},this.getBaseLayer=function(){return null!==v?v:p},this.getBinding=function(){return d},this.getFrame=function(){return m},this.getSession=function(){return g},this.setSession=async function(s){if(null!==(g=s)){if(t=o.getRenderTarget(),g.addEventListener("select",L),g.addEventListener("selectstart",L),g.addEventListener("selectend",L),g.addEventListener("squeeze",L),g.addEventListener("squeezestart",L),g.addEventListener("squeezeend",L),g.addEventListener("end",C),g.addEventListener("inputsourceschange",N),!0!==a.xrCompatible&&await r.makeXRCompatible(),E=o.getPixelRatio(),o.getSize(h),void 0===g.renderState.layers){s={antialias:a.antialias,alpha:!0,depth:a.depth,stencil:a.stencil,framebufferScaleFactor:n};p=new XRWebGLLayer(g,r,s),g.updateRenderState({baseLayer:p}),o.setPixelRatio(1),o.setSize(p.framebufferWidth,p.framebufferHeight,!1),w=new Nc(p.framebufferWidth,p.framebufferHeight,{format:ge,type:se,colorSpace:o.outputColorSpace,stencilBuffer:a.stencil})}else{let t=null,e=null,i=null;a.depth&&(i=a.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,t=a.stencil?ye:Me,e=a.stencil?de:oe);s={colorFormat:r.RGBA8,depthFormat:i,scaleFactor:n};d=new XRWebGLBinding(g,r),v=d.createProjectionLayer(s),g.updateRenderState({layers:[v]}),o.setPixelRatio(1),o.setSize(v.textureWidth,v.textureHeight,!1),w=new Nc(v.textureWidth,v.textureHeight,{format:ge,type:se,depthTexture:new vf(v.textureWidth,v.textureHeight,e,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:a.stencil,colorSpace:o.outputColorSpace,samples:a.antialias?4:0,resolveDepthBuffer:!1===v.ignoreDepthValues})}w.isXRRenderTarget=!0,this.setFoveation(i),c=null,u=await g.requestReferenceSpace(e),U.setContext(g),U.start(),l.isPresenting=!0,l.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==g)return g.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};let I=new Gt,P=new Gt;function D(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(i){if(null!==g){let t=i.near,e=i.far;null!==_.texture&&(0<_.depthNear&&(t=_.depthNear),0<_.depthFar)&&(e=_.depthFar),T.near=b.near=x.near=t,T.far=b.far=x.far=e,A===T.near&&R===T.far||(g.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,R=T.far);var s,r,n,a,h,o,l,u,c,f=i.parent,d=T.cameras;D(T,f);for(let t=0;t{for(let t=0;t{if(t=t.value,void 0===s[e=e+"_"+i])return s[e]="number"==typeof t||"boolean"==typeof t?t:t.clone(),!0;if(i=s[e],"number"==typeof t||"boolean"==typeof t){if(i!==t)return s[e]=t,!0}else if(!1===i.equals(t))return i.copy(t),!0;return!1})(m,i,t,v)){var g=m.ea,_=Array.isArray(m.value)?m.value:[m.value];let e=0;for(let t=0;t<_.length;t++){var w=_[t],M=R(w);"number"==typeof w||"boolean"==typeof w?(m.ta[0]=w,y.bufferSubData(y.UNIFORM_BUFFER,g+e,m.ta)):w.isMatrix3?(m.ta[0]=w.elements[0],m.ta[1]=w.elements[1],m.ta[2]=w.elements[2],m.ta[3]=0,m.ta[4]=w.elements[3],m.ta[5]=w.elements[4],m.ta[6]=w.elements[5],m.ta[7]=0,m.ta[8]=w.elements[6],m.ta[9]=w.elements[7],m.ta[10]=w.elements[8],m.ta[11]=0):(w.toArray(m.ta,e),e+=M.storage/Float32Array.BYTES_PER_ELEMENT)}y.bufferSubData(y.UNIFORM_BUFFER,g,m.ta)}}}y.bindBuffer(y.UNIFORM_BUFFER,null),S[t.id]=c}},dispose:function(){for(var t in b)y.deleteBuffer(b[t]);T=[],b={},S={}}}}class k0{constructor(t={}){let{canvas:s=gh(),context:i=null,depth:a=!0,stencil:x=!1,alpha:b=!1,antialias:S=!1,premultipliedAlpha:T=!0,preserveDrawingBuffer:A=!1,powerPreference:W="default",failIfMajorPerformanceCaveat:j=!1}=t;this.isWebGLRenderer=!0;let X;if(null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");X=i.getContextAttributes().alpha}else X=b;let o=new Uint32Array(4),l=new Int32Array(4),f=null,R=null,h=[],u=[],L=(this.domElement=s,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.ra=bi,this.toneMapping=qt,this.toneMappingExposure=1,this),Y=!1,Z=0,q=0,C=null,N=-1,I=null,d=new Vt,K=new Vt,J=null,$=new Wt(0),Q=0,r=s.width,P=s.height,D=1,tt=null,et=null,it=new Vt(0,0,r,P),st=new Vt(0,0,r,P),rt=!1,nt=new Rr,O=!1,at=!1,ht=new Ht,ot=new Ht,lt=new Gt,v=new Vt,ut={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ct=!1;function ft(){return null===C?D:1}let U=i;function dt(t,e){return s.getContext(t,e)}try{var vt={alpha:!0,depth:a,stencil:x,antialias:S,premultipliedAlpha:T,preserveDrawingBuffer:A,powerPreference:W,failIfMajorPerformanceCaveat:j};if("setAttribute"in s&&s.setAttribute("data-engine","three.js r"+jt),s.addEventListener("webglcontextlost",bt,!1),s.addEventListener("webglcontextrestored",St,!1),s.addEventListener("webglcontextcreationerror",Tt,!1),null===U)if(null===(U=dt("webgl2",vt)))throw dt("webgl2")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}let m,F,B,n,k,G,H,V,g,pt,p,c,mt,gt,_t,z,_,w,wt,Mt,yt,y,M,Et;function xt(){(m=new af(U)).init(),y=new T0(U,m),F=new Ec(U,m,t,y),B=new E0(U),F.reverseDepthBuffer&&B.buffers.depth.setReversed(!0),n=new lf(U),k=new r0,G=new S0(U,m,B,k,F,y,n),H=new Fc(L),V=new nf(L),g=new lh(U),M=new Mc(U,g),pt=new hf(U,g,n,M),p=new ff(U,pt,g,n),wt=new cf(U,F,G),z=new xc(k),c=new s0(L,H,V,m,F,M,z),mt=new F0(L,k),gt=new o0,_t=new p0(m),w=new wc(L,H,V,B,p,X,T),_=new M0(L,p,F),Et=new B0(U,n,F,B),Mt=new yc(U,m,n),yt=new of(U,m,n),n.programs=c.programs,L.capabilities=F,L.extensions=m,L.properties=k,L.renderLists=gt,L.shadowMap=_,L.state=B,L.info=n}xt();let E=new D0(L,U);function bt(t){t.preventDefault(),Y=!0}function St(){Y=!1;var t=n.autoReset,e=_.enabled,i=_.autoUpdate,s=_.needsUpdate,r=_.type;xt(),n.autoReset=t,_.enabled=e,_.autoUpdate=i,_.needsUpdate=s,_.type=r}function Tt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function At(t){var t=t.target,e=(t.removeEventListener("dispose",At),t=t),i=k.get(e).programs;void 0!==i&&(i.forEach(function(t){c.releaseProgram(t)}),e.isShaderMaterial)&&c.releaseShaderCache(e),k.remove(t)}function Rt(t,e,i){!0===t.transparent&&t.side===Zt&&!1===t.forceSinglePass?(t.side=Yt,t.needsUpdate=!0,Ft(t,e,i),t.side=Xt,t.needsUpdate=!0,Ft(t,e,i),t.side=Zt):Ft(t,e,i)}this.xr=E,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){var t=m.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=m.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(t){void 0!==t&&(D=t,this.setSize(r,P,!1))},this.getSize=function(t){return t.set(r,P)},this.setSize=function(t,e,i=!0){E.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(r=t,P=e,s.width=Math.floor(t*D),s.height=Math.floor(e*D),!0===i&&(s.style.width=t+"px",s.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(r*D,P*D).floor()},this.setDrawingBufferSize=function(t,e,i){r=t,P=e,D=i,s.width=Math.floor(t*i),s.height=Math.floor(e*i),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(d)},this.getViewport=function(t){return t.copy(it)},this.setViewport=function(t,e,i,s){t.isVector4?it.set(t.x,t.y,t.z,t.w):it.set(t,e,i,s),B.viewport(d.copy(it).multiplyScalar(D).round())},this.getScissor=function(t){return t.copy(st)},this.setScissor=function(t,e,i,s){t.isVector4?st.set(t.x,t.y,t.z,t.w):st.set(t,e,i,s),B.scissor(K.copy(st).multiplyScalar(D).round())},this.getScissorTest=function(){return rt},this.setScissorTest=function(t){B.setScissorTest(rt=t)},this.setOpaqueSort=function(t){tt=t},this.setTransparentSort=function(t){et=t},this.getClearColor=function(t){return t.copy(w.getClearColor())},this.setClearColor=function(){w.setClearColor.apply(w,arguments)},this.getClearAlpha=function(){return w.getClearAlpha()},this.setClearAlpha=function(){w.setClearAlpha.apply(w,arguments)},this.clear=function(e=!0,t=!0,i=!0){let s=0;if(e){let t=!1;var r,n,a,h;null!==C&&(e=C.texture.format,t=e===Te||e===Se||e===xe),t?(e=(e=C.texture.type)===se||e===oe||e===ae||e===de||e===ce||e===fe,h=w.getClearColor(),r=w.getClearAlpha(),n=h.r,a=h.g,h=h.b,e?(o[0]=n,o[1]=a,o[2]=h,o[3]=r,U.clearBufferuiv(U.COLOR,0,o)):(l[0]=n,l[1]=a,l[2]=h,l[3]=r,U.clearBufferiv(U.COLOR,0,l))):s|=U.COLOR_BUFFER_BIT}t&&(s|=U.DEPTH_BUFFER_BIT,U.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),i&&(s|=U.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),U.clear(s)},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(){s.removeEventListener("webglcontextlost",bt,!1),s.removeEventListener("webglcontextrestored",St,!1),s.removeEventListener("webglcontextcreationerror",Tt,!1),gt.dispose(),_t.dispose(),k.dispose(),H.dispose(),V.dispose(),p.dispose(),M.dispose(),Et.dispose(),c.dispose(),E.dispose(),E.removeEventListener("sessionstart",Ct),E.removeEventListener("sessionend",Nt),e.stop()},this.renderBufferDirect=function(t,i,s,r,n,a){null===i&&(i=ut);var h=n.isMesh&&n.matrixWorld.determinant()<0,t=((t,e,i,s,r)=>{!0!==e.isScene&&(e=ut),G.resetTextureUnits();let n=e.fog,a=s.isMeshStandardMaterial?e.environment:null,h=null===C?L.outputColorSpace:!0===C.isXRRenderTarget?C.texture.colorSpace:Si,o=(s.isMeshStandardMaterial?V:H).get(s.envMap||a),l=!0===s.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,u=!!i.attributes.tangent&&(!!s.normalMap||0{function e(){s.forEach(function(t){k.get(t).currentProgram.isReady()&&s.delete(t)}),0===s.size?t(i):setTimeout(e,10)}null!==m.get("KHR_parallel_shader_compile")?e():setTimeout(e,10)})};let Lt=null;function Ct(){e.stop()}function Nt(){e.start()}let e=new oh;function It(i,s,r,n){if(!1!==i.visible){var t,e;if(i.layers.test(s.layers))if(i.isGroup)r=i.renderOrder;else if(i.isLOD)!0===i.autoUpdate&&i.update(s);else if(i.isLight)R.pushLight(i),i.castShadow&&R.pushShadow(i);else if(i.isSprite)!i.frustumCulled||nt.intersectsSprite(i)?(n&&v.setFromMatrixPosition(i.matrixWorld).applyMatrix4(ot),t=p.update(i),(e=i.material).visible&&f.push(i,t,e,r,v.z,null),i.frustumCulledFailCallback&&i.frustumCulledFailCallback()):i.frustumCulledSuccCallback&&i.frustumCulledSuccCallback();else if((i.isMesh||i.isLine||i.isPoints)&&(!i.frustumCulled||nt.intersectsObject(i))){var a=p.update(i),h=i.material;if(n&&(void 0!==i.boundingSphere?(null===i.boundingSphere&&i.computeBoundingSphere(),v.copy(i.boundingSphere.center)):(null===a.boundingSphere&&a.computeBoundingSphere(),v.copy(a.boundingSphere.center)),v.applyMatrix4(i.matrixWorld).applyMatrix4(ot)),Array.isArray(h)){var o=a.groups;for(let t=0,e=o.length;t + varying vec2 vUv; + + void main() { + + // vec2 muv = vec2(vUv.x , 1.0 - vUv.y); + vec4 diffuseColor = texture2D( mmap, vUv ); + + + gl_FragColor = diffuseColor; + } + `;class H0 extends Vh{constructor(t){super(t),this.uniforms.offset={value:new ct},this.uniforms.rotation={value:0},this.uniforms.scale={value:new ct(1,1)},this.depthTest=!1,this.vertexShader=G0.vert,this.fragmentShader=G0.frag}}class V0{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Wi,this.updateRanges=[],this.version=0,this.uuid=$i()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(i,s,r){i*=this.stride,r*=s.stride;for(let t=0,e=this.stride;t{n.image=t,n.needsUpdate=!0}})),n}let sv={aa:!0},rv=t=>{var e=iv(),i=new ct(.4,.096),s=new H0,t=-1*(.5*i.x/t-1),r=-1*(1-.5*i.y);return e.minFilter=V,e.generateMipmaps=!1,s.transparent=!0,s.depthTest=!1,s.uniforms={scale:{value:i},offset:{value:new ct(t,r)},mmap:{value:e}},s.needsUpdate=!0,new L(new j0,s)};class nv{constructor(t,e,i){this.ha=0,this.Ns=0,this.st=t,this.Ls=e,this.nt=i,this.renderer=this.oa(e.container,e.logarithmicDepthBuffer,e.preserveDrawingBuffer),this.rn=new Map;i=this.st.getMapOptions().depthPeeling;i&&nt.environment===I.BROWSER&&(this.la=new nt.DepthPeelingRenderer({map:t,renderManager:this,mode:i.mode,layers:i.layers,type:i.types})),this.ua=JSON.parse(JSON.stringify(e.renderOrder)),this.ca=0,this.fa=!1,this.da=null,this.va=sv.aa,this.va&&(this.da=rv(this.renderer.domElement.clientWidth/this.renderer.domElement.clientHeight),this.da.frustumCulled=!1,this.xx45f6=this.da),this.pa=!1,this.ma=!1,this._=this.renderer.domElement.clientWidth,this.ga=this.renderer.domElement.clientHeight,this.type="basic",this._a=null,this.k=!0,this.an=void 0,this.wa=void 0,this.nn=[],this.Ma()}getRenderer(){return this.la||this.renderer}setTileLayScene(t){this.an=t}getTileLayScene(){return this.an}setGroundLayerScene(t){this.wa=t}getGroundLayerScene(){return this.wa}set3DTilesLayerSceneArr(t){this.nn.push(t)}get3DTilesLayerSceneArr(){return this.nn}get needLogo(){return this.va}render(){let n=this;if(this.renderer&&(this.ha+=1,15e6this.renderer.render(t,this.st.ct));let r={min:1/0,max:-1/0},s=(this.st.ya.Ft.forEach(e=>{let s=[];e.Ea.forEach(t=>{let e=t.buildingID;var i;e=e||this.st.getMapOptions().mapID,t.isCross&&(e=>{let i=!1,s=Array.from(n.getRenderList());for(let t=0;ti&&(r.min=i),i=Math.max(t.levelRange[0],t.levelRange[1]),r.max{t.line&&i(t.buildingID,t.levelRange[0])&&i(t.buildingID,t.levelRange[1])&&e.visible&&(t.line.visible=!0,this.renderer.render(t.line,this.st.ct),t.line.visible=!1)})}),this.ua.indexOf(p.LINE_MARKER));function i(t,i){t=t||n.st.getMapOptions().mapID;var s=n.st.getBuilding(t).visibleLevels;if(1!==s.length){let e=!1;for(let t=0;t{var e=e.split("%A%B%C%D"),i=e[1],e=e[2];+i===r.max&&this.ua.indexOf(p.LAYER_NODE_TYPE.get(+e))>s&&this.renderer.render(t,this.st.ct)}),this.st.ya&&this.renderer.render(this.st.ya.xa,this.st.ct),this.va&&this.da&&this.renderer.render(this.da,this.st.ct)}}resize(){this.renderer&&(5t-e);for(let t=0;t{switch(e.userData.type){case"label":for(let t=0;t{if(0===u.length)n();else{var e=[],i=new Gt;let r=[];for(let t=0;t{var e=t.result.ndcPositions;let i=0;for(let t=0;tr))a?s[t].mapNode.collisionTargetShow=!1:s[t].visible=!1;else if(!1===n)a?s[t].mapNode.collisionTargetShow=!0:this.Va(s[t],!0);else if(!1===s[t].mapNode.Xa)a?s[t].mapNode.collisionTargetShow=!0:this.Va(s[t],!0);else{var h=s[t].children[0]||s[t];if("Sprite"===h.type&&h.material.map){var o=this.Ba(h,e);if(o){s[t].userData.bounds=o;let e=!0;for(let t=0;t{if(this.st.Wt.Qa(e))for(let t=0;tt.heighte.height?1:t.parent===this.st.jt?-1:e.parent===this.st.jt?1:0),s.forEach(t=>{let e=[];t.traverse(t=>{e.unshift(t)}),e.sort((t,e)=>{let i=this.ua.indexOf(p.LAYER_NODE_TYPE.get(t.Ti)),s=this.ua.indexOf(p.LAYER_NODE_TYPE.get(e.Ti));t=this.ua.length-1;return-1===i&&(i=t),-1===s&&(s=t),i-s}),e.forEach((t,e,i)=>{var s=t.parent,s=s.parent.Ht+"%A%B%C%D"+s.level+"%A%B%C%D"+t.Ti;this.rn.set(s,t.scene)})}),this.pa=!1,this.xt(),this.Za()}},V(){this.rn&&0{200===o.status||0===o.status||201===o.status?t&&t(o.response):e&&(404===o.status?e(Cr.PATH_ERROR):2069===o.response.error_code?e(Cr.NAME_KEY_ERROR):2063===o.response.error_code?e(Cr.MAP_ID_URL_ERROR):400===o.response.error_code?e(Cr.THEME_ID_URL_ERROR):e(o.response))}),o.addEventListener("timeout",t=>{i&&i(t)}),o.addEventListener("error",t=>{e&&e(t)}),o.send(JSON.stringify(s)),this.ih=o},Qt(){this.ih&&this.ih.abort&&(this.ih.abort(),this.ih=null)}});var lv={exports:{}},uv={},cv={},fv,dv;function vv(){return dv||(dv=1,fv=function(t,e){var i=new Array(arguments.length-1),n=0,s=2,a=!0;for(;s>2],s=(3&o)<<4,h=1;break;case 1:n[a++]=l[s|o>>4],s=(15&o)<<2,h=2;break;case 2:n[a++]=l[s|o>>6],n[a++]=l[63&o],h=0}8191>4,s=h,n=2;break;case 2:e[i++]=(15&s)<<4|(60&h)>>2,s=h,n=3;break;case 3:e[i++]=(3&s)<<6|h,n=0}}if(1===n)throw Error(u);return i-r},t.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}}return pv}function bv(){return _v||(_v=1,(gv=t).prototype.on=function(t,e,i){return(this.A[t]||(this.A[t]=[])).push({fn:e,ctx:i||this}),this},t.prototype.off=function(t,e){if(void 0===t)this.A={};else if(void 0===e)this.A[t]=[];else for(var i=this.A[t],s=0;s>>0:e<11754943508222875e-54?(r<<31|Math.round(e/1401298464324817e-60))>>>0:(r<<31|(t=Math.floor(Math.log(e)/Math.LN2))+127<<23|8388607&Math.round(e*Math.pow(2,-t)*8388608))>>>0,i,s)}function i(t,e,i){t=t(e,i),e=2*(t>>31)+1,i=t>>>23&255,t&=8388607;return 255==i?t?NaN:1/0*e:0==i?1401298464324817e-60*e*t:e*Math.pow(2,i-150)*(8388608+t)}function s(t,e,i){h[0]=t,e[i]=o[0],e[i+1]=o[1],e[i+2]=o[2],e[i+3]=o[3]}function r(t,e,i){h[0]=t,e[i]=o[3],e[i+1]=o[2],e[i+2]=o[1],e[i+3]=o[0]}function n(t,e){return o[0]=t[e],o[1]=t[e+1],o[2]=t[e+2],o[3]=t[e+3],h[0]}function a(t,e){return o[3]=t[e],o[2]=t[e+1],o[1]=t[e+2],o[0]=t[e+3],h[0]}var h,o,l,u,c;function f(t,e,i,s,r,n){var a,h,o=s<0?1:0;0===(s=o?-s:s)?(t(0,r,n+e),t(0<1/s?0:2147483648,r,n+i)):isNaN(s)?(t(0,r,n+e),t(2146959360,r,n+i)):17976931348623157e292>>0,r,n+i)):s<22250738585072014e-324?(t((a=s/5e-324)>>>0,r,n+e),t((o<<31|a/4294967296)>>>0,r,n+i)):(1024===(h=Math.floor(Math.log(s)/Math.LN2))&&(h=1023),t(4503599627370496*(a=s*Math.pow(2,-h))>>>0,r,n+e),t((o<<31|h+1023<<20|1048576*a&1048575)>>>0,r,n+i))}function d(t,e,i,s,r){e=t(s,r+e),t=t(s,r+i),s=2*(t>>31)+1,r=t>>>20&2047,i=4294967296*(1048575&t)+e;return 2047==r?i?NaN:1/0*s:0==r?5e-324*s*i:s*Math.pow(2,r-1075)*(i+4503599627370496)}function v(t,e,i){l[0]=t,e[i]=u[0],e[i+1]=u[1],e[i+2]=u[2],e[i+3]=u[3],e[i+4]=u[4],e[i+5]=u[5],e[i+6]=u[6],e[i+7]=u[7]}function p(t,e,i){l[0]=t,e[i]=u[7],e[i+1]=u[6],e[i+2]=u[5],e[i+3]=u[4],e[i+4]=u[3],e[i+5]=u[2],e[i+6]=u[1],e[i+7]=u[0]}function m(t,e){return u[0]=t[e],u[1]=t[e+1],u[2]=t[e+2],u[3]=t[e+3],u[4]=t[e+4],u[5]=t[e+5],u[6]=t[e+6],u[7]=t[e+7],l[0]}function g(t,e){return u[7]=t[e],u[6]=t[e+1],u[5]=t[e+2],u[4]=t[e+3],u[3]=t[e+4],u[2]=t[e+5],u[1]=t[e+6],u[0]=t[e+7],l[0]}return"undefined"!=typeof Float32Array?(h=new Float32Array([-0]),o=new Uint8Array(h.buffer),c=128===o[3],t.writeFloatLE=c?s:r,t.writeFloatBE=c?r:s,t.readFloatLE=c?n:a,t.readFloatBE=c?a:n):(t.writeFloatLE=e.bind(null,_),t.writeFloatBE=e.bind(null,w),t.readFloatLE=i.bind(null,M),t.readFloatBE=i.bind(null,y)),"undefined"!=typeof Float64Array?(l=new Float64Array([-0]),u=new Uint8Array(l.buffer),c=128===u[7],t.writeDoubleLE=c?v:p,t.writeDoubleBE=c?p:v,t.readDoubleLE=c?m:g,t.readDoubleBE=c?g:m):(t.writeDoubleLE=f.bind(null,_,0,4),t.writeDoubleBE=f.bind(null,w,4,0),t.readDoubleLE=d.bind(null,M,0,4),t.readDoubleBE=d.bind(null,y,4,0)),t}function _(t,e,i){e[i]=255&t,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}function w(t,e,i){e[i]=t>>>24,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function M(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function y(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}}function Tv(){return Ev||(Ev=1,yv=t),yv;function t(t){try{var e=eval("quire".replace(/^/,"re"))(t);if(e&&(e.length||Object.keys(e).length))return e}catch(t){}return null}}var Av={},Rv,Lv,Cv,Nv,Iv,Pv;function Dv(){var t;return Rv||(Rv=1,(t=Av).length=function(t){for(var e,i=0,s=0;s>10),n[a++]=56320+(1023&s)):n[a++]=(15&s)<<12|(63&t[e++])<<6|63&t[e++],8191>6|192:(55296==(64512&s)&&56320==(64512&(r=t.charCodeAt(a+1)))?(++a,e[i++]=(s=65536+((1023&s)<<10)+(1023&r))>>18|240,e[i++]=s>>12&63|128):e[i++]=s>>12|224,e[i++]=s>>6&63|128),e[i++]=63&s|128);return i-n}),Av}function Ov(){return Cv||(Cv=1,Lv=function(e,i,t){var s=t||8192,r=s>>>1,n=null,a=s;return function(t){if(t<1||r>>0,t=(t-i)/4294967296>>>0,e&&(t=~t>>>0,i=~i>>>0,4294967295<++i)&&(i=0,4294967295<++t)&&(t=0),new r(i,t))},r.from=function(t){if("number"==typeof t)return r.fromNumber(t);if(e.isString(t)){if(!e.Long)return r.fromNumber(parseInt(t,10));t=e.Long.fromString(t)}return t.low||t.high?new r(t.low>>>0,t.high>>>0):s},r.prototype.toNumber=function(t){var e;return!t&&this.hi>>>31?(t=1+~this.lo>>>0,e=~this.hi>>>0,-(t+4294967296*(e=t?e:e+1>>>0))):this.lo+4294967296*this.hi},r.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}},i=String.prototype.charCodeAt,r.fromHash=function(t){return"\0\0\0\0\0\0\0\0"===t?s:new r((i.call(t,0)|i.call(t,1)<<8|i.call(t,2)<<16|i.call(t,3)<<24)>>>0,(i.call(t,4)|i.call(t,5)<<8|i.call(t,6)<<16|i.call(t,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},r.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},r.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0==i?0==e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}),Nv;function r(t,e){this.lo=t>>>0,this.hi=e>>>0}}function Fv(){var s;return Pv||(Pv=1,(s=cv).asPromise=vv(),s.base64=xv(),s.EventEmitter=bv(),s.float=Sv(),s.inquire=Tv(),s.utf8=Dv(),s.pool=Ov(),s.LongBits=Uv(),s.isNode=Boolean(void 0!==aa&&aa&&aa.process&&aa.process.versions&&aa.process.versions.node),s.global=s.isNode&&aa||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||aa,s.emptyArray=Object.freeze?Object.freeze([]):[],s.emptyObject=Object.freeze?Object.freeze({}):{},s.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},s.isString=function(t){return"string"==typeof t||t instanceof String},s.isObject=function(t){return t&&"object"==typeof t},s.isset=s.isSet=function(t,e){var i=t[e];return!(null==i||!t.hasOwnProperty(e))&&("object"!=typeof i||0<(Array.isArray(i)?i:Object.keys(i)).length)},s.Buffer=(()=>{try{var t=s.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}})(),s.rh=null,s.nh=null,s.newBuffer=function(t){return"number"==typeof t?s.Buffer?s.nh(t):new s.Array(t):s.Buffer?s.rh(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},s.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,s.Long=s.global.dcodeIO&&s.global.dcodeIO.Long||s.global.Long||s.inquire("long"),s.key2Re=/^true|false|0|1$/,s.key32Re=/^-?(?:0|[1-9][0-9]*)$/,s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,s.longToHash=function(t){return t?s.LongBits.from(t).toHash():s.LongBits.zeroHash},s.longFromHash=function(t,e){t=s.LongBits.fromHash(t);return s.Long?s.Long.fromBits(t.lo,t.hi,e):t.toNumber(Boolean(e))},s.merge=r,s.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},s.newError=t,s.ProtocolError=t("ProtocolError"),s.oneOfGetter=function(t){for(var i={},e=0;e>>=7;e[i]=t}function Kv(t,e){this.len=t,this.next=void 0,this.val=e}function Jv(t,e,i){for(;t.hi;)e[i++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127>>7;e[i++]=t.lo}function $v(t,e,i){e[i]=255&t,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}s.create=Yv(),s.alloc=function(t){return new kv.Array(t)},kv.Array!==Array&&(s.alloc=kv.pool(s.alloc,kv.Array.prototype.subarray)),s.prototype.hh=function(t,e,i){return this.tail=this.tail.next=new Wv(t,e,i),this.len+=e,this},Kv.prototype=Object.create(Wv.prototype),Kv.prototype.fn=qv,s.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Kv((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},s.prototype.int32=function(t){return t<0?this.hh(Jv,10,Hv.fromNumber(t)):this.uint32(t)},s.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},s.prototype.uint64=function(t){t=Hv.from(t);return this.hh(Jv,t.length(),t)},s.prototype.int64=s.prototype.uint64,s.prototype.sint64=function(t){t=Hv.from(t).zzEncode();return this.hh(Jv,t.length(),t)},s.prototype.bool=function(t){return this.hh(Zv,1,t?1:0)},s.prototype.fixed32=function(t){return this.hh($v,4,t>>>0)},s.prototype.sfixed32=s.prototype.fixed32,s.prototype.fixed64=function(t){t=Hv.from(t);return this.hh($v,4,t.lo).hh($v,4,t.hi)},s.prototype.sfixed64=s.prototype.fixed64,s.prototype.float=function(t){return this.hh(kv.float.writeFloatLE,4,t)},s.prototype.double=function(t){return this.hh(kv.float.writeDoubleLE,8,t)};var Qv=kv.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var s=0;s>>0;return i?(kv.isString(t)&&(e=s.alloc(i=Vv.length(t)),Vv.decode(t,e,0),t=e),this.uint32(i).hh(Qv,i,t)):this.hh(Zv,1,0)},s.prototype.string=function(t){var e=zv.length(t);return e?this.uint32(e).hh(zv.write,e,t):this.hh(Zv,1,0)},s.prototype.fork=function(){return this.states=new Xv(this),this.head=this.tail=new Wv(jv,0,0),this.len=0,this},s.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Wv(jv,0,0),this.len=0),this},s.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this},s.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e},s.ah=function(t){Gv=t,s.create=Yv(),Gv.ah()},s1),e1=Bv,i1=((s1.prototype=Object.create(e1.prototype)).constructor=s1,Fv());function s1(){e1.call(this)}function r1(t,e,i){t.length<40?i1.utf8.write(t,e,i):e.utf8Write?e.utf8Write(t,i):e.write(t,i)}s1.ah=function(){s1.alloc=i1.nh,s1.writeBytesBuffer=i1.Buffer&&i1.Buffer.prototype instanceof Uint8Array&&"set"===i1.Buffer.prototype.set.name?function(t,e,i){e.set(t,i)}:function(t,e,i){if(t.copy)t.copy(e,i,0,t.length);else for(var s=0;s>>0;return this.uint32(e),e&&this.hh(s1.writeBytesBuffer,e,t),this},s1.prototype.string=function(t){var e=i1.Buffer.byteLength(t);return this.uint32(e),e&&this.hh(r1,e,t),this},s1.ah();var n1=c1,a1=Fv(),h1,o1=a1.LongBits,l1=a1.utf8;function u1(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function c1(t){this.buf=t,this.pos=0,this.len=t.length}var f1="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new c1(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new c1(t);throw Error("illegal buffer")},d1=function(){return a1.Buffer?function(t){return(c1.create=function(t){return a1.Buffer.isBuffer(t)?new h1(t):f1(t)})(t)}:f1};function v1(){var t=new o1(0,0),e=0;if(!(4=this.len)throw u1(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,4>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw u1(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function p1(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function m1(){if(this.pos+8>this.len)throw u1(this,8);return new o1(p1(this.buf,this.pos+=4),p1(this.buf,this.pos+=4))}c1.create=d1(),c1.prototype.oh=a1.Array.prototype.subarray||a1.Array.prototype.slice,c1.prototype.uint32=(()=>{var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return t;throw this.pos=this.len,u1(this,10)}})(),c1.prototype.int32=function(){return 0|this.uint32()},c1.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},c1.prototype.bool=function(){return 0!==this.uint32()},c1.prototype.fixed32=function(){if(this.pos+4>this.len)throw u1(this,4);return p1(this.buf,this.pos+=4)},c1.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u1(this,4);return 0|p1(this.buf,this.pos+=4)},c1.prototype.float=function(){if(this.pos+4>this.len)throw u1(this,4);var t=a1.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},c1.prototype.double=function(){if(this.pos+8>this.len)throw u1(this,4);var t=a1.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},c1.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw u1(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,i):e===i?new this.buf.constructor(0):this.oh.call(this.buf,e,i)},c1.prototype.string=function(){var t=this.bytes();return l1.read(t,0,t.length)},c1.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw u1(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw u1(this)}while(128&this.buf[this.pos++]);return this},c1.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},c1.ah=function(t){h1=t,c1.create=d1(),h1.ah();var e=a1.Long?"toLong":"toNumber";a1.merge(c1.prototype,{int64:function(){return v1.call(this)[e](!1)},uint64:function(){return v1.call(this)[e](!0)},sint64:function(){return v1.call(this).zzDecode()[e](!1)},fixed64:function(){return m1.call(this)[e](!0)},sfixed64:function(){return m1.call(this)[e](!1)}})};var g1=M1,_1=n1,w1=((M1.prototype=Object.create(_1.prototype)).constructor=M1,Fv());function M1(t){_1.call(this,t)}M1.ah=function(){w1.Buffer&&(M1.prototype.oh=w1.Buffer.prototype.slice)},M1.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},M1.ah();var y1={},E1=b1,x1=Fv();function b1(t,e,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");x1.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(i)}(b1.prototype=Object.create(x1.EventEmitter.prototype)).constructor=b1,b1.prototype.rpcCall=function t(i,e,s,r,n){if(!r)throw TypeError("request must be specified");var a=this;if(!n)return x1.asPromise(t,a,i,e,s,r);if(a.rpcImpl)try{return a.rpcImpl(i,e[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(t,e){if(t)return a.emit("error",t,i),n(t);if(null!==e){if(!(e instanceof s))try{e=s[a.responseDelimited?"decodeDelimited":"decode"](e)}catch(t){return a.emit("error",t,i),n(t)}return a.emit("data",e,i),n(null,e)}a.end(!0)})}catch(t){a.emit("error",t,i),setTimeout(function(){n(t)},0)}else setTimeout(function(){n(Error("already ended"))},0)},b1.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},y1.Service=E1;var S1={},T1=((()=>{var t=uv;function e(){t.util.ah(),t.Writer.ah(t.BufferWriter),t.Reader.ah(t.BufferReader)}t.build="minimal",t.Writer=Bv,t.BufferWriter=t1,t.Reader=n1,t.BufferReader=g1,t.util=Fv(),t.rpc=y1,t.roots=S1,t.configure=e,e()})(),{exports:{}}),A1=R1;function R1(e,i){"string"==typeof e&&(i=e,e=void 0);var o=[];function l(t){if("string"!=typeof t){var e=u();if(R1.verbose,e="return "+e,t){for(var i=Object.keys(t),s=new Array(i.length+1),r=new Array(i.length),n=0;n{var t=D1,r=t.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},s=t.normalize=function(t){var e=(t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),i=r(t),t="";i&&(t=e.shift()+"/");for(var s=0;se)return!0;return!1},u.isReservedName=function(t,e){if(t)for(var i=0;i>>3){");for(var i=0;i>>3){")("case 1: k=r.%s(); break",s.keyType)("case 2:"),void 0===o.basic[r]?e("value=types[%i].decode(r,r.uint32())",i):e("value=r.%s()",r),e("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[s.keyType]?e('%s[typeof k==="object"?util.longToHash(k):k]=value',n):e("%s[k]=value",n)):s.repeated?(e("if(!(%s&&%s.length))",n,n)("%s=[]",n),void 0!==o.packed[r]&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",i)("return%j",l(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",i)("return%j",l(e,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",i)("return%j",l(e,"boolean key"))}})(e,a,"k[i]"),u(e,a,r,h+"[k[i]]")("}")):a.repeated?(e("if(!Array.isArray(%s))",h)("return%j",l(a,"array"))("for(var i=0;i<%s.length;++i){",h),u(e,a,r,h+"[i]")("}")):(a.partOf&&(n=o.safeProp(a.partOf.name),1===s[a.partOf.name]&&e("if(p%s===1)",n)("return%j",a.partOf.name+": multiple values"),s[a.partOf.name]=1,e("p%s=1",n)),u(e,a,r,h)),a.optional&&e("}")}return e("return null")},a=Cp(),o=Rp()),ap;function l(t,e){return t.name+": "+e+(t.repeated&&"array"!==e?"[]":t.map&&"object"!==e?"{k:"+t.keyType+"}":"")+" expected"}function u(t,e,i,s){if(e.resolvedType)if(e.resolvedType instanceof a){t("switch(%s){",s)("default:")("return%j",l(e,"enum value"));for(var r=Object.keys(e.resolvedType.values),n=0;n>>0",s,s);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",s,s);break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",s,s,h)('else if(typeof d%s==="string")',s)("m%s=parseInt(d%s,10)",s,s)('else if(typeof d%s==="number")',s)("m%s=d%s",s,s)('else if(typeof d%s==="object")',s)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",s,s,s,h?"true":"");break;case"bytes":t('if(typeof d%s==="string")',s)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",s,s,s)("else if(d%s.length)",s)("m%s=d%s",s,s);break;case"string":t("m%s=String(d%s)",s,s);break;case"bool":t("m%s=Boolean(d%s)",s,s)}}return t}function v(t,e,i,s){if(e.resolvedType)e.resolvedType instanceof f?t("d%s=o.enums===String?types[%i].values[m%s]:m%s",s,i,s,s):t("d%s=types[%i].toObject(m%s,o)",s,i,s);else{var r=!1;switch(e.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",s,s,s,s);break;case"uint64":r=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t('if(typeof m%s==="number")',s)("d%s=o.longs===String?String(m%s):m%s",s,s,s)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",s,s,s,s,r?"true":"",s);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",s,s,s,s,s);break;default:t("d%s=m%s",s,s)}}return t}}var vp={},pp,mp,gp,_p,wp,Mp,yp,Ep,xp,bp,Sp;function Tp(){var a,h,o,l,u,c,r,n,f,d,v,p,m,g,_;return mp||(mp=1,pp=w,a=$1(),((w.prototype=Object.create(a.prototype)).constructor=w).className="Type",h=Cp(),o=J1(),l=K1(),u=Q1(),c=ep(),r=ip,n=n1,f=Bv,d=Rp(),v=Np(),p=lp(),m=up(),g=dp(),_=vp,Object.defineProperties(w.prototype,{fieldsById:{get:function(){if(!this.ph){this.ph={};for(var t=Object.keys(this.fields),e=0;e>>0,8|u.mapKey[n.keyType],n.keyType),void 0===o?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",a,e):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|o,h,e),i("}")("}")):n.repeated?(i("if(%s!=null&&%s.length){",e,e),n.packed&&void 0!==u.packed[h]?i("w.uint32(%i).fork()",(n.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",e)("w.%s(%s[i])",h,e)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",e),void 0===o?f(i,n,a,e+"[i]"):i("w.uint32(%i).%s(%s[i])",(n.id<<3|o)>>>0,h,e)),i("}")):(n.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",e,n.name),void 0===o?f(i,n,a,e):i("w.uint32(%i).%s(%s)",(n.id<<3|o)>>>0,h,e))}return i("return w")},l=Cp(),u=q1(),c=Rp()),bp;function f(t,e,i,s){e.resolvedType.group?t("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",i,s,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",i,s,(e.id<<3|2)>>>0)}}(()=>{var a=ip;vp[".google.protobuf.Any"]={fromObject:function(t){if(t&&t["@type"]){var e,i=t["@type"].substring(t["@type"].lastIndexOf("/")+1),i=this.lookup(i);if(i)return-1===(e="."===t["@type"].charAt(0)?t["@type"].substr(1):t["@type"]).indexOf("/")&&(e="/"+e),this.create({type_url:e,value:i.encode(i.fromObject(t)).finish()})}return this.fromObject(t)},toObject:function(t,e){var i,s,r="",n="";return!((t=e&&e.json&&t.type_url&&t.value&&(n=t.type_url.substring(t.type_url.lastIndexOf("/")+1),r=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1),i=this.lookup(n))?i.decode(t.value):t)instanceof this.ctor)&&t instanceof a?(i=t.$type.toObject(t,e),s="."===t.$type.fullName[0]?t.$type.fullName.substr(1):t.$type.fullName,i["@type"]=n=(r=""===r?"type.googleapis.com/":r)+s,i):this.toObject(t,e)}}})();var r=lv.exports=uv;function Ip(t,e,i){return(e="function"==typeof e?(i=e,new r.Root):e||new r.Root).load(t,i)}function Pp(t,e){return(e=e||new r.Root).loadSync(t)}r.build="light",r.load=Ip,r.loadSync=Pp,r.encoder=Np(),r.decoder=lp(),r.verifier=up(),r.converter=dp(),r.ReflectionObject=Lp(),r.Namespace=$1(),r.Root=Ap(),r.Enum=Cp(),r.Type=Tp(),r.Field=K1(),r.OneOf=J1(),r.MapField=Q1(),r.Service=ep(),r.Method=tp(),r.Message=ip,r.wrappers=vp,r.types=q1(),r.util=Rp(),r.ReflectionObject.ah(r.Root),r.Namespace.ah(r.Type,r.Service,r.Enum),r.Root.ah(r.Type),r.Field.ah(r.Type);var Dp=lv.exports,Op=Dp,Up=ha(Op),Fp=["TmF2aVNlZ21lbg==","YWNjZXNzaWJsZQ==","Zmlk","bmZv","Rmxvb3JHZW8=","bGlmdFR5cGU=","bGVu","dmVs","ZXh0ZW50TGF5ZQ==","RXh0ZW50Qml6SQ==","cmVhZE9ubHk=","LnByb3RvYnVm","aW50MzI=","ZG9vcnR5cGU=","R0VPUE9JTlRfTQ==","TmF2aVpvbmU=","ZW50cmFuY2VGbA==","bGVuZ3Ro","ZWxCaXpJbmZv","c3RhaXJMYXllcg==","dG9CaWQ=","R2F0ZQ==","b2Zmc2V0WQ==","Zmlkcw==","aXNTZWxlY3RhYg==","ZmxhZw==","ZXh0ZXJuYWxNbw==","bGlmdEVudHJ5","VklTRUdNRU5U","SW5kZXhJbmZv","ZGF0YQ==","ZGVsQml6SW5mbw==","bWlk","cG9pTGF5ZXI=","bW9kZWxpZA==","cGFja2Vk","dGhyb3VnaA==","bmF2aVNlZ21lbg==","bGlmdExheWVy","cmVwZWF0ZWQ=","ZGVmQ2VuWQ==","b29y","bm9kZUlk","TmF2aU1vZGVs","cmFuaw==","c25vZGU=","cHRz","ZGVmR2lk","aGFzaENvZGU=","bmVzdGVk","Ymlk","cmVxdWlyZWQ=","R0VPTElORV9OQQ==","b2Zmc2V0WA==","TmF2aU5vZGU=","bHR5cGU=","T1ZFUkxBWURBVA==","ZGVmQ2VuWA==","b3B0aW9ucw==","YmFzZUxldmVs","YXJlYQ==","TGF5ZXJHcm91cA==","ZmllbGRz","cGFzcw==","Zmxvb3Jz","SUZU","Rmxvb3JOYXZp","amF2YV9vdXRlcg==","UG9seWdvbkxhYg==","ZW50cmFuY2VUeQ==","VHlwZQ==","bmF2aVpvbmVz","ZWxMYXllcg==","YWxpYXM=","d2lkdGg=","YXllcg==","ZW50cnl0eXBlcw==","TGlmdEJpekluZg==","bm9kZXR5cGVz","amF2YV9wYWNrYQ==","bmF2aVR5cGU=","ZGF0ZVZlcg==","bGlmdEZsYWc=","Z2lk","bWF4WA==","bW5hbWU=","bWluU2NhbGVMZQ==","Zmxvb3JJZA==","X2NsYXNzbmFtZQ==","TW9kZWxCaXpJbg==","Zmxvb3I=","bmFtZQ==","c2NhbGVMZXZlbA==","RXh0ZXJuYWxNbw==","cGdpZA==","ZmlsZVZlcg==","VEFJUg==","bWlubGV2ZWw=","Rmxvb3JDb25maQ==","R2VuZXJhbEdlbw==","ZHJpdmU=","Ym9vbA==","a2V5","R0VPUE9MWUdPTg==","dG9HaWQ=","ZGVmQ2VuWg==","YnR5cGU=","R0VPUE9JTlRfUw==","cC5wbGF0Zm9ybQ==","TmF2aUZsb29y","ZmxvYXQ=","bmF2aUV4dGVudA==","UE9JQml6SW5mbw==","TGFiZWxCaXpJbg==","TGF5ZXI=","cnVsZQ==","bGlk","Y29tLmZlbmdtYQ==","c2NhbGU=","c2VnbWVudElk","ZGVzYw==","ZGVsTGF5ZXI=","R0VPUE9JTlRfUA==","cm90YXRlQW5nbA==","X0xBQkVM","cG9seWdvbkxheQ==","ZmlsZURhdGU=","R0VPUE9JTlRfTA==","U3RhaXJCaXpJbg==","ZXNjYWxhdG9yTA==","bGlua1NlZw==","QnVmZmVy","TmF2aUV4dGVudA==","Z2Vv","R0VPTElORQ==","bmF2aU5vZGVz","cmVqZWN0cw==","UG9seWdvbkJpeg==","aXNWaXNpYmxl","b25zaGlw","YnVmZmVycw==","bWF4bGV2ZWw=","ZG91Ymxl","R0VPUE9JTlRfRQ==","bmF2aQ==","Rmxvb3JCaXo=","Z1Byb3RvQnVm","T0RFTA==","ZW5hbWU=","bW9kZWxMYXllcg==","a2V5cw==","ZWlk","bGF5ZXJz","QU5PUkFNQQ==","UkRFUg==","R0VPUE9JTlQ=","QnVpbGRpbmc=","bWluWA==","TWFw","aGVpZ2h0","c3RyaW5n","dHlwZQ==","ZGVmYXVsdA==","cG9seWdvbkxhYg==","TmF2aVJlbGF0aQ==","dWludDY0","aWR4cw==","SW5mbw==","X0VYVEVOVA=="];(t=>{for(var e=218;--e;)t.push(t.shift())})(Fp);class Bp{constructor(){this.id={nested:{protobuf:{options:{java_package:"com.fengmap.platform.protobuf",java_outer_classname:"FloorConfigProtoBuf"},nested:{Map:{fields:{mid:{rule:"required",type:"string",id:1},fileVer:{rule:"required",type:"int32",id:2},dateVer:{rule:"required",type:"uint64",id:3},mname:{rule:"required",type:"string",id:4},hashCode:{rule:"required",type:"string",id:5},key:{type:"string",id:6},fileDate:{type:"string",id:7},desc:{type:"string",id:8},readOnly:{type:"bool",id:9,options:{default:!1}},buffers:{rule:"repeated",type:"Buffer",id:10},keys:{rule:"repeated",type:"string",id:11}},nested:{Buffer:{fields:{gid:{rule:"required",type:"int32",id:1},fileVer:{rule:"required",type:"int32",id:2},btype:{rule:"required",type:"int32",id:3},len:{rule:"required",type:"uint64",id:4},data:{rule:"required",type:"bytes",id:5}}}}},Scene:{fields:{mid:{rule:"required",type:"string",id:19},fileVer:{rule:"required",type:"int32",id:20},dateVer:{rule:"required",type:"uint64",id:21},mname:{rule:"required",type:"string",id:22},hashCode:{rule:"required",type:"string",id:23},key:{type:"string",id:24},desc:{type:"string",id:25},readOnly:{type:"bool",id:26,options:{default:!1}},x:{type:"float",id:1},y:{type:"float",id:2},z:{type:"float",id:3},minX:{type:"float",id:4},minY:{type:"float",id:5},maxX:{type:"float",id:6},maxY:{type:"float",id:7},defGid:{type:"string",id:8},defCenX:{type:"float",id:9},defCenY:{type:"float",id:10},defCenZ:{type:"float",id:11},height:{type:"float",id:12},rotateAngleX:{type:"float",id:13},rotateAngleY:{type:"float",id:14},rotateAngleZ:{type:"float",id:15},scale:{type:"float",id:16},scaleLevel:{type:"string",id:17},naviType:{type:"int32",id:28},layerGroups:{rule:"repeated",type:"LayerGroup",id:18},buildings:{rule:"repeated",type:"Building",id:27}},nested:{Layer:{fields:{lid:{type:"int32",id:1},lname:{type:"string",id:2},alias:{type:"string",id:3},ltype:{type:"Type",id:4},offsetX:{type:"float",id:5},offsetY:{type:"float",id:6},height:{type:"float",id:7},rotateAngleX:{type:"float",id:8},rotateAngleY:{type:"float",id:9},rotateAngleZ:{type:"float",id:10},minScaleLevel:{type:"float",id:11},maxScaleLevel:{type:"float",id:12},isVisible:{type:"bool",id:13},isSelectable:{type:"bool",id:14},isEditable:{type:"bool",id:15},desc:{type:"string",id:16}},nested:{Type:{values:{GEOPOINT:1,GEOPOINT_ESCALATOR:2,GEOPOINT_LIFT:3,GEOPOINT_STAIR:4,GEOPOINT_PANORAMA:5,GEOPOINT_POI:6,GEOPOINT_STORELABEL:7,GEOPOINT_NAVINODE:8,GEOPOINT_MODEL:9,GEOLINE:20,GEOLINE_NAVISEGMENT:21,GEOLINE_BORDER:22,GEOPOLYGON:30,GEOPOLYGON_EXTENT:31,GEOPOLYGON_STORE:32,GEOPOLYGON_LABEL:33,RASTERATA:40,OVERLAYDATA:50}}}},LayerGroup:{fields:{gid:{type:"int32",id:1},gname:{type:"string",id:2},alias:{type:"string",id:3},height:{type:"float",id:4},desc:{type:"string",id:5},layers:{rule:"repeated",type:"Layer",id:6},floorId:{type:"string",id:7},naviType:{type:"int32",id:8}}},Floor:{fields:{gid:{type:"int32",id:1},x:{type:"float",id:2},y:{type:"float",id:3},offsetX:{type:"float",id:4},offsetY:{type:"float",id:5},angle:{type:"float",id:6},scale:{type:"float",id:7},fids:{rule:"repeated",type:"string",id:8},pgid:{type:"int32",id:9},baseLevel:{type:"bool",id:10},minlevel:{type:"int32",id:11},maxlevel:{type:"int32",id:12},floorId:{type:"string",id:13},idxs:{rule:"repeated",type:"IndexInfo",id:14},pts:{rule:"repeated",type:"double",id:15,options:{packed:!1}}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}},Building:{fields:{bid:{type:"string",id:1},name:{type:"string",id:2},ename:{type:"string",id:3},alias:{type:"string",id:4},x:{type:"float",id:5},y:{type:"float",id:6},mid:{type:"string",id:7},version:{type:"int32",id:8},floors:{rule:"repeated",type:"Floor",id:9},bcode:{type:"int32",id:10}}}}},Gate:{fields:{mid:{rule:"required",type:"string",id:1},floors:{rule:"repeated",type:"NaviFloor",id:2}},nested:{NaviFloor:{fields:{gid:{type:"int32",id:1},floorId:{type:"string",id:2},bid:{type:"string",id:3},mid:{type:"string",id:4},navi:{rule:"repeated",type:"NaviRelationship",id:5},drive:{rule:"repeated",type:"NaviRelationship",id:6},accessible:{rule:"repeated",type:"NaviRelationship",id:7}}},NaviRelationship:{fields:{eid:{rule:"required",type:"int32",id:1},type:{type:"int32",id:2},accessible:{type:"int32",id:3},idxs:{rule:"repeated",type:"IndexInfo",id:4},pts:{rule:"repeated",type:"double",id:5,options:{packed:!1}},flag:{type:"int32",id:6},toBid:{rule:"repeated",type:"string",id:7},toGid:{rule:"repeated",type:"string",id:8}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}},FloorGeo:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},height:{type:"float",id:3},extentLayer:{rule:"repeated",type:"GeneralGeoInfo",id:4},modelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:5},labelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:6},poiLayer:{rule:"repeated",type:"GeneralGeoInfo",id:7},polygonLayer:{rule:"repeated",type:"GeneralGeoInfo",id:8},polygonLabelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:9},liftLayer:{rule:"repeated",type:"GeneralGeoInfo",id:10},stairLayer:{rule:"repeated",type:"GeneralGeoInfo",id:11},escalatorLayer:{rule:"repeated",type:"GeneralGeoInfo",id:12},externalModelLayer:{rule:"repeated",type:"GeneralGeoInfo",id:13}},nested:{GeneralGeoInfo:{fields:{eid:{rule:"required",type:"int32",id:1},geo:{type:"string",id:2},height:{type:"float",id:3},area:{type:"float",id:4},idxs:{rule:"repeated",type:"IndexInfo",id:5},pts:{rule:"repeated",type:"double",id:6,options:{packed:!1}},baseheight:{type:"float",id:7}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}},FloorBiz:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},extentLayer:{rule:"repeated",type:"ExtentBizInfo",id:3},modelLayer:{rule:"repeated",type:"ModelBizInfo",id:4},labelLayer:{rule:"repeated",type:"LabelBizInfo",id:5},poiLayer:{rule:"repeated",type:"POIBizInfo",id:6},polygonLayer:{rule:"repeated",type:"PolygonBizInfo",id:7},liftLayer:{rule:"repeated",type:"LiftBizInfo",id:8},stairLayer:{rule:"repeated",type:"StairBizInfo",id:9},polygonLabelLayer:{rule:"repeated",type:"PolygonLabelBizInfo",id:10},externalModelLayer:{rule:"repeated",type:"ExternalModelBizInfo",id:11}},nested:{ExtentBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},ModelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7},pass:{type:"int32",id:8}}},LabelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},PolygonBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},POIBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},LiftBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},flag:{type:"int32",id:4},floor:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}},StairBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},flag:{type:"int32",id:4},minlevel:{type:"int32",id:5},maxlevel:{type:"int32",id:6}}},PolygonLabelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},width:{type:"float",id:4},name:{type:"string",id:5},ename:{type:"string",id:6},angle:{type:"float",id:7}}},ExternalModelBizInfo:{fields:{eid:{rule:"required",type:"int32",id:1},fid:{type:"string",id:2},type:{type:"int32",id:3},name:{type:"string",id:4},ename:{type:"string",id:5},minlevel:{type:"int32",id:6},maxlevel:{type:"int32",id:7}}}}},FloorNavi:{fields:{mid:{rule:"required",type:"string",id:1},gid:{rule:"required",type:"int32",id:2},naviNodes:{rule:"repeated",type:"NaviNode",id:3},naviSegments:{rule:"repeated",type:"NaviSegment",id:4},naviZones:{rule:"repeated",type:"NaviZone",id:5},naviModels:{rule:"repeated",type:"NaviModel",id:6},nextFloors:{rule:"repeated",type:"int32",id:7,options:{packed:!1}},naviExtents:{rule:"repeated",type:"NaviExtent",id:8}},nested:{NaviNode:{fields:{nodeId:{type:"int32",id:1},nodeType:{type:"int32",id:2},liftType:{type:"int32",id:3},liftFlag:{type:"int32",id:4},liftEntry:{type:"int32",id:5},liftFloor:{type:"string",id:6},linkSeg:{type:"string",id:7},geo:{type:"string",id:8},entranceType:{type:"int32",id:9},entranceFloor:{type:"string",id:10},doortype:{type:"int32",id:11},idxs:{rule:"repeated",type:"int32",id:12,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:13,options:{packed:!1}},accessible:{type:"int32",id:14,options:{default:0}}}},NaviSegment:{fields:{segmentId:{type:"int32",id:1},snode:{type:"int32",id:2},enode:{type:"int32",id:3},length:{type:"double",id:4},rank:{type:"int32",id:5},name:{type:"string",id:6},entry:{type:"int32",id:7},desc:{type:"string",id:8},geo:{type:"string",id:9},through:{type:"int32",id:10},idxs:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:12,options:{packed:!1}}}},NaviZone:{fields:{id:{rule:"required",type:"int32",id:1},type:{rule:"required",type:"int32",id:2,options:{default:0}},geo:{type:"string",id:3},rejects:{rule:"repeated",type:"string",id:4},idxs:{rule:"repeated",type:"int32",id:5,options:{packed:!1}},pts:{rule:"repeated",type:"double",id:6,options:{packed:!1}}}},NaviModel:{fields:{modelid:{rule:"required",type:"int32",id:1},doorids:{rule:"repeated",type:"int32",id:2,options:{packed:!1}},nodetypes:{rule:"repeated",type:"int32",id:3,options:{packed:!1}},entrytypes:{rule:"repeated",type:"int32",id:4,options:{packed:!1}}}},NaviExtent:{fields:{id:{rule:"required",type:"int32",id:1},pts:{rule:"repeated",type:"double",id:2,options:{packed:!1}},idxs:{rule:"repeated",type:"IndexInfo",id:3}},nested:{IndexInfo:{fields:{idxs:{rule:"repeated",type:"int32",id:1,options:{packed:!1}}}}}}}}}}}}}}class kp{constructor(){this.Mh=null}}Object.assign(kp.prototype,{yh(){this.Mh||(this.Mh=Up.Root.fromJSON((new("undefined"!=typeof KjWzhWlSj&&KjWzhWlSj.ProtoDef?KjWzhWlSj.ProtoDef:Bp)).id))},Eh(t){return this.yh(),this.Mh.lookup("Map").decode(t)},xh(e){for(let t=0;t{e.levels.push(t.gid)}),e},Th(t){return this.yh(),this.Mh.lookup("Gate").decode(t)},Rh(t){return this.yh(),this.Mh.lookup("FloorGeo").decode(t)},Ch(t){return this.yh(),this.Mh.lookup("FloorBiz").decode(t)},Ih(t){return this.yh(),this.Mh.lookup("FloorNavi").decode(t)}});class Gp{constructor(){var t;nt.environment===I.WX?this.Oh=new nt.ProtoReaderStatic:void 0!==hv.global().KjWzhWlSj&&hv.global().KjWzhWlSj.ProtoReaderStatic?(t=hv.global().KjWzhWlSj.ProtoReaderStatic,this.Oh=new t):this.Oh=new kp}}Object.assign(Gp.prototype,{Eh(t){return this.Oh.Eh(t)},xh(t){return this.Oh.xh(t)},Sh(t){return this.Oh.Sh(t)},Ah(t,e){return this.Oh.Ah(t,e)},Lh(t,e){return this.Oh.Lh(t,e)},Nh(t,e){return this.Oh.Nh(t,e)},Ph(t,e){return this.Oh.Ph(t,e)},Dh(t,e){return this.Oh.Dh(t,e)},bh(t){return this.Oh.bh(t)},Th(t){return this.Oh.Th(t)},Rh(t){return this.Oh.Rh(t)},Ch(t){return this.Oh.Ch(t)},Ih(t){return this.Oh.Ih(t)}});let Hp="https://console.fengmap.com/api-s/",Vp="https://console.fengmap.cool/api-s/",zp={domain:Hp,online:Hp+"sdk/check",check:Hp+"sdk/auth/web",download:Hp+"sdk/auth/obtainMapRoute",downloadTile:Hp+"sdk/authLayered/obtainMapRoute",collect:Hp+"sdk/collect",themeUrl:Hp+"webtheme/",externalModelURL:Hp+"webmodel/"},Wp=function(){zp={domain:Vp,online:Vp+"sdk/check",check:Vp+"sdk/auth/web",download:Vp+"sdk/auth/obtainMapRoute",downloadTile:Vp+"sdk/authLayered/obtainMapRoute",collect:Vp+"sdk/collect",themeUrl:Vp+"webtheme/",externalModelURL:Vp+"webmodel/"}},jp=(()=>{function v(t,e){for(var i,s=0,r=0,r=0;r<8;r++)1&e&&(s^=t),i=128&t,t<<=1,i&&(t^=27),e>>=1;return s}function p(t,e,i){for(var s=0;s<4;s++)t[0+s]^=e[16*i+4*s],t[4+s]^=e[16*i+4*s+1],t[8+s]^=e[16*i+4*s+2],t[12+s]^=e[16*i+4*s+3]}function m(t){for(var e,i,s,r=1;r<4;r++)for(i=0;i>4,t[4*s+e]=r[16*i+(15&t[4*s+e])]}function _(t){for(var e=0;e<4;e++)t[e]=i[16*((240&t[e])>>4)+(15&t[e])]}function w(t){return parseInt(t,16)}var i=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],r=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],M=0,y=0,E=[2,0,0,0];return{decryption:function(t,e){for(var i=Array(16),s=0;s<16;s++)i[s]=16*w(e.substr(2*s,1))+w(e.substr(2*s+1,1));var r=Array(16);for(s=0;s<16;s++)r[s]=16*w(t.substr(2*s,1))+w(t.substr(2*s+1,1));var n=Array(16);switch(s=[],i.length){default:case 16:M=4,y=10;break;case 24:M=6,y=12;break;case 32:M=8,y=14}for(var a=s=Array(16*(y+1)),h=Array(4),o=4*(y+1),l=0;l{function c(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function h(t,e,i,s,r,n){return c((e=c(c(e,t),c(s,n)))<>>32-r,i)}function f(t,e,i,s,r,n,a){return h(e&i|~e&s,t,e,r,n,a)}function d(t,e,i,s,r,n,a){return h(e&s|i&~s,t,e,r,n,a)}function v(t,e,i,s,r,n,a){return h(e^i^s,t,e,r,n,a)}function p(t,e,i,s,r,n,a){return h(i^(e|~s),t,e,r,n,a)}function a(t,e){t[e>>5]|=128<>>9<<4)]=e;for(var i,s,r,n,a=1732584193,h=-271733879,o=-1732584194,l=271733878,u=0;u>5]>>>s%32&255);return e}function l(t){var e=[];for(e[(t.length>>2)-1]=void 0,s=0;s>5]|=(255&t.charCodeAt(s/8))<>>4&15)+i.charAt(15&e);return s}function u(t){return unescape(encodeURIComponent(t))}function r(t){return o(a(l(t=u(t)),8*t.length))}function n(t,e){var i,t=u(t),e=u(e),s=l(t),r=[],n=[];for(r[15]=n[15]=void 0,16{i&&i()},()=>{s&&s(Cr.LICENSE_ERROR)}):s&&s(Cr.NAME_KEY_ERROR)},Bh(t,e,i){void 0!==t.mapURL?e&&e():(t.enableCollect&&this.kh(t),this.Gh(()=>{new ov({method:"POST",url:zp.check,header:{"X-Requested-With":"XMLHttpRequest","Content-type":"application/json;charset=utf-8"},data:this.Hh(t)}).sh(()=>{e&&e()},t=>{i&&i(t)},()=>{e&&e()})},()=>{e&&e()}))},Gh(t,e){new ov({method:"GET",url:zp.online}).sh(()=>{t&&t()},()=>{e&&e()},()=>{e&&e()})},Hh(t,e){let i;nt.environment===I.BROWSER&&(s=hv.global(),-1!==(s=(i=s.location.host).indexOf(":")))&&(i=i.slice(0,s));var s={mapId:t.buildingID,appName:t.appName};return e?s.keyValue=t.key:s.appKey=t.key,e?s.webUrl=i||qp:s.webURL=i||qp,s},kh(t){if("undefined"!=typeof navigator&&"undefined"!=typeof document){var i={};-1!==navigator.userAgent.indexOf("Opera")?i.userAgent="Opera":-1!==navigator.userAgent.indexOf("Firefox")?i.userAgent="FF":-1!==navigator.userAgent.indexOf("Chrome")?i.userAgent="Chrome":-1!==navigator.userAgent.indexOf("Safari")&&0===navigator.userAgent.indexOf("Chrome")?i.userAgent="Safari":-1!==navigator.userAgent.indexOf("compatible")&&-1!==navigator.userAgent.indexOf("MSIE")?i.userAgent="IE":-1!==navigator.userAgent.indexOf("Trident")&&(i.userAgent="Edge"),i.product="JS",i.sdkVersion=a.VERSION+"."+a.BUILD,i.appName=t.appName,i.appkey=t.key;var t=nt.document.createElement("canvas").getContext("experimental-webgl"),s=t.getExtension("WEBGL_debug_renderer_info");i.gpu=s?t.getParameter(s.UNMASKED_RENDERER_WEBGL):null,i.os=navigator.platform;let e=!0;var r=navigator.userAgent,n=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"];for(let t=0;t{200!==t.ih.status&&this.Qh.Jh(t.eh.url),t.Qt()}),this.$h.length=0,this.Qh.qh(!0)},io(e,i,s,r){if(e.mapURL){let t;t=e.isPreview?e.isOutdoor?e.tile?e.mapURL+e.buildingID+"/separate/"+e.buildingID+i+".fmap":e.mapURL+e.buildingID+"/"+e.buildingID+i+".fmap":e.tile?e.mapURL+e.mapID+"/"+e.bid+"/"+e.buildingID+"/separate/"+e.buildingID+i+".fmap":e.mapURL+e.mapID+"/"+e.bid+"/"+e.buildingID+"/"+e.buildingID+i+".fmap":e.mapURLAbsolute?e.mapURL+e.buildingID+i+".fmap":e.isOutdoor?e.mapURL+e.buildingID+"/"+e.buildingID+i+".fmap":e.mapURL+e.mapID+"/"+e.bid+"/"+e.buildingID+"/"+e.buildingID+i+".fmap",void(s&&s(t))}else{var t={newFlag:Qp,keyType:tm,isSeparate:!1},i=(e.isOutdoor||(t.bId=e.bid,t.rootMid=e.mapID),new ov({method:"POST",url:""===i?zp.download:zp.downloadTile+"/"+e.buildingID+i+".fmap",header:{"X-Requested-With":"XMLHttpRequest","Content-type":"application/json;charset=utf-8"},data:Object.assign(t,Jp.Hh(e,!0))}));this.$h.push(i),i.sh(t=>{s&&s(t.replace('"',"").replace('"',""))},t=>{r&&r(t)},t=>{r&&r(t)})}},so(s,r,n){s.enableCollect=em,Jp.Bh(s,()=>{this.io(s,"",i=>{var t=new ov({method:"GET",responseType:"arraybuffer",url:i});this.$h.push(t),this.Qh.Kh(i),t.sh(t=>{this.Qh.Jh(i);var t=new Uint8Array(t);let e=this.Oh.Eh(t);!s.isOutdoor||(t=[],e.keys&&0!==e.keys.length?t.push(...e.keys):t.push(e.key),s.isPreview)?r&&r(e):Jp.Fh(s,t,()=>{r&&r(e)},t=>{n&&n(t)})},t=>{n&&(t===Cr.PATH_ERROR?n(Cr.MAP_ID_URL_ERROR):n(t)),this.Qh.Jh(i)},t=>{n&&n(t),this.Qh.Jh(i)})},t=>{n&&n(t)})},t=>{n&&n(t)})},ro(s,r,n){s.enableCollect=em,Jp.Bh(s,()=>{this.io(s,".scene",i=>{this.Qh.Kh(i);var t=new ov({method:"GET",responseType:"arraybuffer",url:i});this.$h.push(t),t.sh(t=>{var t=new Uint8Array(t);let e=this.Oh.bh(t);this.Qh.Jh(i),!s.isOutdoor||(t=[],e.keys&&0!==e.keys.length?t.push(...e.keys):t.push(e.key),s.isPreview)?r&&r(e):Jp.Fh(s,t,()=>{r&&r(e)},t=>{n&&n(t)})},t=>{n&&n(t),this.Qh.Jh(i)},t=>{n&&n(t),this.Qh.Jh(i)})},t=>{n&&n(t)})},t=>{n&&n(t)})},no(t,i,s){this.io(t,".gate",e=>{this.Qh.Kh(e);var t=new ov({method:"GET",responseType:"arraybuffer",url:e});this.$h.push(t),t.sh(t=>{t=new Uint8Array(t),t=this.Oh.Th(t);i&&i(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)})},t=>{s&&s(t)})},ao(t,e,i,s){this.io(t,".floor."+e+".geo",e=>{var t=new ov({method:"GET",responseType:"arraybuffer",url:e});this.Qh.Kh(e),this.$h.push(t),t.sh(t=>{t=new Uint8Array(t),t=this.Oh.Rh(t);i&&i(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)})},t=>{s&&s(t)})},ho(t,e,i,s){this.io(t,".floor."+e+".biz",e=>{var t=new ov({method:"GET",responseType:"arraybuffer",url:e});this.Qh.Kh(e),this.$h.push(t),t.sh(t=>{t=new Uint8Array(t),t=this.Oh.Ch(t);i&&i(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)})},t=>{s&&s(t)})},oo(t,e,i,s){this.io(t,e,e=>{var t=new ov({method:"GET",responseType:"arraybuffer",url:e});this.Qh.Kh(e),this.$h.push(t),t.sh(t=>{t=new Uint8Array(t),t=this.Oh.Ih(t);i&&i(t),this.Qh.Jh(e)},t=>{s&&s(t),this.Qh.Jh(e)})},t=>{s&&s(t)},t=>{s&&s(t)})},uo(t,e,i,s){this.oo(t,".floor."+e+".navi",i,s)},co(t,e,i,s){this.oo(t,".floor."+e+".drive.navi",i,s)},fo(t,e,i,s){this.oo(t,".floor."+e+".accessible.navi",i,s)}});class nm{constructor(){}}Object.assign(nm.prototype,{do(i,s){var r=[];let n=0;for(let t=0;t{t.Li(e)}):t==ca.PUSH&&e._result.push(this)},Ri(){this.mi=new ia,0!=this.Ft.size&&this.Ft.forEach(t=>{this.mi.di(t.getBound())})}});class cm extends fa{constructor(t){super(),this.Ht=t.eid,this.Ti=dn.POINT,Object.assign(this,t)}}Object.assign(cm.prototype,{Ri(){this.mi=new ia,this.Ai&&this.mi.vi(this.Ai)},Li(t){t._support(this)==ca.PUSH&&t._result.push(this)}});class fm{constructor(){this.wo=[1,2,3,4],this.Mo=[6,7,9],this.yo=[31,32],this.Eo=new Map,this.Eo.set(31,dn.EXTENTGROUP),this.Eo.set(32,dn.MODELGROUP),this.Eo.set(6,dn.FACILITYGROUP),this.Eo.set(7,dn.LABELGROUP),this.Eo.set(9,dn.EXTERNALMODELGROUP),this.xo=new Map,this.xo.set(31,["extentLayer",null]),this.xo.set(32,["modelLayer","labelLayer"]),this.xo.set(6,["poiLayer",null]),this.xo.set(7,["labelLayer",null]),this.xo.set(9,["externalModelLayer",null]),this.Oh=new Gp}}Object.assign(fm.prototype,{bo(t){var e;return t?(e=t.scene,this.So(e,t)):null},So(t,i){let{layerGroups:e,...s}=t,r=t.fileVer,n=new um(s);return e.forEach(t=>{var e=this.To(t,i,r);n.Ft.set(t.gid,e)}),n},To(t,e,i){let{layers:s,...r}=t,n=new um(r),a=e&&e.floors?e.floors.get(t.gid).geo[0]:null,h=e&&e.floors?e.floors.get(t.gid).biz[0]:null;return s.forEach(t=>{6===t.ltype&&-1!==t.lname.indexOf("storelabel")&&(t.ltype=7);var e=this.Ao(t,a,h,i);null!==e&&n.Ft.set(this.Eo.get(t.ltype),e)}),this.Ro(n),n},Ro(t){var e=Array.from(t.Ft);e.sort((t,e)=>t[0]-e[0]),t.Ft=new Map(e)},Ao(t,e,i,s){var r;return-1===this.wo.indexOf(t.ltype)&&this.xo.get(t.ltype)?(r=new um(t),this.Lo(r,e,i,s),r&&(r.Ti=this.Eo.get(t.ltype)),r):null},Lo(t,e,i,s){if(t){var r=this.xo.get(t.ltype);if(r){var n=e?e[r[0]]:[],a=i?i[r[0]]:[];switch(t.ltype){case 6:this.Co(t,n,a,s,dn.FACILITY);break;case 7:this.Co(t,n,a,s,dn.LABEL);break;case 9:this.Co(t,n,a,s,dn.EXTERNALMODEL);break;case 31:this.No(t,n,a,s,dn.EXTENT,null);break;case 32:this.No(t,n,a,s,dn.MODEL,e?e[r[1]]:null)}}}},Co(e,i,s,r,n){for(let t=0;t","")).replace("#include ","");var{percent:i,color:s}=t.gradient,r=i.length,n=new Wt;let a=` + float stops[${r}]; + vec3 gradients[${r}]; + float fromPercent = ${Number(t.distancePercent[0]).toFixed(2)}; + float toPercent = ${Number(t.distancePercent[1]).toFixed(2)}; + `;for(let t=0;t",h)).replace("#include ",o)}Object.assign(vm.prototype,{Qt(t){this.Ho.Qt(t),this.Sa()},Sa(){this.Dr.clear(),this.Dr=null,this.Do.clear(),this.Do=null,this.eh.clear(),this.eh=null,this.Oo.clear(),this.Oo=null,this.Uo.clear(),this.Uo=null,this.Fo.clear(),this.Fo=null,this.jo&&this.jo({name:"DataManager"})},Xo(t){this.Oo.set(t.buildingID+t.uuid,null),this.Uo.set(t.buildingID+t.uuid,null),this.Fo.set(t.buildingID+t.uuid,0)},Vo(n,a){this.Xo(n),this.ro(n,(e,t)=>{a&&a(e,t);let r=this.Yo(n);t=n.loadNavi&&r.buildings&&0{a&&a(t,e);var i=void 0!==n.level?n.level:parseInt(r.defGid),s=(this.Zo(n,i,a),n.visibleLevels||r.levels);for(let t=0;t{a&&a(e,t)})},(t,e)=>{a&&a(t,e)})},no(i,t,s,r){t?(t=this.qo(i))?s&&s("gate",t):this.Ho.no(i,t=>{this.Do.get(i.buildingID).gate=t,s&&s("gate",t)},t=>{var e;i.navigationData?((e=this.Do.get(i.buildingID)).gate=i.navigationData,s&&s("gate",e.gate)):r("error",t)}):s&&s("gate",null)},ro(e,i,s){var t=this.Yo(e);t?(i&&i("scene",t),e.justDecode||(t=this.Dr.get(e.buildingID),i&&i("building",t))):this.Ho.ro(e,t=>{e.isOutdoor&&this.Ko(t),this.Do.set(e.buildingID,{scene:t}),i&&i("scene",t),e.justDecode||(t=this.Go.So(t),this.Dr.set(e.buildingID,t),i&&i("building",t))},t=>{s&&(t===Cr.PATH_ERROR?s("error",Cr.MAP_ID_URL_ERROR):s("error",t))})},Ko(t){var e=t.fileVer;t.buildings&&1{e.floors&&(e.levelChart=[],e.fids=[],e.floors.forEach(t=>{t.Ai=am.po(t.idxs,t.pts),t.pgid&&e.levelChart.push(t.pgid,t.gid),t.baseLevel&&(e.minlevel=t.minlevel,e.maxlevel=t.maxlevel),t.fids&&e.fids.push.apply(e.fids,t.fids)}))})},Zo(t,e,i,s){let r=this.Oo.get(t.buildingID+t.uuid);r||(r=[],this.Oo.set(t.buildingID+t.uuid,r)),s?r.unshift(e):r.push(e),this.ko&&1!==r.length||this.Jo(t,i)},Jo(n,a){let h=this.Yo(n);if(h){let r=this.Oo.get(n.buildingID+n.uuid);if(r&&0!==r.length){let t=this.Uo.get(n.buildingID+n.uuid),s=(t||(t=[],this.Uo.set(n.buildingID+n.uuid,t)),r[0]);-1!==t.indexOf(s)?(r.splice(r.indexOf(s),1),this.Jo(n,a)):(t.push(s),this.$o(n,s,(t,e)=>{let i=this.Fo.get(n.buildingID+n.uuid);"layerGroup"===t&&(a&&a(t,e),i++,this.Fo.set(n.buildingID+n.uuid,i),i===h.layerGroups.length&&a&&a("decode",this.Wo(n)),r.splice(r.indexOf(s),1),this.Jo(n,a)),"layer"===t&&a&&a(t,e),"floor"===t&&(a&&a(t,e),i===h.layerGroups.length)&&a&&a("complete",this.Qo(n))},(t,e)=>{a&&a(t,e)}))}}},$o(a,h,o,l){let u=this.Yo(a);var t=this.tl(u,h);if(t){var c=t.gname,t=t.naviType||0;let e=this.Bo[0],i=0,r=new Map,n=a.merge,s=function(s){if(i++,e===i){let e=r.get("geo"),i=r.get("biz");var t;n&&n.merge(h,e,i,u.fileVer),o&&o("layerGroup",r),a.justDecode||((t=s.Vs(a,h)).Ft.forEach(t=>{s.Go.Lo(t,e,i,u.fileVer),o&&o("layer",t)}),o&&o("floor",t))}};a.loadNavi&&((0!=(t&dm.WALK_RODE_NETWORK)||u.fileVer<3)&&(e++,this.uo(a,h,c,(t,e)=>{r.set(t,e),o&&o(t,e),s(this)},t=>{l&&l(t)})),0!=(t&dm.DRIVE_RODE_NETWORK)&&(e++,this.co(a,h,c,(t,e)=>{r.set(t,e),o&&o(t,e),s(this)},t=>{l&&l(t)})),0!=(t&dm.ACCESSIBLE_RODE_NETWORK))&&(e++,this.fo(a,h,c,(t,e)=>{r.set(t,e),o&&o(t,e),s(this)},t=>{l&&l(t)})),this.ao(a,h,c,(t,e)=>{r.set(t,e),o&&o(t,e),s(this)},t=>{l&&l(t)}),this.ho(a,h,c,(t,e)=>{r.set(t,e),o&&o(t,e),s(this)},t=>{l&&l(t)})}else l&&l("error",Cr.DEFAULT_LEVEL_ERROR)},ao(e,i,t,s,r){var n=this.el(e,i,"geo");n?s&&s("geo",n):this.Ho.ao(e,t,t=>{this.il(e,i,"geo",t),s&&s("geo",t)},t=>{r&&r("error",t)})},ho(e,i,t,s,r){var n=this.el(e,i,"biz");n?s&&s("biz",n):this.Ho.ho(e,t,t=>{this.il(e,i,"biz",t),s&&s("biz",t)},t=>{r&&r("error",t)})},uo(e,i,t,s,r){var n=this.el(e,i,"navi");n?s&&s("navi",n):this.Ho.uo(e,t,t=>{this.il(e,i,"navi",t),s&&s("navi",t)},t=>{r&&r("error",t)})},co(e,i,t,s,r){var n=this.el(e,i,"drive_navi");n?s&&s("drive_navi",n):this.Ho.co(e,t,t=>{this.il(e,i,"drive_navi",t),s&&s("drive_navi",t)},t=>{r&&r("error",t)})},fo(e,i,t,s,r){var n=this.el(e,i,"accessible_navi");n?s&&s("drive_navi",n):this.Ho.fo(e,t,t=>{this.il(e,i,"accessible_navi",t),s&&s("accessible_navi",t)},t=>{r&&r("error",t)})},zo(t,i){this.so(t,(t,e)=>{i&&i(t,e)},(t,e)=>{i&&i(t,e)})},so(e,i,s){let r=this.Wo(e);r?i&&i("decode",r):this.Ho.so(e,t=>{this.sl(e,t),r=this.Wo(e),i&&i("decode",r),e.justDecode||(t=this.Go.bo(r),this.Dr.set(e.buildingID,t),i&&i("complete",t))},t=>{s&&s("error",t)})},Qo(t){if(this.Dr)return this.Dr.get(t.buildingID)||null},Vs(t,e){t=this.Dr.get(t.buildingID);return t?t.Ft.get(e):null},sl(e,i){var s={scene:null,floors:new Map},r=this.Oh.xh(i);e.isOutdoor&&this.Ko(r),s.scene=r,s.gate=this.Oh.Sh(i);for(let t=0;t + #include + + uniform float lineWidth; + uniform vec2 resolution; + + attribute float uvyStart; + attribute float uvyEnd; + + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + attribute vec2 uv2; + + + varying vec2 vUv; + varying vec2 vUv2; + varying float uvScale; + + #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 ); + + } + + #include + + 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; + + #endif + + float aspect = resolution.x / resolution.y; + + vUv = uv; + + float duvy = uvyEnd - uvyStart; + float uvy = uvyStart + duvy * uv2.y; + // vUv2 = vec2(uv2.x ,uvy); + vUv2 = ( position.y < 0.5 ) ? vec2(uv2.x ,uvyStart) : vec2(uv2.x ,uvyEnd); + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + + // 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 + vec2 ndcStart = clipStart.xy / clipStart.w; + vec2 ndcEnd = clipEnd.xy / clipEnd.w; + + // direction + vec2 dir = ndcEnd - ndcStart; + + // account for clip-space aspect ratio + dir.x *= aspect; + float scaleDir = length(dir); + uvScale = 0.05/scaleDir; + dir = normalize( dir ); + + // perpendicular to dir + 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; + + gl_Position = clip; + + #include + + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + + } + `,fragmentShader:` + uniform vec3 diffuse; + uniform float opacity; + uniform vec2 repeat; + uniform vec2 offset; + uniform float miny; + uniform vec3 pcolor; + uniform float usePassOpacity; + uniform float passOpacity; + #include + + #ifdef USE_DASH + + uniform float dashSize; + uniform float gapSize; + + #endif + + uniform sampler2D mmap; + + varying float vLineDistance; + + #include + #include + + varying float uvScale; + varying vec2 vUv; + varying vec2 vUv2; + + #include + + void main() { + + #ifdef USE_DASH + + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + + if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + + #endif + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + + #ifdef USE_MMAP + + if(vUv2.y >= miny && miny != 1.0){ + vec4 texColor = texture2D( mmap, vUv2 * repeat + offset ); + diffuseColor = vec4(texColor.xyz,min(texColor.w, opacity)); + }else{ + float ret = opacity; + if(usePassOpacity == 1.0) { + ret = passOpacity; + } + diffuseColor = vec4(pcolor, ret); + + if(usePassOpacity == 1.0 && ret < 0.1) { + discard; + } + } + + #endif + + #include + + gl_FragColor = diffuseColor; + } + `};class gm extends Vh{constructor(t){super({type:"FMLineMaterial",uniforms:kh.clone(pc.line.uniforms),vertexShader:pc.line.vertexShader,fragmentShader:mm(t)}),t.gradient&&(this.defines={GRADIENT:!0}),this.dashed=!1,delete t.gradient,delete t.distancePercent,delete t.isNeedArrow,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},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}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value=t}},pcolor:{enumerable:!0,get:function(){return this.uniforms.pcolor.value},set:function(t){this.uniforms.pcolor.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.lineWidth=t.lineWidth,this.resolution=t.resolution,this}}class _m extends Dh{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Wt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}class wm extends _m{constructor(t){super(t),this.type="FMLineBasicMaterial",this.isMask=!1,this.maskType=0,this.maskPolygons=[],this.maskHolePogygons=[],this.maskHeight=0,this.maskExtrudeHeight=0,this.boundCenter=null,this.boundSize=null,this.maskOpacity=null,this.maskNodeHeight=0,this.maskParam="",this.maskHoleParam=""}}class Mm extends Dh{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Wt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}class ym extends Vh{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Em{constructor(){this.rl=!1,this.nl=new Map,this.al=new Map}}Object.assign(Em.prototype,{hl(t,e){this.al.has(t)||this.al.set(t,new Set),this.al.get(t).add(e)},ol(){this.nl.clear(),this.nl=null,this.al.clear(),this.al=null}});class xm{static getBrowser(){if(void 0!==navigator){var t,e,i,s,r,n,a=navigator.userAgent;if(void 0!==a)return t=-1{e(s),i.delete(t)}),this.al.delete(t)),0{t(e)})},ol(){this.nl.clear(),this.al.clear()}});let Tm=new Sm,Am={Left:0,Center:2,Right:4};class Rm{constructor(t){this.pl=t}}Object.assign(Rm.prototype,{ml(t,e){var i=nt.document.createElement("canvas"),s=i.getContext("2d");return i.width=t,i.height=e,i.style.width=t+"px",i.style.height=e+"px",{canvas:i,ctx:s}},gl(t,e,i,s,r){var n=r,a={x:r.x+e,y:r.y},h={x:r.x,y:r.y+i},e={x:r.x+e,y:r.y+i},r={x:n.x+s,y:n.y},i={x:a.x-s,y:a.y},o={x:a.x,y:a.y+s},l={x:e.x,y:e.y-s},u={x:e.x-s,y:e.y},c={x:h.x+s,y:h.y},f={x:h.x,y:h.y-s},d={x:n.x,y:n.y+s};t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.arcTo(a.x,a.y,o.x,o.y,s),t.lineTo(l.x,l.y),t.arcTo(e.x,e.y,u.x,u.y,s),t.lineTo(c.x,c.y),t.arcTo(h.x,h.y,f.x,f.y,s),t.lineTo(d.x,d.y),t.arcTo(n.x,n.y,r.x,r.y,s),t.closePath()},_l(t,n){if(t){let r=new Image;r.crossOrigin="Anonymous",r.onload=()=>{var t=r.width,e=r.height,{canvas:i,ctx:s}=this.ml(t,e);i.width=t,i.height=e,s.drawImage(r,0,0,t,e),n&&n(i)},r.src=t}else n(null)},wl(t,i,e,s){var r=s.scale??2;let n=1;var a=void 0!==s.needSize&&s.needSize,h=e.fontsize*r*1.2,o=2*r;let l=0,u=0;var c=(void 0!==e.fontWeight?e.fontWeight:400)+` ${h}px `+this.Ml(s.family,e.fontFamily);let f=void 0!==e.space?e.space*r:2*r;var d,v;let p=0;void 0!==e.plateSize&&(p=(e.plateSize-e.fontsize)/2*r),p=Math.max(p,3*r);var m=h/3;let g=0,_=[],w,M;var y=0*r,E=0*r,x=nt.document.createElement("canvas"),b=x.getContext("2d");b.font=c,b.textBaseline="alphabetic";let S=1.2*e.fontsize*r;void 0!==e.imageSize&&(S=1.2*e.imageSize*r),i&&0!=S||(S=0,f=0);var T=-1{r.image=t,r.needsUpdate=!0,s&&s.callback&&s.callback(r),s.labelImageCatch[e].canvas={size:i.size,spriteScale:i.spriteScale,width:i.width,height:i.height},s.labelImageCatch[e].image=t}})}return r.minFilter=V,r.generateMipmaps=!1,r.needsUpdate=!0,r},Al(t){var e=new c;return e.minFilter=V,e.generateMipmaps=!1,e.flipY=t.flipY,e},Rl(e,i){void 0===e.flipY&&(e.flipY=!0);let r,n=this.Sl(e);if(this.nl.has(n))this.al.has(n)?this.hl(n,i):i(r=this.nl.get(n));else{r=this.Al(e),this.nl.set(n,r),this.hl(n,i);let t="_getTexture"+ws.generateUUID();this.Qh.Kh(t),Tm.fl(e.url,s=>{r.image=s,r.needsUpdate=!0,this.al.get(n).forEach((t,e,i)=>{s&&e(r),i.delete(t)}),this.al.delete(n),this.Qh.Jh(t)},{needDraw:e.needDraw})}return r},Ll(t,e){var i=this.Tl(t,e);return i.useCatch||(i.scaleRatio=t.height/t.width,i.mspriteScale=t.spriteScale,e.needSize&&(i.size=t.size)),i},Qt(t){this.jo=t,this.Qh.qh(!0)},Sa(){this.nl.forEach(function(t,e,i){t.dispose(),i.delete(e)}),this.nl.clear(),this.nl=null,this.al.forEach(function(t,e,i){t.forEach(function(t,e,i){i.delete(e)}),i.delete(e)}),this.al.clear(),this.al=null,this.jo&&this.jo({name:"TextureManager"})}});let Nm=` +precision mediump float; +precision mediump int; + +attribute vec3 position; + +uniform mat4 modelViewMatrix; +uniform mat4 projectionMatrix; + +void main() { + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); +} + `,Im=` +precision mediump float; +precision mediump int; + +uniform vec3 color; +uniform float alpha; + +void main() { + gl_FragColor = vec4(color,alpha); +} + `,Pm=` +attribute float gradientAlpha; + +varying float v_gradientAlpha; + +void main() { + v_gradientAlpha = gradientAlpha; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); +} + `,Dm=` + +uniform vec3 color; +uniform float alpha; + +varying float v_gradientAlpha; + +void main() { + gl_FragColor = vec4(color, alpha * v_gradientAlpha); +} + `;class Om extends Dh{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yi,this.normalScale=new ct(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ps,this.combine=o,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Um extends Om{constructor(t){super(t),this.type="FMMeshLambertMaterial",this.mapMixColor=!1,this.heatCenter=null,this.heatSize=null,this.isMask=!1,this.maskType=0,this.maskPolygons=[],this.maskHolePogygons=[],this.maskHeight=0,this.maskExtrudeHeight=0,this.boundCenter=null,this.boundSize=null,this.maskOpacity=null,this.maskNodeHeight=0,this.maskParam="",this.maskHoleParam="",this.isJsonModel=!1}clone(){var t=(new this.constructor).copy(this);return t.mapMixColor=this.mapMixColor,t.heatCenter=this.heatCenter,t.heatSize=this.heatSize,t.isMask=this.isMask,t.maskType=this.maskType,t.maskPolygons=this.maskPolygons,t.maskHolePogygons=this.maskHolePogygons,t.maskHeight=this.maskHeight,t.maskExtrudeHeight=this.maskExtrudeHeight,t.boundCenter=this.boundCenter,t.boundSize=this.boundSize,t.maskOpacity=this.maskOpacity,t.maskNodeHeight=this.maskNodeHeight,t.maskParam=this.maskParam,t.maskHoleParam=this.maskHoleParam,t.isJsonModel=this.isJsonModel,t}}class Fm extends so{constructor(t){super(t),this.type="FMMeshBasicMaterial",this.isMask=!1,this.maskType=0,this.maskPolygons=[],this.maskHolePogygons=[],this.maskHeight=0,this.maskExtrudeHeight=0,this.boundCenter=null,this.boundSize=null,this.maskOpacity=null,this.maskNodeHeight=0,this.maskParam="",this.maskHoleParam=""}}class Bm extends Dh{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Wt(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 Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yi,this.normalScale=new ct(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ps,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},void 0!==t.defines.SHADING_MODE&&(this.defines.SHADING_MODE=t.defines.SHADING_MODE),this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class km extends Bm{constructor(t){super(t),this.type="FMMeshStandardMaterial",this.isMask=!1,this.maskType=0,this.maskPolygons=[],this.maskHolePogygons=[],this.maskHeight=0,this.maskExtrudeHeight=0,this.boundCenter=null,this.boundSize=null,this.maskOpacity=null,this.maskNodeHeight=0,this.maskParam="",this.maskHoleParam=""}clone(){var t=(new this.constructor).copy(this);return t.isMask=this.isMask,t.maskType=this.maskType,t.maskPolygons=this.maskPolygons,t.maskHolePogygons=this.maskHolePogygons,t.maskHeight=this.maskHeight,t.maskExtrudeHeight=this.maskExtrudeHeight,t.boundCenter=this.boundCenter,t.boundSize=this.boundSize,t.maskOpacity=this.maskOpacity,t.maskNodeHeight=this.maskNodeHeight,t.maskParam=this.maskParam,t.maskHoleParam=this.maskHoleParam,t}}class Gm{static setPixel({x:t,y:e,color:i,d:s,width:r}){s[4*(e*r+t)+0]=i[0],s[4*(e*r+t)+1]=i[1],s[4*(e*r+t)+2]=i[2],s[4*(e*r+t)+3]=i[3]}static getPowerOfTwoSizeCanvas(t){var e=ws.floorPowerOfTwo(t.width),i=ws.floorPowerOfTwo(t.height),s=nt.document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return s.width=e,s.height=i,s.getContext("2d").drawImage(t,0,0,e,i),s}static sizeCanvas(t,e,i){var s=nt.document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e=(s.width=e,s.height=i,s.getContext("2d")),i=s.width/2,r=s.height/2,n=Math.min(s.width/t.width,s.height/t.height),a=t.width*n,n=t.height*n,i=i-a/2,r=r-n/2;return e.clearRect(0,0,s.width,s.height),e.drawImage(t,0,0,t.width,t.height,i,r,a,n),s}}class Hm{constructor(t){this.Wt=t,this.Cl=new Rm(this),this.Nl=new Cm({mapCreateTime:this.Wt.st.Il}),this.Pl=this.Wt.st.Ls.materialMode,this.Dl={},this.Ol=new Map,this.Ul=new Map,this.Fl=new Map,this.Bl=new Map,this.kl=new Map,this.Gl=new Map,this.Hl={},this.Vl={},this.jo=null,this.Sa=this.Sa.bind(this),this.Qh=new $p({disposeCallback:this.Sa,enable:!0,name:"MaterialManager",mapCreateTime:this.Wt.st.Il}),this.zl=null,this.Wl={},this.jl()}get lamberMaterials(){return this.Ul}getMaterialCacheKey(t){return this.Xl(t)}regHook(t,e){this.Wl[t]||(this.Wl[t]=[]),this.Wl[t].push(e)}callHook(t,...e){t=this.Wl[t];t&&t.forEach(t=>t(...e))}}Object.assign(Hm.prototype,{Xl(t){var e,i=[];for(e in t)t[e]?t[e].isTexture?i.push(t[e].uuid):t[e].isColor?i.push(t[e].getStyle()):t[e].isVector2?(i.push(t[e].x),i.push(t[e].y)):i.push(t[e]):i.push(t[e]);return i.join()},Yl(t,e){var i=this.Zl(t),i=this.Xl(i);return this.Ol.has(i)||(t=this.ql(t,e),this.Ol.set(i,t)),this.Ol.get(i)},Kl(e,i,s){void 0!==e.url&&this.Nl.Rl({url:e.url,flipY:e.flipY},function(t){t.image&&(i.map=t,i.needsUpdate=!0),e.finish&&e.finish(i),s&&s(i)})},ql(t,e){var i;return t.isline?(i=new wm({color:t.color,linewidth:1,transparent:!0,opacity:t.opacity}),t.isMask&&(i.isMask=t.isMask,i.maskType=t.maskType,i.maskPolygons=t.maskPolygons,i.maskHolePogygons=t.maskHolePogygons,i.maskHeight=t.maskHeight,i.maskExtrudeHeight=t.maskExtrudeHeight,i.boundCenter=t.boundCenter,i.boundSize=t.boundSize,i.maskOpacity=t.maskOpacity,i.maskNodeHeight=t.maskNodeHeight)):(i=new Fm,void 0!==t.color&&(i.color=new Wt(t.color)),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.isMask&&(i.isMask=t.isMask,i.maskType=t.maskType,i.maskPolygons=t.maskPolygons,i.maskHolePogygons=t.maskHolePogygons,i.maskHeight=t.maskHeight,i.maskExtrudeHeight=t.maskExtrudeHeight,i.boundCenter=t.boundCenter,i.boundSize=t.boundSize,i.maskOpacity=t.maskOpacity,i.maskNodeHeight=t.maskNodeHeight,i.transparent=!0),this.Kl(t,i,e),e=void 0!==t.needDepth&&t.needDepth,i.transparent=!0,i.depthTest=e,i.depthWrite=e),i},Jl(t){var e=this.$l(t),e=this.Xl(e);return this.Ul.has(e)||(t=this.Ql(t),this.Ul.set(e,t)),this.Ul.get(e)},tu(t){if(void 0!==t)return"number"==typeof t?new Wt(t):t.constructor===Wt?t.clone():t.constructor===String?(new Wt).setStyle(t):void 0},eu(t){var e=this.iu(t),e=this.Xl(e);if(!this.kl.has(e)){var i,s={};for(i in t)s[i]=t[i];var r=new km(s);this.kl.set(e,r)}return this.kl.get(e)},iu(t){return{color:this.tu(t.color),emissive:t.emissive?t.emissive.clone():new Wt(0,0,0),depthWrite:t.depthWrite??!0,map:t.map,emissiveMap:t.emissiveMap,metalness:t.metalness??0,roughness:t.roughness,opacity:t.opacity??t.alpha,side:t.side,type:t.type}},$l(t){var e={color:this.tu(t.color),depthWrite:t.depthWrite??!0,map:t.map,opacity:t.opacity??t.alpha,side:t.side,type:t.type,modelSideGradient:t.modelSideGradient,isIgnoreLighting:t.isIgnoreLighting,stencilWrite:t.stencilWrite,polygonOffset:t.polygonOffset};return t.isMask&&(e.isMask=t.isMask,e.maskType=t.maskType,e.maskPolygons=JSON.stringify(t.maskPolygons),e.maskHolePogygons=JSON.stringify(t.maskHolePogygons),e.maskHeight=t.maskHeight,e.maskExtrudeHeight=t.maskExtrudeHeight,e.boundCenter=t.boundCenter,e.boundSize=t.boundSize,e.level=t.level,e.buildingId=t.buildingId,e.maskID=t.maskID,e.maskOpacity=t.maskOpacity,e.maskNodeHeight=t.maskNodeHeight),t.url&&(e.url=t.url),e},Zl(t){var e,i={};for(e in t)"maskPolygons"===e||"maskHolePogygons"===e?i[e]=JSON.stringify(t[e]):i[e]=t[e];return i},su(t,e){(e=e||{}).uuid=t.uuid;var i=this.Xl(e);return this.Gl.has(i)||(t=t.clone(),e.color&&(t.color=new Wt(e.color)),e.opacity&&(t.opacity=e.opacity),e.transparent&&(t.transparent=e.transparent),this.Gl.set(i,t)),this.Gl.get(i)},Ql(t){var e=new Um;return e.color=new Wt(t.color),e.opacity=t.alpha??t.opacity,e.transparent=e.opacity<1,e.modelSideGradient=t.modelSideGradient,e.isIgnoreLighting=t.isIgnoreLighting,t.isMask&&(e.isMask=t.isMask,e.maskType=t.maskType,e.maskPolygons=t.maskPolygons,e.maskHolePogygons=t.maskHolePogygons,e.maskHeight=t.maskHeight,e.maskExtrudeHeight=t.maskExtrudeHeight,e.boundCenter=t.boundCenter,e.boundSize=t.boundSize,e.maskOpacity=t.maskOpacity,e.maskNodeHeight=t.maskNodeHeight,e.transparent=!0),t.map&&(e.map=t.map),this.Kl(t,e),e},ru(t){var e=void 0===t.needDepth||t.needDepth,t=new gm({color:t.color,opacity:t.opacity,lineWidth:t.lineWidth,dashed:!1,transparent:!0,gradient:t.gradient}),e=(t.depthWrite=e,t.depthTest=e,this.Wt.st);return nt.environment===I.BROWSER?t.resolution.set(e.bt.renderer.domElement.clientWidth,e.bt.renderer.domElement.clientHeight):t.resolution.set(e.bt.renderer.domElement.width,e.bt.renderer.domElement.height),t},nu(t){var e=this.Xl(t);return this.Fl.has(e)||(t=this.ru(t),this.Fl.set(e,t)),this.Fl.get(e)},au(t,e,i){var s=new Mm,t=(s.sizeAttenuation=!1,s.depthTest=!1,s.depthWrite=!1,s.transparent=!0,s.opacity=i.opacity,s.side=Zt,this.hu(t,null,e,i));return s.map=t,i.needSize&&(s.size=t.size),s.userData.scaleRatio=t.scaleRatio,s.userData.mspriteScale=t.mspriteScale,s.needsUpdate=!0,s},ou(s,r,n,a){let h=new Mm;if(h.sizeAttenuation=!1,h.depthTest=!1,h.depthWrite=!1,h.opacity=n.opacity,h.transparent=!0,n.imageUrl){h.visible=!1;let e="_createLabelMaterial"+ws.generateUUID(),i=(this.Qh.Kh(e),this);Tm.fl(n.imageUrl,t=>{t=this.hu(s,t,r,{...n,callback:t=>{h.map=t,h.visible=!0,h.userData.scaleRatio=t.scaleRatio,h.userData.mspriteScale=t.mspriteScale,a&&a(h),h.needsUpdate=!0}});nt.environment===I.BROWSER&&(h.map=t,h.visible=!0,h.needsUpdate=!0,h.userData.scaleRatio=t.scaleRatio,h.userData.mspriteScale=t.mspriteScale,a)&&a(h),i.Qh.Jh(e)},{needDraw:!0})}else{var t;""!==s?(t=this.hu(s,null,r,{...n,callback:t=>{h.map=t,h.needsUpdate=!0,h.userData.scaleRatio=t.scaleRatio,h.userData.mspriteScale=t.mspriteScale,a&&a(h),h.visible=!0}}),nt.environment===I.BROWSER?(h.map=t,h.needsUpdate=!0,h.userData.scaleRatio=t.scaleRatio,h.userData.mspriteScale=t.mspriteScale,a&&a(h)):h.map||(h.visible=!1)):(a&&a(h),h.visible=!1)}return h},lu(t,e,i){return this.uu(t,i.imageUrl,e,i)},cu(s,r,n,a){let h=new so({transparent:!0});if(n.imageUrl){h.visible=!1;let e="_createLabelTopMaterial"+ws.generateUUID(),i=(this.Qh.Kh(e),this);Tm.fl(n.imageUrl,t=>{t=this.hu(s,t,r,{...n,scale:n.scale,callback:t=>{h.map=t,h.visible=!0,a&&a(h),h.needsUpdate=!0}});nt.environment===I.BROWSER&&(h.map=t,h.visible=!0,h.needsUpdate=!0,a)&&a(h),i.Qh.Jh(e)},{needDraw:!0})}else{var t;""!==s?(t=this.hu(s,null,r,{...n,scale:n.scale,callback:t=>{t.magFilter=V,t.minFilter=ie,h.map=t,h.needsUpdate=!0,a&&a(h),h.visible=!0}}),nt.environment===I.BROWSER?(h.map=t,h.needsUpdate=!0,a&&a(h)):h.map||(h.visible=!1)):(a&&a(h),h.visible=!1)}return h},hu(t,e,i,s){var r=this.fu(t,i);this.Vl[r]||(this.Vl[r]={});let n;return n=this.Vl[r].canvas||this.Cl.wl(t,e,i,s),this.Nl?.Ll(n,{paramKey:r,labelImageCatch:this.Vl,needSize:s.needSize,callback:s.callback})},uu(t,e,i,s){return this.Cl.wl(t,e,i,s)},fu(t,e){var{alpha:e,fontsize:i,fillColor:s,image:r}=e;return[t,e,i,s,r].join()},du(t,e){var i=this.Xl(t);return this.Bl.has(i)||(t=this.vu(t,e),this.Bl.set(i,t)),e&&e(this.Bl.get(i)),this.Bl.get(i)},vu(t,e){var i=void 0!==t.opacity?t.opacity:1;let s=new Mm;return s.sizeAttenuation=!1,s.depthTest=t.needDepth,s.depthWrite=t.needDepth,s.transparent=!0,s.opacity=i,s.visible=!1,this.Nl.Rl({url:t.url},function(t){t.image&&(s.map=t,s.needsUpdate=!0,s.visible=!0,s.userData.scaleRatio=t.image.width/t.image.height),e&&e(s)}),s},createArrowWidthBackTexture(i){var t=this.Cl.yl(i);if(nt.environment===I.BROWSER)return(s=new X0(Gm.getPowerOfTwoSizeCanvas(t))).rotation=-Math.PI/2,s.updateMatrix(),s;{var s=t.toDataURL("image/png");let e=new c;return nt.textureHelper.createImage({url:s,onload:t=>{e.image=t,e.needsUpdate=!0,e.rotation=-Math.PI/2,e.updateMatrix(),i.callback&&i.callback()}}),e}},createNormalLineTexture(i){var t=this.Cl.bl(i);if(nt.environment===I.BROWSER)return new X0(Gm.getPowerOfTwoSizeCanvas(t));{t=t.toDataURL("image/png");let e=new c;return nt.textureHelper.createImage({url:t,onload:t=>{e.image=t,e.needsUpdate=!0,i.callback&&i.callback()}}),e}},pu(i){var t=this.Cl.El(i);if(nt.environment===I.BROWSER)return new X0(Gm.getPowerOfTwoSizeCanvas(t));{t=t.toDataURL("image/png");let e=new c;return nt.textureHelper.createImage({url:t,onload:t=>{e.image=t,e.needsUpdate=!0,i.callback&&i.callback()}}),e}},mu(t,e){var i;return this.Dl[t+e]||((i=new ym({uniforms:{color:{value:new Wt(t)},alpha:{value:e}},vertexShader:Nm,fragmentShader:Im})).transparent=!0,this.Dl[t+e]=i)},gu(t,e){t=new Vh({uniforms:{color:{value:new Wt(t)},alpha:{value:e}},vertexShader:Pm,fragmentShader:Dm});return t.depthTest=!0,t.depthWrite=!1,t.transparent=!0,t},_u(t,e,i={}){let s=new c,r=(s.minFilter=i.generateMipmaps?ie:V,s.generateMipmaps=!!i.generateMipmaps,s.anisotropy=4,s.wrapS=kt,s.wrapT=kt,"_loadTexture"+ws.generateUUID()),n=(this.Qh.Kh(r),this);return Tm.fl(t,function(t){t&&(s.image=t,s.needsUpdate=!0),e(s),n.Qh.Jh(r)}),s},Qt(t){this.jo=t,this.Nl.Qt(()=>{this.Nl=null,this.Qh.qh(!0)}),this.Vl={}},Sa(){Tm.ol(),this.Cl.Qt(),this.Cl=null,this.Ol.clear(),this.Ul.clear(),this.Fl.clear(),this.Bl.clear(),this.jo&&this.jo({name:"MaterialManager"})},jl(){this.Wt.st.Ls.hdr&&this.Wt.st.Ls.hdr.load(this.Wt.st,t=>{this.zl=t;for(var[e,i]of this.kl)i.envMap||(i.uniforms.envMap.value=this.zl,i.envMap=this.zl)})}});class Vm{constructor(){this.wu={clearColor:16777215,clearAlpha:1,alphaTest:null},this.Mu=null,this.yu=new Map,this.Eu=new Map,this.xu=new Map,this.bu=new Map,this.Su=new Map,this.Tu=new Map,this.Au=new Map,this.Ru=new Map,this.Lu=new Map,this.Cu=new Map,this.Nu=new Map,this.Iu=new Map,this.Pu=new Map,this.Du=new Map,this.Ou=new Map,this.Uu=null}resize(){this.wu={clearColor:16777215,clearAlpha:1,alphaTest:null},this.yu.clear(),this.Eu.clear(),this.xu.clear(),this.bu.clear(),this.Su.clear(),this.Tu.clear(),this.Au.clear(),this.Ru.clear(),this.Lu.clear(),this.Cu.clear(),this.Nu.clear(),this.Iu.clear(),this.Pu.clear(),this.Du.clear(),this.Ou.clear()}}Object.assign(Vm.prototype,{Fu(e,t,i){for(var s in t)e[s]=t[s];if(i)for(var r in i){let t=e[r];if(t){if(i[r].type)switch(i[r].type){case"toColor":t=rn.toColor(t);break;case"toFloat":t=parseFloat(t);break;case"toRgba":t=rn.toRgba(t);break;case"toString":t+=""}i[r].name?(e[i[r].name]=t,delete e[r]):e[r]=t}}return e},Bu(t){this.resize(),t&&(this.sysPath=t.sysPath,this.userPath=t.userPath,this.logoPath=t.logoPath,this.sysModelPath=t.sysModelPath,this.userModelPath=t.userModelPath,this.ku(t),this.Gu(t.extenttheme,p.EXTENT),this.Hu(t.floorextentapply,p.EXTENT),this.Vu(t.extentapply,p.EXTENT),this.Gu(t.storetheme,p.MODEL),this.Hu(t.floorapply,p.MODEL),this.Vu(t.storeapply,p.MODEL),this.Gu(t.storelabeltheme,p.LABEL),this.Hu(t.floorstorelabelapply,p.LABEL),this.Vu(t.storelabelapply,p.LABEL),this.Gu(t.poiimagetheme,p.FACILITY),this.Hu(t.floorpoiimageapply,p.FACILITY),this.Vu(t.poiimageapply,p.FACILITY),this.Gu(t.externalmodeltheme,p.EXTERNAL_MODEL),this.Hu(t.floorexternalapply,p.EXTERNAL_MODEL),this.Vu(t.externalmodelapply,p.EXTERNAL_MODEL),this.zu())},ku(t){t.viewtheme&&((t=t.viewtheme).clearcolor&&(this.wu.clearColor=rn.toColor(t.clearcolor)),t.clearalpha&&(this.wu.clearAlpha=parseFloat(t.clearalpha)),t.lighttheme&&(this.Mu=t.lighttheme),null!=t.alphatest)&&(this.wu.alphaTest=t.alphatest)},Gu:function(t,e){if(t)for(var i of t)if(i.id)switch(e){case p.EXTERNAL_MODEL:this.Pu.set(i.id,this.Fu({},i,{color:{type:"toColor"}}));break;case p.FACILITY:i.imagename&&this.Cu.set(i.id,this.Fu({},i,{imagename:{name:"imageName"}}));break;case p.LABEL:this.Au.set(i.id,this.Fu({},i,{alpha:{type:"toFloat"},fillcolor:{name:"fillColor",type:"toRgba"},strokecolor:{name:"strokeColor",type:"toRgba"},platesize:{name:"plateSize"},platestrokecolor:{name:"plateStrokeColor",type:"toRgba"},platecolor:{name:"plateColor",type:"toRgba"},strokewidth:{name:"strokeWidth",type:"toFloat"},space:{type:"toFloat"},fontfamily:{name:"fontFamily"},fontweight:{name:"fontWeight",type:"toFloat"},imagesize:{name:"imageSize",type:"toFloat"}}));break;case p.MODEL:this.yu.set(i.id,this.Fu({},i,{color:{type:"toColor"},alpha:{type:"toFloat"},strokecolor:{name:"strokeColor",type:"toColor"},strokewidth:{name:"strokeWidth",type:"toFloat"}}));break;case p.EXTENT:this.bu.set(i.id,this.Fu({},i,{color:{type:"toColor"},alpha:{type:"toFloat"}}))}},Hu:function(t,e){if(t)for(var i of t)for(var s of i.typeapply){var r,n=this.Fu({},s,{normalid:{name:"normalID",type:"toString"},selectedid:{name:"selectID",type:"toString"}});for(r of s.type.split(","))this.Wu(e).set(r,n)}},Vu:function(t,e){if(t)for(var i of t)if(i.fids){var s,r=this.Fu({},i,{normalid:{name:"normalID",type:"toString"},selectedid:{name:"selectID",type:"toString"}});for(s of i.fids.split(","))this.ju(e).set(s,r)}},zu(){this.Eu.get("0")&&this.yu.get(this.Eu.get("0").selectID)&&(this.Uu=this.yu.get(this.Eu.get("0").selectID).color)},ju:function(t){switch(t){case p.EXTENT:return this.Tu;case p.LABEL:return this.Lu;case p.FACILITY:return this.Iu;case p.MODEL:return this.xu;case p.EXTERNAL_MODEL:return this.Ou}},Wu:function(t){switch(t){case p.EXTENT:return this.Su;case p.LABEL:return this.Ru;case p.FACILITY:return this.Nu;case p.MODEL:return this.Eu;case p.EXTERNAL_MODEL:return this.Du}},Xu:function(t){switch(t){case p.EXTENT:return this.bu;case p.LABEL:return this.Au;case p.FACILITY:return this.Cu;case p.MODEL:return this.yu;case p.EXTERNAL_MODEL:return this.Pu}},Qt(){for(var t in this.resize(),this)this[""+t]=null,delete this[""+t]}});class zm{constructor(t){this.Wt=t}}Object.assign(zm.prototype,{Yu(t){var t=this.Wt.Zu.get(t),e=this.Wt.Zu.get(this.Wt.Ls.buildingID);let i={};return(i=t?{theme:t.theme,themeExtension:t.themeExtension}:i).theme||(i.theme=e.theme),i.themeExtension||(i.themeExtension=e.themeExtension),i},qu(t){t=this.Yu(t);return Object.assign({},t.theme.wu,t.themeExtension.wu)},Ku(t){var e;return void 0===t.fid?(e=this.Yu(t.bid),Object.assign({},e.theme.bu.get("0"),e.themeExtension.bu.get("0"))):this.Ju(p.EXTENT,t)},$u(t){return this.Ju(p.MODEL,t)},Qu(t){return this.Ju(p.FACILITY,t)},tc(t){return this.Ju(p.LABEL,t)},ec(t){return this.Ju(p.EXTERNAL_MODEL,t)},Ju(t,e){var i=this.Yu(e.bid);let s,r;var n={},a={},h=i.themeExtension.ju(t).get(e.fid),o=i.theme.ju(t).get(e.fid);if(h||o){var l=(h&&void 0!==h.normalID?h:o).normalID;if(s=i.themeExtension.Xu(t).get(l),r=i.theme.Xu(t).get(l),s||r)return a.themeUseDetail={content:e.fid,name:"fid",isExtension:!!h},Object.assign(a,r,s,o,h)}return h=i.themeExtension.Wu(t).get(e.typeID),o=i.theme.Wu(t).get(e.typeID),(h||o)&&(a.themeUseDetail={content:e.typeID,name:"typeId",isExtension:!!h},Object.assign(n,o,h)),n.normalID||(h=i.themeExtension.Wu(t).get("0"),o=i.theme.Wu(t).get("0"),Object.assign(n,h,o)),s=i.themeExtension.Xu(t).get(n.normalID),r=i.theme.Xu(t).get(n.normalID),Object.assign(a,r,s)},ic(t){t=this.Yu(t);let e=t.themeExtension.Uu;return e=e||t.theme.Uu},Qt(){this.Wt=null},sc(t){let o=t.Ls.buildingOptions,l=o.buildings||o.theme,u=null,c=()=>{var e=t.getBuildings(),i=e.map(t=>t.Ht);if(!1===t.rc)u=setTimeout(c,1);else{null!==u&&clearTimeout(u);var s=[];if(l)for(let t=0;t{var e={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(t,e).then(i).catch(s)},e,s)}decodeDracoFile(t,e,i,s){s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(t,s).then(e)}decodeGeometry(i,s){for(var t in s.attributeTypes){var e=s.attributeTypes[t];void 0!==e.BYTES_PER_ELEMENT&&(s.attributeTypes[t]=e.name)}var r,n=JSON.stringify(s);if(Jm.taskCache.has(i)){var a=Jm.taskCache.get(i);if(a.key===n)return a.promise;if(0===i.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var h=this.workerNextTaskID++,a=i.byteLength,a=this.oc(h,a).then(t=>(r=t,new Promise((t,e)=>{r.lc[h]={resolve:t,reject:e},r.postMessage({type:"decode",id:h,taskConfig:s,buffer:i},[i])}))).then(t=>this.uc(t.geometry));return a.finally(()=>{r&&h&&this.cc(r,h)}),Jm.taskCache.set(i,{key:n,promise:a}),a}uc(t){var e=new Ch;t.index&&e.setIndex(new N(t.index.array,1));for(var i=0;i{s.load(i,t,void 0,e)})}preload(){return this.dc(),this}dc(){var i,t;return this.decoderPending||(t=[],(i="object"!=typeof WebAssembly||"js"===this.decoderConfig.type)?t.push(this.fc("draco_decoder.js","text")):(t.push(this.fc("draco_wasm_wrapper.js","text")),t.push(this.fc("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{var e=t[0],t=(i||(this.decoderConfig.wasmBinary=t[1]),Jm.DRACOWorker.toString()),e=["/* draco decoder */",e,"","/* worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([e]))})),this.decoderPending}oc(t,e){return this.dc().then(()=>{var i;return this.workerPool.lengthe.mc?-1:1}),(i=this.workerPool[this.workerPool.length-1]).vc[t]=e,i.mc+=e,i})}cc(t,e){t.mc-=t.vc[e],delete t.lc[e],delete t.vc[e]}debug(){this.workerPool.map(t=>t.mc)}dispose(){for(var t=0;t{var t=t.draco,e=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(a),a.byteLength);try{var s=((t,e,i,s)=>{var r,n,a=s.attributeIDs,h=s.attributeTypes,o=e.GetEncodedGeometryType(i);if(o===t.TRIANGULAR_MESH)r=new t.Mesh,n=e.DecodeBufferToMesh(i,r);else{if(o!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");r=new t.PointCloud,n=e.DecodeBufferToPointCloud(i,r)}if(!n.ok()||0===r.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+n.error_msg());var l,u,c,f={index:null,attributes:[]};for(l in a){var d=self[h[l]];if(s.useUniqueIDs)c=a[l],u=e.GetAttributeByUniqueId(r,c);else{if(-1===(c=e.GetAttributeId(r,t[a[l]])))continue;u=e.GetAttribute(r,c)}f.attributes.push(((t,e,i,s,r,n)=>{var a,h,o=n.num_components(),l=i.num_points()*o;switch(r){case Float32Array:a=new t.DracoFloat32Array,e.GetAttributeFloatForAllPoints(i,n,a),h=new Float32Array(l);break;case Int8Array:a=new t.DracoInt8Array,e.GetAttributeInt8ForAllPoints(i,n,a),h=new Int8Array(l);break;case Int16Array:a=new t.DracoInt16Array,e.GetAttributeInt16ForAllPoints(i,n,a),h=new Int16Array(l);break;case Int32Array:a=new t.DracoInt32Array,e.GetAttributeInt32ForAllPoints(i,n,a),h=new Int32Array(l);break;case Uint8Array:a=new t.DracoUInt8Array,e.GetAttributeUInt8ForAllPoints(i,n,a),h=new Uint8Array(l);break;case Uint16Array:a=new t.DracoUInt16Array,e.GetAttributeUInt16ForAllPoints(i,n,a),h=new Uint16Array(l);break;case Uint32Array:a=new t.DracoUInt32Array,e.GetAttributeUInt32ForAllPoints(i,n,a),h=new Uint32Array(l);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;ut.array.buffer);s.index&&r.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},r)}catch(t){console.error(t),self.postMessage({type:"error",id:n.id,error:t.message})}finally{t.destroy(i),t.destroy(e)}})}}},Jm.taskCache=new WeakMap,Jm.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},Jm.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},Jm.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},Jm.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};class sg{constructor(t,e,i,s){this.parameterPositions=t,this.gc=0,this.resultBuffer=void 0!==s?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){var i=this.parameterPositions;let s=this.gc,r=i[s],n=i[s-1];t:{e:{let t;i:{s:if(!(e=n)break t;var h=i[1];e=(n=i[--s-1]))break e}t=s,s=0}for(;s>>1;ee;)--a;return++a,0===n&&a===r||(n>=a&&(a=Math.max(a,1),n=a-1),i=this.getValueSize(),this.times=s.slice(n,a),this.values=this.values.slice(n*i,a*i)),this}validate(){let i=!0;var t=this.getValueSize(),e=(t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),i=!1),this.times),s=this.values,r=e.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),i=!1);let n=null;for(let t=0;t!==r;t++){var a=e[t];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,a),i=!1;break}if(null!==n&&n>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,a,n),i=!1;break}n=a}if(void 0!==s&&Qm(s))for(let t=0,e=s.length;t!==e;++t){var h=s[t];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,h),i=!1;break}}return i}optimize(){var i=this.times.slice(),s=this.values.slice(),r=this.getValueSize(),n=this.getInterpolation()===ui,a=i.length-1;let h=1;for(let t=1;t{i&&i(t),r.manager.itemEnd(e)}).catch(t=>{s&&s(t)}):(setTimeout(function(){i&&i(n),r.manager.itemEnd(e)},0),n);var a={},a=(a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(t){return jm.add(e,t),i&&i(t),r.manager.itemEnd(e),t}).catch(function(t){s&&s(t),jm.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));jm.add(e,a),r.manager.itemStart(e)}}let Fg=new Gt,Bg=new Gt,kg=new Ht,Gg=new Ka,Hg=new yr,Vg=new Gt,zg=new Gt;class Wg extends v{constructor(t=new Ch,e=new _m){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){var t=this.geometry;if(null===t.index){var i=t.attributes.position,s=[0];for(let t=1,e=i.count;te.far))return{distance:n,point:zg.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}}class Xg extends Wg{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}let Yg=new Gt,Zg=new Gt;class qg extends Wg{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){var t=this.geometry;if(null===t.index){var i=t.attributes.position,s=[];for(let t=0,e=i.count;tr.far||n.push({distance:t,distanceToRay:Math.sqrt(h),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a}))}let o_="\\[\\]\\.:\\/",l_=new RegExp("["+o_+"]","g"),u_="[^"+o_+"]",c_="[^"+o_.replace("\\.","")+"]",f_=/((?:WC+[\/:])*)/.source.replace("WC",u_),d_=/(WCOD+)?/.source.replace("WCOD",c_),v_=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",u_),p_=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",u_),m_=new RegExp("^"+f_+d_+v_+p_+"$"),g_=["material","materials","bones","map"];class __{constructor(t,e,i){i=i||d.parseTrackName(e);this.Rc=t,this.Lc=t.subscribe_(e,i)}getValue(t,e){this.bind();var i=this.Rc.nCachedObjects_,i=this.Lc[i];void 0!==i&&i.getValue(t,e)}setValue(i,s){var r=this.Lc;for(let t=this.Rc.nCachedObjects_,e=r.length;t!==e;++t)r[t].setValue(i,s)}bind(){var i=this.Lc;for(let t=this.Rc.nCachedObjects_,e=i.length;t!==e;++t)i[t].bind()}unbind(){var i=this.Lc;for(let t=this.Rc.nCachedObjects_,e=i.length;t!==e;++t)i[t].unbind()}}class d{constructor(t,e,i){this.path=e,this.parsedPath=i||d.parseTrackName(e),this.node=d.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this.Cc,this.setValue=this.Nc}static create(t,e,i){return new(t&&t.isAnimationObjectGroup?d.Composite:d)(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(l_,"")}static parseTrackName(t){var e=m_.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i,e={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=e.nodeName&&e.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s&&(i=e.nodeName.substring(s+1),-1!==g_.indexOf(i))&&(e.nodeName=e.nodeName.substring(0,s),e.objectName=i),null===e.propertyName||0===e.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return e}static findNode(t,r){if(void 0===r||""===r||"."===r||-1===r||r===t.name||r===t.uuid)return t;if(t.skeleton){var e=t.skeleton.getBoneByName(r);if(void 0!==e)return e}if(t.children){let s=function(e){for(let t=0;t{t="data:image/png;base64,"+t.data;let e=nt.textureHelper.createImage({url:t,onload:()=>{n.add(s,e),r&&r(e),a.manager.itemEnd(s),i.unlink({filePath:s,fail(t){},success:()=>{}})}})},fail:t=>{console.error(t),e&&e(t),a.manager.itemError(s),a.manager.itemEnd(s)}})}else i=nt.textureHelper.createImage({url:s,onload:()=>{n.add(s,i),r&&r(i),a.manager.itemEnd(s)},onerror:t=>{console.error(t),e&&e(t),a.manager.itemError(s),a.manager.itemEnd(s)}});return i}class O_ extends Zm{constructor(t){super(t)}load(e,t,i,s){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,n=jm.get(e);if(void 0!==n)return r.manager.itemStart(e),setTimeout(function(){t&&t(n),r.manager.itemEnd(e)},0),n;if(nt.environment===I.WX)return D_(e,t,i,s,jm,r);let a=mh("img");function h(){l(),jm.add(e,this),t&&t(this),r.manager.itemEnd(e)}function o(t){l(),s&&s(t),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){a.removeEventListener("load",h,!1),a.removeEventListener("error",o,!1)}return a.addEventListener("load",h,!1),a.addEventListener("error",o,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class U_ extends Zm{constructor(t){super(t)}load(t,e,i,s){let r=new c;var n=new O_(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,s),r}}function F_(t,i){if(i===mi)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(i!==_i&&i!==gi)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",i),t;{let e=t.getIndex();if(null===e){var s=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t=2.0 are supported."));else{var h=new U2(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder},this.materialManager);h.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t(d[e]=t,d[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(t)),Promise.all(n).then(t=>{var e,i=t.pop(),s=i.isGroup?i.children:[i],r=t[0].count,n=[];for(e of s){var a,h,o=new Ht,l=new Gt,u=new Ms,c=new Gt(1,1,1),f=new Og(e.geometry,e.material,r);for(let t=0;t{var i,s,r=this.associations.get(t);null!=r&&this.associations.set(e,r);for([i,s]of t.children.entries())n(s,e.children[i])};return n(i,s),s.name+="_instance_"+t.uses[e]++,s}hf(e){var i=Object.values(this.plugins);i.push(this);for(let t=0;tt.clone());let i=e.images[t],s,a=(nt.environment===I.BROWSER&&(s=self.URL||self.webkitURL),i.uri||""),h=!1;if(void 0!==i.bufferView)a=this.getDependency("bufferView",i.bufferView).then(function(r){var t;if(nt.environment===I.BROWSER)return h=!0,t=new Blob([r],{type:i.mimeType}),a=s.createObjectURL(t);{let t=wx.getFileSystemManager();return new Promise(function(e,i){let s=wx.env.USER_DATA_PATH+"/"+G_+".png";G_++,t.writeFile({filePath:s,data:r,encoding:"binary",success:t=>{e(s)},fail:t=>{console.error("失败******",s,t),i(s)}})})}});else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");e=Promise.resolve(a).then(function(s){return new Promise(function(e,t){let i=e;!0===r.isImageBitmapLoader&&(i=function(t){t=new c(t);t.needsUpdate=!0,e(t)}),r.load(Wm.resolveURL(s,n.path),i,void 0,t)})}).then(function(t){return!0===h&&s.revokeObjectURL(a),R2(t,i),t.userData.mimeType=i.mimeType||D2(i.uri),t}).catch(function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),t});return this.sourceCache[t]=e}assignTexture(s,r,n,a){let h=this;return this.getDependency("texture",n.index).then(function(t){var e,i;return t?(void 0!==n.texCoord&&0r[f.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,s).then(function(t){return B2(t,e,s)}))(h):B2(new Ch,h,s),n[o]={primitive:h,promise:t},a.push(t)}}return Promise.all(a)}loadMesh(l){let u=this;var t=this.json;let c=this.extensions,f=t.meshes[l],d=f.primitives;var i=[];for(let t=0,e=d.length;t{let i=new Map;for(var[e,s]of r.associations)(e instanceof Dh||e instanceof c)&&i.set(e,s);return t.traverse(t=>{var e=r.associations.get(t);null!=e&&i.set(t,e)}),i})(s),s})}uf(t,i,e,s,r){var n=[],a=t.name||t.uuid;let h=[];x2[r.path]===x2.weights?t.traverse(function(t){t.morphTargetInfluences&&h.push(t.name||t.uuid)}):h.push(a);let o;switch(x2[r.path]){case x2.weights:o=ug;break;case x2.rotation:o=fg;break;case x2.position:case x2.scale:o=vg;break;default:o=1===e.itemSize?ug:vg}var l=void 0!==s.interpolation?b2[s.interpolation]:li,u=this.cf(e);for(let t=0,e=h.length;ts.getDependency("accessor",t).then(function(t){i.setAttribute(e,t)}))(n[e],h))}return void 0===t.indices||i.index||(r=s.getDependency("accessor",t.indices).then(function(t){i.setIndex(t)}),a.push(r)),zt.workingColorSpace!==Si&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${zt.workingColorSpace}" not supported.`),R2(i,t),F2(i,t,s),Promise.all(a).then(function(){return void 0!==t.targets?L2(i,t.targets,s):i})}class k2 extends Em{constructor(t,e){super(),this.st=t,this.df=new H_(void 0,e.pl),this.vf=!1,this.pf=!1,this.st.Ls.decoderURL&&((t=new Jm).setDecoderPath(this.st.Ls.decoderURL),this.df.setDRACOLoader(t))}load(t,e,i){try{return this.Vo(t,e,i)}catch(t){console.error(t)}}}Object.assign(k2.prototype,{Vo(s,r,n){if(!this.nl.has(s))return this.nl.set(s,{loadComplete:!1}),this.df.load(s,(t,e)=>{var i;!0!==this.pf&&(this.nl.set(s,{gltf:t,data:e,isAnimate:0{r&&r(t),this.st.Wt.mf(),this.gf(s,!1)},t=>{n&&n(t),this.st.Wt.mf()}):(i.scene=t.scene.clone(!0),r&&r(i),this.st.Wt.mf(),this.gf(s,!1)))},function(t){},e=>{var t;!0!==this.pf&&(this.nl.delete(s),n&&n(e),(t=this.al.get(s))&&t.forEach(t=>{t.fail&&t.fail(e)}),this.al.delete(s),this.st.Wt.mf(),this.gf(s,e))});this.hl(s,{success:r,fail:n}),!0===this.nl.get(s).loadComplete&&(this.st.Wt.mf(),this.gf(s))},gf(n,a){if(this.al.has(n)){let r=this.nl.get(n);r&&(this.al.get(n).forEach((t,e,i)=>{var s;a?e.fail&&e.fail(a):r.isAnimate?this.df.parse(r.data,Wm.extractUrlBase(n),function(t){e.success&&e.success(t)},function(t){e.fail&&e.fail(t)}):((s={animations:[]}).scene=r.gltf.scene.clone(!0),e.success&&e.success(s)),i.delete(t)}),this.al.delete(n))}},Qt(){this.pf=!0,this.nl.clear(),this.al.clear(),this._f=null,this.df=null}});class G2{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){t=this.getUtoTmapping(t);return this.getPoint(t,e)}getPoints(e=5){var i=[];for(let t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}getSpacedPoints(e=5){var i=[];for(let t=0;t<=e;t++)i.push(this.getPointAt(t/e));return i}getLength(){var t=this.getLengths();return t[t.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var i=[];let s,r=this.getPoint(0),n=0;i.push(0);for(let t=1;t<=e;t++)s=this.getPoint(t/e),n+=s.distanceTo(r),i.push(n),r=s;return this.cacheArcLengths=i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){var i=this.getLengths();let s=0;var r=i.length;let n,a=(n=e||t*i[r-1],0),h=r-1,o;for(;a<=h;)if((o=i[s=Math.floor(a+(h-a)/2)]-n)<0)a=s+1;else{if(!(0Number.EPSILON&&(a.normalize(),u=Math.acos(Qi(s[t-1].dot(s[t]),-1,1)),r[t].applyMatrix4(h.makeRotationAxis(a,u))),n[t].crossVectors(s[t],r[t]);if(!0===t){let e=Math.acos(Qi(r[0].dot(r[i]),-1,1));e/=i,0i;)s-=i;si.length-2?i.length-1:s+1],i=i[s>i.length-3?i.length-1:s+2];return e.set(q2(t,r.x,n.x,a.x,i.x),q2(t,r.y,n.y,a.y,i.y)),e}copy(i){super.copy(i),this.points=[];for(let t=0,e=i.points.length;t=n)return i=a[h]-n,r=(s=this.curves[h]).getLength(),s.getPointAt(0===r?0:1-i/r,e);h++}return null}getLength(){var t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;var i=[];let s=0;for(let t=0,e=this.curves.length;t80*l){e=s=h[0],i=r=h[1];for(let t=l;ts&&(s=n),a>r&&(r=a);t=0!==(t=Math.max(s-e,r-i))?32767/t:0}ww(f,d,l,e,i,t,0)}return d}};function gw(t,e,i,s,r){let n,a;if(r===0=e;n-=s)a=Ww(n,t[n],t[n+1],a);return a&&Uw(a,a.next)&&(jw(a),a=a.next),a}function _w(t,e){if(!t)return t;e=e||t;let i=t,s;do{if(s=!1,i.steiner||!Uw(i,i.next)&&0!==Ow(i.prev,i,i.next))i=i.next;else{if(jw(i),(i=e=i.prev)===i.next)break;s=!0}}while(s||i!==e);return e}function ww(s,r,n,a,h,o,l){if(s){!l&&o&&Lw(s,a,h,o);let t=s,e,i;for(;s.prev!==s.next;)if(e=s.prev,i=s.next,o?yw(s,a,h,o):Mw(s))r.push(e.i/n|0),r.push(s.i/n|0),r.push(i.i/n|0),jw(s),s=i.next,t=i.next;else if((s=i)===t){l?1===l?ww(s=Ew(_w(s),r,n),r,n,a,h,o,2):2===l&&xw(s,r,n,a,h,o):ww(_w(s),r,n,a,h,o,1);break}}}function Mw(t){var e=t.prev,i=t,t=t.next;if(0<=Ow(e,i,t))return!1;var s=e.x,r=i.x,n=t.x,a=e.y,h=i.y,o=t.y,l=s=l&&d.x<=c&&d.y>=u&&d.y<=f&&Pw(s,a,r,h,n,o,d.x,d.y)&&0<=Ow(d.prev,d,d.next))return!1;d=d.next}return!0}function yw(t,e,i,s){var r=t.prev,n=t,a=t.next;if(0<=Ow(r,n,a))return!1;var h=r.x,o=n.x,l=a.x,u=r.y,c=n.y,f=a.y,d=h=g&&M&&M.z<=_;){if(w.x>=d&&w.x<=p&&w.y>=v&&w.y<=m&&w!==r&&w!==a&&Pw(h,u,o,c,l,f,w.x,w.y)&&0<=Ow(w.prev,w,w.next))return!1;if(w=w.prevZ,M.x>=d&&M.x<=p&&M.y>=v&&M.y<=m&&M!==r&&M!==a&&Pw(h,u,o,c,l,f,M.x,M.y)&&0<=Ow(M.prev,M,M.next))return!1;M=M.nextZ}for(;w&&w.z>=g;){if(w.x>=d&&w.x<=p&&w.y>=v&&w.y<=m&&w!==r&&w!==a&&Pw(h,u,o,c,l,f,w.x,w.y)&&0<=Ow(w.prev,w,w.next))return!1;w=w.prevZ}for(;M&&M.z<=_;){if(M.x>=d&&M.x<=p&&M.y>=v&&M.y<=m&&M!==r&&M!==a&&Pw(h,u,o,c,l,f,M.x,M.y)&&0<=Ow(M.prev,M,M.next))return!1;M=M.nextZ}return!0}function Ew(t,e,i){let s=t;do{var r=s.prev,n=s.next.next;!Uw(r,n)&&Fw(r,s,s.next,n)&&Hw(r,n)&&Hw(n,r)&&(e.push(r.i/i|0),e.push(s.i/i|0),e.push(n.i/i|0),jw(s),jw(s.next),s=t=n),s=s.next}while(s!==t);return _w(s)}function xw(t,e,i,s,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){var h;if(a.i!==t.i&&Dw(a,t))return h=zw(a,t),a=_w(a,a.next),h=_w(h,h.next),ww(a,e,i,s,r,n,0),void ww(h,e,i,s,r,n,0);t=t.next}}while((a=a.next)!==t)}function bw(t,e,i,s){var r=[];let n,a,h,o,l;for(n=0,a=e.length;n=i.next.y&&i.next.y!==i.y){var h=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(h<=n&&h>s&&(s=h,r=i.x=i.x&&i.x>=l&&n!==i.x&&Pw(ar.x||i.x===r.x&&Rw(r,i)))&&(r=i,c=f),(i=i.next)!==o;);return r}function Rw(t,e){return Ow(t.prev,t,e.prev)<0&&Ow(e.next,t,t.next)<0}function Lw(t,e,i,s){let r=t;for(;0===r.z&&(r.z=Nw(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,(r=r.next)!==t;);r.prevZ.nextZ=null,r.prevZ=null,Cw(r)}function Cw(t){let e,i,s,r,n,a,h,o,l=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,s=i,h=0,e=0;e=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function kw(t){return 0n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),(i=i.next)!==t;);return s}function zw(t,e){var i=new Xw(t.i,t.x,t.y),s=new Xw(e.i,e.x,e.y),r=t.next,n=e.prev;return(t.next=e).prev=t,(i.next=r).prev=i,(s.next=i).prev=s,(n.next=s).prev=n,s}function Ww(t,e,i,s){t=new Xw(t,e,i);return s?(t.next=s.next,(t.prev=s).next.prev=t,s.next=t):(t.prev=t).next=t,t}function jw(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xw(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Yw(i,s,r,n){let a=0;for(let t=s,e=r-n;t{let s=[],U=void 0!==ht.curveSegments?ht.curveSegments:12,d=void 0!==ht.steps?ht.steps:1,i=void 0!==ht.depth?ht.depth:1,r=void 0===ht.bevelEnabled||ht.bevelEnabled,e=void 0!==ht.bevelThickness?ht.bevelThickness:.2,n=void 0!==ht.bevelSize?ht.bevelSize:e-.1,a=void 0!==ht.bevelOffset?ht.bevelOffset:0,v=void 0!==ht.bevelSegments?ht.bevelSegments:3,h=ht.extrudePath,F=void 0!==ht.UVGenerator?ht.UVGenerator:t3,o,l=!1,u,c,f,p,B=(h&&(o=h.getSpacedPoints(d),l=!0,r=!1,u=h.computeFrenetFrames(d,!1),c=new Gt,f=new Gt,p=new Gt),r||(v=0,e=0,n=0,a=0),t.extractPoints(U)),m=B.shape,g=B.holes,k=!Zw.isClockWise(m);if(k){m=m.reverse();for(let t=0,e=g.length;tNumber.EPSILON){var c=Math.sqrt(u),f=Math.sqrt(o*o+l*l),d=e.x-h/c,e=e.y+a/c,c=((i.x-l/f-d)*l-(i.y+o/f-e)*o)/(a*l-h*o),i=(s=d+a*c-t.x,r=e+h*c-t.y,s*s+r*r);if(i<=2)return new ct(s,r);n=Math.sqrt(i/2)}else{let t=!1;a>Number.EPSILON?o>Number.EPSILON&&(t=!0):a<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(h)===Math.sign(l)&&(t=!0),n=t?(s=-h,r=a,Math.sqrt(u)):(s=a,r=h,Math.sqrt(u/2))}return new ct(s/n,r/n)}var x=[];for(let t=0,e=w.length,i=e-1,s=t+1;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,i3).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class r3{constructor(){}static findNearNthPowerOfTwo(t){t-=1;return(t=(t=(t=(t=(t|=t>>1)|t>>2)|t>>4)|t>>8)|t>>16)<0?1:1+t}static polygonArea(e){if(e.length<3)return 0;let i=e.length;if(e[0].x===e[i-1].x&&e[0].y===e[i-1].y&&--i,i<3)return 0;let s=e[0].y*(e[i-1].x-e[1].x);for(let t=1;te.y:(s=(t.x-i.x)*(e.y-i.y)-(e.x-i.x)*(t.y-i.y))<0||!(0t.far||e.push({distance:i,point:u3.clone(),uv:io.getInterpolation(u3,m3,g3,_3,w3,M3,y3,new ct),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function x3(t,e,i,s,r,n){d3.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(v3.x=n*d3.x-r*d3.y,v3.y=r*d3.x+n*d3.y):v3.copy(d3),t.copy(e),t.x+=v3.x,t.y+=v3.y,t.applyMatrix4(p3)}class b3{constructor(t){this.wf=t,this.Qs=!0,this.Mf=new Map,this.yf={x:1,y:1,z:1},this.Ef=!0,this.Ts=null}get visible(){return this.Qs}set visible(t){this.Qs=t,this.Mf.forEach(t=>{t.xf()})}get show(){return this.Ef}set show(t){t!==this.Ef&&(this.Ef=t,this.bf({opacity:t?1:0,duration:1,finish:()=>{}}))}setFacadeNode(t){let e=t.FID;t.type===p.LABEL&&(e="label"+t.FID),this.Mf.set(e,t)}}Object.assign(b3.prototype,{Bu(t){var e;this.Ef=!this.wf.parent.Wt.Qa(this.wf),this.wf.Sf===o3.NORMAL&&(this.wf.Tf(),e=this.wf.parent.nt.Gt(this.wf.Ht),this.yf.z=e.isZoomLimit?.2:1),t.Zs&&(t.Ti===p.EXTERNAL_MODEL?(t.Zs.scale.x=this.yf.x,t.Zs.scale.y=this.yf.z,t.Zs.scale.z=this.yf.y):t.Ti===p.MODEL&&(t.Zs.scale.x=this.yf.x,t.Zs.scale.y=this.yf.y,t.Zs.scale.z=this.yf.z)),this.bf({opacity:this.Ef?1:0,duration:1,finish:()=>{}})},Af(n,a){if(a.scale.z!==this.yf.z||a.scale.y!==this.yf.y){let t=void 0!==a.duration?a.duration:.5;this.yf=a.scale,this.Mf.forEach(r=>{if((r.Ti===p.MODEL||r.Ti===p.EXTERNAL_MODEL)&&r.Zs){let e={x:r.Zs.scale.x,y:r.Zs.scale.y,z:r.Zs.scale.z},i={x:a.scale.x-e.x,y:a.scale.z-e.y,z:a.scale.y-e.z},s=(r.Ti===p.MODEL&&(i={x:a.scale.x-e.x,y:a.scale.y-e.y,z:a.scale.z-e.z}),new nn({src:[0],dest:[1]}));s.K(t).J(t=>{t=t.destination[0];r.Zs?(r.Zs.scale.x=i.x*t+e.x,r.Zs.scale.y=i.y*t+e.y,r.Zs.scale.z=i.z*t+e.z,n.enableUpdateRender()):n.ot.ht(s)}).$(()=>{n.ot.ht(s),a.finish&&a.finish()}),n.ot.lt(s.X())}})}},bf(r){this.Ts?this.Ts.finish():this.Ts=new nn,this.visible=!0;let i=this.wf.parent,n=[];if(this.Mf.forEach(s=>{s.Zs&&s.Zs.traverse(e=>{if(e.constructor===L){var i;s.Ti===p.MODEL&&(i=e.material.clone(),e.material.dispose(),e.material=i);let t=e.material;Array.isArray(t)||(t=[t]),s.Rf&&t.push(s.Rf.material),t.forEach(t=>{n.push({material:t,offset:r.opacity-t.opacity,opacity:t.opacity})})}})}),this.Ts.Y([0]).Z([1]).K(r.duration).J(t=>{var e=t.destination[0];for(let t=0;t{this.visible=this.Ef;for(let t=0;t1==t)){let t=!0;switch(e){case"sceneLoaded":this.jf[0]=1,t=1===this.jf[0],this.Xf=5;break;case"loaded":this.jf[1]=1,t=1===this.jf[1],this.Xf=85;break;case"externalFirstLoaded":this.jf[2]=1,this.jf[4]?this.Xf=100:t=!1;break;case"visibleLevelsLoaded":this.jf[3]=1,t=1===this.jf[3],this.Xf=55;break;case"firstViewLoaded":this.jf[4]=1,this.jf[2]?this.Xf=100:t=!1}t&&this.st.Yt.Xt({type:"progress",progressBar:this.Xf})}},mf(){if(this.nt&&!this.nt.Yf){if(this.nt.Ka&&0===this.Ua.length){let e=!0;if(this.Zf.nl.forEach(t=>{t.loadComplete||(e=!1)}),e=nt.environment==I.BROWSER&&window.fengmap.FMJSONLoader?window.fengmap.FMJSONLoader.getLoader()?.isAllLoadComplete:e)t:for(let t=0;t{this.mf()},50))}},Qf(t,a){if(this.Ls.tile&&!this.Ls.preLoad){let r=[],n=t.building;for(let t=0;t{if("floor"===t){var s=this.nt.nd(n.Ht);if(s.set(i.gid,!0),-1{var e=this.st.getBuildings();if(!1===this.st.rc)o=setTimeout(l,1);else{null!==o&&clearTimeout(o);var i=[];if(0{this.ud(s,t=>{var e=this.Zu.get(s.bid);e.theme.Bu(t),e.theme.themeID=s.themeID,s.themeExtension&&(e.themeExtension=new n3,e.themeExtension.Bu(s.themeExtension)),this.nt.Gt(s.bid).themeLoaded=!0,s.bid===this.Ls.buildingID&&(this.nt.fd(this.dd),this.st.setBackgroundColor(this.nt.backgroundColor,this.nt.backgroundAlpha),this.Ls.isPreview?this.dd.sc(this.st):this.od(t.buildings)),this.nt.ac=this.hc(),(this.nt.vd||this.nt.pd)&&(this.W(null,null,this.nt.vd,!1,this.nt.pd,this.nt.ac),this.nt.vd)&&(this.nt.vd=!1),i()})})},ud(t,i){if(t.theme)i(t.theme);else{let e="_loadTheme"+ws.generateUUID();this.Qh.Kh(e),h3.sh(this.Ls.themeURL,t.themeID,t=>{i&&i(t),this.Qh.Jh(e)},t=>{this.st.Yt.Xt({type:"info",InfoMode:t}),this.Qh.Jh(e)},t.contentVersion)}},md(t){var e,i=this.nt.Gt(t.Ht);i.buildingLoaded||(this.Ls.tile?this.Qa(t)?((e=T3(t,this)).buildings=null,e.isOutdoor=!1,this.gd(e)):i.sceneLoaded||this.Ls.tile&&((e=T3(t,this)).buildings=null,e.isOutdoor=!1,this._d(e)):((i=Object.assign({},this.Ls)).isOutdoor=!1,i.buildingID=t.dr,i.bid=t.Ht,i.buildings=null,this.wd(i)))},Md(t,e){let i=null;t=this.st.getBuilding(t.bid),e={type:"info",InfoMode:e,buildingID:i=t?t.Ht:i};this.st.js.error.push(e),this.st.Yt.Xt(e)},yd(t,e){let i=null;t.buildingID!==t.mapID&&(i=t.bid),this.Ed({bid:t.bid,levels:e.levels}),this.st.Yt.Xt({type:"sceneLoaded",buildingID:i}),this.st.Yt.Xt({type:"info",InfoMode:Cr.INFO,mapID:e.mid,buildingID:i})},wd(h){this.st.Or.zo(h,(t,n)=>{if(!(0{if(e.dr===n.mid){e.gr=n.levels,e.R=new sr(new Gt(n.minX,n.minY),new Gt(n.maxX,n.maxY));var t=this.nt.Gt(e.Ht),i=(t.buildingLoaded=!0,t.sceneLoaded=!0,this.nt.nd(e.Ht));for(let t=0;t{if(!(0{"building"===t?((i=this.st.getBuilding(r.bid)).gr=e.levels,i.R=new sr(new Gt(e.minX,e.minY),new Gt(e.maxX,e.maxY)),this.nt.Gt(i.Ht).sceneLoaded=!0,this.Ad(i,e),this.Sd(i,void 0)):"scene"===t&&this.yd(r,e)},(t,e)=>{let i=null;var s=this.st.getBuilding(r.bid);s&&(i=s.Ht),this.st.Yt.Xt({type:"info",InfoMode:e,buildingID:i})})},Gf(t){this.md(t)},Sd(t,e){var i=this.nt.Gt(t.Ht),s=i.loaded,r=i.visibleLevelsLoaded;this.Rd(t),!r&&i.visibleLevelsLoaded&&(this.nt.vd&&this.nt.ac?(this.W(null,e,!0,!0,!1,this.nt.ac),this.nt.vd=!1):this.W(null,e,!1,!0,!1,this.nt.ac),r={type:"visibleLevelsLoaded"},t!==this.st.jt&&(r.buildingID=t.Ht),this.st.Yt.Xt(r)),!s&&i.loaded&&(t!==this.st.jt?this.st.Yt.Xt({type:"buildingLoaded",buildingID:t.Ht}):this.st.Yt.Xt({type:"mapLoaded"})),this.nt.pd&&this.nt.ac&&this.W(null,e,!1,!1,!0,this.nt.ac)},hc(){let e=!0;for(let t=0;t=this.Cf))},Ld(t={}){this.Tf();var e=this.parent.nt.Gt(this.Ht);this.Of.Af(this.parent,{scale:{x:1,y:1,z:e.isZoomLimit?.2:1},duration:void 0!==t.duration?t.duration:1,finish:()=>{}})},kf(){if(this.P){var e=this.P.jt;for(let t=0;t{t!==this&&(t.Bf=!0,t.traverse(t=>{t.br({animate:!1})}))})}getFloors(){return this.Ft}}Object.assign(L3.prototype,{lt(t){(t.P=this).Ft.push(t)}});class C3{constructor(t=0,e=0,i=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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)}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){var i=t.x,s=t.y,t=t.z,r=e.x,n=e.y,e=e.z;return this.x=s*e-t*n,this.y=t*r-i*e,this.z=i*n-s*r,this}angleTo(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:(t=this.dot(t)/e,e=Math.max(-1,Math.min(1,t)),Math.acos(e))}normalize(){return this.divideScalar(this.length()||1)}divideScalar(t){return this.multiplyScalar(1/t)}}class N3{constructor(t){this.Ia=t.size,this.yi=t.center,this.Id=t.points}get size(){return this.Ia}get min(){return{x:this.yi.x-this.Ia.x/2,y:this.yi.y-this.Ia.y/2}}get max(){return{x:this.yi.x+this.Ia.x/2,y:this.yi.y+this.Ia.y/2}}get center(){return{x:this.yi.x,y:this.yi.y}}get points(){return this.Id}}class I3{constructor(t){this.Pd=[],this.Ia=null,this.Dd=[],this.Ae=void 0!==t.distance?t.distance:0,this.Od=void 0!==t.circleSegment?t.circleSegment:8,this.Ud=Math.PI/2/this.Od,this.Fd=void 0!==t.endCapStyle?t.endCapStyle:"circle",this.Bd=void 0!==t.isSingleSide&&t.isSingleSide}computeOffsetCurve(e){this.Dd=[];let i=null;var t,s,r=this.Ae,n="left";for(let t=2;t=n&&(a-=2*Math.PI),this.Dd.push(e),this.Jd(t,a,n,s,r),this.Dd.push(i)}Jd(e,i,t,s,r){var n=-1===s?-1:1,s=Math.abs(i-t),a=Math.trunc(s/this.Ud+.5);if(a<1)return null;var h=s/a;for(let t=0;tG.Se(t,e,e.length-1))):t=!0:t=r.every(t=>G.Se(t,e,e.length-1)),t){s=e;break}}}Zd(t,e,i,s){var r={p0:{x:null,y:null},p1:{x:null,y:null}},n=(this.kd({p0:t,p1:e},s,this.Ae,r),{p0:e,p1:i}),a={p0:{x:null,y:null},p1:{x:null,y:null}},n=(this.kd(n,s,this.Ae,a),this.Gd(t,e,i));0==n?this.Hd(r,a):-1==n&&"left"===s||1==n&&"right"===s?this.Vd(n,r,a,e):this.zd(n,r,a,e)}}class P3{constructor(){}static distance(t,e){return G.distance(t,e)}static isContain(t,e){return G.isPolygonContainPoint(t,e)}static inExtents(t){let s=!1;var e=t.type,r=t.point,i=t.level,n=t.map;let a=t.buildingID;a=a||n.getMapOptions().mapID,void 0===e&&p.EXTENT_LAYER;var h=n.getBuilding(a).getFloor(i).getLayers(p.EXTENT_LAYER)[0].children;for(let i=0;ii&&(i=e[t].x),e[t].y>s&&(s=e[t].y),e[t].xs&&(s=o),l>r&&(r=l)}var a=[(s+e)/2,(r+i)/2],u=h[0][0]*h[1][1]-h[1][0]*h[0][1],u=[[h[1][1]/u,-h[0][1]/u],[-h[1][0]/u,h[0][0]/u]],a=[u[0][0]*a[0]+u[0][1]*a[1],u[1][0]*a[0]+u[1][1]*a[1]],a=(t.center.x=a[0],t.center.y=a[1],t.size.x=s-e,t.size.y=r-i,[[e,i],[e,r],[s,r],[s,i]]),c=[[],[],[],[]],u=(c[0]=[u[0][0]*a[0][0]+u[0][1]*a[0][1],u[1][0]*a[0][0]+u[1][1]*a[0][1]],c[1]=[u[0][0]*a[1][0]+u[0][1]*a[1][1],u[1][0]*a[1][0]+u[1][1]*a[1][1]],c[2]=[u[0][0]*a[2][0]+u[0][1]*a[2][1],u[1][0]*a[2][0]+u[1][1]*a[2][1]],c[3]=[u[0][0]*a[3][0]+u[0][1]*a[3][1],u[1][0]*a[3][0]+u[1][1]*a[3][1]],new C3(1,0,0)),a=new C3(c[0][0],0,c[0][1]),a=new C3(c[3][0],0,c[3][1]).clone().sub(a).normalize(),f=a.angleTo(u)*G.de(),a=0e&&(e=_),w>r&&(r=w),g.push({x:_,y:w})}var M=(e-i=L[t];){var N=C[C.length-1],I=(C.pop(),L[N]*(0==C.length?t:t-C[C.length-1]-1));I>n&&(n=I,a=0==C.length?0:C[C.length-1]+1,h=t,o=e,l=e-L[N]+1)}C.push(t)}}var P=i+a*M,D=s+(o+1)*M,O=i+(h+1)*M,U=s+l*M,F=[[P,U],[P,D],[O,D],[O,U]];let u=0,c=2,f=Number.MAX_VALUE,d=-Number.MAX_VALUE;for(let t=0;td&&(c=t,d=F[t][0]*F[t][0]+F[t][1]*F[t][1]);m.corners=[{x:F[0][0],y:F[0][1]},{x:F[1][0],y:F[1][1]},{x:F[2][0],y:F[2][1]},{x:F[3][0],y:F[3][1]}],m.center.x=(F[c][0]+F[u][0])/2,m.center.y=(F[c][1]+F[u][1])/2;var P=new C3(F[u][0],0,F[u][1]),D=new C3(F[(u+c)/2][0],0,F[(u+c)/2][1]),O=D.clone().sub(P).normalize(),U=(O.angleTo(p),G.de(),O.clone().cross(p).y,new C3(F[(u+c)/2][0],0,F[(u+c)/2][1])),B=new C3(F[c][0],0,F[c][1]),k=B.clone().sub(U).normalize();return k.angleTo(p),G.de(),k.clone().cross(p).y,O.clone().cross(k).y<0?(m.size.x=D.clone().sub(P).length(),m.size.y=B.clone().sub(U).length()):(m.size.x=B.clone().sub(U).length(),m.size.y=D.clone().sub(P).length()),new N3({center:m.center,size:m.size,points:m.corners})}}static angle(t){var e=new C3(0,0,1),i=new C3(t.start.x,0,t.start.y),t=new C3(t.end.x,0,t.end.y).clone().sub(i).normalize(),i=t.angleTo(e)*G.de();return t.clone().cross(e).y<0?i:360-i}static intersection(t,e){var i={x:null,y:null};return 2<=t.length&&2<=e.length&&G.De(t[0],t[1],e[0],e[1],i),i}static lineBufferBuilder(e,i){var s={points:[],holes:[]};if(void 0!==i.distance&&0!=i.distance){var r=i.distance,n=(i.endCapStyle=void 0!==i.endCapStyle?i.endCapStyle:"circle",i.circleSegment=void 0!==i.circleSegment?i.circleSegment:8,null!=i.isSingleSide&&i.isSingleSide),a=e[e.length-1].x==e[0].x&&e[e.length-1].y==e[0].y;if(!(a&&e.length<4)){let t=!1;i=new I3(i);a&&(t=i.isCCW(e)),n?a?0{e=!P3.isContain(t.coordinates[0],this.st.I0())}),!!e}},Qa(t){return!1!==t.visible&&(t.overviewMode===o3.INDOOR||(t.overviewMode!==o3.OUTDOOR||this.nt.bs===t.buildingID)&&(this.nt.bs!==this.st.Ls.buildingID?this.nt.bs===t.Ht:t===this.st.jt||!!this.st.P0(t)&&!!this.st.D0()))},xd(t){var e=new L3({bid:this.Ls.buildingID,mid:this.Ls.mapID,height:t.height,scaleLevel:t.scaleLevel,name:t.mname,levels:t.levels,x:t.x,y:t.y,groundLevel:this.Ls.groundLevel,bounds:new sr(new Gt(t.minX,t.minY),new Gt(t.maxX,t.maxY))});return this.st.lt(e),this.st.jt=e,this.st.t=t.x,this.st.o=t.y,e},Td(i){var e=this.nt.Gt(i.bid);if(!e.visibleLevels||0===e.visibleLevels.length){var s=[];for(let e=0;eString(t.bcode)===String(e));return t?t.buildingID:null}}),Object.assign(t.prototype,{U0(){this.st.traverse(t=>{t.traverse(t=>{t=t.getLayers(p.LABEL_LAYER)[0];t&&t.traverse(t=>{this.nt.F0===R3.FID?t.text=t.qs.fid:this.nt.F0===R3.ENAME?t.text=t.qs.ename:t.text=t.qs.name})})})},B0(t){let e=0;return e=this.st.ct.isPerspectiveCamera?t/(this.st.bt.renderer.domElement.clientHeight/(2*Math.tan(this.st.ct.fov*u.DEG2RAD/2))):t*Math.abs(this.st.ct.top-this.st.ct.bottom)/this.st.ct.zoom/this.st.bt.renderer.domElement.clientHeight,e=isNaN(e)?1:e},k0(t,e){var i;return this.st.ct.isPerspectiveCamera?(i=new Ht,t.updateMatrixWorld(),this.st.Ps.updateMatrixWorld(),i.multiplyMatrices(this.st.Ps.matrixWorldInverse,t.matrixWorld),t=(new Gt).applyMatrix4(i),this.B0(e)*Math.abs(t.z)):this.B0(e)}}),Object.assign(t.prototype,{G0(t){null!==this.H0&&(clearTimeout(this.H0),this.H0=null),this.H0=setTimeout(()=>{this.V0({changeScopeTypes:t.changeScopeTypes,fids:t.fids,succCallback:t.succCallback})},t.time||0)},V0(t={}){let{changeScopeTypes:e,fids:i}=t,s=(e=e||[p.EXTENT,p.MODEL,p.LABEL,p.FACILITY,p.EXTERNAL_MODEL],i=i||[],[]),r=()=>{if(s.length<=0)this.st.off("update",r),t.succCallback&&t.succCallback();else{let e=0;for(let t=0;t{t.traverse(t=>{t.parent.visibleLevels.includes(t.level)&&t.traverse(t=>{t.traverse(t=>{(!(0=t.qs.minlevel&&e{var t;this.Ls.tile?((t=Object.assign({},this.Ls,{level:e.level,visibleLevels:e.visibleLevels})).bid=t.buildingID,this.gd(t)):this.wd(this.Ls)})},Oa(r=!1,t){if(this.nt.Y0&&this.Z0&&(nt.environment!==I.WX||1!=this.st.bt.Ns||this.st.bt.ha%2==0)){this.Ua=[];var n=t||this.st.getZoom(),e=this.Ls.tile&&!this.Ls.preLoad;for(let s=0;s{var i=[],t=e.getFloor(e.level),s=(t&&i.push(t),e.visibleLevels);for(let t=0;t=d.qs.maxlevel||n{t.type!==p.MODEL_LAYER&&t.type!==p.EXTERNAL_MODEL_LAYER&&t.type!==p.LABEL_LAYER||t.traverse(i=>{this.st.traverse(e=>{if(e!==this.st.jt)for(let t=0;tthis.Jt+this.i0)&&(e=!0),e="inside"===this.r0?!e:e},Se(e){let i=!1;for(let t=0;t{"Mesh"!==t.type&&"SkinnedMesh"!==t.type||(t.material.maskNodeHeight=this.hr.height)})},sv(i,e){if(e===p.FACILITY_LAYER||e===p.LABEL_LAYER)for(let e=0;ethis.Jt+this.i0)&&(t.c0=!1),t.c0&&0===this.Kr?t.visible=!1:(t.m0=0,t.g0=this.Jt,t._0=this.i0,t.y0=this.Kr,"outside"===this.r0&&(t.m0=1),t.Zs?t.Pr():t.type===p.LABEL&&this.n0.push(t))},V(){var t;this.st.Wt.nt.Gt(this.h0).loaded&&(t=this.hr.getLayers(p.EXTENT_LAYER)[0],this.mi=t.bound,this.Bu(),this.st.off("update",this.V))},o0(){let e=0;for(let t=0;t{i.Zs&&o.bt.Na(i.Zs,t.destination[0]),o.enableUpdateRender()}).$(()=>{if(!(h>n)){let t=a;0{r.Zs&&(r.Zs.position.y=t.destination[0]),a.enableUpdateRender()}).$(()=>{if((i+=.5){e.mi.expand(t.bound)}),e.needUpdateBound=!1),e.mi.clone()}class z3 extends ih{constructor(){super(),this.xa=new U3,this.nr=!0}get scene(){return this.xa}get bound(){return V3(this)}get isLayer(){return!0}get visible(){return super.visible}set visible(t){(super.visible=t)?this.xa.parent||this.parent.effectScene.add(this.xa):this.xa.parent&&this.parent.effectScene.remove(this.xa)}init(){this.xa.position.y=this.parent.Jt}}class W3 extends z3{constructor(t){super(),this.fv=[],void 0!==t&&void 0!==t.type&&(this.Ti=t.type)}getMarkers(){return this.Ft}add(t){t.P=this,t.dv||t.Bu()?this.hh(t):this.fv.push(t),this.needUpdateBound=!0}remove(t){this.vv(t),t.dispose();var e=this.Ft.indexOf(t),e=(-1{this.Cv()}},Cv(){this.xa.remove(this.yv),this.xa.remove(this.Mv),this.xa.remove(this.Ev),this.Lv.Qt()}});class J3 extends W3{constructor(){super(),this.Ti=p.HEAT_MAP_MARKER,this.Nv=!1,this.Iv=this.Iv.bind(this)}add(t){super.add(t),t.dv&&!t.Pv&&this.Dv(t.Ov,t),0{e.xa.environment=t,i.enableUpdateRender()})}function tM(t,e,i){var s=new Ih(200,200,1,1),r=new so({color:"#38382f",side:2}),s=new L(s,r);return void 0!==t&&(s.rotation.y=t),s.position.set(e.x,e.y,e.z),i.parent.xa.add(s),s}Object.assign(J3.prototype,{pv(){for(var t of this.fv){var e;t.Bu()&&(-1<(e=this.fv.indexOf(t))&&this.fv.splice(e,1),this.hh(t),t.Pv||this.Dv(t.Ov,t),t.needUpdateBound=!0)}},Dv(i,t){var e=this.ur(m);let s=this.ur(E),r=t.Uv;var n,a,h=e.getLayers(p.EXTENT_LAYER)[0].children;if(null!==i)for(let t=0;t{var t=e.Zs?.parent;t&&t.remove(e.Zs),super.remove(e)}}):((t=e.Zs?.parent)&&t.remove(e.Zs),super.remove(e))}}Object.assign(eM.prototype,{Av(){var t=this.ur(E);this.Lv=new q3(t).createLight(this,"FMDynamicModelLayer")},Rv(){this.xa.add(this.yv),this.xa.add(this.Mv),this.xa.add(this.Ev),this.xa.add(this.Ki),this.xa.removeLight=()=>{this.Cv()}},Cv(){this.xa.remove(this.yv),this.xa.remove(this.Mv),this.xa.remove(this.Ev),this.Lv.Qt()}});class iM extends W3{constructor(){super(),this.Ti=p.LINE_MARKER}getBelongedBuildingID(){}init(){super.init(),this.xa.position.y=0}}class sM extends W3{constructor(){super(),this.Ti=p.LOCATION_MARKER}init(){super.init(),this.xa.position.y=0}}class rM extends W3{constructor(){super(),this.Ti=p.DOM_MARKER}init(){}add(t){this.Ft.push(t),this.needUpdateBound=!0}remove(t){t=this.Ft.indexOf(t);-1{t.geometry&&t.geometry.dispose(),t.geometry=void 0,t.material=void 0,t.mapNode=void 0}):(t.Zs.geometry.dispose(),t.Zs.geometry=void 0,t.Zs.material=void 0,t.Zs.mapNode=void 0),t.Zs=void 0)}class oM extends ih{constructor(t){super(t),this.Wv=void 0,this.c0=!1,this.f0=[],this.d0=[],this.m0=0,this.g0=void 0,this._0=void 0,this.w0=null,this.M0=null,this.$d=null,this.y0=null,this.av=0,this.ar=!0}get isbloom(){return this.Wv}set isbloom(t){this.Wv=t}get ID(){return this.qs.Ht}get level(){return this.P.P.Ar}get x(){return this.bound.center.x}get y(){return this.bound.center.y}get height(){return this.qs.height}get bound(){return!0===this.tr&&(this.qs.mi=null,this.mi=this.qs.getBound(),this.tr=!1),this.mi.clone()}get boundNoClone(){return 1==this.tr&&(this.qs.mi=null,this.mi=this.qs.getBound(),this.tr=!1),this.mi}get zoomRange(){return{maxLevel:this.qs.maxlevel,minLevel:this.qs.minlevel}}get visible(){return this.Qs}set visible(t){this.Qs=t,this.xf()}getData(){var t=this.qs;return{ID:t.Ht,typeID:t.type,FID:t.fid,height:t.height,name:t.name,eName:t.ename,minLevel:t.minlevel,maxLevel:t.maxlevel}}getBound(){var t=this.bound;return{maxY:t.max.y,maxX:t.max.x,minX:t.min.x,minY:t.min.y}}getRenderNode(){return this.Zs}dispose(){this.Q0(),this.st=null,super.dispose()}}function lM(t,e){var i=[];for(let t=0;t{var e=new Gt(t.x,t.y,t.z);e.applyMatrix4(s),t.x=e.x,t.y=e.y,t.z=e.z}),1/0),n=-1/0,a=1/0,h=-1/0;return i.forEach(t=>{r=Math.min(r,t.x),n=Math.max(n,t.x),a=Math.min(a,t.z),h=Math.max(h,t.z)}),i.map(t=>({u:(t.x-r)/(n-r),v:(t.z-a)/(h-a)}))}Object.assign(oM.prototype,{xf(){(this.Ti===p.LABEL||this.Ti===p.FACILITY?nM:aM)(this)},Q0(){hM(this)},jv(t){function e(t){let e="";if(!(t.length<=2)){var i=(t=>{let e=[],i=0;for(;i{let i=e;for(;i= point.y) || (p2.y < point.y && p1.y >= point.y)) && (p1.x <= point.x || p2.x <= point.x)) {\n")+" if (p1.x + (point.y - p1.y) / (p2.y - p1.y) * (p2.x - p1.x) < point.x) {\n"+" oddNodes = !oddNodes;\n")+" }\n"+" }\n")+"}\n"+"if (oddNodes) {\n")+" return oddNodes;\n"+"}\n"}e+="return oddNodes;\n"}return e}t.maskParam=e(t.maskPolygons),t.maskHoleParam=e(t.maskHolePogygons)}});class uM extends oM{constructor(t){super(),this.qs=t,this.Jt=t.height,this.Ti=p.EXTENT,this.X0=null,this.Xv=null,this.Zs=null,this.Yv=0,this.Zv=0,this.Fv=!1,this.Bv=null,this.kv=null,this.Gv=null,this.N0=null}get FID(){return this.qs.fid}get zoomRange(){}getData(){var t=this.qs;return{ID:t.Ht,height:t.height,area:t.area,FID:t.fid}}getArea(){return P3.area(this.qs.Ai[0])}get coordinates(){return this.qs.Ai}}Object.assign(uM.prototype,{Bu(){if(!this.Zs&&1!==this.Yv){let r=this.ur(E);if(r){let s=this.ur(sh);var t=r.Wt,e=r.nt.qv?t.Kv:t.Jv;this.Yv=1,e.bind(t)({type:this.type,data:this.qs,amount:this.Jt}).then(t=>{this.Yv=2,this.fd(t.geometry),this.$v=s===r.jt&&1!==r.children.length&&1===r.jt.Ft.length,this.Qv=s!==r.jt;var e=this.E0(r,s.Ht,this),i=(this.Qv&&(e.polygonOffset=!0,e.polygonOffsetFactor=1,e.polygonOffsetUnits=1),this.$v&&(e.stencilWrite=!0,e.stencilRef=1,e.stencilFunc=Di,e.stencilFail=Pi,e.stencilZFail=Pi,e.stencilZPass=Pi),this.qs.getBound());this.Zs=new L(t.geometry,e),this.Zs.rotation.set(-Math.PI/2,0,0,"XYZ"),this.Zs.position.set(i.center.x-r.t,-this.Jt,r.o-i.center.y),this.Zs.receiveShadow=!0,this.Zs.visible=this.Qs,(this.Zs.mapNode=this).P.xa.add(this.Zs)})}}},fd(t){var e=this.ur(E),i=this.ur(sh);this.X0=e.Wt.dd.Ku({fid:this.qs.fid??"0",typeID:this.qs.type+"",bid:i.Ht}),0===this.Zv&&(this.X0.image?this.Xv=e.Wt.zf(this.X0,"logoPath",i.buildingID)+this.X0.image:this.Xv=null,this.X0.offset&&(e=this.X0.offset.split(","),this.t1=[-parseFloat(e[0]),-parseFloat(e[1])]),this.X0.center?(i=this.X0.center.split(","),this.yi=[parseFloat(i[0]),parseFloat(i[1])]):this.yi=[.5,.5],this.X0.sizes&&(e=this.X0.sizes.split(","),this.e1=[1/parseFloat(e[0]),1/parseFloat(e[1])]),this.X0.angle)&&(i=t??this.Zs.geometry,e=lM(Number(this.X0.angle),i.attributes.position),t=new Float32Array(e.flatMap(t=>[t.u,t.v])),i.setAttribute("uv",new N(t,2)))},z0(t,e){this.Zs&&(this.fd(),this.Pr())},i1(t){t!==this.Xv&&(this.Zv=1,this.Xv=t,this.Pr())},Pr(){var t,e;this.Zs&&(t=this.ur(E))&&(e=this.ur(sh),this.Zs.material=this.E0(t,e.Ht,this),t.enableUpdateRender())},E0(t,e,i){var s=this.ur(m),e={color:this.X0.color,alpha:this.X0.alpha*s.Kr,buildingID:e,isIgnoreLighting:Kr(),stencilWrite:this.$v,polygonOffset:this.Qv};void 0!==this.ir&&(e.alpha=this.ir),this.c0&&(e.isMask=this.c0,e.maskType=this.m0,e.maskPolygons=this.f0,e.maskHolePogygons=this.d0,e.maskHeight=this.g0,e.maskExtrudeHeight=this._0,e.boundCenter=this.w0,e.boundSize=this.M0,e.level=s.level,e.maskID=this.$d,e.maskOpacity=this.y0,e.maskNodeHeight=this.av),this.Xv&&(e.url=this.Xv,e.finish=()=>{t.enableUpdateRender(),0===this.Zv&&(this.t1&&i.Zs.material.map.offset.set(this.t1[0],this.t1[1]),this.e1&&i.Zs.material.map.repeat.set(this.e1[0],this.e1[1]),this.yi&&i.Zs.material.map.center.set(this.yi[0],this.yi[1]),i.Zs.material.map.needsUpdate=!0)});let r=t.Wt.pl.Jl(e);return this.jv(r),this.Fv&&((r=r.clone()).mapMixColor=this.Fv,r.heatCenter=this.Bv,r.heatSize=this.kv,r.map=this.Gv,r.map.needsUpdate=!0),r.polygonOffset=!0,r.polygonOffsetFactor=1,r.polygonOffsetUnits=4,r.userData.opacity=r.opacity,r},xf(){var t=this.ur(E);t&&(this.Zs&&(this.Zs.visible=this.Qs),t.enableUpdateNode(),t.enableUpdateRender())},updateMaterialByThemeTool(t){this.X0=t,this.Pr()}});let cM=new sr;class fM extends qg{constructor(t,e=16776960){var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new Ch;r.setIndex(new N(i,1)),r.setAttribute("position",new N(s,3)),super(r,new _m({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){var e,i,s;void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&cM.setFromObject(this.object),cM.isEmpty()||(t=cM.min,e=cM.max,(s=(i=this.geometry.attributes.position).array)[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere())}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class dM{constructor(t,e,i=null,s=e.blendMode){this.s1=t,this.n1=e,this.a1=i,this.blendMode=s;var r=e.tracks,n=r.length,a=new Array(n),h={endingStart:ci,endingEnd:ci};for(let t=0;t!==n;++t){var o=r[t].createInterpolant(null);(a[t]=o).settings=h}this.h1=h,this.o1=a,this.l1=new Array(n),this.u1=null,this.c1=null,this.f1=null,this.d1=null,this.loop=ai,this.m1=-1,this.g1=null,this.time=0,this.timeScale=1,this._1=1,this.weight=1,this.w1=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this.s1.M1(this),this}stop(){return this.s1.E1(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this.m1=-1,this.g1=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this.g1&&this.s1.b1(this)}isScheduled(){return this.s1.b1(this)}startAt(t){return this.g1=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this.w1=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this.w1}fadeIn(t){return this.S1(t,0,1)}fadeOut(t){return this.S1(t,1,0)}crossFadeFrom(t,e,i){var s,r;return t.fadeOut(e),this.fadeIn(e),i&&(r=(i=this.n1.duration)/(s=t.n1.duration),t.warp(1,s/i,e),this.warp(r,1,e)),this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){var t=this.d1;return null!==t&&(this.d1=null,this.s1.T1(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._1=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._1}setDuration(t){return this.timeScale=this.n1.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._1,0,t)}warp(t,e,i){var s=this.s1,r=s.time,n=this.timeScale;let a=this.f1;null===a&&(a=s.A1(),this.f1=a);var s=a.parameterPositions,h=a.sampleValues;return s[0]=r,s[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){var t=this.f1;return null!==t&&(this.f1=null,this.s1.T1(t)),this}getMixer(){return this.s1}getClip(){return this.n1}getRoot(){return this.a1||this.s1.Mh}V(t,e,i,s){if(this.enabled){var r=this.g1,n=(null!==r&&(e=(r=(t-r)*i)<0||0===i?0:(this.g1=null,i*r)),e*=this.R1(t),this.L1(e)),a=this.C1(t);if(0i.parameterPositions[1])&&(this.stopFading(),0===s)&&(this.enabled=!1),this.w1=e}R1(t){let e=0;var i,s;return this.paused||(e=this.timeScale,null!==(i=this.f1)&&(s=i.evaluate(t)[0],e*=s,t>i.parameterPositions[1])&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)),this._1=e}L1(t){var e=this.n1.duration,i=this.loop;let s=this.time+t,r=this.m1;var n,a=i===hi;if(0===t)return-1!==r&&a&&1==(1&r)?e-s:s;if(i===ni){-1===r&&(this.m1=0,this.N1(!0,!0,!1));t:{if(s>=e)s=e;else{if(!(s<0)){this.time=s;break t}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this.s1.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else if(-1===r&&(0<=t?(r=0,this.N1(!0,0===this.repetitions,a)):this.N1(0===this.repetitions,!0,a)),s>=e||s<0?(i=Math.floor(s/e),s-=e*i,r+=Math.abs(i),(n=this.repetitions-r)<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=0this.action.playInfo.count&&(this.action.playInfo.param=0),this.resume())}get feature(){return this.mp}play(t){null==t&&(t=this.B),this.yp=t,this.stop(),this.mp.pf=!1,this.mp.xp(),this.st.ot.Ks(this.Ep);var e=this.action,t=Math.abs((this.end-this.start)/(60*t));e.playInfo={action:e,stepLong:t,once:this.Mp,beginTime:(new Date).getTime()},this.st.ot.$s(this.Ep)}pause(){this.st.ot.Ks(this.Ep),this.st.enableUpdateRender()}resume(){this.action.playInfo&&void 0!==this.action.playInfo.playTimelong&&(this.end,this.start,this.action.playInfo.beginTime=(new Date).getTime()-this.action.playInfo.playTimelong,this.st.ot.$s(this.Ep))}stop(){this.action.stop(),this.st.ot.Ks(this.Ep),this.st.enableUpdateRender()}}Object.assign(gM.prototype,{Ep(){var e=this.action.getClip().tracks[0].times,i=(void 0===this.action.playInfo.param&&(this.action.playInfo.param=this.start),this.action.playInfo.param);let t=!1;if(this.end>this.start?i>this.end&&(t=!0):i{let i=t.getClip(),s=i.duration*e,r=i.tracks[0].times,n=r.length-1;for(let t=0;t{var l,u,st,c,rt;t.exports=(l=function(t){return t.reduce(function(t,e){return 2*t+e},0)},u=function(t){for(var e=[],i=7;0<=i;i--)e.push(!!(t&1<=this.data.length)throw new Error("Attempted to read past end of stream.");return t instanceof Uint8Array?t[this.pos++]:255&t.charCodeAt(this.pos++)},this.readBytes=function(t){for(var e=[],i=0;i{for(var e=0,i=0;i>3)&1<<(7&r)&&(e|=1<a.max_width?a.max_width/r.width:1;return t},D=!(d=function(){var t;(u=parseInt(u,10))>R.length-1&&(u=0),t=L[u=u<0?0:u],g.getContext("2d").putImageData(R[u].data,t.x,t.y),p.globalCompositeOperation="copy",p.drawImage(g,0,0)}),O=!(l=function(){var t;(o=T)&&(X(1),t=(t=10*R[u].delay)||100,0===j()?(t+=q,setTimeout(W,t)):setTimeout(l,t))});return{play:I.play,pause:I.pause,move_relative:I.move_relative,move_to:I.move_to,get_playing:function(){return T},get_canvas:function(){return v},get_canvas_scale:function(){return P()},get_loading:function(){return _},get_auto_play:function(){return a.auto_play},get_length:function(){return I.length()},get_frames:function(){return R},get_duration:z,get_duration_ms:function(){return 10*z()},get_current_frame:function(){return I.current_frame()},load_url:function(t,e){V(e)&&((e=new XMLHttpRequest).open("GET",t,!0),"overrideMimeType"in e?e.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in e?e.responseType="arraybuffer":e.setRequestHeader("Accept-Charset","x-user-defined"),e.onloadstart=function(){D||H()},e.onload=function(t){200!=this.status&&n("xhr - response"),"response"in this||(this.response=new VBArray(this.responseText).toArray().map(String.fromCharCode).join(""));var e=this.response;0{this.Cp(t)})}dispose(t){this.st.off("update",this.V),t&&t()}stop(){this.st.off("update",this.V)}}Object.assign(yM.prototype,{Lp(e){var t=this.eh.externalModel.getRenderNode();t.renderOrder=1,this.eh.externalModel.Np?t.traverse(t=>{"Mesh"===t.type&&(t.renderOrder=1,e(t))}):e(t)},Cp(s){let r=this,n=0,a=null;Array.isArray(s.material)?(this.bp[s.name]=[],function i(){n{r.bp[s.name].push(s.material[n].clone()),e&&(s.material[n].dispose(),s.material[n]=t),n++,a=setTimeout(i,0)}):(null!==a&&clearTimeout(a),r.O=(new Date).getTime(),r.st.on("update",r.V))}()):this.Pr(s.material,(t,e)=>{this.bp[s.name]=s.material.clone(),e&&(s.material.dispose(),s.material=t),this.O=(new Date).getTime(),this.st.on("update",r.V)})},Pr(t,e){let i=null;var s;t&&(this.eh.externalModel.Np?t.uniforms&&t.uniforms.map&&t.uniforms.map.value?i=t.uniforms.map.value.name:t.map&&(i=""+t.map.name):t.map&&(i=""+t.map.name).indexOf(".gif")<0&&(i=t.name)),(null===i||!this.eh.parent.Ip||!this.eh.parent.Ip[i])&&null!==i&&0<=i.indexOf(".gif")?(t=(t=i.split("."))[0]+"."+t[1],(s=this.Sp[t])?s.canvasArray&&0{e(t,!0)})):e(null,!1)},Pp(t,i,s){var r=document.createElement("div");r.style.display="none",document.body.appendChild(r);let n=new Image;n.crossOrigin="Anonymous",n.onload=()=>{s&&((t=document.createElement("canvas")).width=this.Ap,t.height=this.Jt,t.getContext("2d").drawImage(n,0,0,this.Ap,this.Jt),t=new X0(t),this.eh.externalModel.Np&&(t.flipY=!1),t.repeat.set(1,1),t.magFilter=V,t.minFilter=ie,(t=new so({map:t})).transparent=!0,t.isBasic=!0,t.gifname=i,s(t)),this.Sp[i]={canvascount:0,canvasArray:[]},r.appendChild(n);var t,e=new MM({gif:n});e.load(()=>{this.Dp(e,i,r)})},n.src=t},Dp(s,r,t){let n=this,a=null,e=s.get_length(),h=1;this.Sp[r].canvascount=0,function i(){if(h>e)document.body.removeChild(t),null!==a&&clearTimeout(a);else{s.move_to(h);let t=document.createElement("canvas"),e=(t.width=n.Ap,t.height=n.Jt,t.getContext("2d"));e.drawImage(s.get_canvas(),0,0,n.Ap,n.Jt),n.Sp[r].canvasArray.push(t),h++,a=setTimeout(i,0)}}()},Op(t,e){t=t.split("."),t=t[0]+"."+t[1];this.Sp[t]&&(this.Sp[t].canvasArray.length=0,this.Sp[t].canvascount=0),this.Pp(e,t),this.V(),this.Rp||(this.Rp=!0,this.st.on("update",this.V))},Xo(t){var e=t.split("."),e=e[0]+"."+e[1];this.Op(t,this.Xv+e)},V(){var t=(new Date).getTime();let e=t-this.O,r=(50<=e&&(this.O=t),t=>{50<=e&&t&&(t.canvascount{if(Array.isArray(s.material)){var t,e=s.material;for(let i=0;i{e&&(s.material[i].dispose(),s.material[i]=t)}):((t=this.Sp[e[i].gifname])&&t.canvasArray[t.canvascount]&&(s.material.isupdate?this.Pr(this.bp[s.name][i],(t,e)=>{e&&(s.material[i].dispose(),s.material[i]=t)}):(s.material[i].map.image=t.canvasArray[t.canvascount],s.material[i].map.needsUpdate=!0)),r(t))}else{var i;s.material.isBasic&&!s.material.isupdate?((i=this.Sp[s.material.gifname])&&i.canvasArray[i.canvascount]&&(s.material.isupdate?this.Pr(this.bp[s.name],(t,e)=>{e&&(s.material.dispose(),s.material=t)}):(s.material.map.image=i.canvasArray[i.canvascount],s.material.map.needsUpdate=!0)),r(i)):this.Pr(this.bp[s.name],(t,e)=>{e&&(s.material.dispose(),s.material=t)})}}),this.st.enableUpdateRender())}});class EM extends c{constructor(e,t,i,s,r,n,a,h,o){super(e,t,i,s,r,n,a,h,o),this.isVideoTexture=!0,this.minFilter=void 0!==n?n:V,this.magFilter=void 0!==r?r:V,this.generateMipmaps=!1;let l=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){l.needsUpdate=!0,e.requestVideoFrameCallback(t)})}clone(){return new this.constructor(this.image).copy(this)}update(){var t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class xM{constructor(t){this.eh=t,this.Up=t.externalModel,this.st=this.eh.map,this.Fp=[],this.Bp=null,this.kp={},this.Gp=null,this.Rp=!1,this.oldmaterial={},this.Xv=null,this.Hp={},this.V=this.V.bind(this)}get isAdded(){return this.Rp}add(t){null===this.Xv&&(this.Xv=t),this.Lp(t=>{this.Cp(t)}),this.st.on("update",this.V)}dispose(){for(let t=0;t{"Mesh"===t.type&&e(t)}):e(t)},Cp(s){let r=this,n=s.material,a=0,h=null;Array.isArray(n)?(this.oldmaterial[s.name]=[],function i(){a{r.oldmaterial[s.name].push(n[a].clone()),e&&(s.material[a].dispose(),s.material[a]=t),a++,h=setTimeout(i,0)}):null!==h&&clearTimeout(h)}()):this.Pr(n,(t,e)=>{this.oldmaterial[s.name]=n.clone(),e&&(s.material.dispose(),s.material=t)})},Pr(i,s){let r=null;if(i&&(this.Up.Np?i.uniforms&&i.uniforms.map&&i.uniforms.map.value?r=i.uniforms.map.value.name:i.map&&(r=""+i.map.name):i.map&&(r=""+i.map.name).indexOf(".mp4")<0&&r.indexOf(".webm")<0&&r.indexOf(".ogg")<0&&(r=i.name)),null!==r&&this.eh.parent.Ip&&this.eh.parent.Ip[r])s(null,!1);else if(null!==r&&(0<=r.indexOf(".mp4")||0<=r.indexOf(".webm")||0<=r.indexOf(".ogg"))){let e=r.split("."),t=this.Hp[r];(t=t||this.kp[e[0]+"."+e[1]])?((i=new so({map:t.clone()})).isBasic=!0,s&&s(i,!0)):this.Vp(this.Xv+e[0]+"."+e[1],t=>{t.name=r,this.kp[e[0]+"."+e[1]]=t;t=new so({map:t.clone()});t.isBasic=!0,s(t,!0)})}else s(null,!1)},Vp(t,i){let s=this,r=(this.Gp=t,null);var e=document.createElement("div");e.style.display="none";let n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)});this.Bp=n+"_div",this.Fp.push(this.Bp),e.setAttribute("id",this.Bp),e.innerHTML='',document.body.appendChild(e),function t(){let e=document.getElementById(n);e?(null!==r&&clearTimeout(r),e.addEventListener("loadeddata",()=>{var t=new EM(e);t.video_id=n+"_div",s.Up.Np&&(t.flipY=!1),i&&i(t),e.play()})):r=setTimeout(t,0)}()},zp(s){this.eh.externalModel.getRenderNode()&&this.Lp(i=>{var t=i.material;if(Array.isArray(t))for(let e=0;e{t&&t.map&&t.map.name===s&&(i.material[e].dispose(),i.material[e]=t)});else this.Pr(this.oldmaterial[i.name],t=>{t&&t.map&&t.map.name===s&&(i.material.dispose(),i.material=t)})})},Xo(t){var e;this.Hp[t]&&(e=this.Hp[t].video_id,null!==document.getElementById(e)&&document.getElementById(e).parentNode.removeChild(document.getElementById(e)),this.Hp[t].dispose(),this.Hp[t]=void 0,this.zp(t))},Op(e,t){this.Vp(t,t=>{this.Hp[e]&&this.Xo(e),t.name=e,this.Hp[e]=t,this.zp(e)}),this.Rp||(this.Rp=!0,this.st.on("update",this.V))},V(){this.eh.externalModel.getRenderNode()&&(this.Lp(i=>{var t=i.material;if(Array.isArray(t))for(let e=0;e{t&&(i.material[e].dispose(),i.material[e]=t)});else t.isBasic?t.isupdate&&this.Pr(this.oldmaterial[i.name],t=>{t&&(i.material.dispose(),i.material=t)}):this.Pr(this.oldmaterial[i.name],t=>{t&&(i.material.dispose(),i.material=t)})}),this.st.enableUpdateRender())}});class bM{constructor(t){this.st=t.parent.parent.parent.parent,this.Up=t,this.V=this.V.bind(this),this.Ti="no",this.Wp=new yM({map:this.st,externalModel:t,parent:this}),this.jp=new xM({map:this.st,externalModel:t,parent:this}),this.Ip=null,this.Xp=[],this.Yp={},this.st.on("update",this.V)}get gifTool(){return this.Wp}get videoTool(){return this.jp}get isGltf(){return this.Up.Np}get textureNames(){return this.Xp}get oldMaterial(){return this.Yp}replace(t,e){null===this.Ip&&(this.Ip={}),this.Ip[t]=!0}reset(t){this.Ip[t]=!1}dispose(){this.Wp.Rp&&this.Wp.dispose(),this.jp.Rp&&this.jp.dispose()}}Object.assign(bM.prototype,{V(){var t=this.Up.getRenderNode();let i=(t,e)=>{t=this.Jr(t);t.needgif&&!this.Wp.Rp&&(this.Wp.add(e),this.Wp.Rp=!0),t.needvideo&&!this.jp.Rp&&(this.jp.add(e),this.jp.Rp=!0)};if(t){this.st.off("update",this.V);let e=this.Up.Zp;this.Up.Np?t.traverse(t=>{"Mesh"===t.type&&i(t,e)}):i(t,e)}},Jr(t){var e={needgif:!1,needvideo:!1};let i=!1,s=!1;var r=t.material,n=t=>{0<=t.indexOf(".gif")?(i=!0,this.Xp.push(t)):(0<=t.indexOf(".mp4")||0<=t.indexOf(".webm")||0<=t.indexOf(".ogg"))&&(s=!0,this.Xp.push(t))},a=(t,e)=>{0<=t.indexOf(".gif")||0<=e.indexOf(".gif")?(i=!0,0<=t.indexOf(".gif")?this.Xp.push(t):this.Xp.push(e)):(0<=t.indexOf(".mp4")||0<=t.indexOf(".webm")||0<=t.indexOf(".ogg")||0<=e.indexOf(".mp4")||0<=e.indexOf(".webm")||0<=e.indexOf(".ogg"))&&(s=!0,0<=t.indexOf(".mp4")||0<=t.indexOf(".webm")||0<=t.indexOf(".ogg")?this.Xp.push(t):this.Xp.push(e))};if(Array.isArray(r)){this.Yp[t.name]=[];for(let e=0;e{t.dispose()}):i.dispose()),t.Pr()}function LM(t,r){t=void 0!==(t=t||{}).duration?t.duration:.5;let n=r.ur(m),a=n.ur(E);if(r.rm&&!1===r.rm.H){if(r.nm)return;r.rm.stop()}r.nm=!0;let h=TM(r);r.rm.Y([0]).Z([1]).K(t).J(t=>{var e=t.destination[0];for(let t=0;t{a.ot.ht(r.rm),RM(r)}),a.ot.lt(r.rm.play())}function CM(t,a){if(a.pf){var e=void 0!==(t=t||{}).duration?t.duration:.5;let s=a.ur(m),r=s.ur(E);if(a.rm&&!1===a.rm.H){if(!a.nm)return;a.rm.stop()}a.nm=!1;let n=TM(a);a.rm.Y([1]).Z([0]).K(e).J(t=>{var e=t.destination[0];for(let t=0;t{r.ot.ht(a.rm),a.Q0(),r.enableUpdateNode(),t.finish&&t.finish()}),r.ot.lt(a.rm.play())}}function NM(t,e){"Mesh"===t.type&&t.material.map&&e.Xp.push(t.material.map.name);var i=t.children;for(let t=0;t{t!==this.Kp&&this.am()}})},im(){var t=this.om(this.qp,this.st.getZoom());this.Kp!==t&&null!==t&&(this.Kp=t,null!==this.Qp&&clearTimeout(this.Qp),this.am(),this.Qp=setTimeout(()=>{},50))},om(e,i){if(!e)return null;var{maxlevel:t,minlevel:s}=this.Up.qs;if(i{this.um(n).then(t=>{t.lod&&Array.isArray(t.lod)||r("lod format error");var e=this.om(t.lod,this.st.getZoom()),i=(null===e&&r(null),Wm.extractUrlBase(n));this.qp=t.lod,s(""+i+e)}).catch(r)})},um(i){return new Promise((e,t)=>{this.Jp?e(this.Jp):this.tm.load(i,t=>{this.Jp=t,e(this.Jp)},null,t)})},Qt(){this.st.off("viewChanged",this.im),this.tm=null}});class IM extends oM{constructor(t){super(),this.qs=t,this.Ti=p.EXTERNAL_MODEL,this.X0=null,this.Zs=null,this.fm=null,this.dm=null,this.vm=null,this.Kr=null,this.pm=!1,this.Ir=null,this.Np=null,this.s1=null,this.ap=[],this.Of=null,this.gm=this.gm.bind(this),this.rm=new nn,this.nm=!0,this._m=null,this.Zp=null,this.Kf=null,this.Jf=!1,this.wm=!1,this.Mm=null,this.ym=null,this.Em=!1,this.xm=null,this.Xp=[],this.bm=!1,this.Sm=null,this.Tm=0,this.pf=!0,this.Am=void 0,this.Rm=[]}get bindBuildingID(){return this.Lm}get multiMediaTool(){return this._m}get fading(){return!this.rm.H}get FID(){return this.qs.fid}get typeID(){return this.qs.type}get name(){return this.qs.name}get eName(){return this.qs.ename}get color(){return this.vm}set color(t){this.vm=t,this.Pr()}get opacity(){return this.Kr}set opacity(t){this.Kr=t,this.Pr()}get canDispose(){return this._canDispose}get show(){return this.Ef}set show(t){t?this.Of&&!this.Of.show||this.Cm():this.Nm()}get isGltf(){return this.Np}get boundNoClone(){var t=this.getBound();return t?{min:{x:t.minX,y:t.minY},max:{x:t.maxX,y:t.maxY}}:null}get renderNode(){return this.Zs}set renderNode(t){this.Zs=t}resetColor(){this.pm=!0,this.Pr(!0)}setColor(t,e){this.vm=t,this.Kr=e,this.Pr()}beforRemove(){var t=this.parent?.parent?.parent;this.wm=!t||!t.visibleLevels.includes(this.level)}getBound(){if(this.dm)return this.dm;var e={};if(this.Zs){var t=new fM(this.Zs,16776960),i=t.geometry.attributes.position.array,s=t.geometry.attributes.position.count;for(let t=0;t{{var s=t=>{i(t)};let e=null;!function t(){r.Zs?(null!==e&&clearTimeout(e),s(r.Rm)):e=setTimeout(t,0)}()}})}}Object.assign(IM.prototype,{iv(t){this.Lm=t},Bu(t){this.Jf=!0,this.wm=!1,!this.Zs&&this.qs&&this.Im(()=>{this.Of&&this.Of.Bu(this),t&&t()},{initLODMesh:!0})},am(t={needFadeIn:!0,needFadeOut:!0,initLODMesh:!0}){this.Zs&&this.P.xa.remove(this.Zs),this.Zs=null,this.Tm=0,this.Im(null,t)},hm(e={needFadeIn:!0,needFadeOut:!0,initLODMesh:!1}){1===this.Tm&&this.pf&&(this.Tm=0),this.Im(t=>{e.onLoaded=()=>{this.Zs&&this.P.xa.remove(this.Zs),this.fm=this.Zs,this.Zs=null},this.Pm(t,()=>{e.callback&&e.callback(e.lodName),!this.visible&&this.Zs&&(this.Zs.visible=!1)},e)},e)},z0(){this.am()},Pm(t,r,n={}){let a=this.ur(E);if(a&&a.Wt){let i=this.ur(m),s=-1===t.indexOf(".js");var e;nt.environment!=I.BROWSER||s||window.fengmap.FMJSONLoader?(e=s?a.Wt.Zf:window.fengmap.FMJSONLoader.getLoader(a))&&(e=e.load(t,(t,e)=>{this.Np=s,n.onLoaded&&n.onLoaded(),s?this.Dm(t,n):(window.fengmap.FMJSONLoader.initMeshJSON(t,e,this.X0,this,a,i,{x:this.qs.Ai[0].x,y:this.qs.Ai[0].y,z:-1===this.qs.height?2.2:this.qs.height}),this.Cm({duration:!1===n.needFadeIn?0:void 0})),nt.environment===I.BROWSER&&null===this._m&&(this._m=new bM(this)),a.enableUpdateRender(),r&&r(),this.Kf=2},t=>{this.Kf=-2}))&&a.Om.add(t,e):console.error("需要插件支持 .js 格式的模型")}},Im(e,i){var t,s,r;1!==this.Tm&&(this.Tm=1,i=i||{},t=this.ur(E),s=this.ur(sh),this.X0=t.Wt.dd.ec({fid:this.qs.fid,typeID:this.qs.type+"",bid:s.Ht}),this.X0)&&this.X0.normalID&&(r=t.Wt.zf(this.X0,"model",s.buildingID)+this.X0.model+"?keyValue="+t.Ls.key,null===this.Zp&&(this.Zp=t.Wt.zf(this.X0,"model",s.buildingID)),r.includes(".json")?(this.Um||(this.Um=new SM(t,this)),this.Um.lm(r).then(t=>{!1!==i.initLODMesh?this.Pm(t,e,i):e&&e(t)})):this.Pm(r,e))},Dm(t,e){if(e=e||{},!this.Zs){var i=this.ur(E);if(i){var s=t.scene,r=this.X0.rotate.split(","),n=new Gt,a=Math.PI/180,r=(n.set(parseFloat(r[0])*a,parseFloat(r[2])*a,parseFloat(r[1])*a),s.rotation.setFromVector3(n,"YXZ"),this.X0.scale.split(",")),a=(s.scale.set(parseFloat(r[0]),parseFloat(r[2]),parseFloat(r[1])),this.X0.translate.split(",")),n=new Gt(this.qs.Ai[0].x-i.t,this.qs.Ai[0].y-i.o,0).applyEuler(new Ps(-Math.PI/2,0,0,"XYZ")).add(new Gt(0,-1===this.qs.height?2.2:this.qs.height,0));if(n.add(new Gt(parseFloat(a[0]),parseFloat(a[2]),parseFloat(a[1]))),s.position.set(n.x,n.y,n.z),this.Zs=s,(this.Zs.mapNode=this).bm||(NM(this.Zs,this),this.bm=!0),this.Pr(),this.P.xa.add(this.Zs),this.Qs&&(this.Zs.visible=!0),this.Of||this.c0||void 0!==this.ir||this.Cm({duration:!1===e.needFadeIn?0:void 0}),0{var e;"Mesh"===t.type&&(t.userData.sourceMaterial||(t.userData.sourceMaterial=t.material),(e=t.material.clone()).transparent=!0,t.material=e,i.push(e))}),i}},Gm(){var t=this.Zs;let e=t=>{var e;t&&t.userData.sourceMaterial&&(e=t.material,t.material=t.userData.sourceMaterial,delete t.userData.sourceMaterial,e.dispose())};this.Np&&t?this.Zs.traverse(t=>{"Mesh"===t.type&&e(t)}):e(t),this.Pr()},Cm(t){if(this.pf)if(this.Np){var e=void 0!==(t=t||{}).duration?t.duration:.5;let r=this.ur(m),n=r.ur(E);if(this.rm&&!1===this.rm.H){if(this.nm)return;this.rm.stop()}this.nm=!0;let a=this.km();this.rm.Y([0]).Z([1]).K(e).J(t=>{var e=t.destination[0];for(let t=0;t{n.ot.ht(this.rm),this.Gm()}),n.ot.lt(this.rm.play())}else LM(t,this)},Nm(t){if(this.pf)if(this.Np){var e=void 0!==(t=t||{}).duration?t.duration:.5;let s=this.ur(m),r=s.ur(E);if(this.rm&&!1===this.rm.H){if(!this.nm)return;this.rm.stop()}this.nm=!1;let n=this.km();this.rm.Y([1]).Z([0]).K(e).J(t=>{var e=t.destination[0];for(let t=0;t{r.ot.ht(this.rm),this.Q0(),r.enableUpdateNode(),t.finish&&t.finish()}),r.ot.lt(this.rm.play())}else CM(t,this)},sm(t,e,i){null==t.userData.sourceOpacity&&(t.userData.sourceOpacity=t.opacity),void 0===t.userData.sourceTransparent&&(t.userData.sourceTransparent=t.transparent),void 0===t.userData.originColor&&(t.userData.originColor=t.color.getHex()),void 0===t.userData.originOpacity&&(t.userData.originOpacity=t.opacity),null===this.Kr&&(this.Kr=t.opacity),this.resetMaterial(t,e),null===this.vm&&(this.vm=t.color.getStyle()),null===this.Kr&&(this.Kr=t.opacity);let s=this.Kr;return i&&(s=t.userData.sourceOpacity),(t=t.clone()).opacity=s*e.Kr,t.color=(new Wt).setStyle(this.vm),t.transparent=t.userData.sourceTransparent||t.opacity<1,void 0!==this.ir&&(t.opacity=this.ir,t.transparent=!0),this.Hm(t),null!==this.Ir&&(t.color=new Wt(this.Ir)),t},Pr(i){if(this.Zs){var t=this.ur(E);let e=this.ur(m);t&&(this.Zs.traverse(t=>{"Mesh"!==t.type&&"SkinnedMesh"!==t.type||(Array.isArray(t.material)?AM(this,e):t.material&&(t.material=this.sm(t.material,e,i)))}),this.pm&&(this.pm=!1),t.enableUpdateRender())}},Hm(t){this.c0?(t.isMask=this.c0,t.maskType=this.m0,t.maskPolygons=this.f0,t.maskHolePogygons=this.d0,t.maskHeight=this.g0,t.maskExtrudeHeight=this._0,t.boundCenter=this.w0,t.boundSize=this.M0,t.maskOpacity=this.y0,t.maskNodeHeight=this.av,t.transparent=!0):(t.isMask=!1,t.maskType=0,t.maskPolygons=[],t.maskHolePogygons=[],t.maskHeight=0,t.maskExtrudeHeight=0,t.boundCenter=null,t.boundSize=null,t.maskNodeHeight=0),this.jv(t)},Vm(t){!t||"Scene"!==t.type&&"Group"!==t.type||(t.parent&&t.parent.remove(t),this.wm&&t.traverse(t=>{"Mesh"===t.type&&t.material?.uniforms?.map?.value.dispose()}),t.mapNode=void 0)},Q0(){if(this.pf){var t;if(this.s1&&(this.stopAction(this.getActionNames()[0],!0),(t=this.ur(E))&&t.ot.zm(this.s1),this.s1=null),this.rm&&!1===this.rm.H&&this.rm.finish(),this.Zs&&"Mesh"===this.Zs.type){if(this.Zs.parent&&this.Zs.parent.remove(this.Zs),Array.isArray(this.Zs.material))for(var e of this.Zs.material)e.map&&this.wm&&e.map.dispose(),e.dispose();else this.Zs.material.map&&this.wm&&this.Zs.material.map.dispose(),this.Zs.material.dispose();this.Zs.geometry.dispose(),this.Zs.geometry=void 0,this.Zs.material=void 0,this.Zs.mapNode=void 0,this.Zs=void 0}else this.Vm(this.Zs),this.Vm(this.fm),this.Zs=void 0,this.fm=void 0,this.Um&&(this.Um.Kp=null);this.Tm=0}},gm(){var t=this.ur(E);t&&t.enableUpdateRender()},xp(){var e=this.getActionNames();for(let t=0;t{this.Pa(t.Wt),t.Wt.Za(),t.enableUpdateRender()})},Pa(t){H3(t,this)}});class DM{constructor(t){this.jm=t,this.Xm=0,this.lv="";t=this.jm.parent.parent.Ym(this.jm.FID);this.Ai=t.qs.Ai[0],this.Zm=t.getArea()}get renderNode(){return this.qm}}Object.assign(DM.prototype,{Km(r){return new Promise((i,t)=>{if(this.Jm)i();else if(r){let e=[];this.Ai.forEach(t=>{e.push(t.x,t.y)});var s=new ArrayBuffer(8*e.length);new Float64Array(s).set(e),r.Ga({type:"maxInnerRect",coords:s},[s]).then(t=>{this.Jm=t.result.rect,i()})}else this.Jm=P3.maxInnerRect(this.Ai),i()})},Qt(){this.qm&&(this.qm=null,this.Ai=null)},$m(t){var e=this.Jm;let i=e.size.x,s=e.size.y;return i<=0||s<=0?{x:1,y:1}:(i/s<(t=t.width/t.height)?s=i/t:i=s*t,{x:i/e.size.x,y:s/e.size.y})},Bu(t){var e;"MeshBasicMaterial"===t.type&&0{!1===this.sg&&t(),this.readyCallback=t})},mg(){return new Promise(t=>{!1===this.sg||this.sg&&this.Zs&&1{var t;this.rg.update(),!1===r._g&&(t=(s+i/2-e/2)/2/1.2,r.pixelOffset=[t,0],a.enableUpdateRender(),a.off("update",n),this.readyCallback&&this.readyCallback(),this.Zs?.children[0])&&(this.Zs.children[0].visible=!0)});this.xg=n,a.on("update",n),a.on("pixelRatioChanged",()=>{r.pixelRatio=a.bt.renderer.getPixelRatio()})}},bg(){var t=this.E0();t.userData.opacity=t.opacity,this.Sg&&this.Sg.Qt();let e=new E3(t);e.scale.set(0,0,0),e.visible=!this.sg,this.Zs.add(e),e.frustumCulledFailCallback=()=>{this.Zs&&this.Zs.children.forEach(t=>{t!==e&&(t.visible=!0)})},e.frustumCulledSuccCallback=()=>{this.Zs&&this.Zs.children.forEach(t=>{t!==e&&(t.visible=!1)})};var t=(e.mapNode=this).ur(m).P.P,i=this.qs.Ai[0],i=new Gt(i.x-t.t,-i.y+t.o,0).applyEuler(new Ps(Math.PI/2,0,0,"XYZ")).add(new Gt(0,this.qs.height,0));this.Zs.position.copy(i)},initTopMesh(){this.Sg||(this.Sg=new DM(this,this.st)),this.Sg.Km(this.st.Wt.Tg).then(()=>{var t;this.Zs&&"1"===this.X0?.mode&&((t=this.E0()).opacity=1,t.userData.opacity=t.opacity,this.Zs.visible=!0,this.Sg?.Bu(t),this.Sg?.renderNode)&&((this.Sg.renderNode.mapNode=this).Zs.add(this.Sg.renderNode),this.st.enableUpdateNode())})},Bu(){var t;this.Zs||(t=this.ur(m).P.P,this.fd(this.st.Wt,t.Wt.dd),this.Zs=new R0,"1"===(this.Zs.mapNode=this).X0.mode?(this.sg=!1,this.jm&&(this.jm.labelMeshInstance&&(this.Zs.remove(this.jm.labelMeshInstance.mesh),this.Zs.remove(this.jm.labelOutlineMeshInstance.mesh)),this.jm=null,t.off("update",this.xg)),0{var e;this.Zs&&(e=this.Zs.children[0].material,this.Zs.children[0].material=t,e.map&&(e.map.dispose(),e.map=null),e.dispose())})):this.Sg&&(this.Q0(),this.st.enableUpdateNode()))},vg(i=0,s=1,t){if(!this.Zs||this.Zs.children.length<1)return null;if(this.Qm.length<1)return this.Zs.visible=!1,null;var e=this.ur(m);let r=this.X0.alpha*e.Kr;if(void 0!==this.ir&&(r=this.ir),this.c0&&(r=this.y0),1===s&&(this.Zs.visible=!0),i===s){e=0===i?0:r;if(this.Zs.children[0].material.opacity===e)return 1;0===(i=this.Zs.children[0].material.opacity)&&0==s?s=0:1===i&&1===s&&(s=e)}this.dg.stop(),this.fg.show=1==s;e="1"!==this.X0?.mode;return e||(s=1),this.st.bi.controls.activeing&&e?(1===i?i=r:1===s&&(s=r),this.dg.Y([i]).Z([s]).K(.2).J(t=>{let e=t.destination[0];this.Zs.children.forEach(t=>{t.material.opacity=e,this.st.enableUpdateRender()});t=OM.Cubic.In(e/Math.max(i,s));this.jm&&(this.jm.opacity=Math.min(t,s))}).$(()=>{t&&t(this),this.st.ot.ht(this.dg)}).X(),this.st.ot.lt(this.dg)):(this.Zs.visible=1==s,this.Zs.children.forEach(t=>{t.material.opacity=r}),this.jm&&(this.jm.opacity=r),this.st.enableUpdateRender()),1},E0(e){var t=this.ur(m);let i={scale:2,needSize:!0,opacity:this.X0.alpha*t.Kr,drawText:!this.sg};void 0!==this.ir&&(i.opacity=this.ir),this.c0&&(i.opacity=this.y0),this.X0.image&&(i.imageUrl=this.ig+this.X0.image);t=this.st.Wt.pl;let s="1"===this.X0.mode?t.cu:t.ou;return(s=s.bind(t))(this.Qm,this.X0,i,t=>{e&&e(t),this.ja&&(t.opacity=0,this.cg=!0,this.ug=!0,this.Ya()),this.Zs&&this.Pa(this.st.Wt),void 0!==i.imageUrl&&this.st.Wt.Za(),nt.environment===I.WX&&this.st.Wt.Za(),this.Sg&&this.Sg.eg(t),!0===this.sg?(t.map&&(t.map.minFilter=$t,t.map.magFilter=$t),this.gg(this.st,t.map?.image),this.jm&&(this.jm.opacity=t.opacity)):this.readyCallback&&this.readyCallback(),this.Ya(1),this.st.enableUpdateRender()})},Pa(t){var e,i,s=this.Zs.children[0];s&&s.material.map&&s.material.map.image&&(e=s.material).userData.mspriteScale&&(t=t.B0(this.fontSize),i=2*this.fontSize*1.2,i=e.map.image.height/i,e.userData.mspriteScale=Math.max(i,e.userData.mspriteScale),s.scale.set(t,t,t),s.scale.multiplyScalar(e.userData.mspriteScale),s.scale.setX(s.scale.x/e.userData.scaleRatio))},fd(t,e){var i=this.ur(sh);this.X0=e.tc({fid:this.qs.fid,typeID:this.qs.type+"",bid:i.Ht}),this.ng&&(this.X0.fontsize=this.ng),this.ig=t.zf(this.X0,"path",i.buildingID),parseInt(this.fontSize)},updateMaterialByThemeTool(t){this.X0=t;var t=this.ur(m).P,e=t.P.Wt;this.ig=e.zf(this.X0,"path",t.buildingID),this.Pr()}});class FM extends ih{constructor(t){super(),this.Jt=void 0!==(t=t||{}).height?t.height:1,this.t=t.x,this.o=t.y,this.Zs=null,this.dv=!1,this.Wv=void 0,this.Ag=t.userID,void 0===this.Ag&&(this.Ag=""+rn.generateUUID()),this.ar=!0,this.qs={minlevel:1,maxlevel:29}}set userID(t){this.Ag=t}get userID(){return this.Ag}get isInit(){return this.dv}set isInit(t){this.dv=t}get isbloom(){return this.Wv}set isbloom(t){this.Wv=t}get x(){return this.t}get y(){return this.o}get height(){return this.Jt}set height(t){this.Jt=t,this.Rg()}get level(){var t=this.ur(m);return t?t.level:null}get visible(){return this.Qs}set visible(t){this.Qs=t,this.Zs&&(this.Zs.visible=this.Qs,t=this.ur(E))&&t.enableUpdateRender()}get opacity(){return this.Kr}set opacity(t){this.Kr=t,this.Zs&&(this.Zs.material.opacity=this.Kr)}get isMarker(){return!0}get zoomRange(){return[this.qs.minlevel,this.qs.maxlevel]}set zoomRange(t){this.qs.minlevel=t[0],this.qs.maxlevel=t[1];t=this.ur(E);t&&t.collisionCheck()}get bound(){return[p.IMAGE_MARKER,p.DOM_MARKER,p.DYNAMIC_MODEL_MARKER,p.LOCATION_MARKER,p.TEXT_MARKER].find(t=>t===this.Ti)?!0===this.needUpdateBound&&(this.mi.reset(),void 0!==this.t)&&void 0!==this.o&&(this.mi.expandByCoords([{x:this.t,y:this.o}]),this.needUpdateBound=!1):!0===this.needUpdateBound&&(this.mi.reset(),this.mi.expandByCoords(this.Id),this.needUpdateBound=!1),this.mi.clone()}addTo(t){t.getOrCreateLayer(this.Ti).add(this),this.Zs&&(this.Zs?.updateMatrixWorld(!0),this.Zs?.parent?.updateMatrixWorld(!0))}remove(){var t=this.ur(E);this.P&&this.P.remove(this),t&&t.enableUpdateRender()}dispose(){this.remove(),this.Zs&&(this.Zs.traverse(t=>{t instanceof L&&(t.geometry.dispose(),t.geometry=void 0,Array.isArray(t.material)?t.material.forEach(t=>{this.Lg(t)}):this.Lg(t.material)),"SkinnedMesh"===t.type&&(t.skeleton.boneTexture&&t.skeleton.boneTexture.dispose(),t.skeleton.dispose())}),this.Zs.mapNode=void 0,this.Zs=void 0),this.dv=!1}}Object.assign(FM.prototype,{Lg(t){if(t){if(t instanceof km){var e,i=t.uniforms;for(e in i)i[e]&&i[e].value instanceof c&&i[e].value.dispose();t.dispose()}else for(var s in t)t[s]&&t[s]instanceof c&&t[s].dispose();t.dispose()}},Cg(){var t;void 0!==this.t&&void 0!==this.o||(t=this.ur(m),this.t=t.center.x,this.o=t.center.y)},Bu(){return!1},Rg(){}});var BM={exports:{}},kM=(BM.exports,(t=>{function s(t,e){var i=t.length-1,s=[t[0]];return function t(e,i,s,r,n){for(var a,h,o,l,u,c,f,d=r,v=i+1;v{for(var i,s,r,n,a=t[0],h=[a],o=1,l=t.length;oe&&(h.push(i),a=i);return a!==i&&h.push(i),h})(t,e),e)),t}t.exports=e,t.exports.default=e})(BM),BM.exports),GM=ha(kM);class HM extends Ch{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this.Id=[],this.Ng=null,this.widthCallback=null,this.totalLength=0,this.matrixWorld=new Ht,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this.Ng},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this.Id},set:function(t){this.setPoints(t,this.widthCallback)}}})}}function VM(t,e){var i=new Ht,s=new Ka,r=new yr,n=new Gt,a=this.geometry;if(a.boundingSphere||a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(this.matrixWorld),!1!==t.ray.intersectSphere(r,n)){i.copy(this.matrixWorld).invert(),s.copy(t.ray).applyMatrix4(i);var h=new Gt,o=new Gt,l=new Gt,u=this instanceof qg?2:1,r=a.index,i=a.attributes;if(null!==r)for(var c=r.array,f=i.position.array,d=0,v=c.length-1;dt.far||(e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}),d=v)}}}function zM(t,e,i,s,r){var n;if(t=t.subarray||t.slice?t:t.buffer,i=i.subarray||i.slice?i:i.buffer,t=e?t.subarray?t.subarray(e,r&&e+r):t.slice(e,r&&e+r):t,i.set)i.set(t,s);else for(n=0;n=gradientPercent[i]){","\t\t\t\tcolorBegin=gradientColor[i];","\t\t\t\tcolorEnd=gradientColor[i];","\t\t\t\tbPercent=gradientPercent[i];","\t\t\t\tePercent=gradientPercent[i];","\t\t\t\tif(i+1<={num}-1){","\t\t\t\t\tcolorEnd=gradientColor[i+1];","\t\t\t\t\tePercent=gradientPercent[i+1];","\t\t\t\t}","\t\t\t}","\t\t}","\t\tfloat perCent=(value-bPercent)/(ePercent-bPercent);","\t\tgColor=mix(colorBegin,colorEnd,perCent);","\t }"," if( useMap == 1. ) {"," vec2 uvRepet = vUV * repeat;"," vec2 uvRotation = ( uvTransform * vec3( uvRepet, 1.0 ) ).xy;","\t \tc = texture2D( map, uvRotation );","\t\tif(isArrow){"," \t\tc=c+gColor;","\t\t} else {","\t\t\tif(isGradient){","\t\t\t\tc.rgb=gColor.rgb;","\t\t\t}","\t\t}","\t } else {"," c = vColor;","\t\tif(isGradient){","\t\t\tc=gColor;","\t\t\tc.a=vColor.a;","\t\t}","\t }","\t bool isPassed2=false;","\t if(ispassed) {","\t\tif(currentPercent>=endPercent){","\t\t\tc=vec4(passColor,vColor.a);","\t\t\tisPassed2=true;","\t\t} else {","\t\t\tif((endPercent-currentPercent)<(1.0-vUvPass.x)*(endPercent-beginPercent)){","\t\t\t\tc=vec4(passColor,vColor.a);","\t\t\t\tisPassed2=true;","\t\t\t}","\t\t}","\t }","\t if(zFighting && !isPassed2){","\t\tdiscard;","\t }"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","\t if(usePassOpacity&&isPassed2){","\t\tgl_FragColor.a=passOpacity;","\t\tif(passOpacity<0.1){","\t\t\tdiscard;","\t\t}","\t }","",b.fog_fragment,"}"].join("\n");class WM extends Vh{constructor(t,e,i){super({uniforms:Object.assign({},P.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Wt(16777215)},opacity:{value:1},resolution:{value:new ct(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new ct(1,1)},offset:{value:new ct(1,1)},ispassed:{value:!1},passColor:{value:new Wt(16777215)},currentPercent:{value:0},beginPercent:{value:0},endPercent:{value:0},isGradient:{value:!1},gradientPercent:{value:[]},gradientColor:{value:[]},gradientBegin:{value:0},gradientEnd:{value:0},isArrow:{value:!1},usePassOpacity:{value:!1},passOpacity:{value:1},zFighting:{value:!1}}),vertexShader:b.meshline_vert,fragmentShader:b.meshline_frag.replace(/{num}/g,""+e)}),this.depthTest=t.depthTest,this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",this.fmmap=i,this.uniforms.uvTransform={value:new _},Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){t&&(this.uniforms.map.value=t,this.uniforms.uvTransform.value=t.matrix)}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.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)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=0!==t?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},offset:{enumerable:!0,get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value.copy(t)}},ispassed:{enumerable:!0,get:function(){return this.uniforms.ispassed.value},set:function(t){this.uniforms.ispassed.value=t}},beginPercent:{enumerable:!0,get:function(){return this.uniforms.beginPercent.value},set:function(t){this.uniforms.beginPercent.value=t}},endPercent:{enumerable:!0,get:function(){return this.uniforms.endPercent.value},set:function(t){this.uniforms.endPercent.value=t}},currentPercent:{enumerable:!0,get:function(){return this.uniforms.currentPercent.value},set:function(t){this.uniforms.currentPercent.value=t}},passColor:{enumerable:!0,get:function(){return this.uniforms.passColor.value},set:function(t){this.uniforms.passColor.value=t}},gradientPercent:{enumerable:!0,get:function(){return this.uniforms.gradientPercent.value},set:function(t){this.uniforms.gradientPercent.value=t}},gradientColor:{enumerable:!0,get:function(){return this.uniforms.gradientColor.value},set:function(t){this.uniforms.gradientColor.value=t}},isGradient:{enumerable:!0,get:function(){return this.uniforms.isGradient.value},set:function(t){this.uniforms.isGradient.value=t}},gradientBegin:{enumerable:!0,get:function(){return this.uniforms.gradientBegin.value},set:function(t){this.uniforms.gradientBegin.value=t}},gradientEnd:{enumerable:!0,get:function(){return this.uniforms.gradientEnd.value},set:function(t){this.uniforms.gradientEnd.value=t}},isArrow:{enumerable:!0,get:function(){return this.uniforms.isArrow.value},set:function(t){this.uniforms.isArrow.value=t}},usePassOpacity:{enumerable:!0,get:function(){return this.uniforms.usePassOpacity.value},set:function(t){this.uniforms.usePassOpacity.value=t}},passOpacity:{enumerable:!0,get:function(){return this.uniforms.passOpacity.value},set:function(t){this.uniforms.passOpacity.value=t}},zFighting:{enumerable:!0,get:function(){return this.uniforms.zFighting.value},set:function(t){this.uniforms.zFighting.value=t}}}),this.setValues(t)}}WM.prototype.copy=function(t){return Vh.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};var jM={},XM=YM;function YM(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}var ZM=qM;function qM(t,e,i){return t[0]=e,t[1]=i,t}var KM=JM;function JM(t,e){var i=e[0],s=e[1],i=i*i+s*s;return 0i.far||(s.push({distance:f,point:l.clone().applyMatrix4(this.matrixWorld),index:t,face:null,faceIndex:null,object:this}),t=e)}}}}b.flatline_vert=["",b.logdepthbuf_pars_vertex,b.fog_pars_vertex,"","uniform float lineWidth;","attribute float lineMiter;","attribute vec2 lineNormal;","uniform vec2 offset;","varying vec2 vUV;","varying vec2 vUvPass;","void main() {"," vec3 pointPos = position.xyz + vec3(lineNormal.x * lineWidth / 2.0 * lineMiter, 0.0, lineNormal.y * lineWidth / 2.0 * lineMiter);"," vUV = uv + offset;","\tvUvPass=uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(pointPos, 1.0);"," vec4 mvPosition = modelViewMatrix * vec4( pointPos, 1.0 );",b.logdepthbuf_vertex,b.fog_vertex,"}"].join("\n"),b.flatline_frag=["",b.fog_pars_fragment,b.logdepthbuf_pars_fragment,"","uniform vec3 color;","uniform float opacity;","uniform sampler2D map;","uniform mat3 uvTransform;","uniform bool isMap;","uniform vec2 repeat;","","uniform bool isGradient;","uniform float gradientPercent[{num}];","uniform vec4 gradientColor[{num}];","uniform float gradientBegin;","uniform float gradientEnd;","uniform bool isArrow;","","uniform bool ispassed;","uniform vec3 passColor;","uniform float currentPercent;","uniform float beginPercent;","uniform float endPercent;","","uniform bool usePassOpacity;","uniform float passOpacity;","uniform bool zFighting;","","varying vec2 vUV;","varying vec2 vUvPass;","","void main() {","",b.logdepthbuf_fragment,""," vec4 color2;","\tvec4 gColor=vec4(0.0,0.0,0.0,0.0);"," if(isGradient){","\t\tfloat value = gradientBegin + vUvPass.x * (gradientEnd - gradientBegin);","\t\tvec4 colorBegin=gradientColor[0];","\t\tvec4 colorEnd=gradientColor[0];","\t\tfloat bPercent=gradientPercent[0];"," float ePercent=gradientPercent[0];","\t\tfor(int i=0;i<{num};i++){","\t\t\tif(value>=gradientPercent[i]){","\t\t\t\tcolorBegin=gradientColor[i];","\t\t\t\tcolorEnd=gradientColor[i];","\t\t\t\tbPercent=gradientPercent[i];","\t\t\t\tePercent=gradientPercent[i];","\t\t\t\tif(i+1<={num}-1){","\t\t\t\t\tcolorEnd=gradientColor[i+1];","\t\t\t\t\tePercent=gradientPercent[i+1];","\t\t\t\t}","\t\t\t}","\t\t}","\t\tfloat perCent=(value-bPercent)/(ePercent-bPercent);","\t\tgColor=mix(colorBegin,colorEnd,perCent);","\t}"," if(isMap){"," vec2 uvRepet = vUV * repeat;"," vec2 uvRotation = ( uvTransform * vec3( uvRepet, 1.0 ) ).xy;"," color2 = texture2D( map, uvRotation);","\t\tif(isArrow){"," \t\tcolor2 = color2+gColor;","\t\t} else {","\t\t\tif(isGradient){","\t\t\t\tcolor2.rgb=gColor.rgb;","\t\t\t}","\t\t}"," } else {"," color2 = vec4(color,opacity);","\t\tif(isGradient){"," color2.rgb=gColor.rgb;","\t\t}"," }","\tbool isPassed2=false;","\tif(ispassed) {","\t\tif(currentPercent>=endPercent){","\t\t\tcolor2=vec4(passColor,color2.a);","\t\t\tisPassed2=true;","\t\t} else {","\t\t\tif((endPercent-currentPercent)<(1.0-vUvPass.x)*(endPercent-beginPercent)){","\t\t\t\tcolor2=vec4(passColor,color2.a);","\t\t\t\tisPassed2=true;","\t\t\t}","\t\t}","\t}","\tif(zFighting && !isPassed2){","\t discard;","\t}"," gl_FragColor = color2;","\tif(usePassOpacity && isPassed2){","\t\tgl_FragColor.a=passOpacity;","\t\tif(passOpacity<0.1){","\t\t\tdiscard;","\t\t}","\t}","",b.fog_fragment,"}"].join("\n");class wy extends Vh{constructor(t,e){super({uniforms:Object.assign({},P.fog,{lineWidth:{value:t.lineWidth},color:{value:t.color},opacity:{value:t.opacity},map:{value:t.map},uvTransform:{value:t.uvTransform},isMap:{value:t.isMap},repeat:{value:new ct(1,1)},offset:{value:new ct(1,1)},isGradient:{value:t.isGradient},gradientPercent:{value:t.gradientPercent},gradientColor:{value:t.gradientColor},gradientBegin:{value:0},gradientEnd:{value:0},isArrow:{value:t.isArrow},ispassed:{value:!1},passColor:{value:t.passColor},currentPercent:{value:0},beginPercent:{value:0},endPercent:{value:0},usePassOpacity:{value:t.usePassOpacity},passOpacity:{value:t.passOpacity},zFighting:{value:t.zFighting}}),vertexShader:b.flatline_vert,fragmentShader:b.flatline_frag.replace(/{num}/g,""+e)}),this.isFlatLineMaterial=!0,this.type="FM2DLineMaterial"}}class My extends Ch{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){var t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class yy extends V0{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){t=super.clone(t);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(t){t=super.toJSON(t);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Ey extends Ch{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){var s=[],r=new Set,n=new Gt,a=new Gt;if(null!==t.index){var h=t.attributes.position,o=t.index;let i=t.groups;for(let t=0,e=(i=0===i.length?[{start:0,count:o.count,materialIndex:0}]:i).length;tE&&r.z>E;if(!x){s.z>E?(x=s.z-r.z,x=(s.z-E)/x,s.lerp(r,x)):r.z>E&&(x=r.z-s.z,x=(r.z-E)/x,r.lerp(s,x)),s.applyMatrix4(v),r.applyMatrix4(v),s.multiplyScalar(1/s.w),r.multiplyScalar(1/r.w),s.x*=_.x/2,s.y*=_.y/2,r.x*=_.x/2,r.y*=_.y/2,h.start.copy(s),h.start.z=0,h.end.copy(r),h.end.z=0;var x=h.closestPointToPointParameter(n,!0),x=(h.at(x,o),ws.lerp(s.z,r.z,x)),x=-1<=x&&x<=1,b=o.distanceTo(r)<1||o.distanceTo(s)<1?.5*w*Math.sqrt(2):.5*w,b=n.distanceTo(o){e.push(void 0===t.buildingID?null:t.buildingID)}),e}get color(){return this.vm}set color(t){this.vm!==t&&(this.vm=t,this.Pr())}get opacity(){return this.Kr}set opacity(t){this.Kr!==t&&(this.Kr=t,this.Pr(),this.M_)&&(this.T_.opacity=t)}get passedColor(){return this.f_}set passedColor(t){this.f_!==t&&(this.f_=t,this.Pr())}get segments(){return this.o_}set segments(t){this.o_=t;var e=this.ur(E);e&&(this.R_(e,!0),this.Bu(),this.__(),this.M_&&(this.T_.segments=t),this.needUpdateBound=!1)}get visible(){return this.Qs}set visible(e){this.Qs=e;for(let t=0;t{t.ya.add(this),this.C_(),t.on("visibleLevelsLoaded",this.__),t.on("levelChanged",this.w_),t.on("updateCameraHeight",this.w_),t.on("zoom",this.w_),t.on("resize",this.w_),this.Ma&&!1!==this.M_&&t.ot.$s(this.p_),this.M_&&this.T_.addTo(t)})}remove(){var t=this.ur(E);t&&(t.off("visibleLevelsLoaded",this.__),t.off("levelChanged",this.w_),t.off("updateCameraHeight",this.w_),t.off("zoom",this.w_),t.off("resize",this.w_),this.R_(t,!0),this.Ma&&t.ot.Ks(this.p_),t.ya.remove(this),t.enableUpdateRender(),this.M_)&&this.T_.remove(t)}dispose(){super.dispose();for(let t=0;t{var s=[];for(let e=0;e{var r=[],n=Math.ceil(s.length/1e3);for(let t=1;t<=n;t++){let e=1e3*(t-1),i=e+1e3;t===n&&(i=s.length),1{this.m_()};let e=null;(M.useMap?function t(){M.texture.source&&M.texture.source.data?(y(),null!==e&&clearTimeout(e)):e=setTimeout(t,0)}:y)()}return r.enableUpdateRender(),this.dv}},z_(){if(void 0!==this.A_){let i=0;var s=[];for(let t=this.Ea.length-1;-1{let i=0;for(let t=0;t{t.needsUpdate=!0,t.rotation=Math.PI/2,t.flipY=!1,t.updateMatrix()})}:(i.useMap&&((t=e.Wt.pl[i.textureCommand](i)).minFilter=V,t.wrapS=kt,t.wrapT=kt,t.generateMipmaps=!1,t.anisotropy=4),this.S_={useMap:i.useMap,texture:t})}return this.S_}},L_(t){this.Xv?Tm.fl(this.Xv,()=>{t&&t()}):t&&t()},Pr(){let n=this.ur(E);if(n){let s=this,r=(this.S_=null,this.F_());var e=this.Ea;if(0=this.qs.baseheight?this.qs.height:this.qs.baseheight}get baseHeight(){return this.qs.baseheight<=this.qs.height?this.qs.baseheight:this.qs.height}get extrudeHeight(){return this.Jt}getData(){var t=Object.assign(super.getData(),{pass:this.qs.pass});return t.height=this.height,t.baseHeight=this.baseHeight,t.extrudeHeight=this.extrudeHeight,t}getArea(){return P3.area(this.qs.Ai[0])}setColor(t,e){this.J_=!0,void 0!==t&&(this.vm=t),void 0!==e&&(this.Kr=e),this.Pr()}resetColor(){this.X0&&!this.n2()||this.fd(),this.setColor(this.X0.color,this.X0.alpha),this.J_=!1}setBorderColor(t,e){t&&(this.Q_=t),null!=e&&(this.t2=e);t=this.ur(E);this.a2(t)}resetBorderColor(){this.X0&&(this.n2()&&this.fd(),this.setBorderColor(this.X0.strokeColor,this.X0.alpha))}setTopImage(t){this.Zv=1,this.lv=t.image,this.tg=void 0!==t.coords?t.coords:this.qs.yi,this.e1=void 0!==t.size?t.size:[5,5],this.t1=void 0!==t.offset?t.offset:[0,0],this.Xm=void 0!==t.angle?t.angle:0,this.Zs&&this.h2()}clearTopImage(){this.Zv=0,this.o2()}flash(t){this.l2(t);let e=this,i=this.ur(E),s=0;function r(){s%2==0?e.Zs&&(e.Zs.material.color=new Wt(e.K_)):e.Zs&&(e.Zs.material.color=new Wt(e.vm)),s++,i.enableUpdateRender()}e.Qp&&clearTimeout(e.Qp),function t(){e.Zs&&(e.Zs.userData.sourceMaterial||(e.Zs.userData.sourceMaterial=e.Zs.material,e.Zs.material=e.Zs.material.clone()),e.Zs.userData.sourceMaterial.canDispose=!1,r());e.Qp=setTimeout(t,100)}()}stopFlash(){if(this.Qp&&(clearTimeout(this.Qp),this.Qp=null,this.Zs)){let t=this.Zs.material;this.Zs.material=this.Zs.userData.sourceMaterial,delete this.Zs.userData.sourceMaterial.canDispose,delete this.Zs.userData.sourceMaterial,t.dispose(),t=null,this.ur(E).enableUpdateRender()}}getOtherNode(){return{top:this.en.top,line:this.Rf}}}Object.assign(Uy.prototype,{iv(t){this.Lm=t},Bu(){if(!this.Zs&&1!==this.Yv){var t=this.ur(m),e=t.P;let r=e.P,n=e.P.Wt;this.fd(),this.vm&&this.J_||(this.vm=this.X0.color),null!==this.Kr&&this.J_||(this.Kr=this.X0.alpha),this.Q_&&this.J_||(this.Q_=this.X0.strokeColor),this.e_&&this.J_||(this.e_=this.X0.strokeWidth),null!==this.t2&&this.J_||(this.t2=this.X0.alpha);e=t.getLayers(p.EXTENT_LAYER)[0].bound,t=r.nt.qv?n.Kv:n.Jv;this.Yv=1,t.bind(n)({type:this.type,data:this.qs,amount:this.Jt,referenceBound:e,isUseReferenceBound:!0,createLineType:1{this.Yv=2;var e=this.E0(n.pl),i=(e.userData.opacity=e.opacity,this.qs.getBound()),s=(null!==this.Ir?((s=e.clone()).color=new Wt(this.Ir),this.Zs=new L(t.geometry,s),this.Zs.userData.sourceMaterial=e):this.Zs=new L(t.geometry,e),new Gt(i.center.x-r.t,this.q_,r.o-i.center.y));this.Zs.position.copy(s),this.Zs.rotation.set(-Math.PI/2,0,0,"XYZ"),(this.Zs.mapNode=this).P.xa.add(this.Zs),this.u2=t.shape,this.c2(t.lineData),this.f2(),this.Of&&this.Of.Bu(this),r.enableUpdateRender()})}},d2(t){let e=[];t?e=t:this.u2.getPoints().forEach(t=>{e.push(t.x,t.y,this.Jt+this.e2)});var t=new Oy({color:this.Q_,width:this.e_,smooth:!1,animate:!1,depth:!0}),i=(t.P=this).ur(E),s=(t.O_(e,i,!0),t.Zs.material.depthWrite=!0,t.Zs.material.depthTest=!0,t.Zs.material.polygonOffset=!0,t.Zs.material.polygonOffsetFactor=-3*this.e_,t.Zs.material.polygonOffsetUnits=1,this.Zs.add(t.Zs),this.Jt&&-1!==this.Jt?this.Jt:2);t.Zs.position.setZ(.005*s),t.Zs.renderOrder=-1,t.Zs.isNoPick=!0,this.Rf=t.Zs,this.m2=t,this.m2.Ea.push({line:t.Zs}),this.m2.N_(i)},cv(t){var e=this.ur(m),i={isline:!0,color:this.Q_,opacity:this.t2*e.Kr,needDepth:!0},e=(void 0!==this.ir&&(i.opacity=this.ir),this.c0&&(i.isMask=this.c0,i.maskType=this.m0,i.maskPolygons=this.f0,i.maskHolePogygons=this.d0,i.maskHeight=this.g0,i.maskExtrudeHeight=this._0,i.boundCenter=this.w0,i.boundSize=this.M0,i.level=e.level,i.buildingId=e.parent.buildingId,i.maskID=this.$d,i.maskOpacity=this.y0,i.maskNodeHeight=this.av),t.Yl(i));return this.jv(e),e},initGLLine(t){var e=this.ur(sh).P.Wt;let i=this.cv(e.pl),s=this.Jt&&-1!==this.Jt?this.Jt:2;if(!t){var r=this.u2.getPoints(),n=(r&&0{t.beforRemove&&t.beforRemove()})}}class jy extends W3{constructor(){super(),this.Ti=p.WALL_MARKER}}class Xy extends W3{constructor(){super(),this.Ti=p.TUBE_MARKER,this.Av()}}Object.assign(Xy.prototype,{Av(){this.Mv=new Z3(7631988),this.Ki=new v,this.yv=new bg(8947848,1.2),this.yv.position.set(-1,1,1).normalize(),this.yv.castShadow=!1,this.yv.target=this.Ki,this.Ev=new bg(3355443),this.Ev.position.set(-.5,1,-1).normalize(),this.Ev.target=this.Ki,this.xa.add(this.yv),this.xa.add(this.Ev),this.xa.add(this.Mv),this.xa.add(this.Ki)}});class Yy extends W3{constructor(){super(),this.Ti=p.LINE3D_MARKER}}class Zy extends W3{constructor(){super(),this.Ti=p.SPHERE_MARKER}}let qy={};qy.LAYER_CLASS=new Map,qy.LAYER_CLASS.set(p.EXTENT_LAYER,ky),qy.LAYER_CLASS.set(p.MODEL_LAYER,Gy),qy.LAYER_CLASS.set(p.LABEL_LAYER,Vy),qy.LAYER_CLASS.set(p.FACILITY_LAYER,zy),qy.LAYER_CLASS.set(p.EXTERNAL_MODEL_LAYER,Wy),qy.LAYER_CLASS.set(p.IMAGE_MARKER,j3),qy.LAYER_CLASS.set(p.TEXT_MARKER,X3),qy.LAYER_CLASS.set(p.POLYGON_MARKER,Y3),qy.LAYER_CLASS.set(p.EXTRUDE_MARKER,K3),qy.LAYER_CLASS.set(p.HEAT_MAP_MARKER,J3),qy.LAYER_CLASS.set(p.DYNAMIC_MODEL_MARKER,eM),qy.LAYER_CLASS.set(p.LINE_MARKER,iM),qy.LAYER_CLASS.set(p.LOCATION_MARKER,sM),qy.LAYER_CLASS.set(p.DOM_MARKER,rM),qy.LAYER_CLASS.set(p.WALL_MARKER,jy),qy.LAYER_CLASS.set(p.TUBE_MARKER,Xy),qy.LAYER_CLASS.set(p.LINE3D_MARKER,Yy),qy.LAYER_CLASS.set(p.SPHERE_MARKER,Zy);class Ky extends ih{constructor(t){super(),this.Ls=t.mapOptions,this.nt=t.states,this.qs=t.data,this.Ar=this.qs.gid,this.C2=this.qs.gname,this.N2=this.qs.alias,this.I2=this.qs.desc,this.Jt=0,this.P2=null,this.D2=[p.EXTENT_LAYER,p.EXTERNAL_MODEL_LAYER,p.MODEL_LAYER,p.LABEL_LAYER,p.FACILITY_LAYER],this.Kr=1,this.O2=!0,this.U2=new U3,this.U2.isEffect=!0,this.Sr=null,this.rr=!0}get bound(){return V3(this)}get height(){return this.Jt}get type(){return this.qs.Ti}get center(){var t=this.P2;return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}}get x(){return this.center.x}get y(){return this.center.y}get visible(){return this.Qs}set visible(t){this.Qs=t,this.traverse(t=>{t.xa.visible=!(!t.visible||!this.Qs)});t=this.ur(E);t&&t.Wt.Za()}get level(){return this.Ar}get name(){return this.C2}get ID(){return this.Ht}get alias(){return this.N2}get floorID(){return this.qs.floorId}get effectScene(){return this.U2}getLayers(e,i){if(void 0===e)return this.Ft;var s=[];for(let t=0;t{Math.abs(this.Ar-e){t.Rg()})},br(t){var e=void 0===(t=t||{}).animate||t.animate,i=void 0!==t.duration?t.duration:.5;let s=this.ur(E);var r=this.Jt;this.H2();let n=()=>{s.ya.Ft.forEach(t=>{t.Ti===p.LINE_MARKER&&t.Rg({needUpdateCrossLine:1{this.traverse(t=>{t.Ti!==p.LINE_MARKER&&t.Ti!==p.LOCATION_MARKER&&(t.xa.position.y=e.destination[0]),this.V2(t)}),n()}).$(()=>{t.finish&&t.finish(),s.ot.ht(this.z2)}),s.ot.lt(this.z2.X())):(this.z2&&this.z2.stop(),this.traverse(t=>{t.Ti!==p.LINE_MARKER&&t.Ti!==p.LOCATION_MARKER&&(t.xa.position.y=this.Jt),this.V2(t)}),n())},W2(i){for(let t=0;t{if("Mesh"===e.type&&e.material.length)for(let t=0;t{if("Mesh"===e.type)if(e.material.length)for(let t=0;t{t.gid===this.Ar&&(t=t.Ft.get(p.EXTENT_LAYER).getBound(),this.P2={minX:t.ci.x,minY:t.ci.y,maxX:t.fi.x,maxY:t.fi.y})})},sd(){var t=this.qs,s=null,r=this.ur(E);for(let[e,i]of t.Ft){var n=this.Ft.some(t=>t.type===e);if(!n){let t=Object.keys(this.Ls.hideList);if(!(t=t.map(t=>+t)).includes(e)||0!==Object.keys(this.Ls.hideList[e]).length){s=new(qy.LAYER_CLASS.get(e))(i,{map:r});if(this.lt(s),e===p.EXTENT_LAYER){var a=[];for(let t=0;t{-1{this.st.bt.Vt(),e.finish&&e.finish()};"animate"in e&&!e.animate?(t.traverse(t=>{t.br({animate:!1})}),s()):t.traverse(t=>{t.Ar===i.level?t.br({finish:()=>{s()}}):t.br({})})},Vs(t,e){t=this.st.getBuilding(t);return t?t.getFloor(e):null},q2(t){t=this.st.getBuilding(t);return null!==t?t.Ft:[]},Cr(e,i){e.levels.sort(),this.nt.Gt(e.building.Ht).visibleLevels=e.levels,this.Ed({bid:e.building.Ht,levels:e.building.gr}),this.Qf(e,()=>{this.Vt(),this.st.bt.xt();var t={type:"visibleLevelsLoaded"};e.building!==this.st.jt&&(t.buildingID=e.building.Ht),this.st.Yt.Xt(t),i&&i()})},Lr(e,i){this.st.Zt();let s=this.nt.Gt(e.Ht);s.targetLevel=i.level,-1{var t;s.targetLevel===i.level?this.st.bi.kt(e,i):(t={type:"levelChanged",level:i.level},e!==this.st.jt&&(t.buildingID=e.Ht),this.st.Yt.Xt(t),i.finish&&i.finish())},!0))},ed(t){let e=!1;return t.qs.Ft.forEach(t=>{0{this.J0(t)&&e++}),e},Rd(t){var i=this.nt.Gt(t.Ht),s=this.nt.nd(t.Ht);if(!i.visibleLevelsLoaded){let e=!0;var r=t.visibleLevels;for(let t=0;t{var e=this.nt.Gt(t.Ht);e.visibleLevelsLoaded||(t.constructor===S3?this.Qa(t)&&!e.visibleLevelsLoaded&&(i=!1):e.visibleLevelsLoaded||(i=!1))}),!this.nt.Ka&&i&&(this.nt.vd=!0),this.nt.Ka=i,!this.nt.qa){let i=!0,s=!0;this.st.traverse(t=>{var e=this.nt.Gt(t.Ht);e.sceneLoaded||(i=!1),(!this.Qa(t)||e.loaded)&&i||(s=!1)}),!this.nt.qa&&s&&(this.nt.pd=!0),this.nt.qa=s}},zt(){this.nt.J2=!0},Q2(){this.nt.J2&&(this.tw=[],this.st.traverse(t=>{for(let e=0;e{t.traverse(t=>{t.type!==p.EXTENT&&t.type!==p.FACILITY&&t.type!==p.LABEL&&t.type!==p.MODEL&&t.type!==p.EXTERNAL_MODEL&&t.type!==p.TEXT_MARKER&&t.type!==p.DOM_MARKER&&t.type!==p.EXTRUDE_MARKER&&t.type!==p.IMAGE_MARKER&&t.type!==p.POLYGON_MARKER&&t.type!==p.DYNAMIC_MODEL_MARKER||t.Zs&&this.tw.push([e,t])})}),i.O2=!1}}),this.nt.J2=!1)},ew(){if(0this.Ls.maxMaterialCount);t++){var i=this.tw[t][1];i.update?i.update():i.Pr(),this.tw.splice(t,1),t--}this.st.enableUpdateRender()}},To(t,e,i){e=new m({mapOptions:this.Ls,states:this.nt,data:e,key:i});return t.lt(e),e.F2(),e.H2(),e},ad(t){t.sd(),t.X2(),this.rd(t)},iw(t,i){return t.reduce((t,e)=>t&&e!==i,!0)},sw(e,i,s){var r=[];r.push(e);for(let t=0;t{}};class Qy{constructor(t,e,i,s){this.st=t,this.Ls=e,this.nt=i,this.W=s,this.pl=new Hm(this),this.qs=null,this.Zf=new k2(t,this),this.dd=new zm(this),this.Zu=new Map,this.Ua=[],this.tw=[],this.Xf=0,this.tv=!1,this.V=this.V.bind(this),this.H0=null,this.rw=this.rw.bind(this),this.nw=new Sr(new Gt(0,1,0),0),this.Vr=new $a,this.Z0=!0,this.L0=null,t.on("visibleLevelsLoaded",this.rw),t.on("loaded",this.rw),t.on("viewChanged",this.rw),t.on("viewModeChanged",this.rw),t.on("buildingEntered",this.rw),t.on("buildingExited",this.rw),t.on("zoom",this.rw),t.on("move",this.rw),t.on("mapLoaded",this.rw),t.on("levelChanged",this.rw),t.on("sceneLoaded",this.rw),t.on("firstViewLoaded",this.rw),t.on("ViewBuildingChange",this.rw),t.on("beforeRender",this.V),this.jo=null,this.Sa=this.Sa.bind(this),this.Qh=new $p({disposeCallback:this.Sa,enable:!0,name:"NodeManager",mapCreateTime:this.st.Il}),e.webWorker?.useWebWorker&&(this.Ha=new nt.TaskProcessor("workerCore.js",e.webWorker),this.Tg=new nt.TaskProcessor("workerCalculate.js",e.webWorker))}}Object.assign(Qy.prototype,{rw(e){if("visibleLevelsLoaded"!==e.type&&"loaded"!==e.type&&"viewChanged"!==e.type||(this.nt.Y0=!0,this.Za()),"viewModeChanged"===e.type&&this.st.bi.yt.updateCheck(),"mapLoaded"===e.type&&this.st.aw(t=>{this.A0({bid:t.Ht})}),"move"===e.type&&this.st.Zt(),"buildingEntered"!==e.type&&"buildingExited"!==e.type||(this.A0({bid:e.buildingID}),"buildingExited"===e.type?e.isVisibuildingChange||null===this.L0||(this.L0.remove(),this.L0=null,this.st.getBuilding(e.buildingID).Df=null):this.R0({bid:e.buildingID})),"zoom"===e.type){if(this.st.Zt(),this.st.traverse(t=>{t!==this.st.jt&&(this.A0({bid:t.Ht}),t.Ld())}),nt.environment===I.WX){if(void 0===$y.lastHandleZoomTime&&($y.lastHandleZoomTime=Date.now()),Date.now()-$y.lastHandleZoomTime<50)return void($y.lastHandleZoomTime=Date.now());$y.lastHandleZoomTime=Date.now()}this.st.traverse(t=>{t.visible&&t.traverse(t=>{t.visible&&t.traverse(t=>{t.visible&&t.traverse(t=>{t.type===p.EXTERNAL_MODEL&&t.Zs&&(!(t.qs&&(t.qs.maxlevel<=e.zoom||t.qs.minlevel>e.zoom))?t.fading&&t.Cm():t.Nm())})})})})}if("levelChanged"===e.type||"visibleLevelsLoaded"===e.type){if(e.buildingID&&e.buildingID!==this.st.Ls.buildingID){var i=this.st.getBuilding(e.buildingID);if(i&&i.traverse(t=>{t.br()}),i&&i.Df){var s=this.C0(i);i.Df.polygons=s;let t=i.Nf[1];1===i.visibleLevels.length&&(t=i.level),i.Df.childMapLevel=t}}else this.st.traverse(t=>{"levelChanged"===e.type&&t.Ht!==this.st.Ls.buildingID&&t.Cd(e.level),t.traverse(t=>{t.br({animate:!1})})});this.st.bi.yt.updateCheck()}"sceneLoaded"!==e.type||e.buildingID||this.Wf(e.type),"visibleLevelsLoaded"===e.type&&void 0===e.buildingID&&this.Wf(e.type),"loaded"===e.type&&this.Wf(e.type),"firstViewLoaded"===e.type&&this.Wf(e.type),"ViewBuildingChange"===e.type&&(e.buildingID!==this.st.Ls.buildingID?this.st.bi.yt.updateCheck():this.st.getMapOptions().followFocus||(s=this.st.getBuilding(e.buildingID),this.st.bi.Kt(s,{level:s.level,animate:!1})))},Y_(t){var e=(new Gt).copy(this.st.bi.yt.target),i=new ct(0,0);e.y=t+i.y;let s;return 10/(s="PerspectiveCamera"===this.st.ct.type?(t=this.st.ct.near,i=this.st.ct.fov,e=this.st.bi.yt.object.position.distanceTo(e),10*t*Math.tan(i/2*u.DEG2RAD)*2/this.st.bt.renderer.domElement.clientHeight*e/t):(i=this.st.ct.top,e=this.st.ct.bottom,10*Math.abs(i-e)/this.st.bt.renderer.domElement.clientHeight/this.st.ct.zoom))},V(){this.nt.ac&&(this.Q2(),this.ew(),this.Oa(),this.Fa(),this.st.bt.$a(),this.st.bt.hw())},Za(){this.st.bt.Za()},Vt(){this.st.bt.Vt()},$0(t,e){if(!t.getBound||!e)return!0;t=t.boundNoClone;if(!t)return!0;let i=!0;var{max:t,min:s}=t,{max:e,min:r}=e;return t.xe.x||t.y{t(this.uc(s,r,n,i==p.MODEL))})},lw(t){let s=new Ch;return t.forEach(t=>{var{itemSize:t,array:e,key:i}=t,e=new Float32Array(e);s.setAttribute(i,new N(e,t))}),s},Kv(t){let{data:o,amount:l,referenceBound:u,type:c,createLineType:f,lineHeight:d}=t;return new Promise((s,t)=>{let i=[];o.Ai.forEach((t,e)=>{i[e]=[],t.forEach(t=>{i[e].push(t.x,t.y)})});var e=[];for(let t=0;t{var{attributesInfo:t,lineAttributeInfo:e}=t.result,t=this.lw(t);t.computeBoundingBox(),t.computeBoundingSphere();let i;"geometry"===f?i=this.lw(e):"onlyData"===f&&(i=new Float32Array(e)),s({shape:1{s.themeID=i.themeID;let e=this.Zu.get(i.bid);e||(this.Zu.set(i.bid,{theme:new Vm}),e=this.Zu.get(i.bid)),e.theme.Bu(t),s.themeLoaded=!0,i.bid===this.Ls.buildingID&&(this.nt.fd(this.dd),this.st.setBackgroundColor(this.nt.backgroundColor,this.nt.backgroundAlpha)),this.V0()})},Vf(t){let e=this.Zu.get(t.bid);t.data?(e||(this.Zu.set(t.bid,{themeExtension:new n3}),e=this.Zu.get(t.bid)),e.themeExtension||(e.themeExtension=new n3),e.themeExtension.Bu(t.data)):e&&e.themeExtension&&(this.Ls.buildingID===t.bid?e.themeExtension.resize():(e.themeExtension.Qt(),e.themeExtension=null)),this.nt.fd(this.dd),this.st.setBackgroundColor(this.nt.backgroundColor,this.nt.backgroundAlpha),!1!==t.needUpdataNode&&this.G0(t)},Qt(t){clearTimeout(this.$f),this.st.off("visibleLevelsLoaded",this.rw),this.st.off("loaded",this.rw),this.st.off("viewChanged",this.rw),this.st.off("viewModeChanged",this.rw),this.st.off("buildingEntered",this.rw),this.st.off("zoom",this.rw),this.st.off("move",this.rw),this.st.off("buildingLoaded",this.rw),this.st.off("beforeRender",this.V),this.st.off("ViewBuildingChange",this.rw),this.jo=t,this.pl.Qt(()=>{this.pl=null,this.Qh.qh(!0)})},Sa(){for(var t in this.Ua=[],this.Zf.Qt(),this.Zf=null,this.Zu.clear(),this.Ha&&this.Ha.uw(),this.Tg&&this.Tg.uw(),this.st=null,this)this[""+t]&&this[""+t].Qt&&this[""+t].Qt();for(var e in this.jo&&this.jo({name:"NodeManager"}),this)this[""+e]=null,delete this[""+e]}}),A3(Qy),O3(Qy),Jy(Qy);class tE{constructor(){this.Ft=new Map,this.cw=[],this.te=(new Date).getTime(),this.fw=new Map,this.jo=null,this.Sa=this.Sa.bind(this),this.Ta=0,this.Ma()}}Object.assign(tE.prototype,{lt(e){if(Array.isArray(e)){this.Ft.set(e[0].j,e[0]),e[0].P=this;for(let t=1;tt(r));for(let t=0;t{var e,i;t.H||(t.G?t.F+=r:(e=(s-t.O)/t.B,i=r/t.B,this.V(t,e,i),e=s-t.O-t.U,t.B<=e&&(t.D=[],t.k?(t.O=s,t.W&&t.W()):(i=t.H,t.H=!0,!i&&t.W&&t.W()))))}),this.te=s},Qt(t){this.jo=t,this.Sa()},Sa(){this.Ta&&(nt.window.cancelAnimationFrame(this.Ta),this.Ta=0),this.Ft.forEach(function(t){t.Qt()}),this.Ft.clear(),this.cw=[],this.fw.clear(),this.jo&&this.jo({name:"Animator"})}});class eE{constructor(){this.dw=!0,this.A={}}}Object.assign(eE.prototype,{pw(t,e){this.mw(t,e)||(void 0===this.A[t]&&(this.A[t]=[]),this.A[t].push(e))},mw(t,e){return e?void 0!==this.A[t]&&-1!==this.A[t].indexOf(e):void 0!==this.A[t]&&0{t.abort(),this.loadManager.itemEnd(e)}),this.requests.clear(),this.loadManager=null}}let hE=(t,e,i,s)=>{t.Or=new vm({mapCreateTime:t.Il}),t.Wt=new Qy(t,e,i,s),t.Wt.j0()};class oE extends ih{constructor(t){super(),t.uatEnvironment&&Wp(),this.js={error:[]},this.Il=(new Date).getTime(),this.Ls=new rE(t),this.nt=new nE(this.Ls),this.t=null,this.o=null,nt.environment===I.WX&&(nt.initCanvas(this.Ls,this),$y.isDestory=!1),this.jt=null,this.rc=!1,this.Dw=new Gt,this.qt=null!=t.followFocus&&t.followFocus,this.Ow=null,this.Uw=!1,this.ua=[p.IMAGE_MARKER,p.TEXT_MARKER],this.Yt=new eE,this.ot=new tE,this.Or=null,this.Wt=null,this.Ps=null,this.Lt=null,nt.environment==I.BROWSER?this.ct=this.Fw(this.Ls.container.clientWidth,this.Ls.container.clientHeight):this.ct=this.Fw(this.Ls.container.width,this.Ls.container.height),this.bt=new nv(this,this.Ls,this.nt),this.ya=new W3,(this.ya.P=this).bi=new Va(this,this.Ls.container,this.nt),this.bi.enableDragRange=this.Ls.interaction.enabledPanRange,this.Ls.interaction.panRangeValue&&(this.Ls.enabledPanRange=!0,this.bi.enableDragRange=!0),this.Vr=new hh(this,this.Ls,this.nt),this.Sa=this.Sa.bind(this),this.Bw=!1,this.St=this.St.bind(this),this.kw=this.kw.bind(this),this.Gw=[],this.Hw=!1,this.Vw=null,this.zw=null,this.Ww=this.Ww.bind(this),nt.environment==I.BROWSER&&(this.jw=new nt.DomMarkerManager(this)),this.Xw(),this.Om=new aE(Ym),Ym.onLoad=()=>{this.enableUpdateRender()}}get requestDispose(){return this.Bw}get focusBuilding(){return this.Yw}get x(){return this.t}get y(){return this.o}get bound(){return!0===this.needUpdateBound&&0{this.mi.expand(t.bound)}),this.mi.expand(this.ya.bound),this.needUpdateBound=!1),this.mi.clone()}get camera(){return this.ct}set camera(t){this.ct=t}get followFocus(){return this.qt}set followFocus(t){this.qt!==t&&(this.qt=t,this.qt||this.bi.Kt(this.jt,{level:this.getLevel()}))}getScaleBarInfo(){let t;var e={x:(t=nt.environment===I.WX?{x:nt.document.body.clientWidth/2,y:nt.document.body.clientHeight/2}:{x:document.body.clientWidth/2,y:document.body.clientHeight/2}).x+100,y:t.y},i=na.coordsScreenToMap(this,t),e=na.coordsScreenToMap(this,e),i=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y))/100;let s=[1e7,5e6,2e6,1e6,5e5,2e5,1e5,5e4,25e3,2e4,1e4,5e3,2e3,1e3,500,200,100,50,20,10,5,2,1,.5,.2,.1,.05,.02,.01][Math.floor(this.getZoom())-1],r="";return r=s<1e3&&1<=s?"米":s<1?(s*=1e3,"毫米"):(s/=1e3,"公里"),{screenDistance:s/i,actualDistance:s,unit:r}}setDevicePixalRatio(t){this.getRenderManager().renderer.setPixelRatio(t),this.Yt.Xt({type:"pixelRatioChanged"}),this.enableUpdateRender()}removeAnimator(t){this.ot.ht(t)}addAnimator(t){this.ot.lt(t)}copyCamera(){let t=null;return(t=this.ct===this.Ps?new er(u.FOV,1,u.CAMERA_NEAR,u.CAMERA_FAR):new ir(1,1,1,1,u.CAMERA_NEAR,u.CAMERA_FAR)).copy(this.ct),t}enableUpdateRender(){this.nt.th=!0}enableUpdateNode(){this.nt.Y0=!0}getFloorInfos(){return this.getBuilding(this.Ls.buildingID).getFloorInfos()}setHighlightColor(t){this.nt.highlightColor=t}setControlTarget(t){this.bi.Xs(t)}resize(t,e){this.bt.ba(t,e)}getMarkerGroup(){return this.ya}getVisibleLevels(){return this.jt.visibleLevels}setTheme(t){this.Wt.Hf({themeID:t,bid:this.Ls.buildingID})}setThemeExtension(t,e){this.Wt.Vf({data:t,bid:this.Ls.buildingID,...e})}clearThemeExtension(){this.Wt.Vf({bid:this.Ls.buildingID})}getRenderOrder(){return this.bt.ua}setRenderOrder(t){this.bt.Ca(t)}getCollisionOrder(){return this.nt.Cw}setCollisionOrder(t){this.nt.Cw=Ir.uniqWithArrayTwo(t),this.Wt.Za()}adjustRenderOrder(t){this.bt.La(t)}setVisibleLevels(t,e){this.jt.setVisibleLevels(t,e)}getRenderManager(){return this.bt}setRenderManager(t){for(var e in this.bt.render=t.render,this.bt.getLayerType=t.getLayerType,t)this.bt[e]=t[e];this.bt.renderer=this.bt.getRenderer()}getCenter(){return this.bi.Ut()}setCenter(t){this.bi.Bt(t)}zoomIn(){this.bi.it(1.02)}zoomOut(){this.bi.it(.98)}getZoomRange(){return this.nt.rt}setZoomRange(t){this.bi.Tt(t)}getZoom(){return this.bi.ut()}setZoom(t){this.bi._t(t)}getRotation(){return this.bi.It()}setRotation(t){this.bi.Dt(t)}autoRotate(t){return(t=t||{}).loop=!0,void 0===t.duration&&(t.duration=5),this.bi.Dt(t)}getTilt(){return rn.round(90-this.bi.yt.getPolarAngle()*u.RAD2DEG)}setTilt(t){t.tilt=ws.clamp(t.tilt,this.Ls.minTiltAngle,this.Ls.maxTiltAngle),this.nt.zs=t.tilt,this.bi.Ct(t)}getFloor(t){return null===this.jt?null:this.jt.getFloor(t)}getLevel(){return this.jt?.level}getLevels(){return null!==this.jt?this.jt.gr:null}setLevel(t){this.Wt.Lr(this.jt,t)}getFloorSpace(){return null!==this.jt?this.jt.floorSpace:null}setFloorSpace(e){if("number"==typeof e)this.Zw(e,!0);else{if(!("animate"in e)||e.animate){this.Nr||(this.Nr=new nn);var i=Number.isFinite(e.duration)?e.duration:.5;let t=e.finish;return this.Nr.Y([this.jt.floorSpace]).Z([e.floorSpace]).K(i).J(t=>{this.Zw(t.destination[0],!1)}).$(()=>{this.ot.ht(this.Nr),this.Zw(e.floorSpace,!0),t&&t()}),this.ot.lt(this.Nr.X()),this.Nr}this.Zw(e.floorSpace,!0)}}getViewMode(){return this.ct.isPerspectiveCamera?Lr.MODE_3D:Lr.MODE_2D}setViewMode(t){this.bi.Ys(t)}getInteractions(){return this.getInteracations()}getInteracations(){return this.bi}getBound(){return this.jt.bound.clone()}getState(){let t=null,e=(this.Yw&&(t={buildingID:this.Yw.buildingID,level:this.Yw.level,visibleLevels:this.Yw.getVisibleLevels()}),this.nt.bs);return e===this.getMapOptions().mapID&&(e=null),{center:this.getCenter(),zoom:this.getZoom(),rotation:this.getRotation(),tiltAngle:this.getTilt(),viewMode:this.getViewMode(),level:this.jt.level,floorSpace:this.getFloorSpace(),visibleLevels:this.jt.visibleLevels,viewBuildingID:e,focusBuildingState:t}}setState(r,n){n=n||{};var e,i=this.getState();let s=!1;for(e in i){if(void 0===r[e]&&(r[e]=i[e]),("floorSpace"===e||"level"===e||"rotation"===e||"tiltAngle"===e||"viewBuildingID"===e||"viewMode"===e||"zoom"===e)&&r[e]!==i[e]){s=!0;break}if("center"===e&&(r[e].x!==i[e].x||r[e].y!==i[e].y)){s=!0;break}if("visibleLevels"===e){if(r[e].length!==i[e].length){s=!0;break}for(let t=0;t{this.setLevel({level:r.level,animate:!1})}})):this.nt.bs!==this.getMapOptions().mapID&&this.exitBuilding({buildingID:this.nt.bs,noCenter:!0,finish:()=>{this.setLevel({level:r.level,animate:!1})}}),this.qt=!1,this.setCenter({animate:s,x:r.center.x,y:r.center.y,duration:i,finish:()=>{this.setRotation({animate:s,rotation:r.rotation,duration:i,finish:()=>{this.setTilt({animate:s,tilt:r.tiltAngle,duration:i,finish:()=>{this.setZoom({animate:s,zoom:r.zoom,duration:i,finish:()=>{this.setViewMode({animate:s,mode:r.viewMode,finish:()=>{this.setVisibleLevels(r.visibleLevels,()=>{this.setLevel({animate:s,level:r.level,duration:i,finish:()=>{if(null===r.focusBuildingState)this.qt=this.getMapOptions().followFocus,this.bi.resumeDamping(),n.finish&&n.finish();else{this.qt=this.getMapOptions().followFocus;let t=r.focusBuildingState,e=this.getBuilding(t.buildingID);e.setVisibleLevels(t.visibleLevels,()=>{e.setLevel({level:t.level,animate:s,duration:i,finish:()=>{t.buildingID===r.viewBuildingID&&this.enterBuilding({buildingID:t.buildingID,noCenter:!0,finish:()=>{this.bi.resumeDamping(),n.finish&&n.finish()}})}})})}}})})}})}})}})}})}})}}else n.finish&&n.finish()}getNodes(i,s){let n=this;var r=[];this.jt;let e=[p.LABEL_LAYER,p.FACILITY_LAYER,p.MODEL_LAYER,p.EXTENT_LAYER,p.EXTERNAL_MODEL_LAYER];var t,a={};if(s)for(let e=0;e{let i=[],s=t.buildingID;s=s||n.jt.buildingID;var r=t.levels;for(let t=0;t{let i=null;for(let t=0;te.includes(t.type));for(let e=0;e{this.setCenter({animate:!1,x:t.center.x,y:t.center.y,finish:()=>{this.qw(t,5,0,t=>{this.bi.yt=a,this.ct=h,this.setZoomRange(s),n.dispose(),n=null,r=null,this.enableUpdateRender(),this.setZoom({animate:i,zoom:t.zoom,duration:.5}),this.setCenter({animate:i,x:t.center.x,y:t.center.y,duration:.5,finish:()=>{e.finish&&e.finish()}})})}})}})}setBackgroundColor(t,e){this.bt.renderer.setClearColor("string"===t?parseInt(t.slice(1),16):t,e),this.enableUpdateRender()}setLabelField(t){this.nt.F0=t,this.Wt.U0(),this.Wt.Za()}getLabelField(){return this.nt.F0}getBuilding(t){return this.Qo({bid:t})}getBuildings(){let e=[];return this.traverse(t=>{t!==this.jt&&e.push(t)}),e}changeOverviewMode(e){for(let t=0;t{e.Gw.push({buildingID:t.buildingID,visible:t.visible}),t.visible=!1}),i.visible=!0,e.nt.bs=t.buildingID,i.Nd("add"),e.Wt.Gf(i),e.Wt.Vt(),e.Wt.Z2(i,{}),e.Yt.Xt({type:"ViewBuildingChange",buildingID:e.nt.bs}),e.Yt.Xt({type:"buildingEntered",buildingID:e.nt.bs}),t.finish&&t.finish({buildingID:t.buildingID})}this.setLevel({level:i.levelChart[0],animate:!1,finish:()=>{t.noCenter?s():this.bi.Bt({x:i.x,y:i.y,animate:!0,duration:.5,finish:()=>{s()}})}})}exitBuilding(t){let e=this,i=(this.Gw.forEach(t=>{this.getBuilding(t.buildingID).visible=t.visible}),this.Gw.length=0,this.getBuilding(this.nt.bs));function s(){e.nt.bs=e.Ls.buildingID,i.Nd("remove"),e.Wt.Vt(),e.Wt.Z2(i,{}),e.Yt.Xt({type:"ViewBuildingChange",buildingID:e.nt.bs}),e.Yt.Xt({type:"buildingExited",noCenter:t.noCenter,buildingID:i.Ht,isVisibuildingChange:!0}),t.finish&&t.finish({buildingID:i.Ht})}t.noCenter?s():this.bi.Bt({x:i.x,y:i.y,animate:!0,duration:.5,finish:()=>{s()}})}setFocusNodes(e){var s=new Map,r=e.nodes,n=[];for(let i=0;i{this.Or.Qt(()=>{this.ot.Qt(()=>{this.Wt.Qt(()=>{this.Sa(),this.ya.dispose(),super.dispose(),Ym.onLoad=()=>{},Ym.record.clear(),t&&t()})})})},Ym.isLoaded()?e():Ym.onLoad=e)}collisionCheck(){this.Wt.Za()}checkExternalLoaded(){return this.Wt.mf()}}Object.assign(oE.prototype,{Zw(t,e=!0){this.jt.floorSpace=t,this.jt.wr=e,this.Yt.Xt({type:"floorSpaceChanged"});var i=this.ya.Ft;for(let t=0;tt.x/t.y?t.y/e:t.x/i)):null},Jw(t){t=this.K0(t);return t?na.coordsScreenToMap(this,{x:(t.max.x+t.min.x)/2,y:(t.max.y+t.min.y)/2,level:this.getLevel()}):null},qw(e,i,s,r){let n=this.getZoom();var t=this.Kw(e);t?n=this.bi.vt(t):n-=1,this.setZoom({animate:!1,zoom:n,finish:()=>{let t=this.Jw(e);t?this.setCenter({animate:!1,x:t.x,y:t.y,finish:()=>{++s===i?r({zoom:n,center:t}):this.qw(e,i,s,r)}}):0u.EPS&&(this.Yt.Xt({type:"zoom",zoom:t}),this.ct.isOrthographicCamera&&this.bt.xt(),this.nt.ls=t)},kw(){if(this.nt.xw){let t=this.bi.yt.target;t.distanceToSquared(this.Dw)>u.EPS&&(this.Yt.Xt({type:"move",center:this.getCenter()}),this.Dw=t.clone(),t=null)}},Xw(){let a=!0;hE(this,this.Ls,this.nt,(t,e,i,s,r,n)=>{a&&(this.nt.Pw(this.jt),a=this.bi.Hs()),this.bt.Vt(),this.ct.updateMatrixWorld(),i&&n&&this.bi.lt([this.St,this.kw]),r&&n&&(this.Hw=!0,this.Yt.Xt({type:"loaded"}),this.Zt(),this.nt.pd=!1)})},Qo(e){let i=null;return this.traverse(t=>{t.Ht!==e.bid&&t.dr!==e.mid||(i=t)}),i},I0(){var t=this.bt.renderer.domElement,t={x:t.clientWidth/2,y:t.clientHeight/2,z:this.bi.controls.target.y};return na.coordsScreenToMap(this,t)},P0(i){if(i===this.jt)return!1;if(!this.Hw)return!1;let s=!1;if(this.Ls.enterTriggerMode===iE.Individual)i.Of.Mf.forEach((t,e)=>{t.type===p.MODEL&&t.level===this.jt.level&&P3.isContain(t.coordinates[0],this.I0())&&(this.Yw=i,s=!0)});else for(let t=0;t{this.Yw||(this.P0(t),this.Yw&&e(t))})},Zt(){if(this.Uw&&this.Yw.Ht!=this.nt.Ls.mapID){let t=this.$w(),e=this.Yw.Ht;if(t||this.Vw===e||(e=this.Vw,t=!0),t){if(this.getState().viewBuildingID&&this.getState().viewBuildingID!==this.nt.Ls.mapID)return;var i={type:"buildingExited",buildingID:e},s=(this.Uw=!1,this.Yw=null,this.getBuilding(e));this.Wt.hc(e)&&s.Uf&&(s.Uf=!1,this.Yt.Xt(i)),this.followFocus&&this.setLevel({level:this.getLevel(),animate:!1})}}this.traverse(t=>{var e;this.Uw||(this.P0(t)?(e=this.D0(),this.Vw=t.buildingID,!e||this.getState().viewBuildingID&&this.getState().viewBuildingID!==this.nt.Ls.mapID||(this.Uw=!0,this.Wt.hc(t.Ht)&&0==t.Uf?(t.Uf=!0,this.Yt.Xt({type:"buildingEntered",buildingID:t.Ht})):(this.zw=t.Ht,this.on("update",this.Ww)),this.followFocus&&t.setLevel({level:t.level,animate:!1}))):this.Yw=null)})},Ww(){var t,e;this.Wt.hc(this.zw)&&(this.Yw&&this.Yw.Ht===this.zw&&(t=this.P0(this.Yw),e=this.D0(),t)&&e&&(this.Yw.Uf=!0,this.Yt.Xt({type:"buildingEntered",buildingID:this.zw})),this.off("update",this.Ww),this.zw=null)},$w(){var t,e=this.Qw();return this.Yw.overviewMode==o3.NORMAL?(t=(t=this.getZoom())=this.Yw.Cf,!e||t):!e},D0(){var t;return this.Yw.overviewMode!=o3.NORMAL||!((t=this.getZoom())=this.Yw.Cf)},Qw(){if(null==this.Yw)return!1;if(this.P0(this.Yw))return!0;{var t=this.Yw.getFloor(this.Yw.level).getLayers(p.EXTENT_LAYER)[0];if(null==t)return!1;let e=!1;return t&&t.traverse(t=>{e=!P3.isContain(t.coordinates[0],this.I0())}),!e}}});var E=oE;class lE extends FM{constructor(t){super(t),this.Ts=new Map}moveTo(e){var t=void 0!==e.animate&&e.animate,i=e.duration||.5;let s=void 0!==e.height?e.height:this.Jt,r=this.ur(E);if(r){if(t){let t;return this.Ts.has("moveTo")?t=this.Ts.get("moveTo"):(t=new nn,this.Ts.set("moveTo",t)),t.Y([this.t,this.o,this.Jt]).Z([e.x,e.y,s]).K(i).J(t=>{this.t=t.destination[0],this.o=t.destination[1],this.Jt=t.destination[2],this.Rg(),e.update&&e.update({x:this.t,y:this.o,level:this.Ar,height:this.Jt,buildingID:this.h0}),r.enableUpdateRender()}).$(()=>{this.t=e.x,this.o=e.y,this.Jt=s,this.Rg(),e.finish&&e.finish(),r.enableUpdateRender()}),r.ot.lt(t.X()),t}this.t=e.x,this.o=e.y,this.Jt=s,this.Rg(),e.finish&&e.finish(),r.enableUpdateRender()}}stop(){let e=this.ur(E);e&&this.Ts&&(this.Ts.forEach(t=>{e.ot.ht(t)}),this.Ts.clear())}getFMAnimation(){return new nn}}Object.assign(lE.prototype,{Rg(){if(this.Zs){var t=this.ur(E);if(!t)return!1;var e=this.Ti===p.DOM_MARKER?this.hr.height+this.Jt:this.Jt;this.Zs.position.set(this.t-t.x,e,-this.o+t.y),this.needUpdateBound=!0,t.enableUpdateRender()}},t3(l){var t=void 0!==l.animate&&l.animate,u=l.duration||.5;let c=this.ur(E);var f=(t,e)=>e?t.getBuilding(e):t;let d=(t,e,i)=>{e!==i&&(this.h0=i.buildingID,this.remove(!1),this.addTo(t))};if(c){let i=f(c,this.h0),s=f(c,l.buildingID);f=this.level;let r=l.level??this.level,n=i.getFloor(f),a=s.getFloor(r),e=void 0!==l.height?l.height:this.e3,h=(void 0!==l.height&&(this.e3=l.height),a.height+e);f=n.height+this.i3;let o=new Gt;if(t){let t;return this.Ts.has("moveTo")?t=this.Ts.get("moveTo"):(t=new nn,this.Ts.set("moveTo",t)),t.Y([this.t,this.o,f]).Z([l.x,l.y,h]).K(u).J(t=>{this.t=t.destination[0],this.o=t.destination[1];var e=this.Zs.getWorldPosition(o).y;r!=this.level?e>=a.height&&this.levelr&&(d(c,i,s),this.level=r),this.i3=t.destination[2]-n.height):this.i3=t.destination[2]-a.height,this.Rg(),this.Zs.getWorldPosition(o).y===h&&(d(c,i,s),this.level=r,this.i3=h-a.height),l.update&&l.update({x:this.t,y:this.o,level:this.Ar,height:this.i3,buildingID:this.h0}),c.enableUpdateRender()}).$(()=>{this.t=l.x,this.o=l.y,this.i3=e,this.Rg(),l.finish&&l.finish(),c.enableUpdateRender()}),c.ot.lt(t.X()),t}d(c,i,s),this.level=l.level,this.i3=h-a.height,this.t=l.x,this.o=l.y,this.Rg(),l.finish&&l.finish(),c.enableUpdateRender()}}});class uE extends lE{constructor(t){super(t),this.collisitionVisible=!1,this.za=!0}get collision(){return this.Xa}set collision(t){this.Xa!==t&&(this.Xa=t,t=this.ur(E))&&t.Wt.Za()}addTo(t){super.addTo(t);t=this.ur(E);t&&(t.on("viewModeChanged",this.Da),t.on("zoom",this.Da),t.on("resize",this.Da),t.Wt.Za())}remove(){this.stop();var t=this.ur(E);t&&(t.off("viewModeChanged",this.Da),t.off("zoom",this.Da),t.off("resize",this.Da),super.remove(),t.Wt.Za(),t.enableUpdateRender())}Rg(){super.Rg(),this.Zs&&(this.Zs?.updateMatrixWorld(!0),this.Zs?.parent?.updateMatrixWorld(!0))}}class cE extends uE{constructor(t){super(t),this.Ti=p.IMAGE_MARKER,this.Xv=t.url,this.Ia=void 0!==t.size?t.size:32,this.s_=void 0!==t.depth&&t.depth,this.Kr=void 0!==t.opacity?t.opacity:1,this.Xa=void 0===t.collision||t.collision,this.yi=Ir.getCenterByAnchor(t.anchor),this.Da=this.Da.bind(this),this.s3=this.s3.bind(this)}get url(){return this.Xv}set url(t){this.Xv=t,this.Pr()}get opacity(){return this.Kr}set opacity(t){this.Kr=t,this.Pr()}get size(){return this.Ia}set size(t){this.Ia=t,this.Da()}jump(t){return k3(this,t)}stopJump(){return G3(this)}boost(t){return F3(this,t)}stopBoost(){return B3(this)}getRenderNode(){return this.Zs}}Object.assign(cE.prototype,{Bu(){var t;return!!this.Xv&&!!(t=this.ur(E))&&(t=this.E0(t),this.Zs=new E3(t),this.Zs.center.set(this.yi.x,this.yi.y),this.Zs.visible=this.collisitionVisible,this.Rg(),this.Da(),(this.Zs.mapNode=this).dv=!0)},Da(){var t=this.ur(E);t&&(H3(t.Wt,this),t.Wt.Za(),t.enableUpdateRender())},Pr(){var t=this.ur(E);t&&(this.Zs.material=this.E0(t),this.Da())},E0(t){var e=this.ur(m);return t.Wt.pl.du({url:this.Xv,needDepth:this.s_,opacity:this.Kr*e.Kr},()=>{this.Zs&&void 0!==this.Zs.material.userData.scaleRatio?this.Da():t.on("update",this.s3),t.enableUpdateRender()})},s3(){this.Zs&&void 0!==this.Zs.material.userData.scaleRatio&&(this.Da(),this.ur(E).off("update",this.s3))}});class fE extends uE{constructor(t){super(t),this.Ti=void 0!==t.type?t.type:p.TEXT_MARKER,this.Qm=void 0!==t.text?t.text:"",this.r3=void 0!==t.fontsize?t.fontsize:20,void 0!==t.fontSize&&(this.r3=t.fontSize),this.n3=t.fontFamily,this.yg=void 0!==t.fillColor?t.fillColor:"0,0,0",this.a3=void 0!==t.strokeColor?t.strokeColor:"255,225,255",this.h3=void 0!==t.strokeWidth?t.strokeWidth:1,this.o3=t.plateColor,this.l3=t.plateStrokeColor,this.s_=void 0!==t.depth&&t.depth,this.Xa=void 0===t.collision||t.collision,this.Kr=void 0!==t.opacity?t.opacity:1,this.Eg=void 0!==t.textAlign?t.textAlign:Am.Center,this.u3=t.anchor,this.yi=Ir.getCenterByAnchor(t.anchor),this.Ia=0,this.Da=this.Da.bind(this)}set size(t){this.Ia=t}get size(){return this.Ia}get text(){return this.Qm}set text(t){this.Qm=t}get fillColor(){return this.yg}set fillColor(t){this.yg=t}get strokeColor(){return this.a3}set strokeColor(t){this.a3=t}get strokeWidth(){return this.h3}set strokeWidth(t){this.h3=t}get fontsize(){return this.r3}set fontsize(t){this.r3=t}get fontSize(){return this.r3}set fontSize(t){this.r3=t}get plateColor(){return this.o3}set plateColor(t){this.o3=t}get plateStrokeColor(){return this.l3}set plateStrokeColor(t){this.l3=t}update(){this.Pr()}setInitWriteRenderNodeFunction(t){this.c3=t}findParent(t){return this.ur(t)}updateSize(){this.Da()}getRenderNode(){return this.Zs}getScreenSize(){var t=null;return t=this.Zs?{width:this.Zs.children[0].material.map.image.width/2,height:this.Zs.children[0].material.map.image.height/2}:t}addFrameCallbacks(t){var e=this.ur(E);if(!e)return!1;e.ot.$s(t)}removeFrameCallbacks(t){var e=this.ur(E);if(!e)return!1;e.ot.$s(t)}}Object.assign(fE.prototype,{Bu(){var t=this.ur(E);if(!t)return!1;this.sg=!1;t=t.Wt,t=this.E0(t.pl).material,this.Zs=new R0,t=new E3(t);return t.center.set(this.yi.x,this.yi.y),this.Zs.add(t),this.Da(),this.Rg(),this.Zs.mapNode=this,(t.mapNode=this).dv=!0,this.c3&&(this.Zs=this.c3(this.Zs)),this.Zs.visible=this.collisitionVisible,!0},f3(t,e){if(t&&t.material){var i=this.ur(E);if(!i)return!1;i=i.Wt.B0(e);t.scale.set(i,i,i),t.scale.multiplyScalar(t.material.userData.mspriteScale||1),t.scale.setX(t.scale.x/t.material.userData.scaleRatio)}},Da(){var t=this.ur(E);if(!t)return!1;var e=this.Zs.isGroup?this.Zs.children[0]:this.Zs;"Sprite"!==e.type||e.isNoScale||(this.f3(e,this.Ia),t.enableUpdateRender())},Lg(t){t&&t.material&&(t.material.map&&t.material.map.dispose(),t.material.dispose())},Pr(){var t,e=this.ur(E);e&&(t=this.Zs.isGroup?this.Zs.children[0]:this.Zs,e=(this.Lg(t),this.E0(e.Wt.pl)).material,t.material=e,this.Da())},E0(t){var e=this.ur(m),t=t.au(this.Qm,{fontsize:this.sg?this.r3+2:this.r3,fillColor:rn.toRgba(this.yg),strokeColor:rn.toRgba(this.a3),plateColor:rn.toRgba(this.o3),plateStrokeColor:rn.toRgba(this.l3),strokeWidth:this.h3},{family:this.n3,needSize:!0,opacity:this.Kr*e.Kr,textAlign:this.Eg,drawText:!this.sg,callback:()=>{var t=this.ur(E);t&&t.enableUpdateRender()}});return this.Ia=t.size,{material:t}}});class dE extends v{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new ct(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&null!==t.element.parentNode&&t.element.parentNode.removeChild(t.element)})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this.center=t.center,this}}let vE=new Gt,pE=new Ht,mE=new Ht,gE=new Gt,_E=new Gt;class wE{constructor(t={}){let a=this,i,s,h,o,l={objects:new WeakMap},u=void 0!==t.element?t.element:document.createElement("div");function c(i){i.isCSS2DObject&&(i.element.style.display="none");for(let t=0,e=i.children.length;t{let e=[];return t.traverseVisible(function(t){t.isCSS2DObject&&e.push(t)}),e})(t).sort(function(t,e){return t.renderOrder!==e.renderOrder?e.renderOrder-t.renderOrder:l.objects.get(t).distanceToCameraSquared-l.objects.get(e).distanceToCameraSquared}),s=i.length;for(let t=0,e=i.length;t{var e=t.result.ndcPositions;for(let t=0;t{t.Zs.element.childNodes[0].style.display="block"})}}},hh(t){this.Ft.push(t);var e=Array.from(this.P.getRenderManager().getRenderList().keys());this.y3(t,e)&&t.Zs&&this.xa.add(t.Zs),this.un.render(this.xa,this.P.camera)}});class xE{constructor(){}static createShape(e,i){var s=new pw;if(Array.isArray(e[0])){var r=e[0];s.moveTo(r[0].x-i.x,r[0].y-i.y);for(let t=1;t{i.map.wrapS=Kt,i.map.wrapT=Kt,i.needsUpdate=!0,i.visible=!0});var e=new ct(t.x,t.y),e=xE.createShapeBufferGeometryByCenter(this.Id,e,!!this.Xv),s=this.E3(e),e=($3(e,i,this),this.Zs.position.set(0,this.Jt,0),new Oy({color:this.Q_,width:this.e_}));return e.P=this,e.O_(s,t),this.Bg=s,(this.Rf=e).Zs.renderOrder=1,this.Zs.add(e.Zs),t.enableUpdateRender(),t.on("resize",this.g_),!0},g_(){var t=this.ur(E);t&&null!==this.Rf&&this.Rf.Zs&&(this.Rf.Zs.material.resolution=new ct(t.bt.renderer.domElement.clientWidth,t.bt.renderer.domElement.clientHeight),t.enableUpdateRender())},Rg(){this.Zs&&this.Zs.position.set(0,this.Jt,0),this.ur(E).enableUpdateRender()},x3(){var t=this.ur(E);if(!t)return!1;var e=t.Wt,i=this.ur(m);this.Zs.material=e.pl.Yl({url:this.Xv,color:this.vm,opacity:this.Kr*i.Kr,visible:!this.Xv},()=>{this.Zs.material.map.wrapS=Kt,this.Zs.material.map.wrapT=Kt,this.Zs.material.needsUpdate=!0,this.Zs.material.visible=!0}),t.enableUpdateRender()},Pr(){this.x3(),this.Rf.update()}});class SE extends Ch{constructor(){super();var t=new Float32Array([-.5,0,-.5,0,0,.5,0,-.5,1,0,.5,0,.5,1,1,-.5,0,.5,0,1]),t=new V0(t,5);this.setIndex([0,1,2,0,2,3]),this.setAttribute("position",new W0(t,3,0,!1)),this.setAttribute("uv",new W0(t,2,3,!1))}}class TE extends lE{constructor(t){super(t),this.Ti=p.LOCATION_MARKER,this.Xv=t.url,this.Ia=void 0!==t.size?t.size:20,this.Ar=void 0!==t.level?t.level:1,this.Kr=void 0!==t.opacity?t.opacity:1,this.h0=t.buildingID,this.b3=0,this.Da=this.Da.bind(this),this.Rg=this.Rg.bind(this),this.e3=t.height??1,this.i3=this.e3}get buildingID(){return this.h0}get level(){return this.Ar}set level(t){this.Ar!==t&&(this.Ar=t,t=this.ur(E),this.remove(!1),this.addTo(t))}get opacity(){return this.Kr}set opacity(t){this.Kr=t,this.dv&&this.Pr()}get url(){return this.Xv}set url(t){this.Xv=t,this.Pr()}get size(){return this.Ia}set size(t){this.Ia=t,this.Da()}get height(){return this.e3}set height(t){this.i3=t,this.e3=t,this.Rg()}moveTo(t){return this.t3(t)}rotateTo(e){let i=this.ur(E);if(!i)return!1;var s=e.duration||.5,r=this.Zs.rotation.y,n=e.heading%360*u.DEG2RAD;let t=0;n=r+(t=n-r!=0?Math.sin(n-r)/Math.abs(Math.sin(n-r))*Math.acos(Math.cos(n-r)):t);if(e.animate){let t;this.Ts.has("rotation")?((t=this.Ts.get("rotation")).finish(),t.Y([r]),t.Z([n])):(t=new nn({src:[r],dest:[n]}),this.Ts.set("rotation",t)),t.K(s).J(t=>{this.Zs&&(this.Zs.rotation.y=t.destination[0],this.b3=t.destination[0],i.enableUpdateRender())}).$(()=>{i.ot.ht(t),i.enableUpdateRender(),e.finish&&e.finish()}),i.ot.lt(t.X())}else this.Zs&&(this.Zs.rotation.y=n,this.b3=n,i.enableUpdateRender())}addTo(t){var e=this.Vs(t);e&&(super.addTo(e),t.on("zoom",this.Da),t.on("resize",this.Da),t.on("viewChanged",this.Da))}remove(t=!0){t&&this.stop();t=this.ur(E);if(!t)return!1;t.off("zoom",this.Da),t.off("resize",this.Da),t.off("viewChanged",this.Da),super.remove()}getRenderNode(){return this.Zs}}Object.assign(TE.prototype,{Bu(){var t,e,i=this.ur(E);return!!i&&(e=new SE,t=this.E0(i),this.Zs=new L(e,t),this.Zs.renderOrder=1,(this.Zs.mapNode=this).Rg(),this.Zs.rotation.set(0,this.b3,0,"XYZ"),t.side=Yt,this.Zs.updateMatrixWorld(!0),e=i.Wt.k0(this.Zs,this.Ia),this.Zs.scale.set(e,e,e),this.Zs.visible=this.Qs,this.P.xa.add(this.Zs),this.dv=!0)},Da(){var e=this.ur(E);if(e){var i=this.Zs.position;let t=!1;(t=!(isNaN(i.x)||isNaN(i.y)||isNaN(i.z))&&"number"==typeof i.x&&"number"==typeof i.y&&"number"==typeof i.z?t:!0)||(i=e.Wt.k0(this.Zs,this.Ia),this.Zs.scale.set(i,i,i),e.enableUpdateRender())}},Rg(){var t,e=this.ur(E);e&&(t=this.Vs(e))&&(this.Zs.position.set(this.t-e.x,t.Jt+this.i3,-this.o+e.y),this.needUpdateBound=!0,e.enableUpdateRender())},E0(t){return t.Wt.pl.ql({url:this.Xv,flipY:!1,opacity:this.Kr},i=>{var s=i.map.image;if(s.width!==s.height){var r=nt.document.createElement("canvas"),n=r.getContext("2d"),a=s.width,h=s.height;let t=0,e=0;h=this.N3.max&&(this.N3={max:100,min:0}),this.I3=void 0!==e.quality?e.quality:1024,this.Pv=void 0===e.isPlane||e.isPlane,this.P3=this.Pv,this.A_=void 0!==e.gradient?e.gradient:{.45:"rgb(0,0,255)",.55:"rgb(0,255,255)",.65:"rgb(0,255,0)",.95:"yellow",1:"rgb(255,0,0)"},this.D3=e.maxOpacity,void 0===this.D3&&(this.D3=1),void 0!==this.Kr&&(this.D3=this.Kr),this.O3=e.minOpacity,void 0===this.O3&&(this.O3=0),this.Sn=e.blur,void 0===this.Sn&&(this.Sn=.85),this.U3=e.scaleRadius,void 0===this.U3&&(this.U3=!0),this.Jt=e.height,void 0===this.Jt&&(this.Jt=1),this.Pv||(this.U3=!0),this.Id=[],this.F3=null,this.qs=null,this.B3=null,this.H3=0,this.hr=null,this.Ov=null,this.V3=void 0,this.z3=null,this.Uv=null,this.W3=null,this.j3=null,this.X3=null,this.Y3=null,this.w_=this.w_.bind(this),this.Z3=11,this.q3=22,this.K3=null,this.J3=` + #include + #include + varying vec3 vPosition; + void main(){ + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + vPosition=vec3(modelMatrix * vec4( position, 1.0 )); + gl_Position = projectionMatrix * mvPosition; + #include + } + `,this.Q3=` + varying vec3 vPosition; + uniform sampler2D heatTexture; + uniform vec2 boundCenter; + uniform vec2 boundSize; + #include + void main() { + #include + vec2 uvheat=vec2((vPosition.x - (boundCenter.x - boundSize.x/2.0)) / boundSize.x , (vPosition.z - (boundCenter.y-boundSize.y/2.0)) / boundSize.y); + vec4 color=texture2D(heatTexture,uvheat); + gl_FragColor = color; + } + `}get bound(){var t,e;return!0===this.needUpdateBound&&null!==this.hr&&(this.mi.reset(),t=this.hr.getLayers(p.MODEL_LAYER)[0],!1===this.Pv?(e=this.hr.getLayers(p.EXTENT_LAYER)[0],t&&this.mi.expand(t.bound),e&&this.mi.expand(e.bound)):t&&this.mi.expand(t.bound),this.needUpdateBound=!1),this.mi.clone()}get x(){return this.t}get y(){return this.o}get height(){return this.Jt}set height(t){if(this.P3&&(this.Jt=t,this.Rg(),null!==this.L3))for(var[e,i]of this.L3.extendDataMap)""+e!=""+this.W3.ID&&(i.heatMap.height=t)}get opacity(){return this.Kr}set opacity(t){if(this.Kr=t,this.D3=this.Kr,this.z3&&(this.z3.configure({radius:this.i_,valueRange:this.N3,maxOpacity:this.D3,minOpacity:this.O3,gradient:this.A_,blur:this.Sn}),null!==this.L3))for(var[e,i]of this.L3.extendDataMap)""+e!=""+this.W3.ID&&(i.heatMap.opacity=t)}set valueRange(t){if(void 0!==t.max&&(this.N3.max=t.max),void 0!==t.min&&(this.N3.min=t.min),this.N3.min>=this.N3.max&&(this.N3={max:100,min:0}),null!==this.L3)for(var[e,i]of this.L3.extendDataMap)""+e!=""+this.W3.ID&&(i.heatMap.valueRange=t)}get valueRange(){return this.N3}get level(){return this.hr.level}get visible(){return super.visible}set visible(t){if(this.Qs!==t)if(super.visible=t,this.Pv){if(this.U3?this.Zs&&(this.Zs.visible=t):(this.Id.length=0,this.tM(),this.update()),this.st.enableUpdateRender(),null!==this.L3)for(var[e,i]of this.L3.extendDataMap)""+e!=""+this.W3.ID&&(i.heatMap.visible=t)}else t?this.P.Dv(this.Ov,this):this.P.Dv(null,this),this.st.enableUpdateRender()}simulate(t){this.H3=t}clearDataSource(){this.qs=null,this.Id=[],null!==this.L3&&this.L3.dataAnalyser(this.hr,null)}addPoint(t,e,i){var s;t&&e&&i&&(null===this.L3?(s=this.hr.getLayers(p.EXTENT_LAYER)[0].bound,(s=this.eM(t,e,s))&&(s.x=Math.round(s.x),s.y=Math.round(s.y),s.value=i,s.radius=this.i_,this.Id.push(s))):this.L3.dataAnalyser(this.hr,[{x:t,y:e,value:i}]))}addDataSource(t){this.qs=t,this.Id=[],null!==this.L3&&(this.L3.dataAnalyser(this.hr,null),this.L3.dataAnalyser(this.hr,t))}update(){if(null!==this.L3){var t,e,i=this.L3.extendDataMap.get(""+this.W3.ID);this.qs=i.datas,this.Id=[];for([t,e]of this.L3.extendDataMap)""+t!=""+this.W3.ID&&(e.heatMap.addDataSource(e.datas),e.heatMap.update())}0===this.Id.length&&null!=this.qs&&(i=this.W3,this.U3?this.iM(i.bound):this.tM()),nt.environment===I.WX&&(this.B3.width=this.F3.width,this.B3.height=this.F3.height),this.z3.setData({max:this.N3.max,min:this.N3.min,data:this.Id}),this.sM(),this.Pv?this.U3?(i=this.Zs.material.uniforms.heatTexture.value,this.Zs.material.uniforms.heatTexture.value=this.Ov,i.dispose()):this.rM():this.P.Dv(this.Ov,this),this.st.enableUpdateRender()}addTo(i){this.hr=i;let s=null;if(this.Pv){let t=null,e=null;s=void 0===this.C3?(this.L3=new UE(this.st,this.eh),e=this.L3.setExtendDataMap(i),(t=this.L3.extendDataMap.get(e)).heatMap=this,t.extend):this.C3,null!==this.L3&&(this.L3.dataAnalyser(i,this.qs),this.qs=t.datas,this.L3.createHeatMap(e))}else if(s=this.hr.getLayers(p.EXTENT_LAYER)[0],null!==this.qs){var e=[],r=(e.push({x:s.bound.min.x,y:s.bound.min.y}),e.push({x:s.bound.min.x,y:s.bound.max.y}),e.push({x:s.bound.max.x,y:s.bound.max.y}),e.push({x:s.bound.max.x,y:s.bound.min.y}),[]);for(let t=0;t{this.Ov.image=this.image,this.Zs.material.map=this.Ov,this.Zs.material.map.needsUpdate=!0,this.Zs.material.needsUpdate=!0,this.st.enableUpdateRender()},this.image.src=t):(e=new c,(this.Ov=e).minFilter=$t,nt.textureHelper.createImage({url:t,onload:t=>{this.Ov.image=t,this.Ov.needsUpdate=!0,this.image=t,this.Zs.material.map=this.Ov,this.Zs.material.map.needsUpdate=!0,this.Zs.material.needsUpdate=!0,this.st.enableUpdateRender()}}))):this.U3?(this.Ov=new X0(this.uM(this.B3)),this.Ov.flipY=!1,this.Ov.minFilter=V,this.Ov.generateMipmaps=!1):(this.lM(),this.Ov=new c(this.uM(this.B3)))},E0(){let t=null;return this.U3?t=new Vh({uniforms:{heatTexture:{value:this.Ov},boundCenter:{value:new ct(this.Uv.center.x-this.st.x,this.st.y-this.Uv.center.y)},boundSize:{value:new ct(this.Uv.size.x,this.Uv.size.y)}},transparent:!0,depthWrite:!0,depthTest:!1,vertexShader:this.J3,fragmentShader:this.Q3}):((t=new so(16777215)).opacity=1,t.transparent=!0,t.map=this.Ov,t.map&&(t.map.needsUpdate=!0),t.depthTest=!1,t.needsUpdate=!0),t},Bu(){if(!this.dv){var t,e,i=this.W3.Zs;if(!this.Pv||i)if(this.Ov=null,this.sM(),this.Pv)this.U3?(t=i.userData,i.userData={},e=i.clone(),i.userData=t,e.name="heatMap",e.scale.z=.001,e.position.y+=this.Jt,i=this.E0(),e.material=i,this.Zs=e,this.Zs.mapNode=this):this.rM(),this.dv=!0;else{this.dv=!0;var s=this.hr.getModelMeshs();for(let t=0;t=this.I3||r.height>=this.I3)&&(r.width>=r.height?(t=r.height/r.width,r.width=this.I3,r.height=parseInt(this.I3*t)):(t=r.width/r.height,r.height=this.I3,r.width=parseInt(this.I3*t)))}else{var e=this.fM(),t=Math.round(i/e),e=Math.round(s/e);r={width:t,height:e}}return r},uM(t){let e=ws.floorPowerOfTwo(t.width),i=ws.floorPowerOfTwo(t.height);this.U3||(e>i?4096e[t].x)&&(i=e[t].x),(null===s||s>e[t].y)&&(s=e[t].y),(null===r||r{this.Zs.rotation.y=t.destination[0],this.Xm=t.destination[1],s.enableUpdateRender()}).$(()=>{this.Zs.rotation.y=e,this.Xm=i.heading,s.enableUpdateRender(),i.finish&&i.finish()}),s.ot.lt(t.X())}else this.Zs.rotation.y=e,this.Xm=i.heading,s.enableUpdateRender(),i.finish&&i.finish();return this.Ts.get("rotation")}}startAction(t,e){var i=this.ap[t],e=(i&&(e&&(i.clampWhenFinished=!0,i.loop=ni),this.Mm&&this.Mm===t?(i.time=this.ym,i.paused=!1,i.play(),this.Mm=null,this.ym=null):(this.Mm!==t&&(this.Mm=null,this.ym=null),i.reset().setEffectiveTimeScale(1).setEffectiveWeight(1).play())),this.ur(E));e&&e.on("beforeRender",this.gm)}getAction(){return this.ap}getClip(t){return this.ap[t].n1}getMixer(){return this.s1}stopAction(t){var e=this.ur(E),e=(e&&e.off("beforeRender",this.gm),this.ap[t]);e&&(e.paused=!0,this.Mm=t,this.ym=e.time)}getActionNames(){return Object.keys(this.ap)}remove(){this.stop(),this.Rm.forEach(t=>{t.stop()}),this.Zs&&this.Zs.bloom&&this.Zs.bloom.remove(this);var t=this.ur(E);t&&this.s1&&t.ot.zm(this.s1),super.remove()}dispose(){super.dispose(),this.remove(),this.Zs&&(this.Zs.mapNode=void 0,this.Zs=void 0),this.dv=!1,this.xM()}getRenderNode(){return this.Zs}getActions(){return this.Zs?Promise.resolve(this.Rm):new Promise(t=>{let e=()=>{this.Zs?t(this.Rm):setTimeout(e,50)};e()})}}Object.assign(BE.prototype,{ROOT:"root",yM(t){var e;this.Ar!==t&&(this.Ar=t,t=this.ur(E))&&(e=this.Hv,this.Hv=!1,this.remove(),t=this.Vs(t),this.addTo(t),this.Hv=e)},Vs(t){return(this.h0?t.getBuilding(this.h0):t).getFloor(this.Ar)},Bu(){if(!this.dv){let s=this.ur(E);if(!s)return!1;this.dv=!0;var n=this.Xv.split(".");let r=n[n.length-1].toLocaleLowerCase();this.fileExtension=r;n={gltf:{},glb:{},fbx:nt.window.fengmap?.FBXLoader};if(n[r]){let t,e,i=(t=("glb"===r||"gltf"===r?(e=s.Wt.Zf).Vo:(e=new n[r]).load).bind(e),{glb:t=>t.scene,fbx:t=>t});return i.gltf=i.glb,t(this.Xv,t=>{if(this.dv){if(this.Zs=i[r](t),this.Zs.visible=this.Qs,this.Xm&&(this.Zs.rotation.y=this.Xm%360*u.DEG2RAD),this._M&&(this.Zs.rotation.x=this._M%360*u.DEG2RAD),this.Pa(),(this.Zs.mapNode=this).P.xa.add(this.Zs),0{let i=t.destination[0];this.Zs.traverse(t=>{var e;"Mesh"!==t.type&&"SkinnedMesh"!==t.type||("glb"===this.fileExtension||"gltf"===this.fileExtension?(t.material.transparent=!0,e=t.material.userData.sourceOpacity,t.material.opacity=e*i,s.enableUpdateRender()):Array.isArray(t.material)?(t.material.forEach(t=>{var e=t.userData.sourceOpacity;t.transparent=!0,t.opacity=e*i}),s.enableUpdateRender()):(e=t.material.userData.sourceOpacity,t.material.transparent=!0,t.material.opacity=e*i))})}).$(()=>{e.callback&&e.callback(),s.ot.ht(t),s.enableUpdateNode()}).X(),s.ot.lt(t)}},Pa(){if(this.Zs){var t=this.ur(E);if(!t)return!1;var e=this.Zs?.userData?.sourceScale||new C3(1,1,1);this.Zs.scale.copy(e).multiplyScalar(this.gM),t.enableUpdateRender()}},bM(t){void 0===t.userData.sourceOpacity&&(t.userData.sourceOpacity=t.opacity),void 0===t.userData.sourceTransparent&&(t.userData.sourceTransparent=t.transparent)},SM(t,e){e=null!==this.Kr?this.Kr*e.Kr:void 0!==t.userData.sourceOpacity?t.userData.sourceOpacity*e.Kr:t.opacity*e.Kr;return{opacity:e,transparent:t.userData.sourceTransparent||e<1}},Pr(){if(this.Zs){let h=this.ur(E),o=this.ur(m);var t=this.wM.get(this.ROOT);function l(t){for(var e in t)t[e]&&t[e].isTexture&&(t[e].colorSpace=bi)}this.TM(this.Zs,t,(e,t)=>{var i={color:t},s=this.AM(e.material,o,i);if("glb"===this.fileExtension||"gltf"===this.fileExtension)if(Array.isArray(e.material.length))for(let t=0;t{t=e.getInteracations().controls.enabled,e.getInteracations().controls.enabled=!1,e.getInteracations().controls.resetState()},this.FM=()=>{null!==t&&(e.getInteracations().controls.enabled=t,e.getInteracations().controls.resetState(),t=null)},this.Zs.element.childNodes[0].addEventListener("mouseenter",this.UM),this.Zs.element.childNodes[0].addEventListener("mouseleave",this.FM)}e.enableUpdateRender()}dispose(t){t||this.remove(),this.Zs&&(this.isInputElement&&(this.Zs.element.childNodes[0].removeEventListener("mouseenter",this.UM),this.Zs.element.childNodes[0].removeEventListener("mouseleave",this.FM)),this.Zs.mapNode=void 0,this.Zs=void 0),this.dv=!1}getRenderNode(){return this.Zs}}Object.assign(kE.prototype,{Bu(){var t=document.createElement("div"),e=document.createElement("div");e.style.position="absolute";let i=!(e.style.pointerEvents="all");void 0===this._3||void 0===this.w3?i=!0:(e.style.width=this._3+"px",e.style.height=this.w3+"px"),e.style.fontSize=this.CM+"px",e.style.opacity=this.Kr,i||(s=this.BM(),e.style.top=s.top,e.style.left=s.left),"string"==typeof this.NM?e.innerHTML=this.NM:e.appendChild(this.NM),t.appendChild(e);var s=new dE(t);return this.Zs=s,this.Zs.element.childNodes[0].style.display="none",(this.Zs.mapNode=this).dv=!0,this.Ht=this.Zs.uuid,i&&this.En(),!0},En(){let i=this,s=null,r=document.createElement("div"),n=this.Zs.element.childNodes[0];r.style.position="absolute",void 0===this.IM?r.style.width="fit-content":r.style.width=this.IM+"px",void 0===this.PM?r.style.height="fit-content":r.style.height=this.PM+"px",r.style.fontSize=this.CM+"px",r.innerHTML=n.innerHTML,document.body.appendChild(r),function t(){if(r.parentNode){null!==s&&clearTimeout(s);let t=r.getBoundingClientRect(),e=(i._3=t.width,i.w3=t.height,i.BM());n.style.width=i._3+"px",n.style.height=i.w3+"px",n.style.top=e.top,n.style.left=e.left,r.parentNode.removeChild(r)}else s=setTimeout(t(),1)}()},BM(){let t,e;switch(this.u3){case Nr.CENTER:t=-this._3/2,e=-this.w3/2;break;case Nr.RIGHT_BOTTOM:t=-this._3,e=-this.w3;break;case Nr.LEFT_BOTTOM:t=0,e=-this.w3;break;case Nr.RIGHT_TOP:t=-this._3,e=0;break;case Nr.LEFT_TOP:t=0,e=0;break;case Nr.RIGHT:t=-this._3,e=-this.w3/2;break;case Nr.LEFT:t=0,e=-this.w3/2;break;case Nr.BOTTOM:t=-this._3/2,e=-this.w3;break;case Nr.TOP:t=-this._3/2,e=0}return this.DM={left:t,top:e},{left:t+"px",top:e+"px"}},m3(){var t=this.P.P;if(!this.DM)return null;var e=t.camera;this.Zs.updateMatrixWorld(!0);var e=(new Gt).setFromMatrixPosition(this.Zs.matrixWorld).applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix),i=t.bt.renderer.domElement.clientWidth,t=t.bt.renderer.domElement.clientHeight,s=e.x,e=e.y;return{leftTop:new ct(s-this._3/i,e+this.w3/t),rightDown:new ct(s+this._3/i,e-this.w3/t)}},OM(t){var e,i=this.P.P,s={};for(e in t)s[e]=t[e];s.offsetX=t.clientX,s.offsetY=t.clientY,i.Vr.W(s)},Pr(){this.Zs.element.childNodes[0].style.opacity=this.hr.Kr}});class GE{constructor(t){this.kM=t.origon,this.Ki=t.target,this.GM=null,this.HM=null,this.VM=null,this.zM=null,this.WM=null,this.jM=null,this.XM=null,this.YM=null,this.Bu()}transform(t){let e=t.x-this.GM.x,i=t.y-this.GM.y;var t=this.HM.x*e+this.HM.y*i,s=this.VM.x*e+this.VM.y*i;let r=t/this.zM.x,n=s/this.zM.y,a=r*this.YM.x,h=n*this.YM.y;return{x:this.WM.x+this.jM.x*a+this.XM.x*h,y:this.WM.y+this.jM.y*a+this.XM.y*h}}}Object.assign(GE.prototype,{Bu(){!Array.isArray(this.kM)||!Array.isArray(this.Ki)||this.kM.length<3||this.Ki.length<3||(this.GM=this.kM[0],this.HM={x:this.kM[1].x-this.kM[0].x,y:this.kM[1].y-this.kM[0].y},this.VM={x:this.kM[2].x-this.kM[0].x,y:this.kM[2].y-this.kM[0].y},this.zM={x:G.ze(this.HM),y:G.ze(this.VM)},this.WM=this.Ki[0],this.jM={x:this.Ki[1].x-this.Ki[0].x,y:this.Ki[1].y-this.Ki[0].y},this.XM={x:this.Ki[2].x-this.Ki[0].x,y:this.Ki[2].y-this.Ki[0].y},this.YM={x:G.ze(this.jM),y:G.ze(this.XM)},this.HM.x/=this.zM.x,this.HM.y/=this.zM.x,this.VM.x/=this.zM.y,this.VM.y/=this.zM.y,this.jM.x/=this.YM.x,this.jM.y/=this.YM.x,this.XM.x/=this.YM.y,this.XM.y/=this.YM.y)}});class HE{constructor(t){this.Ia=t.size,this.Ws=t.rotation,this.yi=t.center}get min(){return{x:this.yi.x-this.Ia.x/2,y:this.yi.y-this.Ia.y/2}}get max(){return{x:this.yi.x+this.Ia.x/2,y:this.yi.y+this.Ia.y/2}}get center(){return{x:this.yi.x,y:this.yi.y}}get rotation(){return this.Ws}get size(){return{x:this.Ia.x,y:this.Ia.y}}clone(){return new HE({size:this.Ia,center:this.yi,rotation:this.Ws})}valid(){return!(this.min.x>this.max.x||this.min.y>this.max.y)}expand(t){t&&t.valid()&&(t.min.xthis.max.x&&(this.max.x=t.max.x),t.max.y>this.max.y)&&(this.max.y=t.max.y)}}let VE={Default:1,Legacy:2,Classic:4,Custom:8};class zE{constructor(t,e){this.ZM=t,this.qM=e,this.KM={[VE.Default]:{FMExtentLayer:[{name:"DirectionalLight",color:11579568,intensity:.95,position:{x:58,y:65,z:40},id:0},{name:"AmbientLight",color:11579568,intensity:.85,id:1},{name:"DirectionalLight",color:6447714,intensity:.65,position:{x:-100,y:0,z:45},id:2}],FMDynamicModelLayer:[{name:"DirectionalLight",color:11579568,intensity:.95,position:{x:58,y:65,z:45},id:0},{name:"AmbientLight",color:11579568,intensity:.85,id:1},{name:"DirectionalLight",color:6447714,position:{x:-100,y:0,z:45},intensity:.45,id:2}],FMModelLayer:[{name:"DirectionalLight",color:11645361,intensity:.95,position:{x:58,y:65,z:40},id:0},{name:"AmbientLight",color:11645361,intensity:.85,id:1},{name:"DirectionalLight",color:6513507,position:{x:-100,y:0,z:45},intensity:.65,id:2}],FMExternalModelLayer:[{name:"DirectionalLight",color:11579568,intensity:.95,position:{x:58,y:65,z:45},id:0},{name:"AmbientLight",color:11579568,intensity:.85,id:1},{name:"DirectionalLight",color:6447714,position:{x:-100,y:0,z:45},intensity:.45,id:2}]},[VE.Legacy]:{FMExtentLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:7631988,intensity:1,id:1},{name:"DirectionalLight",color:3355443,intensity:1,position:{x:-.5,y:1,z:-1},id:2}],FMExternalModelLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:16777215,intensity:.46,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}],FMModelLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:7631988,intensity:1,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}],FMDynamicModelLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:7631988,intensity:1,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}]},[VE.Classic]:{FMExtentLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:7631988,intensity:1,id:1},{name:"DirectionalLight",color:3355443,intensity:1,position:{x:-.5,y:1,z:-1},id:2}],FMExternalModelLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:16777215,intensity:.46,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}],FMModelLayer:[{name:"DirectionalLight",color:8947848,intensity:1.2,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:7631988,intensity:1,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}],FMDynamicModelLayer:[{name:"DirectionalLight",color:8947848,intensity:.9,position:{x:-1,y:1,z:1},id:0},{name:"AmbientLight",color:16777215,intensity:.33,id:1},{name:"DirectionalLight",color:3355443,position:{x:-.5,y:1,z:-1},intensity:1,id:2}]}}}getConfig(){return this.ZM==VE.Custom?this.qM:this.KM[this.ZM]}}class WE{constructor(){this.st=null,this.rn={},this.O=(new Date).getTime(),this.V=this.V.bind(this)}replace(t,e,i){this.getTextureNames(t).indexOf(e)<0?console.warn(e+"不是一个包含视频或gif的纹理,无法替换"):(this.JM(t.FID,e),0<=i.indexOf(".mp4")||0<=i.indexOf(".webm")||0<=i.indexOf(".ogg")?this.Vp(i,t,e):0<=i.indexOf(".gif")?this.Pp(i,t,e):(0<=i.indexOf(".jpg")||0<=i.indexOf(".png"))&&this.$M(i,t,e),t.multiMediaTool.replace(e),null===this.st&&(this.st=t.parent.parent.parent.parent,this.st.on("update",this.V)))}reset(t,e){this.JM(t.FID,e),t.multiMediaTool.reset(e)}dispose(){for(var t in this.rn){var e=t.split("_");this.reset(this.rn[t].externalModel,e[1])}this.st.off("update",this.V)}getTextureNames(t){return t.multiMediaTool.textureNames}}Object.assign(WE.prototype,{JM(t,e){var i=this.rn[t+"_"+e];if(i&&"video"===i.type)document.getElementById(i.texture.video_id).parentNode.removeChild(document.getElementById(i.texture.video_id)),i.texture.dispose();else if(i&&"gif"===i.type)for(let t=0;t{var t=document.createElement("canvas");t.width=512,t.height=512,t.getContext("2d").drawImage(s,0,0,512,512),this.rn[e.FID+"_"+i]={type:"gif",canvascount:0,externalModel:e,canvasArray:[t],isnewupdate:!0}},s.src=t},Vp(t,s,r){let n=this,e=(this.Gp=t,null);var i=document.createElement("div");i.style.display="none";let a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)});var h=a+"_div";i.setAttribute("id",h),i.innerHTML='',document.body.appendChild(i),function t(){let i=document.getElementById(a);i?(null!==e&&clearTimeout(e),i.addEventListener("loadeddata",t=>{var e=new EM(i);e.video_id=a+"_div",e.name=r,s.isGltf&&(e.flipY=!1),n.rn[s.FID+"_"+r]={type:"video",externalModel:s,texture:e,isnewupdate:!0},i.play()})):e=setTimeout(t,0)}()},Pp(t,e,i){var s=document.createElement("div");s.style.display="none",document.body.appendChild(s);let r=new Image;r.crossOrigin="Anonymous",r.onload=()=>{this.rn[e.FID+"_"+i]={type:"gif",canvascount:0,externalModel:e,canvasArray:[],isnewupdate:!0},s.appendChild(r);var t=new MM({gif:r});t.load(()=>{this.Dp(t,e.FID,i,s)})},r.src=t},Dp(s,r,n,t){let a=this,h=null,e=s.get_length(),o=1;this.rn[r+"_"+n].canvascount=0,function i(){if(o>e)document.body.removeChild(t),null!==h&&clearTimeout(h);else{s.move_to(o);let t=document.createElement("canvas"),e=(t.width=512,t.height=512,t.getContext("2d"));e.drawImage(s.get_canvas(),0,0,512,512),a.rn[r+"_"+n].canvasArray.push(t),o++,h=setTimeout(i,0)}}()},QM(a){let r=this;var t=a.getRenderNode();function e(e){var i=a.multiMediaTool.oldMaterial[e.name];if(Array.isArray(i))for(let t=0;t{"Mesh"===t.type&&e(t)}):e(t))},V(){var t,e,i=(new Date).getTime(),s=i-this.O;50<=s&&(this.O=i);let r=[];for(t in this.rn)(e=>{let i=!0;for(let t=0;t=this.x&&t.y>=this.y&&t.xt.x&&this.yt.y}}class XE{constructor(t,e=1,i=8,s=0){this.bound=t,this.maxPoints=e,this.maxDepth=i,this.depth=s,this.points=[],this.nodes=[]}insert(t,e){if(this.bound.contains(t)){if(e){if(0===this.nodes.length||this.depth>=this.maxDepth)return this.points.push(t),!0}else if(this.points.length=this.maxDepth)return this.points.push(t),!0;0===this.nodes.length&&this.split();for(var i of this.nodes)if(i.insert(t,e))return!0}return!1}delete(i){let s=this;var t=(()=>{let e=-1;for(let t=0;t{let e=-1;for(let t=0;t{e.push({x:t.marker.x,y:t.marker.y,level:this.Ar,buildingID:i,isCluster:"multiple"===t.type,points:t.points||[]})}),Ir.compareArrays(this.my,e)||(this.my=e,this.ty(e))}function s(){return e.ny&&e.iy}},Ty(t){for(var[e,i]of this.hy)if(""+t!=""+e)for(let t=0;t",h={marker:o.marker,count:s[t].num},this.iy(h)):o.marker.content=this.Ly(s[t].num)),i.push(t),e.push(o))}s=t(i);for(let t=i.length=0;t{let s=!0;for(let t=0;t'+t+"":this.NM.replace("${num}",""+t)},Cy(e,i){if(1"),count:e.num},this.iy(r),(i||this.py).push({points:e.markers,type:"multiple",num:e.num,marker:s})):(r=this.Ry(e,this.Ly(e.num)),(i||this.py).push({points:e.markers,type:"multiple",num:e.num,marker:r}));else{let t=null;t=this.sy&&(s={x:e.x,y:e.y},this.sy(s),t=s.marker)||new cE({url:this.gy,collision:!1,x:e.x,y:e.y});var s,r=this.Vs(t.type);t.addTo(r),(i||this.py).push({type:"single",num:e.num,marker:t})}},Ry(t,e){let i=new nt.FMDomMarker({map:this.st,x:t.x,y:t.y,collision:!1,anchor:Nr.BOTTOM,content:e});e=this.Vs(i.type);return i.addTo(e),i.getRenderNode().point=t,nt.environment==I.BROWSER&&(i.getRenderNode().element.addEventListener("mousedown",t=>{this.O=(new Date).getTime()}),i.getRenderNode().element.addEventListener("mouseup",t=>{if(!(200<(new Date).getTime()-this.O)){let t=this.h0;t===this.st.getMapOptions().buildingID&&(t=null);var e=i.getRenderNode().point;this.Yt.Xt({type:"click",buildingID:t,coords:{x:e.x,y:e.y},level:this.Ar,target:i,markers:s(e.markers)})}}),i.getRenderNode().element.addEventListener("touchstart",t=>{this.O=(new Date).getTime()}),i.getRenderNode().element.addEventListener("touchend",t=>{if(!(200<(new Date).getTime()-this.O)){let t=this.h0;t===this.st.getMapOptions().buildingID&&(t=null);var e=i.getRenderNode().point;this.Yt.Xt({type:"click",buildingID:t,coords:{x:e.x,y:e.y},level:this.Ar,target:i,markers:s(e.markers)})}})),i;function s(e){var i=[];for(let t=0;t{var i=[];for(let t=0;t",""),t.fragmentShader=` + #include + + ${t.fragmentShader} + `,QE(t),t.fragmentShader=t.fragmentShader.replace(/}(\s*)$/g,` + if(uDepthPeel != 0) { + #ifdef STANDARD + gl_FragColor.a = diffuseColor.a; + #else + gl_FragColor.a = opacity; + #endif + gl_FragColor.rgb *= gl_FragColor.a; + } + } + `)}function QE(t){t.uniforms.uScreenSize=qE.uScreenSize,t.uniforms.uPrevDepthTexture=qE.uPrevDepthTexture,t.uniforms.uLayer=qE.uLayer,t.uniforms.uDepthOffset=qE.uDepthOffset,t.uniforms.uDepthPeel=qE.uDepthPeel,t.vertexShader=t.vertexShader.replace("void main() {",` + varying vec2 vFMHighPrecisionZW; + void main() {`),t.vertexShader=t.vertexShader.replace(/}$/gm,` + vFMHighPrecisionZW = gl_Position.zw; + } + `),t.fragmentShader=` + uniform vec2 uScreenSize; + uniform sampler2D uPrevDepthTexture; + uniform int uLayer; + uniform int uDepthPeel; + uniform float uDepthOffset; + varying vec2 vFMHighPrecisionZW; + ${t.fragmentShader} + `,t.fragmentShader=t.fragmentShader.replace(/}(\s*)$/g,` + if(uDepthPeel == 0) return; + + if(uLayer != 0 ){ + vec2 screenPos = gl_FragCoord.xy * uScreenSize; + float prevDepth = unpackRGBAToDepth(texture2D(uPrevDepthTexture, screenPos)); + float fragCoordZ = 0.5 * vFMHighPrecisionZW[0] / vFMHighPrecisionZW[1] + 0.5; + if(prevDepth + uDepthOffset - fragCoordZ >= 0. ){ + discard; + } + } +}`)}class tx{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}let ex=new ir(-1,1,1,-1,0,1);class ix extends Ch{constructor(){super(),this.setAttribute("position",new vh([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new vh([0,2,0,0,2,0],2))}}let sx=new ix;class rx{constructor(t){this.Ny=new L(sx,t)}dispose(){this.Ny.geometry.dispose()}render(t){t.render(this.Ny,ex)}get material(){return this.Ny.material}set material(t){this.Ny.material=t}}class nx extends tx{constructor(t={}){super();var{scene:t,camera:e,renderer:i,samples:s,layers:r,mode:n,w:a,h,type:o}=t;this.un=i,this.xa=t,this.ct=e,this.Iy=s??4,this.Py=n,this.Ti=o,this.Dy=null,this.Oy=[],this.Uy=r??2,this.Fy=new ct(a,h),this.By=JE(),this.ky=new m0,this.ky.depthPacking=Mi,this.ky.onBeforeCompile=QE,this.Gy=new rx(this.By),this.clearDepth=!1,this.needsSwap=!1,this.Hy=new Map,this.jh=!0,this.initTargets()}set enable(t){(this.jh=t)?(qE.uDepthPeel.value=1,this.Hy.forEach(t=>{t=t.mesh;void 0!==t.material.userData.transparent&&(t.material.transparent=t.material.userData.transparent)})):(qE.uDepthPeel.value=0,this.restoreState()),this.Hy.clear()}get enable(){return this.jh}restoreState(){this.Hy.forEach(t=>{t=t.mesh;t.material&&(t.material.transparent=t.material.userData.transparent,delete t.userData.transparent,t.material.needsUpdate=!0)}),this.Hy.clear()}initTargets(){var e=this.Fy;for(let t=0;t<5;t++){2<=t&&this.Iy;var i=Nc,s=new i(e.x,e.y,{minFilter:$t,magFilter:$t,type:le,format:ge,colorSpace:Gr,depthBuffer:!0});i===Nc&&(s.samples=this.Iy),this.Oy.push(s)}}setSize(){var e=new ct;this.un.getDrawingBufferSize(e);for(let t=0;t<5;t++)this.Oy[t].setSize(e.x,e.y);this.Fy.x=e.x,this.Fy.y=e.y,qE.uScreenSize.value.set(1/e.x,1/e.y)}dispose(){for(let t=0;t<5;t++)this.Oy[t].dispose()}clearTarget(t,e,i){t.setRenderTarget(e),t.setClearColor(i[0],i[1]),t.clear()}clearAllTarget(t,e){var i=this.Oy,s=t.getClearColor(new Wt),r=t.getClearAlpha();this.clearTarget(t,i[0],[16777215,1]),this.clearTarget(t,i[1],[16777215,1]),this.clearTarget(t,i[2],[0,0]),this.clearTarget(t,i[3],[0,0]),this.clearTarget(t,e,[s,r])}Vy(t){let i={model:p.MODEL_LAYER,extent:p.EXTENT_LAYER,externalModel:p.EXTERNAL_MODEL_LAYER,dynamicModel:p.DYNAMIC_MODEL_MARKER};t.children.forEach(t=>{let e=this.Ti.includes(i[t.name]);t.traverse(t=>{"Mesh"==t.type&&(void 0===t.material.userData.transparent&&(t.material.userData.transparent=t.material.transparent),e)&&t.visible&&0===t.renderOrder&&(t.material.transparent=!1,this.Hy.has(t.uuid)||this.Hy.set(t.uuid,{mesh:t,onBeforeCompile:t.material.onBeforeCompile}),t.material.onBeforeCompile=$E,t.material.needsUpdate=!0)})})}render(e,t,i){this.clearAllTarget(e,i);var s=e.getClearColor(new Wt).getHex(),r=e.getClearAlpha(),{xa:n,ct:a,Uy:h,Oy:o,ky:l,By:u}=this,c=(e.setRenderTarget(i),e.setClearColor(s,r),e.clear(),e.render(n,a),qE.uLayer.value=0,n.overrideMaterial=l,e.setRenderTarget(o[0]),e.setClearColor(16777215,1),e.clear(),e.render(n,a),n.overrideMaterial=null,e.setRenderTarget(o[2]),e.setClearColor(0,0),e.clear(),e.render(n,a),{0:2,1:4,2:3}),f={0:3,1:2,2:4},d={0:4,1:3,2:2};for(let t=0;t{this.enable=!0,this.eh.map.enableUpdateRender()},500))}handleResize(){this.jy.setSize()}render(t,e){let i=this.eh.renderManager;if("basic"!==i.type&&i.rn.forEach(t=>{t.effectScene&&(t.effectScene.add(t),t.effectScene=null)}),t)return this.jy.enable&&"Mesh"!==t.type&&!t.overrideMaterial?(this.jy.setPass(t,e),void this.jy.render(this.un,null,this.Wy)):void this.un.render(t,e);let s=!1,r=[];this.jh?(this.zy.children.length=0,i.rn.forEach(t=>{"model"===t.name||"extent"==t.name||"externalModel"==t.name||"dynamicModel"==t.name?(("externalModel"!==t.name||"externalModel"===t.name&&s)&&this.Yy(t,!1),"externalModel"!==t.name||s||(s=!0,t.traverse(t=>{"PointLight"===t.type&&r.push(t),"Mesh"===t.type&&(t.userData.resetLight=!0)})),"model"!==t.name&&"extent"!==t.name||t.traverse(t=>{"Mesh"===t.type&&(t.userData.resetLight=!0,t.onBeforeRender=()=>{r.forEach(t=>{t.userData.intensity=t.intensity,t.intensity=0})},t.onAfterRender=()=>{r.forEach(t=>{t.intensity=t.userData.intensity,delete t.userData.intensity})})})):this.Yy(t,!1),void 0===t.effectScene&&(t.effectScene=t.parent),this.zy.add(t)}),this.jy.setPass(this.zy,this.ct),this.jy.render(this.un,null,this.Wy),i.renderer.setRenderTarget(null),i.rn.forEach(t=>{"model"!==t.name&&"externalModel"!==t.name&&"extent"!==t.name&&"dynamicModel"!==t.name&&i.renderer.render(t,i.st.ct)})):i.rn.forEach(t=>{"externalModel"!==t.name&&this.Yy(t,!0),i.renderer.render(t,i.st.ct)})}}Object.assign(ax.prototype,{Yy(t,e){0e?(e.copy(t),e):t.clone(),lx=(t,e)=>t.equals(e),ux={clone:ox,equals:lx,ZERO:new ct(0,0)},cx={clone:ox,equals:lx,ZERO:new Gt(0,0)};function g(t,e){return null!=t?t:e}g.EMPTY_OBJECT=Object.freeze({});let fx={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1};var dx=Object.freeze(fx);let vx={CENTER:0,LEFT:1,RIGHT:-1};var px=Object.freeze(vx);function mx(t){var e=t.Zy;C(e)&&(e.qy(t),t._g=!0)}class gx{constructor(t,e){this.Zy=e,this.Ky=new ct(0,0),this.Jy=cx.clone(g(t.eyeOffset,cx.ZERO)),this.$y=g(t.verticalOrigin,dx.CENTER),this.Qy=g(t.horizontalOrigin,px.CENTER),this.gM=g(t.scale,1)}get horizontalOrigin(){return this.Qy}set horizontalOrigin(t){this.Qy=t}get verticalOrigin(){return this.$y}set verticalOrigin(t){this.$y=t}get image(){return this.tE}set image(t){this.setImage(t,t)}setImage(t,e){this.eE=-1,this.iE=void 0,this.tE=t,this.sE=e,C(this.Zy.rE)&&this.L_()}}function w(t){this.name="DeveloperError",this.message=t;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}Object.assign(gx.prototype,{L_(){let i=this.Zy.rE,s=this.tE,r=this.sE,t;C(r)&&(t=i.addImage(s,r)),C(this.nE=t)&&t.then(t=>{var e;this.tE===s&&this.sE===r&&(e=i.textureCoordinates[t],this.aE=i.texture.width*e.width,this.hE=i.texture.height*e.height,this.eE=t,this.oE=!0,this.sE=void 0,this.nE=void 0,mx(this))}).catch(t=>{console.error("Error loading image for billboard: "+t),this.nE=void 0})},lE(t){var e=this.Ky;ux.equals(e,t)||ux.clone(t,e)}}),C(Object.create)&&(w.prototype=Object.create(Error.prototype),w.prototype.constructor=w),w.prototype.toString=function(){let t=this.name+": "+this.message;return C(this.stack)&&(t+=` +`+this.stack.toString()),t},w.throwInstantiationError=function(){throw new w("This function defines an interface and should not be called directly.")};let k={};function _x(t){return t+" is required, actual value was undefined"}function Mx(t,e,i){return`Expected ${i} to be typeof ${e}, actual typeof was `+t}k.typeOf={},k.defined=function(t,e){if(!C(e))throw new w(_x(t))},k.typeOf.func=function(t,e){if("function"!=typeof e)throw new w(Mx(typeof e,"function",t))},k.typeOf.string=function(t,e){if("string"!=typeof e)throw new w(Mx(typeof e,"string",t))},k.typeOf.number=function(t,e){if("number"!=typeof e)throw new w(Mx(typeof e,"number",t))},k.typeOf.number.lessThan=function(t,e,i){if(k.typeOf.number(t,e),i<=e)throw new w(`Expected ${t} to be less than ${i}, actual value was `+e)},k.typeOf.number.lessThanOrEquals=function(t,e,i){if(k.typeOf.number(t,e),is&&(r=t,s=n)}let a=1,h=0;var o=jx[r],l=Xx[r];if(Math.abs(e[W.getElementIndex(l,o)])>i){i=(e[W.getElementIndex(l,l)]-e[W.getElementIndex(o,o)])/2/e[W.getElementIndex(l,o)];let t;t=i<0?-1/(-i+Math.sqrt(1+i*i)):1/(i+Math.sqrt(1+i*i)),a=1/Math.sqrt(1+t*t),h=t*a}return(t=W.clone(W.IDENTITY,t))[W.getElementIndex(o,o)]=t[W.getElementIndex(l,l)]=a,t[W.getElementIndex(l,o)]=h,t[W.getElementIndex(o,l)]=-h,t}let qx=new W,Kx=new W,Jx=(W.computeEigenDecomposition=function(t,e){k.typeOf.object("matrix",t);var i=H.EPSILON20;let s=0,r=0;for(var n=(e=C(e)?e:{}).unitary=W.clone(W.IDENTITY,e.unitary),a=e.diagonal=W.clone(t,e.diagonal),h=i*Wx(a);r<10&&Yx(a)>h;)Zx(a,qx),W.transpose(qx,Kx),W.multiply(a,qx,a),W.multiply(Kx,a,a),W.multiply(n,qx,n),2<++s&&(++r,s=0);return e},W.abs=function(t,e){return k.typeOf.object("matrix",t),k.typeOf.object("result",e),e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},W.determinant=function(t){k.typeOf.object("matrix",t);var e=t[0],i=t[3],s=t[6],r=t[4],n=t[7],a=t[5],h=t[8];return e*(r*h-a*n)+t[1]*(a*s-i*h)+t[2]*(i*n-r*s)},W.inverse=function(t,e){k.typeOf.object("matrix",t),k.typeOf.object("result",e);var i=t[0],s=t[1],r=t[2],n=t[3],a=t[4],h=t[5],o=t[6],l=t[7],u=t[8],t=W.determinant(t);if(Math.abs(t)<=H.EPSILON15)throw new w("matrix is not invertible");return e[0]=a*u-l*h,e[1]=l*r-s*u,e[2]=s*h-a*r,e[3]=o*h-n*u,e[4]=i*u-o*r,e[5]=n*r-i*h,e[6]=n*l-o*a,e[7]=o*s-i*l,e[8]=i*a-n*s,W.multiplyByScalar(e,1/t,e)},new W);function $x(t){this.name="RuntimeError",this.message=t;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}function j(t,e,i,s,r,n,a,h,o,l,u,c,f,d,v,p){this[0]=g(t,0),this[1]=g(r,0),this[2]=g(o,0),this[3]=g(f,0),this[4]=g(e,0),this[5]=g(n,0),this[6]=g(l,0),this[7]=g(d,0),this[8]=g(i,0),this[9]=g(a,0),this[10]=g(u,0),this[11]=g(v,0),this[12]=g(s,0),this[13]=g(h,0),this[14]=g(c,0),this[15]=g(p,0)}W.inverseTranspose=function(t,e){return k.typeOf.object("matrix",t),k.typeOf.object("result",e),W.inverse(W.transpose(t,Jx),e)},W.equals=function(t,e){return t===e||C(t)&&C(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},W.equalsEpsilon=function(t,e,i){return i=g(i,0),t===e||C(t)&&C(e)&&Math.abs(t[0]-e[0])<=i&&Math.abs(t[1]-e[1])<=i&&Math.abs(t[2]-e[2])<=i&&Math.abs(t[3]-e[3])<=i&&Math.abs(t[4]-e[4])<=i&&Math.abs(t[5]-e[5])<=i&&Math.abs(t[6]-e[6])<=i&&Math.abs(t[7]-e[7])<=i&&Math.abs(t[8]-e[8])<=i},W.IDENTITY=Object.freeze(new W(1,0,0,0,1,0,0,0,1)),W.ZERO=Object.freeze(new W(0,0,0,0,0,0,0,0,0)),W.COLUMN0ROW0=0,W.COLUMN0ROW1=1,W.COLUMN0ROW2=2,W.COLUMN1ROW0=3,W.COLUMN1ROW1=4,W.COLUMN1ROW2=5,W.COLUMN2ROW0=6,W.COLUMN2ROW1=7,W.COLUMN2ROW2=8,Object.defineProperties(W.prototype,{length:{get:function(){return W.packedLength}}}),W.prototype.clone=function(t){return W.clone(this,t)},W.prototype.equals=function(t){return W.equals(this,t)},W.equalsArray=function(t,e,i){return t[0]===e[i]&&t[1]===e[i+1]&&t[2]===e[i+2]&&t[3]===e[i+3]&&t[4]===e[i+4]&&t[5]===e[i+5]&&t[6]===e[i+6]&&t[7]===e[i+7]&&t[8]===e[i+8]},W.prototype.equalsEpsilon=function(t,e){return W.equalsEpsilon(this,t,e)},W.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]}) +(${this[1]}, ${this[4]}, ${this[7]}) +(${this[2]}, ${this[5]}, ${this[8]})`},C(Object.create)&&($x.prototype=Object.create(Error.prototype),$x.prototype.constructor=$x),$x.prototype.toString=function(){let t=this.name+": "+this.message;return C(this.stack)&&(t+=` +`+this.stack.toString()),t},j.packedLength=16,j.pack=function(t,e,i){return k.typeOf.object("value",t),k.defined("array",e),i=g(i,0),e[i++]=t[0],e[i++]=t[1],e[i++]=t[2],e[i++]=t[3],e[i++]=t[4],e[i++]=t[5],e[i++]=t[6],e[i++]=t[7],e[i++]=t[8],e[i++]=t[9],e[i++]=t[10],e[i++]=t[11],e[i++]=t[12],e[i++]=t[13],e[i++]=t[14],e[i]=t[15],e},j.unpack=function(t,e,i){return k.defined("array",t),e=g(e,0),(i=C(i)?i:new j)[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},j.packArray=function(e,i){k.defined("array",e);var s=e.length,t=16*s;if(C(i)){if(!Array.isArray(i)&&i.length!==t)throw new w("If result is a typed array, it must have exactly array.length * 16 elements");i.length!==t&&(i.length=t)}else i=new Array(t);for(let t=0;tt.far)throw new w("near must be greater than zero and less than far.");t.uE=r,t.cE=s,t.fE=e,t.dE=i,t.vE=n,t.pE=a,t.mE=j.computePerspectiveOffCenter(r,s,i,e,n,a,t.mE),t.gE=j.computeInfinitePerspectiveOffCenter(r,s,i,e,n,t.gE)}}function pb(t){t=g(t,g.EMPTY_OBJECT),this._E=new db,this.fov=t.fov,this.wE=void 0,this.ME=void 0,this.yE=void 0,this.aspectRatio=t.aspectRatio,this.EE=void 0,this.near=g(t.near,1),this.vE=this.near,this.far=g(t.far,5e8),this.pE=this.far,this.xOffset=g(t.xOffset,0),this.xE=this.xOffset,this.yOffset=g(t.yOffset,0),this.bE=this.yOffset}function mb(t){if(!(C(t.fov)&&C(t.aspectRatio)&&C(t.near)&&C(t.far)))throw new w("fov, aspectRatio, near, or far parameters are not set.");var e=t._E;if(t.fov!==t.wE||t.aspectRatio!==t.EE||t.near!==t.vE||t.far!==t.pE||t.xOffset!==t.xE||t.yOffset!==t.bE){if(t.fov<0||t.fov>=Math.PI)throw new w("fov must be in the range [0, PI).");if(t.aspectRatio<0)throw new w("aspectRatio must be positive.");if(t.near<0||t.near>t.far)throw new w("near must be greater than zero and less than far.");t.EE=t.aspectRatio,t.wE=t.fov,t.ME=t.fov,t.vE=t.near,t.pE=t.far,t.yE=2*Math.tan(.5*t.ME),t.xE=t.xOffset,t.bE=t.yOffset,e.top=t.near*Math.tan(.5*t.ME),e.bottom=-e.top,e.right=t.aspectRatio*e.top,e.left=-e.right,e.near=t.near,e.far=t.far,e.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset}}function gb(t){t=g(t,g.EMPTY_OBJECT),this.left=t.left,this.uE=void 0,this.right=t.right,this.cE=void 0,this.top=t.top,this.fE=void 0,this.bottom=t.bottom,this.dE=void 0,this.near=g(t.near,1),this.vE=this.near,this.far=g(t.far,5e8),this.pE=this.far,this.SE=new j}function _b(t){if(!(C(t.right)&&C(t.left)&&C(t.top)&&C(t.bottom)&&C(t.near)&&C(t.far)))throw new w("right, left, top, bottom, near, or far parameters are not set.");if(t.top!==t.fE||t.bottom!==t.dE||t.left!==t.uE||t.right!==t.cE||t.near!==t.vE||t.far!==t.pE){if(t.left>t.right)throw new w("right must be greater than left.");if(t.topt.far)throw new w("near must be greater than zero and less than far.");t.uE=t.left,t.cE=t.right,t.fE=t.top,t.dE=t.bottom,t.vE=t.near,t.pE=t.far,t.SE=j.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t.SE)}}j.inverseTranspose=function(t,e){return k.typeOf.object("matrix",t),k.typeOf.object("result",e),j.inverse(j.transpose(t,fb),e)},j.IDENTITY=Object.freeze(new j(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),j.ZERO=Object.freeze(new j(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),j.COLUMN0ROW0=0,j.COLUMN0ROW1=1,j.COLUMN0ROW2=2,j.COLUMN0ROW3=3,j.COLUMN1ROW0=4,j.COLUMN1ROW1=5,j.COLUMN1ROW2=6,j.COLUMN1ROW3=7,j.COLUMN2ROW0=8,j.COLUMN2ROW1=9,j.COLUMN2ROW2=10,j.COLUMN2ROW3=11,j.COLUMN3ROW0=12,j.COLUMN3ROW1=13,j.COLUMN3ROW2=14,j.COLUMN3ROW3=15,Object.defineProperties(j.prototype,{length:{get:function(){return j.packedLength}}}),j.prototype.clone=function(t){return j.clone(this,t)},j.prototype.equals=function(t){return j.equals(this,t)},j.equalsArray=function(t,e,i){return t[0]===e[i]&&t[1]===e[i+1]&&t[2]===e[i+2]&&t[3]===e[i+3]&&t[4]===e[i+4]&&t[5]===e[i+5]&&t[6]===e[i+6]&&t[7]===e[i+7]&&t[8]===e[i+8]&&t[9]===e[i+9]&&t[10]===e[i+10]&&t[11]===e[i+11]&&t[12]===e[i+12]&&t[13]===e[i+13]&&t[14]===e[i+14]&&t[15]===e[i+15]},j.prototype.equalsEpsilon=function(t,e){return j.equalsEpsilon(this,t,e)},j.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]}) +(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]}) +(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]}) +(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`},Object.defineProperties(db.prototype,{projectionMatrix:{get:function(){return vb(this),this.mE}},infiniteProjectionMatrix:{get:function(){return vb(this),this.gE}}}),db.prototype.getPixelDimensions=function(t,e,i,s,r){if(vb(this),!C(t)||!C(e))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new w("drawingBufferWidth must be greater than zero.");if(e<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!C(i))throw new w("distance is required.");if(!C(s))throw new w("pixelRatio is required");if(s<=0)throw new w("pixelRatio must be greater than zero.");var n,a;if(C(r))return n=1/this.near,e=2*s*i*(a=this.top*n)/e,a=this.right*n,r.x=2*s*i*a/t,r.y=e,r;throw new w("A result object is required.")},db.prototype.clone=function(t){return(t=C(t)?t:new db).right=this.right,t.left=this.left,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t.uE=void 0,t.cE=void 0,t.fE=void 0,t.dE=void 0,t.vE=void 0,t.pE=void 0,t},db.prototype.equals=function(t){return C(t)&&t instanceof db&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},db.prototype.equalsEpsilon=function(t,e,i){return t===this||C(t)&&t instanceof db&&H.equalsEpsilon(this.right,t.right,e,i)&&H.equalsEpsilon(this.left,t.left,e,i)&&H.equalsEpsilon(this.top,t.top,e,i)&&H.equalsEpsilon(this.bottom,t.bottom,e,i)&&H.equalsEpsilon(this.near,t.near,e,i)&&H.equalsEpsilon(this.far,t.far,e,i)},pb.packedLength=6,pb.prototype.update=function(){mb(this)},pb.pack=function(t,e,i){return k.typeOf.object("value",t),k.defined("array",e),i=g(i,0),e[i++]=t.fov,e[i++]=t.aspectRatio,e[i++]=t.near,e[i++]=t.far,e[i++]=t.xOffset,e[i]=t.yOffset,e},pb.unpack=function(t,e,i){return k.defined("array",t),e=g(e,0),(i=C(i)?i:new pb).fov=t[e++],i.aspectRatio=t[e++],i.near=t[e++],i.far=t[e++],i.xOffset=t[e++],i.yOffset=t[e],i},Object.defineProperties(pb.prototype,{projectionMatrix:{get:function(){return mb(this),this._E.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return mb(this),this._E.infiniteProjectionMatrix}},fovy:{get:function(){return mb(this),this.ME}},sseDenominator:{get:function(){return mb(this),this.yE}},offCenterFrustum:{get:function(){return mb(this),this._E}}}),pb.prototype.computeCullingVolume=function(t,e,i){return mb(this),this._E.computeCullingVolume(t,e,i)},pb.prototype.getPixelDimensions=function(t,e,i,s,r){return mb(this),this._E.getPixelDimensions(t,e,i,s,r)},pb.prototype.clone=function(t){return(t=C(t)?t:new pb).aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t.EE=void 0,t.wE=void 0,t.vE=void 0,t.pE=void 0,this._E.clone(t._E),t},pb.prototype.equals=function(t){return!!(C(t)&&t instanceof pb)&&(mb(this),mb(t),this.fov===t.fov)&&this.aspectRatio===t.aspectRatio&&this._E.equals(t._E)},pb.prototype.equalsEpsilon=function(t,e,i){return!!(C(t)&&t instanceof pb)&&(mb(this),mb(t),H.equalsEpsilon(this.fov,t.fov,e,i))&&H.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,i)&&this._E.equalsEpsilon(t._E,e,i)},Object.defineProperties(gb.prototype,{projectionMatrix:{get:function(){return _b(this),this.SE}}});let wb=new M,Mb=new M,yb=new M,Eb=new M;function xb(t){t=g(t,g.EMPTY_OBJECT),this._E=new gb,this.width=t.width,this.Ap=void 0,this.aspectRatio=t.aspectRatio,this.EE=void 0,this.near=g(t.near,1),this.vE=this.near,this.far=g(t.far,5e8),this.pE=this.far,this.zoom=t.zoom||1,this.ns=this.zoom}function bb(t){if(!(C(t.width)&&C(t.aspectRatio)&&C(t.near)&&C(t.far)&&C(t.zoom)))throw new w("width, aspectRatio, near, or far parameters are not set.");var e=t._E;if(t.width!==t.Ap||t.aspectRatio!==t.EE||t.near!==t.vE||t.far!==t.pE||t.zoom!==t.ns){if(t.aspectRatio<0)throw new w("aspectRatio must be positive.");if(t.near<0||t.near>t.far)throw new w("near must be greater than zero and less than far.");t.EE=t.aspectRatio,t.Ap=t.width,t.vE=t.near,t.pE=t.far;var i=t.width/(2*t.zoom),s=1/t.aspectRatio*t.width/(2*t.zoom),r=0-i,n=0+s,s=0-s;e.right=0+i,e.left=r,e.top=n,e.bottom=s,e.near=t.near,e.far=t.far}}gb.prototype.computeCullingVolume=function(t,e,i){if(!C(t))throw new w("position is required.");if(!C(e))throw new w("direction is required.");if(!C(i))throw new w("up is required.");var s=this._cullingVolume.planes,r=this.top,n=this.bottom,a=this.right,h=this.left,o=this.near,l=this.far,u=M.cross(e,i,wb),c=(M.normalize(u,u),Mb),o=(M.multiplyByScalar(e,o,c),M.add(t,c,c),yb);M.multiplyByScalar(u,h,o),M.add(c,o,o);let f=s[0];return(f=C(f)?f:s[0]=new z).x=u.x,f.y=u.y,f.z=u.z,f.w=-M.dot(u,o),M.multiplyByScalar(u,a,o),M.add(c,o,o),(f=C(f=s[1])?f:s[1]=new z).x=-u.x,f.y=-u.y,f.z=-u.z,f.w=-M.dot(M.negate(u,Eb),o),M.multiplyByScalar(i,n,o),M.add(c,o,o),(f=C(f=s[2])?f:s[2]=new z).x=i.x,f.y=i.y,f.z=i.z,f.w=-M.dot(i,o),M.multiplyByScalar(i,r,o),M.add(c,o,o),(f=C(f=s[3])?f:s[3]=new z).x=-i.x,f.y=-i.y,f.z=-i.z,f.w=-M.dot(M.negate(i,Eb),o),(f=C(f=s[4])?f:s[4]=new z).x=e.x,f.y=e.y,f.z=e.z,f.w=-M.dot(e,c),M.multiplyByScalar(e,l,o),M.add(t,o,o),(f=C(f=s[5])?f:s[5]=new z).x=-e.x,f.y=-e.y,f.z=-e.z,f.w=-M.dot(M.negate(e,Eb),o),this._cullingVolume},gb.prototype.getPixelDimensions=function(t,e,i,s,r){if(_b(this),!C(t)||!C(e))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new w("drawingBufferWidth must be greater than zero.");if(e<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!C(i))throw new w("distance is required.");if(!C(s))throw new w("pixelRatio is required.");if(s<=0)throw new w("pixelRatio must be greater than zero.");if(C(r))return i=this.right-this.left,e=s*(this.top-this.bottom)/e,r.x=s*i/t,r.y=e,r;throw new w("A result object is required.")},gb.prototype.clone=function(t){return(t=C(t)?t:new gb).left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t.uE=void 0,t.cE=void 0,t.fE=void 0,t.dE=void 0,t.vE=void 0,t.pE=void 0,t},gb.prototype.equals=function(t){return C(t)&&t instanceof gb&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},gb.prototype.equalsEpsilon=function(t,e,i){return t===this||C(t)&&t instanceof gb&&H.equalsEpsilon(this.right,t.right,e,i)&&H.equalsEpsilon(this.left,t.left,e,i)&&H.equalsEpsilon(this.top,t.top,e,i)&&H.equalsEpsilon(this.bottom,t.bottom,e,i)&&H.equalsEpsilon(this.near,t.near,e,i)&&H.equalsEpsilon(this.far,t.far,e,i)},xb.packedLength=4,xb.pack=function(t,e,i){return k.typeOf.object("value",t),k.defined("array",e),i=g(i,0),e[i++]=t.width,e[i++]=t.aspectRatio,e[i++]=t.near,e[i]=t.far,e},xb.unpack=function(t,e,i){return k.defined("array",t),e=g(e,0),(i=C(i)?i:new xb).width=t[e++],i.aspectRatio=t[e++],i.near=t[e++],i.far=t[e],i},Object.defineProperties(xb.prototype,{projectionMatrix:{get:function(){return bb(this),this._E.projectionMatrix}},offCenterFrustum:{get:function(){return bb(this),this._E}}}),xb.prototype.computeCullingVolume=function(t,e,i){return bb(this),this._E.computeCullingVolume(t,e,i)},xb.prototype.getPixelDimensions=function(t,e,i,s,r){return bb(this),this._E.getPixelDimensions(t,e,i,s,r)},xb.prototype.clone=function(t){return(t=C(t)?t:new xb).aspectRatio=this.aspectRatio,t.width=this.width,t.near=this.near,t.far=this.far,t.EE=void 0,t.Ap=void 0,t.vE=void 0,t.pE=void 0,this._E.clone(t._E),t},xb.prototype.equals=function(t){return!!(C(t)&&t instanceof xb)&&(bb(this),bb(t),this.width===t.width)&&this.aspectRatio===t.aspectRatio&&this._E.equals(t._E)},xb.prototype.update=function(){bb(this)},xb.prototype.equalsEpsilon=function(t,e,i){return!!(C(t)&&t instanceof xb)&&(bb(this),bb(t),H.equalsEpsilon(this.width,t.width,e,i))&&H.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,i)&&this._E.equalsEpsilon(t._E,e,i)};var Sb=` +uniform float czm_orthographicIn3D; +uniform float u_device_pixel_ratio; +uniform vec4 czm_viewport; +uniform vec4 czm_frustumPlanes; +uniform vec2 czm_currentFrustum; +uniform mat4 czm_projection; +uniform mat4 modelViewMatrix; +uniform vec2 pixelOffset; + +attribute vec2 direction; +uniform vec2 origin; +attribute vec2 imageSize; +attribute vec2 translate; +attribute float scale; + +attribute vec3 eyeOffset; +attribute vec2 bottomLeft; +attribute vec2 imageRectangle; + +varying vec2 v_textureCoordinates; + +/** + * 计算屏幕上每个像素对应多少米 + * @param {vec4} positionEC 表示相机位置到目标点的向量 + * @param {float} pixelRatio 像素比例值 + */ +float czm_metersPerPixel(vec4 positionEC, float pixelRatio) { + float width = czm_viewport.z; + float height = czm_viewport.w; + float pixelWidth; + float pixelHeight; + + float top = czm_frustumPlanes.x; + float bottom = czm_frustumPlanes.y; + float left = czm_frustumPlanes.z; + float right = czm_frustumPlanes.w; + + if (czm_orthographicIn3D == 1.0) + { + float frustumWidth = right - left; + float frustumHeight = top - bottom; + pixelWidth = frustumWidth / width; + pixelHeight = frustumHeight / height; + } + else + { + float distanceToPixel = -positionEC.z; + float inverseNear = 1.0 / czm_currentFrustum.x; + float tanTheta = top * inverseNear; + pixelHeight = 2.0 * distanceToPixel * tanTheta / height; + tanTheta = right * inverseNear; + pixelWidth = 2.0 * distanceToPixel * tanTheta / width; + } + + return max(pixelWidth, pixelHeight) * pixelRatio; +} + +float czm_metersPerPixel(vec4 positionEC) { + return czm_metersPerPixel(positionEC, u_device_pixel_ratio); +} + +float czm_branchFreeTernary(bool comparison, float a, float b) { + float useA = float(comparison); + return a * useA + b * (1.0 - useA); +} + +vec4 addScreenSpaceOffset( + vec4 positionEC, + vec2 imageSize, + float scale, + vec2 direction, + vec2 origin, + vec2 translate, + vec2 pixelOffset, + vec3 alignedAxis, + bool validAlignedAxis, + float rotation, + bool sizeInMeters, + out mat2 rotationMatrix, + out float mpp + ) { + vec2 halfSize = imageSize * scale * 0.5; + halfSize *= ((direction * 2.0) - 1.0); + vec2 originTranslate = origin * abs(halfSize); + + mpp = czm_metersPerPixel(positionEC); + positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp); + positionEC.xy += (translate + pixelOffset) * mpp; + return positionEC; +} + +void main() { + vec4 positionEC = modelViewMatrix * vec4(0.,0.,0., 1.0); + + float mpp; + mat2 rotationMatrix; + bool validAlignedAxis = false; + float rotation = 0.0; + bool sizeInMeters = false; + + vec3 alignedAxis = vec3(0.0); + positionEC = addScreenSpaceOffset( + positionEC, + imageSize, + scale, + direction, + origin, + translate, + pixelOffset, + alignedAxis, + validAlignedAxis, + rotation, + sizeInMeters, + rotationMatrix, + mpp + ); + gl_Position = czm_projection * positionEC; + + + vec2 textureCoordinatesBottomLeft = bottomLeft; + vec2 textureCoordinatesRange = imageRectangle; + vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange; + v_textureCoordinates = textureCoordinates; +} +`,Tb=` +precision highp float; +precision highp int; + +#define SDF_EDGE 0.75 +#define SDF_PX 8.0 + +uniform sampler2D u_atlas; +uniform vec3 fillColor; +uniform float fontSize; +uniform float u_device_pixel_ratio; +uniform float opacity; + +uniform float isHalo; +uniform float halo_blur; +uniform vec3 outlineColor; +uniform float outlineWidth; + +varying vec2 v_textureCoordinates; + +void main() { + float buff = (256.0 - 64.0) / 256.0; + float fontScale = fontSize / 24.0; + float EDGE_GAMMA = 0.105 / u_device_pixel_ratio; + float gamma = EDGE_GAMMA / (fontScale); + + vec3 color = fillColor; + + if (isHalo > 0. ) { + color = outlineColor; + gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / fontScale ; + buff = (6.0 - outlineWidth / fontScale) / SDF_PX; + } + + float dist = texture2D(u_atlas, v_textureCoordinates).a; + float alpha = smoothstep(buff - gamma, buff + gamma, dist); + + gl_FragColor = vec4(color, alpha * opacity); + + if(isHalo > 0. && gl_FragColor.a < 0.95) { + discard; + } +} +`;class Ab{constructor(t){this.label=t,this.viewportV2=new ct}get frustum(){return this.label.rg.map.camera.isOrthographicCamera?this.frustumO:this.frustumP}getGeometry(e=[]){var t=new My,i=(t.instanceCount=e.length,[]),s=[],r=[],n=[],a=[],h=[];for(let t=0;t{var t=this.label.rg,e=t.map.camera,t=t.map.bt.renderer,t=(t.getDrawingBufferSize(this.viewportV2),this.frustumP.fov=H.toRadians(e.fov||60),this.frustumP.aspectRatio=this.viewportV2.x/this.viewportV2.y,this.frustumP.near=e.near,this.frustumP.far=e.far,this.frustumO.aspectRatio=t.domElement.clientWidth/t.domElement.clientHeight,this.frustumO.near=e.near,this.frustumO.far=e.far,this.frustumO.width=t.domElement.clientWidth,this.frustumO.zoom=e.zoom,e.isOrthographicCamera?this.frustumO:this.frustumP),t=(t.update(),t._E);i.material.uniforms.czm_currentFrustum.value=[e.near,e.far],i.material.uniforms.czm_viewport.value=[0,0,this.viewportV2.x,this.viewportV2.y],i.material.uniforms.czm_projection.value=e.projectionMatrix,i.material.uniforms.czm_frustumPlanes.value=[t.top,t.bottom,t.left,t.right],i.material.uniforms.czm_orthographicIn3D.value=e.isOrthographicCamera?1:0,i.material.uniforms.pixelOffset.value=this.label.pixelOffset,i.material.uniforms.origin.value=[px.LEFT,this.label.verticalOrigin],i.material.uniforms.fillColor.value=this.label.yg,i.material.uniforms.u_device_pixel_ratio.value=this.label.pixelRatio,i.material.uniforms.opacity.value=this.label.opacity},i.renderOrder=e?-1:1;s=e?"labelMeshInstance":"labelOutlineMeshInstance";this.label.rootNode.add(i),(this.label[s]=this).mesh=i}}}class Rb{constructor(){this.AE=[],this.RE=[],this.label=null}add(t={}){t=new gx(t,this);return t.LE=this.AE.length,this.AE.push(t),t}createMeshInstance(e){if(0!=e.length){this.label._g=!1;var i=[];for(let t=0;t{t.pixelOffset=e})}get totalScale(){return this.gM*this.UE}get horizontalOrigin(){return this.Qy}getScreenSpaceBoundingBox(s={x:0,y:0},t){var r=this;let n=0,a=0,h=0,o=0;var l=r.totalScale,e=r.FE;if(C(e))n=s.x+e.Ky.x,a=s.y-e.Ky.y,h=e.width*l,o=e.height*l,r.verticalOrigin===dx.BOTTOM||r.verticalOrigin===dx.BASELINE?a-=o:r.verticalOrigin===dx.CENTER&&(a-=.5*o);else{n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;let e=0,i=0;var u=r.OE,c=u.length;for(let t=0;t{var e,i;e=aa,i=function(){var l,r={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},n=(l=r.defaultRadius,t.prototype={$E:function(t,e){var i=t[this.QE],s=t[this.tx],r=this.ix,n=this.qs,a=this.fi,h=this.ci,o=t[this.sx]||1,t=t.radius||this.nx||l,r=(n[i]||(n[i]=[],r[i]=[]),n[i][s]?n[i][s]+=o:(n[i][s]=o,r[i][s]=t),n[i][s]);return a{for(var e=[],i=t.min,s=t.max,r=t.radi,t=t.data,n=Object.keys(t),a=n.length;a--;)for(var h=n[a],o=Object.keys(t[h]),l=o.length;l--;){var u=o[l],c=t[h][u],f=r[h][u];e.push({x:h,y:u,value:c,radius:f})}return{min:i,max:s,data:e}})(t)),this.Mx())},yx:function(t){this.mx=s(t)},updateConfig:function(t){t.gradient&&this.yx(t),this._x(t)},setDimensions:function(t,e){this.Ap=t,this.Jt=e,this.canvas.width=this.shadowCanvas.width=t,this.canvas.height=this.shadowCanvas.height=e},Ja:function(){this.shadowCtx.clearRect(0,0,this.Ap,this.Jt),this.ctx.clearRect(0,0,this.Ap,this.Jt)},_x:function(t){this.Sn=0==t.blur?0:t.blur||t.defaultBlur,t.backgroundColor&&(this.canvas.style.backgroundColor=t.backgroundColor),this.Ap=this.canvas.width=this.shadowCanvas.width=t.width||this.Ap,this.Jt=this.canvas.height=this.shadowCanvas.height=t.height||this.Jt,this.Kr=255*(t.opacity||0),this.D3=255*(t.maxOpacity||t.defaultMaxOpacity),this.O3=255*(t.minOpacity||t.defaultMinOpacity),this.Ex=!!t.useGradientOpacity},wx:function(t){for(var e,i,s,r,n,a=this.ci=t.min,h=this.fi=t.max,o=(t=t.data||[]).length,l=1-this.Sn;o--;){var u,c=t[o],f=c.x,d=c.y,v=c.radius,c=Math.min(c.value,h),f=f-v,d=d-v,p=this.shadowCtx,m=(this.gx[v]?u=this.gx[v]:this.gx[v]=(e=v,i=l,n=m=r=s=void 0,s=document.createElement("canvas"),r=s.getContext("2d"),n=m=e,s.width=s.height=2*e,1==i?(r.beginPath(),r.arc(m,n,e,0,2*Math.PI,!1),r.fillStyle="rgba(0,0,0,1)",r.fill()):((i=r.createRadialGradient(m,n,e*i,m,n,e)).addColorStop(0,"rgba(0,0,0,1)"),i.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=i,r.fillRect(0,0,2*e,2*e)),u=s),(c-a)/(h-a));p.globalAlpha=m<.01?.01:m,p.drawImage(u,f,d),fthis.vx[2]&&(this.vx[2]=f+2*v),d+2*v>this.vx[3]&&(this.vx[3]=d+2*v)}},Mx:function(){for(var t=this.vx[0],e=this.vx[1],i=this.vx[2]-t,s=this.vx[3]-e,r=this.Ap,n=this.Jt,a=this.Kr,h=this.D3,o=this.O3,l=this.Ex,r=this.shadowCtx.getImageData(t=t<0?0:t,e=e<0?0:e,i=r>0},getDataURL:function(){return this.canvas.toDataURL()}});var i,a,h=i="canvas2d"===r.defaultRenderer?e:i,o=function(){for(var t={},e=arguments.length,i=0;ia.x&&(i=a.x),s>a.y&&(s=a.y),r{y.showFloorNode(e,e.getFloor(t))});0{t.frustumCulled=e})}}static setValue(t,e,i){i[t]=e}static getValue(t,e){return e[t]}static addLastFrame(e,i){let s=window.devicePixelRatio||1;var t=e.bt.renderer;let r=t.domElement.parentElement,n=t.domElement.clientWidth,a=t.domElement.clientHeight;var h=document.createElement("canvas");h.width=n*s,h.height=a*s,h.style.width=n+"px",h.style.height=a+"px",h.style.position="absolute",h.style.zIndex=1,h.className="exportImageLastFrame";let o=h.getContext("2d"),l=new Image;l.onload=t=>{o.drawImage(t.path[0],0,0,n*s,a*s),r.append(h),e.Yt.Xt({type:"printBefor"}),i()},l.onerror=t=>{console.warn("fail...",t)},e.bt.render(),l.src=t.domElement.toDataURL()}static removeLastFrame(t){var e=t.bt.renderer,i=document.querySelector(".exportImageLastFrame"),e=e.domElement.parentElement;e&&i&&e.removeChild(i),t.Yt.Xt({type:"printAfter"})}static start(t){var e={callback:null,viewParam:{width:0,height:0},state:{col:0,row:0,loadCount:0},camera:null,backCamera:null,width:0,height:0,padding:0,canvas:null,renderTarget:null,cameraType:null,defaultLogoAspact:null};let{padding:i,map:s,imageWidth:r,imageHieght:n,callback:a,bound:h,cameraType:o}=t;h&&(y.setValue("originBound",{max:{x:h.max.x,y:h.max.y},min:{x:h.min.x,y:h.min.y}},e),h.size||(h.size.x=h.max.x-h.min.x,h.size.y=h.max.y-h.min.y),t=r/h.size.x,u=n/h.size.y,l=AS.getRotationBound(h,s),h=l,Math.abs(u-t)<.1)&&(r=h.size.x*t,n=h.size.y*u),y.setValue("mapZoom",s.getZoom(),e),y.setValue("cameraType",o||"2d",e),"2d"==e.cameraType?y.setValue("backCamera",s.ct,e):y.setValue("backCamera",{aspect:s.ct.aspect},e);var l=r/n,t=(15e3{y.start(t)})}static recoverParam(t,e){"2d"===e.cameraType?(t.ct=y.getValue("backCamera",e),t.Lt=t.ct):"3d"===e.cameraType&&(i=y.getValue("backCamera",e),t.ct.aspect=i.aspect,t.ct.clearViewOffset());var i=y.getValue("domSize",e),s=window.devicePixelRatio||1;t.bt.renderer.setPixelRatio(s),t.bt.renderer.setSize(i.width,i.height),t.Yt.Xt({type:"viewModeChanged"}),y.recoveAllNode(t,e),y.setLogo(t,y.getValue("defaultLogoAspact",e)),t.bi.yt.object=t.ct,y.setVisibleLevelsFrustumCulled(t,!0),t.bt.xt(),t.bt.ma=!0,t.bt.renderer.clear(),t.bt.render(),t.enableUpdateNode(),y.removeLastFrame(t)}static getCameraParame2d(t,e,i,s,r,n,a){var h,o,l,u,c=Math.min(e,i),n=n||(c-r)/c,r=t.getState(),{min:c,max:s}=s,f=Math.abs(s.x-c.x),s=Math.abs(s.y-c.y),c=e/i,e=(c{var e=y.getValue("state",n);e.loadCount++,y.setValue("state",e,n),f.drawImage(t.path[0],0,0,l,u),c.putImageData(f.getImageData(0,0,l,u),s,r),e.loadCount===a*h&&(o.toBlob(t=>{d&&d(t)}),y.recoverParam(i,n),n.callback=null,n.viewParam=null,n.state=null,n.camera=null,n.backCamera=null,n.canvas=null,n=null)},i.bt.render(),v.src=t.domElement.toDataURL()}static setLogo(t,e){if(t.bt.needLogo){e=Math.min(e,1);const i=.4;e=-1*(.5*i/e-1);t.bt.da.material.uniforms.offset.value.x=e}}static caleAvoid(t,e){var i,s;"2d"!=t.cameraType&&t.cameraType,"2d"==t.cameraType?(y.showAllNode(e,t),s=y.getValue("width",t),i=y.getValue("height",t),e.bt.renderer.setSize(s,i),e.bt.xt(),e.bt.hw(),s=y.getValue("viewParam",t),e.bt.renderer.setSize(s.width,s.height)):(e.bt.xt(),e.bt.hw())}static shot(e,i,s){y.setLogo(e,s.width/s.height);var r=y.getValue("camera",s),{row:n,col:a}=(e.bt.ma=!0,y.setVisibleLevelsFrustumCulled(e,!1),y.getValue("state",s)),h=y.getValue("viewParam",s);y.caleAvoid(s,e);for(let t=0;t{var e=RS.getRenderNode(t);e&&(e.frustumCulled=i),t.type===p.LABEL&&t.getRenderNode()?.children.forEach(t=>{t.frustumCulled=i})})}static addLastFrame(t,e){let i=nt.window.devicePixelRatio||1;var s=t.bt.renderer;let r=s.domElement.parentElement,n=s.domElement.clientWidth,a=s.domElement.clientHeight;var h=document.createElement("canvas");h.width=n*i,h.height=a*i,h.style.width=n+"px",h.style.height=a+"px",h.style.position="absolute",h.style.zIndex=0,h.className="exportImageLastFrame";let o=h.getContext("2d");var l=new Image,u=(l.crossOrigin="Anonymous",l.onload=()=>{o.drawImage(l,0,0,n*i,a*i),r.append(h),t.Yt.Xt({type:"printBefor"}),e()},l.onerror=t=>{console.warn("fail...",t)},t.bt.render(),"FF"===bm?"image/jpeg":"image/png");l.src=s.domElement.toDataURL(u,1)}static insideBound(t,e){let i=!1;return i=t.min.x>=e.min.x&&t.min.y>=e.min.y&&t.max.x<=e.max.x&&t.max.y<=e.max.y?!0:i}static forEachElement(t,e,i){var s=t.getFloor(e);for(let t=0;t{var e=RS.getRenderNode(t);e&&"Sprite"===e.type&&this.insideBound(t.bound,i)&&(t.type!==p.LABEL||0{e.expand(t.bound)}),e}}class LS{static getSpriteWorldSize(t,e,i,s){let r,n;if(t.parent.isHasText){var a=t.getScreenSize();if(!a||isNaN(a.width)||isNaN(a.height))return null;n=a.width,r=a.height}else{a=RS.getRenderNode(t)?.material?.map?.image;if(!a)return null;r=a.height/2,n=a.width/2}return{x:n*Math.abs(e.left-e.right)/e.zoom/s,y:r*Math.abs(e.top-e.bottom)/e.zoom/i}}static getSpriteBound(t,e,i,s){var r={},n={},a=(t=Math.ceil(t),e=Math.ceil(e),new ia);return r.x=i.x-s.x*t,n.x=i.x+(1-s.x)*t,n.y=i.y-s.y*e,r.y=i.y+(1-s.y)*e,a.expandByCoords([r,n]),a}static calcElements(e,i,s,r,n){for(let t=0;th.x/h.y?i/h.y:e/h.x,r.rotation.x=-Math.PI/2,r.rotation.y=0,r.rotation.z=-s*Math.PI/180;const o=t.Ft[0].x,l=t.Ft[0].y;i=a.x-o,e=l-a.y;r.position.x=i,r.position.y=Math.max((t.getLevels().length+1)*t.getFloorSpace(),1e3),r.position.z=e,r.zoom=n,r.updateProjectionMatrix(),r.updateMatrixWorld()}static readOptions(t,e,i){i.buildings=void 0!==i.buildings?i.buildings:[],i.autoDownload=void 0===i.autoDownload||i.autoDownload,i.isExpandbound=void 0===i.isExpandbound||i.isExpandbound,i.padding=void 0!==i.padding?i.padding:5,i.color=void 0!==i.color?i.color:"rgba(255, 255, 255, 1.0)",i.imageWidth=void 0!==i.width?i.width:1e3,i.imageHeight=void 0!==i.height?i.height:1e3,delete i.width,delete i.height;15e3{i.forEach(t=>{if(t.type===e.type)switch(t.type){case p.LABEL:"befor"===r?0{let{style:i=[],map:s,level:r,buildings:n}=h,a=(s.Wt.Z0=!1,[]);this.setStyle(s,r,i,a,"befor"),n.forEach(t=>{var e=s.getBuilding(t.buildingID);this.setStyle(e,t.level,i,a,"befor")}),Promise.all(a).then(t)})}static after(t){let{style:i=[],map:s,level:e,buildings:r}=t,n=(s.Wt.Z0=!0,[]);this.setStyle(s,e,i,n),r.forEach(t=>{var e=s.getBuilding(t.buildingID);this.setStyle(e,t.level,i,n)})}static updateSize(t,e){RS.forEachElement(t,e,t=>{t.updateSize?t.updateSize():t.Da&&t.Da()})}static caleAvoid(e){e.map.setDevicePixalRatio(1),e.map.bt.renderer.setSize(e.imageRenderSize.width,e.imageRenderSize.height),e.map.bt.xt(),e.map.bt.ma=!0,e.map.bt.hw(e.zoom),this.updateSize(e.map,e.level),e.buildings.forEach(t=>{t=e.map.getBuilding(t.buildingID);this.updateSize(t,t.level)}),e.map.bt.renderer.setSize(e.renderSizeExport.width,e.renderSizeExport.height),e.map.Yt.Xt({type:"resize"})}static start(e,i){var{map:t,imageRenderSize:s,renderSizeExport:r,camera:n}=e,a=(RS.setLogo(t,s.width/s.height),RS.setVisibleLevelsFrustumCulled(t,e.level,!1),e.buildings.forEach(t=>{t=e.map.getBuilding(t.buildingID);RS.setVisibleLevelsFrustumCulled(t,t.level,!1)}),this.caleAvoid(e),document.createElement("canvas")),h=(a.width=e.imageWidth,a.height=e.imageHeight,a.style.width=e.imageWidth+"px",a.style.height=e.imageHeight+"px",a.getContext("2d")),o={col:0,row:0,loadCount:0};if(o.col=Math.ceil(e.imageRenderSize.width/e.renderSizeExport.width),o.row=Math.ceil(e.imageRenderSize.height/e.renderSizeExport.height),isNaN(o.col)||isNaN(o.row))i(null);else for(let t=0;t{let n=0;for(let s=0;s{n+=1,o.ctxAll.drawImage(i,e.x-t.width/2,e.y-t.height/2),n===r.length&&o.callback(o.canvasAll)},i.onerror=t=>{(n+=1)===r.length&&o.callback(o.canvasAll)};var a="FF"===bm?"image/jpeg":"image/png";i.src=t.toDataURL(a,1)}}).catch(t=>{console.error(t),o.callback(o.canvasAll)})}else o.callback(o.canvasAll)}static renderImage(t,e,i,s,r,n,a){let{map:h,padding:o,renderSizeExport:l}=a;var u=document.createElement("canvas");u.width=l.width,u.height=l.height;let c=u.getContext("2d");var f=new Image,u=(f.crossOrigin="Anonymous",f.onload=()=>{i.loadCount++,c.drawImage(f,0,0,l.width,l.height),r.putImageData(c.getImageData(0,0,l.width,l.height),t+o,e+o),i.loadCount===i.row*i.col&&this.renderDomMarker({ctxAll:r,level:a.level,canvasAll:s,map:a.map,width:a.imageWidth,height:a.imageHeight,camera:a.camera,dependent:a.dependent,bound:a.bound,callback:t=>{r.fillStyle=a.color,r.fillRect(0,0,a.imageWidth,a.padding),r.fillRect(0,0,a.padding,a.imageHeight),r.fillRect(0,a.imageHeight-a.padding,a.imageWidth,a.imageHeight),r.fillRect(a.imageWidth-a.padding,0,a.imageWidth,a.imageHeight),t.toBlob(t=>{a.autoDownload&&RS.downLoad(t),n(t)})}})},h.bt.render(),"FF"===bm?"image/jpeg":"image/png");f.src=h.bt.renderer.domElement.toDataURL(u,1)}static recoverParamCore(t){var e=t.map,i=(e.ct=t.backCamera,t.renderSizeMap),s=window.devicePixelRatio||1;e.bt.renderer.setSize(i.width,i.height),e.setDevicePixalRatio(s),RS.setLogo(e,i.width/i.height),e.bi.yt.object=e.ct,t.map.Yt.Xt({type:"resize"})}static findWattingLabelNodeByLevel(t,e,i){RS.forEachElement(t,e,t=>{t.type==p.LABEL&&t.visible&&i.push(t)})}static findAllWattingLabelNode(e,i){CS.findWattingLabelNodeByLevel(e.map,e.level,i);for(let t=0;t{t=e.map.getBuilding(t.buildingID);this.updateSize(t,t.level)}),RS.setVisibleLevelsFrustumCulled(t,e.level,!0),e.buildings.forEach(t=>{t=e.map.getBuilding(t.buildingID);RS.setVisibleLevelsFrustumCulled(t,t.level,!0)}),t.bt.xt(),t.bt.ma=!0,t.enableUpdateNode()}static removeLastFrame(t){let e=t.bt.renderer.domElement.parentElement;e&&e.childNodes.forEach(t=>{"exportImageLastFrame"===t.className&&e.removeChild(t)}),t.Yt.Xt({type:"printAfter"})}}class NS{constructor(t){this.buildings=t.buildings,this.map=t.map,this.onlyInBuilding=t.onlyInBuilding,this.buildingOldParam=[],this.innerBuildingIDs=[],this.outterBuildingIDs=[],this.initBuildingIDs(),this.saveBuildingParam(),this.setBuildingsParamForExport()}restoreBuildingParam(){let n=this.map,a=[];return this.onlyInBuilding&&this.setBuildingVisible(null,!0),this.setBuildingOverviewMode(this.innerBuildingIDs,o3.INDOOR),this.buildingOldParam.forEach(t=>{var{buildingID:t,level:e,visibleLevels:i,overviewMode:s,facadeNodeVisible:r}=t,s=(this.setBuildingVisible(t,!0),void 0!==s&&this.setBuildingOverviewMode([t],s),a.push(this.setBuildingLevel(t,i,e)),n.getBuilding(t));s&&(s.Of.visible=r,s.Ld())}),this.map.qt=this.qt,Promise.all(a)}initBuildingIDs(){var{buildings:t,map:e}=this;let i=[],s=t.map(t=>t.buildingID);e.getBuildings().forEach(t=>{!1===s.includes(t.Ht)&&i.push(t.Ht)}),this.innerBuildingIDs=s,this.outterBuildingIDs=i}saveBuildingParam(){this.qt=this.map.qt,this.map.qt=!1;var{map:e,innerBuildingIDs:t,outterBuildingIDs:i}=this,s=(this.buildingOldParam.push({buildingID:null,level:e.getLevel(),visibleLevels:e.getVisibleLevels()}),[...t,...i]);for(let t=0;t{i.getBuilding(t).Of.visible=e!==o3.INDOOR})}setBuildingsParamForExport(){this.setBuildingOverviewMode(this.innerBuildingIDs,o3.INDOOR),this.setBuildingOverviewMode(this.outterBuildingIDs,o3.OUTDOOR),this.onlyInBuilding&&this.setBuildingVisible(null,!1),this.innerBuildingIDs.forEach(t=>{this.setBuildingVisible(t,!0)}),this.outterBuildingIDs.forEach(t=>{this.setBuildingVisible(t,!1)}),this.map.bt.$a()}loadBuildings(){return new Promise((s,r)=>{if(this.checkBuildingLoaded())s();else{let{buildings:t,map:e}=this,i=()=>{this.checkBuildingLoaded()&&(e.off("buildingLoaded",i),s())};e.on("buildingLoaded",i),t.forEach(t=>{t=e.getBuilding(t.buildingID);e.Wt.md(t)}),setTimeout(()=>{r("加载数据超时...")},1e4)}})}setBuildingVisible(t,e){let i;var s=this.map;(i=null===t?s.jt:s.getBuilding(t))&&(i.Ft.forEach(t=>{t.visible=e}),i.visible=e,i.traverse(t=>{t.br({animate:!1})}))}setBuildingLevel(s,r,n){let a=this.map;return new Promise((e,i)=>{if(s){let t=a.getBuilding(s);t?t.setVisibleLevels(r,()=>{t.traverse(t=>{t.br({animate:!1})}),t.setLevel({level:n,animate:!1,finish:()=>{t.traverse(t=>{t.br({animate:!1})}),e()}})}):i(`buildingId: ${s} 不存在`)}else a.setVisibleLevels(r,()=>{a.setLevel({level:n,animate:!1,finish:e})})})}async loadLevel(){var e=this.buildings,i=[];for(let t=0;tv/p?v/(e.x-t.x):p/(e.y-t.y),s-v/2),_=r-p/2,w=document.getElementsByTagName("canvas")[0],M=document.createElement("canvas"),y=document.createElement("canvas"),E=document.createElement("canvas"),x=nt.window.devicePixelRatio,b=new Image,S=(a.getViewMode(),Lr.PERSPECTIVE,a.ct.setViewOffset(v*m,p*m,v*(m-1)/2+g*m,p*(m-1)/2+_*m,v,p),a.bt.render(),M.width=c*m*x,M.height=f*m*x,M.style.width=c*m*x+"px",M.style.height=f*m*x+"px",i?(y.width=1240*Math.pow(1.414,h-1),y.height=1754*Math.pow(1.414,h-1),y.style.width=1240*Math.pow(1.414,h-1)+"px",y.style.height=1754*Math.pow(1.414,h-1)+"px"):(y.height=1240*Math.pow(1.414,h-1),y.width=1754*Math.pow(1.414,h-1),y.style.height=1240*Math.pow(1.414,h-1)+"px",y.style.width=1754*Math.pow(1.414,h-1)+"px"),E.height=u||f*Math.pow(1.414,h-1),E.width=l||c*Math.pow(1.414,h-1),E.style.height=E.height+"px",E.style.width=E.width+"px",b.src=w.toDataURL("image/png"),(a.getViewMode()===Lr.PERSPECTIVE?a.Ps:a.Lt).clearViewOffset(),M.getContext("2d")),T=y.getContext("2d"),A=E.getContext("2d");b.onload=()=>{a.getViewMode(),Lr.PERSPECTIVE,S.drawImage(b,-(v*x-c*m*x)/2,-(p*x-f*m*x)/2);let n=new Image;n.src=M.toDataURL("image/png"),n.onload=()=>{a.camera.clearViewOffset(),a.enableUpdateRender();var t=Math.min(1240*Math.pow(1.414,h-1)/(c*m),1754*Math.pow(1.414,h-1)/(f*m)),e=(y.width-c*m*t)/2,i=(y.height-f*m*t)/2;T.drawImage(n,e,i,c*m*t,f*m*t),l&&u?DS.Sx(A,n,c,f,E.width,E.height):A.drawImage(n,0,0,c*Math.pow(1.414,h-1),f*Math.pow(1.414,h-1));let s=y.toDataURL("image/png"),r=E.toDataURL("image/png");-1E.toBlob(t=>o(s,e,r,t)))}}}static print(t,e){IS=!0;let i=t.getZoom(),s=(t.setZoom({animate:!0,zoom:29}),t.bi.yt.target.x),r=t.bi.yt.target.z,n=(t.bi.yt.panAdd({x:-s,z:-r,y:0}),t.getTilt()),a=t.getRotation(),h=document.createElement("canvas");h.width=6*t.bt.renderer.domElement.width,h.height=6*t.bt.renderer.domElement.height,t.setTilt({tilt:90,finish:()=>{t.setRotation({rotation:0})}}),t.getViewMode()===Lr.MODE_3D?t.setViewMode({mode:Lr.MODE_2D,callback:()=>DS.shot_(t,h,h.getContext("2d"),0,t.Lt.zoom,s,r,i,Lr.MODE_3D,n,a,e)}):DS.shot_(t,h,h.getContext("2d"),0,t.Lt.zoom,s,r,i,Lr.MODE_2D,n,a,e)}static export(t){var e;void 0!==t.imageWidth&&void 0!==t.imageHieght&&(e=t.map.getViewMode(),void 0===t.mode?t.cameraType=e===Lr.MODE_2D?"2d":"3d":t.cameraType=t.mode===Lr.MODE_2D?"2d":"3d",e!=Lr.MODE_2D||t.mode!==Lr.MODE_3D)&&y.print(t)}static shot_(n,a,h,o,l,u,c,f,d,v,p,m){if(IS&&o<36){let t=null,e=null,i=(o<6?(t=0,e=+o):o<12?(t=1,e=o-6):o<18?(t=2,e=o-12):o<24?(t=3,e=o-18):o<30?(t=4,e=o-24):o<36&&(t=5,e=o-30),n.bt.renderer.domElement.width),s=n.bt.renderer.domElement.height,r=new Image;return r.indexI=t,r.indexJ=e,n.Lt.setViewOffset(i,s,2.5*-i+i*t,2.5*-s+s*e,i,s),n.Lt.updateProjectionMatrix(),r.onload=t=>{PS++;let e=t.target;e=e||t.path[0],h.drawImage(e,i*e.indexI,s*e.indexJ),36===PS&&(a.toBlob(t=>{n.Lt.zoom=6*l,n.Lt.updateProjectionMatrix(),n.setViewMode({mode:d,callback:()=>{n.setRotation({rotation:p,finish:()=>{n.setTilt({tilt:v})}})}}),n.setZoom({zoom:f}),n.Lt.clearViewOffset(),n.bt.Vt(),n.bi.yt.panAdd({x:u,z:c,y:0}),n.bt.xt(),n.bi.yt.update(),n.bt.render(),IS=!1,m(t)}),PS=0)},n.bt.xt(),n.bi.yt.update(),n.bt.render(),r.src=n.bt.renderer.domElement.toDataURL(),o++,DS.shot_(n,a,h,o,l,u,c,f,d,v,p,m)}}static async exportToImage(n,a,h,o,l){h=h||{},n.Yt.dw=!1,CS.readOptions(n,a,h),CS.initOptions(h),h.renderSizeExport.width<=0||h.renderSizeExport.height<=0?l&&l("导出尺寸不能小于等于0"):1==h.onlyInBuilding&&0==h.map.getBuildings().length?l&&l("导出内容为空"):CS.addLastFrame(h.map,async()=>{h.map.bt.renderer.domElement.style.opacity="0";let s=new NS(h),r=h.map.nt.qv,i=(h.map.nt.qv=!1,async()=>{var e=[];for(h.map.enableUpdateNode(),h.map.Wt.Oa(!0,h.zoom);0{var t;await CS.befor(h),!0===h.isExpandbound&&(t=CS.findSpriteElement(h.map,h.level,h.bound),a=CS.expandBoundBySprite(t,h)),CS.updateCamera(h.map,h.imageRenderSize.width,h.imageRenderSize.height,a,h.camera),h.map.camera=h.camera,CS.start(h,async t=>{for(CS.recoverParamCore(h),await s.restoreBuildingParam(),CS.after(h),h.map.Wt.Oa();0{let e=[!1,!1];if(Ym.isLoaded())e[0]=!0,e.every(t=>t)&&i();else{let t=Ym.onLoad;Ym.onLoad=()=>{t(),e[0]=!0,Ym.onLoad=t,e.every(t=>t)&&i()}}Tm.ul===Tm.ll?(e[1]=!0,e.every(t=>t)&&i()):Tm.cl.set(h.map.Il,()=>{Tm.cl.delete(h.map.Il),e[1]=!0,e.every(t=>t)&&i()})};0{h.map.setLevel({level:h.level,animate:!1,finish:t})})})}}function OS(t){t=new Worker(t,{type:"module"});return t.onerror=function(t){console.error(t)},t}let US=(i,s,r,n)=>{let a=({data:t})=>{var e;t.id===s&&(t.error?(e=t.error,(e=new Error(t.error.message)).stack=t.error.stack,n(e)):r(t),i.removeEventListener("message",a))};return a};async function FS(i,t,e){e=e||[];let s=i.Tx++;var r=new Promise((t,e)=>{i.Ax.addEventListener("message",US(i.Ax,s,t,e))});return i.Ax.postMessage({id:s,parameters:t,canTransferArrayBuffer:!0},e),r}async function BS(e,t,i){++e.Rx;try{var s=await FS(e,t,i);return--e.Rx,s}catch(t){throw--e.Rx,t}}class kS{constructor(t,e){this.Lx=e.baseURL+t,this.Tx=0,this.Rx=0,this.Cx=e.maximumActiveTasks??512,this.Nx=[]}}Object.assign(kS.prototype,{Ix(t,e){if(this.Ax||(this.Ax=OS(this.Lx)),!(this.Rx>=this.Cx))return BS(this,t,e)},Px(){for(;this.Rx{this.Px()})}},Ga(i,s){return new Promise((t,e)=>{this.Nx.push({taskParam:{parameters:i,transferableObjects:s},resolve:t,reject:e}),this.Px()})},uw(){this.Ax&&(this.Ax.terminate(),this.Ax=void 0,this.Nx.length=0,this.Rx=0)}}),Object.assign(nv.prototype,{hw(t){this.ma&&(this.st.traverse(async e=>{if(this.st.Wt.Qa(e)){var i=e.visibleLevels,r=[],n=t??this.st.getZoom(),s=this.nt.Cw;for(let t=0;t{t.mapNode&&t.mapNode.avoidBefor&&t.mapNode.avoidBefor()}),this.Wa(r,e.children,i,n,t.collision),this.st.enableUpdateRender())}}}}}}),this.ma=!1,this.st.enableUpdateRender())}}),nt.DepthPeelingRenderer=ax,nt.LabelCollection=xS,nt.heatmap=TS,nt.TaskProcessor=kS,nt.DomMarkerManager=EE,nt.FMDomMarker=kE;let GS={FMMouseMode:va,VERSION:a.VERSION,BUILD:a.BUILD,FMMap:E,FMType:p,FMViewMode:Lr,FMShadingMode:eh,FMInfoMode:Cr,FMTextAlign:Am,FMLineType:Dy,FMLabelField:R3,FMMarkerAnchor:Nr,FMEdgeMode:RE,FMDepthPeelingMode:sE,FMOverviewMode:o3,FMEnterTriggerMode:iE,FMUtil:na,FMCalculator:P3,FMCoordsTransformer:GE,FMImageMarker:cE,FMMarker:FM,FMTextMarker:fE,FMPolygonMarker:bE,FMLocationMarker:TE,FMHeatMap:FE,FMDynamicModel:BE,FMLineMarker:Oy,FMDomMarker:kE,FMExtrudeMarker:OE,FMSegment:Py,FMMarkerLayer:W3,FMBound:ia,FMOrientedBound:HE,FMRectangle:N3,FMMarkerFun:qy,FMMapMask:D3,FMLight:zE,FMLightMode:VE,FMDynamicTextureTool:WE,FMMarkerCluster:ZE,FMZoomCenterType:La},HS=hv.global(),VS=void 0!==HS?HS.fengmap:{};null==VS&&(VS={});for(let t in GS)VS[t]=GS[t];void 0!==HS&&(HS.fengmap=VS),VS.FMUtil.screenshot=DS.screenshot,VS.FMUtil.exportToImage=DS.exportToImage;var zS=VS;let{VERSION:WS,BUILD:jS}=a;export{jS as BUILD,ia as FMBound,P3 as FMCalculator,GE as FMCoordsTransformer,sE as FMDepthPeelingMode,kE as FMDomMarker,BE as FMDynamicModel,WE as FMDynamicTextureTool,RE as FMEdgeMode,iE as FMEnterTriggerMode,OE as FMExtrudeMarker,FE as FMHeatMap,cE as FMImageMarker,Cr as FMInfoMode,R3 as FMLabelField,zE as FMLight,VE as FMLightMode,Oy as FMLineMarker,Dy as FMLineType,TE as FMLocationMarker,E as FMMap,D3 as FMMapMask,FM as FMMarker,Nr as FMMarkerAnchor,ZE as FMMarkerCluster,qy as FMMarkerFun,W3 as FMMarkerLayer,va as FMMouseMode,HE as FMOrientedBound,o3 as FMOverviewMode,bE as FMPolygonMarker,N3 as FMRectangle,Py as FMSegment,eh as FMShadingMode,Am as FMTextAlign,fE as FMTextMarker,p as FMType,na as FMUtil,Lr as FMViewMode,La as FMZoomCenterType,WS as VERSION,zS as default}; diff --git a/src/assets/fengmap/fengmap.plugin.ui.min.js b/src/assets/fengmap/fengmap.plugin.ui.min.js new file mode 100644 index 0000000..181d681 --- /dev/null +++ b/src/assets/fengmap/fengmap.plugin.ui.min.js @@ -0,0 +1,35 @@ +// /**Released Version v3.1.10,BUILD 236,Time 1749031427706. Fengmap Javascript SDK es6, see: https://www.fengmap.com for details**/ +let e={LEFT_TOP:1,LEFT_BOTTOM:2,RIGHT_TOP:3,RIGHT_BOTTOM:4};class t{constructor(t){t=t||{},this.t=null,this.i=t,void 0===this.i.position&&(this.i.position=e.LEFT_TOP),this.h=null,this.o=null}addTo(t){this.t=t,this.l()}remove(){this.i.contain.removeChild(this.o)}on(t,i){this.o.onclick=function(){i&&i()},this.o.addEventListener("touchend",()=>{i&&i()},!1)}get position(){return this.i.position}set position(t){this.i.position=t,this.u(this.i.position,this.i.offset,this.o)}get offset(){var{x:t,y:i}=this.i.offset;return{x:t,y:i}}set offset(t){this.i.offset=t,this.u(this.i.position,this.i.offset,this.o)}}Object.assign(t.prototype,{l(){var t=document.createElement("div"),i=(t.classList.add("fm-compass-container"),void 0!==this.i.backgroundImageSize&&(t.style.width=this.i.backgroundImageSize+"px",t.style.height=this.i.backgroundImageSize+"px"),void 0!==this.i.backgroundImageURL&&(t.style.backgroundImage="url('"+this.i.backgroundImageURL+"')"),void 0===this.i.position&&void 0===this.i.offset||this.u(this.i.position,this.i.offset,t),(this.i.contain||(this.i.contain=this.t.getContainer(),this.t.getContainer())).appendChild(t),-this.t.getRotation());this.h=document.createElement("div"),this.h.classList.add("fm-compass-element"),this.A(i),void 0!==this.i.pointerImageURL&&(this.h.style.backgroundImage="url('"+this.i.pointerImageURL+"')"),void 0!==this.i.pointerImageSize&&(this.h.style.width=this.i.pointerImageSize+"px",this.h.style.height=this.i.pointerImageSize+"px"),t.appendChild(this.h),this.o=t,this.t.on("update",()=>{this.m()})},m(){var t=-this.t.getRotation();this.A(t)},A(t){this.h.style.transform="rotate("+t+"deg)",this.h.style.msTransform="rotate("+t+"deg)",this.h.style.mozTransform="rotate("+t+"deg)",this.h.style.webkitTransform="rotate("+t+"deg)",this.h.style.oTransform="rotate("+t+"deg)"},u(t,i,s){s.style.left="",s.style.right="",s.style.top="",s.style.bottom="",t===e.RIGHT_TOP?(s.style.right=-(i=i||{x:-10,y:10}).x+"px",s.style.top=i.y+"px",s.style.bottom="auto",s.style.left="auto"):t===e.LEFT_BOTTOM?(s.style.left=(i=i||{x:10,y:-10}).x+"px",s.style.bottom=-i.y+"px",s.style.top="auto",s.style.right="auto"):t===e.RIGHT_BOTTOM?(s.style.right=-(i=i||{x:-10,y:-10}).x+"px",s.style.bottom=-i.y+"px",s.style.top="auto",s.style.left="auto"):(s.style.left=(i=i||{x:10,y:10}).x+"px",s.style.top=i.y+"px",s.style.bottom="auto",s.style.right="auto")}});class i{constructor(t){this.v=t=t||{},this.g=40,void 0!==t.maxWidth&&(this.g=t.minWidth),this.p=100,void 0!==t.maxWidth&&(this.p=t.maxWidth),(this.M=void 0)!==t.height&&(this.M=t.height),(this.B=void 0)!==t.fontSize&&(this.B=t.fontSize),(this.C=void 0)!==t.position&&(this.C=t.position),this.t=null,this.O=null,this.I=[1e7,5e6,2e6,1e6,5e5,2e5,1e5,5e4,25e3,2e4,1e4,5e3,2e3,1e3,500,200,100,50,20,10,5,2,1,.5,.2,.1,.05,.02,.01],this.T=this.T.bind(this)}addTo(t){this.t=t,this.l()}remove(){this.t.off("zoom",this.T),this.t.getContainer().removeChild(this.O)}}Object.assign(i.prototype,{l(){this.O=document.createElement("div"),this.O.classList.add("fm-control-scale-bar-contain"),this.O.style.width=this.g+"px",void 0!==this.M&&(this.O.style.height=this.M+"px"),this.O.style.zIndex=20,void 0===this.C&&void 0===this.v.offset||this.u(this.C,this.v.offset,this.O),this.t.getContainer().appendChild(this.O);var t=document.createElement("div"),t=(t.setAttribute("id","ruleWord"),t.classList.add("fm-control-scale-bar-text"),void 0!==this.B&&(t.style.fontSize=this.B+"px"),this.O.appendChild(t),document.createElement("div")),t=(t.classList.add("fm-control-scale-bar-left1"),this.O.appendChild(t),document.createElement("div")),t=(t.classList.add("fm-control-scale-bar-left2"),this.O.appendChild(t),document.createElement("div")),t=(t.classList.add("fm-control-scale-bar-right1"),this.O.appendChild(t),document.createElement("div")),t=(t.classList.add("fm-control-scale-bar-right2"),this.O.appendChild(t),document.createElement("div")),t=(t.classList.add("fm-control-scale-bar-bottom1"),this.O.appendChild(t),document.createElement("div"));t.classList.add("fm-control-scale-bar-bottom2"),this.O.appendChild(t),this.T(),this.t.on("zoom",this.T)},u(t,i,s){switch(s.style.left="",s.style.right="",s.style.top="",s.style.bottom="",t){case e.LEFT_TOP:s.style.left=(i=i||{x:10,y:10}).x+"px",s.style.top=i.y+"px";break;case e.RIGHT_TOP:s.style.right=-(i=i||{x:-10,y:10}).x+"px",s.style.top=i.y+"px";break;case e.LEFT_BOTTOM:s.style.left=(i=i||{x:10,y:-10}).x+"px",s.style.bottom=-i.y+"px";break;case e.RIGHT_BOTTOM:s.style.right=-(i=i||{x:-10,y:-10}).x+"px",s.style.bottom=-i.y+"px";break;default:s.style.left=(i=i||{x:10,y:10}).x+"px",s.style.top=i.y+"px"}},T(t){var i={x:document.body.clientWidth/2,y:document.body.clientHeight/2},s={x:i.x+100,y:i.y},i=fengmap.FMUtil.coordsScreenToMap(this.t,i),s=fengmap.FMUtil.coordsScreenToMap(this.t,s),i=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y))/100,s=this.I[Math.floor(this.t.getZoom())-1];this.O.style.width=s/i+"px";let e="";e=s<1e3&&1<=s?s+"米":s<1?1e3*s+"毫米":s/1e3+"公里",document.getElementById("ruleWord").innerHTML=e}});class n{constructor(){}static toColor(t){var i;return"number"==typeof t?t:3<=(i=t.split(",")).length?parseInt(i[0])<<16|parseInt(i[1])<<8|parseInt(i[2]):(console.error("color format error",t),0)}static bindEvent(t,n,i,o){t.addEventListener(i,function(t){var i,s=t||window.event,e=s.target||s.srcElement,h=s.currentTarget;for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var i=(this.document||this.ownerDocument).querySelectorAll(t),s=i.length;0<=--s&&i.item(s)!==this;);return-1"up"==n?e+(i-s)*t:e-(i-s)*t;let c=()=>{A=m=!1,e.scrollTop=0==h?0:h},u=()=>{--A<=0?c():window.setTimeout(()=>{!1!==A&&((l=d({val:a,nbak:r,n:A,elTop:t,VDIRECTIONE:n}))&&(e.scrollTop=l),u())},a)};m?(A=0,window.setTimeout(()=>{var t=Object(s,{to:e.scrollTop});m=!1,i(t)},a+1)):(m=!0,A=r,u())}}static sleep(t){for(var i=(new Date).getTime(),s=0;s<1e7&&!((new Date).getTime()-i>t);s++);}static getClikEventName(){return window.PointerEvent?"pointerdown":"click"}}let s={FMMap_CONTROL_SMALL:"small",FMMap_CONTROL_NORMAL:"normal"};class h{constructor(t){this.size=s.FMMap_CONTROL_NORMAL,this.position=e.LEFT_TOP,this.offset={x:10,y:10},this.imgURL="resource/style/wedgets/img/",this.floorButtonCount=5,this.needAllLayerBtn=!0,Object.assign(this,t)}}let o={MODE_3D:2,MODE_2D:4};function r(){var t=document.createElement("div"),i=` +
`;return t.innerHTML=i.trim(),t.firstChild}function l(){var t=document.createElement("div"),i=` +
`;return t.innerHTML=i.trim(),t.firstChild}function d(){var t=document.createElement("div"),i=` +
+
+
`;return t.innerHTML=i.trim(),t.firstChild}function c(){var t=document.createElement("div");return t.innerHTML='
`;return t.innerHTML=i.trim(),t.firstChild}function m(t,i){var s=document.createElement("div"),t=`
`;return s.innerHTML=t.trim(),s.firstChild}function f(t,i){var s=document.createElement("div"),i=` +
+ +
+ `;return s.innerHTML=i.trim(),s.firstChild}function v(){var t=document.createElement("div"),i=(t.classList.add("fm-enter-exit-building"),` +
+
+
+
+ `);return t.innerHTML=i.trim(),t}function g(t,i,s){switch(s.style.left="",s.style.right="",s.style.top="",s.style.bottom="",t){case e.LEFT_TOP:s.style.left=i.x+"px",s.style.top=i.y+"px",s.style.bottom="auto",s.style.right="auto";break;case e.RIGHT_TOP:s.style.right=-i.x+"px",s.style.top=i.y+"px",s.style.bottom="auto",s.style.left="auto";break;case e.LEFT_BOTTOM:s.style.left=i.x+"px",s.style.bottom=-i.y+"px",s.style.top="auto",s.style.right="auto";break;case e.RIGHT_BOTTOM:s.style.right=-i.x+"px",s.style.bottom=-i.y+"px",s.style.top="auto",s.style.left="auto";break;default:s.style.left=i.x+"px",s.style.top=i.y+"px",s.style.bottom="auto",s.style.right="auto"}}function p(t,i){t&&i?t.appendChild(i):console.error(t,i)}Object.freeze(o);let a=["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"],b=1234567,w=Math.PI/180,M=180/Math.PI;function x(){var t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,e=4294967295*Math.random()|0;return(a[255&t]+a[t>>8&255]+a[t>>16&255]+a[t>>24&255]+"-"+a[255&i]+a[i>>8&255]+"-"+a[i>>16&15|64]+a[i>>24&255]+"-"+a[63&s|128]+a[s>>8&255]+"-"+a[s>>16&255]+a[s>>24&255]+a[255&e]+a[e>>8&255]+a[e>>16&255]+a[e>>24&255]).toLowerCase()}function y(t,i,s){return Math.max(i,Math.min(s,t))}function E(t,i){return(t%i+i)%i}function B(t,i,s,e,h){return e+(t-i)*(h-e)/(s-i)}function V(t,i,s){return t!==i?(s-t)/(i-t):0}function C(t,i,s){return(1-s)*t+s*i}function D(t,i,s,e){return C(t,i,1-Math.exp(-s*e))}function _(t,i=1){return i-Math.abs(E(t,2*i)-i)}function P(t,i,s){return t<=i?0:s<=t?1:(t=(t-i)/(s-i))*t*(3-2*t)}function Q(t,i,s){return t<=i?0:s<=t?1:(t=(t-i)/(s-i))*t*t*(t*(6*t-15)+10)}function Z(t,i){return t+Math.floor(Math.random()*(i-t+1))}function G(t,i){return t+Math.random()*(i-t)}function N(t){return t*(.5-Math.random())}function X(t){void 0!==t&&(b=t);t=b+=1831565813,t=Math.imul(t^t>>>15,1|t);return(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function Y(t){return t*w}function z(t){return t*M}function H(t){return 0==(t&t-1)&&0!==t}function J(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function j(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function $(t,i,s,e,h){var n=Math.cos,o=Math.sin,a=n(s/2),r=o(s/2),l=n((i+e)/2),d=o((i+e)/2),c=n((i-e)/2),u=o((i-e)/2),A=n((e-i)/2),m=o((e-i)/2);switch(h){case"XYX":t.set(a*d,r*c,r*u,a*l);break;case"YZY":t.set(r*u,a*d,r*c,a*l);break;case"ZXZ":t.set(r*c,r*u,a*d,a*l);break;case"XZX":t.set(a*d,r*m,r*A,a*l);break;case"YXY":t.set(r*A,a*d,r*m,a*l);break;case"ZYZ":t.set(r*m,r*A,a*d,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+h)}}function K(t,i){switch(i.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function W(t,i){switch(i.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}let q={DEG2RAD:w,RAD2DEG:M,generateUUID:x,clamp:y,euclideanModulo:E,mapLinear:B,inverseLerp:V,lerp:C,damp:D,pingpong:_,smoothstep:P,smootherstep:Q,randInt:Z,randFloat:G,randFloatSpread:N,seededRandom:X,degToRad:Y,radToDeg:z,isPowerOfTwo:H,ceilPowerOfTwo:J,floorPowerOfTwo:j,setQuaternionFromProperEuler:$,normalize:W,denormalize:K},O={BROWSER:0,WX:1},I=(Object.freeze(O),{document:"undefined"!=typeof document?document:{},window:"undefined"!=typeof window?window:{},environment:O.BROWSER,XMLHttpRequest:"undefined"!=typeof XMLHttpRequest?XMLHttpRequest:{}});class T{constructor(t,i){this.map=t,this.parent=i.parent;var s=t.getState().viewBuildingID,i=(this.canClick=!0,i.buildingID),t=t.getMapOptions().buildingID,s=(this.enterShow=i!==t&&i!==s,s!==t&&i!==t);this.currentFocuseBuiding=i,I.environment===O.BROWSER&&(t=document.querySelector(".fm-enter-exit-building-button-enter"),i=document.querySelector(".fm-enter-exit-building-button-exit"),this.enterShow?t.classList.remove("fm-hide"):s&&i.classList.remove("fm-hide"),t.addEventListener("pointerdown",()=>{this.enterBuilding()}),i.addEventListener("pointerdown",()=>{this.exitBuilding()}))}enterBuilding(){var{currentFocuseBuiding:t,canClick:i,map:s}=this;null!==t&&!1!==i&&(this.canClick=!1,s.enterBuilding({buildingID:t,finish:()=>{this.canClick=!0}}),this.parent.k=t)}exitBuilding(){var t=this.map;!1!==this.canClick&&(this.canClick=!1,t.exitBuilding({finish:()=>{this.canClick=!0}}),this.currentFocuseBuiding=null,this.parent.k=null)}}let k={NORMAL:1,INDOOR:2,OUTDOOR:4};Object.freeze(k);let S;class R{constructor(t){this.O=(t=t||{}).contain,this.S=new h(t),this.R=this.S.floorButtonCount,this.t=null,this.U=(window&&"undefined"!==window.fengmap?window:getApp().globalData).fengmap,this.F=!1,this.L=!0,this.V=10,this.D=null,this._=null,this.P=[],this.Z=null,this.G=null,this.N=null,this.uuid=null,this.X=null,I.environment===O.BROWSER&&(this.scrollTopAn_=n.scrollTopAnFun()),this.viewModeControl=void 0===t.viewModeControl||t.viewModeControl,this.floorModeControl=void 0===t.floorModeControl||t.floorModeControl,this.timer=null,this.Y=t.buildingID,this.H=void 0===t.showMap||t.showMap,this.hasDOM=!1,this.enable=!0,this.J=void 0===t.entranceIcon||t.entranceIcon,this.k=null,this.isFinishViewMode=!0,this.j=!0}applicationBuilding(){this.Z=this.t.getBuilding(this.Y),null!==this.k&&(this.Z=this.t.getBuilding(this.k)),0!==this.Z.getFloorInfos().length&&(null!=this.Z.level?this.X=this.Z.level:this.Z.setLevel({level:this.X}),this.O||(this.O=this.t.getContainer()),this.P=this.Z.getFloorInfos(),I.environment===O.BROWSER?this.createDOM():(this.J&&(this.enterExitBuildingButton=new T(this.t,{buildingID:this.Y,parent:this})),this.handleViewModeChanged()),!(1t.maxLevel)?!1:s}findBuilding(){let i=!1;var t=this.t.getState();let s=!1,e=!1,h=this;var n=this.t.focusBuilding;return n&&(n.buildingID===t.viewBuildingID||(t=this.buildingIsInZoomRange(n),n.overviewMode!==k.OUTDOOR&&t))?(i=!0,this.Y!==n.buildingID&&(e=!0),this.Y=n.buildingID,s=!0):o(),!1===i&&(null!==this.Y&&(e=!0),this.Y=null),{isShowToolbar:s,isBuildingChange:e};function o(){var t;!0===h.H&&(i=!0,t=h.t.getMapOptions().buildingID,h.Y!==t&&(e=!0),h.Y=t,s=!0)}}addTo(t){(this.t=t).children.length<=1&&(this.J=!1),(t.toolBar=this).initEvent();t=this.findBuilding().isShowToolbar;t&&this.applicationBuilding()}switchBuilding(){this.removeDOM(),this.Y=null,this.Z=null;var t=this.findBuilding().isShowToolbar;t&&this.applicationBuilding()}remove(){this.removeEvent(),this.removeDOM(),delete this.t.toolBar}removeDOM(){this._&&this.O.removeChild(this._),this._=null,this.hasDOM=!1}removeEvent(){this.t.off("levelChanged",this.gidchange),this.t.off("visibleLevelsLoaded",this.handleLayerChangeStyle),this.t.off("buildingEntered",this.handleBuildingEntered),this.t.off("buildingExited",this.handleBuildingExited),this.t.off("buildingOverviewModeChanged",this.handleBuildingOverviewModeChanged),this.t.off("ViewBuildingChange",this.handleViewBuildingChange),this.t.off("zoom",this.handleCheckZoom),this.t.off("viewModeChanged",this.handleViewModeChanged)}initEvent(){var t=t=>{var i;!this.enable||!this.Z||t.buildingID&&t.buildingID!==this.Z.buildingID||!t.buildingID&&this.Z.buildingID!==this.t.getMapOptions().buildingID||I.environment!==O.BROWSER||(i=this.Z.getFloorInfos().map(t=>t.level),t.leveli[i.length-1]||(this.D.scrollTop=this.getCenterScrolltopById(t.level,i.length),this.setGidStyleByEvent(t.level,"levelChanged"))};this.gidchange=t,this.t.on("levelChanged",t),this.$=t=>(this.map?this.map.mapView.container_:document).querySelector(t),this.handleBuildingEntered=this.handleBuildingEntered.bind(this),this.handleBuildingExited=this.handleBuildingExited.bind(this),this.handleBuildingOverviewModeChanged=this.handleBuildingOverviewModeChanged.bind(this),this.handleLayerChangeStyle=this.handleLayerChangeStyle.bind(this),this.handleViewBuildingChange=this.handleViewBuildingChange.bind(this),this.handleCheckZoom=this.handleCheckZoom.bind(this),this.handleViewModeChanged=this.handleViewModeChanged.bind(this),this.t.on("ViewBuildingChange",this.handleViewBuildingChange),this.t.on("buildingEntered",this.handleBuildingEntered),this.t.on("buildingExited",this.handleBuildingExited),this.t.on("buildingOverviewModeChanged",this.handleBuildingOverviewModeChanged),this.t.on("visibleLevelsLoaded",this.handleLayerChangeStyle),this.t.on("zoom",this.handleCheckZoom),this.t.on("viewModeChanged",this.handleViewModeChanged)}handleViewModeChanged(){this.t.getViewMode()===o.MODE_3D?this.L=!1:this.L=!0,this.setViewModeToStyle(this.G,this.L?"2d":"3d")}handleCheckZoom(){var t=this.findBuilding().isBuildingChange;t&&this.switchBuilding()}createDOM(){this.hasDOM=!0,this.uuid=q.generateUUID();var i=r(),s=(this._=i,g(this.S.position,this.S.offset,i),p(this.O,i),this.Z.getFloorInfos().map(t=>t.level)),e=s.length;let h=this.R,n=!0;this.viewModeControl&&(this.G=l(),this.initViewModePanelEvent(this.G),p(i,this.G),this.handleViewModeChanged());var o=d();if(this.S.needAllLayerBtn&&p(i,o),this.K=o,this.eventSwitchBtn(o),this.handleLayerChangeStyle=this.handleLayerChangeStyle.bind(this),this.floorModeControl){e<=this.R&&(h=e,n=!1),this._layer,this.F&&this._layers;var o=c(),a=(p(i,o),n&&o.appendChild(m("up",this.uuid)),u());p(o,a),this.D=a;for(let t=this.P.length-1;-1{this.hasDOM&&this.toggleLayer()}))}setViewModeToStyle(t,i){this.viewModeControl&&I.environment===O.BROWSER&&this.hasDOM&&("2d"==i?(t.classList.remove("fm-view-3d"),t.classList.add("fm-view-2d")):(t.classList.remove("fm-view-2d"),t.classList.add("fm-view-3d")))}initViewModePanelEvent(t){var i=n.getClikEventName();t.addEventListener(i,()=>{this.toggleViewMode()})}eventBtnPanelInit(s){let e=this;e.changeScrollBtnPic(),n.bindEvent(s,"label","click",function(){var t;!e.enable||e.X===parseInt(this.dataset.gid)||(e.foucusId=parseInt(this.dataset.gid),t=e.Z.getFloorInfos().map(t=>t.level),this.dataset.gidt[t.length-1]||(s.scrollTop=e.getCenterScrolltopById(parseInt(this.dataset.gid),t.length),e.setGidStyleByClick(this.dataset.gid,"click"))});var t=t=>{e.changeScrollBtnPic();let i=0;t.wheelDelta?i+=-t.wheelDelta:t.detail&&(i+=t.detail),this.scrollTopAn_({el:s,to:s.scrollTop,form:s.scrollTop+i}),t.stopPropagation()};s.addEventListener("mousewheel",t,{passive:!0}),s.addEventListener("MozMousePixelScroll",t,!1),s.addEventListener("touchstart",this.touchstart.bind(this),!1),s.addEventListener("touchmove",this.touchmove.bind(this),!1),s.addEventListener("touchend",this.touchend.bind(this),!0)}touchstart(t){t.preventDefault(),this.touchStartPointY=t.touches[0].pageY,this.touchPointX=t.touches[0].pageX,this.touchPointY=t.touches[0].pageY,t.stopPropagation()}touchmove(t){t.preventDefault(),this.touchEndPointX=t.touches[0].pageX,this.touchEndPointY=t.touches[0].pageY,this.handleTouchEnd(t),t.stopPropagation()}handleTouchEnd(t){this.touchAchieve(t,"handleTouchEnd")}touchend(t){this.touchAchieve(t,"touchend")}touchAchieve(t,i){var s=this;let e=null,h=(0<(t=t||window.event).changedTouches.length&&(s.touchEndPointX=t.changedTouches[0].pageX,s.touchEndPointY=t.changedTouches[0].pageY),(e=t.target)instanceof HTMLSpanElement==!0&&(e=e.parentElement),s.touchEndPointY-s.touchPointY);"touchend"===i?((h=Math.abs(h))<5&&0<=h&&e&&(i=parseInt(e.dataset.gid),isNaN(i)||(s.foucusId=i,s.setGidStyleByClick(i,"click"))),t.stopPropagation()):0!=(i=-h)&&(s.touchPointX=s.touchEndPointX,s.touchPointY=s.touchEndPointY,t=s.$(".fm-floor-list"),this.scrollTopAn_({el:t,to:t.scrollTop,form:t.scrollTop+i}))}eventPanelInit(t,i,s){let e=this;function h(t){t.id==="scroll_up"+e.uuid?(t=e.X+1,t=Math.min(s[s.length-1],t),e.foucusId!=t&&(e.foucusId=t,e.setGidStyleByClick(t,"click"))):(t=e.X-1,t=Math.max(s[0],t),e.foucusId!=t&&(e.foucusId=t,e.setGidStyleByClick(t,"click")))}t.onselectstart=function(){return!1},t.style.MozUserSelect="none",n.bindEvent(t,".fm-scroll","click",function(t){h(this)}),n.bindEvent(t,".fm-scroll","touchend",function(t){h(this)})}getCenterScrolltopById(t,i){return(i-t-Math.floor(this.R/2))*this.W}changeScrollBtnPic(){var t=this.X,i=this.Z.getFloorInfos().map(t=>t.level),s=(i.sort(function(t,i){return t-i}),document.getElementById("scroll_down"+this.uuid)),e=document.getElementById("scroll_up"+this.uuid);t==i[0]&&s?(s.classList.remove("fm-scroll-down"),s.classList.add("fm-scroll-down-grey")):s&&(s.classList.remove("fm-scroll-down-grey"),s.classList.add("fm-scroll-down")),t==i[i.length-1]&&e?(e.classList.remove("fm-scroll-up"),e.classList.add("fm-scroll-up-grey")):e&&(e.classList.remove("fm-scroll-up-grey"),e.classList.add("fm-scroll-up"))}changeFocusLevel(t){this.foucusId=t}changeLevelsSelect(t){this.allLayer=t,this.setLayerStatus(t)}setLayerStatus(t){this.F=t,I.environment===O.BROWSER&&(this.F?(this.K.firstElementChild.classList.remove("fm-layer-image-one"),this.K.firstElementChild.classList.add("fm-layer-image-many")):(this.K.firstElementChild.classList.remove("fm-layer-image-many"),this.K.firstElementChild.classList.add("fm-layer-image-one")))}onChange(t){S=t}set foucusId(t){this.Z&&(null!==this.N&&!1===this.j&&this.N.finish(),this.j=!1,this.Z.setLevel({level:t,finish:()=>{this.j=!0},callback:t=>{this.N=t}}),S)&&S([t])}get foucusId(){return this.X}setGidStyleByEvent(t){this.setGidStyleByClick(t)}setGidStyleByClick(t){var i=document.getElementById("gid_"+this.X+this.uuid);i&&(i.classList.remove("fm-floor-name-active"),i.classList.add("fm-floor-name-normal"),this.X=parseInt(t),i=document.getElementById("gid_"+t+this.uuid))&&(i.classList.remove("fm-floor-name-normal"),i.classList.add("fm-floor-name-active"),this.changeScrollBtnPic())}get allLayer(){return this.F}set allLayer(t){this.Z&&((this.F=t)?this.Z.setVisibleLevels(this.Z.getFloorInfos().map(t=>t.level)):this.Z.setVisibleLevels([this.Z.level]))}handleBuildingEntered(i){null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{var t;this.switchBuilding(),this.t.followFocus&&(this.Z=this.t.getBuilding(i.buildingID),this.Z)&&(this.Z.overviewMode==k.NORMAL||this.Z.overviewMode==k.INDOOR||this.t.focusBuilding&&this.t.focusBuilding.buildingID==this.t.getState().viewBuildingID)&&(t=this.Z.level,this.changeFocusLevel(t))},200)}handleBuildingExited(t){null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{if(t.noCenter&&(this.k=null),this.switchBuilding(),this.t.followFocus){let t=this.Z;(t=null==this.Z?this.t.getBuilding(this.t.getMapOptions().buildingID):t)&&(null!==this.N&&!1===this.j&&this.N.finish(),this.j=!1,t.setLevel({level:t.level,finish:()=>{this.j=!0},callback:t=>{this.N=t}}))}},200)}handleBuildingOverviewModeChanged(){this.switchBuilding()}handleViewBuildingChange(){this.switchBuilding()}toggleViewMode(){!1!==this.isFinishViewMode&&(this.isFinishViewMode=!1,this.t.getViewMode()===o.MODE_3D?(this.t.setViewMode({mode:o.MODE_2D,finish:()=>{this.isFinishViewMode=!0}}),this.setViewModeToStyle(this.G,"2d")):(this.t.setViewMode({mode:o.MODE_3D,finish:()=>{this.isFinishViewMode=!0}}),this.setViewModeToStyle(this.G,"3d")))}toggleLayer(){var t;this.j&&(t=!this.F,this.changeLevelsSelect(t),this.t.followFocus)&&this.Z&&(t=this.Z.level,-1==this.Z.visibleLevels.indexOf(t)&&this.Z.visibleLevels.push(t),this.changeFocusLevel(t))}setLevel(t){t<1||t>this.P.length||(this.foucusId=t)}enterBuilding(){this.enterExitBuildingButton.enterBuilding()}exitBuilding(){this.enterExitBuildingButton.exitBuilding()}}class U{constructor(t){t=t||{},this.t=null,this.q=new h(t),this.q.position||(this.q.position=e.LEFT_TOP),this.O=t.contain,this.q.offset||(this.q.offset={x:10,y:10}),this.tt=null,this.it=t.imgURL||"resource/style/wedgets/img/"}addTo(t){this.t=t,this.O||(this.O=this.t.getContainer()),this.init()}remove(){this.O.removeChild(this.tt)}init(){var t=this.createPanel();this.tt=t;let i=this;g(this.q.position,this.q.offset,t),n.bindEvent(t,"img","mouseover",function(t){this.src=this.dataset.on}),n.bindEvent(t,"img","mouseout",function(t){this.src=this.dataset.leave}),n.bindEvent(t,"div","click",function(t){"in"===this.dataset.type?i.t.zoomIn():i.t.zoomOut()}),n.bindEvent(t,"div","touchend",function(t){"in"===this.dataset.type?i.t.zoomIn():i.t.zoomOut()})}showZoom(t){this.tt.style.display=t?"block":"none"}createPanel(){var t=document.createElement("div");return t.setAttribute("class","fm-control-zoom-bar"),t.style.left=0,t.style.top=0,this.O.appendChild(t),t.innerHTML=this.createInnerHtml(),t}createInnerHtml(){return` +
+
+
+ `}}class F extends U{constructor(t){super(t)}addTo(t){super.addTo(t)}remove(){super.remove()}showZoom(t){super.showZoom(t)}createPanel(){var t=document.createElement("div");t.setAttribute("class","fm-control-zoom"),t.style.zIndex=20,t.style.position="absolute",t.style.backgroundColor="white",t.style.boxShadow="2px 2px 3px rgba(0,0,0, 0.3)",t.style.borderRadius="2px",t.style.left=0,t.style.top=0,this.O.appendChild(t);return t.innerHTML=this.createInnerHtml("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOAgMAAABiJsVCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACVBMVEUAAABmZmYAAABV8S+1AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAATSURBVAjXY2DAC0JDQwMgBF4AAFvvAp8tw46tAAAAAElFTkSuQmCC","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAIElEQVQokWNgGAXUB4zGsrL/ydHIwsDAcI/KjhkFZAMA5XkCUOIdNxMAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOAgMAAABiJsVCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACVBMVEUAAABmZmYAAABV8S+1AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAXSURBVAjXY2BgZQACXERoaGgAhMCrDgBkQQLbnsbDyQAAAABJRU5ErkJggg==","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAOElEQVQokWM0lpVlwAE+QGkBbJJMuHQRAiNBIwsDA8M7HHJ8UBqrPEU2CuGQg8UjVvkhFKr01wgAH8cEixbYBa8AAAAASUVORK5CYII="),t}createInnerHtml(t,i,s,e){return` + +
+ +
+
+
+ +
+ `}}let L={};L.FMCompass=t,L.FMControlPosition=e,L.FMScaleBar=i,L.FMToolbar=R,L.FMZoomBar=U,L.FMZoomControl=F;export{t as FMCompass,e as FMControlPosition,i as FMScaleBar,R as FMToolbar,U as FMZoomBar,F as FMZoomControl,L as default}; diff --git a/src/assets/fengmap/toolBarStyle.css b/src/assets/fengmap/toolBarStyle.css new file mode 100644 index 0000000..d27c10a --- /dev/null +++ b/src/assets/fengmap/toolBarStyle.css @@ -0,0 +1 @@ +.fm-control-groups{width:48px;position:absolute;border-radius:2px;z-index:20;top:78px;right:80px}.fm-view{display:flex;justify-content:center;align-items:center;margin-bottom:10px;width:48px;height:48px;padding:10px;box-sizing:border-box;cursor:pointer;box-shadow:0 0 8px 0 rgba(0,0,0,.1);border-radius:10px;background:#fff}.fm-view-3d{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABJtJREFUaEPtmFtMHGUUx/9ndimWFtjdxsSIvmg0MX2ApaG14rXi7an6UpMmJsbKgtCY1KSRXgiDrdZoqiY2sCxq1NjExAcSozG1aSm12igCu8ZootE+GEvkgZ1tQyuwM38zLAsIu8xlpxCUeZrd75zz/X/f+S7nG8EKf2SF68cqwHJncDUD/8kMVEa0h0HjBQhqBTAI6VOIo0PdwT6vgT2dQlUN2kOg0U5iay6hItKr+Ng22Bn6yisQTwDC9VodZUr4XbaEiZwSxdcWj5Z9bct+EaOCAMIN2oM0jHYCtW6ECOSkCTLUVXbejb/p4wrAFG7QUEHc7bbjeX4n/OJrG4iVf+s0niOA6kZtm65TBXiP047s2IvgC9DXFu8u77djbzsDmyKpLTqM10jeazdwIXYi+NyvFLV8Hy390SqOZQYqG69UwBj/DWSxVTCP28dkndwUfyuoLRbXHoA+/jvANR4LXDScCK6u9ykV5zoDyYIATOdww6WtNNKvu91tnIPLab/I3oFYYNDK1zIDcwM43u+tep/X7uagcwSQ7c/qxHWoGwI5IwrahrqCZ5375vEI1yefovAIIL8oihwejAZOzzc1ax6BoeYrHazETAkH1Fw1UmUk+YAArSRvg4J9ia7QR7ni5c1AVX1yhOD1M04ip/xQDuQ6bKobU4/ouq4CuNNK9NTeLdIHBWo8GjyzYFAaU5vFMF4mWTfbJn8luoM3OAKorB9lTgeRTxUfWwc7Qz/Mb69uSD2qUzdP6C15fM8SUBOxYO8C4c2XN8pk+jDJx3P5JrpDOQc7bwbyAWSCCwX8GGZB1lX+6/wOw/WpxwhjD4S1JChAn+JTjuaahjXPabdM6jTrqZ0glXwZ9BhgGkMkDeD9In/xS/0dJX/YmT5Zm/DusRs5MX4QkGdJFln5XhOAOetjXATREvG/8k20dGQxMZubL22YmEy/CGA3ibVWwrPt1xZgVsUYRN64vS7Q/skO0eeKU1UqPcPafiH3kiizK3ypATIrBNLjk8CTAzGZNH/fr9Kv/Zk8TmCHU+HLAjC9VT4djwU/MN/NM8UAP3Qr3vRbqik0uywUpSPeFWg2/6iKJI+RnHp3+yw5AETeS8SCu0zBlZHkuyCfcSt+WTKwCjAvXf/DKRRJ/l3QNdLDNWDezuKxUEmuNbRINTp6rqAbmKcA0huPBbc5AtgU0ap18EuSG1ztHh4BCHBRKSqqG+wo/dkRgGlc3XT5DiOd7iR5n2MITwDks+Jief67Y4EL+fq3daXM3Lxo1uo1tkEKAMhcMX377XxytAWQFV3ZmHxCdB4isNESxAWAiPRD5EC8K3DSMv60gSMA0ydTVSZ3CkUleWvejhwAiOAnKnIwEQ322BWetXMMkHU0K8zkxdQugdFKomJBx7YA5IICtG2vCBxXVTGcijftXQPMAbkuNaw10UDLvz8C4NVELLQvUwuNHgHRMjNqgmEBDikIvpMtud2I9wRgBqSJ61NpbQ/BBkJG1viLt2evmTVNV26emBw3p0dIRKJr15W/ff5NuepW9Fy/gjPghYhCYqwCFDJ6XviuZsCLUSwkxorPwD+u9SBP4k09IwAAAABJRU5ErkJggg==") no-repeat #fff;background-size:24px 24px;background-position:50%}.fm-view-2d{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAyFJREFUaEPtmMnLj1EUxz+voRQLlMSCTBkXpCQkMs9kJQvJQsrCQvwDLLGiWLGRhTIPZSESYkFkJkMkhUIszH3r3nq6PcOd3lc//c7mV+9z77nfzz33veec20GLW0eL66cN8K8j2I7A/xqBccA8YATwB3gMXDC/WZlzHyEJXwYMr1D5CDgFPMlFkQtgLLC8Rrir96EBeZoKkgog4dpxHZUYe2BAnsVM1pxYAAlfCoyMXdiZdx84CTwP9RcKMMbseC7hrt57BuSFL4gvwDBgNTDK13HiuLvAMeBNkx8fgH7ADqBHk7PM378D24FvdX59AXYC3TMLbHL3wwB8TQXQfN0yOkKxt02TWPe78sVR4FXTRJ8IFH2E3vdN65cJD0p0oQB2waaMGypcpYaE6zfI6gCmAquAd8BZQNnTtVSQOuGjgSXAQHMjXS8jqwPYBfQpTBLA8YpkM97kB123PqZaSDuus+6afKwElHOsfQG2hgLsr1ByBzgBvC75PsFk6CqQOuGDgRXAxIp1N+YCsH5uml3UEXNNIHMLt5Ytp8uO4QATvSkNpU12AIn+DVwFzgAffc5OYUxfYDEwwzPHdAqA1fMTuAycAz43gOj/agEwG+gZAN2pAFaH0r86r9MmOkV93YBFwHygV4BwO7RLAOxit4EDwC/zB5UhG4DJEcL/CYAWPQhcM6srp6xPEK+pXRoBLXgJOGxErwFmtRqAbqdDRvQ6YFoboGQH6kqJqkzsu5HtCDg7FfxPvDexjcwZAXVnm0NroW2JHVhOAFWtu0MBhgBbgN6+h94ZlwvgE7AHeBsKoPGDgLWRzyk5APS8cgR4X7WJvi2lOi81GUMDopECoPJbzVPjk6MvgNU9yTQdikyTxQC8NML11OhloQByqqpSzYfeRtWMVFkIgM63urxbXqoLg2IA7HRVmNNN463mxDUfgA/mLfRGSfntxZICYBdQU6JCbaHzCHDevCZonF439N2abhZ1cVcKJbeXYHdQDgDrU03KHGAmoFeEfYU2sz+wyVzJqlIvAmp+ki0nQLKYGAdtgJhdyzmnHYGcuxnjq+Uj8BeAFJsx+g4qGwAAAABJRU5ErkJggg==") no-repeat #fff;background-size:24px 24px;background-position:50%}.fm-layer{width:48px;height:48px;box-shadow:0 0 8px 0 rgba(0,0,0,.1);border-radius:10px;cursor:pointer;background-color:#fff;display:flex;justify-content:center;align-items:center;margin-bottom:10px}.fm-layer-image-one{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAqhJREFUaEPtV0tIVFEY/r47zgyiTjObotpELVo6URHYphbtrU3bHjRkEAWVQUaOkL2spOwxjFGLWrS0CIoIcRdR44yLoFZBpBlG17GwfMz9YwZGRNT7OHcU4dztPd//f4//nHsuscIfrnD+0AKWO0GdgE5A0QE9QooGKsN1AsoWKhbQCSgaqAzXCcxnYX3C3A2RswAaSE5C8EpCVZcH7tZ9VLZ8TgFfE9iaGN1UgFwXkca5RAkWSHkQqg61vrtV+8MvIb4I2HFcIhMT5nkRngAkZEPuN4mr1TWxm287+VdViJKAZFKMnqH8IYG0Q2S1SzLfDPBcfzr6hKS4xM4s9ywgftTchQI6BRL32ryEI/tp4FQuFevzUse1gO1NoxsnC9IBkX1eGi6EIfm8KhBo/nA/8tlNXccCdjZL3bhptljkSYiE3TRxupbkNIGUgUBbJh356QRnK6A4588GRw9YwCVA1jgpqrqGRB4w2teGV91+2cWJxerZCqhP/HoKwX5VUl7wJN/k0rE9SgLiCfOLiGzwQkAVQ3Ak1x1b9HSzTSB+zIzLNB5CZIsqITd4El8FxpGBdPS1UgJFcGkffM8ftCxpr/Q+IDEGwZXo+lhnX5L/7ETbJjC7QCVPouIJBEg3w8HWbFfdiB3x8ntXAsog/78FfFHFwJlMOvLJKXElAWWw8teYzAYMnu5PRXvdEvdFQHl/9AznD4slF53eh0gMAmxpXBd9nEzS8kq+dBNRAc/GOrqREn8M8JqB6I1MmuN+9PZNQJlM6Z9ApEMge2diLm5QkUfBYOjC+3u1w34Q922EFiKzrWls85RVaABkygiGe7N3aob8JF5xAZUgO19N30doqYjrBJba6YX66RFa7iR0AjoBRQf0CCkaqAzXCShbqFhAJ6BooDL8P71k3jFn5WarAAAAAElFTkSuQmCC") no-repeat #fff;background-size:100% 100%;height:24px;width:24px}.fm-layer-image-many{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABd5JREFUaEPtWHtsU3UU/s5t92JsbRcMD0kICvwH2wpuiJIQRKKJGBMUYiSYaLZuPMTxHiKMwYC54Yy8tg6VGIlRiI9ENPqXQSMv94KokEwMBBCM9LYwHl3b+5nbrbQURnvbLoZk99/fOd8533n9zu8KHvBPHnD/MUDg/87gQAYGMpBkBAZK6F4BLCxRn6dgKclJAngocgBKxjsdjYMuJBnwu9RTmoH8Mk8RAlo9wKnRlkRwU4j3s81K7c+7rWqqiKSEQNEi92hvt7YZlLkA748pogpka1a2ZfvhBrmZLJGkCDxZ7rZd83MtgEUA0404I4ILIsr6MU9Z9u6fIwEjupGyCRF4qYrpnX+7F2nEWpC2RI3regL8AZE17U7bV4ngGCJAUiaWeeYENG4BODoRg/fROaIosqqtyXbICG7cBOzlrqmaX+oJFhkxYFRWBAdNQGWLM+9kPLoxCdgXeMZofq2O5AvxAKZERkQDsC8zI2PN0e2Dzt8PMyaBglLXeRIPp8QxoyCCkx3OvAlJEcgvdZ0AMd6o7VTIC6Szvdk2NikCM5cz+/I190ohl5MYlArHYmKksoRCxooX3xjp9Xq3kHgl5mUV08O+BQT4VjGjsnV33ol4YGL2QDSIvi6IFmggMSUeAwZk+neMRjtid7jnahprCY4y4OTdooJTUGRNR6Pty0RwDGcg0si0Kma6L6gVBCoB5BhxQF8lAKVq7AzLR/26ShSUqlUk5itCp2WE7b0fq+RWtKPFS7qGem/6NhF4DaRyXyIxlrmI236egL+0N+dtSWoK5ZeopwGO00FEcA5AZVuT7VMRYTRwoUPN1zS8C3B69Jm+TgPYPtikbO1rnbaXuZ7TNNlEMj+oL7jU4cwbnhSBwoXqKM2HbSBnh4BE5Lhi4rLW3Xk/3Qvc7nDNChArBbADUCFygJJR19eDxl7mnh4IaDUAJt+2ATmrmBRHa6Pl+6QIhJQLSq5Ogfjr7pg+Il+YzMqq1l2WTiP1H5K1l3smB/y64xEZE1wCUDNuhM25v0q6Y+EabuLCEvdsCreQDN6QIuKDYFfWIKX6cIPFFcugfh4sNWIjyFlheXGJSK0Jlh0tTrkRD05PlSXwTSxlmh+qQyjrCD7UU6+iKoJNY4Zbd/QVuaKFV8d5ff5qUOZEXIbXoEhDZrp129HtctWoOwkRCBkpXsxcb7dnNai9SSKrl8gZRfS93nogJNfbR+uEeJWgqXcg3IRgZ7rZvPXYztwrRh0P90oMzfxStRrEPCj4cGiOteGHerkerRJcM255N1IwP2KMHoHI5wKM710/gk/OnpKTZklLq2nbkX0xGmti6dUhAfhXEDJDFGlsb7Q2J9XEBaVqJ8lHe0Dksgg3mmBztjjFFw1sL3dN0ALQG31m9JlAAhB8kp4uG47tsP4Vfa6/r7sCWEZoS0AM7iV7pd1pG5IUgUllaqFPwx6Q+kjs5SFnBHy7r/ugwOF+muQqgMVAsCG/McNU1+LMPXV39pjr9borAFaQsIRtoEugVLQ7rXuSIqAr67djoUN9mRB9cjwS5iEdQqWyrdnyndEa1tf0fzzqG4QsB5gXxsQNfaqZaK5tceb+GwvXUBMH/0ZcdJeRWHt7+vTU9SER0+q2ptzDsQw+XsGsW9fdC0isisQAcEsUaUozpW09vmuwfhfE9RkiEEJ8YiVzutzuFSCXAsgOTwT5WhTzmramnN+jrT+7mBmXvG6HBlaCGBY+l24RfkAlsyaRX48JEQgZf2xB1zCfv3sdICUkzT19LpoQH5uE61uceef0O0MTz+uapr0FYGRE+fkB7JU0bGrbaTsbV7jvIZQUgRBegcMzFpq2meCLEQ76QB4DZNwd5aZPI2CfSaS6xWn9M1HHw1lPFiFCP/haC2j6I2faXbDBzPAzs9m84dfduadTZTYlGYh2xu7wPBPQtBUQFgmDP3APMt1c37Ez57dUOd4vGUi1c/Hg9UsG4jGcKpkBAqmKZKI4AxlINHKp0hvIQKoimSjOfxTfV0/Hueb2AAAAAElFTkSuQmCC") no-repeat #fff;background-size:100% 100%;height:24px;width:24px}.fm-floor-list-group{margin-top:0;background-color:#fff;overflow:hidden;width:48px;background:#fff;box-shadow:0 0 8px 0 rgba(0,0,0,.1);border-radius:10px;margin-bottom:10px}.fm-floor-list{overflow:hidden;padding:0 8px;box-sizing:border-box;width:48px}.fm-floor-line{height:1px;border:none;border-top:1px solid hsla(0,0%,60%,.45);border-image:initial;width:100%;margin:0}.fm-floor-name-container{padding:8px 0}.fm-floor-name{display:flex;justify-content:center;align-items:center;width:100%;height:32px;line-height:32px;cursor:pointer;padding:16px 0;box-sizing:border-box;border-radius:2px;font-size:14px;font-family:MicrosoftYaHei;color:#fff;line-height:28px;font-weight:700}.fm-floor-name-normal{font-size:14px;color:#323233}.fm-floor-name-active{font-size:14px;background-color:#2f65ee;color:#fff}.fm-scroll{height:24px;cursor:pointer}.fm-scroll-up{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAcJJREFUaEPt171rVUEUBPBfJBFtTBNLW60E02sThICCVmKjbbARi4TYWKYKpJBUSa0gWCn4UQiK/gE2NrFNaZU0gRiMLLxgFF7u7j37kAe77ZuZPTNz3sKdMOZnYszn1wz87wZbA62BYAJthYIBhumtgXCEQYHWQDDAML01MCTCFMw85ga/f8I7HIYj/0dgVA3cPTb80ZUf8WIcDNzA7SGDvsLbmiZqN3AV9zsGfIYvtUzUNHAFD+j8xkj/gw18rWGiloGLeITJzKEO8BTfM/FDYTUMXMAizhYOs4c1bBfy/oJHDczgMc71HGIXq/jRk9+5ryfppqGXcb7v5QNeGj6ZSGaKT98GzmAJaX1qnLRGaZ3SWhWdPgam8BCXim7qBm9hHT+7oX8QpQZOYQGzJZcUYNPTuolfuZxSA/dwLVe8J+4znudySwxcx51c4SDuJT7kaJQYSC/FdI5oBczO4IXrlCoxsFLhyewc6NjT+iQHXGLgJm7liFbAvMabHJ0SA0cfKZdxOke8B2Yf3/A+9+OnxECPeUZPaQZGn/HJN7QGWgPBBNoKBQMM01sD4QiDAq2BYIBhemsgHGFQoDUQDDBM/w0YVy8xK+gC6wAAAABJRU5ErkJggg==") 50% 50% no-repeat #fff;background-size:24px 24px;padding-top:12px}.fm-scroll-up-grey{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAYtJREFUaEPtl2drw0AMhp9070EL7f//dS20dO/JCw6EtLWlk0IxSGD8IZLuHWflbsLIYzJy/BSB/3awHCgHggrUFgoKGC4vB8ISBhuUA0EBw+XlwB8SSpgdYLv7/QG4B77Cks81WJQD+zPgp0uKxM0YCOwCen6LO0BPWmQ7oC0j9ftCLsiNlMgksAkcGlFdAU/G3N60LALrwJET0CXw4qz5kZ5BYBU4BvftThPpAniLkIgSWOnALzWC+OxIvDfWu1WbXWe5A693JD46Enq7o9UBKa5tIwcyQg5oO8kRV7QQUI0+2DXXSsPJr4A+bNe/tZeA8jUqN4bxNGU8AxqxZhJeAgfAVhM0e9EjcG1N9xDQ4WzP2jiYd9sd/gbbeAicAq3jchDIXII+5jNLkYfACRAdmRZMytFIPbckewj0nTIta3lyzKdWD4HpJUXnHk+dB7imj85H5svPooB4QIdyi0BIvoTiciBBxFCLciAkX0JxOZAgYqhFORCSL6G4HEgQMdSiHAjJl1A8ege+ARcxLTE+3PB6AAAAAElFTkSuQmCC") 50% 50% no-repeat #fff;background-size:24px 24px;padding-top:12px}.fm-scroll-down{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAdJJREFUaEPt10+LjlEYBvDfK8QGC1lNdkqaWNixwH58ABajptlQSvm3srIiFlJSSmnKFxhfYEqWkmzGUlZYyIYQOpl3M72T+zznnKY356yv+7qvP8/znvcZmfIzmnL9uoHNbrA30BsoTKA/QoUBFo/3BoojLCToDRQGWDz+XzWwHQuYxbbi6CYT/MAbPMb3yI6cBs7hWIS0AuYFnkR4cgzcwp4IaQXMZ1yP8OQYuIl9EdIKmA+4EeHJMXAYF2j+DfEbD/C6toHEdxJnIsQFmKdYic7nNDDmPI256IJM3DMs58wMMZD4z+JEzqIANqWe0s86Qw1swSKOZm3bGPwSj/Arl2+ogbRnKy7iYO7SdfhV3Ee6xLJPiYG0bAcuY3/25r8D73AX3wbOV/lJ3IWrA+6Ij7iNL0PFp7nSBsa79+IadgfFJNHpZv8UxG8Iq2UgLZjBFez8h6ivuIP3peJrNjDWcgCX1l7wSfp+4h7e1hDfwkDiPILzEx7P9BfhIV7VEt/KQOI9jvl1QpfwvKb4lgYS9yGcWhOcbtn0oVL91HyJq4uLEHYDkZRaYnoDLdONcPcGIim1xPQGWqYb4e4NRFJqiekNtEw3wt0biKTUEjP1DfwBwgEvMVAV9oUAAAAASUVORK5CYII=") 50% 50% no-repeat #fff;background-size:24px 24px;padding-bottom:12px}.fm-scroll-down-grey{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAZhJREFUaEPtl+lKBEEMhL/1PhBP0Pd/OgVPxPukYBZEdCfXIosJDPsnXUlVdXd6Jyx4TBa8f5rAXzvYDrQDSQV6CyUFTC9vB9ISJgHagaSA6eX/ygGR3Qc20rLNBngEroF3Sx2PA2p+0wJakPMAXFlwPAROgCULaEGO1D+14HgIHAPLFtCCnDfgzILjIaC9f2ABLci5BHQWRsNDQGDbwO4oai7hBrizQngJCHdn+Kw1PHm3gD5zRAgIfA/YMlexJd4P16cte8iKEqieCdrvujY/XN1D6k+9SBwCa96i3/KfgYtI88KJOjDtQXNBJFaDJF6G5k1T96caWQLC1Gw4CswI3fXngH7DUUFAxVcGEtZJLcXV/Gu48+Qh/qmutpGcGBNFB1XNa/ukY6yYt8D6cCZmrdOBffIC/5ZfTUB1Zj05dFXqpVkW8yCg5jTkNOy+huuJYGU4LwJTJ/R2UuhtY3qcWRuf5s2TgLeXUH4TCMlWuKgdKBQzBNUOhGQrXNQOFIoZgmoHQrIVLmoHCsUMQbUDIdkKFy28A5+nHysx2/3TXgAAAABJRU5ErkJggg==") 50% 50% no-repeat #fff;background-size:24px 24px;padding-bottom:12px}.fm-compass-container{position:absolute;width:48px;height:48px;background-color:#fff;background-size:100% 100%;display:flex;justify-content:center;align-items:center;z-index:20;border-radius:80px;left:10px;top:10px}.fm-compass-element{position:absolute;width:58px;height:58px;background-size:100% 100%;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAB0CAYAAABUmhYnAAAAAXNSR0IArs4c6QAAFAtJREFUeF7tnQtUXOWdwP8zA0MgjMIMrwzxhA0QjTWmxlSUZrGr1TZJadSSVpm60T48dROstAb7irtH125DPGIl2sex1WwK6TZUTWmSbbUPacRE09gk20QDpOQYRl4DWAiPee75LnOnd+58zzt3hgvknsMB7v2+7373+93/4/vf72GC5BymOG7Dm5c3HakqIc468qbDFRdPXq7qxdsIrJtoLZ+Vj3WdVS/e6ywArOvxvjy89YykS1TDaCmXlkfrNeEGAQAaJK3XkgZWS8OzGkm0TFJ6vc6z6itfJ8HS63xSoIo2Pq1xRMviBYZLx5s3ETDVgEWBJxSsKARSZUTK4QWkTMeTR6QOPA4LDpTyHOs6S/J56sD7QupmQ0UbUZ1e5H9RwKKNwQJEg8mSWlHnSTS9LkBFYLIkjASL5zx6GJG60EDTwJCA8pxPmrRqbQjefPGC5AGq1Z7y2D4WLNZ1BJIl+SIvGFPr8IJRFsSbh6ZOWaDk67h0eqteVoPL13HwaNfUMFlqWRdniReOfDPe9DwwabDUQIlp6+vrMzds2FCanZ29LCMjozQ1NbXUYrE4TSaTzWQyZaIfALCFH2A0FAqNhX9GA4GA2+fzdYyPj3cMDw+f2bdvX0ddXd1YOK0ISJ60OGnltZW86YRsjxaYopJIAhk539DQYNu4ceMau91ekZaWVmE2m1foaUODweDJqamptqGhoba9e/ceqq2tHVWoTTU43v9p0soLiyudFki8XRctEojyxEBtbGy8xOVy3W6z2e5KSUm5HgAsTGOiT4KA3+8/PDo6uqepqemlmpqavxPg8oIV8ZQ1dWt4gGpJw4KJk8Soc7m5uabjx4/f6nA4XFardR0ALNCHkeZSJr1e7wGPx9O0cuXK3w4MDOAg8p4jeb08UkhNw4LFuo7rMjDVZvhp1NIo5SsrK7O0trZWORyOh8xm83LNzZ/AjMFg8LTH43misrKy5ciRIwGFzVUC1SK1JK9Y/TREqDRgesOkSiUCefDgwc9nZWV9zWQyFSeQh25Fh0KhrpGRkSfXrl37szBYFlAWZJH+KhZqPEBJnixLnSqvS1La1dVVVlRU1BB2cHRr8GQVhByp7u7u2uLi4iNhG4samwRXL6hCQFnSKQpTDVFS1U1NTTlVVVWPWq3Wu3X0VJPFMUYNer3e3S0tLY+4XK5BBtCEQcWB0wMmFmAYmiSVvb296/Pz858FAPtMEUjQfT19fX2bCwoK9qukVVRiedVvlKSKAuWRzBiVqnSCbrvtttTm5ubH0tPTtySoQQ1R7MTExM7q6uptL7/8sk8BVnZ6aCpZNABBBSoinTy2MsqTbWtrW1JeXr7LYrGsNkSrJ7gSgUDgaHt7+6aKiopzGBUsApXVnYlcx/UXSY8p0reUQUagnzlz5tqSkpIXTSaTI8HtaKjiQ6GQp7Oz845ly5b9ORlQeYGyYMr9USVIOY+5p6fnJqfT2QQAKK46H48xt9vtKiws/D0ABFX9VllSeRwlmqRK19RqE9fYJOhR6lTp8CjKNQ8ODqIgwY8BIHU+klQ8s8/j8dyXk5PTwgmVFCakQtUKlAYzIq2Dg4MbHQ7HT+dAl0SvdzHk8Xi+kJOTs5fiKNGCEziHSVm3kBIMr3TivNiYcz09PTc7nU70Ns53yVS3q8/tdlcVFhb+jhKEUDtMapDU0B/Ns8V5smp7GWM/kQNUWlqK+mHz1WayJHqso6NjvcJRwtlRGlRNQEmOEElCJWlHXZM1a9a0zTdvlkVQfR15v4cOHapQdGmUUFldGqLqJalcller9mal/1HQoKWl5ZX50s8UhahOj/qpVVVVt6iCDzSwTNXLC5Qa/Qk7Pebx8fHvpaenb473QedT/omJiWcyMjK+EfZ8eVQvyfuVmg0HVJOq7e3t/VR+fv7P5wqMc4MAE14Akwng8kX0p+rsA/AHAC5JB3Bmi7dAX1/fnQUFBb/GxH6FVS8NKCm0F6Nu0VeT6urqY3Mp0H7DNoDDHdNwfnwfwJdvIoPKvQ9g8O8Ad5YD7HlAHCgAeJqbm69VfKXBqV2ewEOMhGqRTvPU1NQzVqv1XzU9ikEzKYHa0gFO7gBYkoOvrA5Awev1/ndaWhoyVyiSpNlBUksoTzclSkK7urquX7p06StzLXigBIow/suHAH63DT9EXw+gCOLZs2dvKS4uPkxRvUwpVUd85FdQ7QSp+5pmBBANG2lvbz9k1JEGb3ZNP851Gga0yEBvXgHQdhrA5wfY+QWAzbfGSqlOQAGNfCgvL1+jGM6illbZy1WDjXi/NKDU/iYCOjQ0tCk7O/sZg2pNuOcH0zV74X7xGspAq64HyLEB/PAVgIULAE7UAyzNiy5PL6Co1OHh4c12u30Xp5TGeLw4oNzS+cYbbxwz6oAuzxjA4n+bbvjzzwI4BGNWMtCbrgLYvRmg9EGA8SmAiuUAf/z3aNWrJ1A08OyGG25YpUFKI19baHYUG0BA0tnf3/+53Nzcn4i/+8nJUd8K8DD6YAcA210AdZVi95WBri4GeOtxgCf3A3x993QZT98LUPOJf5SnJ1BU6sDAwBfz8vL+hyGlWLWrBCbbSfVvNVQzGgTd29v7pmHHzYYASr4K8Lf+6Ub/pzyAzu8DmGlRaxVvNdBgCKDiPwBefzdW9eoNFI37LSgouC48mJvl9UbsJ3oBaECJ0ul2uz+xaNGiX4q988lLvf9tgE9tj77frx8GWH8Nfx3UQFFOFEBYWTetepEqfvU706pXb6DoXu+///5nnE7nbwSlVAKKPFb5UNtUHFTU79xltVrv4G+e5KZctx3g4NvR91x7DcCBh/nrgQOKcjf+BuCB56fLkQMOiQDq9XpfTEtL20Tpl+K+m0ovmAyUyxlqbGy8dMuWLahDMNNzTbB0zvZPOzBBeaBHOJXZDNDxVKyHSkJMAopa8ebHAP7wVwCHDaDraYAVWwHeGwT4XDnAz7VFinDVmNy5c2dxTU3NB2Ep5erC0IBiVe7Q0NA92dnZO/nf9eSm3NoE8EQr/p4PVQLscPHVhwQU5UZxXgRxdALgm7cB7DsKcOq87kBRF2aL3W5/QUTtigI1+3y+/01JSfkoX7MkN9Wkb7qr4kEzOjEHkijUhVnAMYaCBhQV/dwfAL78I4B0K0DepQDnBvQH6vf7X09NTf0kQ+1GebtqoKRgghQZamhouOTBBx98L4nzM4XeiBdeA7g3HEwgZXz+foB7bmQXywKKSli/HeCAwlbrrHLRLQJPPfXUZbW1tfK8VJzHi9JFvsrIQHH2U4Ko/Dl//vy6wsLCX7CbY2ZSXPdtgLfC4T5SDT5SDPDm4+z68QB1DwNctRVgODyJPwFAoaen57OLFy8+gFG76uGgElgSUKx3Oz4+/l9GncLw1lmA677FBoVSvPldgI8spaflAYpK2NMOUP30dFmJAIqmVGRkZHyTV+0KAQ0EAu1GDcSjuO2u1/iAbrqRHd8NKKKkFkZAQk4rNaZA8IKntsFg8ITFYkE+CynAEPURXAmUaj/r6+ttW7dudRvxM5kct5308jQRwAKrtvguX+m6pwrt2LHDWVdXJy/eQbWjLKARO/ruu++uWrZsWZvu1dWhwB2tAHXhuC1vcfUugK2C8V3esvVOd+bMmYrLL78cjQiRpZHYJ0VA5RVFlFGiGIeov7//ztzc3Of0rmy85aEYKwoknO0TK2lp/nSgQW8VKVYLvtQDAwNfysvLQ+O11CMZYhwjHFBsQGFsbGzbwoULBYJnfJWNN9WBvwCs/562UvZ/A2Ddh7XlTWauCxcubM/MzHyMJ8DAC9Sw8Vt1X1CkodddA7DfcK9o7BNwxnUj30PVKhfbZfH7/a9aLJYykQZLdFpS3Pafl0/bx9XhrsnRswDIzv7pdHSNROO7iX4eUvmBQOBwSkrKLTyeLo+ESvYUFWo2mz80Uw+Fu29dM8COX0Vf+dbtAI99NtY2Ilu77RcA330pOv3WTwPUVxvpqWLrEgwG/2qxWNAKakgKad0XKRLEklAJaDAY/D+TybTEKI+Oi9siyfzjI2RHB0H92KPRkioS352pZw+FQufMZvNVugINhULdAGCY6fS4uO2v6gAqV9GbvfUYwKfro9PwxndnCigaiG0ymYr0BuoBAOsMPlTUrXFxW/cPARZl0Wv4/giA8yvRaXjjuzP47N7wbD79VC6a/mYkoCdPnoTR0envZB//QRlM+CwgAjQ9NQCv3o8W/gKw2WywYgVapdWwR0KAGkrlDgwMQEfH9OSTTc0roXNwIYio3NLcC/DCXcel/KWlpZCbm2tYmglRuUZzikKhEBw9ehR8Ph88d+QyeP7IZSDiFN1b9h58qew9SE1NhdWrV4MJTTMz6JEQp8iI3ZZz586h74VwwWuGu5s+DH2jC4Cn25Jvm4Tdrr/AQmsQCgsLYckSwzjv2FdK726LFMD3+/1oZjbqCxnmmJqagmPHjgGS1j+fvxQeePFK6WMQPbAQgqfvOAXXLv5AkspVq1ZBWlqaYZ4JVxG9AwsSUKMO3XznnXdgaGhIagcE9fFXiiVJxR1IMr99S5cEEx12ux2uuOIKQ8NElUtE6M9k1OD8yMgInDp1KgIFqd89bxfCn7rs0PPBNNjFWZOwZukQ3HVNj6Rm5ePKK6+ErCxGP8cAuOMNzqNHmDWfz1BlkdqdnJwUavoFCxZI6nY2HKKfz5Tw0PMpg/Oz4gO32+2G7m7Uq+I/ioqKwOl08meYwZSiH7hpQCMjGow8BMXv90tdmKB6uDwBgtlslroqKSkpM4iJ+9aah6CopVP9Gc0cCAReN5vNV3NXJYkJOzs7ob8/PN2Mcd+8vDwoKSlJYu203yqeQWJMoEYexjk2NgYnTpzgarmrr74aMjMFZwBzlax/Ir2GcWIdI6MPtFbGd0lNOwvitlFV1zrQWimdOEmdFVMhlPFdEtBZELdVVl3zVAgZIlPtGnmykjK+iwM6G+K2ynrrMVmJBRStfGLo6YRyfBcHdDbEbZX11ns6oRqupHaNPuFXGd9VNs5sidsq6hz3hF+WHZW7MYaN68qNcfr0aTRZNkpIs7OzYflyQ+6NhzX3nPFblFc5tyUqKsRrR01GXzRDHd9FDzZb4rYy3XgWzVBOgVBOWCLZU8Mva4Mqrozvzqa4Laq7nsvacEup0ReeUsZ3Z1PcFgHQY+EpNUiaPY0s3GjkpeHk+C56kFkUt0Uf63VZGk4JlNc5MvzijSi+i47ZErdFdU3E4o04tYvtwhh9eVUU30XHbInb6r28KkntUoMNc3UBZGxfIrEndV8AGad2edTvnFyiPLHsYktP1BLlmqQ0vIkA2k7RMHNfkg0kzvslbBMBrVKKlludU9t8xAlIKHuit/ng9XhjHKWLG/EIcZQSUz5go8ukjXnkG8XsgaaMEilro5wXwBM9ksq5uFWWGNBkbpWlWfVe3MyOD2qyN7OTa4WTTrWqjenWXNxukgl1RrabpEkprm8ade7ihrBEqAnfEFYNTl0Tkj0lLSUXAXtxy+YYqEnZslkLUKU04qRVhn1xU/V/ME3qpupaoPJ4v6hcc09Pz01OpxOtxjc7BsMyTaBwgjG32+0qLCz8fXhZGnWXhHd7ZuJWzeEujjRiQe0AkWrL05Uh2lbkKJWUlLw437ZyRt5sZ2fnHYr9tnEwlefkv5W/1X/jGEVWElNeZM1Ljwsq6tKUl5fvmi9bOqN+Znt7+ybFPtsJhUlSszSo6msktauW1Mj/KPjQ3Nz8n3N9a2e0FXN1dfV3VPtrq4HySCZLOqPUMA6eiJQqXwq110t1nHp7e9fn5+c/O5d2BQ6rOk9fX9/mgoKC/ZjVM3EASXuCypqTZjdjYJPg6QGVKKXhmprQV5qqqqpHrVbr3UZcKVvQ9Ql5vd7dLS0tjyi2XiYBZG7sGr63EEySytXiJJEklSSlUbC7urrKioqKGoy6nj0LLBpp0N3dXVtcXIxWsqIF1Hm9WZaaJV4XsZe45+KxqTioMefQcJaDBw9+Pisr62tG3ZNU3QBoQNfIyMiTa9eu/Zliv0+aXdRLMjUBZUkwSZJp8V+1JMfYXQS2tbW1yuFwPGTY7SyDwdMej+eJysrKljBIEdsYr82kSi/LVsYLlcdpwkow2qP0+PHjtzocDpfVal1ngM3zJr1e7wGPx9O0cuXK34b39lQ2Lkmd0gCqbSTLZjJVMQ/QREHlht3Y2HiJy+W63Waz3ZWSkoIWv5LX+GWZt3ivB/x+/+HR0dE9TU1NL9XU1MhbVvGAVKdRw9AdJi8oXicJl44UiRJRy1HgGxoabBs3blxjt9sr0tLSbgwvDMz7YrIAh9CahlNTU68NDQ217d2791Btba28XwoNEI9tVAIk/U2rH4/0RoX+WA8r8gKQnCWcVJIklSttfX195oYNG0qzs7OXZWRklKamppZaLBanyWSymUymTPSDVlANP9xoKBQaC/+MBgIBt8/n6xgfH+8YHh4+s2/fvo66urrwTmaSt0qSKhGANHhckOQ4rZ6AlGXxSgMPVPVLQpJcFlwt9ZPz4BoVB4F2jkf6tKhYps1UQ+aFozUfKxLFq5JJ4Glag/VsJOkQgSOSVtmGukumqF3ESTurwVhSw4IpAlGkLiJ2ShQYyzbyghSWTD2AithU0v1oalkEqJa6qMHyql5cY7PUqQhIzTD1aAQtLwZLDePK5MkTr5SyoJAcJJYqFYEpkharaeJtBJZapak33g8DPDC1vFgsECRJ4QGvRcrihqmnhCYDLAtavC8nj5Ok9SUQsdu0tMxr8TYC6QZaytX6oUDLvbQ2ME2KtEiYljxUqHo3hvpmWstn5WNdZ77JnAlYDc66TrqN1nzMaierYeK5D29e3nTxNnI8MOLJy4SJEvw/YnVGgU+v8A4AAAAASUVORK5CYII=")}.fm-control-scale-bar-contain{pointer-events:none;position:absolute;left:10px;bottom:10px;height:20px;z-index:20}.fm-control-scale-bar-text{position:absolute;white-space:nowrap;overflow:visible;text-align:center;color:#000;width:100%;cursor:default;line-height:18px;text-shadow:-1px -1px 0 #fff,1px -1px 0 #fff,-1px 1px 0 #fff,1px 1px 0 #fff;font-size:11px;font-family:Arial,sans-serif}.fm-control-scale-bar-left1{position:absolute;overflow:hidden;left:-1px;width:3px;height:7px;bottom:0;font-size:0;background-color:#fff}.fm-control-scale-bar-left2{position:absolute;overflow:hidden;left:0;width:1px;height:6px;bottom:0;font-size:0;background-color:#000}.fm-control-scale-bar-right1{position:absolute;overflow:hidden;right:-1px;width:3px;height:7px;bottom:0;font-size:0;background-color:#fff}.fm-control-scale-bar-right2{position:absolute;overflow:hidden;right:0;width:1px;height:6px;bottom:0;font-size:0;background-color:#000}.fm-control-scale-bar-bottom1{position:absolute;overflow:hidden;width:100%;height:5px;font-size:0;bottom:-1px;background-color:#fff}.fm-control-scale-bar-bottom2{position:absolute;overflow:hidden;width:100%;height:3px;font-size:0;bottom:0;background-color:#000}.fm-control-zoom-bar{border-radius:10px!important;z-index:20;width:48px;position:absolute;background-color:#fff;box-shadow:0 0 8px 0 rgba(0,0,0,.1)}.fm-control-zoom-bar-button{cursor:pointer;width:48px;height:48px;background-position:50%;background-size:24px 24px;background-repeat:no-repeat}.fm-control-zoom-button-bar-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAOhJREFUaEPtl7ENAjEUQ9+NQkNNQU/LDCzATExBS8sGNFAwDbqCJtJJNj8nFMlp4/jybf9cMjH4mAbfPyng3w7GgThQVCARKgpYXh4HFiQ8AKdm7grcypI3BGs5kAJUp+JAekDNygIuEUqEEqGiAiNF6GjUugF2Df4JvA0O6drhnEIX4+M9oGeFJAUoKv2IiQOtcPMVWR1bYN+AH8BLJQDuCtbpAYXvi8l7QFUrDoz0J1ZdnXHpAVWt9EB6QM1K3sSeUsOfQl65BfRap1BhS97SFODp1R8dB/pr6jHGAU+v/ug40F9Tj/EDS8k2Mfq2F7kAAAAASUVORK5CYII=")}.fm-control-zoom-button-bar-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAK1JREFUaEPtk7ERgDAMxJLJaNmEmdiENpvRp7ItLlzuRO3/YCnpbfOvb/7/zQX+NqgBDUACXiEIEMc1gBHCAg1AgDiuAYwQFmgAAsRxDWCEsEADECCOZwyc+LRcwRMZzyxwRwo/nLkiXS4QoVSc0cAM7iiSrMZGJJh5A5G+5TMusBz5dKAGNAAJeIUgQBzXAEYICzQAAeK4BjBCWKABCBDHNYARwgINQIA4vr2BFxMoBjHMrBSuAAAAAElFTkSuQmCC")}.fm-control-zoom-bar-hr{height:1px;background:#cad9e5;box-shadow:0 0 8px 0 #edf0f3;border:none;width:60%;margin:7px 20%}.fm-enter-exit-building-button{width:48px;height:48px;border-radius:10px;z-index:999;display:flex;background:#fff;justify-content:center;align-items:center;outline:1px solid #eee;cursor:pointer;transition:all .2s;background-repeat:no-repeat;background-size:18px 18px;background-position:50%;margin-bottom:10px}.fm-enter-exit-building-button-enter{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAy9JREFUWEfdmEtoE1EUhv9zk2lCrXZR8YEK4kJX1gdF0IWoBbvwAaKWTOxMrGhFRfANZtIy2EYQ1C4UFQUbY20ERRQpVhAfoG7cKS5UFFFExYIvqlKTOZI0aWtfZO4MEpzdcO/5z3fPuc9DGPCpen0Nc6qOiGYyo2Rgu5v/REgy4xmIOpRxpY3nD+/tov4OVD18ihmb3XSatxbhebG3tKIXaF2ooTJlJW/1ChBeE+Nj3oISHRnkB7gcQIaDCMd6gVTNOMTgfT0NdDQRj+6W8GHbJBgyFloW38v4BT3rA9LDl5ixJtPgFZWJlqbbttUlDQKa8R3gEiL87h+hywxendb0esTi1ljTXUl922aqZnxl8BiAkkNGqDCANGMHg5tB9MMvlEmxmPnF9lAlDYaMUFqrpjY8V0HJ25aW8CdJbSmzYYGk1Fww+j+AAnr9HEKq1iPEFbdXoFSEAprxAOAFRGQB2J6IR0+4kK2MhBxQKLINlnW872gRjRfjTQ1uQEkBZUaiG1sBHGNmkT1izqxaPmtLdXV1ygmYNFDaaUCPrAGsVjB8GQiia36hBGIx85cslCOgzH61PrIombKuAijNRuo+jSpZ2XZy/2cZqEFAwQ3mNA+h2I5Y8ndqNmCdYWZ/FuqpAlTF49F3dnQGTWpVCycYCNgVGao/Eb3wCaXcbvr+ipCqG4+YucIVIFCnz6NMcQa0MTqeu7uWCZCtlDFzKYgivSkDvRceUXUh1vjE7uCcT+q68MTUL3QwI339TK+0l8KrLG07a76yCyO9MeYc6bo5vRvdN8GY2sOCxz5RVBWLmR9kYBwBBXVjHjPaGTw2t9x9Qlnh9O4klbKg3rCYOXmdgVFZmPYJZWVrm5t3/ZSNTM5OCkjVww+ZMT+bptYZ04pqTdNMOoWRTlkwZKxj5n0EXL5wLtpEROwGzIhA6StsSil6kzhtdrrlLB+dIVMWCEV2wrKOEtDl8xRNdjpR8wEZcQ6pmlFg77JCBhLkXdIWP3DHTtid9FX18DdmjB74lO4rNggcSZw7uMeJk3xthy02FFw5JrMfFFLBKhfioGZoFnjTvyrpAfycIW7kSnp/AIVbvjT37mztAAAAAElFTkSuQmCC");background-size:18px 18px;background-position:50%;background-repeat:no-repeat}.fm-enter-exit-building-button-enter:hover{background:#2f65ee;outline:none;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMCAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTEtMjFUMDQ6MDg6MDIrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTExLTIxVDEyOjA5OjIwKzA4OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIyLTExLTIxVDEyOjA5OjIwKzA4OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM0MDQ0M2MxLWFkNTEtNDQ4Zi04MmM1LWI0YzM3ZjI5NWNiMCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjNDA0NDNjMS1hZDUxLTQ0OGYtODJjNS1iNGMzN2YyOTVjYjAiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjNDA0NDNjMS1hZDUxLTQ0OGYtODJjNS1iNGMzN2YyOTVjYjAiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmM0MDQ0M2MxLWFkNTEtNDQ4Zi04MmM1LWI0YzM3ZjI5NWNiMCIgc3RFdnQ6d2hlbj0iMjAyMi0xMS0yMVQwNDowODowMiswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+J+gLXQAAAgRJREFUWIXVmDtIXEEUhr+7bqHx3Zl2ETtDtLARRLGw0NLSlKZIZ58qSWNhExGCloJpUlgoWlgp2glaCCpRQ0IQMUUEE4Ro/hR3dnN2fXHf+sNl5u5j5rv/mTl7djxJVGgEeAm0A3WVb8asS2APWAbeAr+QZK8Pyk57kuo941A/sGLovwAnCTtUDTwDPHc/ad0ZN7QTKncuyavHzLubM7QF019M2BmrVeC8yGCBPNP/mx5P2XyeBbq23bKQBVp37W9gK30UX3aXAXQC34DTlDnOgAbgshIoK5WAcvd9Mm0FAeoA3gO9yaA4BUhg6y55XUl6FXNyPHNj/wni0Jxrc8AU8CZ+ewjkEM6ZK5PqpyVVxelQmC8PS7owUPOSqrMEQlKvpJ8Gak1ScxxAxTxUAJ4EjPZzYAa/hADYAQaA7yFWTikPIemj4tO+woWvbJe1hnii29QcdYA8MAQMEjxkjcBr/ofsGD9kF5GIQi7Cp5K2Tag+SyqEHCvyLmuTdGRgtiW1RICJBNQl6dTArElqiggTGqhP0rmBWZBUEwNMaKANAzMrKR8TTBlQPsD6nwJqgU/AOxKqwW8qYb8CP5KY7A7dWDGOAZv4/1ibUgYqyQJ1u7YW/3cqEz2amtq75fWkVJxPFujA9AdThOkB6l3/8EEfx6AHdmBV1AtglPSO9PaBJdyR3j+d4V4reicQggAAAABJRU5ErkJggg==");background-size:18px 18px;background-position:50%;background-repeat:no-repeat}.fm-enter-exit-building-button-exit{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAwhJREFUWEfNmE1IVFEUx//nzYxSlhUVroqocNq1bFlKiwwkihJn1OeMQcSkRFoEM2Pcct6AZVSu1Khw3ugzNVtEq76oZURQLbKFu6IoqCwLnY934s04fpWBTfPe3NW7l8c9P86555MAoO7khaL4x/FWMO8hgpMZduM8V4sIE8z8isjWo0XaonPlUEND+8qfifFnYJTmCuBv9xKhW4uEj2b+IZfs72RG0/QBA/SSwJO5hGNCCRibMjJskn13X++5B8aeXHWBUQY7jY0k0c7+XuVJLmEyd7vkwEVmbk5BgM5rqnI6DST7Y8xwEOG7FgkXmwFjyHB5g+Wc0NNaIQxrkfCh1Hd1XSAOsJ1A3zRVWWUWUK0nuCuR1B9Na+iWpioH8wcoHzTk8YjVk3r8HZiXE+iEpiqXLdWQIdzrDa+PY2JD9Eb4+YzbW/WGFnurlj1qy4FcnkAlGOU2G3VFr4feWArU1NRZ+Onrhy8AloEwTmzbp6ltj/8EZZrJXHWBKINrUhCEKYkld78aGlkIZRrQ4OCgbeTOi26AD6ejM+nMODagKl3zsr3ZXuaqD4ZY1wMZCImks/2RkLDU7d1yoJGBK8wspUGo50Dldl9VVVUya5MJIaSxsYQTBXbbUvJgPJ6oAuutM5ohul0oOdxZAQkh7KNjsdcAti4FZlGXBw1lBVTTJIqT4/H3Rj76L0BE97MCStU1HrGNOFEG5iWZTAecYG6cY7KnDhTtzRroXzRT7W3dQcnkXWasTYcl3LOXrNmvdpz6YTpQjeyvSIKGM2Ym0JBzi6NWCBEzvfxw1/tlXadrRoU6Xbp2OzcX+IQQuulxyC0Hj+usX0pbKBWqwwMRZSZAmgo0L7kCDElqGegNGXC/LdPeULUcUAiokID2vohy09LyYzHhriNinS0e25gXJaxR5E8lY28ZKIIkNWdMaJrJFmopv/sy0GyjaFUr7ZbPlOmceDgdj2ZbacuGDfX+DtbRkk4d84cN+TWOybuBlaEyn0+s+DyRCBL0CoBKzRrpSaCr/aqizvXAX+wC75l1ITwTAAAAAElFTkSuQmCC");background-size:18px 18px;background-position:50%;background-repeat:no-repeat}.fm-enter-exit-building-button-exit:hover{background:#2f65ee;outline:none;transition:all .2s;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMCAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTEtMjFUMDQ6MDc6NTQrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTExLTIxVDEyOjA4OjI1KzA4OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIyLTExLTIxVDEyOjA4OjI1KzA4OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQ0OTI1OWMwLTlhYTctNDc5Ni04MjgxLTllZTQ2Y2NhMmM3NCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0NDkyNTljMC05YWE3LTQ3OTYtODI4MS05ZWU0NmNjYTJjNzQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo0NDkyNTljMC05YWE3LTQ3OTYtODI4MS05ZWU0NmNjYTJjNzQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjQ0OTI1OWMwLTlhYTctNDc5Ni04MjgxLTllZTQ2Y2NhMmM3NCIgc3RFdnQ6d2hlbj0iMjAyMi0xMS0yMVQwNDowNzo1NCswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Nl0QjAAAAgdJREFUWIXNmM9LVUEUxz/3+ijIxIIgEJII0W3QokWgBC16iJsWYS1at1DEvUKLWrgIoVW/drZSqFULHwghuBEqsYW6kf6AFmYqivi+Lu7M87zwCo/nnXlfGDh35gzz4dyZOTOTSAJoByaBh0AfUKJY7QC/gPfAp7oWSR2SNhRPbyXhSyLpDTDq+YBVYL/gCF0HbprvB8CCj9C6oe23tAWX12bcKV+fArcc5T9gseDIWH01tmcgBRJnKyAMQNXYnoE0MESeasGICbQC7Dl7yVcWvd+cpS2ylXYD+OErE0mHZGDbQGcMMqtWmUM1hQQaAqbJUlO+JB26zelvgZvgRUl7bpwtSQN5vqEidAB8dnYnMA88ihkhJLVJ+mjSxZGk5//7hQTy5aXq9SI2EJJGXIS83rkInss+lJKtnLYG+z0mOxR6fQGeNgtUAtaAngb75Wmu2VV2Ceg6DxKnq83msm3gDnCfxn9ZHzBivpeB4ViT+q6kP2ZSVyS1x1plZUm7BmZW0gXfHhromRlPym4cqfUJCTQmqWpgXp3mFwrIJteqpPE835DJdRr4CTxx9qmKfWK8BnRjjrAxT4xXgN/Ad2DcV8YEuk32yAFwz1e25JnaX9KSsxwLkB2v7qK46ewOoD8g0KCxPQMloMLJTeAbcZ5jKjVLLfhgBXAZmADKQC/hnvQ+ADO24Rjty9tcqxMDTgAAAABJRU5ErkJggg==");background-size:18px 18px;background-position:50%;background-repeat:no-repeat}.fm-enter-exit-building-button-exit:hover .icon-tuichu{color:#fff;transition:all .2s}.fm-hide{display:none!important} \ No newline at end of file diff --git a/src/views/deviceManage/accessControlLog/index.vue b/src/views/deviceManage/accessControlLog/index.vue new file mode 100644 index 0000000..14a6d6a --- /dev/null +++ b/src/views/deviceManage/accessControlLog/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/views/deviceManage/accessControlLog/logList.vue b/src/views/deviceManage/accessControlLog/logList.vue new file mode 100644 index 0000000..b01095e --- /dev/null +++ b/src/views/deviceManage/accessControlLog/logList.vue @@ -0,0 +1,152 @@ + + + + + diff --git a/src/views/deviceManage/map/index copy.vue b/src/views/deviceManage/map/index copy.vue new file mode 100644 index 0000000..a7e4da2 --- /dev/null +++ b/src/views/deviceManage/map/index copy.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/src/views/deviceManage/map/index.vue b/src/views/deviceManage/map/index.vue new file mode 100644 index 0000000..ba4e2e1 --- /dev/null +++ b/src/views/deviceManage/map/index.vue @@ -0,0 +1,428 @@ + + + + + diff --git a/src/views/deviceManage/safetyDoorLog/alarmLog/index.vue b/src/views/deviceManage/safetyDoorLog/alarmLog/index.vue new file mode 100644 index 0000000..d143e34 --- /dev/null +++ b/src/views/deviceManage/safetyDoorLog/alarmLog/index.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/views/deviceManage/safetyDoorLog/index.vue b/src/views/deviceManage/safetyDoorLog/index.vue new file mode 100644 index 0000000..2a9a304 --- /dev/null +++ b/src/views/deviceManage/safetyDoorLog/index.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/views/deviceManage/safetyDoorLog/search.vue b/src/views/deviceManage/safetyDoorLog/search.vue new file mode 100644 index 0000000..22808e2 --- /dev/null +++ b/src/views/deviceManage/safetyDoorLog/search.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/src/views/deviceManage/safetyDoorLog/visitorLog/index.vue b/src/views/deviceManage/safetyDoorLog/visitorLog/index.vue new file mode 100644 index 0000000..8ac7ce8 --- /dev/null +++ b/src/views/deviceManage/safetyDoorLog/visitorLog/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/vue.config.js b/vue.config.js index 5b8a69b..a130a4f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -53,6 +53,11 @@ module.exports = { pathRewrite: { '^/auth': 'auth' } + }, + '/fengmap': { + target: 'https://map.fengmap.com', + changeOrigin: true, + pathRewrite: { '^/fengmap': '' } } } },