1var ei=Object.defineProperty;var ti=(n,e,t)=>e in n?ei(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var me=(n,e,t)=>ti(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function makeMap(n,e){const t=Object.create(null),i=n.split(",");for(let r=0;r<i.length;r++)t[i[r]]=!0;return e?r=>!!t[r.toLowerCase()]:r=>!!t[r]}function normalizeStyle(n){if(isArray$1(n)){const e={};for(let t=0;t<n.length;t++){const i=n[t],r=isString$2(i)?parseStringStyle(i):normalizeStyle(i);if(r)for(const s in r)e[s]=r[s]}return e}else{if(isString$2(n))return n;if(isObject$2(n))return n}}const listDelimiterRE=/;(?![^(]*\))/g,propertyDelimiterRE=/:([^]+)/,styleCommentRE=/\/\*.*?\*\//gs;function parseStringStyle(n){const e={};return n.replace(styleCommentRE,"").split(listDelimiterRE).forEach(t=>{if(t){const i=t.split(propertyDelimiterRE);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function normalizeClass(n){let e="";if(isString$2(n))e=n;else if(isArray$1(n))for(let t=0;t<n.length;t++){const i=normalizeClass(n[t]);i&&(e+=i+" ")}else if(isObject$2(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const specialBooleanAttrs="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",isSpecialBooleanAttr=makeMap(specialBooleanAttrs);function includeBooleanAttr(n){return!!n||n===""}const toDisplayString$1=n=>isString$2(n)?n:n==null?"":isArray$1(n)||isObject$2(n)&&(n.toString===objectToString$1||!isFunction$1(n.toString))?JSON.stringify(n,replacer,2):String(n),replacer=(n,e)=>e&&e.__v_isRef?replacer(n,e.value):isMap(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,r])=>(t[`${i} =>`]=r,t),{})}:isSet(e)?{[`Set(${e.size})`]:[...e.values()]}:isObject$2(e)&&!isArray$1(e)&&!isPlainObject$1(e)?String(e):e,EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,onRE=/^on[^a-z]/,isOn=n=>onRE.test(n),isModelListener=n=>n.startsWith("onUpdate:"),extend=Object.assign,remove=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},hasOwnProperty$1=Object.prototype.hasOwnProperty,hasOwn$1=(n,e)=>hasOwnProperty$1.call(n,e),isArray$1=Array.isArray,isMap=n=>toTypeString$1(n)==="[object Map]",isSet=n=>toTypeString$1(n)==="[object Set]",isFunction$1=n=>typeof n=="function",isString$2=n=>typeof n=="string",isSymbol=n=>typeof n=="symbol",isObject$2=n=>n!==null&&typeof n=="object",isPromise$1=n=>isObject$2(n)&&isFunction$1(n.then)&&isFunction$1(n.catch),objectToString$1=Object.prototype.toString,toTypeString$1=n=>objectToString$1.call(n),toRawType=n=>toTypeString$1(n).slice(8,-1),isPlainObject$1=n=>toTypeString$1(n)==="[object Object]",isIntegerKey=n=>isString$2(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=n=>
vendor: 28,650 bytes, line 1
1{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},camelizeRE=/-(\w)/g,camelize=cacheStringFunction(n=>n.replace(camelizeRE,(e,t)=>t?t.toUpperCase():"")),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(n=>n.replace(hyphenateRE,"-$1").toLowerCase()),capitalize$1=cacheStringFunction(n=>n.charAt(0).toUpperCase()+n.slice(1)),toHandlerKey=cacheStringFunction(n=>n?`on${capitalize$1(n)}`:""),hasChanged=(n,e)=>!Object.is(n,e),invokeArrayFns=(n,e)=>{for(let t=0;t<n.length;t++)n[t](e)},def=(n,e,t)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},toNumber=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let _globalThis$1;const getGlobalThis$1=()=>_globalThis$1||(_globalThis$1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let activeEffectScope;class EffectScope{constructor(e=!1){this.detached=e,this.active=!0,this.effects=[],this.cleanups=[],this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}run(e){if(this.active){const t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){activeEffectScope=this}off(){activeEffectScope=this.parent}stop(e){if(this.active){let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.scopes)for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0,this.active=!1}}}function effectScope(n){return new EffectScope(n)}function recordEffectScope(n,e=activeEffectScope){e&&e.active&&e.effects.push(n)}const createDep=n=>{const e=new Set(n);return e.w=0,e.n=0,e},wasTracked=n=>(n.w&trackOpBit)>0,newTracked=n=>(n.n&trackOpBit)>0,initDepMarkers=({deps:n})=>{if(n.length)for(let e=0;e<n.length;e++)n[e].w|=trackOpBit},finalizeDepMarkers=n=>{const{deps:e}=n;if(e.length){let t=0;for(let i=0;i<e.length;i++){const r=e[i];wasTracked(r)&&!newTracked(r)?r.delete(n):e[t++]=r,r.w&=~trackOpBit,r.n&=~trackOpBit}e.length=t}},targetMap=new WeakMap;let effectTrackDepth=0,trackOpBit=1;const maxMarkerBits=30;let activeEffect;const ITERATE_KEY=Symbol(""),MAP_KEY_ITERATE_KEY=Symbol("");class ReactiveEffect{constructor(e,t=null,i){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],this.parent=void 0,recordEffectScope(this,i)}run(){if(!this.active)return this.fn();let e=activeEffect,t=shouldTrack;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=activeEffect,activeEffect=this,shouldTrack=!0,trackOpBit=1<<++effectTrackDepth,effectTrackDepth<=maxMarkerBits?initDepMarkers(this):cleanupEffect(this),this.fn()}finally{effectTrackDepth<=maxMarkerBits&&finalizeDepMarkers(this),trackOpBit=1<<--effectTrackDepth,activeEffect=this.parent,shouldTrack=t,this.parent=void 0,this.deferStop&&this.stop()}}stop(){activeEffect===this?this.deferStop=!0:this.active&&(cleanupEffect(this),this.onStop&&this.onStop(),this.active=!1)}}function cleanupEffect(n){const{deps:e}=n;if(e.length){for(let t=0;t<e.length;t++)e[t].delete(n);e.length=0}}let shouldTrack=!0;const trackStack=[];function pauseTracking(){trackStack.push(shouldTrack),shouldTrack=!1}function resetTracking(){const n=trackStack.pop();shouldTrack=n===void 0?!0:n}function track(n,e,t){if(shouldTrack&&activeEffect){let i=targetMap.get(n);i||targetMap.set(n,i=new Map);let r=i.get(t);r||i.set(t,r=createDep()),trackEffects(r)}}function trackEffects(n,e){let t=!1;effectTrackDepth<=maxMarkerBits?newTracked(n)||(n.n|=trackOpBit,t=!wasTracked(n)):t=!n.has(activeEffect),t&&(n.add(activeEffect),activeEffect.deps.push(n))}function trigger(n,e,t,i,r,s){const a=targetMap.get(n);if(!a)return;let o=[];if(e==="clear")o=[...a.values()];else if(t==="length"&&isArray$1(n)){const l=toNumber(i);a.forEach((c,u)=>{(u==="length"||u>=l)&&o.push(c)})}else switch(t!==void 0&&o.push(a.get(t)),e){case"add":isArray$1(n)?isIntegerKey(t)&&o.push(a.get("length")):(o.push(a.get(ITERATE_KEY)),isMap(n)&&o.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$1(n)||(o.push(a.get(ITERATE_KEY)),isMap(n)&&o.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap(n)&&o.push(a.get(ITERATE_KEY));break}if(o.length===1)o[0]&&triggerEffects(o[0]);else{const l=[];for(const c of o)c&&l.push(...c);triggerEffects(createDep(l))}}function triggerEffects(n,e){const t=isArray$1(n)?n:[...n];for(const i of t)i.computed&&triggerEffect(i);for(const i of t)i.computed||triggerEffect(i)}function triggerEffect(n,e){(n!==activeEffect||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(isSymbol)),get=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const n={};return["includes","indexOf","lastIndexOf"].forEach(e=>{n[e]=function(...t){const i=toRaw(this);for(let s=0,a=this.length;s<a;s++)track(i,"get",s+"");const r=i[e](...t);return r===-1||r===!1?i[e](...t.map(toRaw)):r}}),["push","pop","shift","unshift","splice"].forEach(e=>{n[e]=function(...t){pauseTracking();const i=toRaw(this)[e].apply(this,t);return resetTracking(),i}}),n}function createGetter(n=!1,e=!1){return function(i,r,s){if(r==="__v_isReactive")return!n;if(r==="__v_isReadonly")return n;if(r==="__v_isShallow")return e;if(r==="__v_raw"&&s===(n?e?shallowReadonlyMap:readonlyMap:e?shallowReactiveMap:reactiveMap).get(i))return i;const a=isArray$1(i);if(!n&&a&&hasOwn$1(arrayInstrumentations,r))return Reflect.get(arrayInstrumentations,r,s);const o=Reflect.get(i,r,s);return(isSymbol(r)?builtInSymbols.has(r):isNonTrackableKeys(r))||(n||track(i,"get",r),e)?o:isRef(o)?a&&isIntegerKey(r)?o:o.value:isObject$2(o)?n?readonly(o):reactive(o):o}}const set=createSetter(),shallowSet=createSetter(!0);function createSetter(n=!1){return function(t,i,r,s){let a=t[i];if(isReadonly(a)&&isRef(a)&&!isRef(r))return!1;if(!n&&(!isShallow(r)&&!isReadonly(r)&&(a=toRaw(a),r=toRaw(r)),!isArray$1(t)&&isRef(a)&&!isRef(r)))return a.value=r,!0;const o=isArray$1(t)&&isIntegerKey(i)?Number(i)<t.length:hasOwn$1(t,i),l=Reflect.set(t,i,r,s);return t===toRaw(s)&&(o?hasChanged(r,a)&&trigger(t,"set",i,r):trigger(t,"add",i,r)),l}}function deleteProperty(n,e){const t=hasOwn$1(n,e);n[e];const i=Reflect.deleteProperty(n,e);return i&&t&&trigger(n,"delete",e,void 0),i}function has(n,e){const t=Reflect.has(n,e);return(!isSymbol(e)||!builtInSymbols.has(e))&&track(n,"has",e),t}function ownKeys(n){return track(n,"iterate",isArray$1(n)?"length":ITERATE_KEY),Reflect.ownKeys(n)}const mutableHandlers={get,set,deleteProperty,has,ownKeys},readonlyHandlers={get:readonlyGet,set(n,e){return!0},deleteProperty(n,e){return!0}},shallowReactiveHandlers=extend({},mutableHandlers,{get:shallowGet,set:shallowSet}),toShallow=n=>n,getProto=n=>Reflect.getPrototypeOf(n);function get$1(n,e,t=!1,i=!1){n=n.__v_raw;const r=toRaw(n),s=toRaw(e);t||(e!==s&&track(r,"get",e),track(r,"get",s));const{has:a}=getProto(r),o=i?toShallow:t?toReadonly:toReactive;if(a.call(r,e))return o(n.get(e));if(a.call(r,s))return o(n.get(s));n!==r&&n.get(e)}function has$1(n,e=!1){const t=this.__v_raw,i=toRaw(t),r=toRaw(n);return e||(n!==r&&track(i,"has",n),track(i,"has",r)),n===r?t.has(n):t.has(n)||t.has(r)}function size(n,e=!1){return n=n.__v_raw,!e&&track(toRaw(n),"iterate",ITERATE_KEY),Reflect.get(n,"size",n)}function add(n){n=toRaw(n);const e=toRaw(this);return getProto(e).has.call(e,n)||(e.add(n),trigger(e,"add",n,n)),this}function set$1(n,e){e=toRaw(e);const t=toRaw(this),{has:i,get:r}=getProto(t);let s=i.call(t,n);s||(n=toRaw(n),s=i.call(t,n));const a=r.call(t,n);return t.set(n,e),s?hasChanged(e,a)&&trigger(t,"set",n,e):trigger(t,"add",n,e),this}function deleteEntry(n){const e=toRaw(this),{has:t,get:i}=getProto(e);let r=t.call(e,n);r||(n=toRaw(n),r=t.call(e,n)),i&&i.call(e,n);const s=e.delete(n);return r&&trigger(e,"delete",n,void 0),s}function clear(){const n=toRaw(this),e=n.size!==0,t=n.clear();return e&&trigger(n,"clear",void 0,void 0),t}function createForEach(n,e){return function(i,r){const s=this,a=s.__v_raw,o=toRaw(a),l=e?toShallow:n?toReadonly:toReactive;return!n&&track(o,"iterate",ITERATE_KEY),a.forEach((c,u)=>i.call(r,l(c),l(u),s))}}function createIterableMethod(n,e,t){return function(...i){const r=this.__v_raw,s=toRaw(r),a=isMap(s),o=n==="entries"||n===Symbol.iterator&&a,l=n==="keys"&&a,c=r[n](...i),u=t?toShallow:e?toReadonly:toReactive;return!e&&track(s,"iterate",l?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:d,done:f}=c.next();return f?{value:d,done:f}:{value:o?[u(d[0]),u(d[1])]:u(d),done:f}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(n){return function(...e){return n==="delete"?!1:this}}function createInstrumentations(){const n={get(s){return get$1(this,s)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!1)},e={get(s){return get$1(this,s,!1,!0)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!0)},t={get(s){return get$1(this,s,!0)},get size(){return size(this,!0)},has(s){return has$1.call(this,s,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},i={get(s){return get$1(this,s,!0,!0)},get size(){return size(this,!0)},has(s){return has$1.call(this,s,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=createIterableMethod(s,!1,!1),t[s]=createIterableMethod(s,!0,!1),e[s]=createIterableMethod(s,!1,!0),i[s]=createIterableMethod(s,!0,!0)}),[n,t,e,i]}const[mutableInstrumentations,readonlyInstrumentations,shallowInstrumentations,shallowReadonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(n,e){const t=e?n?shallowReadonlyInstrumentations:shallowInstrumentations:n?readonlyInstrumentations:mutableInstrumentations;return(i,r,s)=>r==="__v_isReactive"?!n:r==="__v_isReadonly"?n:r==="__v_raw"?i:Reflect.get(hasOwn$1(t,r)&&r in i?t:i,r,s)}const mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(n){return n.__v_skip||!Object.isExtensible(n)?0:targetTypeMap(toRawType(n))}function reactive(n){return isReadonly(n)?n:createReactiveObject(n,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(n){return createReactiveObject(n,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(n){return createReactiveObject(n,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(n,e,t,i,r){if(!isObject$2(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=r.get(n);if(s)return s;const a=getTargetType(n);if(a===0)return n;const o=new Proxy(n,a===2?i:t);return r.set(n,o),o}function isReactive(n){return isReadonly(n)?isReactive(n.__v_raw):!!(n&&n.__v_isReactive)}function isReadonly(n){return!!(n&&n.__v_isReadonly)}function isShallow(n){return!!(n&&n.__v_isShallow)}function isProxy(n){return isReactive(n)||isReadonly(n)}function toRaw(n){const e=n&&n.__v_raw;return e?toRaw(e):n}function markRaw(n){return def(n,"__v_skip",!0),n}const toReactive=n=>isObject$2(n)?reactive(n):n,toReadonly=n=>isObject$2(n)?readonly(n):n;function trackRefValue(n){shouldTrack&&activeEffect&&(n=toRaw(n),trackEffects(n.dep||(n.dep=createDep())))}function triggerRefValue(n,e){n=toRaw(n),n.dep&&triggerEffects(n.dep)}function isRef(n){return!!(n&&n.__v_isRef===!0)}function ref(n){return createRef(n,!1)}function shallowRef(n){return createRef(n,!0)}function createRef(n,e){return isRef(n)?n:new RefImpl(n,e)}class RefImpl{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e)}get value(){return trackRefValue(this),this._value}set value(e){const t=this.__v_isShallow||isShallow(e)||isReadonly(e);e=t?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:toReactive(e),triggerRefValue(this))}}function unref(n){return isRef(n)?n.value:n}const shallowUnwrapHandlers={get:(n,e,t)=>unref(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const r=n[e];return isRef(r)&&!isRef(t)?(r.value=t,!0):Reflect.set(n,e,t,i)}};function proxyRefs(n){return isReactive(n)?n:new Proxy(n,shallowUnwrapHandlers)}var _a;class ComputedRefImpl{constructor(e,t,i,r){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this[_a]=!1,this._dirty=!0,this.effect=new ReactiveEffect(e,()=>{this._dirty||(this._dirty=!0,triggerRefValue(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=i}get value(){const e=toRaw(this);return trackRefValue(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}_a="__v_isReadonly";function computed$1(n,e,t=!1){let i,r;const s=isFunction$1(n);return s?(i=n,r=NOOP):(i=n.get,r=n.set),new ComputedRefImpl(i,r,s||!r,t)}function warn$1(n,...e){}function callWithErrorHandling(n,e,t,i){let r;try{r=i?n(...i):n()}catch(s){handleError(s,e,t)}return r}function callWithAsyncErrorHandling(n,e,t,i){if(isFunction$1(n)){const s=callWithErrorHandling(n,e,t,i);return s&&isPromise$1(s)&&s.catch(a=>{handleError(a,e,t)}),s}const r=[];for(let s=0;s<n.length;s++)r.push(callWithAsyncErrorHandling(n[s],e,t,i));return r}function handleError(n,e,t,i=!0){const r=e?e.vnode:null;if(e){let s=e.parent;const a=e.proxy,o=t;for(;s;){const c=s.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](n,a,o)===!1)return}s=s.parent}const l=e.appContext.config.errorHandler;if(l){callWithErrorHandling(l,null,10,[n,a,o]);return}}logError(n,t,r,i)}function logError(n,e,t,i=!0){console.error(n)}let isFlushing=!1,isFlushPending=!1;const queue=[];let flushIndex=0;const pendingPostFlushCbs=[];let activePostFlushCbs=null,postFlushIndex=0;const resolvedPromise=Promise.resolve();let currentFlushPromise=null;function nextTick(n){const e=currentFlushPromise||resolvedPromise;return n?e.then(this?n.bind(this):n):e}function findInsertionIndex(n){let e=flushIndex+1,t=queue.length;for(;e<t;){const i=e+t>>>1;getId(queue[i])<n?e=i+1:t=i}return e}function queueJob(n){(!queue.length||!queue.includes(n,isFlushing&&n.allowRecurse?flushIndex+1:flushIndex))&&(n.id==null?queue.push(n):queue.splice(findInsertionIndex(n.id),0,n),queueFlush())}function queueFlush(){!isFlushing&&!isFlushPending&&(isFlushPending=!0,currentFlushPromise=resolvedPromise.then(flushJobs))}function invalidateJob(n){const e=queue.indexOf(n);e>flushIndex&&queue.splice(e,1)}function queuePostFlushCb(n){isArray$1(n)?pendingPostFlushCbs.push(...n):(!activePostFlushCbs||!activePostFlushCbs.includes(n,n.allowRecurse?postFlushIndex+1:postFlushIndex))&&pendingPostFlushCbs.push(n),queueFlush()}function flushPreFlushCbs(n,e=isFlushing?flushIndex+1:0){for(;e<queue.length;e++){const t=queue[e];t&&t.pre&&(queue.splice(e,1),e--,t())}}function flushPostFlushCbs(n){if(pendingPostFlushCbs.length){const e=[...new Set(pendingPostFlushCbs)];if(pendingPostFlushCbs.length=0,activePostFlushCbs){activePostFlushCbs.push(...e);return}for(activePostFlushCbs=e,activePostFlushCbs.sort((t,i)=>getId(t)-getId(i)),postFlushIndex=0;postFlushIndex<activePostFlushCbs.length;postFlushIndex++)activePostFlushCbs[postFlushIndex]();activePostFlushCbs=null,postFlushIndex=0}}const getId=n=>n.id==null?1/0:n.id,comparator=(n,e)=>{const t=getId(n)-getId(e);if(t===0){if(n.pre&&!e.pre)return-1;if(e.pre&&!n.pre)return 1}return t};function flushJobs(n){isFlushPending=!1,isFlushing=!0,queue.sort(comparator);try{for(flushIndex=0;flushIndex<queue.length;flushIndex++){const e=queue[flushIndex];e&&e.active!==!1&&callWithErrorHandling(e,null,14)}}finally{flushIndex=0,queue.length=0,flushPostFlushCbs(),isFlushing=!1,currentFlushPromise=null,(queue.length||pendingPostFlushCbs.length)&&flushJobs()}}function emit$1(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||EMPTY_OBJ;let r=t;const s=e.startsWith("update:"),a=s&&e.slice(7);if(a&&a in i){const u=`${a==="modelValue"?"model":a}Modifiers`,{number:d,trim:f}=i[u]||EMPTY_OBJ;f&&(r=t.map(m=>isString$2(m)?m.trim():m)),d&&(r=t.map(toNumber))}let o,l=i[o=toHandlerKey(e)]||i[o=toHandlerKey(camelize(e))];!l&&s&&(l=i[o=toHandlerKey(hyphenate(e))]),l&&callWithAsyncErrorHandling(l,n,6,r);const c=i[o+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[o])return;n.emitted[o]=!0,callWithAsyncErrorHandling(c,n,6,r)}}function normalizeEmitsOptions(n,e,t=!1){const i=e.emitsCache,r=i.get(n);if(r!==void 0)return r;const s=n.emits;let a={},o=!1;if(!isFunction$1(n)){const l=c=>{const u=normalizeEmitsOptions(c,e,!0);u&&(o=!0,extend(a,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!s&&!o?(isObject$2(n)&&i.set(n,null),null):(isArray$1(s)?s.forEach(l=>a[l]=null):extend(a,s),isObject$2(n)&&i.set(n,a),a)}function isEmitListener(n,e){return!n||!isOn(e)?!1:(e=e.slice(2).replace(/Once$/,""),hasOwn$1(n,e[0].toLowerCase()+e.slice(1))||hasOwn$1(n,hyphenate(e))||hasOwn$1(n,e))}let currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(n){const e=currentRenderingInstance;return currentRenderingInstance=n,currentScopeId=n&&n.type.__scopeId||null,e}function withCtx(n,e=currentRenderingInstance,t){if(!e||n._n)return n;const i=(...r)=>{i._d&&setBlockTracking(-1);const s=setCurrentRenderingInstance(e);let a;try{a=n(...r)}finally{setCurrentRenderingInstance(s),i._d&&setBlockTracking(1)}return a};return i._n=!0,i._c=!0,i._d=!0,i}function markAttrsAccessed(){}function renderComponentRoot(n){const{type:e,vnode:t,proxy:i,withProxy:r,props:s,propsOptions:[a],slots:o,attrs:l,emit:c,render:u,renderCache:d,data:f,setupState:m,ctx:v,inheritAttrs:_}=n;let g,x;const S=setCurrentRenderingInstance(n);try{if(t.shapeFlag&4){const b=r||i;g=normalizeVNode(u.call(b,b,d,s,m,f,v)),x=l}else{const b=e;g=normalizeVNode(b.length>1?b(s,{attrs:l,slots:o,emit:c}):b(s,null)),x=e.props?l:getFunctionalFallthrough(l)}}catch(b){blockStack.length=0,handleError(b,n,1),g=createVNode(Comment)}let y=g;if(x&&_!==!1){const b=Object.keys(x),{shapeFlag:w}=y;b.length&&w&7&&(a&&b.some(isModelListener)&&(x=filterModelListeners(x,a)),y=cloneVNode(y,x))}return t.dirs&&(y=cloneVNode(y),y.dirs=y.dirs?y.dirs.concat(t.dirs):t.dirs),t.transition&&(y.transition=t.transition),g=y,setCurrentRenderingInstance(S),g}const getFunctionalFallthrough=n=>{let e;for(const t in n)(t==="class"||t==="style"||isOn(t))&&((e||(e={}))[t]=n[t]);return e},filterModelListeners=(n,e)=>{const t={};for(const i in n)(!isModelListener(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function shouldUpdateComponent(n,e,t){const{props:i,children:r,component:s}=n,{props:a,children:o,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?hasPropsChanged(i,a,c):!!a;if(l&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const f=u[d];if(a[f]!==i[f]&&!isEmitListener(c,f))return!0}}}else return(r||o)&&(!o||!o.$stable)?!0:i===a?!1:i?a?hasPropsChanged(i,a,c):!0:!!a;return!1}function hasPropsChanged(n,e,t){const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!0;for(let r=0;r<i.length;r++){const s=i[r];if(e[s]!==n[s]&&!isEmitListener(t,s))return!0}return!1}function updateHOCHostEl({vnode:n,parent:e},t){for(;e&&e.subTree===n;)(n=e.vnode).el=t,e=e.parent}const isSuspense=n=>n.__isSuspense;function queueEffectWithSuspense(n,e){e&&e.pendingBranch?isArray$1(n)?e.effects.push(...n):e.effects.push(n):queuePostFlushCb(n)}function provide(n,e){if(currentInstance){let t=currentInstance.provides;const i=currentInstance.parent&¤tInstance.parent.provides;i===t&&(t=currentInstance.provides=Object.create(i)),t[n]=e}}function inject(n,e,t=!1){const i=currentInstance||currentRenderingInstance;if(i){const r=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(r&&n in r)return r[n];if(arguments.length>1)return t&&isFunction$1(e)?e.call(i.proxy):e}}const INITIAL_WATCHER_VALUE={};function watch(n,e,t){return doWatch(n,e,t)}function doWatch(n,e,{immediate:t,deep:i,flush:r,onTrack:s,onTrigger:a}=EMPTY_OBJ){const o=currentInstance;let l,c=!1,u=!1;if(isRef(n)?(l=()=>n.value,c=isShallow(n)):isReactive(n)?(l=()=>n,i=!0):isArray$1(n)?(u=!0,c=n.some(y=>isReactive(y)||isShallow(y)),l=()=>n.map(y=>{if(isRef(y))return y.value;if(isReactive(y))return traverse(y);if(isFunction$1(y))return callWithErrorHandling(y,o,2)})):isFunction$1(n)?e?l=()=>callWithErrorHandling(n,o,2):l=()=>{if(!(o&&o.isUnmounted))return d&&d(),callWithAsyncErrorHandling(n,o,3,[f])}:l=NOOP,e&&i){const y=l;l=()=>traverse(y())}let d,f=y=>{d=x.onStop=()=>{callWithErrorHandling(y,o,4)}},m;if(isInSSRComponentSetup)if(f=NOOP,e?t&&callWithAsyncErrorHandling(e,o,3,[l(),u?[]:void 0,f]):l(),r==="sync"){const y=useSSRContext();m=y.__watcherHandles||(y.__watcherHandles=[])}else return NOOP;let v=u?new Array(n.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE;const _=()=>{if(x.active)if(e){const y=x.run();(i||c||(u?y.some((b,w)=>hasChanged(b,v[w])):hasChanged(y,v)))&&(d&&d(),callWithAsyncErrorHandling(e,o,3,[y,v===INITIAL_WATCHER_VALUE?void 0:u&&v[0]===INITIAL_WATCHER_VALUE?[]:v,f]),v=y)}else x.run()};_.allowRecurse=!!e;let g;r==="sync"?g=_:r==="post"?g=()=>queuePostRenderEffect(_,o&&o.suspense):(_.pre=!0,o&&(_.id=o.uid),g=()=>queueJob(_));const x=new ReactiveEffect(l,g);e?t?_():v=x.run():r==="post"?queuePostRenderEffect(x.run.bind(x),o&&o.suspense):x.run();const S=()=>{x.stop(),o&&o.scope&&remove(o.scope.effects,x)};return m&&m.push(S),S}function instanceWatch(n,e,t){const i=this.proxy,r=isString$2(n)?n.includes(".")?createPathGetter(i,n):()=>i[n]:n.bind(i,i);let s;isFunction$1(e)?s=e:(s=e.handler,t=e);const a=currentInstance;setCurrentInstance(this);const o=doWatch(r,s.bind(i),t);return a?setCurrentInstance(a):unsetCurrentInstance(),o}function createPathGetter(n,e){const t=e.split(".");return()=>{let i=n;for(let r=0;r<t.length&&i;r++)i=i[t[r]];return i}}function traverse(n,e){if(!isObject$2(n)||n.__v_skip||(e=e||new Set,e.has(n)))return n;if(e.add(n),isRef(n))traverse(n.value,e);else if(isArray$1(n))for(let t=0;t<n.length;t++)traverse(n[t],e);else if(isSet(n)||isMap(n))n.forEach(t=>{traverse(t,e)});else if(isPlainObject$1(n))for(const t in n)traverse(n[t],e);return n}function useTransitionState(){const n={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{n.isMounted=!0}),onBeforeUnmount(()=>{n.isUnmounting=!0}),n}const TransitionHookValidator=[Function,Array],BaseTransitionImpl={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},setup(n,{slots:e}){const t=getCurrentInstance(),i=useTransitionState();let r;return()=>{const s=e.default&&getTransitionRawChildren(e.default(),!0);if(!s||!s.length)return;let a=s[0];if(s.length>1){for(const _ of s)if(_.type!==Comment){a=_;break}}const o=toRaw(n),{mode:l}=o;if(i.isLeaving)return emptyPlaceholder(a);const c=getKeepAliveChild(a);if(!c)return emptyPlaceholder(a);const u=resolveTransitionHooks(c,o,i,t);setTransitionHooks(c,u);const d=t.subTree,f=d&&getKeepAliveChild(d);let m=!1;const{getTransitionKey:v}=c.type;if(v){const _=v();r===void 0?r=_:_!==r&&(r=_,m=!0)}if(f&&f.type!==Comment&&(!isSameVNodeType(c,f)||m)){const _=resolveTransitionHooks(f,o,i,t);if(setTransitionHooks(f,_),l==="out-in")return i.isLeaving=!0,_.afterLeave=()=>{i.isLeaving=!1,t.update.active!==!1&&t.update()},emptyPlaceholder(a);l==="in-out"&&c.type!==Comment&&(_.delayLeave=(g,x,S)=>{const y=getLeavingNodesForType(i,f);y[String(f.key)]=f,g._leaveCb=()=>{x(),g._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=S})}return a}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function resolveTransitionHooks(n,e,t,i){const{appear:r,mode:s,persisted:a=!1,onBeforeEnter:o,onEnter:l,onAfterEnter:c,onEnterCancelled:u,onBeforeLeave:d,onLeave:f,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:_,onAppear:g,onAfterAppear:x,onAppearCancelled:S}=e,y=String(n.key),b=getLeavingNodesForType(t,n),w=(M,L)=>{M&&callWithAsyncErrorHandling(M,i,9,L)},C=(M,L)=>{const B=L[1];w(M,L),isArray$1(M)?M.every(Z=>Z.length<=1)&&B():M.length<=1&&B()},R={mode:s,persisted:a,beforeEnter(M){let L=o;if(!t.isMounted)if(r)L=_||o;else return;M._leaveCb&&M._leaveCb(!0);const B=b[y];B&&isSameVNodeType(n,B)&&B.el._leaveCb&&B.el._leaveCb(),w(L,[M])},enter(M){let L=l,B=c,Z=u;if(!t.isMounted)if(r)L=g||l,B=x||c,Z=S||u;else return;let W=!1;const X=M._enterCb=G=>{W||(W=!0,G?w(Z,[M]):w(B,[M]),R.delayedLeave&&R.delayedLeave(),M._enterCb=void 0)};L?C(L,[M,X]):X()},leave(M,L){const B=String(n.key);if(M._enterCb&&M._enterCb(!0),t.isUnmounting)return L();w(d,[M]);let Z=!1;const W=M._leaveCb=X=>{Z||(Z=!0,L(),X?w(v,[M]):w(m,[M]),M._leaveCb=void 0,b[B]===n&&delete b[B])};b[B]=n,f?C(f,[M,W]):W()},clone(M){return resolveTransitionHooks(M,e,t,i)}};return R}function emptyPlaceholder(n){if(isKeepAlive(n))return n=cloneVNode(n),n.children=null,n}function getKeepAliveChild(n){return isKeepAlive(n)?n.children?n.children[0]:void 0:n}function setTransitionHooks(n,e){n.shapeFlag&6&&n.component?setTransitionHooks(n.component.subTree,e):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function getTransitionRawChildren(n,e=!1,t){let i=[],r=0;for(let s=0;s<n.length;s++){let a=n[s];const o=t==null?a.key:String(t)+String(a.key!=null?a.key:s);a.type===Fragment?(a.patchFlag&128&&r++,i=i.concat(getTransitionRawChildren(a.children,e,o))):(e||a.type!==Comment)&&i.push(o!=null?cloneVNode(a,{key:o}):a)}if(r>1)for(let s=0;s<i.length;s++)i[s].patchFlag=-2;return i}function defineComponent(n){return isFunction$1(n)?{setup:n,name:n.name}:n}const isAsyncWrapper=n=>!!n.type.__asyncLoader,isKeepAlive=n=>n.type.__isKeepAlive;function onActivated(n,e){registerKeepAliveHook(n,"a",e)}function onDeactivated(n,e){registerKeepAliveHook(n,"da",e)}function registerKeepAliveHook(n,e,t=currentInstance){const i=n.__wdc||(n.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return n()});if(injectHook(e,i,t),t){let r=t.parent;for(;r&&r.parent;)isKeepAlive(r.parent.vnode)&&injectToKeepAliveRoot(i,e,t,r),r=r.parent}}function injectToKeepAliveRoot(n,e,t,i){const r=injectHook(e,n,i,!0);onUnmounted(()=>{remove(i[e],r)},t)}function injectHook(n,e,t=currentInstance,i=!1){if(t){const r=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...a)=>{if(t.isUnmounted)return;pauseTracking(),setCurrentInstance(t);const o=callWithAsyncErrorHandling(e,t,n,a);return unsetCurrentInstance(),resetTracking(),o});return i?r.unshift(s):r.push(s),s}}const createHook=n=>(e,t=currentInstance)=>(!isInSSRComponentSetup||n==="sp")&&injectHook(n,(...i)=>e(...i),t),onBeforeMount=createHook("bm"),onMounted=createHook("m"),onBeforeUpdate=createHook("bu"),onUpdated=createHook("u"),onBeforeUnmount=createHook("bum"),onUnmounted=createHook("um"),onServerPrefetch=createHook("sp"),onRenderTriggered=createHook("rtg"),onRenderTracked=createHook("rtc");function onErrorCaptured(n,e=currentInstance){injectHook("ec",n,e)}function invokeDirectiveHook(n,e,t,i){const r=n.dirs,s=e&&e.dirs;for(let a=0;a<r.length;a++){const o=r[a];s&&(o.oldValue=s[a].value);let l=o.dir[i];l&&(pauseTracking(),callWithAsyncErrorHandling(l,t,8,[n.el,o,n,e]),resetTracking())}}const COMPONENTS="components";
1function resolveComponent(n,e){return resolveAsset(COMPONENTS,n,!0,e)||n}const NULL_DYNAMIC_COMPONENT=Symbol();function resolveAsset(n,e,t=!0,i=!1){const r=currentRenderingInstance||currentInstance;if(r){const s=r.type;{const o=getComponentName(s,!1);if(o&&(o===e||o===camelize(e)||o===capitalize$1(camelize(e))))return s}const a=resolve(r[n]||s[n],e)||resolve(r.appContext[n],e);return!a&&i?s:a}}function resolve(n,e){return n&&(n[e]||n[camelize(e)]||n[capitalize$1(camelize(e))])}function renderList(n,e,t,i){let r;const s=t;if(isArray$1(n)||isString$2(n)){r=new Array(n.length);for(let a=0,o=n.length;a<o;a++)r[a]=e(n[a],a,void 0,s)}else if(typeof n=="number"){r=new Array(n);for(let a=0;a<n;a++)r[a]=e(a+1,a,void 0,s)}else if(isObject$2(n))if(n[Symbol.iterator])r=Array.from(n,(a,o)=>e(a,o,void 0,s));else{const a=Object.keys(n);r=new Array(a.length);for(let o=0,l=a.length;o<l;o++){const c=a[o];r[o]=e(n[c],c,o,s)}}else r=[];return r}function renderSlot(n,e,t={},i,r){if(currentRenderingInstance.isCE||currentRenderingInstance.parent&&isAsyncWrapper(currentRenderingInstance.parent)&¤tRenderingInstance.parent.isCE)return createVNode("slot",t,i);let s=n[e];s&&s._c&&(s._d=!1),openBlock();const a=s&&ensureValidVNode(s(t)),o=createBlock(Fragment,{key:t.key||a&&a.key||`_${e}`},a||[],a&&n._===1?64:-2);return o.scopeId&&(o.slotScopeIds=[o.scopeId+"-s"]),s&&s._c&&(s._d=!0),o}function ensureValidVNode(n){return n.some(e=>isVNode$1(e)?!(e.type===Comment||e.type===Fragment&&!ensureValidVNode(e.children)):!0)?n:null}const getPublicInstance=n=>n?isStatefulComponent(n)?getExposeProxy(n)||n.proxy:getPublicInstance(n.parent):null,publicPropertiesMap=extend(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>getPublicInstance(n.parent),$root:n=>getPublicInstance(n.root),$emit:n=>n.emit,$options:n=>resolveMergedOptions(n),$forceUpdate:n=>n.f||(n.f=()=>queueJob(n.update)),$nextTick:n=>n.n||(n.n=nextTick.bind(n.proxy)),$watch:n=>instanceWatch.bind(n)}),hasSetupBinding=(n,e)=>n!==EMPTY_OBJ&&!n.__isScriptSetup&&hasOwn$1(n,e),PublicInstanceProxyHandlers={get({_:n},e){const{ctx:t,setupState:i,data:r,props:s,accessCache:a,type:o,appContext:l}=n;let c;if(e[0]!=="$"){const m=a[e];if(m!==void 0)switch(m){case 1:return i[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(hasSetupBinding(i,e))return a[e]=1,i[e];if(r!==EMPTY_OBJ&&hasOwn$1(r,e))return a[e]=2,r[e];if((c=n.propsOptions[0])&&hasOwn$1(c,e))return a[e]=3,s[e];if(t!==EMPTY_OBJ&&hasOwn$1(t,e))return a[e]=4,t[e];shouldCacheAccess&&(a[e]=0)}}const u=publicPropertiesMap[e];let d,f;if(u)return e==="$attrs"&&track(n,"get",e),u(n);if((d=o.__cssModules)&&(d=d[e]))return d;if(t!==EMPTY_OBJ&&hasOwn$1(t,e))return a[e]=4,t[e];if(f=l.config.globalProperties,hasOwn$1(f,e))return f[e]},set({_:n},e,t){const{data:i,setupState:r,ctx:s}=n;return hasSetupBinding(r,e)?(r[e]=t,!0):i!==EMPTY_OBJ&&hasOwn$1(i,e)?(i[e]=t,!0):hasOwn$1(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:r,propsOptions:s}},a){let o;return!!t[a]||n!==EMPTY_OBJ&&hasOwn$1(n,a)||hasSetupBinding(e,a)||(o=s[0])&&hasOwn$1(o,a)||hasOwn$1(i,a)||hasOwn$1(publicPropertiesMap,a)||hasOwn$1(r.config.globalProperties,a)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:hasOwn$1(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};let shouldCacheAccess=!0;function applyOptions(n){const e=resolveMergedOptions(n),t=n.proxy,i=n.ctx;shouldCacheAccess=!1,e.beforeCreate&&callHook$1(e.beforeCreate,n,"bc");const{data:r,computed:s,methods:a,watch:o,provide:l,inject:c,created:u,beforeMount:d,mounted:f,beforeUpdate:m,updated:v,activated:_,deactivated:g,beforeDestroy:x,beforeUnmount:S,destroyed:y,unmounted:b,render:w,renderTracked:C,renderTriggered:R,errorCaptured:M,serverPrefetch:L,expose:B,inheritAttrs:Z,components:W,directives:X,filters:G}=e;if(c&&resolveInjections(c,i,null,n.appContext.config.unwrapInjectedRef),a)for(const ue in a){const ie=a[ue];isFunction$1(ie)&&(i[ue]=ie.bind(t))}if(r){const ue=r.call(t,t);isObject$2(ue)&&(n.data=reactive(ue))}if(shouldCacheAccess=!0,s)for(const ue in s){const ie=s[ue],ve=isFunction$1(ie)?ie.bind(t,t):isFunction$1(ie.get)?ie.get.bind(t,t):NOOP,_e=!isFunction$1(ie)&&isFunction$1(ie.set)?ie.set.bind(t):NOOP,Q=computed({get:ve,set:_e});Object.defineProperty(i,ue,{enumerable:!0,configurable:!0,get:()=>Q.value,set:ne=>Q.value=ne})}if(o)for(const ue in o)createWatcher(o[ue],i,t,ue);if(l){const ue=isFunction$1(l)?l.call(t):l;Reflect.ownKeys(ue).forEach(ie=>{provide(ie,ue[ie])})}u&&callHook$1(u,n,"c");function he(ue,ie){isArray$1(ie)?ie.forEach(ve=>ue(ve.bind(t))):ie&&ue(ie.bind(t))}if(he(onBeforeMount,d),he(onMounted,f),he(onBeforeUpdate,m),he(onUpdated,v),he(onActivated,_),he(onDeactivated,g),he(onErrorCaptured,M),he(onRenderTracked,C),he(onRenderTriggered,R),he(onBeforeUnmount,S),he(onUnmounted,b),he(onServerPrefetch,L),isArray$1(B))if(B.length){const ue=n.exposed||(n.exposed={});B.forEach(ie=>{Object.defineProperty(ue,ie,{get:()=>t[ie],set:ve=>t[ie]=ve})})}else n.exposed||(n.exposed={});
vendor: 11,672 bytes, line 1
1w&&n.render===NOOP&&(n.render=w),Z!=null&&(n.inheritAttrs=Z),W&&(n.components=W),X&&(n.directives=X)}function resolveInjections(n,e,t=NOOP,i=!1){isArray$1(n)&&(n=normalizeInject(n));for(const r in n){const s=n[r];let a;isObject$2(s)?"default"in s?a=inject(s.from||r,s.default,!0):a=inject(s.from||r):a=inject(s),isRef(a)&&i?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:o=>a.value=o}):e[r]=a}}function callHook$1(n,e,t){callWithAsyncErrorHandling(isArray$1(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function createWatcher(n,e,t,i){const r=i.includes(".")?createPathGetter(t,i):()=>t[i];if(isString$2(n)){const s=e[n];isFunction$1(s)&&watch(r,s)}else if(isFunction$1(n))watch(r,n.bind(t));else if(isObject$2(n))if(isArray$1(n))n.forEach(s=>createWatcher(s,e,t,i));else{const s=isFunction$1(n.handler)?n.handler.bind(t):e[n.handler];isFunction$1(s)&&watch(r,s,n)}}function resolveMergedOptions(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=n.appContext,o=s.get(e);let l;return o?l=o:!r.length&&!t&&!i?l=e:(l={},r.length&&r.forEach(c=>mergeOptions(l,c,a,!0)),mergeOptions(l,e,a)),isObject$2(e)&&s.set(e,l),l}function mergeOptions(n,e,t,i=!1){const{mixins:r,extends:s}=e;s&&mergeOptions(n,s,t,!0),r&&r.forEach(a=>mergeOptions(n,a,t,!0));for(const a in e)if(!(i&&a==="expose")){const o=internalOptionMergeStrats[a]||t&&t[a];n[a]=o?o(n[a],e[a]):e[a]}return n}const internalOptionMergeStrats={data:mergeDataFn,props:mergeObjectOptions,emits:mergeObjectOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(n,e){return e?n?function(){return extend(isFunction$1(n)?n.call(this,this):n,isFunction$1(e)?e.call(this,this):e)}:e:n}function mergeInject(n,e){return mergeObjectOptions(normalizeInject(n),normalizeInject(e))}function normalizeInject(n){if(isArray$1(n)){const e={};for(let t=0;t<n.length;t++)e[n[t]]=n[t];return e}return n}function mergeAsArray(n,e){return n?[...new Set([].concat(n,e))]:e}function mergeObjectOptions(n,e){return n?extend(extend(Object.create(null),n),e):e}function mergeWatchOptions(n,e){if(!n)return e;if(!e)return n;const t=extend(Object.create(null),n);for(const i in e)t[i]=mergeAsArray(n[i],e[i]);return t}function initProps(n,e,t,i=!1){const r={},s={};def(s,InternalObjectKey,1),n.propsDefaults=Object.create(null),setFullProps(n,e,r,s);for(const a in n.propsOptions[0])a in r||(r[a]=void 0);t?n.props=i?r:shallowReactive(r):n.type.props?n.props=r:n.props=s,n.attrs=s}function updateProps(n,e,t,i){const{props:r,attrs:s,vnode:{patchFlag:a}}=n,o=toRaw(r),[l]=n.propsOptions;let c=!1;if((i||a>0)&&!(a&16)){if(a&8){const u=n.vnode.dynamicProps;for(let d=0;d<u.length;d++){let f=u[d];if(isEmitListener(n.emitsOptions,f))continue;const m=e[f];if(l)if(hasOwn$1(s,f))m!==s[f]&&(s[f]=m,c=!0);else{const v=camelize(f);r[v]=resolvePropValue(l,o,v,m,n,!1)}else m!==s[f]&&(s[f]=m,c=!0)}}}else{setFullProps(n,e,r,s)&&(c=!0);let u;for(const d in o)(!e||!hasOwn$1(e,d)&&((u=hyphenate(d))===d||!hasOwn$1(e,u)))&&(l?t&&(t[d]!==void 0||t[u]!==void 0)&&(r[d]=resolvePropValue(l,o,d,void 0,n,!0)):delete r[d]);if(s!==o)for(const d in s)(!e||!hasOwn$1(e,d))&&(delete s[d],c=!0)}c&&trigger(n,"set","$attrs")}function setFullProps(n,e,t,i){const[r,s]=n.propsOptions;let a=!1,o;if(e)for(let l in e){if(isReservedProp(l))continue;const c=e[l];let u;r&&hasOwn$1(r,u=camelize(l))?!s||!s.includes(u)?t[u]=c:(o||(o={}))[u]=c:isEmitListener(n.emitsOptions,l)||(!(l in i)||c!==i[l])&&(i[l]=c,a=!0)}if(s){const l=toRaw(t),c=o||EMPTY_OBJ;for(let u=0;u<s.length;u++){const d=s[u];t[d]=resolvePropValue(r,l,d,c[d],n,!hasOwn$1(c,d))}}return a}function resolvePropValue(n,e,t,i,r,s){const a=n[t];if(a!=null){const o=hasOwn$1(a,"default");if(o&&i===void 0){const l=a.default;if(a.type!==Function&&isFunction$1(l)){const{propsDefaults:c}=r;t in c?i=c[t]:(setCurrentInstance(r),i=c[t]=l.call(null,e),unsetCurrentInstance())}else i=l}a[0]&&(s&&!o?i=!1:a[1]&&(i===""||i===hyphenate(t))&&(i=!0))}return i}function normalizePropsOptions(n,e,t=!1){const i=e.propsCache,r=i.get(n);if(r)return r;const s=n.props,a={},o=[];let l=!1;if(!isFunction$1(n)){const u=d=>{l=!0;const[f,m]=normalizePropsOptions(d,e,!0);extend(a,f),m&&o.push(...m)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!s&&!l)return isObject$2(n)&&i.set(n,EMPTY_ARR),EMPTY_ARR;if(isArray$1(s))for(let u=0;u<s.length;u++){const d=camelize(s[u]);validatePropName(d)&&(a[d]=EMPTY_OBJ)}else if(s)for(const u in s){const d=camelize(u);if(validatePropName(d)){const f=s[u],m=a[d]=isArray$1(f)||isFunction$1(f)?{type:f}:Object.assign({},f);if(m){const v=getTypeIndex(Boolean,m.type),_=getTypeIndex(String,m.type);m[0]=v>-1,m[1]=_<0||v<_,(v>-1||hasOwn$1(m,"default"))&&o.push(d)}}}const c=[a,o];return isObject$2(n)&&i.set(n,c),c}function validatePropName(n){return n[0]!=="$"}function getType(n){const e=n&&n.toString().match(/^\s*function (\w+)/);return e?e[1]:n===null?"null":""}function isSameType(n,e){return getType(n)===getType(e)}function getTypeIndex(n,e){return isArray$1(e)?e.findIndex(t=>isSameType(t,n)):isFunction$1(e)&&isSameType(e,n)?0:-1}const isInternalKey=n=>n[0]==="_"||n==="$stable",normalizeSlotValue=n=>isArray$1(n)?n.map(normalizeVNode):[normalizeVNode(n)],normalizeSlot=(n,e,t)=>{if(e._n)return e;const i=withCtx((...r)=>normalizeSlotValue(e(...r)),t);return i._c=!1,i},normalizeObjectSlots=(n,e,t)=>{const i=n._ctx;for(const r in n){if(isInternalKey(r))continue;const s=n[r];if(isFunction$1(s))e[r]=normalizeSlot(r,s,i);else if(s!=null){const a=normalizeSlotValue(s);e[r]=()=>a}}},normalizeVNodeSlots=(n,e)=>{const t=normalizeSlotValue(e);n.slots.default=()=>t},initSlots=(n,e)=>{if(n.vnode.shapeFlag&32){const t=e._;t?(n.slots=toRaw(e),def(e,"_",t)):normalizeObjectSlots(e,n.slots={})}else n.slots={},e&&normalizeVNodeSlots(n,e);def(n.slots,InternalObjectKey,1)},updateSlots=(n,e,t)=>{const{vnode:i,slots:r}=n;let s=!0,a=EMPTY_OBJ;if(i.shapeFlag&32){const o=e._;o?t&&o===1?s=!1:(extend(r,e),!t&&o===1&&delete r._):(s=!e.$stable,normalizeObjectSlots(e,r)),a=e}else e&&(normalizeVNodeSlots(n,e),a={default:1});if(s)for(const o in r)!isInternalKey(o)&&!(o in a)&&delete r[o]};function createAppContext(){return{app:null,config:{isNativeTag:NO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let uid=0;function createAppAPI(n,e){return function(i,r=null){isFunction$1(i)||(i=Object.assign({},i)),r!=null&&!isObject$2(r)&&(r=null);const s=createAppContext(),a=new Set;let o=!1;const l=s.app={_uid:uid++,_component:i,_props:r,_container:null,_context:s,_instance:null,version,get config(){return s.config},set config(c){},use(c,...u){return a.has(c)||(c&&isFunction$1(c.install)?(a.add(c),c.install(l,...u)):isFunction$1(c)&&(a.add(c),c(l,...u))),l},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),l},component(c,u){return u?(s.components[c]=u,l):s.components[c]},directive(c,u){return u?(s.directives[c]=u,l):s.directives[c]},mount(c,u,d){if(!o){const f=createVNode(i,r);return f.appContext=s,n(f,c,d),o=!0,l._container=c,c.__vue_app__=l,getExposeProxy(f.component)||f.component.proxy}},unmount(){o&&(n(null,l._container),delete l._container.__vue_app__)},provide(c,u){return s.provides[c]=u,l}};return l}}function setRef(n,e,t,i,r=!1){if(isArray$1(n)){n.forEach((f,m)=>setRef(f,e&&(isArray$1(e)?e[m]:e),t,i,r));return}if(isAsyncWrapper(i)&&!r)return;const s=i.shapeFlag&4?getExposeProxy(i.component)||i.component.proxy:i.el,a=r?null:s,{i:o,r:l}=n,c=e&&e.r,u=o.refs===EMPTY_OBJ?o.refs={}:o.refs,d=o.setupState;if(c!=null&&c!==l&&(isString$2(c)?(u[c]=null,hasOwn$1(d,c)&&(d[c]=null)):isRef(c)&&(c.value=null)),isFunction$1(l))callWithErrorHandling(l,o,12,[a,u]);else{const f=isString$2(l),m=isRef(l);if(f||m){const v=()=>{if(n.f){const _=f?hasOwn$1(d,l)?d[l]:u[l]:l.value;r?isArray$1(_)&&remove(_,s):isArray$1(_)?_.includes(s)||_.push(s):f?(u[l]=[s],hasOwn$1(d,l)&&(d[l]=u[l])):(l.value=[s],n.k&&(u[n.k]=l.value))}else f?(u[l]=a,hasOwn$1(d,l)&&(d[l]=a)):m&&(l.value=a,n.k&&(u[n.k]=a))};a?(v.id=-1,queuePostRenderEffect(v,t)):v()}}}const queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(n){return baseCreateRenderer(n)}function baseCreateRenderer(n,e){const t=getGlobalThis$1();t.__VUE__=!0;const{insert:i,remove:r,patchProp:s,createElement:a,createText:o,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:f,setScopeId:m=NOOP,insertStaticContent:v}=n,_=(O,D,k,H=null,j=null,Y=null,ce=!1,re=null,se=!!D.dynamicChildren)=>{if(O===D)return;O&&!isSameVNodeType(O,D)&&(H=Le(O),ne(O,j,Y,!0),O=null),D.patchFlag===-2&&(se=!1,D.dynamicChildren=null);const{type:P,ref:N,shapeFlag:T}=D;switch(P){case Text:g(O,D,k,H);break;case Comment:x(O,D,k,H);break;case Static:O==null&&S(D,k,H,ce);break;case Fragment:W(O,D,k,H,j,Y,ce,re,se);break;default:T&1?w(O,D,k,H,j,Y,ce,re,se):T&6?X(O,D,k,H,j,Y,ce,re,se):(T&64||T&128)&&P.process(O,D,k,H,j,Y,ce,re,se,Ce)}N!=null&&j&&setRef(N,O&&O.ref,Y,D||O,!D)},g=(O,D,k,H)=>{if(O==null)i(D.el=o(D.children),k,H);else{const j=D.el=O.el;D.children!==O.children&&c(j,D.children)}},x=(O,D,k,H)=>{O==null?i(D.el=l(D.children||""),k,H):D.el=O.el},S=(O,D,k,H)=>{[O.el,O.anchor]=v(O.children,D,k,H,O.el,O.anchor)},y=({el:O,anchor:D},k,H)=>{let j;for(;O&&O!==D;)j=f(O),i(O,k,H),O=j;i(D,k,H)},b=({el:O,anchor:D})=>{let k;for(;O&&O!==D;)k=f(O),r(O),O=k;r(D)},w=(O,D,k,H,j,Y,ce,re,se)=>{ce=ce||D.type==="svg",O==null?C(D,k,H,j,Y,ce,re,se):L(O,D,j,Y,ce,re,se)},C=(O,D,k,H,j,Y,ce,re)=>{let se,P;const{type:N,props:T,shapeFlag:E,transition:z,dirs:K}=O;if(se=O.el=a(O.type,Y,T&&T.is,T),E&8?u(se,O.children):E&16&&M(O.children,se,null,H,j,Y&&N!=="foreignObject",ce,re),K&&invokeDirectiveHook(O,null,H,"created"),T){for(const $ in T)$!=="value"&&!isReservedProp($)&&s(se,$,null,T[$],Y,O.children,H,j,ae);"value"in T&&s(se,"value",null,T.value),(P=T.onVnodeBeforeMount)&&invokeVNodeHook(P,H,O)}R(se,O,O.scopeId,ce,H),K&&invokeDirectiveHook(O,null,H,"beforeMount");const V=(!j||j&&!j.pendingBranch)&&z&&!z.persisted;V&&z.beforeEnter(se),i(se,D,k),((P=T&&T.onVnodeMounted)||V||K)&&queuePostRenderEffect(()=>{P&&invokeVNodeHook(P,H,O),V&&z.enter(se),K&&invokeDirectiveHook(O,null,H,"mounted")},j)},R=(O,D,k,H,j)=>{if(k&&m(O,k),H)for(let Y=0;Y<H.length;Y++)m(O,H[Y]);if(j){let Y=j.subTree;if(D===Y){const ce=j.vnode;R(O,ce,ce.scopeId,ce.slotScopeIds,j.parent)}}},M=(O,D,k,H,j,Y,ce,re,se=0)=>{for(let P=se;P<O.length;P++){const N=O[P]=re?cloneIfMounted(O[P]):normalizeVNode(O[P]);_(null,N,D,k,H,j,Y,ce,re)}},L=(O,D,k,H,j,Y,ce)=>{const re=D.el=O.el;let{patchFlag:se,dynamicChildren:P,dirs:N}=D;se|=O.patchFlag&16;const T=O.props||EMPTY_OBJ,E=D.props||EMPTY_OBJ;let z;k&&toggleRecurse(k,!1),(z=E.onVnodeBeforeUpdate)&&invokeVNodeHook(z,k,D,O),N&&invokeDirectiveHook(D,O,k,"beforeUpdate"),k&&toggleRecurse(k,!0);const K=j&&D.type!=="foreignObject";if(P?B(O.dynamicChildren,P,re,k,H,K,Y):ce||ie(O,D,re,null,k,H,K,Y,!1),se>0){if(se&16)Z(re,D,T,E,k,H,j);else if(se&2&&T.class!==E.class&&s(re,"class",null,E.class,j),se&4&&s(re,"
1style",T.style,E.style,j),se&8){const V=D.dynamicProps;for(let $=0;$<V.length;$++){const be=V[$],ge=T[be],oe=E[be];(oe!==ge||be==="value")&&s(re,be,ge,oe,j,O.children,k,H,ae)}}se&1&&O.children!==D.children&&u(re,D.children)}else!ce&&P==null&&Z(re,D,T,E,k,H,j);((z=E.onVnodeUpdated)||N)&&queuePostRenderEffect(()=>{z&&invokeVNodeHook(z,k,D,O),N&&invokeDirectiveHook(D,O,k,"updated")},H)},B=(O,D,k,H,j,Y,ce)=>{for(let re=0;re<D.length;re++){const se=O[re],P=D[re],N=se.el&&(se.type===Fragment||!isSameVNodeType(se,P)||se.shapeFlag&70)?d(se.el):k;_(se,P,N,null,H,j,Y,ce,!0)}},Z=(O,D,k,H,j,Y,ce)=>{if(k!==H){if(k!==EMPTY_OBJ)for(const re in k)!isReservedProp(re)&&!(re in H)&&s(O,re,k[re],null,ce,D.children,j,Y,ae);for(const re in H){if(isReservedProp(re))continue;const se=H[re],P=k[re];se!==P&&re!=="value"&&s(O,re,P,se,ce,D.children,j,Y,ae)}"value"in H&&s(O,"value",k.value,H.value)}},W=(O,D,k,H,j,Y,ce,re,se)=>{const P=D.el=O?O.el:o(""),N=D.anchor=O?O.anchor:o("");let{patchFlag:T,dynamicChildren:E,slotScopeIds:z}=D;z&&(re=re?re.concat(z):z),O==null?(i(P,k,H),i(N,k,H),M(D.children,k,N,j,Y,ce,re,se)):T>0&&T&64&&E&&O.dynamicChildren?(B(O.dynamicChildren,E,k,j,Y,ce,re),(D.key!=null||j&&D===j.subTree)&&traverseStaticChildren(O,D,!0)):ie(O,D,k,N,j,Y,ce,re,se)},X=(O,D,k,H,j,Y,ce,re,se)=>{D.slotScopeIds=re,O==null?D.shapeFlag&512?j.ctx.activate(D,k,H,ce,se):G(D,k,H,j,Y,ce,se):le(O,D,se)},G=(O,D,k,H,j,Y,ce)=>{const re=O.component=createComponentInstance(O,H,j);if(isKeepAlive(O)&&(re.ctx.renderer=Ce),setupComponent(re),re.asyncDep){if(j&&j.registerDep(re,he),!O.el){const se=re.subTree=createVNode(Comment);x(null,se,D,k)}return}he(re,O,D,k,j,Y,ce)},le=(O,D,k)=>{const H=D.component=O.component;if(shouldUpdateComponent(O,D,k))if(H.asyncDep&&!H.asyncResolved){ue(H,D,k);return}else H.next=D,invalidateJob(H.update),H.update();else D.el=O.el,H.vnode=D},he=(O,D,k,H,j,Y,ce)=>{const re=()=>{if(O.isMounted){let{next:N,bu:T,u:E,parent:z,vnode:K}=O,V=N,$;toggleRecurse(O,!1),N?(N.el=K.el,ue(O,N,ce)):N=K,T&&invokeArrayFns(T),($=N.props&&N.props.onVnodeBeforeUpdate)&&invokeVNodeHook($,z,N,K),toggleRecurse(O,!0);const be=renderComponentRoot(O),ge=O.subTree;O.subTree=be,_(ge,be,d(ge.el),Le(ge),O,j,Y),N.el=be.el,V===null&&updateHOCHostEl(O,be.el),E&&queuePostRenderEffect(E,j),($=N.props&&N.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook($,z,N,K),j)}else{let N;const{el:T,props:E}=D,{bm:z,m:K,parent:V}=O,$=isAsyncWrapper(D);toggleRecurse(O,!1),z&&invokeArrayFns(z),!$&&(N=E&&E.onVnodeBeforeMount)&&invokeVNodeHook(N,V,D),toggleRecurse(O,!0);{const be=O.subTree=renderComponentRoot(O);_(null,be,k,H,O,j,Y),D.el=be.el}if(K&&queuePostRenderEffect(K,j),!$&&(N=E&&E.onVnodeMounted)){const be=D;queuePostRenderEffect(()=>invokeVNodeHook(N,V,be),j)}(D.shapeFlag&256||V&&isAsyncWrapper(V.vnode)&&V.vnode.shapeFlag&256)&&O.a&&queuePostRenderEffect(O.a,j),O.isMounted=!0,D=k=H=null}},se=O.effect=new ReactiveEffect(re,()=>queueJob(P),O.scope),P=O.update=()=>se.run();P.id=O.uid,toggleRecurse(O,!0),P()},ue=(O,D,k)=>{D.component=O;const H=O.vnode.props;O.vnode=D,O.next=null,updateProps(O,D.props,H,k),updateSlots(O,D.children,k),pauseTracking(),flushPreFlushCbs(),resetTracking()},ie=(O,D,k,H,j,Y,ce,re,se=!1)=>{const P=O&&O.children,N=O?O.shapeFlag:0,T=D.children,{patchFlag:E,shapeFlag:z}=D;if(E>0){if(E&128){_e(P,T,k,H,j,Y,ce,re,se);return}else if(E&256){ve(P,T,k,H,j,Y,ce,re,se);return}}z&8?(N&16&&ae(P,j,Y),T!==P&&u(k,T)):N&16?z&16?_e(P,T,k,H,j,Y,ce,re,se):ae(P,j,Y,!0):(N&8&&u(k,""),z&16&&M(T,k,H,j,Y,ce,re,se))},ve=(O,D,k,H,j,Y,ce,re,se)=>{O=O||EMPTY_ARR,D=D||EMPTY_ARR;const P=O.length,N=D.length,T=Math.min(P,N);let E;for(E=0;E<T;E++){const z=D[E]=se?cloneIfMounted(D[E]):normalizeVNode(D[E]);_(O[E],z,k,null,j,Y,ce,re,se)}P>N?ae(O,j,Y,!0,!1,T):M(D,k,H,j,Y,ce,re,se,T)},_e=(O,D,k,H,j,Y,ce,re,se)=>{let P=0;const N=D.length;let T=O.length-1,E=N-1;for(;P<=T&&P<=E;){const z=O[P],K=D[P]=se?cloneIfMounted(D[P]):normalizeVNode(D[P]);if(isSameVNodeType(z,K))_(z,K,k,null,j,Y,ce,re,se);else break;P++}for(;P<=T&&P<=E;){const z=O[T],K=D[E]=se?cloneIfMounted(D[E]):normalizeVNode(D[E]);if(isSameVNodeType(z,K))_(z,K,k,null,j,Y,ce,re,se);else break;T--,E--}if(P>T){if(P<=E){const z=E+1,K=z<N?D[z].el:H;for(;P<=E;)_(null,D[P]=se?cloneIfMounted(D[P]):normalizeVNode(D[P]),k,K,j,Y,ce,re,se),P++}}else if(P>E)for(;P<=T;)ne(O[P],j,Y,!0),P++;else{const z=P,K=P,V=new Map;for(P=K;P<=E;P++){const Re=D[P]=se?cloneIfMounted(D[P]):normalizeVNode(D[P]);Re.key!=null&&V.set(Re.key,P)}let $,be=0;const ge=E-K+1;let oe=!1,Ie=0;const Ne=new Array(ge);for(P=0;P<ge;P++)Ne[P]=0;for(P=z;P<=T;P++){const Re=O[P];if(be>=ge){ne(Re,j,Y,!0);continue}let De;if(Re.key!=null)De=V.get(Re.key);else for($=K;$<=E;$++)if(Ne[$-K]===0&&isSameVNodeType(Re,D[$])){De=$;break}De===void 0?ne(Re,j,Y,!0):(Ne[De-K]=P+1,De>=Ie?Ie=De:oe=!0,_(Re,D[De],k,null,j,Y,ce,re,se),be++)}const Fe=oe?getSequence(Ne):EMPTY_ARR;for($=Fe.length-1,P=ge-1;P>=0;P--){const Re=K+P,De=D[Re],We=Re+1<N?D[Re+1].el:H;Ne[P]===0?_(null,De,k,We,j,Y,ce,re,se):oe&&($<0||P!==Fe[$]?Q(De,k,We,2):$--)}}},Q=(O,D,k,H,j=null)=>{const{el:Y,type:ce,transition:re,children:se,shapeFlag:P}=O;if(P&6){Q(O.component.subTree,D,k,H);return}if(P&128){O.suspense.move(D,k,H);return}if(P&64){ce.move(O,D,k,Ce);return}
vendor: 17,096 bytes, line 1
1if(ce===Fragment){i(Y,D,k);for(let T=0;T<se.length;T++)Q(se[T],D,k,H);i(O.anchor,D,k);return}if(ce===Static){y(O,D,k);return}if(H!==2&&P&1&&re)if(H===0)re.beforeEnter(Y),i(Y,D,k),queuePostRenderEffect(()=>re.enter(Y),j);else{const{leave:T,delayLeave:E,afterLeave:z}=re,K=()=>i(Y,D,k),V=()=>{T(Y,()=>{K(),z&&z()})};E?E(Y,K,V):V()}else i(Y,D,k)},ne=(O,D,k,H=!1,j=!1)=>{const{type:Y,props:ce,ref:re,children:se,dynamicChildren:P,shapeFlag:N,patchFlag:T,dirs:E}=O;if(re!=null&&setRef(re,null,k,O,!0),N&256){D.ctx.deactivate(O);return}const z=N&1&&E,K=!isAsyncWrapper(O);let V;if(K&&(V=ce&&ce.onVnodeBeforeUnmount)&&invokeVNodeHook(V,D,O),N&6)Te(O.component,k,H);else{if(N&128){O.suspense.unmount(k,H);return}z&&invokeDirectiveHook(O,null,D,"beforeUnmount"),N&64?O.type.remove(O,D,k,j,Ce,H):P&&(Y!==Fragment||T>0&&T&64)?ae(P,D,k,!1,!0):(Y===Fragment&&T&384||!j&&N&16)&&ae(se,D,k),H&&ye(O)}(K&&(V=ce&&ce.onVnodeUnmounted)||z)&&queuePostRenderEffect(()=>{V&&invokeVNodeHook(V,D,O),z&&invokeDirectiveHook(O,null,D,"unmounted")},k)},ye=O=>{const{type:D,el:k,anchor:H,transition:j}=O;if(D===Fragment){Me(k,H);return}if(D===Static){b(O);return}const Y=()=>{r(k),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(O.shapeFlag&1&&j&&!j.persisted){const{leave:ce,delayLeave:re}=j,se=()=>ce(k,Y);re?re(O.el,Y,se):se()}else Y()},Me=(O,D)=>{let k;for(;O!==D;)k=f(O),r(O),O=k;r(D)},Te=(O,D,k)=>{const{bum:H,scope:j,update:Y,subTree:ce,um:re}=O;H&&invokeArrayFns(H),j.stop(),Y&&(Y.active=!1,ne(ce,O,D,k)),re&&queuePostRenderEffect(re,D),queuePostRenderEffect(()=>{O.isUnmounted=!0},D),D&&D.pendingBranch&&!D.isUnmounted&&O.asyncDep&&!O.asyncResolved&&O.suspenseId===D.pendingId&&(D.deps--,D.deps===0&&D.resolve())},ae=(O,D,k,H=!1,j=!1,Y=0)=>{for(let ce=Y;ce<O.length;ce++)ne(O[ce],D,k,H,j)},Le=O=>O.shapeFlag&6?Le(O.component.subTree):O.shapeFlag&128?O.suspense.next():f(O.anchor||O.el),Ee=(O,D,k)=>{O==null?D._vnode&&ne(D._vnode,null,null,!0):_(D._vnode||null,O,D,null,null,null,k),flushPreFlushCbs(),flushPostFlushCbs(),D._vnode=O},Ce={p:_,um:ne,m:Q,r:ye,mt:G,mc:M,pc:ie,pbc:B,n:Le,o:n};return{render:Ee,hydrate:void 0,createApp:createAppAPI(Ee)}}function toggleRecurse({effect:n,update:e},t){n.allowRecurse=e.allowRecurse=t}function traverseStaticChildren(n,e,t=!1){const i=n.children,r=e.children;if(isArray$1(i)&&isArray$1(r))for(let s=0;s<i.length;s++){const a=i[s];let o=r[s];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=r[s]=cloneIfMounted(r[s]),o.el=a.el),t||traverseStaticChildren(a,o)),o.type===Text&&(o.el=a.el)}}function getSequence(n){const e=n.slice(),t=[0];let i,r,s,a,o;const l=n.length;for(i=0;i<l;i++){const c=n[i];if(c!==0){if(r=t[t.length-1],n[r]<c){e[i]=r,t.push(i);continue}for(s=0,a=t.length-1;s<a;)o=s+a>>1,n[t[o]]<c?s=o+1:a=o;c<n[t[s]]&&(s>0&&(e[i]=t[s-1]),t[s]=i)}}for(s=t.length,a=t[s-1];s-- >0;)t[s]=a,a=e[a];return t}const isTeleport=n=>n.__isTeleport,Fragment=Symbol(void 0),Text=Symbol(void 0),Comment=Symbol(void 0),Static=Symbol(void 0),blockStack=[];let currentBlock=null;function openBlock(n=!1){blockStack.push(currentBlock=n?null:[])}function closeBlock(){blockStack.pop(),currentBlock=blockStack[blockStack.length-1]||null}let isBlockTreeEnabled=1;function setBlockTracking(n){isBlockTreeEnabled+=n}function setupBlock(n){return n.dynamicChildren=isBlockTreeEnabled>0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(n),n}function createElementBlock(n,e,t,i,r,s){return setupBlock(createBaseVNode(n,e,t,i,r,s,!0))}function createBlock(n,e,t,i,r){return setupBlock(createVNode(n,e,t,i,r,!0))}function isVNode$1(n){return n?n.__v_isVNode===!0:!1}function isSameVNodeType(n,e){return n.type===e.type&&n.key===e.key}const InternalObjectKey="__vInternal",normalizeKey=({key:n})=>n??null,normalizeRef=({ref:n,ref_key:e,ref_for:t})=>n!=null?isString$2(n)||isRef(n)||isFunction$1(n)?{i:currentRenderingInstance,r:n,k:e,f:!!t}:n:null;function createBaseVNode(n,e=null,t=null,i=0,r=null,s=n===Fragment?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&normalizeKey(e),ref:e&&normalizeRef(e),scopeId:currentScopeId,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return o?(normalizeChildren(l,t),s&128&&n.normalize(l)):t&&(l.shapeFlag|=isString$2(t)?8:16),isBlockTreeEnabled>0&&!a&¤tBlock&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&¤tBlock.push(l),l}const createVNode=_createVNode;function _createVNode(n,e=null,t=null,i=0,r=null,s=!1){if((!n||n===NULL_DYNAMIC_COMPONENT)&&(n=Comment),isVNode$1(n)){const o=cloneVNode(n,e,!0);return t&&normalizeChildren(o,t),isBlockTreeEnabled>0&&!s&¤tBlock&&(o.shapeFlag&6?currentBlock[currentBlock.indexOf(n)]=o:currentBlock.push(o)),o.patchFlag|=-2,o}if(isClassComponent(n)&&(n=n.__vccOpts),e){e=guardReactiveProps(e);let{class:o,style:l}=e;o&&!isString$2(o)&&(e.class=normalizeClass(o)),isObject$2(l)&&(isProxy(l)&&!isArray$1(l)&&(l=extend({},l)),e.style=normalizeStyle(l))}const a=isString$2(n)?1:isSuspense(n)?128:isTeleport(n)?64:isObject$2(n)?4:isFunction$1(n)?2:0;return createBaseVNode(n,e,t,i,r,a,s,!0)}function guardReactiveProps(n){return n?isProxy(n)||InternalObjectKey in n?extend({},n):n:null}function cloneVNode(n,e,t=!1){const{props:i,ref:r,patchFlag:s,children:a}=n,o=e?mergeProps(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:n.type,props:o,key:o&&normalizeKey(o),ref:e&&e.ref?t&&r?isArray$1(r)?r.concat(normalizeRef(e)):[r,normalizeRef(e)]:normalizeRef(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Fragment?s===-1?16:s|16:s,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:n.transition,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&cloneVNode(n.ssContent),ssFallback:n.ssFallback&&cloneVNode(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx}}function createTextVNode(n=" ",e=0){return createVNode(Text,null,n,e)}function createStaticVNode(n,e){const t=createVNode(Static,null,n);return t.staticCount=e,t}function createCommentVNode(n="",e=!1){return e?(openBlock(),createBlock(Comment,null,n)):createVNode(Comment,null,n)}function normalizeVNode(n){return n==null||typeof n=="boolean"?createVNode(Comment):isArray$1(n)?createVNode(Fragment,null,n.slice()):typeof n=="object"?cloneIfMounted(n):createVNode(Text,null,String(n))}function cloneIfMounted(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:cloneVNode(n)}function normalizeChildren(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(isArray$1(e))t=16;else if(typeof e=="object")if(i&65){const r=e.default;r&&(r._c&&(r._d=!1),normalizeChildren(n,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!(InternalObjectKey in e)?e._ctx=currentRenderingInstance:r===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else isFunction$1(e)?(e={default:e,_ctx:currentRenderingInstance},t=32):(e=String(e),i&64?(t=16,e=[createTextVNode(e)]):t=8);n.children=e,n.shapeFlag|=t}function mergeProps(...n){const e={};for(let t=0;t<n.length;t++){const i=n[t];for(const r in i)if(r==="class")e.class!==i.class&&(e.class=normalizeClass([e.class,i.class]));else if(r==="style")e.style=normalizeStyle([e.style,i.style]);else if(isOn(r)){const s=e[r],a=i[r];a&&s!==a&&!(isArray$1(s)&&s.includes(a))&&(e[r]=s?[].concat(s,a):a)}else r!==""&&(e[r]=i[r])}return e}function invokeVNodeHook(n,e,t,i=null){callWithAsyncErrorHandling(n,e,7,[t,i])}const emptyAppContext=createAppContext();let uid$1=0;function createComponentInstance(n,e,t){const i=n.type,r=(e?e.appContext:n.appContext)||emptyAppContext,s={uid:uid$1++,vnode:n,type:i,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new EffectScope(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:normalizePropsOptions(i,r),emitsOptions:normalizeEmitsOptions(i,r),emit:null,emitted:null,propsDefaults:EMPTY_OBJ,inheritAttrs:i.inheritAttrs,ctx:EMPTY_OBJ,data:EMPTY_OBJ,props:EMPTY_OBJ,attrs:EMPTY_OBJ,slots:EMPTY_OBJ,refs:EMPTY_OBJ,setupState:EMPTY_OBJ,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=emit$1.bind(null,s),n.ce&&n.ce(s),s}let currentInstance=null;const getCurrentInstance=()=>currentInstance||currentRenderingInstance,setCurrentInstance=n=>{currentInstance=n,n.scope.on()},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),currentInstance=null};function isStatefulComponent(n){return n.vnode.shapeFlag&4}let isInSSRComponentSetup=!1;function setupComponent(n,e=!1){isInSSRComponentSetup=e;const{props:t,children:i}=n.vnode,r=isStatefulComponent(n);initProps(n,t,r,e),initSlots(n,i);const s=r?setupStatefulComponent(n,e):void 0;return isInSSRComponentSetup=!1,s}function setupStatefulComponent(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=markRaw(new Proxy(n.ctx,PublicInstanceProxyHandlers));const{setup:i}=t;if(i){const r=n.setupContext=i.length>1?createSetupContext(n):null;setCurrentInstance(n),pauseTracking();const s=callWithErrorHandling(i,n,0,[n.props,r]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(s)){if(s.then(unsetCurrentInstance,unsetCurrentInstance),e)return s.then(a=>{handleSetupResult(n,a)}).catch(a=>{handleError(a,n,0)});n.asyncDep=s}else handleSetupResult(n,s)}else finishComponentSetup(n)}function handleSetupResult(n,e,t){isFunction$1(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:isObject$2(e)&&(n.setupState=proxyRefs(e)),finishComponentSetup(n)}function finishComponentSetup(n,e,t){const i=n.type;n.render||(n.render=i.render||NOOP),setCurrentInstance(n),pauseTracking(),applyOptions(n),resetTracking(),unsetCurrentInstance()}function createAttrsProxy(n){return new Proxy(n.attrs,{get(e,t){return track(n,"get","$attrs"),e[t]}})}function createSetupContext(n){const e=i=>{n.exposed=i||{}};let t;return{get attrs(){return t||(t=createAttrsProxy(n))},slots:n.slots,emit:n.emit,expose:e}}function getExposeProxy(n){if(n.exposed)return n.exposeProxy||(n.exposeProxy=new Proxy(proxyRefs(markRaw(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in publicPropertiesMap)return publicPropertiesMap[t](n)},has(e,t){return t in e||t in publicPropertiesMap}}))}function getComponentName(n,e=!0){return isFunction$1(n)?n.displayName||n.name:n.name||e&&n.__name}function isClassComponent(n){return isFunction$1(n)&&"__vccOpts"in n}const computed=(n,e)=>computed$1(n,e,isInSSRComponentSetup);function h(n,e,t){const i=arguments.length;return i===2?isObject$2(e)&&!isArray$1(e)?isVNode$1(e)?createVNode(n,null,[e]):createVNode(n,e):createVNode(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&isVNode$1(t)&&(t=[t]),createVNode(n,e,t))}const ssrContextKey=Symbol(""),useSSRContext=()=>inject(ssrContextKey),version="3.2.45",svgNS="http://www.w3.org/2000/svg",doc=typeof document<"u"?document:null,templateContainer=doc&&doc.createElement("template"),nodeOps={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const r=e?doc.createElementNS(svgNS,n):doc.createElement(n,t?{is:t}:void 0);return n==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:n=>doc.createTextNode(n),createComment:n=>doc.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>doc.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,r,s){const a=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{templateContainer.innerHTML=i?`<svg>${n}</svg>`:n;const o=templateContainer.content;if(i){const l=o.firstChild;for(;l.firstChild;)o.appendChild(l.firstChild);o.removeChild(l)}e.insertBefore(o,t)}return[a?a.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function patchClass(n,e,t){const i=n._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}function patchStyle(n,e,t){const i=n.style,r=isString$2(t);if(t&&!r){for(const s in t)setStyle(i,s,t[s]);if(e&&!isString$2(e))for(const s in e)t[s]==null&&setStyle(i,s,"")}else{const s=i.display;r?e!==t&&(i.cssText=t):e&&n.removeAttribute("style"),"_vod"in n&&(i.display=s)}}const importantRE=/\s*!important$/;function setStyle(n,e,t){if(isArray$1(t))t.forEach(i=>setStyle(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=autoPrefix(n,e);importantRE.test(t)?n.setProperty(hyphenate(i),t.replace(importantRE,""),"important"):n[i]=t}}const prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(n,e){const t=prefixCache[e];if(t)return t;let i=camelize(e);if(i!=="filter"&&i in n)return prefixCache[e]=i;i=capitalize$1(i);for(let r=0;r<prefixes.length;r++){const s=prefixes[r]+i;if(s in n)return prefixCache[e]=s}return e}const xlinkNS="http://www.w3.org/1999/xlink";function patchAttr(n,e,t,i,r){if(i&&e.startsWith("xlink:"))t==null?n.removeAttributeNS(xlinkNS,e.slice(6,e.length)):n.setAttributeNS(xlinkNS,e,t);else{const s=isSpecialBooleanAttr(e);t==null||s&&!includeBooleanAttr(t)?n.removeAttribute(e):n.setAttribute(e,s?"":t)}}function patchDOMProp(n,e,t,i,r,s,a){if(e==="innerHTML"||e==="textContent"){i&&a(i,r,s),n[e]=t??"";return}if(e==="value"&&n.tagName!=="PROGRESS"&&!n.tagName.includes("-")){n._value=t;const l=t??"";(n.value!==l||n.tagName==="OPTION")&&(n.value=l),t==null&&n.removeAttribute(e);return}let o=!1;if(t===""||t==null){const l=typeof n[e];l==="boolean"?t=includeBooleanAttr(t):t==null&&l==="string"?(t="",o=!0):l==="number"&&(t=0,o=!0)}try{n[e]=t}catch{}o&&n.removeAttribute(e)}function addEventListener(n,e,t,i){n.addEventListener(e,t,i)}function removeEventListener(n,e,t,i){n.removeEventListener(e,t,i)}function patchEvent(n,e,t,i,r=null){const s=n._vei||(n._vei={}),a=s[e];if(i&&a)a.value=i;else{const[o,l]=parseName(e);if(i){const c=s[e]=createInvoker(i,r);addEventListener(n,o,c,l)}else a&&(removeEventListener(n,o,a,l),s[e]=void 0)}}const optionsModifierRE=/(?:Once|Passive|Capture)$/;function parseName(n){let e;if(optionsModifierRE.test(n)){e={};let i;for(;i=n.match(optionsModifierRE);)n=n.slice(0,n.length-i[0].length),e[i[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):hyphenate(n.slice(2)),e]}let cachedNow=0;const p=Promise.resolve(),getNow=()=>cachedNow||(p.then(()=>cachedNow=0),cachedNow=Date.now());function createInvoker(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(i,t.value),e,5,[i])};return t.value=n,t.attached=getNow(),t}function patchStopImmediatePropagation(n,e){if(isArray$1(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>r=>!r._stopped&&i&&i(r))}else return e}const nativeOnRE=/^on[a-z]/,patchProp=(n,e,t,i,r=!1,s,a,o,l)=>{e==="class"?patchClass(n,i,r):e==="style"?patchStyle(n,t,i):isOn(e)?isModelListener(e)||patchEvent(n,e,t,i,a):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):shouldSetAsProp(n,e,i,r))?patchDOMProp(n,e,i,s,a,o,l):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),patchAttr(n,e,i,r))};function shouldSetAsProp(n,e,t,i){return i?!!(e==="innerHTML"||e==="textContent"||e in n&&nativeOnRE.test(e)&&isFunction$1(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA"||nativeOnRE.test(e)&&isString$2(t)?!1:e in n}const TRANSITION="transition",ANIMATION="animation",Transition=(n,{slots:e})=>h(BaseTransition,resolveTransitionProps(n),e);Transition.displayName="Transition";const DOMTransitionPropsValidators={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Transition.props=extend({},BaseTransition.props,DOMTransitionPropsValidators);const callHook=(n,e=[])=>{isArray$1(n)?n.forEach(t=>t(...e)):n&&n(...e)},hasExplicitCallback=n=>n?isArray$1(n)?n.some(e=>e.length>1):n.length>1:!1;function resolveTransitionProps(n){const e={};for(const W in n)W in DOMTransitionPropsValidators||(e[W]=n[W]);if(n.css===!1)return e;const{name:t="v",type:i,duration:r,enterFromClass:s=`${t}
1-enter-from`,enterActiveClass:a=`${t}-enter-active`,enterToClass:o=`${t}-enter-to`,appearFromClass:l=s,appearActiveClass:c=a,appearToClass:u=o,leaveFromClass:d=`${t}-leave-from`,leaveActiveClass:f=`${t}-leave-active`,leaveToClass:m=`${t}-leave-to`}=n,v=normalizeDuration(r),_=v&&v[0],g=v&&v[1],{onBeforeEnter:x,onEnter:S,onEnterCancelled:y,onLeave:b,onLeaveCancelled:w,onBeforeAppear:C=x,onAppear:R=S,onAppearCancelled:M=y}=e,L=(W,X,G)=>{removeTransitionClass(W,X?u:o),removeTransitionClass(W,X?c:a),G&&G()},B=(W,X)=>{W._isLeaving=!1,removeTransitionClass(W,d),removeTransitionClass(W,m),removeTransitionClass(W,f),X&&X()},Z=W=>(X,G)=>{const le=W?R:S,he=()=>L(X,W,G);callHook(le,[X,he]),nextFrame(()=>{removeTransitionClass(X,W?l:s),addTransitionClass(X,W?u:o),hasExplicitCallback(le)||whenTransitionEnds(X,i,_,he)})};return extend(e,{onBeforeEnter(W){callHook(x,[W]),addTransitionClass(W,s),addTransitionClass(W,a)},onBeforeAppear(W){callHook(C,[W]),addTransitionClass(W,l),addTransitionClass(W,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave(W,X){W._isLeaving=!0;const G=()=>B(W,X);addTransitionClass(W,d),forceReflow(),addTransitionClass(W,f),nextFrame(()=>{W._isLeaving&&(removeTransitionClass(W,d),addTransitionClass(W,m),hasExplicitCallback(b)||whenTransitionEnds(W,i,g,G))}),callHook(b,[W,G])},onEnterCancelled(W){L(W,!1),callHook(y,[W])},onAppearCancelled(W){L(W,!0),callHook(M,[W])},onLeaveCancelled(W){B(W),callHook(w,[W])}})}function normalizeDuration(n){if(n==null)return null;if(isObject$2(n))return[NumberOf(n.enter),NumberOf(n.leave)];{const e=NumberOf(n);return[e,e]}}function NumberOf(n){return toNumber(n)}function addTransitionClass(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n._vtc||(n._vtc=new Set)).add(e)}function removeTransitionClass(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const{_vtc:t}=n;t&&(t.delete(e),t.size||(n._vtc=void 0))}function nextFrame(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let endId=0;function whenTransitionEnds(n,e,t,i){const r=n._endId=++endId,s=()=>{r===n._endId&&i()};if(t)return setTimeout(s,t);const{type:a,timeout:o,propCount:l}=getTransitionInfo(n,e);if(!a)return i();const c=a+"end";let u=0;const d=()=>{n.removeEventListener(c,f),s()},f=m=>{m.target===n&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},o+1),n.addEventListener(c,f)}function getTransitionInfo(n,e){const t=window.getComputedStyle(n),i=v=>(t[v]||"").split(", "),r=i(`${TRANSITION}Delay`),s=i(`${TRANSITION}Duration`),a=getTimeout(r,s),o=i(`${ANIMATION}Delay`),l=i(`${ANIMATION}Duration`),c=getTimeout(o,l);let u=null,d=0,f=0;e===TRANSITION?a>0&&(u=TRANSITION,d=a,f=s.length):e===ANIMATION?c>0&&(u=ANIMATION,d=c,f=l.length):(d=Math.max(a,c),u=d>0?a>c?TRANSITION:ANIMATION:null,f=u?u===TRANSITION?s.length:l.length:0);const m=u===TRANSITION&&/\b(transform|all)(,|$)/.test(i(`${TRANSITION}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:m}}function getTimeout(n,e){for(;n.length<e.length;)n=n.concat(n);return Math.max(...e.map((t,i)=>toMs(t)+toMs(n[i])))}function toMs(n){return Number(n.slice(0,-1).replace(",","."))*1e3}function forceReflow(){return document.body.offsetHeight}const rendererOptions=extend({patchProp},nodeOps);let renderer;function ensureRenderer(){return renderer||(renderer=createRenderer(rendererOptions))}const createApp=(...n)=>{const e=ensureRenderer().createApp(...n),{mount:t}=e;return e.mount=i=>{const r=normalizeContainer(i);if(!r)return;const s=e._component;!isFunction$1(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.innerHTML="";const a=t(r,!1,r instanceof SVGElement);return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},e};function normalizeContainer(n){return isString$2(n)?document.querySelector(n):n}const _export_sfc=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},_sfc_main$o={name:"NumberInput",props:{label:String,value:Number},computed:{format(){return n=>Math.floor(n)}}},_hoisted_1$l={class:"number-input"},_hoisted_2$f={class:"label"},_hoisted_3$e=["value"];function _sfc_render$o(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$l,[createBaseVNode("label",null,[createBaseVNode("span",_hoisted_2$f,toDisplayString$1(t.label)+":",1),createBaseVNode("input",{type:"number",value:s.format(t.value),onInput:e[0]||(e[0]=a=>n.$emit("input",a)),onKeydown:e[1]||(e[1]=a=>a.stopPropagation())},null,40,_hoisted_3$e)])])}const NumberInput=_export_sfc(_sfc_main$o,[["render",_sfc_render$o]]),_sfc_main$n={name:"PositionInput",components:{NumberInput},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data,appState:this.$bluemap.appState}}},_hoisted_1$k={class:"position-input"};function _sfc_render$n(n,e,t,i,r,s){const a=resolveComponent("NumberInput");return openBlock(),createElementBlock("div",_hoisted_1$k,[createVNode(a,{label:"x",value:r.controls.position.x,onInput:e[0]||(e[0]=o=>{r.controls.position.x=parseFloat(o.target.value)})},null,8,["value"]),r.appState.controls.state==="free"?(openBlock(),createBlock(a,{key:0,label:"y",value:r.controls.position.y,onInput:e[1]||(e[1]=o=>{r.controls.position.y=parseFloat(o.target.value)})},null,8,["value"])):createCommentVNode("",!0),createVNode(a,{label:"z",value:r.controls.position.z,onInput:e[2]||(e[2]=o=>{r.controls.position.z=parseFloat(o.target.value)})},null,8,["value"])])}const PositionInput=_export_sfc(_sfc_main$n,[["render",_sfc_render$n]]);/** 2 * @license 3 * Copyright 2010-2022 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const REVISION="147",MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},CullFaceNone=0,CullFaceBack=1,CullFaceFront=2,CullFaceFrontBack=3,BasicShadowMap=0,PCFShadowMap=1,PCFSoftShadowMap=2,VSMShadowMap=3,FrontSide=0,BackSide=1,DoubleSide=2,NoBlending=0,NormalBlending=1,AdditiveBlending=2,SubtractiveBlending=3,MultiplyBlending=4,CustomBlending=5,AddEquation=100,SubtractEquation=101,ReverseSubtractEquation=102,MinEquation=103,MaxEquation=104,ZeroFactor=200,OneFactor=201,SrcColorFactor=202,OneMinusSrcColorFactor=203,SrcAlphaFactor=204,OneMinusSrcAlphaFactor=205,DstAlphaFactor=206,OneMinusDstAlphaFactor=207,DstColorFactor=208,OneMinusDstColorFactor=209,SrcAlphaSaturateFactor=210,NeverDepth=0,AlwaysDepth=1,LessDepth=2,LessEqualDepth=3,EqualDepth=4,GreaterEqualDepth=5,GreaterDepth=6,NotEqualDepth=
vendor: 5,581 bytes, line 5
57,MultiplyOperation=0,MixOperation=1,AddOperation=2,NoToneMapping=0,LinearToneMapping=1,ReinhardToneMapping=2,CineonToneMapping=3,ACESFilmicToneMapping=4,CustomToneMapping=5,UVMapping=300,CubeReflectionMapping=301,CubeRefractionMapping=302,EquirectangularReflectionMapping=303,EquirectangularRefractionMapping=304,CubeUVReflectionMapping=306,RepeatWrapping=1e3,ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004,NearestMipMapNearestFilter=1004,NearestMipmapLinearFilter=1005,NearestMipMapLinearFilter=1005,LinearFilter=1006,LinearMipmapNearestFilter=1007,LinearMipMapNearestFilter=1007,LinearMipmapLinearFilter=1008,LinearMipMapLinearFilter=1008,UnsignedByteType=1009,ByteType=1010,ShortType=1011,UnsignedShortType=1012,IntType=1013,UnsignedIntType=1014,FloatType=1015,HalfFloatType=1016,UnsignedShort4444Type=1017,UnsignedShort5551Type=1018,UnsignedInt248Type=1020,AlphaFormat=1021,RGBFormat=1022,RGBAFormat=1023,LuminanceFormat=1024,LuminanceAlphaFormat=1025,DepthFormat=1026,DepthStencilFormat=1027,RedFormat=1028,RedIntegerFormat=1029,RGFormat=1030,RGIntegerFormat=1031,RGBAIntegerFormat=1033,RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT1_Format=33777,RGBA_S3TC_DXT3_Format=33778,RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGB_PVRTC_2BPPV1_Format=35841,RGBA_PVRTC_4BPPV1_Format=35842,RGBA_PVRTC_2BPPV1_Format=35843,RGB_ETC1_Format=36196,RGB_ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,RGBA_ASTC_4x4_Format=37808,RGBA_ASTC_5x4_Format=37809,RGBA_ASTC_5x5_Format=37810,RGBA_ASTC_6x5_Format=37811,RGBA_ASTC_6x6_Format=37812,RGBA_ASTC_8x5_Format=37813,RGBA_ASTC_8x6_Format=37814,RGBA_ASTC_8x8_Format=37815,RGBA_ASTC_10x5_Format=37816,RGBA_ASTC_10x6_Format=37817,RGBA_ASTC_10x8_Format=37818,RGBA_ASTC_10x10_Format=37819,RGBA_ASTC_12x10_Format=37820,RGBA_ASTC_12x12_Format=37821,RGBA_BPTC_Format=36492,LoopOnce=2200,LoopRepeat=2201,LoopPingPong=2202,InterpolateDiscrete=2300,InterpolateLinear=2301,InterpolateSmooth=2302,ZeroCurvatureEnding=2400,ZeroSlopeEnding=2401,WrapAroundEnding=2402,NormalAnimationBlendMode=2500,AdditiveAnimationBlendMode=2501,TrianglesDrawMode=0,TriangleStripDrawMode=1,TriangleFanDrawMode=2,LinearEncoding=3e3,sRGBEncoding=3001,BasicDepthPacking=3200,RGBADepthPacking=3201,TangentSpaceNormalMap=0,ObjectSpaceNormalMap=1,NoColorSpace="",SRGBColorSpace="srgb",LinearSRGBColorSpace="srgb-linear",ZeroStencilOp=0,KeepStencilOp=7680,ReplaceStencilOp=7681,IncrementStencilOp=7682,DecrementStencilOp=7683,IncrementWrapStencilOp=34055,DecrementWrapStencilOp=34056,InvertStencilOp=5386,NeverStencilFunc=512,LessStencilFunc=513,EqualStencilFunc=514,LessEqualStencilFunc=515,GreaterStencilFunc=516,NotEqualStencilFunc=517,GreaterEqualStencilFunc=518,AlwaysStencilFunc=519,StaticDrawUsage=35044,DynamicDrawUsage=35048,StreamDrawUsage=35040,StaticReadUsage=35045,DynamicReadUsage=35049,StreamReadUsage=35041,StaticCopyUsage=35046,DynamicCopyUsage=35050,StreamCopyUsage=35042,GLSL1="100",GLSL3="300 es",_SRGBAFormat=1035;class EventDispatcher{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const _lut=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let _seed=1234567;const DEG2RAD$1=Math.PI/180,RAD2DEG=180/Math.PI;function generateUUID(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(_lut[n&255]+_lut[n>>8&255]+_lut[n>>16&255]+_lut[n>>24&255]+"-"+_lut[e&255]+_lut[e>>8&255]+"-"+_lut[e>>16&15|64]+_lut[e>>24&255]+"-"+_lut[t&63|128]+_lut[t>>8&255]+"-"+_lut[t>>16&255]+_lut[t>>24&255]+_lut[i&255]+_lut[i>>8&255]+_lut[i>>16&255]+_lut[i>>24&255]).toLowerCase()}function clamp(n,e,t){return Math.max(e,Math.min(t,n))}function euclideanModulo(n,e){return(n%e+e)%e}function mapLinear(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}
vendor: 9,300 bytes, line 5
5function inverseLerp(n,e,t){return n!==e?(t-n)/(e-n):0}function lerp(n,e,t){return(1-t)*n+t*e}function damp(n,e,t,i){return lerp(n,e,1-Math.exp(-t*i))}function pingpong(n,e=1){return e-Math.abs(euclideanModulo(n,e*2)-e)}function smoothstep(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function smootherstep(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function randInt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function randFloat(n,e){return n+Math.random()*(e-n)}function randFloatSpread(n){return n*(.5-Math.random())}function seededRandom(n){n!==void 0&&(_seed=n);let e=_seed+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function degToRad(n){return n*DEG2RAD$1}function radToDeg(n){return n*RAD2DEG}function isPowerOfTwo(n){return(n&n-1)===0&&n!==0}function ceilPowerOfTwo(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function floorPowerOfTwo(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function setQuaternionFromProperEuler(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),d=s((e-i)/2),f=a((e-i)/2),m=s((i-e)/2),v=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*d,l*f,o*c);break;case"YZY":n.set(l*f,o*u,l*d,o*c);break;case"ZXZ":n.set(l*d,l*f,o*u,o*c);break;case"XZX":n.set(o*u,l*v,l*m,o*c);break;case"YXY":n.set(l*m,o*u,l*v,o*c);break;case"ZYZ":n.set(l*v,l*m,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function denormalize(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function normalize(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var MathUtils=Object.freeze({__proto__:null,DEG2RAD:DEG2RAD$1,RAD2DEG,generateUUID,clamp,euclideanModulo,mapLinear,inverseLerp,lerp,damp,pingpong,smoothstep,smootherstep,randInt,randFloat,randFloatSpread,seededRandom,degToRad,radToDeg,isPowerOfTwo,ceilPowerOfTwo,floorPowerOfTwo,setQuaternionFromProperEuler,normalize,denormalize});class Vector2{constructor(e=0,t=0){Vector2.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],d=i[7],f=i[2],m=i[5],v=i[8],_=r[0],g=r[3],x=r[6],S=r[1],y=r[4],b=r[7],w=r[2],C=r[5],R=r[8];return s[0]=a*_+o*S+l*w,s[3]=a*g+o*y+l*C,s[6]=a*x+o*b+l*R,s[1]=c*_+u*S+d*w,s[4]=c*g+u*y+d*C,s[7]=c*x+u*b+d*R,s[2]=f*_+m*S+v*w,s[5]=f*g+m*y+v*C,s[8]=f*x+m*b+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,f=o*l-u*s,m=c*s-a*l,v=t*d+i*f+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/v;return e[0]=d*_,e[1]=(r*c-u*i)*_,e[2]=(o*i-r*a)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=m*_,e[7]=(i*l-c*t)*_,e[8]=(a*t-i*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(_m3.makeScale(e,t)),this}rotate(e){return this.premultiply(_m3.makeRotation(-e)),this}translate(e,t){return this.premultiply(_m3.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const _m3=new Matrix3;function arrayNeedsUint32(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const TYPED_ARRAYS={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function getTypedArray(n,e){return new TYPED_ARRAYS[n](e)}function createElementNS(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function SRGBToLinear(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}
vendor: 13,843 bytes, line 5
5function LinearToSRGB(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const FN={[SRGBColorSpace]:{[LinearSRGBColorSpace]:SRGBToLinear},[LinearSRGBColorSpace]:{[SRGBColorSpace]:LinearToSRGB}},ColorManagement={legacyMode:!0,get workingColorSpace(){return LinearSRGBColorSpace},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(FN[e]&&FN[e][t]!==void 0){const i=FN[e][t];return n.r=i(n.r),n.g=i(n.g),n.b=i(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},_colorKeywords={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},_rgb$1={r:0,g:0,b:0},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function toComponents(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Color{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=SRGBColorSpace){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ColorManagement.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=ColorManagement.workingColorSpace){return this.r=e,this.g=t,this.b=i,ColorManagement.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=ColorManagement.workingColorSpace){if(e=euclideanModulo(e,1),t=clamp(t,0,1),i=clamp(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=hue2rgb(a,s,e+1/3),this.g=hue2rgb(a,s,e),this.b=hue2rgb(a,s,e-1/3)}return ColorManagement.toWorkingColorSpace(this,r),this}setStyle(e,t=SRGBColorSpace){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,ColorManagement.toWorkingColorSpace(this,t),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,ColorManagement.toWorkingColorSpace(this,t),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return i(s[4]),this.setHSL(l,c,u,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,ColorManagement.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,ColorManagement.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=SRGBColorSpace){const i=_colorKeywords[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=SRGBColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),e),clamp(_rgb$1.r*255,0,255)<<16^clamp(_rgb$1.g*255,0,255)<<8^clamp(_rgb$1.b*255,0,255)<<0}getHexString(e=SRGBColorSpace){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ColorManagement.workingColorSpace){ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),t);const i=_rgb$1.r,r=_rgb$1.g,s=_rgb$1.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ColorManagement.workingColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),t),e.r=_rgb$1.r,e.g=_rgb$1.g,e.b=_rgb$1.b,e}getStyle(e=SRGBColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),e),e!==SRGBColorSpace?`color(${e} ${_rgb$1.r} ${_rgb$1.g} ${_rgb$1.b})`:`rgb(${_rgb$1.r*255|0},${_rgb$1.g*255|0},${_rgb$1.b*255|0})`}offsetHSL(e,t,i){return this.getHSL(_hslA),_hslA.h+=e,_hslA.s+=t,_hslA.l+=i,this.setHSL(_hslA.h,_hslA.s,_hslA.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(_hslA),e.getHSL(_hslB);const i=lerp(_hslA.h,_hslB.h,t),r=lerp(_hslA.s,_hslB.s,t),s=lerp(_hslA.l,_hslB.l,t);return this.setHSL(i,r,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Color.NAMES=_colorKeywords;let _canvas;class ImageUtils{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{_canvas===void 0&&(_canvas=createElementNS("canvas")),_canvas.width=e.width,_canvas.height=e.height;const i=_canvas.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=_canvas}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=createElementNS("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=SRGBToLinear(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(SRGBToLinear(t[i]/255)*255):t[i]=SRGBToLinear(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class Source{constructor(e=null){this.isSource=!0,this.uuid=generateUUID(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(serializeImage(r[a].image)):s.push(serializeImage(r[a]))}else s=serializeImage(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function serializeImage(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?ImageUtils.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let textureId=0;class Texture extends EventDispatcher{constructor(e=Texture.DEFAULT_IMAGE,t=Texture.DEFAULT_MAPPING,i=ClampToEdgeWrapping,r=ClampToEdgeWrapping,s=LinearFilter,a=LinearMipmapLinearFilter,o=RGBAFormat,l=UnsignedByteType,c=Texture.DEFAULT_ANISOTROPY,u=LinearEncoding){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:textureId++}),this.uuid=generateUUID(),this.name="",this.source=new Source(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.t
vendor: 4,934 bytes, line 5
5ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==UVMapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case MirroredRepeatWrapping:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case MirroredRepeatWrapping:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}Texture.DEFAULT_IMAGE=null;Texture.DEFAULT_MAPPING=UVMapping;Texture.DEFAULT_ANISOTROPY=1;class Vector4{constructor(e=0,t=0,i=0,r=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],f=l[1],m=l[5],v=l[9],_=l[2],g=l[6],x=l[10];if(Math.abs(u-f)<.01&&Math.abs(d-_)<.01&&Math.abs(v-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+_)<.1&&Math.abs(v+g)<.1&&Math.abs(c+m+x-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,b=(m+1)/2,w=(x+1)/2,C=(u+f)/4,R=(d+_)/4,M=(v+g)/4;return y>b&&y>w?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=C/i,s=R/i):b>w?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=C/r,s=M/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=R/s,r=M/s),this.set(i,r,s,t),this}let S=Math.sqrt((g-v)*(g-v)+(d-_)*(d-_)+(f-u)*(f-u));return Math.abs(S)<.001&&(S=1),this.x=(g-v)/S,this.y=(d-_)/S,this.z=(f-u)/S,this.w=Math.acos((c+m+x-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}
vendor: 4,212 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class WebGLRenderTarget extends EventDispatcher{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new Texture(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:LinearFilter,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class DataArrayTexture extends Texture{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WebGLArrayRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new DataArrayTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class Data3DTexture extends Texture{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WebGL3DRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1){super(e,t),this.isWebG
vendor: 4,202 bytes, line 5
5L3DRenderTarget=!0,this.depth=i,this.texture=new Data3DTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<i;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class Quaternion{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],u=i[r+2],d=i[r+3];const f=s[a+0],m=s[a+1],v=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(o===1){e[t+0]=f,e[t+1]=m,e[t+2]=v,e[t+3]=_;return}if(d!==_||l!==f||c!==m||u!==v){let g=1-o;const x=l*f+c*m+u*v+d*_,S=x>=0?1:-1,y=1-x*x;if(y>Number.EPSILON){const w=Math.sqrt(y),C=Math.atan2(w,x*S);g=Math.sin(g*C)/w,o=Math.sin(o*C)/w}const b=o*S;if(l=l*g+f*b,c=c*g+m*b,u=u*g+v*b,d=d*g+_*b,g===1-o){const w=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=w,c*=w,u*=w,d*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],d=s[a],f=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+u*d+l*m-c*f,e[t+1]=l*v+u*f+c*d-o*m,e[t+2]=c*v+u*m+o*f-l*d,e[t+3]=u*v-o*d-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),d=o(s/2),f=l(i/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=f*u*d+c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d-f*m*v;break;case"YXZ":this._x=f*u*d+c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d+f*m*v;break;case"ZXY":this._x=f*u*d-c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d-f*m*v;break;case"ZYX":this._x=f*u*d-c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d+f*m*v;break;case"YZX":this._x=f*u*d+c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d-f*m*v;break;case"XZY":this._x=f*u*d-c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d+f*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],f=i+o+d;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(i>o&&i>d){const m=2*Math.sqrt(1+i-o-d);this._w=(u-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>d){const m=2*Math.sqrt(1+o-i-d);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+d-i-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>
vendor: 16,397 bytes, line 5
5Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*d+this._w*f,this._x=i*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3{constructor(e=0,t=0,i=0){Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(_quaternion$4.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(_quaternion$4.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,u=l*i+o*t-s*r,d=l*r+s*i-a*t,f=-s*t-a*i-o*r;return this.x=c*l+f*-s+u*-o-d*-a,this.y=u*l+f*-a+d*-s-c*-o,this.z=d*l+f*-o+c*-a-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return _vector$c.copy(this).projectOnVector(e),this.sub(_vector$c)}reflect(e){return this.sub(_vector$c.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(clamp(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const _vector$c=new Vector3,_quaternion$4=new Quaternion;class Box3{constructor(e=new Vector3(1/0,1/0,1/0),t=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.length;l<c;l+=3){const u=e[l],d=e[l+1],f=e[l+2];u<t&&(t=u),d<i&&(i=d),f<r&&(r=f),u>s&&(s=u),d>a&&(a=d),f>o&&(o=f)}return this.min.set(t,i,r),this.max.set(s,a,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.count;l<c;l++){const u=e.getX(l),d=e.getY(l),f=e.getZ(l);u<t&&(t=u),d<i&&(i=d),f<r&&(r=f),u>s&&(s=u),d>a&&(a=d),f>o&&(o=f)}return this.min.set(t,i,r),this.max.set(s,a,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=_vector$b.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){const s=i.attributes.position;for(let a=0,o=s.count;a<o;a++)_vector$b.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(_vector$b)}else i.boundingBox===null&&i.computeBoundingBox(),_box$3.copy(i.boundingBox),_box$3.applyMatrix4(e.matrixWorld),this.union(_box$3);const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,_vector$b),_vector$b.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max,_center),_v0$2.subVectors(e.a,_center),_v1$7.subVectors(e.b,_center),_v2$4.subVectors(e.c,_center),_f0.subVectors(_v1$7,_v0$2),_f1.subVectors(_v2$4,_v1$7),_f2.subVectors(_v0$2,_v2$4);let t=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0.z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2.x,0];return!satForAxes(t,_v0$2,_v1$7,_v2$4,_extents)||(t=[1,0,0,0,1,0,0,0,1],!satForAxes(t,_v0$2,_v1$7,_v2$4,_extents))?!1:(_triangleNormal.crossVectors(_f0,_f1),t=[_triangleNormal.x,_triangleNormal.y,_triangleNormal.z],satForAxes(t,_v0$2,_v1$7,_v2$4,_extents))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return _vector$b.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(_vector$b).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_points),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _points=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],_vector$b=new Vector3,_box$3=new Box3,_v0$2=new Vector3,_v1$7=new Vector3,_v2$4=new Vector3,_f0=new Vector3,_f1=new Vector3,_f2=new Vector3,_center=new Vector3,_extents=new Vector3,_triangleNormal=new Vector3,_testAxis=new Vector3;function satForAxes(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_testAxis.fromArray(n,s);const o=r.x*Math.abs(_testAxis.x)+r.y*Math.abs(_testAxis.y)+r.z*Math.abs(_testAxis.z),l=e.dot(_testAxis),c=t.dot(_testAxis),u=i.dot(_testAxis);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const _box$2=new Box3,_v1$6=new Vector3,_v2$3=new Vector3;class Sphere{constructor(e=new Vector3,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):_box$2.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}
vendor: 4,529 bytes, line 5
5applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_v1$6.subVectors(e,this.center);const t=_v1$6.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(_v1$6,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(_v2$3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_v1$6.copy(e.center).add(_v2$3)),this.expandByPoint(_v1$6.copy(e.center).sub(_v2$3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const _vector$a=new Vector3,_segCenter=new Vector3,_segDir=new Vector3,_diff=new Vector3,_edge1=new Vector3,_edge2=new Vector3,_normal$1=new Vector3;class Ray{constructor(e=new Vector3,t=new Vector3(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,_vector$a)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=_vector$a.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_vector$a.copy(this.direction).multiplyScalar(t).add(this.origin),_vector$a.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){_segCenter.copy(e).add(t).multiplyScalar(.5),_segDir.copy(t).sub(e).normalize(),_diff.copy(this.origin).sub(_segCenter);const s=e.distanceTo(t)*.5,a=-this.direction.dot(_segDir),o=_diff.dot(this.direction),l=-_diff.dot(_segDir),c=_diff.lengthSq(),u=Math.abs(1-a*a);let d,f,m,v;if(u>0)if(d=a*l-o,f=a*o-l,v=s*u,d>=0)if(f>=-v)if(f<=v){const _=1/u;d*=_,f*=_,m=d*(d+a*f+2*o)+f*(a*d+f+2*l)+c}else f=s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f<=-v?(d=Math.max(0,-(-a*s+o)),f=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c):f<=v?(d=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(d=Math.max(0,-(a*s+o)),f=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c);else f=a>0?-s:s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;return i&&i.copy(this.direction).multiplyScalar(d).add(this.origin),r&&r.copy(_segDir).multiplyScalar(f).add(_segCenter),m}intersectSphere(e,t){_vector$a.subVectors(e.center,this.origin);const i=_vector$a.dot(this.direction),r=_vector$a.dot(_vector$a)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return o<0&&l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(o=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,_vector$a)!==null}intersectTriangle(e,t,i,r,s){_edge1.subVectors(t,e),_edge2.subVectors(i,e),_normal$1.crossVectors(_edge1,_edge2);let a=this.direction.dot(_normal$1),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;_diff.subVectors(this.origin,e);const l=o*this.direction.dot(_edge2.crossVectors(_diff,_edge2));if(l<0)return null;const c=o*this.direction.dot(_edge1.cross(_diff));if(c<0||l+c>a)return null;
vendor: 34,270 bytes, line 5
5const u=-o*_diff.dot(_normal$1);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Matrix4{constructor(){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,s,a,o,l,c,u,d,f,m,v,_,g){const x=this.elements;return x[0]=e,x[4]=t,x[8]=i,x[12]=r,x[1]=s,x[5]=a,x[9]=o,x[13]=l,x[2]=c,x[6]=u,x[10]=d,x[14]=f,x[3]=m,x[7]=v,x[11]=_,x[15]=g,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 Matrix4().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/_v1$5.setFromMatrixColumn(e,0).length(),s=1/_v1$5.setFromMatrixColumn(e,1).length(),a=1/_v1$5.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=a*u,m=a*d,v=o*u,_=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,m=l*d,v=c*u,_=c*d;t[0]=f+_*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=m*o-v,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,m=l*d,v=c*u,_=c*d;t[0]=f-_*o,t[4]=-a*d,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,m=a*d,v=o*u,_=o*d;t[0]=l*u,t[4]=v*c-m,t[8]=f*c+_,t[1]=l*d,t[5]=_*c+f,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,m=a*c,v=o*l,_=o*c;t[0]=l*u,t[4]=_-f*d,t[8]=v*d+m,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=m*d+v,t[10]=f-_*d}else if(e.order==="XZY"){const f=a*l,m=a*c,v=o*l,_=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=f*d+_,t[5]=a*u,t[9]=m*d-v,t[2]=v*d-m,t[6]=o*u,t[10]=_*d+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_zero,e,_one)}lookAt(e,t,i){const r=this.elements;return _z.subVectors(e,t),_z.lengthSq()===0&&(_z.z=1),_z.normalize(),_x.crossVectors(i,_z),_x.lengthSq()===0&&(Math.abs(i.z)===1?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(),_x.crossVectors(i,_z)),_x.normalize(),_y.crossVectors(_z,_x),r[0]=_x.x,r[4]=_y.x,r[8]=_z.x,r[1]=_x.y,r[5]=_y.y,r[9]=_z.y,r[2]=_x.z,r[6]=_y.z,r[10]=_z.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],d=i[5],f=i[9],m=i[13],v=i[2],_=i[6],g=i[10],x=i[14],S=i[3],y=i[7],b=i[11],w=i[15],C=r[0],R=r[4],M=r[8],L=r[12],B=r[1],Z=r[5],W=r[9],X=r[13],G=r[2],le=r[6],he=r[10],ue=r[14],ie=r[3],ve=r[7],_e=r[11],Q=r[15];return s[0]=a*C+o*B+l*G+c*ie,s[4]=a*R+o*Z+l*le+c*ve,s[8]=a*M+o*W+l*he+c*_e,s[12]=a*L+o*X+l*ue+c*Q,s[1]=u*C+d*B+f*G+m*ie,s[5]=u*R+d*Z+f*le+m*ve,s[9]=u*M+d*W+f*he+m*_e,s[13]=u*L+d*X+f*ue+m*Q,s[2]=v*C+_*B+g*G+x*ie,s[6]=v*R+_*Z+g*le+x*ve,s[10]=v*M+_*W+g*he+x*_e,s[14]=v*L+_*X+g*ue+x*Q,s[3]=S*C+y*B+b*G+w*ie,s[7]=S*R+y*Z+b*le+w*ve,s[11]=S*M+y*W+b*he+w*_e,s[15]=S*L+y*X+b*ue+w*Q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],f=e[10],m=e[14],v=e[3],_=e[7],g=e[11],x=e[15];return v*(+s*l*d-r*c*d-s*o*f+i*c*f+r*o*m-i*l*m)+_*(+t*l*m-t*c*f+s*a*f-r*a*m+r*c*u-s*l*u)+g*(+t*c*d-t*o*m-s*a*d+i*a*m+s*o*u-i*c*u)+x*(-r*o*u-t*l*d+t*o*f+r*a*d-i*a*f+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],f=e[10],m=e[11],v=e[12],_=e[13],g=e[14],x=e[15],S=d*g*c-_*f*c+_*l*m-o*g*m-d*l*x+o*f*x,y=v*f*c-u*g*c-v*l*m+a*g*m+u*l*x-a*f*x,b=u*_*c-v*d*c+v*o*m-a*_*m-u*o*x+a*d*x,w=v*d*l-u*_*l-v*o*f+a*_*f+u*o*g-a*d*g,C=t*S+i*y+r*b+s*w;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/C;return e[0]=S*R,e[1]=(_*f*s-d*g*s-_*r*m+i*g*m+d*r*x-i*f*x)*R,e[2]=(o*g*s-_*l*s+_*r*c-i*g*c-o*r*x+i*l*x)*R,e[3]=(d*l*s-o*f*s-d*r*c+i*f*c+o*r*m-i*l*m)*R,e[4]=y*R,e[5]=(u*g*s-v*f*s+v*r*m-t*g*m-u*r*x+t*f*x)*R,e[6]=(v*l*s-a*g*s-v*r*c+t*g*c+a*r*x-t*l*x)*R,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*m+t*l*m)*R,e[8]=b*R,e[9]=(v*d*s-u*_*s-v*i*m+t*_*m+u*i*x-t*d*x)*R,e[10]=(a*_*s-v*o*s+v*i*c-t*_*c-a*i*x+t*o*x)*R,e[11]=(u*o*s-a*d*s-u*i*c+t*d*c+a*i*m-t*o*m)*R,e[12]=w*R,e[13]=(u*_*r-v*d*r+v*i*f-t*_*f-u*i*g+t*d*g)*R,e[14]=(v*o*r-a*_*r-v*i*l+t*_*l+a*i*g-t*o*g)*R,e[15]=(a*d*r-u*o*r+u*i*l-t*d*l-a*i*f+t*o*f)*R,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,f=s*c,m=s*u,v=s*d,_=a*u,g=a*d,x=o*d,S=l*c,y=l*u,b=l*d,w=i.x,C=i.y,R=i.z;return r[0]=(1-(_+x))*w,r[1]=(m+b)*w,r[2]=(v-y)*w,r[3]=0,r[4]=(m-b)*C,r[5]=(1-(f+x))*C,r[6]=(g+S)*C,r[7]=0,r[8]=(v+y)*R,r[9]=(g-S)*R,r[10]=(1-(f+_))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=_v1$5.set(r[0],r[1],r[2]).length();const a=_v1$5.set(r[4],r[5],r[6]).length(),o=_v1$5.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],_m1$2.copy(this);const c=1/s,u=1/a,d=1/o;return _m1$2.elements[0]*=c,_m1$2.elements[1]*=c,_m1$2.elements[2]*=c,_m1$2.elements[4]*=u,_m1$2.elements[5]*=u,_m1$2.elements[6]*=u,_m1$2.elements[8]*=d,_m1$2.elements[9]*=d,_m1$2.elements[10]*=d,t.setFromRotationMatrix(_m1$2),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a){const o=this.elements,l=2*s/(t-e),c=2*s/(i-r),u=(t+e)/(t-e),d=(i+r)/(i-r),f=-(a+s)/(a-s),m=-2*a*s/(a-s);return o[0]=l,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,r,s,a){const o=this.elements,l=1/(t-e),c=1/(i-r),u=1/(a-s),d=(t+e)*l,f=(i+r)*c,m=(a+s)*u;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const _v1$5=new Vector3,_m1$2=new Matrix4,_zero=new Vector3(0,0,0),_one=new Vector3(1,1,1),_x=new Vector3,_y=new Vector3,_z=new Vector3,_matrix$1=new Matrix4,_quaternion$3=new Quaternion;class Euler{constructor(e=0,t=0,i=0,r=Euler.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],d=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(clamp(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-clamp(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(clamp(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-clamp(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return _matrix$1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(_matrix$1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _quaternion$3.setFromEuler(this),this.setFromQuaternion(_quaternion$3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Euler.DefaultOrder="XYZ";Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Layers{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let _object3DId=0;const _v1$4=new Vector3,_q1=new Quaternion,_m1$1=new Matrix4,_target=new Vector3,_position$3=new Vector3,_scale$2=new Vector3,_quaternion$2=new Quaternion,_xAxis=new Vector3(1,0,0),_yAxis=new Vector3(0,1,0),_zAxis=new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DefaultUp.clone();const e=new Vector3,t=new Euler,i=new Quaternion,r=new Vector3(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DefaultMatrixWorldAutoUpdate,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.premultiply(_q1),this}rotateX(e){return this.rotateOnAxis(_xAxis,e)}rotateY(e){return this.rotateOnAxis(_yAxis,e)}rotateZ(e){return this.rotateOnAxis(_zAxis,e)}translateOnAxis(e,t){return _v1$4.copy(e).applyQuaternion(this.quaternion),this.position.add(_v1$4.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_xAxis,e)}translateY(e){return this.translateOnAxis(_yAxis,e)}translateZ(e){return this.translateOnAxis(_zAxis,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(_m1$1.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?_target.copy(e):_target.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),_position$3.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1$1.lookAt(_position$3,_target,this.up):_m1$1.lookAt(_target,_position$3,this.up),this.quaternion.setFromRotationMatrix(_m1$1),r&&(_m1$1.extractRotation(r.matrixWorld),_q1.setFromRotationMatrix(_m1$1),this.quaternion.premultiply(_q1.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(_addedEvent)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(_removedEvent)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(_removedEvent)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),_m1$1.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),_m1$1.multiply(e.parent.matrixWorld)),e.applyMatrix4(_m1$1),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$3,e,_scale$2),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$3,_quaternion$2,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),f=a(e.skeletons),m=a(e.animations),v=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),v.length>0&&(i.nodes=v)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Object3D.DefaultUp=new Vector3(0,1,0);Object3D.DefaultMatrixAutoUpdate=!0;Object3D.DefaultMatrixWorldAutoUpdate=!0;const _v0$1=new Vector3,_v1$3=new Vector3,_v2$2=new Vector3,_v3$1=new Vector3,_vab=new Vector3,_vac=new Vector3,_vbc=new Vector3,_vap=new Vector3,_vbp=new Vector3,_vcp=new Vector3;class Triangle{constructor(e=new Vector3,t=new Vector3,i=new Vector3){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),_v0$1.subVectors(e,t),r.cross(_v0$1);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){_v0$1.subVectors(r,t),_v1$3.subVectors(i,t),_v2$2.subVectors(e,t);const a=_v0$1.dot(_v0$1),o=_v0$1.dot(_v1$3),l=_v0$1.dot(_v2$2),c=_v1$3.dot(_v1$3),u=_v1$3.dot(_v2$2),d=a*c-o*o;if(d===0)return s.set(-2,-1,-1);const f=1/d,m=(c*l-o*u)*f,v=(a*u-o*l)*f;return s.set(1-m-v,v,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,_v3$1),_v3$1.x>=0&&_v3$1.y>=0&&_v3$1.x+_v3$1.y<=1}static getUV(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,_v3$1),l.set(0,0),l.addScaledVector(s,_v3$1.x),l.addScaledVector(a,_v3$1.y),l.addScaledVector(o,_v3$1.z),l}static isFrontFacing(e,t,i,r){return _v0$1.subVectors(i,t),_v1$3.subVectors(e,t),_v0$1.cross(_v1$3).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _v0$1.subVectors(this.c,this.b),_v1$3.subVectors(this.a,this.b),_v0$1.cross(_v1$3).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Triangle.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;_vab.subVectors(r,i),_vac.subVectors(s,i),_vap.subVectors(e,i);const l=_vab.dot(_vap),c=_vac.dot(_vap);if(l<=0&&c<=0)return t.copy(i);_vbp.subVectors(e,r);const u=_vab.dot(_vbp),d=_vac.dot(_vbp);if(u>=0&&d<=u)return t.copy(r);const f=l*d-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(_vab,a);_vcp.subVectors(e,s);const m=_vab.dot(_vcp),v=_vac.dot(_vcp);if(v>=0&&m<=v)return t.copy(s);const _=m*c-l*v;if(_<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(i).addScaledVector(_vac,o);const g=u*v-m*d;if(g<=0&&d-u>=0&&m-v>=0)return _vbc.subVectors(s,r),o=(d-u)/(d-u+(m-v)),t.copy(r).addScaledVector(_vbc,o);const x=1/(g+_+f);return a=_*x,o=f*x,t.copy(i).addScaledVector(_vab,a).addScaledVector(_vac,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let materialId=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:materialId++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=NormalBlending,this.side=FrontSide,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=SrcAlphaFactor,this.blendDst=OneMinusSrcAlphaFactor,this.blendEquation=AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=AlwaysStencilFunc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=KeepStencilOp,this.stencilZFail=KeepStencilOp,this.stencilZPass=KeepStencilOp,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==NormalBlending&&(i.blending=this.blending),this.side!==FrontSide&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 9,348 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class MeshBasicMaterial extends Material{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const _vector$9=new Vector3,_vector2$1=new Vector2;class BufferAttribute{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=StaticDrawUsage,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)_vector2$1.fromBufferAttribute(this,t),_vector2$1.applyMatrix3(e),this.setXY(t,_vector2$1.x,_vector2$1.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)_vector$9.fromBufferAttribute(this,t),_vector$9.applyMatrix3(e),this.setXYZ(t,_vector$9.x,_vector$9.y,_vector$9.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)_vector$9.fromBufferAttribute(this,t),_vector$9.applyMatrix4(e),this.setXYZ(t,_vector$9.x,_vector$9.y,_vector$9.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)_vector$9.fromBufferAttribute(this,t),_vector$9.applyNormalMatrix(e),this.setXYZ(t,_vector$9.x,_vector$9.y,_vector$9.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)_vector$9.fromBufferAttribute(this,t),_vector$9.transformDirection(e),this.setXYZ(t,_vector$9.x,_vector$9.y,_vector$9.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array),s=normalize(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==StaticDrawUsage&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class Int8BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int8Array(e),t,i)}}class Uint8BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class Uint8ClampedBufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class Int16BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int16Array(e),t,i)}}class Uint16BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Int32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int32Array(e),t,i)}}class Uint32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Float16BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}}class Float32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Float32Array(e),t,i)}}class Float64BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Float64Array(e),t,i)}}let _id$1=0;const _m1=new Matrix4,_obj=new Object3D,_offset=new Vector3,_box$1$1=new Box3,_boxMorphTargets=new Box3,_vector$8=new Vector3;class BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_id$1++}),this.uuid=generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(arrayNeedsUint32(e)?Uint32BufferAttribute:Uint16BufferAttribute)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Matrix3().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _m1.makeRotationFromQuaternion(e),this.applyMatrix4(_m1),this}rotateX(e){return _m1.makeRotationX(e),this.applyMatrix4(_m1),this}rotateY(e){return _m1.makeRotationY(e),this.applyMatrix4(_m1),this}rotateZ(e){return _m1.makeRotationZ(e),this.applyMatrix4(_m1),this}translate(e,t,i){return _m1.makeTranslation(e,t,i),this.applyMatrix4(_m1),this}scale(e,t,i){return _m1.makeScale(e,t,i),this.applyMatrix4(_m1),this}lookAt(e){return _obj.lookAt(e),_obj.updateMatrix(),this.applyMatrix4(_obj.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_offset).negate(),this.translate(_offset.x,_offset.y,_offset.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Float32BufferAttribute(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];_box$1$1.setFromBufferAttribute(s),this.morphTargetsRelative?(_vector$8.addVectors(this.boundingBox.min,_box$1$1.min),this.boundingBox.expandByPoint(_vector$8),_vector$8.addVectors(this.boundingBox.max,_box$1$1.max),this.boundingBox.expandByPoint(_vector$8)):(this.boundingBox.expandByPoint(_box$1$1.min),this.boundingBox.expandByPoint(_box$1$1.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new Vector3,1/0);return}if(e){const i=this.boundingSphere.center;if(_box$1$1.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];_boxMorphTargets.setFromBufferAttribute(o),this.morphTargetsRelative?(_vector$8.addVectors(_box$1$1.min,_boxMorphTargets.min),_box$1$1.expandByPoint(_vector$8),_vector$8.addVectors(_box$1$1.max,_boxMorphTargets.max),_box$1$1.expandByPoint(_vector$8)):(_box$1$1.expandByPoint(_boxMorphTargets.min),_box$1$1.expandByPoint(_boxMorphTargets.max))}_box$1$1.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)_vector$8.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(_vector$8));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)_vector$8.fromBufferAttribute(o,c),l&&(_offset.fromBufferAttribute(e,c),_vector$8.add(_offset)),r=Math.max(r,i.distanceToSquared(_vector$8))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,a=t.uv.array,o=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],u=[];for(let B=0;B<o;B++)c[B]=new Vector3,u[B]=new Vector3;const d=new Vector3,f=new Vector3,m=new Vector3,v=new Vector2,_=new Vector2,g=new Vector2,x=new Vector3,S=new Vector3;function y(B,Z,W){d.fromArray(r,B*3),f.fromArray(r,Z*3),m.fromArray(r,W*3),v.fromArray(a,B*2),_.fromArray(a,Z*2),g.fromArray(a,W*2),f.sub(d),m.sub(d),_.sub(v),g.sub(v);const X=1/(_.x*g.y-g.x*_.y);isFinite(X)&&(x.copy(f).multiplyScalar(g.y).addScaledVector(m,-_.y).multiplyScalar(X),S.copy(m).multiplyScalar(_.x).addScaledVector(f,-g.x).multiplyScalar(X),c[B].add(x),c[Z].add(x),c[W].add(x),u[B].add(S),u[Z].add(S),u[W].add(S))}let b=this.groups;b.length===0&&(b=[{start:0,count:i.length}]);for(let B=0,Z=b.length;B<Z;++B){const W=b[B],X=W.start,G=W.count;for(let le=X,he=X+G;le<he;le+=3)y(i[le+0],i[le+1],i[le+2])}const w=new Vector3,C=new Vector3,R=new Vector3,M=new Vector3;function L(B){R.fromArray(s,B*3),M.copy(R);const Z=c[B];w.copy(Z),w.sub(R.multiplyScalar(R.dot(Z))).normalize(),C.crossVectors(M,Z);const X=C.dot(u[B])<0?-1:1;l[B*4]=w.x,l[B*4+1]=w.y,l[B*4+2]=w.z,l[B*4+3]=X}for(let B=0,Z=b.length;B<Z;++B){const W=b[B],X=W.start,G=W.count;for(let le=X,he=X+G;le<he;le+=3)L(i[le+0]),L(i[le+1]),L(i[le+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new BufferAttribute(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,m=i.count;f<m;f++)i.setXYZ(f,0,0,0);const r=new Vector3,s=new Vector3,a=new Vector3,o=new Vector3,l=new Vector3,c=new Vector3,u=new Vector3,d=new Vector3;if(e)for(let f=0,m=e.count;f<m;f+=3){const v=e.getX(f+0),_=e.getX(f+1),g=e.getX(f+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),o.fromBufferAttribute(i,v),l.fromBufferAttribute(i,_),c.fromBufferAttribute(i,g),o.add(u),l.add(u),c.add(u),i.setXYZ(v,o.x,o.y,o.z),i.setXYZ(_,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),i.setXYZ(f+0,u.x,u.y,u.z),i.setXYZ(f+1,u.x,u.y,u.z),i.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)_vector$8.fromBufferAttribute(e,t),_vector$8.normalize(),e.setXYZ(t,_vector$8.x,_vector$8.y,_vector$8.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,f=new c.constructor(l.length*u);let m=0,v=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?m=l[_]*o.data.stride+o.offset:m=l[_]*u;for(let x=0;x<u;
vendor: 13,123 bytes, lines 5-9
5x++)f[v++]=c[m++]}return new BufferAttribute(f,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new BufferGeometry,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const f=c[u],m=e(f,i);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,f=c.length;d<f;d++){const m=c[d];u.push(m.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let f=0,m=d.length;f<m;f++)u.push(d[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const _inverseMatrix$2=new Matrix4,_ray$2=new Ray,_sphere$3=new Sphere,_vA$1=new Vector3,_vB$1=new Vector3,_vC$1=new Vector3,_tempA=new Vector3,_tempB=new Vector3,_tempC=new Vector3,_morphA=new Vector3,_morphB=new Vector3,_morphC=new Vector3,_uvA$1=new Vector2,_uvB$1=new Vector2,_uvC$1=new Vector2,_intersectionPoint=new Vector3,_intersectionPointWorld=new Vector3;class Mesh extends Object3D{constructor(e=new BufferGeometry,t=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),_sphere$3.copy(i.boundingSphere),_sphere$3.applyMatrix4(s),e.ray.intersectsSphere(_sphere$3)===!1)||(_inverseMatrix$2.copy(s).invert(),_ray$2.copy(e.ray).applyMatrix4(_inverseMatrix$2),i.boundingBox!==null&&_ray$2.intersectsBox(i.boundingBox)===!1))return;let a;const o=i.index,l=i.attributes.position,c=i.morphAttributes.position,u=i.morphTargetsRelative,d=i.attributes.uv,f=i.attributes.uv2,m=i.groups,v=i.drawRange;if(o!==null)if(Array.isArray(r))for(let _=0,g=m.length;_<g;_++){const x=m[_],S=r[x.materialIndex],y=Math.max(x.start,v.start),b=Math.min(o.count,Math.min(x.start+x.count,v.start+v.count));for(let w=y,C=b;w<C;w+=3){const R=o.getX(w),M=o.getX(w+1),L=o.getX(w+2);a=checkBufferGeometryIntersection(this,S,e,_ray$2,l,c,u,d,f,R,M,L),a&&(a.faceIndex=Math.floor(w/3),a.face.materialIndex=x.materialIndex,t.push(a))}}else{const _=Math.max(0,v.start),g=Math.min(o.count,v.start+v.count);for(let x=_,S=g;x<S;x+=3){const y=o.getX(x),b=o.getX(x+1),w=o.getX(x+2);a=checkBufferGeometryIntersection(this,r,e,_ray$2,l,c,u,d,f,y,b,w),a&&(a.faceIndex=Math.floor(x/3),t.push(a))}}else if(l!==void 0)if(Array.isArray(r))for(let _=0,g=m.length;_<g;_++){const x=m[_],S=r[x.materialIndex],y=Math.max(x.start,v.start),b=Math.min(l.count,Math.min(x.start+x.count,v.start+v.count));for(let w=y,C=b;w<C;w+=3){const R=w,M=w+1,L=w+2;a=checkBufferGeometryIntersection(this,S,e,_ray$2,l,c,u,d,f,R,M,L),a&&(a.faceIndex=Math.floor(w/3),a.face.materialIndex=x.materialIndex,t.push(a))}}else{const _=Math.max(0,v.start),g=Math.min(l.count,v.start+v.count);for(let x=_,S=g;x<S;x+=3){const y=x,b=x+1,w=x+2;a=checkBufferGeometryIntersection(this,r,e,_ray$2,l,c,u,d,f,y,b,w),a&&(a.faceIndex=Math.floor(x/3),t.push(a))}}}}function checkIntersection(n,e,t,i,r,s,a,o){let l;if(e.side===BackSide?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side!==DoubleSide,o),l===null)return null;_intersectionPointWorld.copy(o),_intersectionPointWorld.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(_intersectionPointWorld);return c<t.near||c>t.far?null:{distance:c,point:_intersectionPointWorld.clone(),object:n}}function checkBufferGeometryIntersection(n,e,t,i,r,s,a,o,l,c,u,d){_vA$1.fromBufferAttribute(r,c),_vB$1.fromBufferAttribute(r,u),_vC$1.fromBufferAttribute(r,d);const f=n.morphTargetInfluences;if(s&&f){_morphA.set(0,0,0),_morphB.set(0,0,0),_morphC.set(0,0,0);for(let v=0,_=s.length;v<_;v++){const g=f[v],x=s[v];g!==0&&(_tempA.fromBufferAttribute(x,c),_tempB.fromBufferAttribute(x,u),_tempC.fromBufferAttribute(x,d),a?(_morphA.addScaledVector(_tempA,g),_morphB.addScaledVector(_tempB,g),_morphC.addScaledVector(_tempC,g)):(_morphA.addScaledVector(_tempA.sub(_vA$1),g),_morphB.addScaledVector(_tempB.sub(_vB$1),g),_morphC.addScaledVector(_tempC.sub(_vC$1),g)))}_vA$1.add(_morphA),_vB$1.add(_morphB),_vC$1.add(_morphC)}n.isSkinnedMesh&&(n.boneTransform(c,_vA$1),n.boneTransform(u,_vB$1),n.boneTransform(d,_vC$1));const m=checkIntersection(n,e,t,i,_vA$1,_vB$1,_vC$1,_intersectionPoint);if(m){o&&(_uvA$1.fromBufferAttribute(o,c),_uvB$1.fromBufferAttribute(o,u),_uvC$1.fromBufferAttribute(o,d),m.uv=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2)),l&&(_uvA$1.fromBufferAttribute(l,c),_uvB$1.fromBufferAttribute(l,u),_uvC$1.fromBufferAttribute(l,d),m.uv2=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2));const v={a:c,b:u,c:d,normal:new Vector3,materialIndex:0};Triangle.getNormal(_vA$1,_vB$1,_vC$1,v.normal),m.face=v}return m}class BoxGeometry extends BufferGeometry{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let f=0,m=0;v("z","y","x",-1,-1,i,t,e,a,s,0),v("z","y","x",1,-1,i,t,-e,a,s,1),v("x","z","y",1,1,e,i,t,r,a,2),v("x","z","y",1,-1,e,i,-t,r,a,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Float32BufferAttribute(c,3)),this.setAttribute("normal",new Float32BufferAttribute(u,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2));function v(_,g,x,S,y,b,w,C,R,M,L){const B=b/R,Z=w/M,W=b/2,X=w/2,G=C/2,le=R+1,he=M+1;let ue=0,ie=0;const ve=new Vector3;for(let _e=0;_e<he;_e++){const Q=_e*Z-X;for(let ne=0;ne<le;ne++){const ye=ne*B-W;ve[_]=ye*S,ve[g]=Q*y,ve[x]=G,c.push(ve.x,ve.y,ve.z),ve[_]=0,ve[g]=0,ve[x]=C>0?1:-1,u.push(ve.x,ve.y,ve.z),d.push(ne/R),d.push(1-_e/M),ue+=1}}for(let _e=0;_e<M;_e++)for(let Q=0;Q<R;Q++){const ne=f+Q+le*_e,ye=f+Q+le*(_e+1),Me=f+(Q+1)+le*(_e+1),Te=f+(Q+1)+le*_e;l.push(ne,ye,Te),l.push(ye,Me,Te),ie+=6}o.addGroup(m,ie,L),m+=ie,f+=ue}}static fromJSON(e){return new BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function cloneUniforms(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function mergeUniforms(n){const e={};for(let t=0;t<n.length;t++){const i=cloneUniforms(n[t]);for(const r in i)e[r]=i[r]}return e}function cloneUniformsGroups(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function getUnlitUniformColorSpace(n){return n.getRenderTarget()===null&&n.outputEncoding===sRGBEncoding?SRGBColorSpace:LinearSRGBColorSpace}const UniformsUtils={clone:cloneUniforms,merge:mergeUniforms};var default_vertex=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,default_fragment=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class ShaderMaterial extends Material{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=default_vertex,this.fragmentShader=default_fragment,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cloneUniforms(e.uniforms),this.uniformsGroups=cloneUniformsGroups(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class PerspectiveCamera extends Camera{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(DEG2RAD$1*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 5,389 bytes, lines 9-44
9getEffectiveFOV(){return RAD2DEG*2*Math.atan(Math.tan(DEG2RAD$1*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(DEG2RAD$1*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const fov=-90,aspect=1;class CubeCamera extends Object3D{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const r=new PerspectiveCamera(fov,aspect,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);const s=new PerspectiveCamera(fov,aspect,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const a=new PerspectiveCamera(fov,aspect,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);const o=new PerspectiveCamera(fov,aspect,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(0,-1,0),this.add(o);const l=new PerspectiveCamera(fov,aspect,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new PerspectiveCamera(fov,aspect,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[r,s,a,o,l,c]=this.children,u=e.getRenderTarget(),d=e.toneMapping,f=e.xr.enabled;e.toneMapping=NoToneMapping,e.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=m,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=d,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:CubeReflectionMapping,super(e,t,i,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new CubeTexture(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:LinearFilter}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new BoxGeometry(5,5,5),s=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:BackSide,blending:NoBlending});s.uniforms.tEquirect.value=t;const a=new Mesh(r,s),o=t.minFilter;return t.minFilter===LinearMipmapLinearFilter&&(t.minFilter=LinearFilter),new CubeCamera(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const _vector1=new Vector3,_vector2=new Vector3,_normalMatrix=new Matrix3;class Plane{constructor(e=new Vector3(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 6,105 bytes, lines 44-45
44setFromCoplanarPoints(e,t,i){const r=_vector1.subVectors(i,t).cross(_vector2.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(_vector1),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||_normalMatrix.getNormalMatrix(e),r=this.coplanarPoint(_vector1).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _sphere$2=new Sphere,_vector$7=new Vector3;class Frustum{constructor(e=new Plane,t=new Plane,i=new Plane,r=new Plane,s=new Plane,a=new Plane){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],u=i[6],d=i[7],f=i[8],m=i[9],v=i[10],_=i[11],g=i[12],x=i[13],S=i[14],y=i[15];return t[0].setComponents(o-r,d-l,_-f,y-g).normalize(),t[1].setComponents(o+r,d+l,_+f,y+g).normalize(),t[2].setComponents(o+s,d+c,_+m,y+x).normalize(),t[3].setComponents(o-s,d-c,_-m,y-x).normalize(),t[4].setComponents(o-a,d-u,_-v,y-S).normalize(),t[5].setComponents(o+a,d+u,_+v,y+S).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),_sphere$2.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSprite(e){return _sphere$2.center.set(0,0,0),_sphere$2.radius=.7071067811865476,_sphere$2.applyMatrix4(e.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(_vector$7.x=r.normal.x>0?e.max.x:e.min.x,_vector$7.y=r.normal.y>0?e.max.y:e.min.y,_vector$7.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_vector$7)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function WebGLAnimation(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function WebGLAttributes(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const d=c.array,f=c.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,d,f),c.onUploadCallback();let v;if(d instanceof Float32Array)v=5126;else if(d instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=5123;else if(d instanceof Int16Array)v=5122;else if(d instanceof Uint32Array)v=5125;else if(d instanceof Int32Array)v=5124;else if(d instanceof Int8Array)v=5120;else if(d instanceof Uint8Array)v=5121;else if(d instanceof Uint8ClampedArray)v=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:m,type:v,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,d){const f=u.array,m=u.updateRange;n.bindBuffer(d,c),m.count===-1?n.bufferSubData(d,0,f):(t?n.bufferSubData(d,m.offset*f.BYTES_PER_ELEMENT,f,m.offset,m.count):n.bufferSubData(d,m.offset*f.BYTES_PER_ELEMENT,f.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const d=i.get(c);d===void 0?i.set(c,r(c,u)):d.version<c.version&&(s(d.buffer,c,u),d.version=c.version)}return{get:a,remove:o,update:l}}class PlaneGeometry extends BufferGeometry{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,u=l+1,d=e/o,f=t/l,m=[],v=[],_=[],g=[];for(let x=0;x<u;x++){const S=x*f-a;for(let y=0;y<c;y++){const b=y*d-s;v.push(b,-S,0),_.push(0,0,1),g.push(y/o),g.push(1-x/l)}}for(let x=0;x<l;x++)for(let S=0;S<o;S++){const y=S+c*x,b=S+c*(x+1),w=S+1+c*(x+1),C=S+1+c*x;m.push(y,b,C),m.push(b,w,C)}this.setIndex(m),this.setAttribute("position",new Float32BufferAttribute(v,3)),this.setAttribute("normal",new Float32BufferAttribute(_,3)),this.setAttribute("uv",new Float32BufferAttribute(g,2))}static fromJSON(e){return new PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)}}var alphamap_fragment=`#ifdef USE_ALPHAMAP 45 diffuseColor.a *= texture2D( alphaMap, vUv ).g;
46#endif`,alphamap_pars_fragment=`#ifdef USE_ALPHAMAP 47 uniform sampler2D alphaMap; 48#endif`,alphatest_fragment=`#ifdef USE_ALPHATEST 49 if ( diffuseColor.a < alphaTest ) discard; 50#endif`,alphatest_pars_fragment=`#ifdef USE_ALPHATEST 51 uniform float alphaTest; 52#endif`,aomap_fragment=`#ifdef USE_AOMAP 53 float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; 54 reflectedLight.indirectDiffuse *= ambientOcclusion; 55 #if defined( USE_ENVMAP ) && defined( STANDARD ) 56 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 57 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 58 #endif 59#endif`,aomap_pars_fragment=`#ifdef USE_AOMAP 60 uniform sampler2D aoMap; 61 uniform float aoMapIntensity; 62#endif`,begin_vertex="vec3 transformed = vec3( position );",beginnormal_vertex=`vec3 objectNormal = vec3( normal ); 63#ifdef USE_TANGENT 64 vec3 objectTangent = vec3( tangent.xyz ); 65#endif`,bsdfs=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 66 return RECIPROCAL_PI * diffuseColor; 67} 68vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 69 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 70 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 71} 72float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 73 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 74 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 75} 76vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 77 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 78 float x2 = x * x; 79 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 80 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 81} 82float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 83 float a2 = pow2( alpha ); 84 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 85 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 86 return 0.5 / max( gv + gl, EPSILON ); 87} 88float D_GGX( const in float alpha, const in float dotNH ) { 89 float a2 = pow2( alpha ); 90 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 91 return RECIPROCAL_PI * a2 / pow2( denom ); 92} 93vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { 94 float alpha = pow2( roughness ); 95 vec3 halfDir = normalize( lightDir + viewDir ); 96 float dotNL = saturate( dot( normal, lightDir ) ); 97 float dotNV = saturate( dot( normal, viewDir ) ); 98 float dotNH = saturate( dot( normal, halfDir ) ); 99 float dotVH = saturate( dot( viewDir, halfDir ) ); 100 vec3 F = F_Schlick( f0, f90, dotVH ); 101 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 102 float D = D_GGX( alpha, dotNH ); 103 return F * ( V * D ); 104} 105#ifdef USE_IRIDESCENCE 106 vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) { 107 float alpha = pow2( roughness ); 108 vec3 halfDir = normalize( lightDir + viewDir ); 109 float dotNL = saturate( dot( normal, lightDir ) ); 110 float dotNV = saturate( dot( normal, viewDir ) ); 111 float dotNH = saturate( dot( normal, halfDir ) ); 112 float dotVH = saturate( dot( viewDir, halfDir ) ); 113 vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence ); 114 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 115 float D = D_GGX( alpha, dotNH ); 116 return F * ( V * D ); 117 } 118#endif 119vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 120 const float LUT_SIZE = 64.0; 121 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 122 const float LUT_BIAS = 0.5 / LUT_SIZE; 123 float dotNV = saturate( dot( N, V ) ); 124 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 125 uv = uv * LUT_SCALE + LUT_BIAS; 126 return uv; 127} 128float LTC_ClippedSphereFormFactor( const in vec3 f ) { 129 float l = length( f ); 130 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 131} 132vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 133 float x = dot( v1, v2 ); 134 float y = abs( x ); 135 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 136 float b = 3.4175940 + ( 4.1616724 + y ) * y; 137 float v = a / b; 138 float theta_sintheta = ( x >
138 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 139 return cross( v1, v2 ) * theta_sintheta; 140} 141vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 142 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 143 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 144 vec3 lightNormal = cross( v1, v2 ); 145 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 146 vec3 T1, T2; 147 T1 = normalize( V - N * dot( V, N ) ); 148 T2 = - cross( N, T1 ); 149 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 150 vec3 coords[ 4 ]; 151 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 152 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 153 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 154 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 155 coords[ 0 ] = normalize( coords[ 0 ] ); 156 coords[ 1 ] = normalize( coords[ 1 ] ); 157 coords[ 2 ] = normalize( coords[ 2 ] ); 158 coords[ 3 ] = normalize( coords[ 3 ] ); 159 vec3 vectorFormFactor = vec3( 0.0 ); 160 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 161 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 162 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 163 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 164 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 165 return vec3( result ); 166} 167float G_BlinnPhong_Implicit( ) { 168 return 0.25; 169} 170float D_BlinnPhong( const in float shininess, const in float dotNH ) { 171 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 172} 173vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 174 vec3 halfDir = normalize( lightDir + viewDir ); 175 float dotNH = saturate( dot( normal, halfDir ) ); 176 float dotVH = saturate( dot( viewDir, halfDir ) ); 177 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 178 float G = G_BlinnPhong_Implicit( ); 179 float D = D_BlinnPhong( shininess, dotNH ); 180 return F * ( G * D ); 181} 182#if defined( USE_SHEEN ) 183float D_Charlie( float roughness, float dotNH ) { 184 float alpha = pow2( roughness ); 185 float invAlpha = 1.0 / alpha; 186 float cos2h = dotNH * dotNH; 187 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 188 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 189} 190float V_Neubelt( float dotNV, float dotNL ) { 191 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 192} 193vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 194 vec3 halfDir = normalize( lightDir + viewDir ); 195 float dotNL = saturate( dot( normal, lightDir ) ); 196 float dotNV = saturate( dot( normal, viewDir ) ); 197 float dotNH = saturate( dot( normal, halfDir ) ); 198 float D = D_Charlie( sheenRoughness, dotNH ); 199 float V = V_Neubelt( dotNV, dotNL ); 200 return sheenColor * ( D * V ); 201} 202#endif`,iridescence_fragment=`#ifdef USE_IRIDESCENCE 203 const mat3 XYZ_TO_REC709 = mat3( 204 3.2404542, -0.9692660, 0.0556434, 205 -1.5371385, 1.8760108, -0.2040259, 206 -0.4985314, 0.0415560, 1.0572252 207 ); 208 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 209 vec3 sqrtF0 = sqrt( fresnel0 ); 210 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 211 } 212 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 213 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 214 } 215 float IorToFresnel0( float transmittedIor, float incidentIor ) { 216 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 217 } 218 vec3 evalSensitivity( float OPD, vec3 shift ) { 219 float phase = 2.0 * PI * OPD * 1.0e-9; 220 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 221 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 222 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 223 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 224 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 225 xyz /= 1.0685e-7; 226 vec3 rgb = XYZ_TO_REC709 * xyz; 227 return rgb; 228 } 229 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 230 vec3 I; 231 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 232 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 233 float cosTheta2Sq = 1.0 - sinTheta2Sq; 234 if ( cosTheta2Sq < 0.0 ) { 235 return vec3( 1.0 ); 236 } 237 float cosTheta2 = sqrt( cosTheta2Sq ); 238 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
239 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 240 float R21 = R12; 241 float T121 = 1.0 - R12; 242 float phi12 = 0.0; 243 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 244 float phi21 = PI - phi12; 245 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 246 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 247 vec3 phi23 = vec3( 0.0 ); 248 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 249 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 250 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 251 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 252 vec3 phi = vec3( phi21 ) + phi23; 253 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 254 vec3 r123 = sqrt( R123 ); 255 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 256 vec3 C0 = R12 + Rs; 257 I = C0; 258 vec3 Cm = Rs - T121; 259 for ( int m = 1; m <= 2; ++ m ) { 260 Cm *= r123; 261 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 262 I += Cm * Sm; 263 } 264 return max( I, vec3( 0.0 ) ); 265 } 266#endif`,bumpmap_pars_fragment=`#ifdef USE_BUMPMAP 267 uniform sampler2D bumpMap; 268 uniform float bumpScale; 269 vec2 dHdxy_fwd() { 270 vec2 dSTdx = dFdx( vUv ); 271 vec2 dSTdy = dFdy( vUv ); 272 float Hll = bumpScale * texture2D( bumpMap, vUv ).x; 273 float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; 274 float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; 275 return vec2( dBx, dBy ); 276 } 277 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 278 vec3 vSigmaX = dFdx( surf_pos.xyz ); 279 vec3 vSigmaY = dFdy( surf_pos.xyz ); 280 vec3 vN = surf_norm; 281 vec3 R1 = cross( vSigmaY, vN ); 282 vec3 R2 = cross( vN, vSigmaX ); 283 float fDet = dot( vSigmaX, R1 ) * faceDirection; 284 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 285 return normalize( abs( fDet ) * surf_norm - vGrad ); 286 } 287#endif`,clipping_planes_fragment=`#if NUM_CLIPPING_PLANES > 0 288 vec4 plane; 289 #pragma unroll_loop_start 290 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 291 plane = clippingPlanes[ i ]; 292 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 293 } 294 #pragma unroll_loop_end 295 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 296 bool clipped = true; 297 #pragma unroll_loop_start 298 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 299 plane = clippingPlanes[ i ]; 300 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 301 } 302 #pragma unroll_loop_end 303 if ( clipped ) discard; 304 #endif 305#endif`,clipping_planes_pars_fragment=`#if NUM_CLIPPING_PLANES > 0 306 varying vec3 vClipPosition; 307 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 308#endif`,clipping_planes_pars_vertex=`#if NUM_CLIPPING_PLANES > 0 309 varying vec3 vClipPosition; 310#endif`,clipping_planes_vertex=`#if NUM_CLIPPING_PLANES > 0 311 vClipPosition = - mvPosition.xyz; 312#endif`,color_fragment=`#if defined( USE_COLOR_ALPHA ) 313 diffuseColor *= vColor; 314#elif defined( USE_COLOR ) 315 diffuseColor.rgb *= vColor; 316#endif`,color_pars_fragment=`#if defined( USE_COLOR_ALPHA ) 317 varying vec4 vColor; 318#elif defined( USE_COLOR ) 319 varying vec3 vColor; 320#endif`,color_pars_vertex=`#if defined( USE_COLOR_ALPHA ) 321 varying vec4 vColor; 322#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 323 varying vec3 vColor; 324#endif`,color_vertex=`#if defined( USE_COLOR_ALPHA ) 325 vColor = vec4( 1.0 ); 326#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 327 vColor = vec3( 1.0 ); 328#endif 329#ifdef USE_COLOR 330 vColor *= color; 331#endif 332#ifdef USE_INSTANCING_COLOR 333 vColor.xyz *= instanceColor.xyz; 334#endif`,common=`#define PI 3.141592653589793 335#define PI2 6.283185307179586 336#define PI_HALF 1.5707963267948966 337#define RECIPROCAL_PI 0.3183098861837907 338#define RECIPROCAL_PI2 0.15915494309189535 339#define EPSILON 1e-6 340#ifndef saturate 341#define saturate( a ) clamp( a, 0.0, 1.0 ) 342#endif 343#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 344float pow2( const in float x ) { return x*x; } 345vec3 pow2( const in vec3 x ) { return x*x; } 346float pow3( const in float x ) { return x*x*x; } 347float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 348float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 349float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 350highp float rand( const in vec2 uv ) { 351 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 352 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 353 return fract( sin( sn ) * c ); 354} 355#ifdef HIGH_PRECISION 356 float precisionSafeLength( vec3 v ) { return length( v ); } 357#else 358 float precisionSafeLength( vec3 v ) { 359 float maxComponent = max3( abs( v ) ); 360 return length( v / maxComponent ) * maxComponent; 361 } 362#endif 363struct IncidentLight { 364 vec3 color; 365 vec3 direction; 366 bool visible; 367}; 368struct ReflectedLight { 369 vec3 directDiffuse; 370 vec3 directSpecular; 371 vec3 indirectDiffuse; 372 vec3 indirectSpecular; 373}; 374struct GeometricContext { 375 vec3 position; 376 vec3 normal; 377 vec3 viewDir; 378#ifdef USE_CLEARCOAT 379 vec3 clearcoatNormal; 380#endif 381}; 382vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 383 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 384} 385vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 386 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 387} 388mat3 transposeMat3( const in mat3 m ) { 389 mat3 tmp; 390 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 391 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 392 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 393 return tmp; 394} 395float luminance( const in vec3 rgb ) { 396 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 397 return dot( weights, rgb ); 398} 399bool isPerspectiveMatrix( mat4 m ) { 400 return m[ 2 ][ 3 ] == - 1.0; 401} 402vec2 equirectUv( in vec3 dir ) { 403 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 404 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 405 return vec2( u, v ); 406}`,cube_uv_reflection_fragment=`#ifdef ENVMAP_TYPE_CUBE_UV 407 #define cubeUV_minMipLevel 4.0 408 #define cubeUV_minTileSize 16.0 409 float getFace( vec3 direction ) { 410 vec3 absDirection = abs( direction ); 411 float face = - 1.0; 412 if ( absDirection.x > absDirection.z ) { 413 if ( absDirection.x > absDirection.y ) 414 face = direction.x > 0.0 ? 0.0 : 3.0; 415 else 416 face = direction.y > 0.0 ? 1.0 : 4.0; 417 } else { 418 if ( absDirection.z > absDirection.y ) 419 face = direction.z > 0.0 ? 2.0 : 5.0; 420 else 421 face = direction.y > 0.0 ? 1.0 : 4.0; 422 } 423 return face; 424 } 425 vec2 getUV( vec3 direction, float face ) { 426 vec2 uv; 427 if ( face == 0.0 ) { 428 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 429 } else if ( face == 1.0 ) { 430 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 431 } else if ( face == 2.0 ) { 432 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 433 } else if ( face == 3.0 ) { 434 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 435 } else if ( face == 4.0 ) { 436 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 437 } else { 438 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 439 } 440 return 0.5 * ( uv + 1.0 ); 441 } 442 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 443 float face = getFace( direction ); 444 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 445 mipInt = max( mipInt, cubeUV_minMipLevel ); 446 float faceSize = exp2( mipInt ); 447 vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 448 if ( face > 2.0 ) { 449 uv.y += faceSize; 450 face -= 3.0; 451 } 452 uv.x += face * faceSize; 453 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 454 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 455 uv.x *= CUBEUV_TEXEL_WIDTH; 456 uv.y *= CUBEUV_TEXEL_HEIGHT; 457 #ifdef texture2DGradEXT 458 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 459 #else 460 return texture2D( envMap, uv ).rgb; 461 #endif 462 } 463 #define cubeUV_r0 1.0 464 #define cubeUV_v0 0.339 465 #define cubeUV_m0 - 2.0 466 #define cubeUV_r1 0.8 467 #define cubeUV_v1 0.276 468 #define cubeUV_m1 - 1.0 469 #define cubeUV_r4 0.4 470 #define cubeUV_v4 0.046 471 #define cubeUV_m4 2.0 472 #define cubeUV_r5 0.305 473 #define cubeUV_v5 0.016 474 #define cubeUV_m5 3.0 475 #define cubeUV_r6 0.21 476 #define cubeUV_v6 0.0038 477 #define cubeUV_m6 4.0 478 float roughnessToMip( float roughness ) { 479 float mip = 0.0; 480 if ( roughness >= cubeUV_r1 ) { 481 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 482 } else if ( roughness >= cubeUV_r4 ) { 483 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 484 } else if ( roughness >= cubeUV_r5 ) { 485 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 486 } else if ( roughness >= cubeUV_r6 ) { 487 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 488 } else { 489 mip = - 2.0 * log2( 1.16 * roughness ); } 490 return mip; 491 } 492 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 493 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 494 float mipF = fract( mip ); 495 float mipInt = floor( mip ); 496 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 497 if ( mipF == 0.0 ) { 498 return vec4( color0, 1.0 ); 499 } else { 500 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 501 return vec4( mix( color0, color1, mipF ), 1.0 ); 502 } 503 } 504#endif`,defaultnormal_vertex=`vec3 transformedNormal = objectNormal; 505#ifdef USE_INSTANCING 506 mat3 m = mat3( instanceMatrix ); 507 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 508 transformedNormal = m * transformedNormal; 509#endif 510transformedNormal = normalMatrix * transformedNormal; 511#ifdef FLIP_SIDED 512 transformedNormal = - transformedNormal; 513#endif 514#ifdef USE_TANGENT 515 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 516 #ifdef FLIP_SIDED 517 transformedTangent = - transformedTangent; 518 #endif 519#endif`,displacementmap_pars_vertex=`#ifdef USE_DISPLACEMENTMAP 520 uniform sampler2D displacementMap; 521 uniform float displacementScale; 522 uniform float displacementBias; 523#endif`,displacementmap_vertex=`#ifdef USE_DISPLACEMENTMAP 524 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
524placementBias ); 525#endif`,emissivemap_fragment=`#ifdef USE_EMISSIVEMAP 526 vec4 emissiveColor = texture2D( emissiveMap, vUv ); 527 totalEmissiveRadiance *= emissiveColor.rgb; 528#endif`,emissivemap_pars_fragment=`#ifdef USE_EMISSIVEMAP 529 uniform sampler2D emissiveMap; 530#endif`,encodings_fragment="gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment=`vec4 LinearToLinear( in vec4 value ) { 531 return value; 532} 533vec4 LinearTosRGB( in vec4 value ) { 534 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 ); 535}`,envmap_fragment=`#ifdef USE_ENVMAP 536 #ifdef ENV_WORLDPOS 537 vec3 cameraToFrag; 538 if ( isOrthographic ) { 539 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 540 } else { 541 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 542 } 543 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 544 #ifdef ENVMAP_MODE_REFLECTION 545 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 546 #else 547 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 548 #endif 549 #else 550 vec3 reflectVec = vReflect; 551 #endif 552 #ifdef ENVMAP_TYPE_CUBE 553 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 554 #else 555 vec4 envColor = vec4( 0.0 ); 556 #endif 557 #ifdef ENVMAP_BLENDING_MULTIPLY 558 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 559 #elif defined( ENVMAP_BLENDING_MIX ) 560 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 561 #elif defined( ENVMAP_BLENDING_ADD ) 562 outgoingLight += envColor.xyz * specularStrength * reflectivity; 563 #endif 564#endif`,envmap_common_pars_fragment=`#ifdef USE_ENVMAP 565 uniform float envMapIntensity; 566 uniform float flipEnvMap; 567 #ifdef ENVMAP_TYPE_CUBE 568 uniform samplerCube envMap; 569 #else 570 uniform sampler2D envMap; 571 #endif 572 573#endif`,envmap_pars_fragment=`#ifdef USE_ENVMAP 574 uniform float reflectivity; 575 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 576 #define ENV_WORLDPOS 577 #endif 578 #ifdef ENV_WORLDPOS 579 varying vec3 vWorldPosition; 580 uniform float refractionRatio; 581 #else 582 varying vec3 vReflect; 583 #endif 584#endif`,envmap_pars_vertex=`#ifdef USE_ENVMAP 585 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 586 #define ENV_WORLDPOS 587 #endif 588 #ifdef ENV_WORLDPOS 589 590 varying vec3 vWorldPosition; 591 #else 592 varying vec3 vReflect; 593 uniform float refractionRatio; 594 #endif 595#endif`,envmap_vertex=`#ifdef USE_ENVMAP 596 #ifdef ENV_WORLDPOS 597 vWorldPosition = worldPosition.xyz; 598 #else 599 vec3 cameraToVertex; 600 if ( isOrthographic ) { 601 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 602 } else {
603 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 604 } 605 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 606 #ifdef ENVMAP_MODE_REFLECTION 607 vReflect = reflect( cameraToVertex, worldNormal ); 608 #else 609 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 610 #endif 611 #endif 612#endif`,fog_vertex=`#ifdef USE_FOG 613 vFogDepth = - mvPosition.z; 614#endif`,fog_pars_vertex=`#ifdef USE_FOG 615 varying float vFogDepth; 616#endif`,fog_fragment=`#ifdef USE_FOG 617 #ifdef FOG_EXP2 618 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 619 #else 620 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 621 #endif 622 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 623#endif`,fog_pars_fragment=`#ifdef USE_FOG 624 uniform vec3 fogColor; 625 varying float vFogDepth; 626 #ifdef FOG_EXP2 627 uniform float fogDensity; 628 #else 629 uniform float fogNear; 630 uniform float fogFar; 631 #endif 632#endif`,gradientmap_pars_fragment=`#ifdef USE_GRADIENTMAP 633 uniform sampler2D gradientMap; 634#endif 635vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 636 float dotNL = dot( normal, lightDirection ); 637 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 638 #ifdef USE_GRADIENTMAP 639 return vec3( texture2D( gradientMap, coord ).r ); 640 #else 641 vec2 fw = fwidth( coord ) * 0.5; 642 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 643 #endif 644}`,lightmap_fragment=`#ifdef USE_LIGHTMAP 645 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 646 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 647 reflectedLight.indirectDiffuse += lightMapIrradiance; 648#endif`,lightmap_pars_fragment=`#ifdef USE_LIGHTMAP 649 uniform sampler2D lightMap; 650 uniform float lightMapIntensity; 651#endif`,lights_lambert_fragment=`LambertMaterial material; 652material.diffuseColor = diffuseColor.rgb; 653material.specularStrength = specularStrength;`,lights_lambert_pars_fragment=`varying vec3 vViewPosition; 654struct LambertMaterial { 655 vec3 diffuseColor; 656 float specularStrength; 657}; 658void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 659 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 660 vec3 irradiance = dotNL * directLight.color; 661 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 662} 663void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 664 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 665} 666#define RE_Direct RE_Direct_Lambert 667#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin=`uniform bool receiveShadow; 668uniform vec3 ambientLightColor; 669uniform vec3 lightProbe[ 9 ]; 670vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 671 float x = normal.x, y = normal.y, z = normal.z; 672 vec3 result = shCoefficients[ 0 ] * 0.886227; 673 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 674 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 675 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 676 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 677 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 678 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 679 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 680 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 681 return result; 682} 683vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 684 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 685 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 686 return irradiance; 687} 688vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 689 vec3 irradiance = ambientLightColor; 690 return irradiance; 691} 692float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 693 #if defined ( PHYSICALLY_CORRECT_LIGHTS ) 694 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 695 if ( cutoffDistance > 0.0 ) { 696 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 697 } 698 return distanceFalloff; 699 #else 700 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 701 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 702 } 703 return 1.0; 704 #endif 705} 706float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 707 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 708} 709#if NUM_DIR_LIGHTS > 0 710 struct DirectionalLight { 711 vec3 direction; 712 vec3 color; 713 }; 714 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 715 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 716 light.color = directionalLight.color; 717 light.direction = directionalLight.direction; 718 light.visible = true; 719 } 720#endif 721#if NUM_POINT_LIGHTS > 0 722 struct PointLight { 723 vec3 position; 724 vec3 color; 725 float distance; 726 float decay; 727 }; 728 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 729 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 730 vec3 lVector = pointLight.position - geometry.position; 731 light.direction = normalize( lVector ); 732 float lightDistance = length( lVector ); 733 light.color = pointLight.color; 734 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 735 light.visible = ( light.color != vec3( 0.0 ) ); 736 } 737#endif
738#if NUM_SPOT_LIGHTS > 0 739 struct SpotLight { 740 vec3 position; 741 vec3 direction; 742 vec3 color; 743 float distance; 744 float decay; 745 float coneCos; 746 float penumbraCos; 747 }; 748 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 749 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 750 vec3 lVector = spotLight.position - geometry.position; 751 light.direction = normalize( lVector ); 752 float angleCos = dot( light.direction, spotLight.direction ); 753 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 754 if ( spotAttenuation > 0.0 ) { 755 float lightDistance = length( lVector ); 756 light.color = spotLight.color * spotAttenuation; 757 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 758 light.visible = ( light.color != vec3( 0.0 ) ); 759 } else { 760 light.color = vec3( 0.0 ); 761 light.visible = false; 762 } 763 } 764#endif 765#if NUM_RECT_AREA_LIGHTS > 0 766 struct RectAreaLight { 767 vec3 color; 768 vec3 position; 769 vec3 halfWidth; 770 vec3 halfHeight; 771 }; 772 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 773 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 774#endif 775#if NUM_HEMI_LIGHTS > 0 776 struct HemisphereLight { 777 vec3 direction; 778 vec3 skyColor; 779 vec3 groundColor; 780 }; 781 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 782 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 783 float dotNL = dot( normal, hemiLight.direction ); 784 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 785 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 786 return irradiance; 787 } 788#endif`,envmap_physical_pars_fragment=`#if defined( USE_ENVMAP ) 789 vec3 getIBLIrradiance( const in vec3 normal ) { 790 #if defined( ENVMAP_TYPE_CUBE_UV ) 791 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 792 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 793 return PI * envMapColor.rgb * envMapIntensity; 794 #else 795 return vec3( 0.0 ); 796 #endif 797 } 798 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 799 #if defined( ENVMAP_TYPE_CUBE_UV ) 800 vec3 reflectVec = reflect( - viewDir, normal ); 801 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 802 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 803 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 804 return envMapColor.rgb * envMapIntensity; 805 #else 806 return vec3( 0.0 ); 807 #endif 808 } 809#endif`,lights_toon_fragment=`ToonMaterial material; 810material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment=`varying vec3 vViewPosition; 811struct ToonMaterial { 812 vec3 diffuseColor; 813}; 814void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 815 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 816 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 817} 818void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 819 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 820} 821#define RE_Direct RE_Direct_Toon 822#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment=`BlinnPhongMaterial material; 823material.diffuseColor = diffuseColor.rgb; 824material.specularColor = specular; 825material.specularShininess = shininess; 826material.specularStrength = specularStrength;`,lights_phong_pars_fragment=`varying vec3 vViewPosition; 827struct BlinnPhongMaterial { 828 vec3 diffuseColor; 829 vec3 specularColor; 830 float specularShininess; 831 float specularStrength; 832}; 833void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 834 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 835 vec3 irradiance = dotNL * directLight.color; 836 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 837 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 838} 839void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 840 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 841} 842#define RE_Direct RE_Direct_BlinnPhong 843#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment=`PhysicalMaterial material; 844material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 845vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 846float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 847material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 848material.roughness = min( material.roughness, 1.0 ); 849#ifdef IOR 850 material.ior = ior; 851 #ifdef SPECULAR 852 float specularIntensityFactor = specularIntensity; 853 vec3 specularColorFactor = specularColor; 854 #ifdef USE_SPECULARINTENSITYMAP 855 specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; 856 #endif 857 #ifdef USE_SPECULARCOLORMAP 858 specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; 859 #endif 860 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 861 #else 862 float specularIntensityFactor = 1.0; 863 vec3 specularColorFactor = vec3( 1.0 ); 864 material.specularF90 = 1.0; 865 #endif 866 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 867#else 868 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 869 material.specularF90 = 1.0; 870#endif 871#ifdef USE_CLEARCOAT 872 material.clearcoat = clearcoat; 873 material.clearcoatRoughness = clearcoatRoughness; 874 material.clearcoatF0 = vec3( 0.04 ); 875 material.clearcoatF90 = 1.0; 876 #ifdef USE_CLEARCOATMAP 877 material.clearcoat *= texture2D( clearcoatMap, vUv ).x; 878 #endif 879 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 880 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; 881 #endif 882 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 883 material.clearcoatRoughness += geometryRoughness; 884 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 885#endif
886#ifdef USE_IRIDESCENCE 887 material.iridescence = iridescence; 888 material.iridescenceIOR = iridescenceIOR; 889 #ifdef USE_IRIDESCENCEMAP 890 material.iridescence *= texture2D( iridescenceMap, vUv ).r; 891 #endif 892 #ifdef USE_IRIDESCENCE_THICKNESSMAP 893 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; 894 #else 895 material.iridescenceThickness = iridescenceThicknessMaximum; 896 #endif 897#endif 898#ifdef USE_SHEEN 899 material.sheenColor = sheenColor; 900 #ifdef USE_SHEENCOLORMAP 901 material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; 902 #endif 903 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 904 #ifdef USE_SHEENROUGHNESSMAP 905 material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; 906 #endif 907#endif`,lights_physical_pars_fragment=`struct PhysicalMaterial { 908 vec3 diffuseColor; 909 float roughness; 910 vec3 specularColor; 911 float specularF90; 912 #ifdef USE_CLEARCOAT 913 float clearcoat; 914 float clearcoatRoughness; 915 vec3 clearcoatF0; 916 float clearcoatF90; 917 #endif 918 #ifdef USE_IRIDESCENCE 919 float iridescence; 920 float iridescenceIOR; 921 float iridescenceThickness; 922 vec3 iridescenceFresnel; 923 vec3 iridescenceF0; 924 #endif 925 #ifdef USE_SHEEN 926 vec3 sheenColor; 927 float sheenRoughness; 928 #endif 929 #ifdef IOR 930 float ior; 931 #endif 932 #ifdef USE_TRANSMISSION 933 float transmission; 934 float transmissionAlpha; 935 float thickness; 936 float attenuationDistance; 937 vec3 attenuationColor; 938 #endif 939}; 940vec3 clearcoatSpecular = vec3( 0.0 ); 941vec3 sheenSpecular = vec3( 0.0 ); 942float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 943 float dotNV = saturate( dot( normal, viewDir ) ); 944 float r2 = roughness * roughness; 945 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 946 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 947 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 948 return saturate( DG * RECIPROCAL_PI ); 949} 950vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 951 float dotNV = saturate( dot( normal, viewDir ) ); 952 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 953 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 954 vec4 r = roughness * c0 + c1; 955 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 956 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 957 return fab; 958} 959vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 960 vec2 fab = DFGApprox( normal, viewDir, roughness ); 961 return specularColor * fab.x + specularF90 * fab.y; 962} 963#ifdef USE_IRIDESCENCE 964void 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 ) { 965#else 966void 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 ) { 967#endif 968 vec2 fab = DFGApprox( normal, viewDir, roughness ); 969 #ifdef USE_IRIDESCENCE 970 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 971 #else 972 vec3 Fr = specularColor; 973 #endif 974 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 975 float Ess = fab.x + fab.y; 976 float Ems = 1.0 - Ess; 977 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 978 singleScatter += FssEss; 979 multiScatter += Fms * Ems; 980} 981#if NUM_RECT_AREA_LIGHTS > 0 982 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 983 vec3 normal = geometry.normal; 984 vec3 viewDir = geometry.viewDir; 985 vec3 position = geometry.position; 986 vec3 lightPos = rectAreaLight.position; 987 vec3 halfWidth = rectAreaLight.halfWidth; 988 vec3 halfHeight = rectAreaLight.halfHeight; 989 vec3 lightColor = rectAreaLight.color; 990 float roughness = material.roughness; 991 vec3 rectCoords[ 4 ]; 992 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 993 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 994 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 995 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 996 vec4 t1 = texture2D( ltc_1, uv ); 997 vec4 t2 = texture2D( ltc_2, uv ); 998 mat3 mInv = mat3( 999 vec3( t1.x, 0, t1.y ), 1000 vec3( 0, 1, 0 ), 1001 vec3( t1.z, 0, t1.w ) 1002 ); 1003 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1004 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1005 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1006 } 1007#endif 1008void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1009 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1010 vec3 irradiance = dotNL * directLight.color; 1011 #ifdef USE_CLEARCOAT 1012 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1013 vec3 ccIrradiance = dotNLcc * directLight.color; 1014 clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1015 #endif 1016 #ifdef USE_SHEEN 1017 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1018 #endif 1019 #ifdef USE_IRIDESCENCE 1020 reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); 1021 #else 1022 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); 1023 #endif 1024 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1025} 1026void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1027 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1028} 1029void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1030 #ifdef USE_CLEARCOAT 1031 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1032 #endif 1033 #ifdef USE_SHEEN 1034 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1035 #endif 1036 vec3 singleScattering = vec3( 0.0 ); 1037 vec3 multiScattering = vec3( 0.0 ); 1038 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1039 #ifdef USE_IRIDESCENCE 1040 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1041 #else 1042 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1043 #endif 1044 vec3 totalScattering = singleScattering + multiScattering; 1045 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1046 reflectedLight.indirectSpecular += radiance * singleScattering; 1047 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1048 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1049} 1050#define RE_Direct RE_Direct_Physical 1051#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1052#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1053#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1054float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1055 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1056}`,lights_fragment_begin=` 1057GeometricContext geometry; 1058geometry.position = - vViewPosition; 1059geometry.normal = normal; 1060geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1061#ifdef USE_CLEARCOAT 1062 geometry.clearcoatNormal = clearcoatNormal; 1063#endif 1064#ifdef USE_IRIDESCENCE 1065 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1066 if ( material.iridescenceThickness == 0.0 ) { 1067 material.iridescence = 0.0; 1068 } else { 1069 material.iridescence = saturate( material.iridescence ); 1070 } 1071 if ( material.iridescence > 0.0 ) { 1072 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1073 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1074 } 1075#endif 1076IncidentLight directLight; 1077#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1078 PointLight pointLight; 1079 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1080 PointLightShadow pointLightShadow; 1081 #endif 1082 #pragma unroll_loop_start 1083 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1084 pointLight = pointLights[ i ]; 1085 getPointLightInfo( pointLight, geometry, directLight ); 1086 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1087 pointLightShadow = pointLightShadows[ i ]; 1088 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1089 #endif 1090 RE_Direct( directLight, geometry, material, reflectedLight ); 1091 } 1092 #pragma unroll_loop_end 1093#endif
1094#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1095 SpotLight spotLight; 1096 vec4 spotColor; 1097 vec3 spotLightCoord; 1098 bool inSpotLightMap; 1099 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1100 SpotLightShadow spotLightShadow; 1101 #endif 1102 #pragma unroll_loop_start 1103 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1104 spotLight = spotLights[ i ]; 1105 getSpotLightInfo( spotLight, geometry, directLight ); 1106 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1107 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1108 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1109 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1110 #else 1111 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1112 #endif 1113 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1114 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1115 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1116 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1117 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1118 #endif 1119 #undef SPOT_LIGHT_MAP_INDEX 1120 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1121 spotLightShadow = spotLightShadows[ i ]; 1122 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1123 #endif 1124 RE_Direct( directLight, geometry, material, reflectedLight ); 1125 } 1126 #pragma unroll_loop_end 1127#endif 1128#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1129 DirectionalLight directionalLight; 1130 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1131 DirectionalLightShadow directionalLightShadow; 1132 #endif 1133 #pragma unroll_loop_start 1134 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1135 directionalLight = directionalLights[ i ]; 1136 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1137 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1138 directionalLightShadow = directionalLightShadows[ i ]; 1139 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1140 #endif 1141 RE_Direct( directLight, geometry, material, reflectedLight ); 1142 } 1143 #pragma unroll_loop_end 1144#endif 1145#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1146 RectAreaLight rectAreaLight; 1147 #pragma unroll_loop_start 1148 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1149 rectAreaLight = rectAreaLights[ i ]; 1150 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1151 } 1152 #pragma unroll_loop_end 1153#endif 1154#if defined( RE_IndirectDiffuse ) 1155 vec3 iblIrradiance = vec3( 0.0 ); 1156 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1157 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1158 #if ( NUM_HEMI_LIGHTS > 0 ) 1159 #pragma unroll_loop_start 1160 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1161 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1162 } 1163 #pragma unroll_loop_end 1164 #endif 1165#endif 1166#if defined( RE_IndirectSpecular ) 1167 vec3 radiance = vec3( 0.0 ); 1168 vec3 clearcoatRadiance = vec3( 0.0 ); 1169#endif`,lights_fragment_maps=`#if defined( RE_IndirectDiffuse ) 1170 #ifdef USE_LIGHTMAP 1171 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 1172 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1173 irradiance += lightMapIrradiance; 1174 #endif 1175 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1176 iblIrradiance += getIBLIrradiance( geometry.normal ); 1177 #endif 1178#endif 1179#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1180 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1181 #ifdef USE_CLEARCOAT 1182 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1183 #endif 1184#endif`,lights_fragment_end=`#if defined( RE_IndirectDiffuse ) 1185 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1186#endif 1187#if defined( RE_IndirectSpecular ) 1188 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1189#endif`,logdepthbuf_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1190 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1191#endif`,logdepthbuf_pars_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1192 uniform float logDepthBufFC; 1193 varying float vFragDepth; 1194 varying float vIsPerspective; 1195#endif`,logdepthbuf_pars_vertex=`#ifdef USE_LOGDEPTHBUF 1196 #ifdef USE_LOGDEPTHBUF_EXT 1197 varying float vFragDepth; 1198 varying float vIsPerspective; 1199 #else 1200 uniform float logDepthBufFC; 1201 #endif 1202#endif`,logdepthbuf_vertex=`#ifdef USE_LOGDEPTHBUF 1203 #ifdef USE_LOGDEPTHBUF_EXT 1204 vFragDepth = 1.0 + gl_Position.w; 1205 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1206 #else 1207 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1208 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1209 gl_Position.z *= gl_Position.w; 1210 } 1211 #endif 1212#endif`,map_fragment=`#ifdef USE_MAP 1213 vec4 sampledDiffuseColor = texture2D( map, vUv ); 1214 #ifdef DECODE_VIDEO_TEXTURE 1215 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 ); 1216 #endif 1217 diffuseColor *= sampledDiffuseColor; 1218#endif`,map_pars_fragment=`#ifdef USE_MAP 1219 uniform sampler2D map; 1220#endif`,map_particle_fragment=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1221 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1222#endif 1223#ifdef USE_MAP 1224 diffuseColor *= texture2D( map, uv ); 1225#endif 1226#ifdef USE_ALPHAMAP 1227 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1228#endif`,map_particle_pars_fragment=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1229 uniform mat3 uvTransform; 1230#endif 1231#ifdef USE_MAP 1232 uniform sampler2D map; 1233#endif 1234#ifdef USE_ALPHAMAP 1235 uniform sampler2D alphaMap; 1236#endif`,metalnessmap_fragment=`float metalnessFactor = metalness; 1237#ifdef USE_METALNESSMAP 1238 vec4 texelMetalness = texture2D( metalnessMap, vUv ); 1239 metalnessFactor *= texelMetalness.b; 1240#endif`,metalnessmap_pars_fragment=`#ifdef USE_METALNESSMAP 1241 uniform sampler2D metalnessMap; 1242#endif`,morphcolor_vertex=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1243 vColor *= morphTargetBaseInfluence; 1244 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1245 #if defined( USE_COLOR_ALPHA ) 1246 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1247 #elif defined( USE_COLOR ) 1248 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1249 #endif 1250 } 1251#endif`,morphnormal_vertex=`#ifdef USE_MORPHNORMALS 1252 objectNormal *= morphTargetBaseInfluence; 1253 #ifdef MORPHTARGETS_TEXTURE 1254 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1255 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1256 } 1257 #else 1258 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1259 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1260 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1261 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1262 #endif 1263#endif`,morphtarget_pars_vertex=`#ifdef USE_MORPHTARGETS 1264 uniform float morphTargetBaseInfluence; 1265 #ifdef MORPHTARGETS_TEXTURE 1266 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1267 uniform sampler2DArray morphTargetsTexture; 1268 uniform ivec2 morphTargetsTextureSize; 1269 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1270 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1271 int y = texelIndex / morphTargetsTextureSize.x; 1272 int x = texelIndex - y * morphTargetsTextureSize.x; 1273 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1274 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1275 } 1276 #else 1277 #ifndef USE_MORPHNORMALS 1278 uniform float morphTargetInfluences[ 8 ]; 1279 #else 1280 uniform float morphTargetInfluences[ 4 ]; 1281 #endif 1282 #endif 1283#endif`,morphtarget_vertex=`#ifdef USE_MORPHTARGETS 1284 transformed *= morphTargetBaseInfluence; 1285 #ifdef MORPHTARGETS_TEXTURE 1286 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1287 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1288 } 1289 #else 1290 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1291 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1292 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1293 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1294 #ifndef USE_MORPHNORMALS 1295 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1296 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1297 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1298 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1299 #endif 1300 #endif 1301#endif`,normal_fragment_begin=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1302#ifdef FLAT_SHADED 1303 vec3 fdx = dFdx( vViewPosition ); 1304 vec3 fdy = dFdy( vViewPosition ); 1305 vec3 normal = normalize( cross( fdx, fdy ) ); 1306#else 1307 vec3 normal = normalize( vNormal ); 1308 #ifdef DOUBLE_SIDED 1309 normal = normal * faceDirection; 1310 #endif 1311 #ifdef USE_TANGENT 1312 vec3 tangent = normalize( vTangent ); 1313 vec3 bitangent = normalize( vBitangent ); 1314 #ifdef DOUBLE_SIDED 1315 tangent = tangent * faceDirection; 1316 bitangent = bitangent * faceDirection; 1317 #endif 1318 #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) 1319 mat3 vTBN = mat3( tangent, bitangent, normal ); 1320 #endif 1321 #endif 1322#endif 1323vec3 geometryNormal = normal;`,normal_fragment_maps=`#ifdef OBJECTSPACE_NORMALMAP 1324 normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1325 #ifdef FLIP_SIDED 1326 normal = - normal; 1327 #endif 1328 #ifdef DOUBLE_SIDED 1329 normal = normal * faceDirection; 1330 #endif 1331 normal = normalize( normalMatrix * normal ); 1332#elif defined( TANGENTSPACE_NORMALMAP ) 1333 vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1334 mapN.xy *= normalScale; 1335 #ifdef USE_TANGENT 1336 normal = normalize( vTBN * mapN ); 1337 #else
1338 normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); 1339 #endif 1340#elif defined( USE_BUMPMAP ) 1341 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1342#endif`,normal_pars_fragment=`#ifndef FLAT_SHADED 1343 varying vec3 vNormal; 1344 #ifdef USE_TANGENT 1345 varying vec3 vTangent; 1346 varying vec3 vBitangent; 1347 #endif 1348#endif`,normal_pars_vertex=`#ifndef FLAT_SHADED 1349 varying vec3 vNormal; 1350 #ifdef USE_TANGENT 1351 varying vec3 vTangent; 1352 varying vec3 vBitangent; 1353 #endif 1354#endif`,normal_vertex=`#ifndef FLAT_SHADED 1355 vNormal = normalize( transformedNormal ); 1356 #ifdef USE_TANGENT 1357 vTangent = normalize( transformedTangent ); 1358 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1359 #endif 1360#endif`,normalmap_pars_fragment=`#ifdef USE_NORMALMAP 1361 uniform sampler2D normalMap; 1362 uniform vec2 normalScale; 1363#endif 1364#ifdef OBJECTSPACE_NORMALMAP 1365 uniform mat3 normalMatrix; 1366#endif 1367#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1368 vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { 1369 vec3 q0 = dFdx( eye_pos.xyz ); 1370 vec3 q1 = dFdy( eye_pos.xyz ); 1371 vec2 st0 = dFdx( vUv.st ); 1372 vec2 st1 = dFdy( vUv.st ); 1373 vec3 N = surf_norm; 1374 vec3 q1perp = cross( q1, N ); 1375 vec3 q0perp = cross( N, q0 ); 1376 vec3 T = q1perp * st0.x + q0perp * st1.x; 1377 vec3 B = q1perp * st0.y + q0perp * st1.y; 1378 float det = max( dot( T, T ), dot( B, B ) ); 1379 float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); 1380 return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); 1381 } 1382#endif`,clearcoat_normal_fragment_begin=`#ifdef USE_CLEARCOAT 1383 vec3 clearcoatNormal = geometryNormal; 1384#endif`,clearcoat_normal_fragment_maps=`#ifdef USE_CLEARCOAT_NORMALMAP 1385 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; 1386 clearcoatMapN.xy *= clearcoatNormalScale; 1387 #ifdef USE_TANGENT 1388 clearcoatNormal = normalize( vTBN * clearcoatMapN ); 1389 #else 1390 clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); 1391 #endif 1392#endif`,clearcoat_pars_fragment=`#ifdef USE_CLEARCOATMAP 1393 uniform sampler2D clearcoatMap; 1394#endif 1395#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1396 uniform sampler2D clearcoatRoughnessMap; 1397#endif 1398#ifdef USE_CLEARCOAT_NORMALMAP 1399 uniform sampler2D clearcoatNormalMap; 1400 uniform vec2 clearcoatNormalScale; 1401#endif`,iridescence_pars_fragment=`#ifdef USE_IRIDESCENCEMAP 1402 uniform sampler2D iridescenceMap; 1403#endif 1404#ifdef USE_IRIDESCENCE_THICKNESSMAP 1405 uniform sampler2D iridescenceThicknessMap; 1406#endif`,output_fragment=`#ifdef OPAQUE 1407diffuseColor.a = 1.0; 1408#endif 1409#ifdef USE_TRANSMISSION 1410diffuseColor.a *= material.transmissionAlpha + 0.1; 1411#endif 1412gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing=`vec3 packNormalToRGB( const in vec3 normal ) { 1413 return normalize( normal ) * 0.5 + 0.5; 1414} 1415vec3 unpackRGBToNormal( const in vec3 rgb ) { 1416 return 2.0 * rgb.xyz - 1.0; 1417} 1418const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1419const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1420const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1421const float ShiftRight8 = 1. / 256.; 1422vec4 packDepthToRGBA( const in float v ) { 1423 vec4 r = vec4( fract( v * PackFactors ), v ); 1424 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1425} 1426float unpackRGBAToDepth( const in vec4 v ) { 1427 return dot( v, UnpackFactors ); 1428} 1429vec2 packDepthToRG( in highp float v ) { 1430 return packDepthToRGBA( v ).yx; 1431} 1432float unpackRGToDepth( const in highp vec2 v ) { 1433 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1434} 1435vec4 pack2HalfToRGBA( vec2 v ) { 1436 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1437 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1438} 1439vec2 unpackRGBATo2Half( vec4 v ) { 1440 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1441} 1442float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1443 return ( viewZ + near ) / ( near - far ); 1444} 1445float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { 1446 return linearClipZ * ( near - far ) - near; 1447} 1448float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1449 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1450} 1451float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { 1452 return ( near * far ) / ( ( far - near ) * invClipZ - far ); 1453}`,premultiplied_alpha_fragment=`#ifdef PREMULTIPLIED_ALPHA 1454 gl_FragColor.rgb *= gl_FragColor.a; 1455#endif`,project_vertex=`vec4 mvPosition = vec4( transformed, 1.0 ); 1456#ifdef USE_INSTANCING 1457 mvPosition = instanceMatrix * mvPosition; 1458#endif 1459mvPosition = modelViewMatrix * mvPosition; 1460gl_Position = projectionMatrix * mvPosition;`,dithering_fragment=`#ifdef DITHERING 1461 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1462#endif`,dithering_pars_fragment=`#ifdef DITHERING 1463 vec3 dithering( vec3 color ) { 1464 float grid_position = rand( gl_FragCoord.xy ); 1465 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1466 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1467 return color + dither_shift_RGB; 1468 } 1469#endif`,roughnessmap_fragment=`float roughnessFactor = roughness; 1470#ifdef USE_ROUGHNESSMAP 1471 vec4 texelRoughness = texture2D( roughnessMap, vUv ); 1472 roughnessFactor *= texelRoughness.g; 1473#endif`,roughnessmap_pars_fragment=`#ifdef USE_ROUGHNESSMAP 1474 uniform sampler2D roughnessMap;
1475#endif`,shadowmap_pars_fragment=`#if NUM_SPOT_LIGHT_COORDS > 0 1476 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1477#endif 1478#if NUM_SPOT_LIGHT_MAPS > 0 1479 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1480#endif 1481#ifdef USE_SHADOWMAP 1482 #if NUM_DIR_LIGHT_SHADOWS > 0 1483 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1484 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1485 struct DirectionalLightShadow { 1486 float shadowBias; 1487 float shadowNormalBias; 1488 float shadowRadius; 1489 vec2 shadowMapSize; 1490 }; 1491 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1492 #endif 1493 #if NUM_SPOT_LIGHT_SHADOWS > 0 1494 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1495 struct SpotLightShadow { 1496 float shadowBias; 1497 float shadowNormalBias; 1498 float shadowRadius; 1499 vec2 shadowMapSize; 1500 }; 1501 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1502 #endif 1503 #if NUM_POINT_LIGHT_SHADOWS > 0 1504 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1505 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1506 struct PointLightShadow { 1507 float shadowBias; 1508 float shadowNormalBias; 1509 float shadowRadius; 1510 vec2 shadowMapSize; 1511 float shadowCameraNear; 1512 float shadowCameraFar; 1513 }; 1514 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1515 #endif 1516 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1517 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1518 } 1519 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1520 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1521 } 1522 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1523 float occlusion = 1.0; 1524 vec2 distribution = texture2DDistribution( shadow, uv ); 1525 float hard_shadow = step( compare , distribution.x ); 1526 if (hard_shadow != 1.0 ) { 1527 float distance = compare - distribution.x ; 1528 float variance = max( 0.00000, distribution.y * distribution.y ); 1529 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1530 } 1531 return occlusion; 1532 } 1533 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1534 float shadow = 1.0; 1535 shadowCoord.xyz /= shadowCoord.w; 1536 shadowCoord.z += shadowBias; 1537 bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); 1538 bool inFrustum = all( inFrustumVec ); 1539 bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); 1540 bool frustumTest = all( frustumTestVec ); 1541 if ( frustumTest ) { 1542 #if defined( SHADOWMAP_TYPE_PCF ) 1543 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1544 float dx0 = - texelSize.x * shadowRadius; 1545 float dy0 = - texelSize.y * shadowRadius; 1546 float dx1 = + texelSize.x * shadowRadius; 1547 float dy1 = + texelSize.y * shadowRadius; 1548 float dx2 = dx0 / 2.0; 1549 float dy2 = dy0 / 2.0; 1550 float dx3 = dx1 / 2.0; 1551 float dy3 = dy1 / 2.0; 1552 shadow = ( 1553 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1554 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1555 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1556 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1557 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1558 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1559 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1560 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1561 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1562 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1563 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1564 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1565 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1566 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1567 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1568 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1569 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1570 ) * ( 1.0 / 17.0 ); 1571 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1572 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1573 float dx = texelSize.x; 1574 float dy = texelSize.y; 1575 vec2 uv = shadowCoord.xy;
1576 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1577 uv -= f * texelSize; 1578 shadow = ( 1579 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1580 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1581 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1582 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1583 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1584 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1585 f.x ) + 1586 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1587 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1588 f.x ) + 1589 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1590 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1591 f.y ) + 1592 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1593 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1594 f.y ) + 1595 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1596 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1597 f.x ), 1598 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1599 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1600 f.x ), 1601 f.y ) 1602 ) * ( 1.0 / 9.0 ); 1603 #elif defined( SHADOWMAP_TYPE_VSM ) 1604 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1605 #else 1606 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1607 #endif 1608 } 1609 return shadow; 1610 } 1611 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1612 vec3 absV = abs( v ); 1613 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1614 absV *= scaleToCube; 1615 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1616 vec2 planar = v.xy; 1617 float almostATexel = 1.5 * texelSizeY; 1618 float almostOne = 1.0 - almostATexel; 1619 if ( absV.z >= almostOne ) { 1620 if ( v.z > 0.0 ) 1621 planar.x = 4.0 - v.x; 1622 } else if ( absV.x >= almostOne ) { 1623 float signX = sign( v.x ); 1624 planar.x = v.z * signX + 2.0 * signX; 1625 } else if ( absV.y >= almostOne ) { 1626 float signY = sign( v.y ); 1627 planar.x = v.x + 2.0 * signY + 2.0; 1628 planar.y = v.z * signY - 2.0; 1629 } 1630 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1631 } 1632 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1633 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1634 vec3 lightToPosition = shadowCoord.xyz; 1635 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1636 vec3 bd3D = normalize( lightToPosition ); 1637 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1638 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1639 return ( 1640 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1641 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1642 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1643 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1644 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1645 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1646 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1647 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1648 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1649 ) * ( 1.0 / 9.0 ); 1650 #else 1651 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1652 #endif 1653 } 1654#endif`,shadowmap_pars_vertex=`#if NUM_SPOT_LIGHT_COORDS > 0 1655 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1656 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1657#endif 1658#ifdef USE_SHADOWMAP 1659 #if NUM_DIR_LIGHT_SHADOWS > 0 1660 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1661 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1662 struct DirectionalLightShadow { 1663 float shadowBias; 1664 float shadowNormalBias; 1665 float shadowRadius; 1666 vec2 shadowMapSize; 1667 }; 1668 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1669 #endif
1670 #if NUM_SPOT_LIGHT_SHADOWS > 0 1671 struct SpotLightShadow { 1672 float shadowBias; 1673 float shadowNormalBias; 1674 float shadowRadius; 1675 vec2 shadowMapSize; 1676 }; 1677 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1678 #endif 1679 #if NUM_POINT_LIGHT_SHADOWS > 0 1680 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1681 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1682 struct PointLightShadow { 1683 float shadowBias; 1684 float shadowNormalBias; 1685 float shadowRadius; 1686 vec2 shadowMapSize; 1687 float shadowCameraNear; 1688 float shadowCameraFar; 1689 }; 1690 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1691 #endif 1692#endif`,shadowmap_vertex=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1693 #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 1694 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1695 vec4 shadowWorldPosition; 1696 #endif 1697 #if NUM_DIR_LIGHT_SHADOWS > 0 1698 #pragma unroll_loop_start 1699 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1700 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1701 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1702 } 1703 #pragma unroll_loop_end 1704 #endif 1705 #if NUM_SPOT_LIGHT_COORDS > 0 1706 #pragma unroll_loop_start 1707 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1708 shadowWorldPosition = worldPosition; 1709 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1710 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1711 #endif 1712 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1713 } 1714 #pragma unroll_loop_end 1715 #endif 1716 #if NUM_POINT_LIGHT_SHADOWS > 0 1717 #pragma unroll_loop_start 1718 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1719 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1720 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1721 } 1722 #pragma unroll_loop_end 1723 #endif 1724#endif`,shadowmask_pars_fragment=`float getShadowMask() { 1725 float shadow = 1.0; 1726 #ifdef USE_SHADOWMAP 1727 #if NUM_DIR_LIGHT_SHADOWS > 0 1728 DirectionalLightShadow directionalLight; 1729 #pragma unroll_loop_start 1730 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1731 directionalLight = directionalLightShadows[ i ]; 1732 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1733 } 1734 #pragma unroll_loop_end 1735 #endif 1736 #if NUM_SPOT_LIGHT_SHADOWS > 0 1737 SpotLightShadow spotLight; 1738 #pragma unroll_loop_start 1739 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1740 spotLight = spotLightShadows[ i ]; 1741 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1742 } 1743 #pragma unroll_loop_end 1744 #endif 1745 #if NUM_POINT_LIGHT_SHADOWS > 0 1746 PointLightShadow pointLight; 1747 #pragma unroll_loop_start 1748 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1749 pointLight = pointLightShadows[ i ]; 1750 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1751 } 1752 #pragma unroll_loop_end 1753 #endif 1754 #endif 1755 return shadow; 1756}`,skinbase_vertex=`#ifdef USE_SKINNING 1757 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1758 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1759 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1760 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1761#endif`,skinning_pars_vertex=`#ifdef USE_SKINNING 1762 uniform mat4 bindMatrix; 1763 uniform mat4 bindMatrixInverse; 1764 uniform highp sampler2D boneTexture; 1765 uniform int boneTextureSize; 1766 mat4 getBoneMatrix( const in float i ) { 1767 float j = i * 4.0; 1768 float x = mod( j, float( boneTextureSize ) ); 1769 float y = floor( j / float( boneTextureSize ) ); 1770 float dx = 1.0 / float( boneTextureSize ); 1771 float dy = 1.0 / float( boneTextureSize ); 1772 y = dy * ( y + 0.5 ); 1773 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1774 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1775 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1776 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1777 mat4 bone = mat4( v1, v2, v3, v4 ); 1778 return bone; 1779 } 1780#endif`,skinning_vertex=`#ifdef USE_SKINNING 1781 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1782 vec4 skinned = vec4( 0.0 ); 1783 skinned += boneMatX * skinVertex * skinWeight.x; 1784 skinned += boneMatY * skinVertex * skinWeight.y; 1785 skinned += boneMatZ * skinVertex * skinWeight.z; 1786 skinned += boneMatW * skinVertex * skinWeight.w; 1787 transformed = ( bindMatrixInverse * skinned ).xyz; 1788#endif`,skinnormal_vertex=`#ifdef USE_SKINNING 1789 mat4 skinMatrix = mat4( 0.0 ); 1790 skinMatrix += skinWeight.x * boneMatX; 1791 skinMatrix += skinWeight.y * boneMatY; 1792 skinMatrix += skinWeight.z * boneMatZ; 1793 skinMatrix += skinWeight.w * boneMatW; 1794 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1795 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1796 #ifdef USE_TANGENT 1797 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1798 #endif 1799#endif`,specularmap_fragment=`float specularStrength; 1800#ifdef USE_SPECULARMAP 1801 vec4 texelSpecular = texture2D( specularMap, vUv ); 1802 specularStrength = texelSpecular.r; 1803#else 1804 specularStrength = 1.0; 1805#endif`,specularmap_pars_fragment=`#ifdef USE_SPECULARMAP 1806 uniform sampler2D specularMap; 1807#endif`,tonemapping_fragment=`#if defined( TONE_MAPPING ) 1808 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1809#endif`,tonemapping_pars_fragment=`#ifndef saturate 1810#define saturate( a ) clamp( a, 0.0, 1.0 ) 1811#endif 1812uniform float toneMappingExposure; 1813vec3 LinearToneMapping( vec3 color ) { 1814 return toneMappingExposure * color; 1815} 1816vec3 ReinhardToneMapping( vec3 color ) { 1817 color *= toneMappingExposure; 1818 return saturate( color / ( vec3( 1.0 ) + color ) ); 1819} 1820vec3 OptimizedCineonToneMapping( vec3 color ) { 1821 color *= toneMappingExposure; 1822 color = max( vec3( 0.0 ), color - 0.004 ); 1823 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1824} 1825vec3 RRTAndODTFit( vec3 v ) { 1826 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1827 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1828 return a / b; 1829} 1830vec3 ACESFilmicToneMapping( vec3 color ) { 1831 const mat3 ACESInputMat = mat3( 1832 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1833 vec3( 0.04823, 0.01566, 0.83777 ) 1834 ); 1835 const mat3 ACESOutputMat = mat3( 1836 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1837 vec3( -0.07367, -0.00605, 1.07602 ) 1838 ); 1839 color *= toneMappingExposure / 0.6; 1840 color = ACESInputMat * color; 1841 color = RRTAndODTFit( color ); 1842 color = ACESOutputMat * color; 1843 return saturate( color ); 1844} 1845vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment=`#ifdef USE_TRANSMISSION 1846 material.transmission = transmission; 1847 material.transmissionAlpha = 1.0; 1848 material.thickness = thickness; 1849 material.attenuationDistance = attenuationDistance; 1850 material.attenuationColor = attenuationColor; 1851 #ifdef USE_TRANSMISSIONMAP 1852 material.transmission *= texture2D( transmissionMap, vUv ).r; 1853 #endif 1854 #ifdef USE_THICKNESSMAP 1855 material.thickness *= texture2D( thicknessMap, vUv ).g;
1856 #endif 1857 vec3 pos = vWorldPosition; 1858 vec3 v = normalize( cameraPosition - pos ); 1859 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1860 vec4 transmission = getIBLVolumeRefraction( 1861 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1862 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1863 material.attenuationColor, material.attenuationDistance ); 1864 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1865 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1866#endif`,transmission_pars_fragment=`#ifdef USE_TRANSMISSION 1867 uniform float transmission; 1868 uniform float thickness; 1869 uniform float attenuationDistance; 1870 uniform vec3 attenuationColor; 1871 #ifdef USE_TRANSMISSIONMAP 1872 uniform sampler2D transmissionMap; 1873 #endif 1874 #ifdef USE_THICKNESSMAP 1875 uniform sampler2D thicknessMap; 1876 #endif 1877 uniform vec2 transmissionSamplerSize; 1878 uniform sampler2D transmissionSamplerMap; 1879 uniform mat4 modelMatrix; 1880 uniform mat4 projectionMatrix; 1881 varying vec3 vWorldPosition; 1882 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1883 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1884 vec3 modelScale; 1885 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1886 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1887 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1888 return normalize( refractionVector ) * thickness * modelScale; 1889 } 1890 float applyIorToRoughness( const in float roughness, const in float ior ) { 1891 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1892 } 1893 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1894 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1895 #ifdef texture2DLodEXT 1896 return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1897 #else 1898 return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1899 #endif 1900 } 1901 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1902 if ( isinf( attenuationDistance ) ) { 1903 return radiance; 1904 } else { 1905 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1906 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1907 } 1908 } 1909 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1910 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1911 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1912 const in vec3 attenuationColor, const in float attenuationDistance ) { 1913 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1914 vec3 refractedRayExit = position + transmissionRay; 1915 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1916 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1917 refractionCoords += 1.0; 1918 refractionCoords /= 2.0; 1919 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1920 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1921 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1922 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1923 } 1924#endif`,uv_pars_fragment=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) 1925 varying vec2 vUv; 1926#endif`,uv_pars_vertex=`#ifdef USE_UV 1927 #ifdef UVS_VERTEX_ONLY 1928 vec2 vUv; 1929 #else 1930 varying vec2 vUv; 1931 #endif 1932 uniform mat3 uvTransform; 1933#endif`,uv_vertex=`#ifdef USE_UV 1934 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1935#endif`,uv2_pars_fragment=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1936 varying vec2 vUv2; 1937#endif`,uv2_pars_vertex=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1938 attribute vec2 uv2; 1939 varying vec2 vUv2; 1940 uniform mat3 uv2Transform; 1941#endif`,uv2_vertex=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1942 vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; 1943#endif`,worldpos_vertex=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1943IGHT_COORDS > 0 1944 vec4 worldPosition = vec4( transformed, 1.0 ); 1945 #ifdef USE_INSTANCING 1946 worldPosition = instanceMatrix * worldPosition; 1947 #endif 1948 worldPosition = modelMatrix * worldPosition; 1949#endif`;const vertex$h=`varying vec2 vUv; 1950uniform mat3 uvTransform; 1951void main() { 1952 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1953 gl_Position = vec4( position.xy, 1.0, 1.0 ); 1954}`,fragment$h=`uniform sampler2D t2D; 1955uniform float backgroundIntensity; 1956varying vec2 vUv; 1957void main() { 1958 vec4 texColor = texture2D( t2D, vUv ); 1959 #ifdef DECODE_VIDEO_TEXTURE 1960 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 ); 1961 #endif 1962 texColor.rgb *= backgroundIntensity; 1963 gl_FragColor = texColor; 1964 #include <tonemapping_fragment> 1965 #include <encodings_fragment> 1966}`,vertex$g=`varying vec3 vWorldDirection; 1967#include <common> 1968void main() { 1969 vWorldDirection = transformDirection( position, modelMatrix ); 1970 #include <begin_vertex> 1971 #include <project_vertex> 1972 gl_Position.z = gl_Position.w; 1973}`,fragment$g=`#ifdef ENVMAP_TYPE_CUBE 1974 uniform samplerCube envMap; 1975#elif defined( ENVMAP_TYPE_CUBE_UV ) 1976 uniform sampler2D envMap; 1977#endif 1978uniform float flipEnvMap; 1979uniform float backgroundBlurriness; 1980uniform float backgroundIntensity; 1981varying vec3 vWorldDirection; 1982#include <cube_uv_reflection_fragment> 1983void main() { 1984 #ifdef ENVMAP_TYPE_CUBE 1985 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 1986 #elif defined( ENVMAP_TYPE_CUBE_UV ) 1987 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 1988 #else 1989 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 1990 #endif 1991 texColor.rgb *= backgroundIntensity; 1992 gl_FragColor = texColor; 1993 #include <tonemapping_fragment> 1994 #include <encodings_fragment> 1995}`,vertex$f=`varying vec3 vWorldDirection; 1996#include <common> 1997void main() { 1998 vWorldDirection = transformDirection( position, modelMatrix ); 1999 #include <begin_vertex> 2000 #include <project_vertex> 2001 gl_Position.z = gl_Position.w; 2002}`,fragment$f=`uniform samplerCube tCube; 2003uniform float tFlip; 2004uniform float opacity; 2005varying vec3 vWorldDirection; 2006void main() { 2007 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2008 gl_FragColor = texColor; 2009 gl_FragColor.a *= opacity; 2010 #include <tonemapping_fragment> 2011 #include <encodings_fragment> 2012}`,vertex$e=`#include <common> 2013#include <uv_pars_vertex> 2014#include <displacementmap_pars_vertex> 2015#include <morphtarget_pars_vertex> 2016#include <skinning_pars_vertex> 2017#include <logdepthbuf_pars_vertex> 2018#include <clipping_planes_pars_vertex> 2019varying vec2 vHighPrecisionZW; 2020void main() { 2021 #include <uv_vertex> 2022 #include <skinbase_vertex> 2023 #ifdef USE_DISPLACEMENTMAP 2024 #include <beginnormal_vertex> 2025 #include <morphnormal_vertex> 2026 #include <skinnormal_vertex> 2027 #endif 2028 #include <begin_vertex> 2029 #include <morphtarget_vertex> 2030 #include <skinning_vertex> 2031 #include <displacementmap_vertex> 2032 #include <project_vertex> 2033 #include <logdepthbuf_vertex> 2034 #include <clipping_planes_vertex> 2035 vHighPrecisionZW = gl_Position.zw; 2036}`,fragment$e=`#if DEPTH_PACKING == 3200 2037 uniform float opacity; 2038#endif 2039#include <common> 2040#include <packing> 2041#include <uv_pars_fragment> 2042#include <map_pars_fragment> 2043#include <alphamap_pars_fragment> 2044#include <alphatest_pars_fragment> 2045#include <logdepthbuf_pars_fragment> 2046#include <clipping_planes_pars_fragment> 2047varying vec2 vHighPrecisionZW; 2048void main() { 2049 #include <clipping_planes_fragment> 2050 vec4 diffuseColor = vec4( 1.0 ); 2051 #if DEPTH_PACKING == 3200 2052 diffuseColor.a = opacity; 2053 #endif 2054 #include <map_fragment> 2055 #include <alphamap_fragment> 2056 #include <alphatest_fragment> 2057 #include <logdepthbuf_fragment> 2058 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2059 #if DEPTH_PACKING == 3200 2060 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2061 #elif DEPTH_PACKING == 3201 2062 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2063 #endif 2064}`,vertex$d=`#define DISTANCE 2065varying vec3 vWorldPosition; 2066#include <common> 2067#include <uv_pars_vertex> 2068#include <displacementmap_pars_vertex> 2069#include <morphtarget_pars_vertex> 2070#include <skinning_pars_vertex> 2071#include <clipping_planes_pars_vertex> 2072void main() { 2073 #include <uv_vertex> 2074 #include <skinbase_vertex> 2075 #ifdef USE_DISPLACEMENTMAP 2076 #include <beginnormal_vertex> 2077 #include <morphnormal_vertex> 2078 #include <skinnormal_vertex> 2079 #endif 2080 #include <begin_vertex> 2081 #include <morphtarget_vertex> 2082 #include <skinning_vertex> 2083 #include <displacementmap_vertex> 2084 #include <project_vertex> 2085 #include <worldpos_vertex> 2086 #include <clipping_planes_vertex> 2087 vWorldPosition = worldPosition.xyz; 2088}`,fragment$d=`#define DISTANCE 2089uniform vec3 referencePosition; 2090uniform float nearDistance; 2091uniform float farDistance; 2092varying vec3 vWorldPosition; 2093#include <common> 2094#include <packing> 2095#include <uv_pars_fragment> 2096#include <map_pars_fragment> 2097#include <alphamap_pars_fragment> 2098#include <alphatest_pars_fragment> 2099#include <clipping_planes_pars_fragment> 2100void main () { 2101 #include <clipping_planes_fragment> 2102 vec4 diffuseColor = vec4( 1.0 ); 2103 #include <map_fragment> 2104 #include <alphamap_fragment> 2105 #include <alphatest_fragment> 2106 float dist = length( vWorldPosition - referencePosition ); 2107 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2108 dist = saturate( dist ); 2109 gl_FragColor = packDepthToRGBA( dist ); 2110}`,vertex$c=`varying vec3 vWorldDirection; 2111#include <common> 2112void main() { 2113 vWorldDirection = transformDirection( position, modelMatrix ); 2114 #include <begin_vertex> 2115 #include <project_vertex> 2116}`,fragment$c=`uniform sampler2D tEquirect; 2117varying vec3 vWorldDirection; 2118#include <common> 2119void main() { 2120 vec3 direction = normalize( vWorldDirection ); 2121 vec2 sampleUV = equirectUv( direction ); 2122 gl_FragColor = texture2D( tEquirect, sampleUV ); 2123 #include <tonemapping_fragment> 2124 #include <encodings_fragment> 2125}`,vertex$b=`uniform float scale; 2126attribute float lineDistance; 2127varying float vLineDistance; 2128#include <common> 2129#include <color_pars_vertex> 2130#include <fog_pars_vertex> 2131#include <morphtarget_pars_vertex> 2132#include <logdepthbuf_pars_vertex> 2133#include <clipping_planes_pars_vertex> 2134void main() { 2135 vLineDistance = scale * lineDistance; 2136 #include <color_vertex> 2137 #include <morphcolor_vertex> 2138 #include <begin_vertex> 2139 #include <morphtarget_vertex> 2140 #include <project_vertex> 2141 #include <logdepthbuf_vertex> 2142 #include <clipping_planes_vertex> 2143 #include <fog_vertex> 2144}`,fragment$b=`uniform vec3 diffuse; 2145uniform float opacity; 2146uniform float dashSize; 2147uniform float totalSize; 2148varying float vLineDistance; 2149#include <common> 2150#include <color_pars_fragment> 2151#include <fog_pars_fragment> 2152#include <logdepthbuf_pars_fragment> 2153#include <clipping_planes_pars_fragment> 2154void main() { 2155 #include <clipping_planes_fragment> 2156 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2157 discard; 2158 } 2159 vec3 outgoingLight = vec3( 0.0 ); 2160 vec4 diffuseColor = vec4( diffuse, opacity ); 2161 #include <logdepthbuf_fragment> 2162 #include <color_fragment> 2163 outgoingLight = diffuseColor.rgb; 2164 #include <output_fragment> 2165 #include <tonemapping_fragment> 2166 #include <encodings_fragment> 2167 #include <fog_fragment> 2168 #include <premultiplied_alpha_fragment> 2169}`,vertex$a=`#include <common> 2170#include <uv_pars_vertex> 2171#include <uv2_pars_vertex> 2172#include <envmap_pars_vertex> 2173#include <color_pars_vertex> 2174#include <fog_pars_vertex> 2175#include <morphtarget_pars_vertex> 2176#include <skinning_pars_vertex> 2177#include <logdepthbuf_pars_vertex> 2178#include <clipping_planes_pars_vertex> 2179void main() { 2180 #include <uv_vertex> 2181 #include <uv2_vertex> 2182 #include <color_vertex> 2183 #include <morphcolor_vertex> 2184 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2185 #include <beginnormal_vertex> 2186 #include <morphnormal_vertex> 2187 #include <skinbase_vertex> 2188 #include <skinnormal_vertex> 2189 #include <defaultnormal_vertex> 2190 #endif 2191 #include <begin_vertex> 2192 #include <morphtarget_vertex> 2193 #include <skinning_vertex> 2194 #include <project_vertex> 2195 #include <logdepthbuf_vertex> 2196 #include <clipping_planes_vertex> 2197 #include <worldpos_vertex> 2198 #include <envmap_vertex> 2199 #include <fog_vertex> 2200}`,fragment$a=`uniform vec3 diffuse; 2201uniform float opacity; 2202#ifndef FLAT_SHADED 2203 varying vec3 vNormal; 2204#endif 2205#include <common> 2206#include <dithering_pars_fragment> 2207#include <color_pars_fragment> 2208#include <uv_pars_fragment> 2209#include <uv2_pars_fragment> 2210#include <map_pars_fragment> 2211#include <alphamap_pars_fragment> 2212#include <alphatest_pars_fragment> 2213#include <aomap_pars_fragment> 2214#include <lightmap_pars_fragment> 2215#include <envmap_common_pars_fragment> 2216#include <envmap_pars_fragment> 2217#include <fog_pars_fragment> 2218#include <specularmap_pars_fragment> 2219#include <logdepthbuf_pars_fragment> 2220#include <clipping_planes_pars_fragment> 2221void main() { 2222 #include <clipping_planes_fragment> 2223 vec4 diffuseColor = vec4( diffuse, opacity ); 2224 #include <logdepthbuf_fragment> 2225 #include <map_fragment> 2226 #include <color_fragment> 2227 #include <alphamap_fragment> 2228 #include <alphatest_fragment> 2229 #include <specularmap_fragment> 2230 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2231 #ifdef USE_LIGHTMAP 2232 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 2233 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2234 #else 2235 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2236 #endif 2237 #include <aomap_fragment> 2238 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2239 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2240 #include <envmap_fragment> 2241 #include <output_fragment> 2242 #include <tonemapping_fragment> 2243 #include <encodings_fragment> 2244 #include <fog_fragment> 2245 #include <premultiplied_alpha_fragment> 2246 #include <dithering_fragment> 2247}`,vertex$9=`#define LAMBERT 2248varying vec3 vViewPosition; 2249#include <common> 2250#include <uv_pars_vertex> 2251#include <uv2_pars_vertex> 2252#include <displacementmap_pars_vertex> 2253#include <envmap_pars_vertex> 2254#include <color_pars_vertex> 2255#include <fog_pars_vertex> 2256#include <normal_pars_vertex> 2257#include <morphtarget_pars_vertex> 2258#include <skinning_pars_vertex> 2259#include <shadowmap_pars_vertex> 2260#include <logdepthbuf_pars_vertex> 2261#include <clipping_planes_pars_vertex> 2262void main() { 2263 #include <uv_vertex> 2264 #include <uv2_vertex> 2265 #include <color_vertex> 2266 #include <morphcolor_vertex> 2267 #include <beginnormal_vertex> 2268 #include <morphnormal_vertex> 2269 #include <skinbase_vertex> 2270 #include <skinnormal_vertex> 2271 #include <defaultnormal_vertex> 2272 #include <normal_vertex> 2273 #include <begin_vertex> 2274 #include <morphtarget_vertex> 2275 #include <skinning_vertex> 2276 #include <displacementmap_vertex> 2277 #include <project_vertex> 2278 #include <logdepthbuf_vertex> 2279 #include <clipping_planes_vertex> 2280 vViewPosition = - mvPosition.xyz; 2281 #include <worldpos_vertex> 2282 #include <envmap_vertex> 2283 #include <shadowmap_vertex> 2284 #include <fog_vertex> 2285}`,fragment$9=`#define LAMBERT 2286uniform vec3 diffuse; 2287uniform vec3 emissive; 2288uniform float opacity; 2289#include <common> 2290#include <packing> 2291#include <dithering_pars_fragment> 2292#include <color_pars_fragment> 2293#include <uv_pars_fragment> 2294#include <uv2_pars_fragment> 2295#include <map_pars_fragment> 2296#include <alphamap_pars_fragment> 2297#include <alphatest_pars_fragment> 2298#include <aomap_pars_fragment> 2299#include <lightmap_pars_fragment> 2300#include <emissivemap_pars_fragment> 2301#include <envmap_common_pars_fragment> 2302#include <envmap_pars_fragment> 2303#include <fog_pars_fragment> 2304#include <bsdfs> 2305#include <lights_pars_begin> 2306#include <normal_pars_fragment> 2307#include <lights_lambert_pars_fragment> 2308#include <shadowmap_pars_fragment> 2309#include <bumpmap_pars_fragment> 2310#include <normalmap_pars_fragment> 2311#include <specularmap_pars_fragment> 2312#include <logdepthbuf_pars_fragment> 2313#include <clipping_planes_pars_fragment> 2314void main() { 2315 #include <clipping_planes_fragment> 2316 vec4 diffuseColor = vec4( diffuse, opacity ); 2317 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2318 vec3 totalEmissiveRadiance = emissive; 2319 #include <logdepthbuf_fragment> 2320 #include <map_fragment> 2321 #include <color_fragment> 2322 #include <alphamap_fragment> 2323 #include <alphatest_fragment> 2324 #include <specularmap_fragment> 2325 #include <normal_fragment_begin> 2326 #include <normal_fragment_maps> 2327 #include <emissivemap_fragment> 2328 #include <lights_lambert_fragment> 2329 #include <lights_fragment_begin> 2330 #include <lights_fragment_maps> 2331 #include <lights_fragment_end> 2332 #include <aomap_fragment> 2333 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2334 #include <envmap_fragment> 2335 #include <output_fragment> 2336 #include <tonemapping_fragment> 2337 #include <encodings_fragment> 2338 #include <fog_fragment> 2339 #include <premultiplied_alpha_fragment> 2340 #include <dithering_fragment> 2341}`,vertex$8=`#define MATCAP 2342varying vec3 vViewPosition; 2343#include <common> 2344#include <uv_pars_vertex> 2345#include <color_pars_vertex> 2346#include <displacementmap_pars_vertex> 2347#include <fog_pars_vertex> 2348#include <normal_pars_vertex> 2349#include <morphtarget_pars_vertex> 2350#include <skinning_pars_vertex> 2351#include <logdepthbuf_pars_vertex> 2352#include <clipping_planes_pars_vertex> 2353void main() { 2354 #include <uv_vertex> 2355 #include <color_vertex> 2356 #include <morphcolor_vertex> 2357 #include <beginnormal_vertex> 2358 #include <morphnormal_vertex> 2359 #include <skinbase_vertex> 2360 #include <skinnormal_vertex> 2361 #include <defaultnormal_vertex> 2362 #include <normal_vertex> 2363 #include <begin_vertex> 2364 #include <morphtarget_vertex> 2365 #include <skinning_vertex> 2366 #include <displacementmap_vertex> 2367 #include <project_vertex> 2368 #include <logdepthbuf_vertex> 2369 #include <clipping_planes_vertex> 2370 #include <fog_vertex> 2371 vViewPosition = - mvPosition.xyz; 2372}`,fragment$8=`#define MATCAP 2373uniform vec3 diffuse; 2374uniform float opacity; 2375uniform sampler2D matcap; 2376varying vec3 vViewPosition; 2377#include <common> 2378#include <dithering_pars_fragment> 2379#include <color_pars_fragment> 2380#include <uv_pars_fragment> 2381#include <map_pars_fragment> 2382#include <alphamap_pars_fragment> 2383#include <alphatest_pars_fragment> 2384#include <fog_pars_fragment> 2385#include <normal_pars_fragment> 2386#include <bumpmap_pars_fragment> 2387#include <normalmap_pars_fragment> 2388#include <logdepthbuf_pars_fragment> 2389#include <clipping_planes_pars_fragment> 2390void main() { 2391 #include <clipping_planes_fragment> 2392 vec4 diffuseColor = vec4( diffuse, opacity ); 2393 #include <logdepthbuf_fragment> 2394 #include <map_fragment> 2395 #include <color_fragment> 2396 #include <alphamap_fragment> 2397 #include <alphatest_fragment> 2398 #include <normal_fragment_begin> 2399 #include <normal_fragment_maps> 2400 vec3 viewDir = normalize( vViewPosition ); 2401 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2402 vec3 y = cross( viewDir, x ); 2403 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2404 #ifdef USE_MATCAP
2405 vec4 matcapColor = texture2D( matcap, uv ); 2406 #else 2407 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2408 #endif 2409 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2410 #include <output_fragment> 2411 #include <tonemapping_fragment> 2412 #include <encodings_fragment> 2413 #include <fog_fragment> 2414 #include <premultiplied_alpha_fragment> 2415 #include <dithering_fragment> 2416}`,vertex$7=`#define NORMAL 2417#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2418 varying vec3 vViewPosition; 2419#endif 2420#include <common> 2421#include <uv_pars_vertex> 2422#include <displacementmap_pars_vertex> 2423#include <normal_pars_vertex> 2424#include <morphtarget_pars_vertex> 2425#include <skinning_pars_vertex> 2426#include <logdepthbuf_pars_vertex> 2427#include <clipping_planes_pars_vertex> 2428void main() { 2429 #include <uv_vertex> 2430 #include <beginnormal_vertex> 2431 #include <morphnormal_vertex> 2432 #include <skinbase_vertex> 2433 #include <skinnormal_vertex> 2434 #include <defaultnormal_vertex> 2435 #include <normal_vertex> 2436 #include <begin_vertex> 2437 #include <morphtarget_vertex> 2438 #include <skinning_vertex> 2439 #include <displacementmap_vertex> 2440 #include <project_vertex> 2441 #include <logdepthbuf_vertex> 2442 #include <clipping_planes_vertex> 2443#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2444 vViewPosition = - mvPosition.xyz; 2445#endif 2446}`,fragment$7=`#define NORMAL 2447uniform float opacity; 2448#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2449 varying vec3 vViewPosition; 2450#endif 2451#include <packing> 2452#include <uv_pars_fragment> 2453#include <normal_pars_fragment> 2454#include <bumpmap_pars_fragment> 2455#include <normalmap_pars_fragment> 2456#include <logdepthbuf_pars_fragment> 2457#include <clipping_planes_pars_fragment> 2458void main() { 2459 #include <clipping_planes_fragment> 2460 #include <logdepthbuf_fragment> 2461 #include <normal_fragment_begin> 2462 #include <normal_fragment_maps> 2463 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2464 #ifdef OPAQUE 2465 gl_FragColor.a = 1.0; 2466 #endif 2467}`,vertex$6=`#define PHONG 2468varying vec3 vViewPosition; 2469#include <common> 2470#include <uv_pars_vertex> 2471#include <uv2_pars_vertex> 2472#include <displacementmap_pars_vertex> 2473#include <envmap_pars_vertex> 2474#include <color_pars_vertex> 2475#include <fog_pars_vertex> 2476#include <normal_pars_vertex> 2477#include <morphtarget_pars_vertex> 2478#include <skinning_pars_vertex> 2479#include <shadowmap_pars_vertex> 2480#include <logdepthbuf_pars_vertex> 2481#include <clipping_planes_pars_vertex> 2482void main() { 2483 #include <uv_vertex> 2484 #include <uv2_vertex> 2485 #include <color_vertex> 2486 #include <morphcolor_vertex> 2487 #include <beginnormal_vertex> 2488 #include <morphnormal_vertex> 2489 #include <skinbase_vertex> 2490 #include <skinnormal_vertex> 2491 #include <defaultnormal_vertex> 2492 #include <normal_vertex> 2493 #include <begin_vertex> 2494 #include <morphtarget_vertex> 2495 #include <skinning_vertex> 2496 #include <displacementmap_vertex> 2497 #include <project_vertex> 2498 #include <logdepthbuf_vertex> 2499 #include <clipping_planes_vertex> 2500 vViewPosition = - mvPosition.xyz; 2501 #include <worldpos_vertex> 2502 #include <envmap_vertex> 2503 #include <shadowmap_vertex> 2504 #include <fog_vertex> 2505}`,fragment$6=`#define PHONG 2506uniform vec3 diffuse; 2507uniform vec3 emissive; 2508uniform vec3 specular; 2509uniform float shininess; 2510uniform float opacity; 2511#include <common> 2512#include <packing> 2513#include <dithering_pars_fragment> 2514#include <color_pars_fragment> 2515#include <uv_pars_fragment> 2516#include <uv2_pars_fragment> 2517#include <map_pars_fragment> 2518#include <alphamap_pars_fragment> 2519#include <alphatest_pars_fragment> 2520#include <aomap_pars_fragment> 2521#include <lightmap_pars_fragment> 2522#include <emissivemap_pars_fragment> 2523#include <envmap_common_pars_fragment> 2524#include <envmap_pars_fragment> 2525#include <fog_pars_fragment> 2526#include <bsdfs> 2527#include <lights_pars_begin> 2528#include <normal_pars_fragment> 2529#include <lights_phong_pars_fragment> 2530#include <shadowmap_pars_fragment> 2531#include <bumpmap_pars_fragment> 2532#include <normalmap_pars_fragment> 2533#include <specularmap_pars_fragment> 2534#include <logdepthbuf_pars_fragment> 2535#include <clipping_planes_pars_fragment> 2536void main() { 2537 #include <clipping_planes_fragment> 2538 vec4 diffuseColor = vec4( diffuse, opacity ); 2539 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2540 vec3 totalEmissiveRadiance = emissive; 2541 #include <logdepthbuf_fragment> 2542 #include <map_fragment> 2543 #include <color_fragment> 2544 #include <alphamap_fragment> 2545 #include <alphatest_fragment> 2546 #include <specularmap_fragment> 2547 #include <normal_fragment_begin> 2548 #include <normal_fragment_maps> 2549 #include <emissivemap_fragment> 2550 #include <lights_phong_fragment> 2551 #include <lights_fragment_begin> 2552 #include <lights_fragment_maps> 2553 #include <lights_fragment_end> 2554 #include <aomap_fragment> 2555 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2556 #include <envmap_fragment> 2557 #include <output_fragment> 2558 #include <tonemapping_fragment> 2559 #include <encodings_fragment> 2560 #include <fog_fragment> 2561 #include <premultiplied_alpha_fragment> 2562 #include <dithering_fragment> 2563}`,vertex$5=`#define STANDARD 2564varying vec3 vViewPosition; 2565#ifdef USE_TRANSMISSION 2566 varying vec3 vWorldPosition; 2567#endif 2568#include <common> 2569#include <uv_pars_vertex> 2570#include <uv2_pars_vertex> 2571#include <displacementmap_pars_vertex> 2572#include <color_pars_vertex> 2573#include <fog_pars_vertex> 2574#include <normal_pars_vertex> 2575#include <morphtarget_pars_vertex> 2576#include <skinning_pars_vertex> 2577#include <shadowmap_pars_vertex> 2578#include <logdepthbuf_pars_vertex> 2579#include <clipping_planes_pars_vertex> 2580void main() { 2581 #include <uv_vertex> 2582 #include <uv2_vertex> 2583 #include <color_vertex> 2584 #include <morphcolor_vertex> 2585 #include <beginnormal_vertex> 2586 #include <morphnormal_vertex> 2587 #include <skinbase_vertex> 2588 #include <skinnormal_vertex> 2589 #include <defaultnormal_vertex> 2590 #include <normal_vertex> 2591 #include <begin_vertex> 2592 #include <morphtarget_vertex> 2593 #include <skinning_vertex> 2594 #include <displacementmap_vertex> 2595 #include <project_vertex> 2596 #include <logdepthbuf_vertex> 2597 #include <clipping_planes_vertex> 2598 vViewPosition = - mvPosition.xyz; 2599 #include <worldpos_vertex> 2600 #include <shadowmap_vertex> 2601 #include <fog_vertex> 2602#ifdef USE_TRANSMISSION 2603 vWorldPosition = worldPosition.xyz; 2604#endif 2605}`,fragment$5=`#define STANDARD 2606#ifdef PHYSICAL 2607 #define IOR 2608 #define SPECULAR 2609#endif 2610uniform vec3 diffuse; 2611uniform vec3 emissive; 2612uniform float roughness; 2613uniform float metalness; 2614uniform float opacity; 2615#ifdef IOR 2616 uniform float ior; 2617#endif 2618#ifdef SPECULAR 2619 uniform float specularIntensity; 2620 uniform vec3 specularColor; 2621 #ifdef USE_SPECULARINTENSITYMAP 2622 uniform sampler2D specularIntensityMap; 2623 #endif 2624 #ifdef USE_SPECULARCOLORMAP 2625 uniform sampler2D specularColorMap; 2626 #endif 2627#endif 2628#ifdef USE_CLEARCOAT 2629 uniform float clearcoat; 2630 uniform float clearcoatRoughness; 2631#endif
2632#ifdef USE_IRIDESCENCE 2633 uniform float iridescence; 2634 uniform float iridescenceIOR; 2635 uniform float iridescenceThicknessMinimum; 2636 uniform float iridescenceThicknessMaximum; 2637#endif 2638#ifdef USE_SHEEN 2639 uniform vec3 sheenColor; 2640 uniform float sheenRoughness; 2641 #ifdef USE_SHEENCOLORMAP 2642 uniform sampler2D sheenColorMap; 2643 #endif 2644 #ifdef USE_SHEENROUGHNESSMAP 2645 uniform sampler2D sheenRoughnessMap; 2646 #endif 2647#endif 2648varying vec3 vViewPosition; 2649#include <common> 2650#include <packing> 2651#include <dithering_pars_fragment> 2652#include <color_pars_fragment> 2653#include <uv_pars_fragment> 2654#include <uv2_pars_fragment> 2655#include <map_pars_fragment> 2656#include <alphamap_pars_fragment> 2657#include <alphatest_pars_fragment> 2658#include <aomap_pars_fragment> 2659#include <lightmap_pars_fragment> 2660#include <emissivemap_pars_fragment> 2661#include <bsdfs> 2662#include <iridescence_fragment> 2663#include <cube_uv_reflection_fragment> 2664#include <envmap_common_pars_fragment> 2665#include <envmap_physical_pars_fragment> 2666#include <fog_pars_fragment> 2667#include <lights_pars_begin> 2668#include <normal_pars_fragment> 2669#include <lights_physical_pars_fragment> 2670#include <transmission_pars_fragment> 2671#include <shadowmap_pars_fragment> 2672#include <bumpmap_pars_fragment> 2673#include <normalmap_pars_fragment> 2674#include <clearcoat_pars_fragment> 2675#include <iridescence_pars_fragment> 2676#include <roughnessmap_pars_fragment> 2677#include <metalnessmap_pars_fragment> 2678#include <logdepthbuf_pars_fragment> 2679#include <clipping_planes_pars_fragment> 2680void main() { 2681 #include <clipping_planes_fragment> 2682 vec4 diffuseColor = vec4( diffuse, opacity ); 2683 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2684 vec3 totalEmissiveRadiance = emissive; 2685 #include <logdepthbuf_fragment> 2686 #include <map_fragment> 2687 #include <color_fragment> 2688 #include <alphamap_fragment> 2689 #include <alphatest_fragment> 2690 #include <roughnessmap_fragment> 2691 #include <metalnessmap_fragment> 2692 #include <normal_fragment_begin> 2693 #include <normal_fragment_maps> 2694 #include <clearcoat_normal_fragment_begin> 2695 #include <clearcoat_normal_fragment_maps> 2696 #include <emissivemap_fragment> 2697 #include <lights_physical_fragment> 2698 #include <lights_fragment_begin> 2699 #include <lights_fragment_maps> 2700 #include <lights_fragment_end> 2701 #include <aomap_fragment> 2702 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2703 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2704 #include <transmission_fragment> 2705 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2706 #ifdef USE_SHEEN 2707 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2708 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2709 #endif 2710 #ifdef USE_CLEARCOAT 2711 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2712 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2713 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2714 #endif 2715 #include <output_fragment> 2716 #include <tonemapping_fragment> 2717 #include <encodings_fragment> 2718 #include <fog_fragment> 2719 #include <premultiplied_alpha_fragment> 2720 #include <dithering_fragment> 2721}`,vertex$4=`#define TOON 2722varying vec3 vViewPosition; 2723#include <common> 2724#include <uv_pars_vertex> 2725#include <uv2_pars_vertex> 2726#include <displacementmap_pars_vertex> 2727#include <color_pars_vertex> 2728#include <fog_pars_vertex> 2729#include <normal_pars_vertex> 2730#include <morphtarget_pars_vertex> 2731#include <skinning_pars_vertex> 2732#include <shadowmap_pars_vertex> 2733#include <logdepthbuf_pars_vertex> 2734#include <clipping_planes_pars_vertex> 2735void main() { 2736 #include <uv_vertex> 2737 #include <uv2_vertex> 2738 #include <color_vertex> 2739 #include <morphcolor_vertex> 2740 #include <beginnormal_vertex> 2741 #include <morphnormal_vertex> 2742 #include <skinbase_vertex> 2743 #include <skinnormal_vertex> 2744 #include <defaultnormal_vertex> 2745 #include <normal_vertex> 2746 #include <begin_vertex> 2747 #include <morphtarget_vertex> 2748 #include <skinning_vertex> 2749 #include <displacementmap_vertex> 2750 #include <project_vertex> 2751 #include <logdepthbuf_vertex> 2752 #include <clipping_planes_vertex> 2753 vViewPosition = - mvPosition.xyz; 2754 #include <worldpos_vertex> 2755 #include <shadowmap_vertex> 2756 #include <fog_vertex> 2757}`,fragment$4=`#define TOON 2758uniform vec3 diffuse; 2759uniform vec3 emissive; 2760uniform float opacity; 2761#include <common> 2762#include <packing> 2763#include <dithering_pars_fragment> 2764#include <color_pars_fragment> 2765#include <uv_pars_fragment> 2766#include <uv2_pars_fragment> 2767#include <map_pars_fragment> 2768#include <alphamap_pars_fragment> 2769#include <alphatest_pars_fragment> 2770#include <aomap_pars_fragment> 2771#include <lightmap_pars_fragment> 2772#include <emissivemap_pars_fragment> 2773#include <gradientmap_pars_fragment> 2774#include <fog_pars_fragment> 2775#include <bsdfs> 2776#include <lights_pars_begin> 2777#include <normal_pars_fragment> 2778#include <lights_toon_pars_fragment> 2779#include <shadowmap_pars_fragment> 2780#include <bumpmap_pars_fragment> 2781#include <normalmap_pars_fragment> 2782#include <logdepthbuf_pars_fragment> 2783#include <clipping_planes_pars_fragment> 2784void main() { 2785 #include <clipping_planes_fragment> 2786 vec4 diffuseColor = vec4( diffuse, opacity ); 2787 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2788 vec3 totalEmissiveRadiance = emissive; 2789 #include <logdepthbuf_fragment> 2790 #include <map_fragment> 2791 #include <color_fragment> 2792 #include <alphamap_fragment> 2793 #include <alphatest_fragment> 2794 #include <normal_fragment_begin> 2795 #include <normal_fragment_maps> 2796 #include <emissivemap_fragment> 2797 #include <lights_toon_fragment> 2798 #include <lights_fragment_begin> 2799 #include <lights_fragment_maps> 2800 #include <lights_fragment_end> 2801 #include <aomap_fragment> 2802 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2803 #include <output_fragment> 2804 #include <tonemapping_fragment> 2805 #include <encodings_fragment> 2806 #include <fog_fragment> 2807 #include <premultiplied_alpha_fragment> 2808 #include <dithering_fragment> 2809}`,vertex$3=`uniform float size; 2810uniform float scale; 2811#include <common> 2812#include <color_pars_vertex> 2813#include <fog_pars_vertex> 2814#include <morphtarget_pars_vertex> 2815#include <logdepthbuf_pars_vertex> 2816#include <clipping_planes_pars_vertex> 2817void main() { 2818 #include <color_vertex> 2819 #include <morphcolor_vertex> 2820 #include <begin_vertex> 2821 #include <morphtarget_vertex> 2822 #include <project_vertex> 2823 gl_PointSize = size; 2824 #ifdef USE_SIZEATTENUATION 2825 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2826 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 2827 #endif 2828 #include <logdepthbuf_vertex> 2829 #include <clipping_planes_vertex> 2830 #include <worldpos_vertex> 2831 #include <fog_vertex> 2832}`,fragment$3=`uniform vec3 diffuse; 2833uniform float opacity; 2834#include <common> 2835#include <color_pars_fragment> 2836#include <map_particle_pars_fragment> 2837#include <alphatest_pars_fragment> 2838#include <fog_pars_fragment> 2839#include <logdepthbuf_pars_fragment> 2840#include <clipping_planes_pars_fragment> 2841void main() { 2842 #include <clipping_planes_fragment> 2843 vec3 outgoingLight = vec3( 0.0 ); 2844 vec4 diffuseColor = vec4( diffuse, opacity ); 2845 #include <logdepthbuf_fragment> 2846 #include <map_particle_fragment> 2847 #include <color_fragment> 2848 #include <alphatest_fragment> 2849 outgoingLight = diffuseColor.rgb; 2850 #include <output_fragment> 2851 #include <tonemapping_fragment> 2852 #include <encodings_fragment> 2853 #include <fog_fragment> 2854 #include <premultiplied_alpha_fragment> 2855}`,vertex$2=`#include <common> 2856#include <fog_pars_vertex> 2857#include <morphtarget_pars_vertex> 2858#include <skinning_pars_vertex> 2859#include <shadowmap_pars_vertex> 2860void main() { 2861 #include <beginnormal_vertex> 2862 #include <morphnormal_vertex> 2863 #include <skinbase_vertex> 2864 #include <skinnormal_vertex> 2865 #include <defaultnormal_vertex> 2866 #include <begin_vertex> 2867 #include <morphtarget_vertex> 2868 #include <skinning_vertex> 2869 #include <project_vertex> 2870 #include <worldpos_vertex> 2871 #include <shadowmap_vertex> 2872 #include <fog_vertex> 2873}`,fragment$2=`uniform vec3 color; 2874uniform float opacity; 2875#include <common> 2876#include <packing> 2877#include <fog_pars_fragment> 2878#include <bsdfs> 2879#include <lights_pars_begin> 2880#include <shadowmap_pars_fragment> 2881#include <shadowmask_pars_fragment> 2882void main() { 2883 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 2884 #include <tonemapping_fragment> 2885 #include <encodings_fragment> 2886 #include <fog_fragment> 2887}`,vertex$1=`uniform float rotation; 2888uniform vec2 center; 2889#include <common> 2890#include <uv_pars_vertex> 2891#include <fog_pars_vertex> 2892#include <logdepthbuf_pars_vertex> 2893#include <clipping_planes_pars_vertex> 2894void main() { 2895 #include <uv_vertex> 2896 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 2897 vec2 scale; 2898 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 2899 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 2900 #ifndef USE_SIZEATTENUATION 2901 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2902 if ( isPerspective ) scale *= - mvPosition.z; 2903 #endif 2904 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 2905 vec2 rotatedPosition; 2906 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 2907 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 2908 mvPosition.xy += rotatedPosition; 2909 gl_Position = projectionMatrix * mvPosition; 2910 #include <logdepthbuf_vertex> 2911 #include <clipping_planes_vertex> 2912 #include <fog_vertex> 2913}`,fragment$1=`uniform vec3 diffuse; 2914uniform float opacity; 2915#include <common> 2916#include <uv_pars_fragment> 2917#include <map_pars_fragment> 2918#include <alphamap_pars_fragment> 2919#include <alphatest_pars_fragment> 2920#include <fog_pars_fragment> 2921#include <logdepthbuf_pars_fragment> 2922#include <clipping_planes_pars_fragment> 2923void main() { 2924 #include <clipping_planes_fragment> 2925 vec3 outgoingLight = vec3( 0.0 ); 2926 vec4 diffuseColor = vec4( diffuse, opacity ); 2927 #include <logdepthbuf_fragment> 2928 #include <map_fragment> 2929 #include <alphamap_fragment> 2930 #include <alphatest_fragment> 2931 outgoingLight = diffuseColor.rgb; 2932 #include <output_fragment> 2933 #include <tonemapping_fragment> 2934 #include <encodings_fragment> 2935 #include <fog_fragment> 2936}`,ShaderChunk={alphamap_fragment,alphamap_pars_fragment,alphatest_fragment,alphatest_pars_fragment,aomap_fragment,aomap_pars_fragment,begin_vertex,beginnormal_vertex,bsdfs,iridescence_fragment,bumpmap_pars_fragment,clipping_planes_fragment,clipping_planes_pars_fragment,clipping_planes_pars_vertex,clipping_planes_vertex,color_fragment,color_pars_fragment,color_pars_vertex,color_vertex,common,cube_uv_reflection_fragment,defaultnormal_vertex,displacementmap_pars_vertex,displacementmap_vertex,emissivemap_fragment,emissivemap_pars_fragment,encodings_fragment,encodings_pars_fragment,envmap_fragment,envmap_common_pars_fragment,envmap_pars_fragment,envmap_pars_vertex,envmap_physical_pars_fragment,envmap_vertex,fog_vertex,fog_pars_vertex,fog_fragment,fog_pars_fragment,gradientmap_pars_fragment,lightmap_fragment,lightmap_pars_fragment,lights_lambert_fragment,lights_lambert_pars_fragment,lights_pars_begin,lights_toon_fragment,lights_toon_pars_fragment,lights_phong_fragment,lights_phong_pars_fragment,lights_physical_fragment,lights_physical_pars_fragment,lights_fragment_begin,lights_fragment_maps,lights_fragment_end,logdepthbuf_fragment,logdepthbuf_pars_fragment,logdepthbuf_pars_vertex,logdepthbuf_vertex,map_fragment,map_pars_fragment,map_particle_fragment,map_particle_pars_fragment,metalnessmap_fragment,metalnessmap_pars_fragment,morphcolor_vertex,morphnormal_vertex,morphtarget_pars_vertex,morphtarget_vertex,normal_fragment_begin,normal_fragment_maps,normal_pars_fragment,normal_pars_vertex,normal_vertex,normalmap_pars_fragment,clearcoat_normal_fragment_begin,clearcoat_normal_fragment_maps,clearcoat_pars_fragment,iridescence_pars_fragment,output_fragment,packing,premultiplied_alpha_fragment,project_vertex,dithering_fragment,dithering_pars_fragment,roughnessmap_fragment,roughnessmap_pars_fragment,shadowmap_pars_fragment,shadowmap_pars_vertex,shadowmap_vertex,shadowmask_pars_fragment,skinbase_vertex,skinning_pars_vertex,skinning_vertex,skinnormal_vertex,specularmap_fragment,specularmap_pars_fragment,tonemapping_fragment,tonemapping_pars_fragment,transmission_fragment,transmission_pars_fragment,uv_pars_fragment,uv_pars_vertex,uv_vertex,uv2_pars_fragment,uv2_pars_vertex,uv2_vertex,worldpos_vertex,background_vert:vertex$h,background_frag:fragment$h,backgroundCube_vert:vertex$g,backgroundCube_frag:fragment$g,cube_vert:vertex$f,cube_frag:fragment$f,depth_vert:vertex$e,depth_frag:fragment$e,distanceRGBA_vert:vertex$d,distanceRGBA_frag:fragment$d,equirect_vert:vertex$c,equirect_frag:fragment$c,linedashed_vert:vertex$b,linedashed_frag:fragment$b,meshbasic_vert:vertex$a,meshbasic_frag:fragment$a,meshlambert_vert:vertex$9,meshlambert_frag:fragment$9,meshmatcap_vert:vertex$8,meshmatcap_frag:fragment$8,meshnormal_vert:vertex$7,meshnormal_frag:fragment$7,meshphong_vert:vertex$6,meshphong_frag:fragment$6,meshphysical_vert:vertex$5,meshphysical_frag:fragment$5,meshtoon_vert:vertex$4,meshtoon_frag:fragment$4,points_vert:vertex$3,points_frag:fragment$3,shadow_vert:vertex$2,shadow_frag:fragment$2,sprite_vert:vertex$1,sprite_frag:fragment$1},UniformsLib={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Matrix3},uv2Transform:{value:new Matrix3},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Vector2(1,1)}}
vendor: 7,053 bytes, line 2936
2936,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}}},ShaderLib={basic:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.fog]),vertexShader:ShaderChunk.meshbasic_vert,fragmentShader:ShaderChunk.meshbasic_frag},lambert:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshlambert_vert,fragmentShader:ShaderChunk.meshlambert_frag},phong:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:ShaderChunk.meshphong_vert,fragmentShader:ShaderChunk.meshphong_frag},standard:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.roughnessmap,UniformsLib.metalnessmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag},toon:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.gradientmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshtoon_vert,fragmentShader:ShaderChunk.meshtoon_frag},matcap:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk.meshmatcap_vert,fragmentShader:ShaderChunk.meshmatcap_frag},points:{uniforms:mergeUniforms([UniformsLib.points,UniformsLib.fog]),vertexShader:ShaderChunk.points_vert,fragmentShader:ShaderChunk.points_frag},dashed:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk.linedashed_vert,fragmentShader:ShaderChunk.linedashed_frag},depth:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap]),vertexShader:ShaderChunk.depth_vert,fragmentShader:ShaderChunk.depth_frag},normal:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,{opacity:{value:1}}]),vertexShader:ShaderChunk.meshnormal_vert,fragmentShader:ShaderChunk.meshnormal_frag},sprite:{uniforms:mergeUniforms([UniformsLib.sprite,UniformsLib.fog]),vertexShader:ShaderChunk.sprite_vert,fragmentShader:ShaderChunk.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.background_vert,fragmentShader:ShaderChunk.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.backgroundCube_vert,fragmentShader:ShaderChunk.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ShaderChunk.cube_vert,fragmentShader:ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ShaderChunk.equirect_vert,fragmentShader:ShaderChunk.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ShaderChunk.distanceRGBA_vert,fragmentShader:ShaderChunk.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([UniformsLib.lights,UniformsLib.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:ShaderChunk.shadow_vert,fragmentShader:ShaderChunk.shadow_frag}};ShaderLib.physical={uniforms:mergeUniforms([ShaderLib.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag};const _rgb={r:0,b:0,g:0};
vendor: 11,975 bytes, line 2936
2936function WebGLBackground(n,e,t,i,r,s,a){const o=new Color(0);let l=s===!0?0:1,c,u,d=null,f=0,m=null;function v(g,x){let S=!1,y=x.isScene===!0?x.background:null;y&&y.isTexture&&(y=(x.backgroundBlurriness>0?t:e).get(y));const b=n.xr,w=b.getSession&&b.getSession();w&&w.environmentBlendMode==="additive"&&(y=null),y===null?_(o,l):y&&y.isColor&&(_(y,1),S=!0),(n.autoClear||S)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),y&&(y.isCubeTexture||y.mapping===CubeUVReflectionMapping)?(u===void 0&&(u=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(ShaderLib.backgroundCube.uniforms),vertexShader:ShaderLib.backgroundCube.vertexShader,fragmentShader:ShaderLib.backgroundCube.fragmentShader,side:BackSide,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,R,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,(d!==y||f!==y.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,d=y,f=y.version,m=n.toneMapping),u.layers.enableAll(),g.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(ShaderLib.background.uniforms),vertexShader:ShaderLib.background.vertexShader,fragmentShader:ShaderLib.background.fragmentShader,side:FrontSide,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(d!==y||f!==y.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,d=y,f=y.version,m=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function _(g,x){g.getRGB(_rgb,getUnlitUniformColorSpace(n)),i.buffers.color.setClear(_rgb.r,_rgb.g,_rgb.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(g,x=1){o.set(g),l=x,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,_(o,l)},render:v}}function WebGLBindingStates(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=g(null);let c=l,u=!1;function d(G,le,he,ue,ie){let ve=!1;if(a){const _e=_(ue,he,le);c!==_e&&(c=_e,m(c.object)),ve=x(G,ue,he,ie),ve&&S(G,ue,he,ie)}else{const _e=le.wireframe===!0;(c.geometry!==ue.id||c.program!==he.id||c.wireframe!==_e)&&(c.geometry=ue.id,c.program=he.id,c.wireframe=_e,ve=!0)}ie!==null&&t.update(ie,34963),(ve||u)&&(u=!1,M(G,le,he,ue),ie!==null&&n.bindBuffer(34963,t.get(ie).buffer))}function f(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(G){return i.isWebGL2?n.bindVertexArray(G):s.bindVertexArrayOES(G)}function v(G){return i.isWebGL2?n.deleteVertexArray(G):s.deleteVertexArrayOES(G)}function _(G,le,he){const ue=he.wireframe===!0;let ie=o[G.id];ie===void 0&&(ie={},o[G.id]=ie);let ve=ie[le.id];ve===void 0&&(ve={},ie[le.id]=ve);let _e=ve[ue];return _e===void 0&&(_e=g(f()),ve[ue]=_e),_e}function g(G){const le=[],he=[],ue=[];for(let ie=0;ie<r;ie++)le[ie]=0,he[ie]=0,ue[ie]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:le,enabledAttributes:he,attributeDivisors:ue,object:G,attributes:{},index:null}}function x(G,le,he,ue){const ie=c.attributes,ve=le.attributes;let _e=0;const Q=he.getAttributes();for(const ne in Q)if(Q[ne].location>=0){const Me=ie[ne];let Te=ve[ne];if(Te===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(Te=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(Te=G.instanceColor)),Me===void 0||Me.attribute!==Te||Te&&Me.data!==Te.data)return!0;_e++}return c.attributesNum!==_e||c.index!==ue}function S(G,le,he,ue){const ie={},ve=le.attributes;let _e=0;const Q=he.getAttributes();for(const ne in Q)if(Q[ne].location>=0){let Me=ve[ne];Me===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(Me=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(Me=G.instanceColor));const Te={};Te.attribute=Me,Me&&Me.data&&(Te.data=Me.data),ie[ne]=Te,_e++}c.attributes=ie,c.attributesNum=_e,c.index=ue}function y(){const G=c.newAttributes;for(let le=0,he=G.length;le<he;le++)G[le]=0}function b(G){w(G,0)}function w(G,le){const he=c.newAttributes,ue=c.enabledAttributes,ie=c.attributeDivisors;he[G]=1,ue[G]===0&&(n.enableVertexAttribArray(G),ue[G]=1),ie[G]!==le&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](G,le),ie[G]=le)}function C(){const G=c.newAttributes,le=c.enabledAttributes;for(let he=0,ue=le.length;he<ue;he++)le[he]!==G[he]&&(n.disableVertexAttribArray(he),le[he]=0)}function R(G,le,he,ue,ie,ve){i.isWebGL2===!0&&(he===5124||he===5125)?n.vertexAttribIPointer(G,le,he,ie,ve):n.vertexAttribPointer(G,le,he,ue,ie,ve)}function M(G,le,he,ue){if(i.isWebGL2===!1&&(G.isInstancedMesh||ue.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();const ie=ue.attributes,ve=he.getAttributes(),_e=le.defaultAttributeValues;for(const Q in ve){const ne=ve[Q];if(ne.location>=0){let ye=ie[Q];if(ye===void 0&&(Q==="instanceMatrix"&&G.instanceMatrix&&(ye=G.instanceMatrix),Q==="instanceColor"&&G.instanceColor&&(ye=G.instanceColor)),ye!==void 0){const Me=ye.normalized,Te=ye.itemSize,ae=t.get(ye);if(ae===void 0)continue;const Le=ae.buffer,Ee=ae.type,Ce=ae.bytesPerElement;if(ye.isInterleavedBufferAttribute){const we=ye.data,O=we.stride,D=ye.offset;if(we.isInstancedInterleavedBuffer){for(let k=0;k<ne.locationSize;k++)w(ne.location+k,we.meshPerAttribute);G.isInstancedMesh!==!0&&ue._maxInstanceCount===void 0&&(ue._maxInstanceCount=we.meshPerAttribute*we.count)}else for(let k=0;k<ne.locationSize;k++)b(ne.location+k);n.bindBuffer(34962,Le);for(let k=0;k<ne.locationSize;k++)R(ne.location+k,Te/ne.locationSize,Ee,Me,O*Ce,(D+Te/ne.locationSize*k)*Ce)}else{if(ye.isInstancedBufferAttribute){for(let we=0;we<ne.locationSize;we++)w(ne.location+we,ye.meshPerAttribute);G.isInstancedMesh!==!0&&ue._maxInstanceCount===void 0&&(ue._maxInstanceCount=ye.meshPerAttribute*ye.count)}else for(let we=0;we<ne.locationSize;we++)b(ne.location+we);n.bindBuffer(34962,Le);for(let we=0;we<ne.locationSize;we++)R(ne.location+we,Te/ne.locationSize,Ee,Me,Te*Ce,Te/ne.locationSize*we*Ce)}}else if(_e!==void 0){const Me=_e[Q];if(Me!==void 0)switch(Me.length){case 2:n.vertexAttrib2fv(ne.location,Me);break;case 3:n.vertexAttrib3fv(ne.location,Me);break;case 4:n.vertexAttrib4fv(ne.location,Me);break;default:n.vertexAttrib1fv(ne.location,Me)}}}}C()}function L(){W();for(const G in o){const le=o[G];for(const he in le){const ue=le[he];for(const ie in ue)v(ue[ie].object),delete ue[ie];delete le[he]}delete o[G]}}function B(G){if(o[G.id]===void 0)return;const le=o[G.id];for(const he in le){const ue=le[he];for(const ie in ue)v(ue[ie].object),delete ue[ie];delete le[he]}delete o[G.id]}function Z(G){for(const le in o){const he=o[le];if(he[G.id]===void 0)continue;const ue=he[G.id];for(const ie in ue)v(ue[ie].object),delete ue[ie];delete he[G.id]}}function W(){X(),u=!0,c!==l&&(c=l,m(c.object))}function X(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:d,reset:W,resetDefaultState:X,dispose:L,releaseStatesOfGeometry:B,releaseStatesOfProgram:Z,initAttributes:y,enableAttribute:b,disableUnusedAttributes:C}}function WebGLBufferRenderer(n,e,t,i){const r=i.isWebGL2;let s;function a(c){s=c}function o(c,u){n.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,d){if(d===0)return;let f,m;if(r)f=n,m="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),m="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[m](s,c,u,d),t.update(u,s,d)}this.setMode=a,this.render=o,this.renderInstances=l}function WebGLCapabilities(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(R){if(R==="highp"){if(n.getShaderPrecisionFormat(35633,36338).precision>0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";R="mediump"}return R==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,d=n.getParameter(34930),f=n.getParameter(35660),m=n.getParameter(3379),v=n.getParameter(34076),_=n.getParameter(34921),g=n.getParameter(36347),x=n.getParameter(36348),S=n.getParameter(36349),y=f>0,b=a||e.has("OES_texture_float"),w=y&&b,C=a?n.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:g,maxVaryings:x,maxFragmentUniforms:S,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:w,maxSamples:C}}function WebGLClipping(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Plane,o=new Matrix3,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f,m){const v=d.length!==0||f||i!==0||r;return r=f,t=u(d,m,0),i=d.length,v},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(d,f,m){const v=d.clippingPlanes,_=d.clipIntersection,g=d.clipShadows,x=n.get(d);if(!r||v===null||v.length===0||s&&!g)s?u(null):c();else{const S=s?0:i,y=S*4;let b=x.clippingState||null;l.value=b,b=u(v,f,y,m);for(let w=0;w!==y;++w)b[w]=t[w];x.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,f,m,v){const _=d!==null?d.length:0;let g=null;if(_!==0){if(g=l.value,v!==!0||g===null){const x=m+_*4,S=f.matrixWorldInverse;o.getNormalMatrix(S),(g===null||g.length<x)&&(g=new Float32Array(x));for(let y=0,b=m;y!==_;++y,b+=4)a.copy(d[y]).applyMatrix4(S,o),a.normal.toArray(g,b),g[b+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}function WebGLCubeMaps(n){let e=new WeakMap;function t(a,o){return o===EquirectangularReflectionMapping?a.mapping=CubeReflectionMapping:o===EquirectangularRefractionMapping&&(a.mapping=CubeRefractionMapping),a}function i(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const o=a.mapping;if(o===EquirectangularReflectionMapping||o===EquirectangularRefractionMapping)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new WebGLCubeRenderTarget(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class OrthographicCamera extends Camera{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
2936phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const LOD_MIN=4,EXTRA_LOD_SIGMA=[.125,.215,.35,.446,.526,.582],MAX_SAMPLES=20,_flatCamera=new OrthographicCamera,_clearColor=new Color;let _oldTarget=null;const PHI=(1+Math.sqrt(5))/2,INV_PHI=1/PHI,_axisDirections=[new Vector3(1,1,1),new Vector3(-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,PHI,INV_PHI),new Vector3(0,PHI,-INV_PHI),new Vector3(INV_PHI,0,PHI),new Vector3(-INV_PHI,0,PHI),new Vector3(PHI,INV_PHI,0),new Vector3(-PHI,INV_PHI,0)];class PMREMGenerator{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){_oldTarget=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(_oldTarget),e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===CubeReflectionMapping||e.mapping===CubeRefractionMapping?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_oldTarget=this._renderer.getRenderTarget();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:LinearFilter,minFilter:LinearFilter,generateMipmaps:!1,type:HalfFloatType,format:RGBAFormat,encoding:LinearEncoding,depthBuffer:!1},r=_createRenderTarget(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=_createPlanes(s)),this._blurMaterial=_getBlurShader(s,e,t)}return r}_compileMaterial(e){const t=new Mesh(this._lodPlanes[0],e);this._renderer.compile(t,_flatCamera)}_sceneToCubeUV(e,t,i,r){const o=new PerspectiveCamera(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(_clearColor),u.toneMapping=NoToneMapping,u.autoClear=!1;
vendor: 5,950 bytes, lines 2936-3011
2936const m=new MeshBasicMaterial({name:"PMREM.Background",side:BackSide,depthWrite:!1,depthTest:!1}),v=new Mesh(new BoxGeometry,m);let _=!1;const g=e.background;g?g.isColor&&(m.color.copy(g),e.background=null,_=!0):(m.color.copy(_clearColor),_=!0);for(let x=0;x<6;x++){const S=x%3;S===0?(o.up.set(0,l[x],0),o.lookAt(c[x],0,0)):S===1?(o.up.set(0,0,l[x]),o.lookAt(0,c[x],0)):(o.up.set(0,l[x],0),o.lookAt(0,0,c[x]));const y=this._cubeSize;_setViewport(r,S*y,x>2?y:0,y,y),u.setRenderTarget(r),_&&u.render(v,o),u.render(e,o)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===CubeReflectionMapping||e.mapping===CubeRefractionMapping;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Mesh(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;_setViewport(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,_flatCamera)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=_axisDirections[(r-1)%_axisDirections.length];this._blur(e,r-1,r,s,a)}t.autoClear=i}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new Mesh(this._lodPlanes[r],c),f=c.uniforms,m=this._sizeLods[i]-1,v=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*MAX_SAMPLES-1),_=s/v,g=isFinite(s)?1+Math.floor(u*_):MAX_SAMPLES;g>MAX_SAMPLES&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${MAX_SAMPLES}`);const x=[];let S=0;for(let R=0;R<MAX_SAMPLES;++R){const M=R/_,L=Math.exp(-M*M/2);x.push(L),R===0?S+=L:R<g&&(S+=2*L)}for(let R=0;R<x.length;R++)x[R]=x[R]/S;f.envMap.value=e.texture,f.samples.value=g,f.weights.value=x,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:y}=this;f.dTheta.value=v,f.mipInt.value=y-i;const b=this._sizeLods[r],w=3*b*(r>y-LOD_MIN?r-y+LOD_MIN:0),C=4*(this._cubeSize-b);_setViewport(t,w,C,3*b,2*b),l.setRenderTarget(t),l.render(d,_flatCamera)}}function _createPlanes(n){const e=[],t=[],i=[];let r=n;const s=n-LOD_MIN+1+EXTRA_LOD_SIGMA.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>n-LOD_MIN?l=EXTRA_LOD_SIGMA[a-n+LOD_MIN-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],m=6,v=6,_=3,g=2,x=1,S=new Float32Array(_*v*m),y=new Float32Array(g*v*m),b=new Float32Array(x*v*m);for(let C=0;C<m;C++){const R=C%3*2/3-1,M=C>2?0:-1,L=[R,M,0,R+2/3,M,0,R+2/3,M+1,0,R,M,0,R+2/3,M+1,0,R,M+1,0];S.set(L,_*v*C),y.set(f,g*v*C);const B=[C,C,C,C,C,C];b.set(B,x*v*C)}const w=new BufferGeometry;w.setAttribute("position",new BufferAttribute(S,_)),w.setAttribute("uv",new BufferAttribute(y,g)),w.setAttribute("faceIndex",new BufferAttribute(b,x)),e.push(w),r>LOD_MIN&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function _createRenderTarget(n,e,t){const i=new WebGLRenderTarget(n,e,t);return i.texture.mapping=CubeUVReflectionMapping,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function _setViewport(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function _getBlurShader(n,e,t){const i=new Float32Array(MAX_SAMPLES),r=new Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:MAX_SAMPLES,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:_getCommonVertexShader(),fragmentShader:` 2937 2938 precision mediump float; 2939 precision mediump int; 2940 2941 varying vec3 vOutputDirection; 2942 2943 uniform sampler2D envMap; 2944 uniform int samples; 2945 uniform float weights[ n ]; 2946 uniform bool latitudinal; 2947 uniform float dTheta; 2948 uniform float mipInt; 2949 uniform vec3 poleAxis; 2950 2951 #define ENVMAP_TYPE_CUBE_UV 2952 #include <cube_uv_reflection_fragment> 2953 2954 vec3 getSample( float theta, vec3 axis ) { 2955 2956 float cosTheta = cos( theta ); 2957 // Rodrigues' axis-angle rotation 2958 vec3 sampleDirection = vOutputDirection * cosTheta 2959 + cross( axis, vOutputDirection ) * sin( theta ) 2960 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 2961 2962 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 2963 2964 } 2965 2966 void main() { 2967 2968 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 2969 2970 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 2971 2972 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 2973 2974 } 2975 2976 axis = normalize( axis ); 2977 2978 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2979 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 2980 2981 for ( int i = 1; i < n; i++ ) { 2982 2983 if ( i >= samples ) { 2984 2985 break; 2986 2987 } 2988 2989 float theta = dTheta * float( i ); 2990 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 2991 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 2992 2993 } 2994 2995 } 2996 `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:` 2997 2998 precision mediump float; 2999 precision mediump int; 3000 3001 varying vec3 vOutputDirection; 3002 3003 uniform sampler2D envMap; 3004 3005 #include <common> 3006 3007 void main() { 3008 3009 vec3 outputDirection = normalize( vOutputDirection ); 3010 vec2 uv = equirectUv( outputDirection ); 3011
3012 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3013 3014 } 3015 `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:` 3016 3017 precision mediump float; 3018 precision mediump int; 3019 3020 uniform float flipEnvMap; 3021 3022 varying vec3 vOutputDirection; 3023 3024 uniform samplerCube envMap; 3025 3026 void main() { 3027 3028 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3029 3030 } 3031 `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return` 3032 3033 precision mediump float; 3034 precision mediump int; 3035 3036 attribute float faceIndex; 3037 3038 varying vec3 vOutputDirection; 3039 3040 // RH coordinate system; PMREM face-indexing convention 3041 vec3 getDirection( vec2 uv, float face ) { 3042 3043 uv = 2.0 * uv - 1.0; 3044 3045 vec3 direction = vec3( uv, 1.0 ); 3046 3047 if ( face == 0.0 ) { 3048 3049 direction = direction.zyx; // ( 1, v, u ) pos x 3050 3051 } else if ( face == 1.0 ) { 3052 3053 direction = direction.xzy; 3054 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3055 3056 } else if ( face == 2.0 ) { 3057 3058 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3059 3060 } else if ( face == 3.0 ) { 3061 3062 direction = direction.zyx; 3063 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3064 3065 } else if ( face == 4.0 ) { 3066 3067 direction = direction.xzy; 3068 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3069 3070 } else if ( face == 5.0 ) { 3071 3072 direction.z *= -1.0; // ( u, v, -1 ) neg z 3073 3074 } 3075 3076 return direction; 3077 3078 } 3079 3080 void main() { 3081 3082 vOutputDirection = getDirection( uv, faceIndex ); 3083 gl_Position = vec4( position, 1.0 ); 3084 3085 } 3086 `}function WebGLCubeUVMaps(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===EquirectangularReflectionMapping||l===EquirectangularRefractionMapping,u=l===CubeReflectionMapping||l===CubeRefractionMapping;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let d=e.get(o);return t===null&&(t=new PMREMGenerator(n)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),e.set(o,d),d.texture}else{if(e.has(o))return e.get(o).texture;{const d=o.image;if(c&&d&&d.height>0||u&&d&&r(d)){t===null&&(t=new PMREMGenerator(n));const f=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,f),o.addEventListener("dispose",s),f.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function WebGLExtensions(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function WebGLGeometries(n,e,t,i){const r={},s=new WeakMap;function a(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const v in f.attributes)e.remove(f.attributes[v]);f.removeEventListener("dispose",a),delete r[f.id];const m=s.get(f);m&&(e.remove(m),s.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(d,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(d){const f=d.attributes;for(const v in f)e.update(f[v],34962);const m=d.morphAttributes;for(const v in m){const _=m[v];for(let g=0,x=_.length;g<x;g++)e.update(_[g],34962)}}function c(d){const f=[],m=d.index,v=d.attributes.position;let _=0;if(m!==null){const S=m.array;_=m.version;for(let y=0,b=S.length;y<b;y+=3){const w=S[y+0],C=S[y+1],R=S[y+2];f.push(w,C,C,R,R,w)}}else{const S=v.array;_=v.version;for(let y=0,b=S.length/3-1;y<b;y+=3){const w=y+0,C=y+1,R=y+2;f.push(w,C,C,R,R,w)}}const g=new(arrayNeedsUint32(f)?Uint32BufferAttribute:Uint16BufferAttribute)(f,1);g.version=_;const x=s.get(d);x&&e.remove(x),s.set(d,g)}function u(d){const f=s.get(d);if(f){const m=d.index;m!==null&&f.version<m.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}
vendor: 15,003 bytes, lines 3086-3088
3086function WebGLIndexedBufferRenderer(n,e,t,i){const r=i.isWebGL2;let s;function a(f){s=f}let o,l;function c(f){o=f.type,l=f.bytesPerElement}function u(f,m){n.drawElements(s,m,o,f*l),t.update(m,s,1)}function d(f,m,v){if(v===0)return;let _,g;if(r)_=n,g="drawElementsInstanced";else if(_=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",_===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}_[g](s,m,o,f*l,v),t.update(m,s,v)}this.setMode=a,this.setIndex=c,this.render=u,this.renderInstances=d}function WebGLInfo(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case 4:t.triangles+=o*(s/3);break;case 1:t.lines+=o*(s/2);break;case 3:t.lines+=o*(s-1);break;case 2:t.lines+=o*s;break;case 0:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function numericalSort(n,e){return n[0]-e[0]}function absNumericalSort(n,e){return Math.abs(e[1])-Math.abs(n[1])}function WebGLMorphtargets(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,a=new Vector4,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,u,d,f){const m=c.morphTargetInfluences;if(e.isWebGL2===!0){const _=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,g=_!==void 0?_.length:0;let x=s.get(u);if(x===void 0||x.count!==g){let he=function(){G.dispose(),s.delete(u),u.removeEventListener("dispose",he)};var v=he;x!==void 0&&x.texture.dispose();const b=u.morphAttributes.position!==void 0,w=u.morphAttributes.normal!==void 0,C=u.morphAttributes.color!==void 0,R=u.morphAttributes.position||[],M=u.morphAttributes.normal||[],L=u.morphAttributes.color||[];let B=0;b===!0&&(B=1),w===!0&&(B=2),C===!0&&(B=3);let Z=u.attributes.position.count*B,W=1;Z>e.maxTextureSize&&(W=Math.ceil(Z/e.maxTextureSize),Z=e.maxTextureSize);const X=new Float32Array(Z*W*4*g),G=new DataArrayTexture(X,Z,W,g);G.type=FloatType,G.needsUpdate=!0;const le=B*4;for(let ue=0;ue<g;ue++){const ie=R[ue],ve=M[ue],_e=L[ue],Q=Z*W*4*ue;for(let ne=0;ne<ie.count;ne++){const ye=ne*le;b===!0&&(a.fromBufferAttribute(ie,ne),X[Q+ye+0]=a.x,X[Q+ye+1]=a.y,X[Q+ye+2]=a.z,X[Q+ye+3]=0),w===!0&&(a.fromBufferAttribute(ve,ne),X[Q+ye+4]=a.x,X[Q+ye+5]=a.y,X[Q+ye+6]=a.z,X[Q+ye+7]=0),C===!0&&(a.fromBufferAttribute(_e,ne),X[Q+ye+8]=a.x,X[Q+ye+9]=a.y,X[Q+ye+10]=a.z,X[Q+ye+11]=_e.itemSize===4?a.w:1)}}x={count:g,texture:G,size:new Vector2(Z,W)},s.set(u,x),u.addEventListener("dispose",he)}let S=0;for(let b=0;b<m.length;b++)S+=m[b];const y=u.morphTargetsRelative?1:1-S;f.getUniforms().setValue(n,"morphTargetBaseInfluence",y),f.getUniforms().setValue(n,"morphTargetInfluences",m),f.getUniforms().setValue(n,"morphTargetsTexture",x.texture,t),f.getUniforms().setValue(n,"morphTargetsTextureSize",x.size)}else{const _=m===void 0?0:m.length;let g=i[u.id];if(g===void 0||g.length!==_){g=[];for(let w=0;w<_;w++)g[w]=[w,0];i[u.id]=g}for(let w=0;w<_;w++){const C=g[w];C[0]=w,C[1]=m[w]}g.sort(absNumericalSort);for(let w=0;w<8;w++)w<_&&g[w][1]?(o[w][0]=g[w][0],o[w][1]=g[w][1]):(o[w][0]=Number.MAX_SAFE_INTEGER,o[w][1]=0);o.sort(numericalSort);const x=u.morphAttributes.position,S=u.morphAttributes.normal;let y=0;for(let w=0;w<8;w++){const C=o[w],R=C[0],M=C[1];R!==Number.MAX_SAFE_INTEGER&&M?(x&&u.getAttribute("morphTarget"+w)!==x[R]&&u.setAttribute("morphTarget"+w,x[R]),S&&u.getAttribute("morphNormal"+w)!==S[R]&&u.setAttribute("morphNormal"+w,S[R]),r[w]=M,y+=M):(x&&u.hasAttribute("morphTarget"+w)===!0&&u.deleteAttribute("morphTarget"+w),S&&u.hasAttribute("morphNormal"+w)===!0&&u.deleteAttribute("morphNormal"+w),r[w]=0)}const b=u.morphTargetsRelative?1:1-y;f.getUniforms().setValue(n,"morphTargetBaseInfluence",b),f.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:l}}function WebGLObjects(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,d=e.get(l,u);return r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const emptyTexture=new Texture,emptyArrayTexture=new DataArrayTexture,empty3dTexture=new Data3DTexture,emptyCubeTexture=new CubeTexture,arrayCacheF32=[],arrayCacheI32=[],mat4array=new Float32Array(16),mat3array=new Float32Array(9),mat2array=new Float32Array(4);function flatten(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=arrayCacheF32[r];if(s===void 0&&(s=new Float32Array(r),arrayCacheF32[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function arraysEqual(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function copyArray(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function allocTexUnits(n,e){let t=arrayCacheI32[e];t===void 0&&(t=new Int32Array(e),arrayCacheI32[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function setValueV1f(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function setValueV2f(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(arraysEqual(t,e))return;n.uniform2fv(this.addr,e),copyArray(t,e)}}function setValueV3f(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(arraysEqual(t,e))return;n.uniform3fv(this.addr,e),copyArray(t,e)}}function setValueV4f(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(arraysEqual(t,e))return;n.uniform4fv(this.addr,e),copyArray(t,e)}}function setValueM2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(arraysEqual(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),copyArray(t,e)}else{if(arraysEqual(t,i))return;mat2array.set(i),n.uniformMatrix2fv(this.addr,!1,mat2array),copyArray(t,i)}}function setValueM3(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(arraysEqual(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),copyArray(t,e)}else{if(arraysEqual(t,i))return;mat3array.set(i),n.uniformMatrix3fv(this.addr,!1,mat3array),copyArray(t,i)}}function setValueM4(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(arraysEqual(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),copyArray(t,e)}else{if(arraysEqual(t,i))return;mat4array.set(i),n.uniformMatrix4fv(this.addr,!1,mat4array),copyArray(t,i)}}function setValueV1i(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function setValueV2i(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(arraysEqual(t,e))return;n.uniform2iv(this.addr,e),copyArray(t,e)}}function setValueV3i(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(arraysEqual(t,e))return;n.uniform3iv(this.addr,e),copyArray(t,e)}}function setValueV4i(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(arraysEqual(t,e))return;n.uniform4iv(this.addr,e),copyArray(t,e)}}function setValueV1ui(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function setValueV2ui(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(arraysEqual(t,e))return;n.uniform2uiv(this.addr,e),copyArray(t,e)}}function setValueV3ui(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(arraysEqual(t,e))return;n.uniform3uiv(this.addr,e),copyArray(t,e)}}function setValueV4ui(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(arraysEqual(t,e))return;n.uniform4uiv(this.addr,e),copyArray(t,e)}}function setValueT1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||emptyTexture,r)}function setValueT3D1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||empty3dTexture,r)}function setValueT6(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||emptyCubeTexture,r)}function setValueT2DArray1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||emptyArrayTexture,r)}function getSingularSetter(n){switch(n){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}function setValueV1fArray(n,e){n.uniform1fv(this.addr,e)}function setValueV2fArray(n,e){const t=flatten(e,this.size,2);n.uniform2fv(this.addr,t)}function setValueV3fArray(n,e){const t=flatten(e,this.size,3);n.uniform3fv(this.addr,t)}function setValueV4fArray(n,e){const t=flatten(e,this.size,4);n.uniform4fv(this.addr,t)}function setValueM2Array(n,e){const t=flatten(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function setValueM3Array(n,e){const t=flatten(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function setValueM4Array(n,e){const t=flatten(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function setValueV1iArray(n,e){n.uniform1iv(this.addr,e)}function setValueV2iArray(n,e){n.uniform2iv(this.addr,e)}function setValueV3iArray(n,e){n.uniform3iv(this.addr,e)}function setValueV4iArray(n,e){n.uniform4iv(this.addr,e)}function setValueV1uiArray(n,e){n.uniform1uiv(this.addr,e)}function setValueV2uiArray(n,e){n.uniform2uiv(this.addr,e)}function setValueV3uiArray(n,e){n.uniform3uiv(this.addr,e)}function setValueV4uiArray(n,e){n.uniform4uiv(this.addr,e)}function setValueT1Array(n,e,t){const i=this.cache,r=e.length,s=allocTexUnits(t,r);arraysEqual(i,s)||(n.uniform1iv(this.addr,s),copyArray(i,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||emptyTexture,s[a])}function setValueT3DArray(n,e,t){const i=this.cache,r=e.length,s=allocTexUnits(t,r);arraysEqual(i,s)||(n.uniform1iv(this.addr,s),copyArray(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||empty3dTexture,s[a])}function setValueT6Array(n,e,t){const i=this.cache,r=e.length,s=allocTexUnits(t,r);arraysEqual(i,s)||(n.uniform1iv(this.addr,s),copyArray(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||emptyCubeTexture,s[a])}function setValueT2DArrayArray(n,e,t){const i=this.cache,r=e.length,s=allocTexUnits(t,r);arraysEqual(i,s)||(n.uniform1iv(this.addr,s),copyArray(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||emptyArrayTexture,s[a])}function getPureArraySetter(n){switch(n){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}class SingleUniform{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=getSingularSetter(t.type)}}class PureArrayUniform{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=getPureArraySetter(t.type)}}class StructuredUniform{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const RePathPart=/(\w+)(\])?(\[|\.)?/g;function addUniform(n,e){n.seq.push(e),n.map[e.id]=e}function parseUniform(n,e,t){const i=n.name,r=i.length;for(RePathPart.lastIndex=0;;){const s=RePathPart.exec(i),a=RePathPart.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){addUniform(t,c===void 0?new SingleUniform(o,n,e):new PureArrayUniform(o,n,e));break}else{let d=t.map[o];d===void 0&&(d=new StructuredUniform(o),addUniform(t,d)),t=d}}}class WebGLUniforms{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);parseUniform(s,a,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function WebGLShader(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}let programIdCount=0;function handleSource(n,e){const t=n.split(` 3087`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(` 3088`)}function getEncodingComponents(n){switch(n){case LinearEncoding:return["Linear","( value )"];case sRGBEncoding:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function getShaderErrors(n,e,t){const i=n.getShaderParameter(e,35
3088713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3089 3090`+r+` 3091 3092`+handleSource(n.getShaderSource(e),a)}else return r}function getTexelEncodingFunction(n,e){const t=getEncodingComponents(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function getToneMappingFunction(n,e){let t;switch(e){case LinearToneMapping:t="Linear";break;case ReinhardToneMapping:t="Reinhard";break;case CineonToneMapping:t="OptimizedCineon";break;case ACESFilmicToneMapping:t="ACESFilmic";break;case CustomToneMapping:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function generateExtensions(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(filterEmptyLine).join(` 3093`)}function generateDefines(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` 3094`)}function fetchAttributeLocations(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===35674&&(o=2),s.type===35675&&(o=3),s.type===35676&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function filterEmptyLine(n){return n!==""}function replaceLightNums(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function replaceClippingPlaneNums(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const includePattern=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(n){return n.replace(includePattern,includeReplacer)}function includeReplacer(n,e){const t=ShaderChunk[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return resolveIncludes(t)}const unrollLoopPattern=/#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 unrollLoops(n){return n.replace(unrollLoopPattern,loopReplacer)}function loopReplacer(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function generatePrecision(n){let e="precision "+n.precision+` float; 3095precision `+n.precision+" int;";return n.precision==="highp"?e+=` 3096#define HIGH_PRECISION`:n.precision==="mediump"?e+=` 3097#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=` 3098#define LOW_PRECISION`),e}function generateShadowMapTypeDefine(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===PCFShadowMap?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===PCFSoftShadowMap?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===VSMShadowMap&&(e="SHADOWMAP_TYPE_VSM"),e}function generateEnvMapTypeDefine(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case CubeReflectionMapping:case CubeRefractionMapping:e="ENVMAP_TYPE_CUBE";break;case CubeUVReflectionMapping:e="ENVMAP_TYPE_CUBE_UV";break}return e}function generateEnvMapModeDefine(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case CubeRefractionMapping:e="ENVMAP_MODE_REFRACTION";break}return e}function generateEnvMapBlendingDefine(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case MultiplyOperation:e="ENVMAP_BLENDING_MULTIPLY";break;case MixOperation:e="ENVMAP_BLENDING_MIX";break;case AddOperation:e="ENVMAP_BLENDING_ADD";break}return e}function generateCubeUVSize(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function WebGLProgram(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=generateShadowMapTypeDefine(t),c=generateEnvMapTypeDefine(t),u=generateEnvMapModeDefine(t),d=generateEnvMapBlendingDefine(t),f=generateCubeUVSize(t),m=t.isWebGL2?"":generateExtensions(t),v=generateDefines(s),_=r.createProgram();let g,x,S=t.glslVersion?"#version "+t.glslVersion+` 3099`:"";t.isRawShaderMaterial?(g=[v].filter(filterEmptyLine).join(` 3100`),g.length>0&&(g+=` 3101`),x=[m,v].filter(filterEmptyLine).join(` 3102`),x.length>0&&(x+=` 3103`)):(g=[generatePrecision(t),"#define SHADER_NAME "+t.shaderName,v,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3103IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3104`].filter(filterEmptyLine).join(` 3105`),x=[m,generatePrecision(t),"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IR
3105IDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==NoToneMapping?ShaderChunk.tonemapping_pars_fragment:"",t.toneMapping!==NoToneMapping?getToneMappingFunction("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ShaderChunk.encodings_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3106`].filter(filterEmptyLine).join(` 3107`)),a=resolveIncludes(a),a=replaceLightNums(a,t),a=replaceClippingPlaneNums(a,t),o=resolveIncludes(o),o=replaceLightNums(o,t),o=replaceClippingPlaneNums(o,t),a=unrollLoops(a),o=unrollLoops(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(S=`#version 300 es 3108`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3109`)+` 3110`+g,x=["#define varying in",t.glslVersion===GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 3111`)+` 3112`+x);const y=S+g+a,b=S+x+o,w=WebGLShader(r,35633,y),C=WebGLShader(r,35632,b);if(r.attachShader(_,w),r.attachShader(_,C),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),n.debug.checkShaderErrors){const L=r.getProgramInfoLog(_).trim(),B=r.getShaderInfoLog(w).trim(),Z=r.getShaderInfoLog(C).trim();let W=!0,X=!0;if(r.getProgramParameter(_,35714)===!1){W=!1;const G=getShaderErrors(r,w,"vertex"),le=getShaderErrors(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715
vendor: 13,924 bytes, lines 3112-3116
3112)+` 3113 3114Program Info Log: `+L+` 3115`+G+` 3116`+le)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(B===""||Z==="")&&(X=!1);X&&(this.diagnostics={runnable:W,programLog:L,vertexShader:{log:B,prefix:g},fragmentShader:{log:Z,prefix:x}})}r.deleteShader(w),r.deleteShader(C);let R;this.getUniforms=function(){return R===void 0&&(R=new WebGLUniforms(r,_)),R};let M;return this.getAttributes=function(){return M===void 0&&(M=fetchAttributeLocations(r,_)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.name=t.shaderName,this.id=programIdCount++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=w,this.fragmentShader=C,this}let _id=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new WebGLShaderStage(e),t.set(e,i)),i}}class WebGLShaderStage{constructor(e){this.id=_id++,this.code=e,this.usedTimes=0}}function WebGLPrograms(n,e,t,i,r,s,a){const o=new Layers,l=new WebGLShaderCache,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M,L,B,Z,W){const X=Z.fog,G=W.geometry,le=M.isMeshStandardMaterial?Z.environment:null,he=(M.isMeshStandardMaterial?t:e).get(M.envMap||le),ue=he&&he.mapping===CubeUVReflectionMapping?he.image.height:null,ie=v[M.type];M.precision!==null&&(m=r.getMaxPrecision(M.precision),m!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",m,"instead."));const ve=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,_e=ve!==void 0?ve.length:0;let Q=0;G.morphAttributes.position!==void 0&&(Q=1),G.morphAttributes.normal!==void 0&&(Q=2),G.morphAttributes.color!==void 0&&(Q=3);let ne,ye,Me,Te;if(ie){const O=ShaderLib[ie];ne=O.vertexShader,ye=O.fragmentShader}else ne=M.vertexShader,ye=M.fragmentShader,l.update(M),Me=l.getVertexShaderID(M),Te=l.getFragmentShaderID(M);const ae=n.getRenderTarget(),Le=M.alphaTest>0,Ee=M.clearcoat>0,Ce=M.iridescence>0;return{isWebGL2:u,shaderID:ie,shaderName:M.type,vertexShader:ne,fragmentShader:ye,defines:M.defines,customVertexShaderID:Me,customFragmentShaderID:Te,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:m,instancing:W.isInstancedMesh===!0,instancingColor:W.isInstancedMesh===!0&&W.instanceColor!==null,supportsVertexTextures:f,outputEncoding:ae===null?n.outputEncoding:ae.isXRRenderTarget===!0?ae.texture.encoding:LinearEncoding,map:!!M.map,matcap:!!M.matcap,envMap:!!he,envMapMode:he&&he.mapping,envMapCubeUVHeight:ue,lightMap:!!M.lightMap,aoMap:!!M.aoMap,emissiveMap:!!M.emissiveMap,bumpMap:!!M.bumpMap,normalMap:!!M.normalMap,objectSpaceNormalMap:M.normalMapType===ObjectSpaceNormalMap,tangentSpaceNormalMap:M.normalMapType===TangentSpaceNormalMap,decodeVideoTexture:!!M.map&&M.map.isVideoTexture===!0&&M.map.encoding===sRGBEncoding,clearcoat:Ee,clearcoatMap:Ee&&!!M.clearcoatMap,clearcoatRoughnessMap:Ee&&!!M.clearcoatRoughnessMap,clearcoatNormalMap:Ee&&!!M.clearcoatNormalMap,iridescence:Ce,iridescenceMap:Ce&&!!M.iridescenceMap,iridescenceThicknessMap:Ce&&!!M.iridescenceThicknessMap,displacementMap:!!M.displacementMap,roughnessMap:!!M.roughnessMap,metalnessMap:!!M.metalnessMap,specularMap:!!M.specularMap,specularIntensityMap:!!M.specularIntensityMap,specularColorMap:!!M.specularColorMap,opaque:M.transparent===!1&&M.blending===NormalBlending,alphaMap:!!M.alphaMap,alphaTest:Le,gradientMap:!!M.gradientMap,sheen:M.sheen>0,sheenColorMap:!!M.sheenColorMap,sheenRoughnessMap:!!M.sheenRoughnessMap,transmission:M.transmission>0,transmissionMap:!!M.transmissionMap,thicknessMap:!!M.thicknessMap,combine:M.combine,vertexTangents:!!M.normalMap&&!!G.attributes.tangent,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUvs:!!M.map||!!M.bumpMap||!!M.normalMap||!!M.specularMap||!!M.alphaMap||!!M.emissiveMap||!!M.roughnessMap||!!M.metalnessMap||!!M.clearcoatMap||!!M.clearcoatRoughnessMap||!!M.clearcoatNormalMap||!!M.iridescenceMap||!!M.iridescenceThicknessMap||!!M.displacementMap||!!M.transmissionMap||!!M.thicknessMap||!!M.specularIntensityMap||!!M.specularColorMap||!!M.sheenColorMap||!!M.sheenRoughnessMap,uvsVertexOnly:!(M.map||M.bumpMap||M.normalMap||M.specularMap||M.alphaMap||M.emissiveMap||M.roughnessMap||M.metalnessMap||M.clearcoatNormalMap||M.iridescenceMap||M.iridescenceThicknessMap||M.transmission>0||M.transmissionMap||M.thicknessMap||M.specularIntensityMap||M.specularColorMap||M.sheen>0||M.sheenColorMap||M.sheenRoughnessMap)&&!!M.displacementMap,fog:!!X,useFog:M.fog===!0,fogExp2:X&&X.isFogExp2,flatShading:!!M.flatShading,sizeAttenuation:M.sizeAttenuation,logarithmicDepthBuffer:d,skinning:W.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Q,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&B.length>0,shadowMapType:n.shadowMap.type,toneMapping:M.toneMapped?n.toneMapping:NoToneMapping,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===DoubleSide,flipSided:M.side===BackSide,useDepthPacking:!!M.depthPacking,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:M.extensions&&M.extensions.derivatives,extensionFragDepth:M.extensions&&M.extensions.fragDepth,extensionDrawBuffers:M.extensions&&M.extensions.drawBuffers,extensionShaderTextureLOD:M.extensions&&M.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function g(M){const L=[];if(M.shaderID?L.push(M.shaderID):(L.push(M.customVertexShaderID),L.push(M.customFragmentShaderID)),M.defines!==void 0)for(const B in M.defines)L.push(B),L.push(M.defines[B]);return M.isRawShaderMaterial===!1&&(x(L,M),S(L,M),L.push(n.outputEncoding)),L.push(M.customProgramCacheKey),L.join()}function x(M,L){M.push(L.precision),M.push(L.outputEncoding),M.push(L.envMapMode),M.push(L.envMapCubeUVHeight),M.push(L.combine),M.push(L.vertexUvs),M.push(L.fogExp2),M.push(L.sizeAttenuation),M.push(L.morphTargetsCount),M.push(L.morphAttributeCount),M.push(L.numDirLights),M.push(L.numPointLights),M.push(L.numSpotLights),M.push(L.numSpotLightMaps),M.push(L.numHemiLights),M.push(L.numRectAreaLights),M.push(L.numDirLightShadows),M.push(L.numPointLightShadows),M.push(L.numSpotLightShadows),M.push(L.numSpotLightShadowsWithMaps),M.push(L.shadowMapType),M.push(L.toneMapping),M.push(L.numClippingPlanes),M.push(L.numClipIntersection),M.push(L.depthPacking)}function S(M,L){o.disableAll(),L.isWebGL2&&o.enable(0),L.supportsVertexTextures&&o.enable(1),L.instancing&&o.enable(2),L.instancingColor&&o.enable(3),L.map&&o.enable(4),L.matcap&&o.enable(5),L.envMap&&o.enable(6),L.lightMap&&o.enable(7),L.aoMap&&o.enable(8),L.emissiveMap&&o.enable(9),L.bumpMap&&o.enable(10),L.normalMap&&o.enable(11),L.objectSpaceNormalMap&&o.enable(12),L.tangentSpaceNormalMap&&o.enable(13),L.clearcoat&&o.enable(14),L.clearcoatMap&&o.enable(15),L.clearcoatRoughnessMap&&o.enable(16),L.clearcoatNormalMap&&o.enable(17),L.iridescence&&o.enable(18),L.iridescenceMap&&o.enable(19),L.iridescenceThicknessMap&&o.enable(20),L.displacementMap&&o.enable(21),L.specularMap&&o.enable(22),L.roughnessMap&&o.enable(23),L.metalnessMap&&o.enable(24),L.gradientMap&&o.enable(25),L.alphaMap&&o.enable(26),L.alphaTest&&o.enable(27),L.vertexColors&&o.enable(28),L.vertexAlphas&&o.enable(29),L.vertexUvs&&o.enable(30),L.vertexTangents&&o.enable(31),L.uvsVertexOnly&&o.enable(32),M.push(o.mask),o.disableAll(),L.fog&&o.enable(0),L.useFog&&o.enable(1),L.flatShading&&o.enable(2),L.logarithmicDepthBuffer&&o.enable(3),L.skinning&&o.enable(4),L.morphTargets&&o.enable(5),L.morphNormals&&o.enable(6),L.morphColors&&o.enable(7),L.premultipliedAlpha&&o.enable(8),L.shadowMapEnabled&&o.enable(9),L.physicallyCorrectLights&&o.enable(10),L.doubleSided&&o.enable(11),L.flipSided&&o.enable(12),L.useDepthPacking&&o.enable(13),L.dithering&&o.enable(14),L.specularIntensityMap&&o.enable(15),L.specularColorMap&&o.enable(16),L.transmission&&o.enable(17),L.transmissionMap&&o.enable(18),L.thicknessMap&&o.enable(19),L.sheen&&o.enable(20),L.sheenColorMap&&o.enable(21),L.sheenRoughnessMap&&o.enable(22),L.decodeVideoTexture&&o.enable(23),L.opaque&&o.enable(24),M.push(o.mask)}function y(M){const L=v[M.type];let B;if(L){const Z=ShaderLib[L];B=UniformsUtils.clone(Z.uniforms)}else B=M.uniforms;return B}function b(M,L){let B;for(let Z=0,W=c.length;Z<W;Z++){const X=c[Z];if(X.cacheKey===L){B=X,++B.usedTimes;break}}return B===void 0&&(B=new WebGLProgram(n,L,M,s),c.push(B)),B}function w(M){if(--M.usedTimes===0){const L=c.indexOf(M);c[L]=c[c.length-1],c.pop(),M.destroy()}}function C(M){l.remove(M)}function R(){l.dispose()}return{getParameters:_,getProgramCacheKey:g,getUniforms:y,acquireProgram:b,releaseProgram:w,releaseShaderCache:C,programs:c,dispose:R}}function WebGLProperties(){let n=new WeakMap;function e(s){let a=n.get(s);return a===void 0&&(a={},n.set(s,a)),a}function t(s){n.delete(s)}function i(s,a,o){n.get(s)[a]=o}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function painterSortStable(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function reversePainterSortStable(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function WebGLRenderList(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(d,f,m,v,_,g){let x=n[e];return x===void 0?(x={id:d.id,object:d,geometry:f,material:m,groupOrder:v,renderOrder:d.renderOrder,z:_,group:g},n[e]=x):(x.id=d.id,x.object=d,x.geometry=f,x.material=m,x.groupOrder=v,x.renderOrder=d.renderOrder,x.z=_,x.group=g),e++,x}function o(d,f,m,v,_,g){const x=a(d,f,m,v,_,g);m.transmission>0?i.push(x):m.transparent===!0?r.push(x):t.push(x)}function l(d,f,m,v,_,g){const x=a(d,f,m,v,_,g);m.transmission>0?i.unshift(x):m.transparent===!0?r.unshift(x):t.unshift(x)}function c(d,f){t.length>1&&t.sort(d||painterSortStable),i.length>1&&i.sort(f||reversePainterSortStable),r.length>1&&r.sort(f||reversePainterSortStable)}function u(){for(let d=e,f=n.length;d<f;d++){const m=n[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function WebGLRenderLists(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new WebGLRenderList,n.set(i,[a])):r>=s.length?(a=new WebGLRenderList,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function UniformsCache(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Vector3,color:new Color};break;case"SpotLight":t={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":t={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3};break}return n[e.id]=t,t}}}function ShadowUniformsCache(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let nextVersion=0;function shadowCastingAndTexturingLightsFirst(n,e){return(e.castShadow?2:0)-(n.
vendor: 7,426 bytes, lines 3116-3122
3116castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function WebGLLights(n,e){const t=new UniformsCache,i=ShadowUniformsCache(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)r.probe.push(new Vector3);const s=new Vector3,a=new Matrix4,o=new Matrix4;function l(u,d){let f=0,m=0,v=0;for(let Z=0;Z<9;Z++)r.probe[Z].set(0,0,0);let _=0,g=0,x=0,S=0,y=0,b=0,w=0,C=0,R=0,M=0;u.sort(shadowCastingAndTexturingLightsFirst);const L=d!==!0?Math.PI:1;for(let Z=0,W=u.length;Z<W;Z++){const X=u[Z],G=X.color,le=X.intensity,he=X.distance,ue=X.shadow&&X.shadow.map?X.shadow.map.texture:null;if(X.isAmbientLight)f+=G.r*le*L,m+=G.g*le*L,v+=G.b*le*L;else if(X.isLightProbe)for(let ie=0;ie<9;ie++)r.probe[ie].addScaledVector(X.sh.coefficients[ie],le);else if(X.isDirectionalLight){const ie=t.get(X);if(ie.color.copy(X.color).multiplyScalar(X.intensity*L),X.castShadow){const ve=X.shadow,_e=i.get(X);_e.shadowBias=ve.bias,_e.shadowNormalBias=ve.normalBias,_e.shadowRadius=ve.radius,_e.shadowMapSize=ve.mapSize,r.directionalShadow[_]=_e,r.directionalShadowMap[_]=ue,r.directionalShadowMatrix[_]=X.shadow.matrix,b++}r.directional[_]=ie,_++}else if(X.isSpotLight){const ie=t.get(X);ie.position.setFromMatrixPosition(X.matrixWorld),ie.color.copy(G).multiplyScalar(le*L),ie.distance=he,ie.coneCos=Math.cos(X.angle),ie.penumbraCos=Math.cos(X.angle*(1-X.penumbra)),ie.decay=X.decay,r.spot[x]=ie;const ve=X.shadow;if(X.map&&(r.spotLightMap[R]=X.map,R++,ve.updateMatrices(X),X.castShadow&&M++),r.spotLightMatrix[x]=ve.matrix,X.castShadow){const _e=i.get(X);_e.shadowBias=ve.bias,_e.shadowNormalBias=ve.normalBias,_e.shadowRadius=ve.radius,_e.shadowMapSize=ve.mapSize,r.spotShadow[x]=_e,r.spotShadowMap[x]=ue,C++}x++}else if(X.isRectAreaLight){const ie=t.get(X);ie.color.copy(G).multiplyScalar(le),ie.halfWidth.set(X.width*.5,0,0),ie.halfHeight.set(0,X.height*.5,0),r.rectArea[S]=ie,S++}else if(X.isPointLight){const ie=t.get(X);if(ie.color.copy(X.color).multiplyScalar(X.intensity*L),ie.distance=X.distance,ie.decay=X.decay,X.castShadow){const ve=X.shadow,_e=i.get(X);_e.shadowBias=ve.bias,_e.shadowNormalBias=ve.normalBias,_e.shadowRadius=ve.radius,_e.shadowMapSize=ve.mapSize,_e.shadowCameraNear=ve.camera.near,_e.shadowCameraFar=ve.camera.far,r.pointShadow[g]=_e,r.pointShadowMap[g]=ue,r.pointShadowMatrix[g]=X.shadow.matrix,w++}r.point[g]=ie,g++}else if(X.isHemisphereLight){const ie=t.get(X);ie.skyColor.copy(X.color).multiplyScalar(le*L),ie.groundColor.copy(X.groundColor).multiplyScalar(le*L),r.hemi[y]=ie,y++}}S>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=UniformsLib.LTC_FLOAT_1,r.rectAreaLTC2=UniformsLib.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=UniformsLib.LTC_HALF_1,r.rectAreaLTC2=UniformsLib.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=m,r.ambient[2]=v;const B=r.hash;(B.directionalLength!==_||B.pointLength!==g||B.spotLength!==x||B.rectAreaLength!==S||B.hemiLength!==y||B.numDirectionalShadows!==b||B.numPointShadows!==w||B.numSpotShadows!==C||B.numSpotMaps!==R)&&(r.directional.length=_,r.spot.length=x,r.rectArea.length=S,r.point.length=g,r.hemi.length=y,r.directionalShadow.length=b,r.directionalShadowMap.length=b,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=b,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=C+R-M,r.spotLightMap.length=R,r.numSpotLightShadowsWithMaps=M,B.directionalLength=_,B.pointLength=g,B.spotLength=x,B.rectAreaLength=S,B.hemiLength=y,B.numDirectionalShadows=b,B.numPointShadows=w,B.numSpotShadows=C,B.numSpotMaps=R,r.version=nextVersion++)}function c(u,d){let f=0,m=0,v=0,_=0,g=0;const x=d.matrixWorldInverse;for(let S=0,y=u.length;S<y;S++){const b=u[S];if(b.isDirectionalLight){const w=r.directional[f];w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(x),f++}else if(b.isSpotLight){const w=r.spot[v];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(x),w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(x),v++}else if(b.isRectAreaLight){const w=r.rectArea[_];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(x),o.identity(),a.copy(b.matrixWorld),a.premultiply(x),o.extractRotation(a),w.halfWidth.set(b.width*.5,0,0),w.halfHeight.set(0,b.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),_++}else if(b.isPointLight){const w=r.point[m];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(x),m++}else if(b.isHemisphereLight){const w=r.hemi[g];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(x),g++}}}return{setup:l,setupView:c,state:r}}function WebGLRenderState(n,e){const t=new WebGLLights(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function a(d){i.push(d)}function o(d){r.push(d)}function l(d){t.setup(i,d)}function c(d){t.setupView(i,d)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function WebGLRenderStates(n,e){let t=new WeakMap;function i(s,a=0){const o=t.get(s);let l;return o===void 0?(l=new WebGLRenderState(n,e),t.set(s,[l])):a>=o.length?(l=new WebGLRenderState(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class MeshDepthMaterial extends Material{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=BasicDepthPacking,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class MeshDistanceMaterial extends Material{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Vector3,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const vertex=`void main() { 3117 gl_Position = vec4( position, 1.0 ); 3118}`,fragment=`uniform sampler2D shadow_pass; 3119uniform vec2 resolution; 3120uniform float radius; 3121#include <packing> 3122void main() {
3123 const float samples = float( VSM_SAMPLES ); 3124 float mean = 0.0; 3125 float squared_mean = 0.0; 3126 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3127 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3128 for ( float i = 0.0; i < samples; i ++ ) { 3129 float uvOffset = uvStart + i * uvStride; 3130 #ifdef HORIZONTAL_PASS 3131 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3132 mean += distribution.x; 3133 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3134 #else 3135 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3136 mean += depth; 3137 squared_mean += depth * depth; 3138 #endif 3139 } 3140 mean = mean / samples; 3141 squared_mean = squared_mean / samples; 3142 float std_dev = sqrt( squared_mean - mean * mean ); 3143 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3144}`;function WebGLShadowMap(n,e,t){let i=new Frustum;const r=new Vector2,s=new Vector2,a=new Vector4,o=new MeshDepthMaterial({depthPacking:RGBADepthPacking}),l=new MeshDistanceMaterial,c={},u=t.maxTextureSize,d={0:BackSide,1:FrontSide,2:DoubleSide},f=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:vertex,fragmentShader:fragment}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const v=new BufferGeometry;v.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Mesh(v,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=PCFShadowMap,this.render=function(b,w,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const R=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),B=n.state;B.setBlending(NoBlending),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);for(let Z=0,W=b.length;Z<W;Z++){const X=b[Z],G=X.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",X,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const le=G.getFrameExtents();if(r.multiply(le),s.copy(G.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/le.x),r.x=s.x*le.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/le.y),r.y=s.y*le.y,G.mapSize.y=s.y)),G.map===null){const ue=this.type!==VSMShadowMap?{minFilter:NearestFilter,magFilter:NearestFilter}:{};G.map=new WebGLRenderTarget(r.x,r.y,ue),G.map.texture.name=X.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const he=G.getViewportCount();for(let ue=0;ue<he;ue++){const ie=G.getViewport(ue);a.set(s.x*ie.x,s.y*ie.y,s.x*ie.z,s.y*ie.w),B.viewport(a),G.updateMatrices(X,ue),i=G.getFrustum(),y(w,C,G.camera,X,this.type)}G.isPointLightShadow!==!0&&this.type===VSMShadowMap&&x(G,C),G.needsUpdate=!1}g.needsUpdate=!1,n.setRenderTarget(R,M,L)};function x(b,w){const C=e.update(_);f.defines.VSM_SAMPLES!==b.blurSamples&&(f.defines.VSM_SAMPLES=b.blurSamples,m.defines.VSM_SAMPLES=b.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new WebGLRenderTarget(r.x,r.y)),f.uniforms.shadow_pass.value=b.map.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,n.setRenderTarget(b.mapPass),n.clear(),n.renderBufferDirect(w,null,C,f,_,null),m.uniforms.shadow_pass.value=b.mapPass.texture,m.uniforms.resolution.value=b.mapSize,m.uniforms.radius.value=b.radius,n.setRenderTarget(b.map),n.clear(),n.renderBufferDirect(w,null,C,m,_,null)}function S(b,w,C,R,M,L){let B=null;const Z=C.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(Z!==void 0?B=Z:B=C.isPointLight===!0?l:o,n.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const W=B.uuid,X=w.uuid;let G=c[W];G===void 0&&(G={},c[W]=G);let le=G[X];le===void 0&&(le=B.clone(),G[X]=le),B=le}return B.visible=w.visible,B.wireframe=w.wireframe,L===VSMShadowMap?B.side=w.shadowSide!==null?w.shadowSide:w.side:B.side=w.shadowSide!==null?w.shadowSide:d[w.side],B.alphaMap=w.alphaMap,B.alphaTest=w.alphaTest,B.map=w.map,B.clipShadows=w.clipShadows,B.clippingPlanes=w.clippingPlanes,B.clipIntersection=w.clipIntersection,B.displacementMap=w.displacementMap,B.displacementScale=w.displacementScale,B.displacementBias=w.displacementBias,B.wireframeLinewidth=w.wireframeLinewidth,B.linewidth=w.linewidth,C.isPointLight===!0&&B.isMeshDistanceMaterial===!0&&(B.referencePosition.setFromMatrixPosition(C.matrixWorld),B.nearDistance=R,B.farDistance=M),B}function y(b,w,C,R,M){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===VSMShadowMap)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,b.matrixWorld);const Z=e.update(b),W=b.material;if(Array.isArray(W)){const X=Z.groups;for(let G=0,le=X.length;G<le;G++){const he=X[G],ue=W[he.materialIndex];if(ue&&ue.visible){const ie=S(b,ue,R,C.near,C.far,M);n.renderBufferDirect(C,null,Z,ie,b,he)}}}else if(W.visible){const X=S(b,W,R,C.near,C.far,M);n.renderBufferDirect(C,null,Z,X,b,null)}}const B=b.children;for(let Z=0,W=B.length;Z<W;Z++)y(B[Z],w,C,R,M)}}function WebGLState(n,e,t){const i=t.isWebGL2;function r(){let q=!1;const fe=new Vector4;let Se=null;const Ae=new Vector4(0,0,0,0);return{setMask:function(Oe){Se!==Oe&&!q&&(n.colorMask(Oe,Oe,Oe,Oe),Se=Oe)},setLocked:function(Oe){q=Oe},setClear:function(Oe,Xe,tt,it,vt){vt===!0&&(Oe*=it,Xe*=it,tt*=it),fe.set(Oe,Xe,tt,it),Ae.equals(fe)===!1&&(n.clearColor(Oe,Xe,tt,it),Ae.copy(fe))},reset:function(){q=!1,Se=null,Ae.set(-1,0,0,0)}}}function s(){let q=!1,fe=null,Se=null,Ae=null;return{setTest:function(Oe){Oe?Le(2929):Ee(2929)},setMask:function(Oe){fe!==Oe&&!q&&(n.depthMask(Oe),fe=Oe)},setFunc:function(Oe){if(Se!==Oe){switch(Oe){case NeverDepth:n.depthFunc(512);break;case AlwaysDepth:n.depthFunc(519);break;case LessDepth:n.depthFunc(513);break;
3144case LessEqualDepth:n.depthFunc(515);break;case EqualDepth:n.depthFunc(514);break;case GreaterEqualDepth:n.depthFunc(518);break;case GreaterDepth:n.depthFunc(516);break;case NotEqualDepth:n.depthFunc(517);break;default:n.depthFunc(515)}Se=Oe}},setLocked:function(Oe){q=Oe},setClear:function(Oe){Ae!==Oe&&(n.clearDepth(Oe),Ae=Oe)},reset:function(){q=!1,fe=null,Se=null,Ae=null}}}function a(){let q=!1,fe=null,Se=null,Ae=null,Oe=null,Xe=null,tt=null,it=null,vt=null;return{setTest:function(Ke){q||(Ke?Le(2960):Ee(2960))},setMask:function(Ke){fe!==Ke&&!q&&(n.stencilMask(Ke),fe=Ke)},setFunc:function(Ke,mt,ut){(Se!==Ke||Ae!==mt||Oe!==ut)&&(n.stencilFunc(Ke,mt,ut),Se=Ke,Ae=mt,Oe=ut)},setOp:function(Ke,mt,ut){(Xe!==Ke||tt!==mt||it!==ut)&&(n.stencilOp(Ke,mt,ut),Xe=Ke,tt=mt,it=ut)},setLocked:function(Ke){q=Ke},setClear:function(Ke){vt!==Ke&&(n.clearStencil(Ke),vt=Ke)},reset:function(){q=!1,fe=null,Se=null,Ae=null,Oe=null,Xe=null,tt=null,it=null,vt=null}}}const o=new r,l=new s,c=new a,u=new WeakMap,d=new WeakMap;let f={},m={},v=new WeakMap,_=[],g=null,x=!1,S=null,y=null,b=null,w=null,C=null,R=null,M=null,L=!1,B=null,Z=null,W=null,X=null,G=null;const le=n.getParameter(35661);let he=!1,ue=0;const ie=n.getParameter(7938);ie.indexOf("WebGL")!==-1?(ue=parseFloat(/^WebGL (\d)/.exec(ie)[1]),he=ue>=1):ie.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(ie)[1]),he=ue>=2);let ve=null,_e={};const Q=n.getParameter(3088),ne=n.getParameter(2978),ye=new Vector4().fromArray(Q),Me=new Vector4().fromArray(ne);function Te(q,fe,Se){const Ae=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(q,Oe),n.texParameteri(q,10241,9728),n.texParameteri(q,10240,9728);for(let Xe=0;Xe<Se;Xe++)n.texImage2D(fe+Xe,0,6408,1,1,0,6408,5121,Ae);return Oe}const ae={};ae[3553]=Te(3553,3553,1),ae[34067]=Te(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Le(2929),l.setFunc(LessEqualDepth),Y(!1),ce(CullFaceBack),Le(2884),H(NoBlending);function Le(q){f[q]!==!0&&(n.enable(q),f[q]=!0)}function Ee(q){f[q]!==!1&&(n.disable(q),f[q]=!1)}function Ce(q,fe){return m[q]!==fe?(n.bindFramebuffer(q,fe),m[q]=fe,i&&(q===36009&&(m[36160]=fe),q===36160&&(m[36009]=fe)),!0):!1}function we(q,fe){let Se=_,Ae=!1;if(q)if(Se=v.get(fe),Se===void 0&&(Se=[],v.set(fe,Se)),q.isWebGLMultipleRenderTargets){const Oe=q.texture;if(Se.length!==Oe.length||Se[0]!==36064){for(let Xe=0,tt=Oe.length;Xe<tt;Xe++)Se[Xe]=36064+Xe;Se.length=Oe.length,Ae=!0}}else Se[0]!==36064&&(Se[0]=36064,Ae=!0);else Se[0]!==1029&&(Se[0]=1029,Ae=!0);Ae&&(t.isWebGL2?n.drawBuffers(Se):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Se))}function O(q){return g!==q?(n.useProgram(q),g=q,!0):!1}const D={[AddEquation]:32774,[SubtractEquation]:32778,[ReverseSubtractEquation]:32779};if(i)D[MinEquation]=32775,D[MaxEquation]=32776;else{const q=e.get("EXT_blend_minmax");q!==null&&(D[MinEquation]=q.MIN_EXT,D[MaxEquation]=q.MAX_EXT)}const k={[ZeroFactor]:0,[OneFactor]:1,[SrcColorFactor]:768,[SrcAlphaFactor]:770,[SrcAlphaSaturateFactor]:776,[DstColorFactor]:774,[DstAlphaFactor]:772,[OneMinusSrcColorFactor]:769,[OneMinusSrcAlphaFactor]:771,[OneMinusDstColorFactor]:775,[OneMinusDstAlphaFactor]:773};function H(q,fe,Se,Ae,Oe,Xe,tt,it){if(q===NoBlending){x===!0&&(Ee(3042),x=!1);return}if(x===!1&&(Le(3042),x=!0),q!==CustomBlending){if(q!==S||it!==L){if((y!==AddEquation||C!==AddEquation)&&(n.blendEquation(32774),y=AddEquation,C=AddEquation),it)switch(q){case NormalBlending:n.blendFuncSeparate(1,771,1,771);break;case AdditiveBlending:n.blendFunc(1,1);break;case SubtractiveBlending:n.blendFuncSeparate(0,769,0,1);break;case MultiplyBlending:n.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",q);break}else switch(q){case NormalBlending:n.blendFuncSeparate(770,771,1,771);break;case AdditiveBlending:n.blendFunc(770,1);break;case SubtractiveBlending:n.blendFuncSeparate(0,769,0,1);break;case MultiplyBlending:n.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",q);break}b=null,w=null,R=null,M=null,S=q,L=it}return}Oe=Oe||fe,Xe=Xe||Se,tt=tt||Ae,(fe!==y||Oe!==C)&&(n.blendEquationSeparate(D[fe],D[Oe]),y=fe,C=Oe),(Se!==b||Ae!==w||Xe!==R||tt!==M)&&(n.blendFuncSeparate(k[Se],k[Ae],k[Xe],k[tt]),b=Se,w=Ae,R=Xe,M=tt),S=q,L=!1}function j(q,fe){q.side===DoubleSide?Ee(2884):Le(2884);let Se=q.side===BackSide;fe&&(Se=!Se),Y(Se),q.blending===NormalBlending&&q.transparent===!1?H(NoBlending):H(q.blending,q.blendEquation,q.blendSrc,q.blendDst,q.blendEquationAlpha,q.blendSrcAlpha,q.blendDstAlpha,q.premultipliedAlpha),l.setFu
vendor: 7,441 bytes, line 3144
3144nc(q.depthFunc),l.setTest(q.depthTest),l.setMask(q.depthWrite),o.setMask(q.colorWrite);const Ae=q.stencilWrite;c.setTest(Ae),Ae&&(c.setMask(q.stencilWriteMask),c.setFunc(q.stencilFunc,q.stencilRef,q.stencilFuncMask),c.setOp(q.stencilFail,q.stencilZFail,q.stencilZPass)),se(q.polygonOffset,q.polygonOffsetFactor,q.polygonOffsetUnits),q.alphaToCoverage===!0?Le(32926):Ee(32926)}function Y(q){B!==q&&(q?n.frontFace(2304):n.frontFace(2305),B=q)}function ce(q){q!==CullFaceNone?(Le(2884),q!==Z&&(q===CullFaceBack?n.cullFace(1029):q===CullFaceFront?n.cullFace(1028):n.cullFace(1032))):Ee(2884),Z=q}function re(q){q!==W&&(he&&n.lineWidth(q),W=q)}function se(q,fe,Se){q?(Le(32823),(X!==fe||G!==Se)&&(n.polygonOffset(fe,Se),X=fe,G=Se)):Ee(32823)}function P(q){q?Le(3089):Ee(3089)}function N(q){q===void 0&&(q=33984+le-1),ve!==q&&(n.activeTexture(q),ve=q)}function T(q,fe,Se){Se===void 0&&(ve===null?Se=33984+le-1:Se=ve);let Ae=_e[Se];Ae===void 0&&(Ae={type:void 0,texture:void 0},_e[Se]=Ae),(Ae.type!==q||Ae.texture!==fe)&&(ve!==Se&&(n.activeTexture(Se),ve=Se),n.bindTexture(q,fe||ae[q]),Ae.type=q,Ae.texture=fe)}function E(){const q=_e[ve];q!==void 0&&q.type!==void 0&&(n.bindTexture(q.type,null),q.type=void 0,q.texture=void 0)}function z(){try{n.compressedTexImage2D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function K(){try{n.compressedTexImage3D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function V(){try{n.texSubImage2D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function $(){try{n.texSubImage3D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function be(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function ge(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function oe(){try{n.texStorage2D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function Ie(){try{n.texStorage3D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function Ne(){try{n.texImage2D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function Fe(){try{n.texImage3D.apply(n,arguments)}catch(q){console.error("THREE.WebGLState:",q)}}function Re(q){ye.equals(q)===!1&&(n.scissor(q.x,q.y,q.z,q.w),ye.copy(q))}function De(q){Me.equals(q)===!1&&(n.viewport(q.x,q.y,q.z,q.w),Me.copy(q))}function We(q,fe){let Se=d.get(fe);Se===void 0&&(Se=new WeakMap,d.set(fe,Se));let Ae=Se.get(q);Ae===void 0&&(Ae=n.getUniformBlockIndex(fe,q.name),Se.set(q,Ae))}function je(q,fe){const Ae=d.get(fe).get(q);u.get(q)!==Ae&&(n.uniformBlockBinding(fe,Ae,q.__bindingPointIndex),u.set(q,Ae))}function et(){n.disable(3042),n.disable(2884),n.disable(2929),n.disable(32823),n.disable(3089),n.disable(2960),n.disable(32926),n.blendEquation(32774),n.blendFunc(1,0),n.blendFuncSeparate(1,0,1,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(513),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(519,0,4294967295),n.stencilOp(7680,7680,7680),n.clearStencil(0),n.cullFace(1029),n.frontFace(2305),n.polygonOffset(0,0),n.activeTexture(33984),n.bindFramebuffer(36160,null),i===!0&&(n.bindFramebuffer(36009,null),n.bindFramebuffer(36008,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),f={},ve=null,_e={},m={},v=new WeakMap,_=[],g=null,x=!1,S=null,y=null,b=null,w=null,C=null,R=null,M=null,L=!1,B=null,Z=null,W=null,X=null,G=null,ye.set(0,0,n.canvas.width,n.canvas.height),Me.set(0,0,n.canvas.width,n.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Le,disable:Ee,bindFramebuffer:Ce,drawBuffers:we,useProgram:O,setBlending:H,setMaterial:j,setFlipSided:Y,setCullFace:ce,setLineWidth:re,setPolygonOffset:se,setScissorTest:P,activeTexture:N,bindTexture:T,unbindTexture:E,compressedTexImage2D:z,compressedTexImage3D:K,texImage2D:Ne,texImage3D:Fe,updateUBOMapping:We,uniformBlockBinding:je,texStorage2D:oe,texStorage3D:Ie,texSubImage2D:V,texSubImage3D:$,compressedTexSubImage2D:be,compressedTexSubImage3D:ge,scissor:Re,viewport:De,reset:et}}function WebGLTextures(n,e,t,i,r,s,a){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,u=r.maxTextureSize,d=r.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let _;const g=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(T,E){return x?new OffscreenCanvas(T,E):createElementNS("canvas")}function y(T,E,z,K){let V=1;if((T.width>K||T.height>K)&&(V=K/Math.max(T.width,T.height)),V<1||E===!0)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap){const $=E?floorPowerOfTwo:Math.floor,be=$(V*T.width),ge=$(V*T.height);_===void 0&&(_=S(be,ge));const oe=z?S(be,ge):_;return oe.width=be,oe.height=ge,oe.getContext("2d").drawImage(T,0,0,be,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+be+"x"+ge+")."),oe}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function b(T){return isPowerOfTwo(T.width)&&isPowerOfTwo(T.height)}function w(T){return o?!1:T.wrapS!==ClampToEdgeWrapping||T.wrapT!==ClampToEdgeWrapping||T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter}function C(T,E){return T.generateMipmaps&&E&&T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter}function R(T){n.generateMipmap(T)}function M(T,E,z,K,V=!1){if(o===!1)return E;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let $=E;return E===6403&&(z===5126&&($=33326),z===5131&&($=33325),z===5121&&($=33321)),E===33319&&(z===5126&&($=33328),z===5131&&($=33327),z===5121&&($=33323)),E===6408&&(z===5126&&($=34836),z===5131&&($=34842),z===5121&&($=K===sRGBEncoding&&V===!1?35907:32856),z===32819&&($=32854),z===32820&&($=32855)),($===33325||$===33326||$===33327||$===33328||$===34842||$===34836)&&e.get("EXT_color_buffer_float"),$}function L(T,E,z){return C(T,z)===!0||T.isFramebufferTexture&&T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter?Math.log2(Math.max(E.width,E.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?E.mipmaps.length:1}function B(T){return T===NearestFilter||T===NearestMipmapNearestFilter||T===NearestMipmapLinearFilter?9728:9729}function Z(T){const E=T.target;E.removeEventListener("dispose",Z),X(E),E.isVideoTexture&&v.delete(E)}function W(T){const E=T.target;E.removeEventListener("dispose",W),le(E)}function X(T){const E=i.get(T);if(E.__webglInit===void 0)return;const z=T.source,K=g.get(z);if(K){const V=K[E.__cacheKey];V.usedTimes--,V.usedTimes===0&&G(T),Object.keys(K).length===0&&g.delete(z)}i.remove(T)}function G(T){const E=i.get(T);n.deleteTexture(E.__webglTexture);const z=T.source,K=g.get(z);delete K[E.__cacheKey],a.memory.textures--}function le(T){const E=T.texture,z=i.get(T),K=i.get(E);if(K.__webglTexture!==void 0&&(n.deleteTexture(K.__webglTexture),a.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRen
3144derTarget)for(let V=0;V<6;V++)n.deleteFramebuffer(z.__webglFramebuffer[V]),z.__webglDepthbuffer&&n.deleteRenderbuffer(z.__webglDepthbuffer[V]);else{if(n.deleteFramebuffer(z.__webglFramebuffer),z.__webglDepthbuffer&&n.deleteRenderbuffer(z.__webglDepthbuffer),z.__webglMultisampledFramebuffer&&n.deleteFramebuffer(z.__webglMultisampledFramebuffer),z.__webglColorRenderbuffer)for(let V=0;V<z.__webglColorRenderbuffer.length;V++)z.__webglColorRenderbuffer[V]&&n.deleteRenderbuffer(z.__webglColorRenderbuffer[V]);z.__webglDepthRenderbuffer&&n.deleteRenderbuffer(z.__webglDepthRenderbuffer)}if(T.isWebGLMultipleRenderTargets)for(let V=0,$=E.length;V<$;V++){const be=i.get(E[V]);be.__webglTexture&&(n.deleteTexture(be.__webglTexture),a.memory.textures--),i.remove(E[V])}i.remove(E),i.remove(T)}let he=0;function ue(){he=0}function ie(){const T=he;return T>=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),he+=1,T}function ve(T){const E=[];return E.push(T.wrapS),E.push(T.wrapT),E.push(T.wrapR||0),E.push(T.magFilter),E.push(T.minFilter),E.push(T.anisotropy),E.push(T.internalFormat),E.push(T.format),E.push(T.type),E.push(T.generateMipmaps),E.push(T.premultiplyAlpha),E.push(T.flipY),E.push(T.unpackAlignment),E.push(T.encoding),E.join()}function _e(T,E){const z=i.get(T);if(T.isVideoTexture&&P(T),T.isRenderTargetTexture===!1&&T.version>0&&z.__version!==T.version){const K=T.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(z,T,E);return}}t.bindTexture(3553,z.__webglTexture,33984+E)}function Q(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ee(z,T,E);return}t.bindTexture(35866,z.__webglTexture,33984+E)}function ne(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ee(z,T,E);return}t.bindTexture(32879,z.__webglTexture,33984+E)}function ye(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ce(z,T,E);return}t.bindTexture(34067,z.__webglTexture,33984+E)}const Me={[RepeatWrapping]:10497,[ClampToEdgeWrapping]:33071,[MirroredRepeatWrapping]:33648},Te={[NearestFilter]:9728,[NearestMipmapNearestFilter]:9984,[NearestMipmapLinearFilter]:9986,[LinearFilter]:9729,[LinearMipmapNearestFilter]:9985,[LinearMipmapLinearFilter]:9987};function ae(T,E,z){if(z?(n.texParameteri(T,10242,Me[E.wrapS]),n.texParameteri(T,10243,Me[E.wrapT]),(T===32879||T===35866)&&n.texParameteri(T,32882,Me[E.wrapR]),n.texParameteri(T,10240,Te[E.magFilter]),n.texParameteri(T,10241,Te[E.minFilter])):(n.texParameteri(T,10242,33071),n.texParameteri(T,10243,33071),(T===32879||T===35866)&&n.texParameteri(T,32882,33071),(E.wrapS!==ClampToEdgeWrapping||E.wrapT!==ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,10240,B(E.magFilter)),n.texParameteri(T,10241,B(E.minFilter)),E.minFilter!==NearestFilter&&E.minFilter!==LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const K=e.get("EXT_texture_filter_anisotropic");if(E.type===FloatType&&e.has("OES_texture_float_linear")===!1||o===!1&&E.type===HalfFloatType&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||i.get(E).__currentAnisotropy)&&(n.texParameterf(T,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,r.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy)}}function Le(T,E){let z=!1;T.__webglInit===void 0&&(T.__webglInit=!0,E.addEventListener("dispose",Z));const K=E.source;let V=g.get(K);V===void 0&&(V={},g.set(K,V));const $=ve(E);if($!==T.__cacheKey){V[$]===void 0&&(V[$]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,z=!0),V[$].usedTimes++;const be=V[T.__cacheKey];be!==void 0&&(V[T.__cacheKey].usedTimes--,be.usedTimes===0&&G(E)),T.__cacheKey=$,T.__webglTexture=V[$].texture}return z}function Ee(T,E,z){let K=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(K=35866),E.isData3DTexture&&(K=32879);const V=Le(T,E),$=E.source;t.bindTexture(K,T.__webglTexture,33984+z);const be=i.get($);if($.version!==be.__version||V===!0){t.activeTexture(33984+z),n.pixelStorei(37440,E.flipY),n.pixelStorei(37441,E.premultiplyAlpha),n.pixelStorei(3317,E.unpackAlignment),n.pixelStorei(37443,0);const ge=w(E)&&b(E.image)===!1;let oe=y(E.image,ge,!1,u);oe=N(E,oe);const Ie=b(oe)||o,Ne=s.convert(E.format,E.encoding);let Fe=s.convert(E.type),Re=M(E.internalFormat,Ne,Fe,E.encoding,E.isVideoTexture);ae(K,E,Ie);let De;const We=E.mipmaps,je=o&&E.isVideoTexture!==!0,et=be.__version===void 0||V===!0,q=L(E,oe,Ie);if(E.isDepthTexture)Re=6402,o?E.type===FloatType?Re=36012:E.type===UnsignedIntType?Re=33190:E.type===UnsignedInt248Type?Re=35056:Re=33189:E.type===FloatType&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===DepthFormat&&Re===6402&&E.type!==UnsignedShortType&&E.type!==UnsignedIntType&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=UnsignedIntType,Fe=s.convert(E.type)),E.format===DepthStencilFormat&&Re===6402&&(Re=34041,E.type!==UnsignedInt248Type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=UnsignedInt248Type,Fe=s.convert(E.type))),et&&(je?t.texStorage2D(3553,1,Re,oe.width,oe.height):t.texImage2D(3553,0,Re,oe.width,oe.height,0,Ne,Fe,null));else if(E.isDataTexture)if(We.length>0&&Ie){je&&et&&t.texStorage2D(3553,q,Re,We[0].width,We[0].height);for(let fe=0,Se=We.length;fe<Se;fe++)De=We[fe],je?t.texSubImage2D(3553,fe,0,0,De.width,De.height,Ne,Fe,De.data):t.texImage2D(3553,fe,Re,De.width,De.height,0,Ne,Fe,De.data);E.generateMipmaps=!1}else je?(et&&t.texStorage2D(3553,q,Re,oe.width,oe.height),t.texSubImage2D(3553,0,0,0,oe.width,oe.height,Ne,Fe,oe.data)):t.texImage2D(3553,0,Re,oe.width,oe.height,0,Ne,Fe,oe.data);else if(E.isCompressedTexture)if(E.isCompressedArrayTexture){je&&et&&t.texStorage3D(35866,q,Re,We[0].width,We[0].height,oe.depth);for(let fe=0,Se=We.length;fe<Se;fe++)De=We[fe],E.format!==RGBAFormat?Ne!==null?je?t.compressedTexSubImage3D(35866,fe,0,0,0,De.width,De.height,oe.depth,Ne,De.data,0,0):t.compressedTexImage3D(35866,fe,Re,De.width,De.height,oe.depth,0,De.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):je?t.texSubImage3D(35866,fe,0,0,0,De.width,De.height,oe.depth,Ne,Fe,De.data):t.texImage3D(35866,fe,Re,De.width,De.height,oe.depth,0,Ne,Fe,De.data)}else{je&&et&&t.texStorage2D(3553,q,Re,We[0].width,We[0].height);for(let fe=0,Se=We.length;fe<Se;fe++)De=We[fe],E.format!==RGBAFormat?Ne!==null?je?t.compressedTexSubImage2D(3553,fe,0,0,De.width,De.height,Ne,De.data):t.compressedTexImage2D(3553,fe,Re,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):je?t.texSubImage2D(3553,fe,0,0,De.width,De.height,Ne,Fe,De.data):t.texImage2D(3553,fe,Re,De.width,De.height,0,Ne,Fe,De.data)}else if(E.isDataArrayTexture)je?(et&&t.texStorage3D(35866,q,Re,oe.width,oe.height,oe.depth),t.texSubImage3D(35866,0,0,0,0,oe.width,oe.height,oe.depth,Ne,Fe,oe.data)):t.texImage3D(35866,0,Re,oe.width,oe.height,oe.depth,0,Ne,Fe,oe.data);else if(E.isData3DTexture)je?(et&&t.texStorage3D(32879,q,Re,oe.width,oe.height,oe.depth),t.texSubImage3D(32879,0,0,0,0,oe.width,oe.height,oe.depth,Ne,Fe,oe.data)):t.texImage3D(32879,0,Re,oe.width,oe.height,oe.depth,0,Ne,Fe,oe.data);else if(E.isFramebufferTexture){if(et)if(je)t.texStorage2D(3553,q,Re,oe.width,oe.height);
vendor: 10,458 bytes, line 3144
3144else{let fe=oe.width,Se=oe.height;for(let Ae=0;Ae<q;Ae++)t.texImage2D(3553,Ae,Re,fe,Se,0,Ne,Fe,null),fe>>=1,Se>>=1}}else if(We.length>0&&Ie){je&&et&&t.texStorage2D(3553,q,Re,We[0].width,We[0].height);for(let fe=0,Se=We.length;fe<Se;fe++)De=We[fe],je?t.texSubImage2D(3553,fe,0,0,Ne,Fe,De):t.texImage2D(3553,fe,Re,Ne,Fe,De);E.generateMipmaps=!1}else je?(et&&t.texStorage2D(3553,q,Re,oe.width,oe.height),t.texSubImage2D(3553,0,0,0,Ne,Fe,oe)):t.texImage2D(3553,0,Re,Ne,Fe,oe);C(E,Ie)&&R(K),be.__version=$.version,E.onUpdate&&E.onUpdate(E)}T.__version=E.version}function Ce(T,E,z){if(E.image.length!==6)return;const K=Le(T,E),V=E.source;t.bindTexture(34067,T.__webglTexture,33984+z);const $=i.get(V);if(V.version!==$.__version||K===!0){t.activeTexture(33984+z),n.pixelStorei(37440,E.flipY),n.pixelStorei(37441,E.premultiplyAlpha),n.pixelStorei(3317,E.unpackAlignment),n.pixelStorei(37443,0);const be=E.isCompressedTexture||E.image[0].isCompressedTexture,ge=E.image[0]&&E.image[0].isDataTexture,oe=[];for(let fe=0;fe<6;fe++)!be&&!ge?oe[fe]=y(E.image[fe],!1,!0,c):oe[fe]=ge?E.image[fe].image:E.image[fe],oe[fe]=N(E,oe[fe]);const Ie=oe[0],Ne=b(Ie)||o,Fe=s.convert(E.format,E.encoding),Re=s.convert(E.type),De=M(E.internalFormat,Fe,Re,E.encoding),We=o&&E.isVideoTexture!==!0,je=$.__version===void 0||K===!0;let et=L(E,Ie,Ne);ae(34067,E,Ne);let q;if(be){We&&je&&t.texStorage2D(34067,et,De,Ie.width,Ie.height);for(let fe=0;fe<6;fe++){q=oe[fe].mipmaps;for(let Se=0;Se<q.length;Se++){const Ae=q[Se];E.format!==RGBAFormat?Fe!==null?We?t.compressedTexSubImage2D(34069+fe,Se,0,0,Ae.width,Ae.height,Fe,Ae.data):t.compressedTexImage2D(34069+fe,Se,De,Ae.width,Ae.height,0,Ae.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):We?t.texSubImage2D(34069+fe,Se,0,0,Ae.width,Ae.height,Fe,Re,Ae.data):t.texImage2D(34069+fe,Se,De,Ae.width,Ae.height,0,Fe,Re,Ae.data)}}}else{q=E.mipmaps,We&&je&&(q.length>0&&et++,t.texStorage2D(34067,et,De,oe[0].width,oe[0].height));for(let fe=0;fe<6;fe++)if(ge){We?t.texSubImage2D(34069+fe,0,0,0,oe[fe].width,oe[fe].height,Fe,Re,oe[fe].data):t.texImage2D(34069+fe,0,De,oe[fe].width,oe[fe].height,0,Fe,Re,oe[fe].data);for(let Se=0;Se<q.length;Se++){const Oe=q[Se].image[fe].image;We?t.texSubImage2D(34069+fe,Se+1,0,0,Oe.width,Oe.height,Fe,Re,Oe.data):t.texImage2D(34069+fe,Se+1,De,Oe.width,Oe.height,0,Fe,Re,Oe.data)}}else{We?t.texSubImage2D(34069+fe,0,0,0,Fe,Re,oe[fe]):t.texImage2D(34069+fe,0,De,Fe,Re,oe[fe]);for(let Se=0;Se<q.length;Se++){const Ae=q[Se];We?t.texSubImage2D(34069+fe,Se+1,0,0,Fe,Re,Ae.image[fe]):t.texImage2D(34069+fe,Se+1,De,Fe,Re,Ae.image[fe])}}}C(E,Ne)&&R(34067),$.__version=V.version,E.onUpdate&&E.onUpdate(E)}T.__version=E.version}function we(T,E,z,K,V){const $=s.convert(z.format,z.encoding),be=s.convert(z.type),ge=M(z.internalFormat,$,be,z.encoding);i.get(E).__hasExternalTextures||(V===32879||V===35866?t.texImage3D(V,0,ge,E.width,E.height,E.depth,0,$,be,null):t.texImage2D(V,0,ge,E.width,E.height,0,$,be,null)),t.bindFramebuffer(36160,T),se(E)?f.framebufferTexture2DMultisampleEXT(36160,K,V,i.get(z).__webglTexture,0,re(E)):(V===3553||V>=34069&&V<=34074)&&n.framebufferTexture2D(36160,K,V,i.get(z).__webglTexture,0),t.bindFramebuffer(36160,null)}function O(T,E,z){if(n.bindRenderbuffer(36161,T),E.depthBuffer&&!E.stencilBuffer){let K=33189;if(z||se(E)){const V=E.depthTexture;V&&V.isDepthTexture&&(V.type===FloatType?K=36012:V.type===UnsignedIntType&&(K=33190));const $=re(E);se(E)?f.renderbufferStorageMultisampleEXT(36161,$,K,E.width,E.height):n.renderbufferStorageMultisample(36161,$,K,E.width,E.height)}else n.renderbufferStorage(36161,K,E.width,E.height);n.framebufferRenderbuffer(36160,36096,36161,T)}else if(E.depthBuffer&&E.stencilBuffer){const K=re(E);z&&se(E)===!1?n.renderbufferStorageMultisample(36161,K,35056,E.width,E.height):se(E)?f.renderbufferStorageMultisampleEXT(36161,K,35056,E.width,E.height):n.renderbufferStorage(36161,34041,E.width,E.height),n.framebufferRenderbuffer(36160,33306,36161,T)}else{const K=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let V=0;V<K.length;V++){const $=K[V],be=s.convert($.format,$.encoding),ge=s.convert($.type),oe=M($.internalFormat,be,ge,$.encoding),Ie=re(E);z&&se(E)===!1?n.renderbufferStorageMultisample(36161,Ie,oe,E.width,E.height):se(E)?f.renderbufferStorageMultisampleEXT(36161,Ie,oe,E.width,E.height):n.renderbufferStorage(36161,oe,E.width,E.height)}}n.bindRenderbuffer(36161,null)}function D(T,E){if(E&&E.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,T),!(E.depthTexture&&E.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(E.depthTexture).__webglTexture||E.depthTexture.image.width!==E.width||E.depthTexture.image.height!==E.height)&&(E.depthTexture.image.width=E.width,E.depthTexture.image.height=E.height,E.depthTexture.needsUpdate=!0),_e(E.depthTexture,0);const K=i.get(E.depthTexture).__webglTexture,V=re(E);if(E.depthTexture.format===DepthFormat)se(E)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,K,0,V):n.framebufferTexture2D(36160,36096,3553,K,0);else if(E.depthTexture.format===DepthStencilFormat)se(E)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,K,0,V):n.framebufferTexture2D(36160,33306,3553,K,0);else throw new Error("Unknown depthTexture format")}function k(T){const E=i.get(T),z=T.isWebGLCubeRenderTarget===!0;if(T.depthTexture&&!E.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");D(E.__webglFramebuffer,T)}else if(z){E.__webglDepthbuffer=[];for(let K=0;K<6;K++)t.bindFramebuffer(36160,E.__webglFramebuffer[K]),E.__webglDepthbuffer[K]=n.createRenderbuffer(),O(E.__webglDepthbuffer[K],T,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=n.createRenderbuffer(),O(E.__webglDepthbuffer,T,!1);t.bindFramebuffer(36160,null)}function H(T,E,z){const K=i.get(T);E!==void 0&&we(K.__webglFramebuffer,T,T.texture,36064,3553),z!==void 0&&k(T)}function j(T){const E=T.texture,z=i.get(T),K=i.get(E);T.addEventListener("dispose",W),T.isWebGLMultipleRenderTargets!==!0&&(K.__webglTexture===void 0&&(K.__webglTexture=n.createTexture()),K.__version=E.version,a.memory.textures++);const V=T.isWebGLCubeRenderTarget===!0,$=T.isWebGLMultipleRenderTargets===!0,be=b(T)||o;if(V){z.__webglFramebuffer=[];for(let ge=0;ge<6;ge++)z.__webglFramebuffer[ge]=n.createFramebuffer()}else{if(z.__webglFramebuffer=n.createFramebuffer(),$)if(r.drawBuffers){const ge=T.texture;for(let oe=0,Ie=ge.length;oe<Ie;oe++){const Ne=i.get(ge[oe]);Ne.__webglTexture===void 0&&(Ne.__webglTexture=n.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&T.samples>0&&se(T)===!1){const ge=$?E:[E];z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,z.__webglMultisampledFramebuffer);for(let oe=0;oe<ge.length;oe++){const Ie=ge[oe];z.__webglColorRenderbuffer[oe]=n.createRenderbuffer(),n.bindRenderbuffer(36161,z.__webglColorRenderbuffer[oe]);const Ne=s.convert(Ie.format,Ie.encoding),Fe=s.convert(Ie.type),Re=M(Ie.internalFormat,Ne,Fe,Ie.encoding,T.isXRRenderTarget===!0),De=re(T);n.renderbufferStorageMultisample(36161,De,Re,T.width,T.height),n.framebufferRenderbuffer(36160,36064+oe,36161,z.__webglColorRenderbuffer[oe])}n.bindRenderbuffer(36161,null),T.depthBuffer&&(z.__webglDepthRenderbuffer=n.createRenderbuffer(),O(z.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(36160,null)}}if(V){t.bindTexture(34067,K.__webglTexture),ae(34067,E,be);for(let ge=0;ge<6;ge++)we(z.__webglFramebuffer[ge],T,E,36064,34069+ge);C(E,be)&&R(34067),t.unbindTexture()}else if($){const ge=T.texture;for(let oe=0,Ie=ge.length;oe<Ie;oe++){const Ne=ge[oe],Fe=i.get(Ne);t.bindTexture(3553,Fe.__webglTexture),ae(3553,Ne,be),we(z.__webglFramebuffer,T,Ne,36064+oe,3553),C(Ne,be)&&R(3553)}t.unbindTexture()}else{let ge=3553;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(o?ge=T.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ge,K.__webglTexture),ae(ge,E,be),we(z.__webglFramebuffer,T,E,36064,ge),C(E,be)&&R(ge),t.unbindTexture()}T.depthBuffer&&k(T)}function Y(T){const E=b(T)||o,z=T.isWebGLMultipleRenderTargets===!0?T.texture:[T.texture];for(let K=0,V=z.length;K<V;K++){const $=z[K];if(C($,E)){const be=T.isWebGLCubeRenderTarget?34067:3553,ge=i.get($).__webglTexture;t.bindTexture(be,ge),R(be),t.unbindTexture()}}}function ce(T){if(o&&T.samples>0&&se(T)===!1){const E=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],z=T.width,K=T.height;let V=16384;const $=[],be=T.stencilBuffer?33306:36096,ge=i.get(T),oe=T.isWebGLMultipleRenderTargets===!0;if(oe)for(let Ie=0;Ie<E.length;Ie++)t.bindFramebuffer(36160,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ie,36161,null),t.bindFramebuffer(36160,ge.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ie,3553,null,0);t.bindFramebuffer(36008,ge.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ge.__webglFramebuffer);for(let Ie=0;Ie<E.length;Ie++){$.push(36064+Ie),T.depthBuffer&&$.push(be);const Ne=ge.__ignoreDepthValues!==void 0?ge.__ignoreDepthValues:!1;if(Ne===!1&&(T.depthBuffer&&(V|=256),T.stencilBuffer&&(V|=1024)),oe&&n.framebufferRenderbuffer(36008,36064,36161,ge.__webglColorRenderbuffer[Ie]),Ne===!0&&(n.invalidateFramebuffer(36008,[be]),n.invalidateFramebuffer(36009,[be])),oe){const Fe=i.get(E[Ie]).__webglTexture;n.framebufferTexture2D(36009,36064,3553,Fe,0)}n.blitFramebuffer(0,0,z,K,0,0,z,K,V,9728),m&&n.invalidateFramebuffer(36008,$)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),oe)for(let Ie=0;Ie<E.length;Ie++){t.bindFramebuffer(36160,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ie,36161,ge.__webglColorRenderbuffer[Ie]);const Ne=i.get(E[Ie]).__webglTexture;t.bindFramebuffer(36160,ge.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ie,3553,Ne,0)}t.bindFramebuffer(36009,ge.__webglMultisampledFramebuffer)}}function re(T){return Math.min(d,T.samples)}function se(T){const E=i.get(T);return o&&T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function P(T){const E=a.render.frame;
3144v.get(T)!==E&&(v.set(T,E),T.update())}function N(T,E){const z=T.encoding,K=T.format,V=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||T.format===_SRGBAFormat||z!==LinearEncoding&&(z===sRGBEncoding?o===!1?e.has("EXT_sRGB")===!0&&K===RGBAFormat?(T.format=_SRGBAFormat,T.minFilter=LinearFilter,T.generateMipmaps=!1):E=ImageUtils.sRGBToLinear(E):(K!==RGBAFormat||V!==UnsignedByteType)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",z)),E}this.allocateTextureUnit=ie,this.resetTextureUnits=ue,this.setTexture2D=_e,this.setTexture2DArray=Q,this.setTexture3D=ne,this.setTextureCube=ye,this.rebindTextures=H,this.setupRenderTarget=j,this.updateRenderTargetMipmap=Y,this.updateMultisampleRenderTarget=ce,this.setupDepthRenderbuffer=k,this.setupFrameBufferTexture=we,this.useMultisampledRTT=se}function WebGLUtils(n,e,t){const i=t.isWebGL2;function r(s,a=null){let o;if(s===UnsignedByteType)return 5121;if(s===UnsignedShort4444Type)return 32819;if(s===UnsignedShort5551Type)return 32820;if(s===ByteType)return 5120;if(s===ShortType)return 5122;if(s===UnsignedShortType)return 5123;if(s===IntType)return 5124;if(s===UnsignedIntType)return 5125;if(s===FloatType)return 5126;if(s===HalfFloatType)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===AlphaFormat)return 6406;if(s===RGBAFormat)return 6408;if(s===LuminanceFormat)return 6409;if(s===LuminanceAlphaFormat)return 6410;if(s===DepthFormat)return 6402;if(s===DepthStencilFormat)return 34041;if(s===RGBFormat)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===_SRGBAFormat)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===RedFormat)return 6403;if(s===RedIntegerFormat)return 36244;if(s===RGFormat)return 33319;if(s===RGIntegerFormat)return 33320;if(s===RGBAIntegerFormat)return 36249;if(s===RGB_S3TC_DXT1_Format||s===RGBA_S3TC_DXT1_Format||s===RGBA_S3TC_DXT3_Format||s===RGBA_S3TC_DXT5_Format)if(a===sRGBEncoding)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===RGB_S3TC_DXT1_Format)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT1_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT3_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===RGBA_S3TC_DXT5_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===RGB_S3TC_DXT1_Format)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT1_Format)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT3_Format)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===RGBA_S3TC_DXT5_Format)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===RGB_PVRTC_4BPPV1_Format||s===RGB_PVRTC_2BPPV1_Format||s===RGBA_PVRTC_4BPPV1_Format||s===RGBA_PVRTC_2BPPV1_Format)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===RGB_PVRTC_4BPPV1_Format)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===RGB_PVRTC_2BPPV1_Format)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===RGBA_PVRTC_4BPPV1_Format)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===RGBA_PVRTC_2BPPV1_Format)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===RGB_ETC1_Format)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===RGB_ETC2_Format||s===RGBA_ETC2_EAC_Format)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===RGB_ETC2_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===RGBA_ETC2_EAC_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===RGBA_ASTC_4x4_Format||s===RGBA_ASTC_5x4_Format||s===RGBA_ASTC_5x5_Format||s===RGBA_ASTC_6x5_Format||s===RGBA_ASTC_6x6_Format||s===RGBA_ASTC_8x5_Format||s===RGBA_ASTC_8x6_Format||s===RGBA_ASTC_8x8_Format||s===RGBA_ASTC_10x5_Format||s===RGBA_ASTC_10x6_Format||s===RGBA_ASTC_10x8_Format||s===RGBA_ASTC_10x10_Format||s===RGBA_ASTC_12x10_Format||s===RGBA_ASTC_12x12_Format)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===RGBA_ASTC_4x4_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===RGBA_ASTC_5x4_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===RGBA_ASTC_5x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===RGBA_ASTC_6x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===RGBA_ASTC_6x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===RGBA_ASTC_8x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===RGBA_ASTC_8x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===RGBA_ASTC_8x8_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===RGBA_ASTC_10x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===RGBA_ASTC_10x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===RGBA_ASTC_10x8_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===RGBA_ASTC_10x10_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===RGBA_ASTC_12x10_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RGBA_ASTC_12x12_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===RGBA_BPTC_Format)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===RGBA_BPTC_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===UnsignedInt248Type?i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Group$1=class extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}};const _moveEvent={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Group$1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Group$1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Group$1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,i),x=this._getHandJoint(c,_);g!==null&&(x.matrix.fromArray(g.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.jointRadius=g.radius),x.visible=g!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),m=.02,v=.005;c.inputState.pinching&&f>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Group$1;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class DepthTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u){if(u=u!==void 0?u:DepthFormat,u!==DepthFormat&&u!==DepthStencilFormat)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===DepthFormat&&(i=UnsignedIntType),i===void 0&&u===DepthStencilFormat&&(i=UnsignedInt248Type),super(null,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:NearestFilter,this.minFilter=l!==void 0?l:NearestFilter,this.flipY=!1,this.generateMipmaps=!1}}
vendor: 4,959 bytes, line 3144
3144class WebXRManager extends EventDispatcher{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=null,c=null,u=null,d=null,f=null,m=null;const v=t.getContextAttributes();let _=null,g=null;const x=[],S=[],y=new Set,b=new Map,w=new PerspectiveCamera;w.layers.enable(1),w.viewport=new Vector4;const C=new PerspectiveCamera;C.layers.enable(2),C.viewport=new Vector4;const R=[w,C],M=new ArrayCamera;M.layers.enable(1),M.layers.enable(2);let L=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getTargetRaySpace()},this.getControllerGrip=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getGripSpace()},this.getHand=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getHandSpace()};function Z(Q){const ne=S.indexOf(Q.inputSource);if(ne===-1)return;const ye=x[ne];ye!==void 0&&ye.dispatchEvent({type:Q.type,data:Q.inputSource})}function W(){r.removeEventListener("select",Z),r.removeEventListener("selectstart",Z),r.removeEventListener("selectend",Z),r.removeEventListener("squeeze",Z),r.removeEventListener("squeezestart",Z),r.removeEventListener("squeezeend",Z),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",X);for(let Q=0;Q<x.length;Q++){const ne=S[Q];ne!==null&&(S[Q]=null,x[Q].disconnect(ne))}L=null,B=null,e.setRenderTarget(_),f=null,d=null,u=null,r=null,g=null,_e.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Q){s=Q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Q){o=Q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Q){l=Q},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(Q){if(r=Q,r!==null){if(_=e.getRenderTarget(),r.addEventListener("select",Z),r.addEventListener("selectstart",Z),r.addEventListener("selectend",Z),r.addEventListener("squeeze",Z),r.addEventListener("squeezestart",Z),r.addEventListener("squeezeend",Z),r.addEventListener("end",W),r.addEventListener("inputsourceschange",X),v.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ne={antialias:r.renderState.layers===void 0?v.antialias:!0,alpha:v.alpha,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,ne),r.updateRenderState({baseLayer:f}),g=new WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,encoding:e.outputEncoding,stencilBuffer:v.stencil})}else{let ne=null,ye=null,Me=null;v.depth&&(Me=v.stencil?35056:33190,ne=v.stencil?DepthStencilFormat:DepthFormat,ye=v.stencil?UnsignedInt248Type:UnsignedIntType);const Te={colorFormat:32856,depthFormat:Me,scaleFactor:s};u=new XRWebGLBinding(r,t),d=u.createProjectionLayer(Te),r.updateRenderState({layers:[d]}),g=new WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(d.textureWidth,d.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,ne),stencilBuffer:v.stencil,encoding:e.outputEncoding,samples:v.antialias?4:0});const ae=e.properties.get(g);ae.__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),l=null,a=await r.requestReferenceSpace(o),_e.setContext(r),_e.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function X(Q){for(let ne=0;ne<Q.removed.length;ne++){const ye=Q.removed[ne],Me=S.indexOf(ye);Me>=0&&(S[Me]=null,x[Me].disconnect(ye))}for(let ne=0;ne<Q.added.length;ne++){const ye=Q.added[ne];let Me=S.indexOf(ye);if(Me===-1){for(let ae=0;ae<x.length;ae++)if(ae>=S.length){S.push(ye),Me=ae;break}else if(S[ae]===null){S[ae]=ye,Me=ae;break}if(Me===-1)break}const Te=x[Me];Te&&Te.connect(ye)}}const G=new Vector3,le=new Vector3;function he(Q,ne,ye){G.setFromMatrixPosition(ne.matrixWorld),le.setFromMatrixPosition(ye.matrixWorld);const Me=G.distanceTo(le),Te=ne.projectionMatrix.elements,ae=ye.projectionMatrix.elements,Le=Te[14]/(Te[10]-1),Ee=Te[14]/(Te[10]+1),Ce=(Te[9]+1)/Te[5],we=(Te[9]-1)/Te[5],O=(Te[8]-1)/Te[0],D=(ae[8]+1)/ae[0],k=Le*O,H=Le*D,j=Me/(-O+D),Y=j*-O;ne.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(Y),Q.translateZ(j),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert();const ce=Le+j,re=Ee+j,se=k-Y,P=H+(Me-Y),N=Ce*Ee/re*ce,T=we*Ee/re*ce;Q.projectionMatrix.makePerspective(se,P,N,T,ce,re)}function ue(Q,ne){ne===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(ne.matrixWorld,Q.matrix
3144),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(r===null)return;M.near=C.near=w.near=Q.near,M.far=C.far=w.far=Q.far,(L!==M.near||B!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,B=M.far);const ne=Q.parent,ye=M.cameras;ue(M,ne);for(let Te=0;Te<ye.length;Te++)ue(ye[Te],ne);M.matrixWorld.decompose(M.position,M.quaternion,M.scale),Q.matrix.copy(M.matrix),Q.matrix.decompose(Q.position,Q.quaternion,Q.scale);const Me=Q.children;for(let Te=0,ae=Me.length;Te<ae;Te++)Me[Te].updateMatrixWorld(!0);ye.length===2?he(M,w,C):M.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return M},this.getFoveation=function(){if(d!==null)return d.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(Q){d!==null&&(d.fixedFoveation=Q),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Q)},this.getPlanes=function(){return y};let ie=null;function ve(Q,ne){if(c=ne.getViewerPose(l||a),m=ne,c!==null){const ye=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let Me=!1;ye.length!==M.cameras.length&&(M.cameras.length=0,Me=!0);for(let Te=0;Te<ye.length;Te++){const ae=ye[Te];let Le=null;if(f!==null)Le=f.getViewport(ae);else{const Ce=u.getViewSubImage(d,ae);Le=Ce.viewport,Te===0&&(e.setRenderTargetTextures(g,Ce.colorTexture,d.ignoreDepthValues?void 0:Ce.depthStencilTexture),e.setRenderTarget(g))}let Ee=R[Te];Ee===void 0&&(Ee=new PerspectiveCamera,Ee.layers.enable(Te),Ee.viewport=new Vector4,R[Te]=Ee),Ee.matrix.fromArray(ae.transform.matrix),Ee.projectionMatrix.fromArray(ae.projectionMatrix),Ee.viewport.set(Le.x,Le.y,Le.width,Le.height),Te===0&&M.matrix.copy(Ee.matrix),Me===!0&&M.cameras.push(Ee)}}for(let ye=0;ye<x.length;ye++){const Me=S[ye],Te=x[ye];Me!==null&&Te!==void 0&&Te.update(Me,ne,l||a)}if(ie&&ie(Q,ne),ne.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:ne.detectedPlanes});let ye=null;for(const Me of y)ne.detectedPlanes.has(Me)||(ye===null&&(ye=[]),ye.push(Me));if(ye!==null)for(const Me of ye)y.delete(Me),b.delete(Me),i.dispatchEvent({type:"planeremoved",data:Me});for(const Me of ne.detectedPlanes)if(!y.has(Me))y.add(Me),b.set(Me,ne.lastChangedTime),i.dispatchEvent({type:"planeadded",data:Me});else{const Te=b.get(Me);Me.lastChangedTime>Te&&(b.set(Me,Me.lastChangedTime),i.dispatchEvent({type:"planechanged",data:Me}))}}m=null}const _e=new WebGLAnimation;_e.setAnimationLoop(ve),this.setAnimationLoop=function(Q){ie=Q},this.dispose=function(){}}}function WebGLMaterials(n,e){function t(_,g){g.color.getRGB(_.fogColor.value,getUnlitUniformColorSpace(n)),g.isFog?(_.fogNear.value=g.near,_.fogFar.value=g.far):g.isFogExp2&&(_.fogDensity.value=g.density)}function i(_,g,x,S,y){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(_,g):g.isMeshToonMaterial?(r(_,g),u(_,g)):g.isMeshPhongMaterial?(r(_,g),c(_,g)):g.isMeshStandardMaterial?(r(_,g),d(_,g),g.isMeshPhysicalMaterial&&f(_,g,y)):g.isMeshMatcapMaterial?(r(_,g),m(_,g)):g.isMeshDepthMaterial?r(_,g):g.isMeshDistanceMaterial?(r(_,g),v(_,g)):g.isMeshNormalMaterial?r(_,g):g.isLineBasicMaterial?(s(_,g),g.isLineDashedMaterial&&a(_,g)):g.isPointsMaterial?o(_,g,x,S):g.isSpriteMaterial?l(_,g):g.isShadowMaterial?(_.color.value.copy(g.color),_.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(_,g){_.opacity.value=g.opacity,g.color&&_.diffuse.value.copy(g.color),g.emissive&&_.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.bumpMap&&(_.bumpMap.value=g.bumpMap,_.bumpScale.value=g.bumpScale,g.side===BackSide&&(_.bumpScale.value*=-1)),g.displacementMap&&(_.displacementMap.value=g.displacementMap,_.displacementScale.value=g.displacementScale,_.displacementBias.value=g.displacementBias),g.emissiveMap&&(_.emissiveMap.value=g.emissiveMap),g.normalMap&&(_.normalMap.value=g.normalMap,_.normalScale.value.copy(g.normalScale),g.side===BackSide&&_.normalScale.value.negate()),g.specularMap&&(_.specularMap.value=g.specularMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);const x=e.get(g).envMap;if(x&&(_.envMap.value=x,_.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap){_.lightMap.value=g.lightMap;const b=n.physicallyCorrectLights!==!0?Math.PI:1;_.lightMapIntensity.value=g.lightMapIntensity*b}
vendor: 9,967 bytes, line 3144
3144g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity);let S;g.map?S=g.map:g.specularMap?S=g.specularMap:g.displacementMap?S=g.displacementMap:g.normalMap?S=g.normalMap:g.bumpMap?S=g.bumpMap:g.roughnessMap?S=g.roughnessMap:g.metalnessMap?S=g.metalnessMap:g.alphaMap?S=g.alphaMap:g.emissiveMap?S=g.emissiveMap:g.clearcoatMap?S=g.clearcoatMap:g.clearcoatNormalMap?S=g.clearcoatNormalMap:g.clearcoatRoughnessMap?S=g.clearcoatRoughnessMap:g.iridescenceMap?S=g.iridescenceMap:g.iridescenceThicknessMap?S=g.iridescenceThicknessMap:g.specularIntensityMap?S=g.specularIntensityMap:g.specularColorMap?S=g.specularColorMap:g.transmissionMap?S=g.transmissionMap:g.thicknessMap?S=g.thicknessMap:g.sheenColorMap?S=g.sheenColorMap:g.sheenRoughnessMap&&(S=g.sheenRoughnessMap),S!==void 0&&(S.isWebGLRenderTarget&&(S=S.texture),S.matrixAutoUpdate===!0&&S.updateMatrix(),_.uvTransform.value.copy(S.matrix));let y;g.aoMap?y=g.aoMap:g.lightMap&&(y=g.lightMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),_.uv2Transform.value.copy(y.matrix))}function s(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity}function a(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function o(_,g,x,S){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*x,_.scale.value=S*.5,g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);let y;g.map?y=g.map:g.alphaMap&&(y=g.alphaMap),y!==void 0&&(y.matrixAutoUpdate===!0&&y.updateMatrix(),_.uvTransform.value.copy(y.matrix))}function l(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);let x;g.map?x=g.map:g.alphaMap&&(x=g.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),_.uvTransform.value.copy(x.matrix))}function c(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function u(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function d(_,g){_.roughness.value=g.roughness,_.metalness.value=g.metalness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function f(_,g,x){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),_.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===BackSide&&_.clearcoatNormalScale.value.negate())),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=x.texture,_.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap)}function m(_,g){g.matcap&&(_.matcap.value=g.matcap)}function v(_,g){_.referencePosition.value.copy(g.referencePosition),_.nearDistance.value=g.nearDistance,_.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function WebGLUniformsGroups(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(35375):0;function l(S,y){const b=y.program;i.uniformBlockBinding(S,b)}function c(S,y){let b=r[S.id];b===void 0&&(v(S),b=u(S),r[S.id]=b,S.addEventListener("dispose",g));const w=y.program;i.updateUBOMapping(S,w);const C=e.render.frame;s[S.id]!==C&&(f(S),s[S.id]=C)}function u(S){const y=d();S.__bindingPointIndex=y;const b=n.createBuffer(),w=S.__size,C=S.usage;return n.bindBuffer(35345,b),n.bufferData(35345,w,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,y,b),b}function d(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(S){const y=r[S.id],b=S.uniforms,w=S.__cache;n.bindBuffer(35345,y);for(let C=0,R=b.length;C<R;C++){const M=b[C];if(m(M,C,w)===!0){const L=M.value,B=M.__offset;typeof L=="number"?(M.__data[0]=L,n.bufferSubData(35345,B,M.__data)):(M.value.isMatrix3?(M.__data[0]=M.value.elements[0],M.__data[1]=M.value.elements[1],M.__data[2]=M.value.elements[2],M.__data[3]=M.value.elements[0],M.__data[4]=M.value.elements[3],M.__data[5]=M.value.elements[4],M.__data[6]=M.value.elements[5],M.__data[7]=M.value.elements[0],M.__data[8]=M.value.elements[6],M.__data[9]=M.value.elements[7],M.__data[10]=M.value.elements[8],M.__data[11]=M.value.elements[0]):L.toArray(M.__data),n.bufferSubData(35345,B,M.__data))}}n.bindBuffer(35345,null)}function m(S,y,b){const w=S.value;if(b[y]===void 0)return typeof w=="number"?b[y]=w:b[y]=w.clone(),!0;if(typeof w=="number"){if(b[y]!==w)return b[y]=w,!0}else{const C=b[y];if(C.equals(w)===!1)return C.copy(w),!0}return!1}function v(S){const y=S.uniforms;let b=0;const w=16;let C=0;for(let R=0,M=y.length;R<M;R++){const L=y[R],B=_(L);if(L.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=b,R>0){C=b%w;const Z=w-C;C!==0&&Z-B.boundary<0&&(b+=w-C,L.__offset=b)}b+=B.storage}return C=b%w,C>0&&(b+=w-C),S.__size=b,S.__cache={},this}function _(S){const y=S.value,b={boundary:0,storage:0};return typeof y=="number"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=48,b.storage=48):y.isMatrix4?(b.boundary=64,b.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),b}function g(S){const y=S.target;y.removeEventListener("dispose",g);const b=a.indexOf(y.__bindingPointIndex);a.splice(b,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function x(){for(const S in r)n.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:x}}function createCanvasElement(){const n=createElementNS("canvas");return n.style.display="block",n}function WebGLRenderer(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:createCanvasElement(),t=n.context!==void 0?n.context:null,i=n.depth!==void 0?n.depth:!0,r=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,a=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,o=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",c=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let u;t!==null?u=t.getContextAttributes().alpha:u=n.alpha!==void 0?n.alpha:!1;let d=null,f=null;const m=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=LinearEncoding,this.physicallyCorrectLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const _=this;let g=!1,x=0,S=0,y=null,b=-1,w=null;const C=new Vector4,R=new Vector4;let M=null,L=e.width,B=e.height,Z=1,W=null,X=null;const G=new Vector4(0,0,L,B),le=new Vector4(0,0,L,B);let he=!1;const ue=new Frustum;let ie=!1,ve=!1,_e=null;const Q=new Matrix4,ne=new Vector2,ye=new Vector3,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Te(){return y===null?Z:1}let ae=t;function Le(F,ee){for(let de=0;de<F.length;de++){const J=F[de],pe=e.getContext(J,ee);if(pe!==null)return pe}return null}try{const F={alpha:!0,depth:i,stencil:r,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:o,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${REVISION}`),e.addEventListener("webglcontextlost",Re,!1),e.addEventListener("webglcontextrestored",De,!1),e.addEventListener("webglcontextcreationerror",We,!1),ae===null){const ee=["webgl2","webgl","experimental-webgl"];if(_.isWebGL1Renderer===!0&&ee.shift(),ae=Le(ee,F),ae===null)throw Le(ee)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}ae.getShaderPrecisionFormat===void 0&&(ae.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(F){throw console.error("THREE.WebGLRenderer: "+F.message),F}let Ee,Ce,we,O,D,k,H,j,Y,ce,re,se,P,N,T,E,z,K,V,$,be,ge,oe,Ie;function Ne(){Ee=new WebGLExtensions(ae),Ce=new WebGLCapabilities(ae,Ee,n),Ee.init(Ce),ge=new WebGLUtils(ae,Ee,Ce),we=new WebGLState(ae,Ee,Ce),O=new WebGLInfo,D=new WebGLProperties,k=new WebGLTextures(ae,Ee,we,D,Ce,ge,O),H=new WebGLCubeMaps(_),j=new WebGLCubeUVMaps(_),Y=new WebGLAttributes(ae,Ce),oe=new WebGLBindingStates(ae,Ee,Y,Ce),ce=new WebGLGeometries(ae,Y,O,oe),re=ne
3144w WebGLObjects(ae,ce,Y,O),V=new WebGLMorphtargets(ae,Ce,k),E=new WebGLClipping(D),se=new WebGLPrograms(_,H,j,Ee,Ce,oe,E),P=new WebGLMaterials(_,D),N=new WebGLRenderLists,T=new WebGLRenderStates(Ee,Ce),K=new WebGLBackground(_,H,j,we,re,u,a),z=new WebGLShadowMap(_,re,Ce),Ie=new WebGLUniformsGroups(ae,O,Ce,we),$=new WebGLBufferRenderer(ae,Ee,O,Ce),be=new WebGLIndexedBufferRenderer(ae,Ee,O,Ce),O.programs=se.programs,_.capabilities=Ce,_.extensions=Ee,_.properties=D,_.renderLists=N,_.shadowMap=z,_.state=we,_.info=O}Ne();const Fe=new WebXRManager(_,ae);this.xr=Fe,this.getContext=function(){return ae},this.getContextAttributes=function(){return ae.getContextAttributes()},this.forceContextLoss=function(){const F=Ee.get("WEBGL_lose_context");F&&F.loseContext()},this.forceContextRestore=function(){const F=Ee.get("WEBGL_lose_context");F&&F.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(F){F!==void 0&&(Z=F,this.setSize(L,B,!1))},this.getSize=function(F){return F.set(L,B)},this.setSize=function(F,ee,de){if(Fe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}L=F,B=ee,e.width=Math.floor(F*Z),e.height=Math.floor(ee*Z),de!==!1&&(e.style.width=F+"px",e.style.height=ee+"px"),this.setViewport(0,0,F,ee)},this.getDrawingBufferSize=function(F){return F.set(L*Z,B*Z).floor()},this.setDrawingBufferSize=function(F,ee,de){L=F,B=ee,Z=de,e.width=Math.floor(F*de),e.height=Math.floor(ee*de),this.setViewport(0,0,F,ee)},this.getCurrentViewport=function(F){return F.copy(C)},this.getViewport=function(F){return F.copy(G)},this.setViewport=function(F,ee,de,J){F.isVector4?G.set(F.x,F.y,F.z,F.w):G.set(F,ee,de,J),we.viewport(C.copy(G).multiplyScalar(Z).floor())},this.getScissor=function(F){return F.copy(le)},this.setScissor=function(F,ee,de,J){F.isVector4?le.set(F.x,F.y,F.z,F.w):le.set(F,ee,de,J),we.scissor(R.copy(le).multiplyScalar(Z).floor())},this.getScissorTest=function(){return he},this.setScissorTest=function(F){we.setScissorTest(he=F)},this.setOpaqueSort=function(F){W=F},this.setTransparentSort=function(F){X=F},this.getClearColor=function(F){return F.copy(K.getClearColor())},this.setClearColor=function(){K.setClearColor.apply(K,arguments)},this.getClearAlpha=function(){return K.getClearAlpha()},this.setClearAlpha=function(){K.setClearAlpha.apply(K,arguments)},this.clear=function(F=!0,ee=!0,de=!0){let J=0;F&&(J|=16384),ee&&(J|=256),de&&(J|=1024),ae.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Re,!1),e.removeEventListener("webglcontextrestored",De,!1),e.removeEventListener("webglcontextcreationerror",We,!1),N.dispose(),T.dispose(),D.dispose(),H.dispose(),j.dispose(),re.dispose(),oe.dispose(),Ie.dispose(),se.dispose(),Fe.dispose(),Fe.removeEventListener("sessionstart",Ae),Fe.removeEventListener("sessionend",Oe),_e&&(_e.dispose(),_e=null),Xe.stop()};function Re(F){F.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function De(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const F=O.autoReset,ee=z.enabled,de=z.autoUpdate,J=z.needsUpdate,pe=z.type;Ne(),O.autoReset=F,z.enabled=ee,z.autoUpdate=de,z.needsUpdate=J,z.type=pe}function We(F){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",F.statusMessage)}function je(F){const ee=F.target;ee.removeEventListener("dispose",je),et(ee)}function et(F){q(F),D.remove(F)}function q(F){const ee=D.get(F).programs;ee!==void 0&&(ee.forEach(function(de){se.releaseProgram(de)}),F.isShaderMaterial&&se.releaseShaderCache(F))}this.renderBufferDirect=function(F,ee,de,J,pe,Be){ee===null&&(ee=Me);const Ve=pe.isMesh&&pe.matrixWorld.determinant()<0,Ue=Ht(F,ee,de,J,pe);we.setMaterial(J,Ve);let ze=de.index,$e=1;J.wireframe===!0&&(ze=ce.getWireframeAttribute(de),$e=2);const Ge=de.drawRange,He=de.attributes.position;let Ze=Ge.start*$e,st=(Ge.start+Ge.count)*$e;Be!==null&&(Ze=Math.max(Ze,Be.start*$e),st=Math.min(st,(Be.start+Be.count)*$e)),ze!==null?(Ze=Math.max(Ze,0),st=Math.min(st,ze.count)):He!=null&&(Ze=Math.max(Ze,0),st=Math.min(st,He.count));const gt=st-Ze;if(gt<0||gt===1/0)return;oe.setup(pe,J,Ue,de,ze);let Mt,Je=$;if(ze!==null&&(Mt=Y.get(ze),Je=be,Je.setIndex(Mt)),pe.isMesh)J.wireframe===!0?(we.setLineWidth(J.wireframeLinewidth*Te()),Je.setMode(1)):Je.setMode(4);else if(pe.isLine){let ke=J.linewidth;ke===void 0&&(ke=1),we.setLineWidth(ke*Te()),pe.isLineSegments?Je.setMode(1):pe.isLineLoop?Je.setMode(2):Je.setMode(3)}else pe.isPoints?Je.setMode(0):pe.isSprite&&Je.setMode(4);
vendor: 12,788 bytes, line 3144
3144if(pe.isInstancedMesh)Je.renderInstances(Ze,gt,pe.count);else if(de.isInstancedBufferGeometry){const ke=de._maxInstanceCount!==void 0?de._maxInstanceCount:1/0,yt=Math.min(de.instanceCount,ke);Je.renderInstances(Ze,gt,yt)}else Je.render(Ze,gt)},this.compile=function(F,ee){function de(J,pe,Be){J.transparent===!0&&J.side===DoubleSide?(J.side=BackSide,J.needsUpdate=!0,ut(J,pe,Be),J.side=FrontSide,J.needsUpdate=!0,ut(J,pe,Be),J.side=DoubleSide):ut(J,pe,Be)}f=T.get(F),f.init(),v.push(f),F.traverseVisible(function(J){J.isLight&&J.layers.test(ee.layers)&&(f.pushLight(J),J.castShadow&&f.pushShadow(J))}),f.setupLights(_.physicallyCorrectLights),F.traverse(function(J){const pe=J.material;if(pe)if(Array.isArray(pe))for(let Be=0;Be<pe.length;Be++){const Ve=pe[Be];de(Ve,F,J)}else de(pe,F,J)}),v.pop(),f=null};let fe=null;function Se(F){fe&&fe(F)}function Ae(){Xe.stop()}function Oe(){Xe.start()}const Xe=new WebGLAnimation;Xe.setAnimationLoop(Se),typeof self<"u"&&Xe.setContext(self),this.setAnimationLoop=function(F){fe=F,Fe.setAnimationLoop(F),F===null?Xe.stop():Xe.start()},Fe.addEventListener("sessionstart",Ae),Fe.addEventListener("sessionend",Oe),this.render=function(F,ee){if(ee!==void 0&&ee.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),ee.parent===null&&ee.matrixWorldAutoUpdate===!0&&ee.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(ee),ee=Fe.getCamera()),F.isScene===!0&&F.onBeforeRender(_,F,ee,y),f=T.get(F,v.length),f.init(),v.push(f),Q.multiplyMatrices(ee.projectionMatrix,ee.matrixWorldInverse),ue.setFromProjectionMatrix(Q),ve=this.localClippingEnabled,ie=E.init(this.clippingPlanes,ve,ee),d=N.get(F,m.length),d.init(),m.push(d),tt(F,ee,0,_.sortObjects),d.finish(),_.sortObjects===!0&&d.sort(W,X),ie===!0&&E.beginShadows();const de=f.state.shadowsArray;if(z.render(de,F,ee),ie===!0&&E.endShadows(),this.info.autoReset===!0&&this.info.reset(),K.render(d,F),f.setupLights(_.physicallyCorrectLights),ee.isArrayCamera){const J=ee.cameras;for(let pe=0,Be=J.length;pe<Be;pe++){const Ve=J[pe];it(d,F,Ve,Ve.viewport)}}else it(d,F,ee);y!==null&&(k.updateMultisampleRenderTarget(y),k.updateRenderTargetMipmap(y)),F.isScene===!0&&F.onAfterRender(_,F,ee),oe.resetDefaultState(),b=-1,w=null,v.pop(),v.length>0?f=v[v.length-1]:f=null,m.pop(),m.length>0?d=m[m.length-1]:d=null};function tt(F,ee,de,J){if(F.visible===!1)return;if(F.layers.test(ee.layers)){if(F.isGroup)de=F.renderOrder;else if(F.isLOD)F.autoUpdate===!0&&F.update(ee);else if(F.isLight)f.pushLight(F),F.castShadow&&f.pushShadow(F);else if(F.isSprite){if(!F.frustumCulled||ue.intersectsSprite(F)){J&&ye.setFromMatrixPosition(F.matrixWorld).applyMatrix4(Q);const Ve=re.update(F),Ue=F.material;Ue.visible&&d.push(F,Ve,Ue,de,ye.z,null)}}else if((F.isMesh||F.isLine||F.isPoints)&&(F.isSkinnedMesh&&F.skeleton.frame!==O.render.frame&&(F.skeleton.update(),F.skeleton.frame=O.render.frame),!F.frustumCulled||ue.intersectsObject(F))){J&&ye.setFromMatrixPosition(F.matrixWorld).applyMatrix4(Q);const Ve=re.update(F),Ue=F.material;if(Array.isArray(Ue)){const ze=Ve.groups;for(let $e=0,Ge=ze.length;$e<Ge;$e++){const He=ze[$e],Ze=Ue[He.materialIndex];Ze&&Ze.visible&&d.push(F,Ve,Ze,de,ye.z,He)}}else Ue.visible&&d.push(F,Ve,Ue,de,ye.z,null)}}const Be=F.children;for(let Ve=0,Ue=Be.length;Ve<Ue;Ve++)tt(Be[Ve],ee,de,J)}function it(F,ee,de,J){const pe=F.opaque,Be=F.transmissive,Ve=F.transparent;f.setupLightsView(de),Be.length>0&&vt(pe,ee,de),J&&we.viewport(C.copy(J)),pe.length>0&&Ke(pe,ee,de),Be.length>0&&Ke(Be,ee,de),Ve.length>0&&Ke(Ve,ee,de),we.buffers.depth.setTest(!0),we.buffers.depth.setMask(!0),we.buffers.color.setMask(!0),we.setPolygonOffset(!1)}function vt(F,ee,de){const J=Ce.isWebGL2;_e===null&&(_e=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:J&&s===!0?4:0})),_.getDrawingBufferSize(ne),J?_e.setSize(ne.x,ne.y):_e.setSize(floorPowerOfTwo(ne.x),floorPowerOfTwo(ne.y));const pe=_.getRenderTarget();_.setRenderTarget(_e),_.clear();const Be=_.toneMapping;_.toneMapping=NoToneMapping,Ke(F,ee,de),_.toneMapping=Be,k.updateMultisampleRenderTarget(_e),k.updateRenderTargetMipmap(_e),_.setRenderTarget(pe)}function Ke(F,ee,de){const J=ee.isScene===!0?ee.overrideMaterial:null;for(let pe=0,Be=F.length;pe<Be;pe++){const Ve=F[pe],Ue=Ve.object,ze=Ve.geometry,$e=J===null?Ve.material:J,Ge=Ve.group;Ue.layers.test(de.layers)&&mt(Ue,ee,de,ze,$e,Ge)}}function mt(F,ee,de,J,pe,Be){F.onBeforeRender(_,ee,de,J,pe,Be),F.modelViewMatrix.multiplyMatrices(de.matrixWorldInverse,F.matrixWorld),F.normalMatrix.getNormalMatrix(F.modelViewMatrix),pe.onBeforeRender(_,ee,de,J,F,Be),pe.transparent===!0&&pe.side===DoubleSide?(pe.side=BackSide,pe.needsUpdate=!0,_.renderBufferDirect(de,ee,J,pe,F,Be),pe.side=FrontSide,pe.needsUpdate=!0,_.renderBufferDirect(de,ee,J,pe,F,Be),pe.side=DoubleSide):_.renderBufferDirect(de,ee,J,pe,F,Be),F.onAfterRender(_,ee,de,J,pe,Be)}function ut(F,ee,de){ee.isScene!==!0&&(ee=Me);const J=D.get(F),pe=f.state.lights,Be=f.state.shadowsArray,Ve=pe.state.version,Ue=se.getParameters(F,pe.state,Be,ee,de),ze=se.getProgramCacheKey(Ue);let $e=J.programs;J.environment=F.isMeshStandardMaterial?ee.environment:null,J.fog=ee.fog,J.envMap=(F.isMeshStandardMaterial?j:H).get(F.envMap||J.environment),$e===void 0&&(F.addEventListener("dispose",je),$e=new Map,J.programs=$e);let Ge=$e.get(ze);if(Ge!==void 0){if(J.currentProgram===Ge&&J.lightsStateVersion===Ve)return Lt(F,Ue),Ge}else Ue.uniforms=se.getUniforms(F),F.onBuild(de,Ue,_),F.onBeforeCompile(Ue,_),Ge=se.acquireProgram(Ue,ze),$e.set(ze,Ge),J.uniforms=Ue.uniforms;const He=J.uniforms;(!F.isShaderMaterial&&!F.isRawShaderMaterial||F.clipping===!0)&&(He.clippingPlanes=E.uniform),Lt(F,Ue),J.needsLights=zt(F),J.lightsStateVersion=Ve,J.needsLights&&(He.ambientLightColor.value=pe.state.ambient,He.lightProbe.value=pe.state.probe,He.directionalLights.value=pe.state.directional,He.directionalLightShadows.value=pe.state.directionalShadow,He.spotLights.value=pe.state.spot,He.spotLightShadows.value=pe.state.spotShadow,He.rectAreaLights.value=pe.state.rectArea,He.ltc_1.value=pe.state.rectAreaLTC1,He.ltc_2.value=pe.state.rectAreaLTC2,He.pointLights.value=pe.state.point,He.pointLightShadows.value=pe.state.pointShadow,He.hemisphereLights.value=pe.state.hemi,He.directionalShadowMap.value=pe.state.directionalShadowMap,He.directionalShadowMatrix.value=pe.state.directionalShadowMatrix,He.spotShadowMap.value=pe.state.spotShadowMap,He.spotLightMatrix.value=pe.state.spotLightMatrix,He.spotLightMap.value=pe.state.spotLightMap,He.pointShadowMap.value=pe.state.pointShadowMap,He.pointShadowMatrix.value=pe.state.pointShadowMatrix);const Ze=Ge.getUniforms(),st=WebGLUniforms.seqWithValue(Ze.seq,He);return J.currentProgram=Ge,J.uniformsList=st,Ge}function Lt(F,ee){const de=D.get(F);de.outputEncoding=ee.outputEncoding,de.instancing=ee.instancing,de.skinning=ee.skinning,de.morphTargets=ee.morphTargets,de.morphNormals=ee.morphNormals,de.morphColors=ee.morphColors,de.morphTargetsCount=ee.morphTargetsCount,de.numClippingPlanes=ee.numClippingPlanes,de.numIntersection=ee.numClipIntersection,de.vertexAlphas=ee.vertexAlphas,de.vertexTangents=ee.vertexTangents,de.toneMapping=ee.toneMapping}function Ht(F,ee,de,J,pe){ee.isScene!==!0&&(ee=Me),k.resetTextureUnits();const Be=ee.fog,Ve=J.isMeshStandardMaterial?ee.environment:null,Ue=y===null?_.outputEncoding:y.isXRRenderTarget===!0?y.texture.encoding:LinearEncoding,ze=(J.isMeshStandardMaterial?j:H).get(J.envMap||Ve),$e=J.vertexColors===!0&&!!de.attributes.color&&de.attributes.color.itemSize===4,Ge=!!J.normalMap&&!!de.attributes.tangent,He=!!de.morphAttributes.position,Ze=!!de.morphAttributes.normal,st=!!de.morphAttributes.color,gt=J.toneMapped?_.toneMapping:NoToneMapping,Mt=de.morphAttributes.position||de.morphAttributes.normal||de.morphAttributes.color,Je=Mt!==void 0?Mt.length:0,ke=D.get(J),yt=f.state.lights;if(ie===!0&&(ve===!0||F!==w)){const Qe=F===w&&J.id===b;E.setState(J,F,Qe)}let Ye=!1;J.version===ke.__version?(ke.needsLights&&ke.lightsStateVersion!==yt.state.version||ke.outputEncoding!==Ue||pe.isInstancedMesh&&ke.instancing===!1||!pe.isInstancedMesh&&ke.instancing===!0||pe.isSkinnedMesh&&ke.skinning===!1||!pe.isSkinnedMesh&&ke.skinning===!0||ke.envMap!==ze||J.fog===!0&&ke.fog!==Be||ke.numClippingPlanes!==void 0&&(ke.numClippingPlanes!==E.numPlanes||ke.numIntersection!==E.numIntersection)||ke.vertexAlphas!==$e||ke.vertexTangents!==Ge||ke.morphTargets!==He||ke.morphNormals!==Ze||ke.morphColors!==st||ke.toneMapping!==gt||Ce.isWebGL2===!0&&ke.morphTargetsCount!==Je)&&(Ye=!0):(Ye=!0,ke.__version=J.version);let at=ke.currentProgram;Ye===!0&&(at=ut(J,ee,pe));let wt=!1,lt=!1,dt=!1;const nt=at.getUniforms(),xt=ke.uniforms;if(we.useProgram(at.program)&&(wt=!0,lt=!0,dt=!0),J.id!==b&&(b=J.id,lt=!0),wt||w!==F){if(nt.setValue(ae,"projectionMatrix",F.projectionMatrix),Ce.logarithmicDepthBuffer&&nt.setValue(ae,"logDepthBufFC",2/(Math.log(F.far+1)/Math.LN2)),w!==F&&(w=F,lt=!0,dt=!0),J.isShaderMaterial||J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshStandardMaterial||J.envMap){const Qe=nt.map.cameraPosition;Qe!==void 0&&Qe.setValue(ae,ye.setFromMatrixPosition(F.matrixWorld))}(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&nt.setValue(ae,"isOrthographic",F.isOrthographicCamera===!0),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial||J.isShadowMaterial||pe.isSkinnedMesh)&&nt.setValue(ae,"viewMatrix",F.matrixWorldInverse)}if(pe.isSkinnedMesh){nt.setOptional(ae,pe,"bindMatrix"),nt.setOptional(ae,pe,"bindMatrixInverse");const Qe=pe.skeleton;Qe&&(Ce.floatVertexTextures?(Qe.boneTexture===null&&Qe.computeBoneTexture(),nt.setValue(ae,"boneTexture",Qe.boneTexture,k),nt.setValue(ae,"boneTextureSize",Qe.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Tt=de.morphAttributes;if((Tt.position!==void 0||Tt.normal!==void 0||Tt.color!==void 0&&Ce.isWebGL2===!0)&&V.update(pe,de,J,at),(lt||ke.receiveShadow!==pe.receiveShadow)&&(ke.receiveShadow=pe.receiveShadow,nt.setValue(ae,"receiveShadow",pe.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(xt.envMap.value=ze,xt.flipEnvMap.value=ze.isCubeTexture&&ze.isRenderTargetTexture===!1?-1:1),lt&&(nt.setValue(ae,"toneMappingExposure",_.toneMappingExposure),ke.needsLights&&Wt(xt,dt),Be&&J.fog===!0&&P.refreshFogUniforms(xt,Be),P.refreshMaterialUniforms(xt,J,Z,B,_e),WebGLUniforms.upload(ae,ke.uniformsList,xt,k)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(ae,ke.uniformsList,xt,k),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&nt.setValue(ae,"center",pe.center),nt.setValue(ae,"modelViewMatrix",pe.modelViewMatrix),nt.setValue(ae,"normalMatrix",pe.normalMatrix),nt.setValue(ae,"modelMatrix",pe.matrixWorld),J.isShaderMaterial||J.isRawShaderMaterial){const Qe=J.uniformsGroups;for(let Et=0,Ot=Qe.length;Et<Ot;Et++)if(Ce.isWebGL2){const Ft=Qe[Et];Ie.update(Ft,at),Ie.bind(Ft,at)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return at}function Wt(F,ee){F.ambientLightColor.needsUpdate=ee,F.lightProbe.needsUpdate=ee,F.directionalLights.needsUpdate=ee,F.directionalLightShadows.needsUpdate=ee,F.pointLights.needsUpdate=ee,F.pointLightShadows.needsUpdate=ee,F.spotLights.needsUpdate=ee,F.spotLightShadows.needsUpdate=ee,F.rectAreaLights.needsUpdate=ee,F.hemisphereLights.needsUpdate=ee}function zt(F){return F.isMeshLambertMaterial||F.isMeshToonMaterial||F.isMeshPhongMaterial||F.isMeshStandardMaterial||F.isShadowMaterial||F.isShaderMaterial&&F.lights===!0}this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return y},this.setRenderTargetTextures=function(F,ee,de){D.get(F.texture).__webglTexture=ee,D.get(F.depthTexture).__webglTexture=de;const J=D.get(F);J.__hasExternalTextures=!0,J.__hasExternalTextures&&(J.__autoAllocateDepthBuffer=de===void 0,J.__autoAllocateDepthBuffer||Ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),J.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(F,ee){const de=D.get(F);de.__webglFramebuffer=ee,de.__useDefaultFramebuffer=ee===void 0},this.setRenderTarget=function(F,ee=0,de=0){y=F,x=ee,S=de;let J=!0,pe=null,Be=!1,Ve=!1;
vendor: 50,756 bytes, line 3144
3144if(F){const ze=D.get(F);ze.__useDefaultFramebuffer!==void 0?(we.bindFramebuffer(36160,null),J=!1):ze.__webglFramebuffer===void 0?k.setupRenderTarget(F):ze.__hasExternalTextures&&k.rebindTextures(F,D.get(F.texture).__webglTexture,D.get(F.depthTexture).__webglTexture);const $e=F.texture;($e.isData3DTexture||$e.isDataArrayTexture||$e.isCompressedArrayTexture)&&(Ve=!0);const Ge=D.get(F).__webglFramebuffer;F.isWebGLCubeRenderTarget?(pe=Ge[ee],Be=!0):Ce.isWebGL2&&F.samples>0&&k.useMultisampledRTT(F)===!1?pe=D.get(F).__webglMultisampledFramebuffer:pe=Ge,C.copy(F.viewport),R.copy(F.scissor),M=F.scissorTest}else C.copy(G).multiplyScalar(Z).floor(),R.copy(le).multiplyScalar(Z).floor(),M=he;if(we.bindFramebuffer(36160,pe)&&Ce.drawBuffers&&J&&we.drawBuffers(F,pe),we.viewport(C),we.scissor(R),we.setScissorTest(M),Be){const ze=D.get(F.texture);ae.framebufferTexture2D(36160,36064,34069+ee,ze.__webglTexture,de)}else if(Ve){const ze=D.get(F.texture),$e=ee||0;ae.framebufferTextureLayer(36160,36064,ze.__webglTexture,de||0,$e)}b=-1},this.readRenderTargetPixels=function(F,ee,de,J,pe,Be,Ve){if(!(F&&F.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ue=D.get(F).__webglFramebuffer;if(F.isWebGLCubeRenderTarget&&Ve!==void 0&&(Ue=Ue[Ve]),Ue){we.bindFramebuffer(36160,Ue);try{const ze=F.texture,$e=ze.format,Ge=ze.type;if($e!==RGBAFormat&&ge.convert($e)!==ae.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const He=Ge===HalfFloatType&&(Ee.has("EXT_color_buffer_half_float")||Ce.isWebGL2&&Ee.has("EXT_color_buffer_float"));if(Ge!==UnsignedByteType&&ge.convert(Ge)!==ae.getParameter(35738)&&!(Ge===FloatType&&(Ce.isWebGL2||Ee.has("OES_texture_float")||Ee.has("WEBGL_color_buffer_float")))&&!He){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ee>=0&&ee<=F.width-J&&de>=0&&de<=F.height-pe&&ae.readPixels(ee,de,J,pe,ge.convert($e),ge.convert(Ge),Be)}finally{const ze=y!==null?D.get(y).__webglFramebuffer:null;we.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(F,ee,de=0){const J=Math.pow(2,-de),pe=Math.floor(ee.image.width*J),Be=Math.floor(ee.image.height*J);k.setTexture2D(ee,0),ae.copyTexSubImage2D(3553,de,0,0,F.x,F.y,pe,Be),we.unbindTexture()},this.copyTextureToTexture=function(F,ee,de,J=0){const pe=ee.image.width,Be=ee.image.height,Ve=ge.convert(de.format),Ue=ge.convert(de.type);k.setTexture2D(de,0),ae.pixelStorei(37440,de.flipY),ae.pixelStorei(37441,de.premultiplyAlpha),ae.pixelStorei(3317,de.unpackAlignment),ee.isDataTexture?ae.texSubImage2D(3553,J,F.x,F.y,pe,Be,Ve,Ue,ee.image.data):ee.isCompressedTexture?ae.compressedTexSubImage2D(3553,J,F.x,F.y,ee.mipmaps[0].width,ee.mipmaps[0].height,Ve,ee.mipmaps[0].data):ae.texSubImage2D(3553,J,F.x,F.y,Ve,Ue,ee.image),J===0&&de.generateMipmaps&&ae.generateMipmap(3553),we.unbindTexture()},this.copyTextureToTexture3D=function(F,ee,de,J,pe=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Be=F.max.x-F.min.x+1,Ve=F.max.y-F.min.y+1,Ue=F.max.z-F.min.z+1,ze=ge.convert(J.format),$e=ge.convert(J.type);let Ge;if(J.isData3DTexture)k.setTexture3D(J,0),Ge=32879;else if(J.isDataArrayTexture)k.setTexture2DArray(J,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ae.pixelStorei(37440,J.flipY),ae.pixelStorei(37441,J.premultiplyAlpha),ae.pixelStorei(3317,J.unpackAlignment);const He=ae.getParameter(3314),Ze=ae.getParameter(32878),st=ae.getParameter(3316),gt=ae.getParameter(3315),Mt=ae.getParameter(32877),Je=de.isCompressedTexture?de.mipmaps[0]:de.image;ae.pixelStorei(3314,Je.width),ae.pixelStorei(32878,Je.height),ae.pixelStorei(3316,F.min.x),ae.pixelStorei(3315,F.min.y),ae.pixelStorei(32877,F.min.z),de.isDataTexture||de.isData3DTexture?ae.texSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,$e,Je.data):de.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ae.compressedTexSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,Je.data)):ae.texSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,$e,Je),ae.pixelStorei(3314,He),ae.pixelStorei(32878,Ze),ae.pixelStorei(3316,st),ae.pixelStorei(3315,gt),ae.pixelStorei(32877,Mt),pe===0&&J.generateMipmaps&&ae.generateMipmap(Ge),we.unbindTexture()},this.initTexture=function(F){F.isCubeTexture?k.setTextureCube(F,0):F.isData3DTexture?k.setTexture3D(F,0):F.isDataArrayTexture||F.isCompressedArrayTexture?k.setTexture2DArray(F,0):k.setTexture2D(F,0),we.unbindTexture()},this.resetState=function(){x=0,S=0,y=null,we.reset(),oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class WebGL1Renderer extends WebGLRenderer{}WebGL1Renderer.prototype.isWebGL1Renderer=!0;class FogExp2{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color(e),this.density=t}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Fog{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Color(e),this.near=t,this.far=i}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class InterleavedBuffer{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=StaticDrawUsage,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const _vector$6=new Vector3;class InterleavedBufferAttribute{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)_vector$6.fromBufferAttribute(this,t),_vector$6.applyMatrix4(e),this.setXYZ(t,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)_vector$6.fromBufferAttribute(this,t),_vector$6.applyNormalMatrix(e),this.setXYZ(t,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)_vector$6.fromBufferAttribute(this,t),_vector$6.transformDirection(e),this.setXYZ(t,_vector$6.x,_vector$6.y,_vector$6.z);return this}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=denormalize(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=denormalize(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=denormalize(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=denormalize(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array),s=normalize(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new BufferAttribute(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new InterleavedBufferAttribute(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class SpriteMaterial extends Material{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let _geometry;const _intersectPoint=new Vector3,_worldScale=new Vector3,_mvPosition=new Vector3,_alignedPosition=new Vector2,_rotatedPosition=new Vector2,_viewWorldMatrix=new Matrix4,_vA=new Vector3,_vB=new Vector3,_vC=new Vector3,_uvA=new Vector2,_uvB=new Vector2,_uvC=new Vector2;class Sprite extends Object3D{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",_geometry===void 0){_geometry=new BufferGeometry;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new InterleavedBuffer(t,5);_geometry.setIndex([0,1,2,0,2,3]),_geometry.setAttribute("position",new InterleavedBufferAttribute(i,3,0,!1)),_geometry.setAttribute("uv",new InterleavedBufferAttribute(i,2,3,!1))}this.geometry=_geometry,this.material=e!==void 0?e:new SpriteMaterial,this.center=new Vector2(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_worldScale.setFromMatrixScale(this.matrixWorld),_viewWorldMatrix.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),_mvPosition.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_worldScale.multiplyScalar(-_mvPosition.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;transformVertex(_vA.set(-.5,-.5,0),_mvPosition,a,_worldScale,r,s),transformVertex(_vB.set(.5,-.5,0),_mvPosition,a,_worldScale,r,s),transformVertex(_vC.set(.5,.5,0),_mvPosition,a,_worldScale,r,s),_uvA.set(0,0),_uvB.set(1,0),_uvC.set(1,1);let o=e.ray.intersectTriangle(_vA,_vB,_vC,!1,_intersectPoint);if(o===null&&(transformVertex(_vB.set(-.5,.5,0),_mvPosition,a,_worldScale,r,s),_uvB.set(0,1),o=e.ray.intersectTriangle(_vA,_vC,_vB,!1,_intersectPoint),o===null))return;const l=e.ray.origin.distanceTo(_intersectPoint);l<e.near||l>e.far||t.push({distance:l,point:_intersectPoint.clone(),uv:Triangle.getUV(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function transformVertex(n,e,t,i,r,s){_alignedPosition.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(_rotatedPosition.x=s*_alignedPosition.x-r*_alignedPosition.y,_rotatedPosition.y=r*_alignedPosition.x+s*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),n.copy(e),n.x+=_rotatedPosition.x,n.y+=_rotatedPosition.y,n.applyMatrix4(_viewWorldMatrix)}const _v1$2=new Vector3,_v2$1=new Vector3;class LOD extends Object3D{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){_v1$2.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){_v1$2.setFromMatrixPosition(e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const i=_v1$2.distanceTo(_v2$1)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let a=t[r].distance;if(t[r].object.visible&&(a-=a*t[r].hysteresis),i>=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const a=i[r];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector$5=new Vector3,_matrix=new Matrix4;class SkinnedMesh extends Mesh{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Vector4,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const i=this.skeleton,r=this.geometry;_skinIndex.fromBufferAttribute(r.attributes.skinIndex,e),_skinWeight.fromBufferAttribute(r.attributes.skinWeight,e),_basePosition.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=_skinWeight.getComponent(s);if(a!==0){const o=_skinIndex.getComponent(s);_matrix.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),t.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(e=null,t=1,i=1,r,s,a,o,l,c=NearestFilter,u=NearestFilter,d,f){super(null,a,o,l,c,u,r,s,d,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _offsetMatrix=new Matrix4,_identityMatrix=new Matrix4;class Skeleton{constructor(e=[],t=[]){this.uuid=generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new Matrix4;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:_identityMatrix;_offsetMatrix.multiplyMatrices(o,t[s]),_offsetMatrix.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=ceilPowerOfTwo(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new DataTexture(t,e,e,RGBAFormat,FloatType);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new Bone),this.bones.push(a),this.boneInverses.push(new Matrix4().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=i[r];e.boneInverses.push(o.toArray())}return e}}class InstancedBufferAttribute extends BufferAttribute{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const _instanceLocalMatrix=new Matrix4,_instanceWorldMatrix=new Matrix4,_instanceIntersects=[],_identity=new Matrix4,_mesh=new Mesh;class InstancedMesh extends Mesh{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let r=0;r<i;r++)this.setMatrixAt(r,_identity)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(_mesh.geometry=this.geometry,_mesh.material=this.material,_mesh.material!==void 0)for(let s=0;s<r;s++){this.getMatrixAt(s,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(i,_instanceLocalMatrix),_mesh.matrixWorld=_instanceWorldMatrix,_mesh.raycast(e,_instanceIntersects);for(let a=0,o=_instanceIntersects.length;a<o;a++){const l=_instanceIntersects[a];l.instanceId=s,l.object=this,t.push(l)}_instanceIntersects.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class LineBasicMaterial extends Material{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const _start$1=new Vector3,_end$1=new Vector3,_inverseMatrix$1=new Matrix4,_ray$1=new Ray,_sphere$1=new Sphere;class Line extends Object3D{constructor(e=new BufferGeometry,t=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)_start$1.fromBufferAttribute(t,r-1),_end$1.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=_start$1.distanceTo(_end$1);e.setAttribute("lineDistance",new Float32BufferAttribute(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),_sphere$1.copy(i.boundingSphere),_sphere$1.applyMatrix4(r),_sphere$1.radius+=s,e.ray.intersectsSphere(_sphere$1)===!1)return;_inverseMatrix$1.copy(r).invert(),_ray$1.copy(e.ray).applyMatrix4(_inverseMatrix$1);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new Vector3,u=new Vector3,d=new Vector3,f=new Vector3,m=this.isLineSegments?2:1,v=i.index,g=i.attributes.position;if(v!==null){const x=Math.max(0,a.start),S=Math.min(v.count,a.start+a.count);for(let y=x,b=S-1;y<b;y+=m){const w=v.getX(y),C=v.getX(y+1);if(c.fromBufferAttribute(g,w),u.fromBufferAttribute(g,C),_ray$1.distanceSqToSegment(c,u,f,d)>l)continue;f.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(f);M<e.near||M>e.far||t.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const x=Math.max(0,a.start),S=Math.min(g.count,a.start+a.count);for(let y=x,b=S-1;y<b;y+=m){if(c.fromBufferAttribute(g,y),u.fromBufferAttribute(g,y+1),_ray$1.distanceSqToSegment(c,u,f,d)>l)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);C<e.near||C>e.far||t.push({distance:C,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const _start$2=new Vector3,_end$2=new Vector3;class LineSegments extends Line{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)_start$2.fromBufferAttribute(t,r),_end$2.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+_start$2.distanceTo(_end$2);e.setAttribute("lineDistance",new Float32BufferAttribute(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const _inverseMatrix=new Matrix4,_ray$3=new Ray,_sphere$4=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(e=new BufferGeometry,t=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),_sphere$4.copy(i.boundingSphere),_sphere$4.applyMatrix4(r),_sphere$4.radius+=s,e.ray.intersectsSphere(_sphere$4)===!1)return;_inverseMatrix.copy(r).invert(),_ray$3.copy(e.ray).applyMatrix4(_inverseMatrix);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,d=i.attributes.position;if(c!==null){const f=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let v=f,_=m;v<_;v++){const g=c.getX(v);_position$2.fromBufferAttribute(d,g),testPoint(_position$2,g,l,r,e,t,this)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let v=f,_=m;v<_;v++)_position$2.fromBufferAttribute(d,v),testPoint(_position$2,v,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function testPoint(n,e,t,i,r,s,a){const o=_ray$3.distanceSqToPoint(n);if(o<t){const l=new Vector3;_ray$3.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class VideoTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:LinearFilter,this.magFilter=s!==void 0?s:LinearFilter,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class FramebufferTexture extends Texture{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u,d,f){super(null,a,o,l,c,u,r,s,d,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=ClampToEdgeWrapping}}class CanvasTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);const u=i[r],f=i[r+1]-u,m=(a-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new Vector2:new Vector3);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new Vector3,r=[],s=[],a=[],o=new Vector3,l=new Matrix4;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new Vector3)}s[0]=new Vector3,a[0]=new Vector3;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),f<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),a[m]=a[m-1].clone(),o.crossVectors(r[m-1],r[m]),o.length()>Number.EPSILON){o.normalize();const v=Math.acos(clamp(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(o,v))}a[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(clamp(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),a[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class EllipseCurve extends Curve{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const i=t||new Vector2,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),f=l-this.aX,m=c-this.aY;l=f*u-m*d+this.aX,c=f*d+m*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class ArcCurve extends EllipseCurve{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function CubicPoly(){let n=0,e=0,t=0,i=0;function r(s,a,o,l){n=s,e=o,t=-3*s+3*a-2*o-l,i=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,d){let f=(a-s)/c-(o-s)/(c+u)+(o-a)/u,m=(o-a)/u-(l-a)/(u+d)+(l-o)/d;f*=u,m*=u,r(a,o,f,m)},calc:function(s){const a=s*s,o=a*s;return n+e*s+t*a+i*o}}}const tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;class CatmullRomCurve3 extends Curve{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new Vector3){const i=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(tmp.subVectors(r[0],r[1]).add(r[0]),c=tmp);const d=r[o%s],f=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(tmp.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=tmp),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let v=Math.pow(c.distanceToSquared(d),m),_=Math.pow(d.distanceToSquared(f),m),g=Math.pow(f.distanceToSquared(u),m);_<1e-4&&(_=1),v<1e-4&&(v=_),g<1e-4&&(g=_),px.initNonuniformCatmullRom(c.x,d.x,f.x,u.x,v,_,g),py.initNonuniformCatmullRom(c.y,d.y,f.y,u.y,v,_,g),pz.initNonuniformCatmullRom(c.z,d.z,f.z,u.z,v,_,g)}else this.curveType==="catmullrom"&&(px.initCatmullRom(c.x,d.x,f.x,u.x,this.tension),py.initCatmullRom(c.y,d.y,f.y,u.y,this.tension),pz.initCatmullRom(c.z,d.z,f.z,u.z,this.tension));return i.set(px.calc(l),py.calc(l),pz.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Vector3().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function CatmullRom(n,e,t,i,r){const s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}function QuadraticBezierP0(n,e){const t=1-n;return t*t*e}function QuadraticBezierP1(n,e){return 2*(1-n)*n*e}function QuadraticBezierP2(n,e){return n*n*e}function QuadraticBezier(n,e,t,i){return QuadraticBezierP0(n,e)+QuadraticBezierP1(n,t)+QuadraticBezierP2(n,i)}function CubicBezierP0(n,e){const t=1-n;return t*t*t*e}function CubicBezierP1(n,e){const t=1-n;return 3*t*t*n*e}function CubicBezierP2(n,e){return 3*(1-n)*n*n*e}function CubicBezierP3(n,e){return n*n*n*e}function CubicBezier(n,e,t,i,r){return CubicBezierP0(n,e)+CubicBezierP1(n,t)+CubicBezierP2(n,i)+CubicBezierP3(n,r)}class CubicBezierCurve extends Curve{constructor(e=new Vector2,t=new Vector2,i=new Vector2,r=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Vector2){const i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(CubicBezier(e,r.x,s.x,a.x,o.x),CubicBezier(e,r.y,s.y,a.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class CubicBezierCurve3 extends Curve{constructor(e=new Vector3,t=new Vector3,i=new Vector3,r=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Vector3){const i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(CubicBezier(e,r.x,s.x,a.x,o.x),CubicBezier(e,r.y,s.y,a.y,o.y),CubicBezier(e,r.z,s.z,a.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class LineCurve extends Curve{constructor(e=new Vector2,t=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Vector2){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const i=t||new Vector2;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class LineCurve3 extends Curve{constructor(e=new Vector3,t=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Vector3){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class QuadraticBezierCurve extends Curve{constructor(e=new Vector2,t=new Vector2,i=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Vector2){const i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(QuadraticBezier(e,r.x,s.x,a.x),QuadraticBezier(e,r.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class QuadraticBezierCurve3 extends Curve{constructor(e=new Vector3,t=new Vector3,i=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Vector3){const i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(QuadraticBezier(e,r.x,s.x,a.x),QuadraticBezier(e,r.y,s.y,a.y),QuadraticBezier(e,r.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class SplineCurve extends Curve{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Vector2){const i=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return i.set(CatmullRom(o,l.x,c.x,u.x,d.x),CatmullRom(o,l.y,c.y,u.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Vector2().fromArray(r))}return this}}var Curves=Object.freeze({__proto__:null,ArcCurve,CatmullRomCurve3,CubicBezierCurve,CubicBezierCurve3,EllipseCurve,LineCurve,LineCurve3,QuadraticBezierCurve,QuadraticBezierCurve3,SplineCurve});class CurvePath extends Curve{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new LineCurve(t,e))}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const a=r[s]-i,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const a=s[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new Curves[r.type]().fromJSON(r))}return this}}class Path extends CurvePath{constructor(e){super(),this.type="Path",this.currentPoint=new Vector2,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new LineCurve(this.currentPoint.clone(),new Vector2(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,a){const o=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(i,r),new Vector2(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new SplineCurve(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,i,r,s,a),this}absarc(e,t,i,r,s,a){return this.absellipse(e,t,i,i,r,s,a),this}ellipse(e,t,i,r,s,a,o,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,a,o,l),this}absellipse(e,t,i,r,s,a,o,l){const c=new EllipseCurve(e,t,i,r,s,a,o,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class LatheGeometry extends BufferGeometry{constructor(e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=clamp(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,d=new Vector3,f=new Vector2,m=new Vector3,v=new Vector3,_=new Vector3;let g=0,x=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:g=e[S+1].x-e[S].x,x=e[S+1].y-e[S].y,m.x=x*1,m.y=-g,m.z=x*0,_.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[S+1].x-e[S].x,x=e[S+1].y-e[S].y,m.x=x*1,m.y=-g,m.z=x*0,v.copy(m),m.x+=_.x,m.y+=_.y,m.z+=_.z,m.normalize(),l.push(m.x,m.y,m.z),_.copy(v)}for(let S=0;S<=t;S++){const y=i+S*u*r,b=Math.sin(y),w=Math.cos(y);for(let C=0;C<=e.length-1;C++){d.x=e[C].x*b,d.y=e[C].y,d.z=e[C].x*w,a.push(d.x,d.y,d.z),f.x=S/t,f.y=C/(e.length-1),o.push(f.x,f.y);const R=l[3*C+0]*b,M=l[3*C+1],L=l[3*C+0]*w;c.push(R,M,L)}}for(let S=0;S<t;S++)for(let y=0;y<e.length-1;y++){const b=y+S*e.length,w=b,C=b+e.length,R=b+e.length+1,M=b+1;s.push(w,C,M),s.push(R,M,C)}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("uv",new Float32BufferAttribute(o,2)),this.setAttribute("normal",new Float32BufferAttribute(c,3))}static fromJSON(e){return new LatheGeometry(e.points,e.segments,e.phiStart,e.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(e=1,t=1,i=4,r=8){const s=new Path;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new CapsuleGeometry(e.radius,e.length,e.capSegments,e.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(e=1,t=8,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new Vector3,u=new Vector2;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let d=0,f=3;d<=t;d++,f+=3){const m=i+d/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),a.push(c.x,c.y,c.z),o.push(0,0,1),u.x=(a[f]/e+1)/2,u.y=(a[f+1]/e+1)/2,l.push(u.x,u.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("normal",new Float32BufferAttribute(o,3)),this.setAttribute("uv",new Float32BufferAttribute(l,2))}static fromJSON(e){return new CircleGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(e=1,t=1,i=1,r=8,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],d=[],f=[],m=[];let v=0;const _=[],g=i/2;let x=0;S(),a===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new Float32BufferAttribute(d,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2));function S(){const b=new Vector3,w=new Vector3;let C=0;const R=(t-e)/i;for(let M=0;M<=s;M++){const L=[],B=M/s,Z=B*(t-e)+e;for(let W=0;W<=r;W++){const X=W/r,G=X*l+o,le=Math.sin(G),he=Math.cos(G);w.x=Z*le,w.y=-B*i+g,w.z=Z*he,d.push(w.x,w.y,w.z),b.set(le,R,he).normalize(),f.push(b.x,b.y,b.z),m.push(X,1-B),L.push(v++)}_.push(L)}for(let M=0;M<r;M++)for(let L=0;L<s;L++){const B=_[L][M],Z=_[L+1][M],W=_[L+1][M+1],X=_[L][M+1];u.push(B,Z,X),u.push(Z,W,X),C+=6}c.addGroup(x,C,0),x+=C}function y(b){const w=v,C=new Vector2,R=new Vector3;let M=0;const L=b===!0?e:t,B=b===!0?1:-1;for(let W=1;W<=r;W++)d.push(0,g*B,0),f.push(0,B,0),m.push(.5,.5),v++;const Z=v;for(let W=0;W<=r;W++){const G=W/r*l+o,le=Math.cos(G),he=Math.sin(G);R.x=L*he,R.y=g*B,R.z=L*le,d.push(R.x,R.y,R.z),f.push(0,B,0),C.x=le*.5+.5,C.y=he*.5*B+.5,m.push(C.x,C.y),v++}for(let W=0;W<r;W++){const X=w+W,G=Z+W;b===!0?u.push(G,G+1,X):u.push(G+1,G,X),M+=3}c.addGroup(x,M,b===!0?1:2),x+=M}}static fromJSON(e){return new CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ConeGeometry extends CylinderGeometry{constructor(e=1,t=1,i=8,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,i,r,s,a,o),this.type="C
3144oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new ConeGeometry(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class PolyhedronGeometry extends BufferGeometry{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],a=[];o(r),c(i),u(),this.setAttribute("position",new Float32BufferAttribute(s,3)),this.setAttribute("normal",new Float32BufferAttribute(s.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(S){const y=new Vector3,b=new Vector3,w=new Vector3;for(let C=0;C<t.length;C+=3)m(t[C+0],y),m(t[C+1],b),m(t[C+2],w),l(y,b,w,S)}function l(S,y,b,w){const C=w+1,R=[];for(let M=0;M<=C;M++){R[M]=[];const L=S.clone().lerp(b,M/C),B=y.clone().lerp(b,M/C),Z=C-M;for(let W=0;W<=Z;W++)W===0&&M===C?R[M][W]=L:R[M][W]=L.clone().lerp(B,W/Z)}for(let M=0;M<C;M++)for(let L=0;L<2*(C-M)-1;L++){const B=Math.floor(L/2);L%2===0?(f(R[M][B+1]),f(R[M+1][B]),f(R[M][B])):(f(R[M][B+1]),f(R[M+1][B+1]),f(R[M+1][B]))}}function c(S){const y=new Vector3;for(let b=0;b<s.length;b+=3)y.x=s[b+0],y.y=s[b+1],y.z=s[b+2],y.normalize().multiplyScalar(S),s[b+0]=y.x,s[b+1]=y.y,s[b+2]=y.z}function u(){const S=new Vector3;for(let y=0;y<s.length;y+=3){S.x=s[y+0],S.y=s[y+1],S.z=s[y+2];const b=g(S)/2/Math.PI+.5,w=x(S)/Math.PI+.5;a.push(b,1-w)}v(),d()}function d(){for(let S=0;S<a.length;S+=6){const y=a[S+0],b=a[S+2],w=a[S+4],C=Math.max(y,b,w),R=Math.min(y,b,w);C>.9&&R<.1&&(y<.2&&(a[S+0]+=1),b<.2&&(a[S+2]+=1),w<.2&&(a[S+4]+=1))}}function f(S){s.push(S.x,S.y,S.z)}function m(S,y){const b=S*3;y.x=e[b+0],y.y=e[b+1],y.z=e[b+2]}function v(){const S=new Vector3,y=new Vector3,b=new Vector3,w=new Vector3,C=new Vector2,R=new Vector2,M=new Vector2;for(let L=0,B=0;L<s.length;L+=9,B+=6){S.set(s[L+0],s[L+1],s[L+2]),y.set(s[L+3],s[L+4],s[L+5]),b.set(s[L+6],s[L+7],s[L+8]),C.set(a[B+0],a[B+1]),R.set(a[B+2],a[B+3]),M.set(a[B+4],a[B+5]),w.copy(S).add(y).add(b).divideScalar(3);const Z=g(w);_(C,B+0,S,Z),_(R,B+2,y,Z),_(M,B+4,b,Z)}}function _(S,y,b,w){w<0&&S.x===1&&(a[y]=S.x-1),b.x===0&&b.z===0&&(a[y]=w/2/Math.PI+.5)}function g(S){return Math.atan2(S.z,-S.x)}function x(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}static fromJSON(e){return new PolyhedronGeometry(e.vertices,e.indices,e.radius,e.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 157,523 bytes, line 3144
314419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new DodecahedronGeometry(e.radius,e.detail)}}const _v0=new Vector3,_v1$1=new Vector3,_normal=new Vector3,_triangle=new Triangle;class EdgesGeometry extends BufferGeometry{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(DEG2RAD$1*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),f={},m=[];for(let v=0;v<l;v+=3){a?(c[0]=a.getX(v),c[1]=a.getX(v+1),c[2]=a.getX(v+2)):(c[0]=v,c[1]=v+1,c[2]=v+2);const{a:_,b:g,c:x}=_triangle;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),x.fromBufferAttribute(o,c[2]),_triangle.getNormal(_normal),d[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[1]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,d[2]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let S=0;S<3;S++){const y=(S+1)%3,b=d[S],w=d[y],C=_triangle[u[S]],R=_triangle[u[y]],M=`${b}_${w}`,L=`${w}_${b}`;L in f&&f[L]?(_normal.dot(f[L].normal)<=s&&(m.push(C.x,C.y,C.z),m.push(R.x,R.y,R.z)),f[L]=null):M in f||(f[M]={index0:c[S],index1:c[y],normal:_normal.clone()})}}for(const v in f)if(f[v]){const{index0:_,index1:g}=f[v];_v0.fromBufferAttribute(o,_),_v1$1.fromBufferAttribute(o,g),m.push(_v0.x,_v0.y,_v0.z),m.push(_v1$1.x,_v1$1.y,_v1$1.z)}this.setAttribute("position",new Float32BufferAttribute(m,3))}}}class Shape extends Path{constructor(e){super(e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new Path().fromJSON(r))}return this}}const Earcut={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=linkedList(n,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,u,d,f,m;if(i&&(s=eliminateHoles(n,e,s,t)),n.length>80*t){o=c=n[0],l=u=n[1];for(let v=t;v<r;v+=t)d=n[v],f=n[v+1],d<o&&(o=d),f<l&&(l=f),d>c&&(c=d),f>u&&(u=f);m=Math.max(c-o,u-l),m=m!==0?32767/m:0}return earcutLinked(s,a,t,o,l,m,0),a}};function linkedList(n,e,t,i,r){let s,a;if(r===signedArea(n,e,t,i)>0)for(s=e;s<t;s+=i)a=insertNode(s,n[s],n[s+1],a);else for(s=t-i;s>=e;s-=i)a=insertNode(s,n[s],n[s+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(equals(t,t.next)||area(t.prev,t,t.next)===0)){if(removeNode(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function earcutLinked(n,e,t,i,r,s,a){if(!n)return;!a&&s&&indexCurve(n,i,r,s);let o=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?isEarHashed(n,i,r,s):isEar(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),removeNode(n),n=c.next,o=c.next;continue}if(n=c,n===o){a?a===1?(n=cureLocalIntersections(filterPoints(n),e,t),earcutLinked(n,e,t,i,r,s,2)):a===2&&splitEarcut(n,e,t,i,r,s):earcutLinked(filterPoints(n),e,t,i,r,s,1);break}}}function isEar(n){const e=n.prev,t=n,i=n.next;if(area(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=r<s?r<a?r:a:s<a?s:a,d=o<l?o<c?o:c:l<c?l:c,f=r>s?r>a?r:a:s>a?s:a,m=o>l?o>c?o:c:l>c?l:c;let v=i.next;for(;v!==e;){if(v.x>=u&&v.x<=f&&v.y>=d&&v.y<=m&&pointInTriangle(r,o,s,l,a,c,v.x,v.y)&&area(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function isEarHashed(n,e,t,i){const r=n.prev,s=n,a=n.next;if(area(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,d=s.y,f=a.y,m=o<l?o<c?o:c:l<c?l:c,v=u<d?u<f?u:f:d<f?d:f,_=o>l?o>c?o:c:l>c?l:c,g=u>d?u>f?u:f:d>f?d:f,x=zOrder(m,v,e,t,i),S=zOrder(_,g,e,t,i);let y=n.prevZ,b=n.nextZ;for(;y&&y.z>=x&&b&&b.z<=S;){if(y.x>=m&&y.x<=_&&y.y>=v&&y.y<=g&&y!==r&&y!==a&&pointInTriangle(o,u,l,d,c,f,y.x,y.y)&&area(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=m&&b.x<=_&&b.y>=v&&b.y<=g&&b!==r&&b!==a&&pointInTriangle(o,u,l,d,c,f,b.x,b.y)&&area(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=x;){if(y.x>=m&&y.x<=_&&y.y>=v&&y.y<=g&&y!==r&&y!==a&&pointInTriangle(o,u,l,d,c,f,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=S;){if(b.x>=m&&b.x<=_&&b.y>=v&&b.y<=g&&b!==r&&b!==a&&pointInTriangle(o,u,l,d,c,f,b.x,b.y)&&area(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function cureLocalIntersections(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!equals(r,s)&&intersects(r,i,i.next,s)&&locallyInside(r,s)&&locallyInside(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),removeNode(i),removeNode(i.next),i=n=s),i=i.next}while(i!==n);return filterPoints(i)}function splitEarcut(n,e,t,i,r,s){let a=n;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){let l=splitPolygon(a,o);a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,e,t,i,r,s,0),earcutLinked(l,e,t,i,r,s,0);return}o=o.next}a=a.next}while(a!==n)}function eliminateHoles(n,e,t,i){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*i,l=s<a-1?e[s+1]*i:n.length,c=linkedList(n,o,l,i,!1),c===c.next&&(c.steiner=!0),r.push(getLeftmost(c));for(r.sort(compareX),s=0;s<r.length;s++)t=eliminateHole(r[s],t);return t}function compareX(n,e){return n.x-e.x}function eliminateHole(n,e){const t=findHoleBridge(n,e);if(!t)return e;const i=splitPolygon(t,n);return filterPoints(i,i.next),filterPoints(t,t.next)}function findHoleBridge(n,e){let t=e,i=-1/0,r;const s=n.x,a=n.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;const o=r,l=r.x,c=r.y;let u=1/0,d;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&pointInTriangle(a<c?s:i,a,l,c,a<c?i:s,a,t.x,t.y)&&(d=Math.abs(a-t.y)/(s-t.x),locallyInside(t,n)&&(d<u||d===u&&(t.x>r.x||t.x===r.x&§orContainsSector(r,t)))&&(r=t,u=d)),t=t.next;while(t!==o);return r}function sectorContainsSector(n,e){return area(n.prev,n,e.prev)<0&&area(e.next,n,n.next)<0}function indexCurve(n,e,t,i){let r=n;do r.z===0&&(r.z=zOrder(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,sortLinked(r)}function sortLinked(n){let e,t,i,r,s,a,o,l,c=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e<c&&(o++,i=i.nextZ,!!i);e++);for(l=c;o>0||l>0&&i;)o!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(a>1);return n}function zOrder(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function getLeftmost(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function pointInTriangle(n,e,t,i,r,s,a,o){return(r-a)*(e-o)>=(n-a)*(s-o)&&(n-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(i-o)}function isValidDiagonal(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!intersectsPolygon(n,e)&&(locallyInside(n,e)&&locallyInside(e,n)&&middleInside(n,e)&&(area(n.prev,n,e.prev)||area(n,e.prev,e))||equals(n,e)&&area(n.prev,n,n.next)>0&&area(e.prev,e,e.next)>0)}function area(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function equals(n,e){return n.x===e.x&&n.y===e.y}function intersects(n,e,t,i){const r=sign(area(n,e,t)),s=sign(area(n,e,i)),a=sign(area(t,i,n)),o=sign(area(t,i,e));return!!(r!==s&&a!==o||r===0&&onSegment(n,t,e)||s===0&&onSegment(n,i,e)||a===0&&onSegment(t,n,i)||o===0&&onSegment(t,e,i))}function onSegment(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function sign(n){return n>0?1:n<0?-1:0}function intersectsPolygon(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&intersects(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function locallyInside(n,e){return area(n.prev,n,n.next)<0?area(n,e,n.next)>=0&&area(n,n.prev,e)>=0:area(n,e,n.prev)<0||area(n,n.next,e)<0}function middleInside(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function splitPolygon(n,e){const t=new Node(n.i,n.x,n.y),i=new Node(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function insertNode(n,e,t,i){const r=new Node(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function removeNode(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Node(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(n,e,t,i){let r=0;for(let s=e,a=t-i;s<t;s+=i)r+=(n[a]-n[s])*(n[s+1]+n[a+1]),a=s;return r}class ShapeUtils{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return ShapeUtils.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];removeDupEndPts(e),addContour(i,e);let a=e.length;t.forEach(removeDupEndPts);for(let l=0;l<t.length;l++)r.push(a),a+=t[l].length,addContour(i,t[l]);const o=Earcut.triangulate(i,r);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function removeDupEndPts(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function addContour(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class ExtrudeGeometry extends BufferGeometry{constructor(e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Float32BufferAttribute(r,3)),this.setAttribute("uv",new Float32BufferAttribute(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:m-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const x=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:WorldUVGenerator;let y,b=!1,w,C,R,M;x&&(y=x.getSpacedPoints(u),b=!0,f=!1,w=x.computeFrenetFrames(u,!1),C=new Vector3,R=new Vector3,M=new Vector3),f||(g=0,m=0,v=0,_=0);const L=o.extractPoints(c);let B=L.shape;const Z=L.holes;if(!ShapeUtils.isClockWise(B)){B=B.reverse();for(let D=0,k=Z.length;D<k;D++){const H=Z[D];ShapeUtils.isClockWise(H)&&(Z[D]=H.reverse())}}const X=ShapeUtils.triangulateShape(B,Z),G=B;for(let D=0,k=Z.length;D<k;D++){const H=Z[D];B=B.concat(H)}function le(D,k,H){return k||console.error("THREE.ExtrudeGeometry: vec does not exist"),k.clone().multiplyScalar(H).add(D)}const he=B.length,ue=X.length;function ie(D,k,H){let j,Y,ce;const re=D.x-k.x,se=D.y-k.y,P=H.x-D.x,N=H.y-D.y,T=re*re+se*se,E=re*N-se*P;if(Math.abs(E)>Number.EPSILON){const z=Math.sqrt(T),K=Math.sqrt(P*P+N*N),V=k.x-se/z,$=k.y+re/z,be=H.x-N/K,ge=H.y+P/K,oe=((be-V)*N-(ge-$)*P)/(re*N-se*P);j=V+re*oe-D.x,Y=$+se*oe-D.y;const Ie=j*j+Y*Y;if(Ie<=2)return new Vector2(j,Y);ce=Math.sqrt(Ie/2)}else{let z=!1;re>Number.EPSILON?P>Number.EPSILON&&(z=!0):re<-Number.EPSILON?P<-Number.EPSILON&&(z=!0):Math.sign(se)===Math.sign(N)&&(z=!0),z?(j=-se,Y=re,ce=Math.sqrt(T)):(j=re,Y=se,ce=Math.sqrt(T/2))}return new Vector2(j/ce,Y/ce)}const ve=[];for(let D=0,k=G.length,H=k-1,j=D+1;D<k;D++,H++,j++)H===k&&(H=0),j===k&&(j=0),ve[D]=ie(G[D],G[H],G[j]);const _e=[];let Q,ne=ve.concat();for(let D=0,k=Z.length;D<k;D++){const H=Z[D];Q=[];for(let j=0,Y=H.length,ce=Y-1,re=j+1;j<Y;j++,ce++,re++)ce===Y&&(ce=0),re===Y&&(re=0),Q[j]=ie(H[j],H[ce],H[re]);_e.push(Q),ne=ne.concat(Q)}for(let D=0;D<g;D++){const k=D/g,H=m*Math.cos(k*Math.PI/2),j=v*Math.sin(k*Math.PI/2)+_;for(let Y=0,ce=G.length;Y<ce;Y++){const re=le(G[Y],ve[Y],j);Le(re.x,re.y,-H)}for(let Y=0,ce=Z.length;Y<ce;Y++){const re=Z[Y];Q=_e[Y];for(let se=0,P=re.length;se<P;se++){const N=le(re[se],Q[se],j);Le(N.x,N.y,-H)}}}const ye=v+_;for(let D=0;D<he;D++){const k=f?le(B[D],ne[D],ye):B[D];b?(R.copy(w.normals[0]).multiplyScalar(k.x),C.copy(w.binormals[0]).multiplyScalar(k.y),M.copy(y[0]).add(R).add(C),Le(M.x,M.y,M.z)):Le(k.x,k.y,0)}for(let D=1;D<=u;D++)for(let k=0;k<he;k++){const H=f?le(B[k],ne[k],ye):B[k];b?(R.copy(w.normals[D]).multiplyScalar(H.x),C.copy(w.binormals[D]).multiplyScalar(H.y),M.copy(y[D]).add(R).add(C),Le(M.x,M.y,M.z)):Le(H.x,H.y,d/u*D)}for(let D=g-1;D>=0;D--){const k=D/g,H=m*Math.cos(k*Math.PI/2),j=v*Math.sin(k*Math.PI/2)+_;for(let Y=0,ce=G.length;Y<ce;Y++){const re=le(G[Y],ve[Y],j);Le(re.x,re.y,d+H)}for(let Y=0,ce=Z.length;Y<ce;Y++){const re=Z[Y];Q=_e[Y];for(let se=0,P=re.length;se<P;se++){const N=le(re[se],Q[se],j);b?Le(N.x,N.y+y[u-1].y,y[u-1].x+H):Le(N.x,N.y,d+H)}}}Me(),Te();function Me(){const D=r.length/3;if(f){let k=0,H=he*k;for(let j=0;j<ue;j++){const Y=X[j];Ee(Y[2]+H,Y[1]+H,Y[0]+H)}k=u+g*2,H=he*k;for(let j=0;j<ue;j++){const Y=X[j];Ee(Y[0]+H,Y[1]+H,Y[2]+H)}}else{for(let k=0;k<ue;k++){const H=X[k];Ee(H[2],H[1],H[0])}for(let k=0;k<ue;k++){const H=X[k];Ee(H[0]+he*u,H[1]+he*u,H[2]+he*u)}}i.addGroup(D,r.length/3-D,0)}function Te(){const D=r.length/3;let k=0;ae(G,k),k+=G.length;for(let H=0,j=Z.length;H<j;H++){const Y=Z[H];ae(Y,k),k+=Y.length}i.addGroup(D,r.length/3-D,1)}function ae(D,k){let H=D.length;for(;--H>=0;){const j=H;let Y=H-1;Y<0&&(Y=D.length-1);for(let ce=0,re=u+g*2;ce<re;ce++){const se=he*ce,P=he*(ce+1),N=k+j+se,T=k+Y+se,E=k+Y+P,z=k+j+P;Ce(N,T,E,z)}}}function Le(D,k,H){l.push(D),l.push(k),l.push(H)}function Ee(D,k,H){we(D),we(k),we(H);const j=r.length/3,Y=S.generateTopUV(i,r,j-3,j-2,j-1);O(Y[0]),O(Y[1]),O(Y[2])}function Ce(D,k,H,j){we(D),we(k),we(j),we(k),we(H),we(j);const Y=r.length/3,ce=S.generateSideWallUV(i,r,Y-6,Y-3,Y-2,Y-1);O(ce[0]),O(ce[1]),O(ce[3]),O(ce[1]),O(ce[2]),O(ce[3])}function we(D){r.push(l[D*3+0]),r.push(l[D*3+1]),r.push(l[D*3+2])}function O(D){s.push(D.x),s.push(D.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return toJSON$1(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];i.push(o)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Curves[r.type]().fromJSON(r)),new ExtrudeGeometry(i,e.options)}}const WorldUVGenerator={generateTopUV:function(n,e,t,i,r){const s=e[t*3],a=e[t*3+1],o=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new Vector2(s,a),new Vector2(o,l),new Vector2(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],d=e[i*3+2],f=e[r*3],m=e[r*3+1],v=e[r*3+2],_=e[s*3],g=e[s*3+1],x=e[s*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new Vector2(a,1-l),new Vector2(c,1-d),new Vector2(f,1-v),new Vector2(_,1-x)]:[new Vector2(o,1-l),new Vector2(u,1-d),new Vector2(m,1-v),new Vector2(g,1-x)]}};function toJSON$1(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class IcosahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new IcosahedronGeometry(e.radius,e.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new OctahedronGeometry(e.radius,e.detail)}}class RingGeometry extends BufferGeometry{constructor(e=.5,t=1,i=8,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:a},i=Math.max(3,i),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let d=e;const f=(t-e)/r,m=new Vector3,v=new Vector2;for(let _=0;_<=r;_++){for(let g=0;g<=i;g++){const x=s+g/i*a;m.x=d*Math.cos(x),m.y=d*Math.sin(x),l.push(m.x,m.y,m.z),c.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,u.push(v.x,v.y)}d+=f}for(let _=0;_<r;_++){const g=_*(i+1);for(let x=0;x<i;x++){const S=x+g,y=S,b=S+i+1,w=S+i+2,C=S+1;o.push(y,b,C),o.push(b,w,C)}}this.setIndex(o),this.setAttribute("position",new Float32BufferAttribute(l,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}static fromJSON(e){return new RingGeometry(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ShapeGeometry extends BufferGeometry{constructor(e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(o,l,u),o+=l,l=0;this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(r,3)),this.setAttribute("normal",new Float32BufferAttribute(s,3)),this.setAttribute("uv",new Float32BufferAttribute(a,2));function c(u){const d=r.length/3,f=u.extractPoints(t);let m=f.shape;const v=f.holes;ShapeUtils.isClockWise(m)===!1&&(m=m.reverse());for(let g=0,x=v.length;g<x;g++){const S=v[g];ShapeUtils.isClockWise(S)===!0&&(v[g]=S.reverse())}const _=ShapeUtils.triangulateShape(m,v);for(let g=0,x=v.length;g<x;g++){const S=v[g];m=m.concat(S)}for(let g=0,x=m.length;g<x;g++){const S=m[g];r.push(S.x,S.y,0),s.push(0,0,1),a.push(S.x,S.y)}for(let g=0,x=_.length;g<x;g++){const S=_[g],y=S[0]+d,b=S[1]+d,w=S[2]+d;i.push(y,b,w),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return toJSON(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const a=t[e.shapes[r]];i.push(a)}return new ShapeGeometry(i,e.curveSegments)}}function toJSON(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class SphereGeometry extends BufferGeometry{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new Vector3,f=new Vector3,m=[],v=[],_=[],g=[];for(let x=0;x<=i;x++){const S=[],y=x/i;let b=0;x==0&&a==0?b=.5/t:x==i&&l==Math.PI&&(b=-.5/t);for(let w=0;w<=t;w++){const C=w/t;d.x=-e*Math.cos(r+C*s)*Math.sin(a+y*o),d.y=e*Math.cos(a+y*o),d.z=e*Math.sin(r+C*s)*Math.sin(a+y*o),v.push(d.x,d.y,d.z),f.copy(d).normalize(),_.push(f.x,f.y,f.z),g.push(C+b,1-y),S.push(c++)}u.push(S)}for(let x=0;x<i;x++)for(let S=0;S<t;S++){const y=u[x][S+1],b=u[x][S],w=u[x+1][S],C=u[x+1][S+1];(x!==0||a>0)&&m.push(y,b,C),(x!==i-1||l<Math.PI)&&m.push(b,w,C)}this.setIndex(m),this.setAttribute("position",new Float32BufferAttribute(v,3)),this.setAttribute("normal",new Float32BufferAttribute(_,3)),this.setAttribute("uv",new Float32BufferAttribute(g,2))}static fromJSON(e){return new SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class TetrahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new TetrahedronGeometry(e.radius,e.detail)}}class TorusGeometry extends BufferGeometry{constructor(e=1,t=.4,i=8,r=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const a=[],o=[],l=[],c=[],u=new Vector3,d=new Vector3,f=new Vector3;for(let m=0;m<=i;m++)for(let v=0;v<=r;v++){const _=v/r*s,g=m/i*Math.PI*2;d.x=(e+t*Math.cos(g))*Math.cos(_),d.y=(e+t*Math.cos(g))*Math.sin(_),d.z=t*Math.sin(g),o.push(d.x,d.y,d.z),u.x=e*Math.cos(_),u.y=e*Math.sin(_),f.subVectors(d,u).normalize(),l.push(f.x,f.y,f.z),c.push(v/r),c.push(m/i)}for(let m=1;m<=i;m++)for(let v=1;v<=r;v++){const _=(r+1)*m+v-1,g=(r+1)*(m-1)+v-1,x=(r+1)*(m-1)+v,S=(r+1)*m+v;a.push(_,g,S),a.push(g,x,S)}this.setIndex(a),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(c,2))}static fromJSON(e){return new TorusGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(e=1,t=.4,i=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:a},i=Math.floor(i),r=Math.floor(r);const o=[],l=[],c=[],u=[],d=new Vector3,f=new Vector3,m=new Vector3,v=new Vector3,_=new Vector3,g=new Vector3,x=new Vector3;for(let y=0;y<=i;++y){const b=y/i*s*Math.PI*2;S(b,s,a,e,m),S(b+.01,s,a,e,v),g.subVectors(v,m),x.addVectors(v,m),_.crossVectors(g,x),x.crossVectors(_,g),_.normalize(),x.normalize();for(let w=0;w<=r;++w){const C=w/r*Math.PI*2,R=-t*Math.cos(C),M=t*Math.sin(C);d.x=m.x+(R*x.x+M*_.x),d.y=m.y+(R*x.y+M*_.y),d.z=m.z+(R*x.z+M*_.z),l.push(d.x,d.y,d.z),f.subVectors(d,m).normalize(),c.push(f.x,f.y,f.z),u.push(y/i),u.push(w/r)}}for(let y=1;y<=i;y++)for(let b=1;b<=r;b++){const w=(r+1)*(y-1)+(b-1),C=(r+1)*y+(b-1),R=(r+1)*y+b,M=(r+1)*(y-1)+b;o.push(w,C,M),o.push(C,R,M)}this.setIndex(o),this.setAttribute("position",new Float32BufferAttribute(l,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2));function S(y,b,w,C,R){const M=Math.cos(y),L=Math.sin(y),B=w/b*y,Z=Math.cos(B);R.x=C*(2+Z)*.5*M,R.y=C*(2+Z)*L*.5,R.z=C*Math.sin(B)*.5}}static fromJSON(e){return new TorusKnotGeometry(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class TubeGeometry extends BufferGeometry{constructor(e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new Vector3,l=new Vector3,c=new Vector2;let u=new Vector3;const d=[],f=[],m=[],v=[];_(),this.setIndex(v),this.setAttribute("position",new Float32BufferAttribute(d,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2));function _(){for(let y=0;y<t;y++)g(y);g(s===!1?t:0),S(),x()}function g(y){u=e.getPointAt(y/t,u);const b=a.normals[y],w=a.binormals[y];for(let C=0;C<=r;C++){const R=C/r*Math.PI*2,M=Math.sin(R),L=-Math.cos(R);l.x=L*b.x+M*w.x,l.y=L*b.y+M*w.y,l.z=L*b.z+M*w.z,l.normalize(),f.push(l.x,l.y,l.z),o.x=u.x+i*l.x,o.y=u.y+i*l.y,o.z=u.z+i*l.z,d.push(o.x,o.y,o.z)}}function x(){for(let y=1;y<=t;y++)for(let b=1;b<=r;b++){const w=(r+1)*(y-1)+(b-1),C=(r+1)*y+(b-1),R=(r+1)*y+b,M=(r+1)*(y-1)+b;v.push(w,C,M),v.push(C,R,M)}}function S(){for(let y=0;y<=t;y++)for(let b=0;b<=r;b++)c.x=y/t,c.y=b/r,m.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new TubeGeometry(new Curves[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class WireframeGeometry extends BufferGeometry{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new Vector3,s=new Vector3;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const d=l[c],f=d.start,m=d.count;for(let v=f,_=f+m;v<_;v+=3)for(let g=0;g<3;g++){const x=o.getX(v+g),S=o.getX(v+(g+1)%3);r.fromBufferAttribute(a,x),s.fromBufferAttribute(a,S),isUniqueEdge(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,d=3*o+(c+1)%3;r.fromBufferAttribute(a,u),s.fromBufferAttribute(a,d),isUniqueEdge(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Float32BufferAttribute(t,3))}}}function isUniqueEdge(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var Geometries=Object.freeze({__proto__:null,BoxGeometry,CapsuleGeometry,CircleGeometry,ConeGeometry,CylinderGeometry,DodecahedronGeometry,EdgesGeometry,ExtrudeGeometry,IcosahedronGeometry,LatheGeometry,OctahedronGeometry,PlaneGeometry,PolyhedronGeometry,RingGeometry,ShapeGeometry,SphereGeometry,TetrahedronGeometry,TorusGeometry,TorusKnotGeometry,TubeGeometry,WireframeGeometry});class ShadowMaterial extends Material{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Color(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class RawShaderMaterial extends ShaderMaterial{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class MeshStandardMaterial extends Material{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(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 Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class MeshPhysicalMaterial extends MeshStandardMaterial{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class MeshPhongMaterial extends Material{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color(16777215),this.specular=new Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class MeshToonMaterial extends Material{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class MeshNormalMaterial extends Material{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class MeshLambertMaterial extends Material{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class MeshMatcapMaterial extends Material{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class LineDashedMaterial extends LineBasicMaterial{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function arraySlice(n,e,t){return isTypedArray(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function convertArray(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function isTypedArray(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function getKeyframeOrder(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function sortedArray(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=n[o+l]}return r}function flattenJSON(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}function subclip(n,e,t,i,r=30){const s=n.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),d=[],f=[];for(let m=0;m<c.times.length;++m){const v=c.times[m]*r;if(!(v<t||v>=i)){d.push(c.times[m]);for(let _=0;_<u;++_)f.push(c.values[m*u+_])}}d.length!==0&&(c.times=convertArray(d,c.times.constructor),c.values=convertArray(f,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function makeClipAdditive(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let a=0;a<r;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(x){return x.name===o.name&&x.ValueTypeName===l});if(c===void 0)continue;let u=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let f=0;const m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=m/3);const v=o.times.length-1;let _;if(s<=o.times[0]){const x=u,S=d-u;_=arraySlice(o.values,x,S)}else if(s>=o.times[v]){const x=v*d+u,S=x+d-u;_=arraySlice(o.values,x,S)}else{const x=o.createInterpolant(),S=u,y=d-u;x.evaluate(s),_=arraySlice(x.resultBuffer,S,y)}l==="quaternion"&&new Quaternion().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let x=0;x<g;++x){const S=x*m+f;if(l==="quaternion")Quaternion.multiplyQuaternionsFlat(c.values,S,_,0,c.values,S);else{const y=m-f*2;for(let b=0;b<y;++b)c.values[S+b]-=_[b]}}}return n.blendMode=AdditiveAnimationBlendMode,n}var AnimationUtils=Object.freeze({__proto__:null,arraySlice,convertArray,isTypedArray,getKeyframeOrder,sortedArray,flattenJSON,subclip,makeClipAdditive});class Interpolant{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let a;i:{n:if(!(e<r)){for(let o=i+2;;){if(r===void 0){if(e<s)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=r,r=t[++i],e<r)break t}a=t.length;break i}if(!(e>=s)){const o=t[1];e<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}a=i,i=0;break i}break e}for(;i<a;){const o=i+a>>>1;e<t[o]?a=o:i=o+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case ZeroSlopeEnding:s=e,o=2*t-i;break;case WrapAroundEnding:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:a=e,l=2*i-t;break;case WrapAroundEnding:a=1,l=i+r[1]-r[0];break;default:a=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,d=this._offsetNext,f=this._weightPrev,m=this._weightNext,v=(i-t)/(r-t),_=v*v,g=_*v,x=-f*g+2*f*_-f*v,S=(1+f)*g+(-1.5-2*f)*_+(-.5+f)*v+1,y=(-1-m)*g+(1.5+m)*_+.5*v,b=m*g-m*_;for(let w=0;w!==o;++w)s[w]=x*a[u+w]+S*a[c+w]+y*a[l+w]+b*a[d+w];return s}}class LinearInterpolant extends Interpolant{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(i-t)/(r-t),d=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*d+a[l+f]*u;return s}}class DiscreteInterpolant extends Interpolant{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class KeyframeTrack{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=convertArray(t,this.TimeBufferType),this.values=convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:convertArray(e.times,Array),values:convertArray(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return InterpolateSmooth}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=arraySlice(i,s,a),this.values=arraySlice(this.values,s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&isTypedArray(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=arraySlice(this.times),t=arraySlice(this.values),i=this.getValueSize(),r=this.getInterpolation()===InterpolateSmooth,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(r)l=!0;else{const d=o*i,f=d-i,m=d+i;for(let v=0;v!==i;++v){const _=t[d+v];if(_!==t[f+v]||_!==t[m+v]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const d=o*i,f=a*i;for(let m=0;m!==i;++m)t[f+m]=t[d+m]}++a}}if(s>0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=arraySlice(e,0,a),this.values=arraySlice(t,0,a*i)):(this.times=e,this.values=t),this}clone(){const e=arraySlice(this.times,0),t=arraySlice(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}KeyframeTrack.prototype.TimeBufferType=Float32Array;KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool";BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)Quaternion.slerpFlat(s,0,a,c-o,a,c,l);return s}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion";QuaternionKeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string";StringKeyframeTrack.prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";class AnimationClip{constructor(e,t=-1,i,r=NormalAnimationBlendMode){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(parseKeyframeTrack(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(KeyframeTrack.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=getKeyframeOrder(l);l=sortedArray(l,1,u),c=sortedArray(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new NumberKeyframeTrack(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,f,m,v,_){if(m.length!==0){const g=[],x=[];flattenJSON(m,g,x,v),g.length!==0&&_.push(new d(f,g,x))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const f=c[d].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const m={};let v;for(v=0;v<f.length;v++)if(f[v].morphTargets)for(let _=0;_<f[v].morphTargets.length;_++)m[f[v].morphTargets[_]]=-1;for(const _ in m){const g=[],x=[];for(let S=0;S!==f[v].morphTargets.length;++S){const y=f[v];g.push(y.time),x.push(y.morphTarget===_?1:0)}r.push(new NumberKeyframeTrack(".morphTargetInfluence["+_+"]",g,x))}l=m.length*a}else{const m=".bones["+t[d].name+"]";i(VectorKeyframeTrack,m+".position",f,"pos",r),i(QuaternionKeyframeTrack,m+".quaternion",f,"rot",r),i(VectorKeyframeTrack,m+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function getTrackTypeForValueTypeName(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function parseKeyframeTrack(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=getTrackTypeForValueTypeName(n.type);if(n.times===void 0){const t=[],i=[];flattenJSON(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Cache={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class LoadingManager{constructor(e,t,i){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,f=c.length;d<f;d+=2){const m=c[d],v=c[d+1];if(m.global&&(m.lastIndex=0),m.test(u))return v}return null}}}const DefaultLoadingManager=new LoadingManager;class Loader{constructor(e){this.manager=e!==void 0?e:DefaultLoadingManager,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const loading={};class HttpError extends Error{constructor(e,t){super(e),this.response=t}}let FileLoader$1=class extends Loader{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Cache.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(loading[e]!==void 0){loading[e].push({onLoad:t,onProgress:i,onError:r});return}loading[e]=[],loading[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=loading[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=f?parseInt(f):0,v=m!==0;let _=0;const g=new ReadableStream({start(x){S();function S(){d.read().then(({done:y,value:b})=>{if(y)x.close();else{_+=b.byteLength;const w=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:m});for(let C=0,R=u.length;C<R;C++){const M=u[C];M.onProgress&&M.onProgress(w)}x.enqueue(b),S()}})}}});return new Response(g)}else throw new HttpError(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),f=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(f);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{Cache.add(e,c);const u=loading[e];delete loading[e];for(let d=0,f=u.length;d<f;d++){const m=u[d];m.onLoad&&m.onLoad(c)}}).catch(c=>{const u=loading[e];if(u===void 0)throw this.manager.itemError(e),c;delete loading[e];for(let d=0,f=u.length;d<f;d++){const m=u[d];m.onError&&m.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};class AnimationLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new FileLoader$1(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=AnimationClip.parse(e[i]);t.push(r)}return t}}class CompressedTextureLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=[],o=new CompressedTexture,l=new FileLoader$1(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(d){l.load(e[d],function(f){const m=s.parse(f,!0);a[d]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},c+=1,c===6&&(m.mipmapCount===1&&(o.minFilter=LinearFilter),o.image=a,o.format=m.format,o.needsUpdate=!0,t&&t(o))},i,r)}if(Array.isArray(e))for(let d=0,f=e.length;d<f;++d)u(d);else l.load(e,function(d){const f=s.parse(d,!0);if(f.isCubemap){const m=f.mipmaps.length/f.mipmapCount;for(let v=0;v<m;v++){a[v]={mipmaps:[]};for(let _=0;_<f.mipmapCount;_++)a[v].mipmaps.push(f.mipmaps[v*f.mipmapCount+_]),a[v].format=f.format,a[v].width=f.width,a[v].height=f.height}o.image=a}else o.image.width=f.width,o.image.height=f.height,o.mipmaps=f.mipmaps;f.mipmapCount===1&&(o.minFilter=LinearFilter),o.format=f.format,o.needsUpdate=!0,t&&t(o)},i,r);return o}}class ImageLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Cache.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=createElementNS("img");function l(){u(),Cache.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(d){u(),r&&r(d),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class CubeTextureLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=new CubeTexture,a=new ImageLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(u){s.images[c]=u,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class DataTextureLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new DataTexture,o=new FileLoader$1(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){const c=s.parse(l);c&&(c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:ClampToEdgeWrapping,a.wrapT=c.wrapT!==void 0?c.wrapT:ClampToEdgeWrapping,a.magFilter=c.magFilter!==void 0?c.magFilter:LinearFilter,a.minFilter=c.minFilter!==void 0?c.minFilter:LinearFilter,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(a.encoding=c.encoding),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=LinearMipmapLinearFilter),c.mipmapCount===1&&(a.minFilter=LinearFilter),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c))},i,r),a}}class TextureLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=new Texture,a=new ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Light extends Object3D{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Color(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class HemisphereLight extends Light{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DefaultUp),this.updateMatrix(),this.groundColor=new Color(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const _projScreenMatrix$1=new Matrix4,_lightPositionWorld$1=new Vector3,_lookTarget$1=new Vector3;class LightShadow{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(e.matrixWorld),t.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(_lookTarget$1),t.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(_projScreenMatrix$1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=RAD2DEG*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class SpotLight extends Light{constructor(e,t,i=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DefaultUp),this.updateMatrix(),this.target=new Object3D,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new SpotLightShadow}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const _projScreenMatrix=new Matrix4,_lightPositionWorld=new Vector3,_lookTarget=new Vector3;class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(e.matrixWorld),i.position.copy(_lightPositionWorld),_lookTarget.copy(i.position),_lookTarget.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(_lookTarget),i.updateMatrixWorld(),r.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new PointLightShadow}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DirectionalLight extends Light{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DefaultUp),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class AmbientLight extends Light{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class RectAreaLight extends Light{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Vector3)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],1.092548*(i*r)),t.addScaledVector(a[5],1.092548*(r*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(i*s)),t.addScaledVector(a[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*i),t.addScaledVector(a[4],2*.429043*i*r),t.addScaledVector(a[5],2*.429043*r*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*i*s),t.addScaledVector(a[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class LightProbe extends Light{constructor(e=new SphericalHarmonics3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class MaterialLoader extends Loader{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,a=new FileLoader$1(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=MaterialLoader.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Color().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=i(a.value);break;case"c":r.uniforms[s].value=new Color().setHex(a.value);break;case"v2":r.uniforms[s].value=new Vector2().fromArray(a.value);break;case"v3":r.uniforms[s].value=new Vector3().fromArray(a.value);break;case"v4":r.uniforms[s].value=new Vector4().fromArray(a.value);break;case"m3":r.uniforms[s].value=new Matrix3().fromArray(a.value);break;case"m4":r.uniforms[s].value=new Matrix4().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Vector2().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Vector2().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new t[e]}}class LoaderUtils{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class InstancedBufferGeometry extends BufferGeometry{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class BufferGeometryLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new FileLoader$1(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(m,v){if(t[v]!==void 0)return t[v];const g=m.interleavedBuffers[v],x=s(m,g.buffer),S=getTypedArray(g.type,x),y=new InterleavedBuffer(S,g.stride);return y.uuid=g.uuid,t[v]=y,y}function s(m,v){if(i[v]!==void 0)return i[v];const g=m.arrayBuffers[v],x=new Uint32Array(g).buffer;return i[v]=x,x}const a=e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,o=e.data.index;if(o!==void 0){const m=getTypedArray(o.type,o.array);a.setIndex(new BufferAttribute(m,1))}const l=e.data.attributes;for(const m in l){const v=l[m];let _;if(v.isInterleavedBufferAttribute){const g=r(e.data,v.data);_=new InterleavedBufferAttribute(g,v.itemSize,v.offset,v.normalized)}else{const g=getTypedArray(v.type,v.array),x=v.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;_=new x(g,v.itemSize,v.normalized)}v.name!==void 0&&(_.name=v.name),v.usage!==void 0&&_.setUsage(v.usage),v.updateRange!==void 0&&(_.updateRange.offset=v.updateRange.offset,_.updateRange.count=v.updateRange.count),a.setAttribute(m,_)}const c=e.data.morphAttributes;if(c)for(const m in c){const v=c[m],_=[];for(let g=0,x=v.length;g<x;g++){const S=v[g];let y;if(S.isInterleavedBufferAttribute){const b=r(e.data,S.data);y=new InterleavedBufferAttribute(b,S.itemSize,S.offset,S.normalized)}else{const b=getTypedArray(S.type,S.array);y=new BufferAttribute(b,S.itemSize,S.normalized)}S.name!==void 0&&(y.name=S.name),_.push(y)}a.morphAttributes[m]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let m=0,v=d.length;m!==v;++m){const _=d[m];a.addGroup(_.start,_.count,_.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const m=new Vector3;f.center!==void 0&&m.fromArray(f.center),a.boundingSphere=new Sphere(m,f.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class ObjectLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=this.path===""?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new FileLoader$1(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new FileLoader$1(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(o)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let d=!1;for(const f in a)if(a[f].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new Shape().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Skeleton().fromJSON(e[s],r);i[o.uuid]=o}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new BufferGeometryLoader;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(l);break;default:l.type in Geometries?o=Geometries[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),o.isBufferGeometry===!0&&l.userData!==void 0&&(o.userData=l.userData),i[l.uuid]=o}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new MaterialLoader;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=AnimationClip.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function a(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return a(u)}else return l.data?{data:getTypedArray(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new LoadingManager(t);s=new ImageLoader(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],f=d.url;if(Array.isArray(f)){const m=[];for(let v=0,_=f.length;v<_;v++){const g=f[v],x=o(g);x!==null&&(x instanceof HTMLImageElement?m.push(x):m.push(new DataTexture(x.data,x.width,x.height)))}r[d.uuid]=new Source(m)}else{const m=o(d.url);r[d.uuid]=new Source(m)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await r.loadAsync(l)}else return a.data?{data:getTypedArray(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){r=new ImageLoader(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const u=[];for(let d=0,f=c.length;d<f;d++){const m=c[d],v=await s(m);v!==null&&(v instanceof HTMLImageElement?u.push(v):u.push(new DataTexture(v.data,v.width,v.height)))}i[l.uuid]=new Source(u)}else{const u=await s(l.url);i[l.uuid]=new Source(u)}}}return i}parseTextures(e,t){function i(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const r={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let u;Array.isArray(c)?(u=new CubeTexture,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new DataTexture:u=new Texture,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=o.uuid,o.name!==void 0&&(u.name=o.name),o.mapping!==void 0&&(u.mapping=i(o.mapping,TEXTURE_MAPPING)),o.offset!==void 0&&u.offset.fromArray(o.offset),o.repeat!==void 0&&u.repeat.fromArray(o.repeat),o.center!==void 0&&u.center.fromArray(o.center),o.rotation!==void 0&&(u.rotation=o.rotation),o.wrap!==void 0&&(u.wrapS=i(o.wrap[0],TEXTURE_WRAPPING),u.wrapT=i(o.wrap[1],TEXTURE_WRAPPING)),o.format!==void 0&&(u.format=o.format),o.type!==void 0&&(u.type=o.type),o.encoding!==void 0&&(u.encoding=o.encoding),o.minFilter!==void 0&&(u.minFilter=i(o.minFilter,TEXTURE_FILTER)),o.magFilter!==void 0&&(u.magFilter=i(o.magFilter,TEXTURE_FILTER)),o.anisotropy!==void 0&&(u.anisotropy=o.anisotropy),o.flipY!==void 0&&(u.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(u.unpackAlignment=o.unpackAlignment),o.userData!==void 0&&(u.userData=o.userData),r[o.uuid]=u}return r}parseObject(e,t,i,r,s){let a;function o(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const m=[];for(let v=0,_=f.length;v<_;v++){const g=f[v];i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),m.push(i[g])}return m}return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),i[f]}}function c(f){return r[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),r[f]}let u,d;switch(e.type){case"Scene":a=new Scene,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Color(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new Fog(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new FogExp2(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness);break;case"PerspectiveCamera":a=new PerspectiveCamera(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new PointLight(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new RectAreaLight(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new HemisphereLight(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new LightProbe().fromJSON(e);break;case"SkinnedMesh":u=o(e.geometry),d=l(e.material),a=new SkinnedMesh(u,d),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":u=o(e.geometry),d=l(e.material),a=new Mesh(u,d);break;case"InstancedMesh":u=o(e.geometry),d=l(e.material);const f=e.count,m=e.instanceMatrix,v=e.instanceColor;a=new InstancedMesh(u,d,f),a.instanceMatrix=new InstancedBufferAttribute(new Float32Array(m.array),16),v!==void 0&&(a.instanceColor=new InstancedBufferAttribute(new Float32Array(v.array),v.itemSize));break;case"LOD":a=new LOD;break;case"Line":a=new Line(o(e.geometry),l(e.material));break;case"LineLoop":a=new LineLoop(o(e.geometry),l(e.material));break;case"LineSegments":a=new LineSegments(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new Points(o(e.geometry),l(e.material));break;case"Sprite":a=new Sprite(l(e.material));break;case"Group":a=new Group$1;break;case"Bone":a=new Bone;break;default:a=new Object3D}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let m=0;m<f.length;m++)a.add(this.parseObject(f[m],t,i,r,s))}if(e.animations!==void 0){const f=e.animations;for(let m=0;m<f.length;m++){const v=f[m];a.animations.push(s[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const f=e.levels;for(let m=0;m<f.length;m++){const v=f[m],_=a.getObjectByProperty("uuid",v.object);_!==void 0&&a.addLevel(_,v.distance,v.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const TEXTURE_MAPPING={UVMapping,CubeReflectionMapping,CubeRefractionMapping,EquirectangularReflectionMapping,EquirectangularRefractionMapping,CubeUVReflectionMapping},TEXTURE_WRAPPING={RepeatWrapping,ClampToEdgeWrapping,MirroredRepeatWrapping},TEXTURE_FILTER={NearestFilter,NearestMipmapNearestFilter,NearestMipmapLinearFilter,LinearFilter,LinearMipmapNearestFilter,LinearMipmapLinearFilter};class ImageBitmapLoader extends Loader{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Cache.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Cache.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let _context;class AudioContext{static getContext(){return _context===void 0&&(_context=new(window.AudioContext||window.webkitAudioContext)),_context}static setContext(e){_context=e}}class AudioLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new FileLoader$1(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{const l=o.slice(0);AudioContext.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}}class HemisphereLightProbe extends LightProbe{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new Color().set(e),s=new Color().set(t),a=new Vector3(r.r,r.g,r.b),o=new Vector3(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}class AmbientLightProbe extends LightProbe{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Color().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const _eyeRight=new Matrix4,_eyeLeft=new Matrix4,_projectionMatrix=new Matrix4;class StereoCamera{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,_projectionMatrix.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(DEG2RAD$1*t.fov*.5)/t.zoom;let o,l;_eyeLeft.elements[12]=-r,_eyeRight.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,_projectionMatrix.elements[0]=2*t.near/(l-o),_projectionMatrix.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(_projectionMatrix),o=-a*t.aspect-s,l=a*t.aspect-s,_projectionMatrix.elements[0]=2*t.near/(l-o),_projectionMatrix.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(_projectionMatrix)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(_eyeLeft),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_eyeRight)}}class Clock{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function now(){return(typeof performance>"u"?Date:performance).now()}const _position$1=new Vector3,_quaternion$1=new Quaternion,_scale$1=new Vector3,_orientation$1=new Vector3;class AudioListener extends Object3D{constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_position$1,_quaternion$1,_scale$1),_orientation$1.set(0,0,-1).applyQuaternion(_quaternion$1),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(_position$1.x,r),t.positionY.linearRampToValueAtTime(_position$1.y,r),t.positionZ.linearRampToValueAtTime(_position$1.z,r),t.forwardX.linearRampToValueAtTime(_orientation$1.x,r),t.forwardY.linearRampToValueAtTime(_orientation$1.y,r),t.forwardZ.linearRampToValueAtTime(_orientation$1.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(_position$1.x,_position$1.y,_position$1.z),t.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,i.x,i.y,i.z)}}class Audio extends Object3D{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const _position=new Vector3,_quaternion=new Quaternion,_scale=new Vector3,_orientation=new Vector3;class PositionalAudio extends Audio{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(_position,_quaternion,_scale),_orientation.set(0,0,1).applyQuaternion(_quaternion);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(_position.x,i),t.positionY.linearRampToValueAtTime(_position.y,i),t.positionZ.linearRampToValueAtTime(_position.z,i),t.orientationX.linearRampToValueAtTime(_orientation.x,i),t.orientationY.linearRampToValueAtTime(_orientation.y,i),t.orientationZ.linearRampToValueAtTime(_orientation.z,i)}else t.setPosition(_position.x,_position.y,_position.z),t.setOrientation(_orientation.x,_orientation.y,_orientation.z)}}class AudioAnalyser{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class PropertyMixer{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,a;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==r;++o)i[s+o]=i[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(i,s,0,o,r)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){o.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,a=r;s!==a;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,r){Quaternion.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const a=this._workIndex*s;Quaternion.multiplyQuaternionsFlat(e,a,e,t,e,i),Quaternion.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[i+o]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[i+a]*r}}}const _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=new RegExp("["+_RESERVED_CHARS_RE+"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE.replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar),_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_wordChar),_trackRe=new RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+"$"),_supportedObjectNames=["material","materials","bones","map"];class Composite{constructor(e,t,i){const r=i||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class PropertyBinding{constructor(e,t,i){this.path=t,this.parsedPath=i||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,i):new PropertyBinding(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(e){const t=_trackRe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);_supportedObjectNames.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=i(o.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=Composite;PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray];PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AnimationObjectGroup{constructor(){this.isAnimationObjectGroup=!0,this.uuid=generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let u=0,d=arguments.length;u!==d;++u){const f=arguments[u],m=f.uuid;let v=t[m];if(v===void 0){v=l++,t[m]=v,e.push(f);for(let _=0,g=a;_!==g;++_)s[_].push(new PropertyBinding(f,i[_],r[_]))}else if(v<c){o=e[v];const _=--c,g=e[_];t[g.uuid]=v,e[v]=g,t[m]=_,e[_]=f;for(let x=0,S=a;x!==S;++x){const y=s[x],b=y[_];let w=y[v];y[v]=b,w===void 0&&(w=new PropertyBinding(f,i[x],r[x])),y[_]=w}}else e[v]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const d=s++,f=e[d];t[f.uuid]=u,e[u]=f,t[c]=d,e[d]=l;for(let m=0,v=r;m!==v;++m){const _=i[m],g=_[d],x=_[u];_[u]=g,_[d]=x}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){const f=--s,m=e[f],v=--a,_=e[v];t[m.uuid]=d,e[d]=m,t[_.uuid]=f,e[f]=_,e.pop();for(let g=0,x=r;g!==x;++g){const S=i[g],y=S[f],b=S[v];S[d]=y,S[f]=b,S.pop()}}else{const f=--a,m=e[f];f>0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,_=r;v!==_;++v){const g=i[v];g[d]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);r=s.length,i[e]=r,a.push(e),o.push(t),s.push(d);for(let f=u,m=l.length;f!==m;++f){const v=l[f];d[f]=new PropertyBinding(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=i,a[i]=l,a.pop(),s[i]=s[o],s.pop(),r[i]=r[o],r.pop()}}}class AnimationAction{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case NormalAnimationBlendMode:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const a=i===LoopPingPong;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===LoopOnce){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ZeroSlopeEnding,r.endingEnd=ZeroSlopeEnding):(e?r.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:r.endingStart=WrapAroundEnding,t?r.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:r.endingEnd=WrapAroundEnding)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=i,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const f=r[d],m=f.name;let v=u[m];if(v!==void 0)++v.referenceCount,a[d]=v;else{if(v=a[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const _=t&&t._propertyBindings[d].binding.parsedPath;v=new PropertyMixer(PropertyBinding.create(i,m,_),f.ValueTypeName,f.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),a[d]=v}o[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const d=o.actionByRoot,f=(e._localRoot||this._root).uuid;delete d[f],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let a=r[t];a===void 0&&(a={},r[t]=a),a[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,a=this._bindingsByRootAndName,o=a[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let a=typeof e=="string"?AnimationClip.findByName(r,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(i===void 0&&(a!==null?i=a.blendMode:i=NormalAnimationBlendMode),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const u=new AnimationAction(this,a,t,i);return this._bindAction(u,c),this._addInactiveAction(u,o,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?AnimationClip.findByName(i,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const u=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const a in i){const o=i[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Uniform{constructor(e){this.value=e}clone(){return new Uniform(this.value.clone===void 0?this.value:this.value.clone())}}let id=0;class UniformsGroup extends EventDispatcher{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:id++}),this.name="",this.usage=StaticDrawUsage,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++)this.uniforms.push(t[i].clone());return this}clone(){return new this.constructor().copy(this)}}class InstancedInterleavedBuffer extends InterleavedBuffer{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class GLBufferAttribute{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class Raycaster{constructor(e,t,i=0,r=1/0){this.ray=new Ray(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return intersectObject(e,this,i,t),i.sort(ascSort),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)intersectObject(e[r],this,i,t);return i.sort(ascSort),i}}function ascSort(n,e){return n.distance-e.distance}function intersectObject(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,a=r.length;s<a;s++)intersectObject(r[s],e,t,!0)}}class Spherical{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(clamp(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Cylindrical{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const _vector$4=new Vector2;class Box2{constructor(e=new Vector2(1/0,1/0),t=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=_vector$4.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return _vector$4.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _startP=new Vector3,_startEnd=new Vector3;class Line3{constructor(e=new Vector3,t=new Vector3){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){_startP.subVectors(e,this.start),_startEnd.subVectors(this.end,this.start);const i=_startEnd.dot(_startEnd);let s=_startEnd.dot(_startP)/i;return t&&(s=clamp(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const _vector$3=new Vector3;class SpotLightHelper extends Object3D{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new BufferGeometry,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,u=o/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Float32BufferAttribute(r,3));const s=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),_vector$3.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_vector$3),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const _vector$2=new Vector3,_boneMatrix=new Matrix4,_matrixWorldInv=new Matrix4;class SkeletonHelper extends LineSegments{constructor(e){const t=getBoneList(e),i=new BufferGeometry,r=[],s=[],a=new Color(0,0,1),o=new Color(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}i.setAttribute("position",new Float32BufferAttribute(r,3)),i.setAttribute("color",new Float32BufferAttribute(s,3));const l=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");_matrixWorldInv.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(_boneMatrix.multiplyMatrices(_matrixWorldInv,o.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),r.setXYZ(a,_vector$2.x,_vector$2.y,_vector$2.z),_boneMatrix.multiplyMatrices(_matrixWorldInv,o.parent.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),r.setXYZ(a+1,_vector$2.x,_vector$2.y,_vector$2.z),a+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function getBoneList(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,getBoneList(n.children[t]));return e}class PointLightHelper extends Mesh{constructor(e,t,i){const r=new SphereGeometry(t,4,2),s=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const _vector$1=new Vector3,_color1=new Color,_color2=new Color;class HemisphereLightHelper extends Object3D{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new OctahedronGeometry(t);r.rotateY(Math.PI*.5),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),a=new Float32Array(s.count*3);r.setAttribute("color",new BufferAttribute(a,3)),this.add(new Mesh(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");_color1.copy(this.light.color),_color2.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?_color1:_color2;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GridHelper extends LineSegments{constructor(e=10,t=10,i=4473924,r=8947848){i=new Color(i),r=new Color(r);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let f=0,m=0,v=-o;f<=t;f++,v+=a){l.push(-o,0,v,o,0,v),l.push(v,0,-o,v,0,o);const _=f===s?i:r;_.toArray(c,m),m+=3,_.toArray(c,m),m+=3,_.toArray(c,m),m+=3,_.toArray(c,m),m+=3}const u=new BufferGeometry;u.setAttribute("position",new Float32BufferAttribute(l,3)),u.setAttribute("color",new Float32BufferAttribute(c,3));const d=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class PolarGridHelper extends LineSegments{constructor(e=10,t=16,i=8,r=64,s=4473924,a=8947848){s=new Color(s),a=new Color(a);const o=[],l=[];if(t>1)for(let d=0;d<t;d++){const f=d/t*(Math.PI*2),m=Math.sin(f)*e,v=Math.cos(f)*e;o.push(0,0,0),o.push(m,0,v);const _=d&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let d=0;d<i;d++){const f=d&1?s:a,m=e-e/i*d;for(let v=0;v<r;v++){let _=v/r*(Math.PI*2),g=Math.sin(_)*m,x=Math.cos(_)*m;o.push(g,0,x),l.push(f.r,f.g,f.b),_=(v+1)/r*(Math.PI*2),g=Math.sin(_)*m,x=Math.cos(_)*m,o.push(g,0,x),l.push(f.r,f.g,f.b)}}const c=new BufferGeometry;c.setAttribute("position",new Float32BufferAttribute(o,3)),c.setAttribute("color",new Float32BufferAttribute(l,3));const u=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const _v1=new Vector3,_v2=new Vector3,_v3=new Vector3;class DirectionalLightHelper extends Object3D{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(r,s),this.add(this.lightPlane),r=new BufferGeometry,r.setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),_v1.setFromMatrixPosition(this.light.matrixWorld),_v2.setFromMatrixPosition(this.light.target.matrixWorld),_v3.subVectors(_v2,_v1),this.lightPlane.lookAt(_v2),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(_v2),this.targetLine.scale.z=_v3.length()}}const _vector$d=new Vector3,_camera=new Camera;class CameraHelper extends LineSegments{constructor(e){const t=new BufferGeometry,i=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(v,_){l(v),l(_)}function l(v){r.push(0,0,0),s.push(0,0,0),a[v]===void 0&&(a[v]=[]),a[v].push(r.length/3-1)}t.setAttribute("position",new Float32BufferAttribute(r,3)),t.setAttribute("color",new Float32BufferAttribute(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new Color(16755200),u=new Color(16711680),d=new Color(43775),f=new Color(16777215),m=new Color(3355443);this.setColors(c,u,d,f,m)}setColors(e,t,i,r,s){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",t,e,_camera,0,0,-1),setPoint("t",t,e,_camera,0,0,1),setPoint("n1",t,e,_camera,-1,-1,-1),setPoint("n2",t,e,_camera,i,-1,-1),setPoint("n3",t,e,_camera,-1,r,-1),setPoint("n4",t,e,_camera,i,r,-1),setPoint("f1",t,e,_camera,-1,-1,1),setPoint("f2",t,e,_camera,i,-1,1),setPoint("f3",t,e,_camera,-1,r,1),setPoint("f4",t,e,_camera,i,r,1),setPoint("u1",t,e,_camera,i*.7,r*1.1,-1),setPoint("u2",t,e,_camera,-1*.7,r*1.1,-1),setPoint("u3",t,e,_camera,0,r*2,-1),setPoint("cf1",t,e,_camera,-1,0,1),setPoint("cf2",t,e,_camera,i,0,1),setPoint("cf3",t,e,_camera,0,-1,1),setPoint("cf4",t,e,_camera,0,r,1),setPoint("cn1",t,e,_camera,-1,0,-1),setPoint("cn2",t,e,_camera,i,0,-1),setPoint("cn3",t,e,_camera,0,-1,-1),setPoint("cn4",t,e,_camera,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function setPoint(n,e,t,i,r,s,a){_vector$d.set(r,s,a).unproject(i);const o=e[n];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],_vector$d.x,_vector$d.y,_vector$d.z)}}const _box$4=new Box3;class BoxHelper extends LineSegments{constructor(e,t=16776960){const 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]),r=new Float32Array(8*3),s=new BufferGeometry;s.setIndex(new BufferAttribute(i,1)),s.setAttribute("position",new BufferAttribute(r,3)),super(s,new LineBasicMaterial({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&_box$4.setFromObject(this.object),_box$4.isEmpty())return;const t=_box$4.min,i=_box$4.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Box3Helper extends LineSegments{constructor(e,t=16776960){const 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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new BufferGeometry;s.setIndex(new BufferAttribute(i,1)),s.setAttribute("position",new Float32BufferAttribute(r,3)),super(s,new LineBasicMaterial({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class PlaneHelper extends Line{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new BufferGeometry;a.setAttribute("position",new Float32BufferAttribute(s,3)),a.computeBoundingSphere(),super(a,new LineBasicMaterial({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new BufferGeometry;l.setAttribute("position",new Float32BufferAttribute(o,3)),l.computeBoundingSphere(),this.add(new Mesh(l,new MeshBasicMaterial({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const _axis=new Vector3;let _lineGeometry,_coneGeometry;class ArrowHelper extends Object3D{constructor(e=new Vector3(0,0,1),t=new Vector3(0,0,0),i=1,r=16776960,s=i*.2,a=s*.2){super(),this.type="ArrowHelper",_lineGeometry===void 0&&(_lineGeometry=new BufferGeometry,_lineGeometry.setAttribute("position",new Float32BufferAttribute([0,0,0,0,1,0],3)),_coneGeometry=new CylinderGeometry(0,.5,1,5,1),_coneGeometry.translate(0,-.5,0)),this.position.copy(t),this.line=new Line(_lineGeometry,new LineBasicMaterial({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(_coneGeometry,new MeshBasicMaterial({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{_axis.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(_axis,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class AxesHelper extends LineSegments{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute(t,3)),r.setAttribute("color",new Float32BufferAttribute(i,3));const s=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Color,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ShapePath{constructor(){this.type="ShapePath",this.color=new Color,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(x){const S=[];for(let y=0,b=x.length;y<b;y++){const w=x[y],C=new Shape;C.curves=w.curves,S.push(C)}return S}function i(x,S){const y=S.length;let b=!1;for(let w=y-1,C=0;C<y;w=C++){let R=S[w],M=S[C],L=M.x-R.x,B=M.y-R.y;if(Math.abs(B)>Number.EPSILON){if(B<0&&(R=S[C],L=-L,M=S[w],B=-B),x.y<R.y||x.y>M.y)continue;if(x.y===R.y){if(x.x===R.x)return!0}else{const Z=B*(x.x-R.x)-L*(x.y-R.y);if(Z===0)return!0;if(Z<0)continue;b=!b}}else{if(x.y!==R.y)continue;if(M.x<=x.x&&x.x<=R.x||R.x<=x.x&&x.x<=M.x)return!0}}return b}const r=ShapeUtils.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Shape,l.curves=o.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const d=[],f=[];let m=[],v=0,_;f[v]=void 0,m[v]=[];for(let x=0,S=s.length;x<S;x++)o=s[x],_=o.getPoints(),a=r(_),a=e?!a:a,a?(!u&&f[v]&&v++,f[v]={s:new Shape,p:_},f[v].s.curves=o.curves,u&&v++,m[v]=[]):m[v].push({h:o,p:_[0]});if(!f[0])return t(s);if(f.length>1){let x=!1,S=0;for(let y=0,b=f.length;y<b;y++)d[y]=[];for(let y=0,b=f.length;y<b;y++){const w=m[y];for(let C=0;C<w.length;C++){const R=w[C];let M=!0;for(let L=0;L<f.length;L++)i(R.p,f[L].p)&&(y!==L&&S++,M?(M=!1,d[L].push(R)):x=!0);M&&d[y].push(R)}}S>0&&x===!1&&(m=d)}let g;for(let x=0,S=f.length;x<S;x++){l=f[x].s,c.push(l),g=m[x];for(let y=0,b=g.length;y<b;y++)l.holes.push(g[y].h)}return c}}const _tables=_generateTables();function _generateTables(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function toHalfFloat(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=clamp(n,-65504,65504),_tables.floatView[0]=n;const e=_tables.uint32View[0],t=e>>23&511;return _tables.baseTable[t]+((e&8388607)>>_tables.shiftTable[t])}function fromHalfFloat(n){const e=n>>10;return _tables.uint32View[0]=_tables.mantissaTable[_tables.offsetTable[e]+(n&1023)]+_tables.exponentTable[e],_tables.floatView[0]}var DataUtils=Object.freeze({__proto__:null,toHalfFloat,fromHalfFloat});function ImmediateRenderObject(){console.error("THREE.ImmediateRenderObject has been removed.")}class WebGLMultisampleRenderTarget extends WebGLRenderTarget{constructor(e,t,i){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,i),this.samples=4}}class DataTexture2DArray extends DataArrayTexture{constructor(e,t,i,r){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,i,r)}}class DataTexture3D extends Data3DTexture{constructor(e,t,i,r){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,i,r)}}class BoxBufferGeometry extends BoxGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,i,r,s,a)}}class CapsuleBufferGeometry extends CapsuleGeometry{constructor(e,t,i,r){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,i,r)}}class CircleBufferGeometry extends CircleGeometry{constructor(e,t,i,r){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,i,r)}}class ConeBufferGeometry extends ConeGeometry{constructor(e,t,i,r,s,a,o){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,i,r,s,a,o)}}class CylinderBufferGeometry extends CylinderGeometry{constructor(e,t,i,r,s,a,o,l){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,i,r,s,a,o,l)}}class DodecahedronBufferGeometry extends DodecahedronGeometry{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}
3144class ExtrudeBufferGeometry extends ExtrudeGeometry{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class IcosahedronBufferGeometry extends IcosahedronGeometry{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class LatheBufferGeometry extends LatheGeometry{constructor(e,t,i,r){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,i,r)}}class OctahedronBufferGeometry extends OctahedronGeometry{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class PlaneBufferGeometry extends PlaneGeometry{constructor(e,t,i,r){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,i,r)}}class PolyhedronBufferGeometry extends PolyhedronGeometry{constructor(e,t,i,r){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,i,r)}}class RingBufferGeometry extends RingGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,i,r,s,a)}}class ShapeBufferGeometry extends ShapeGeometry{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class SphereBufferGeometry extends SphereGeometry{constructor(e,t,i,r,s,a,o){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,i,r,s,a,o)}}class TetrahedronBufferGeometry extends TetrahedronGeometry{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class TorusBufferGeometry extends TorusGeometry{constructor(e,t,i,r,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,i,r,s)}}class TorusKnotBufferGeometry extends TorusKnotGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,i,r,s,a)}}class TubeBufferGeometry extends TubeGeometry{constructor(e,t,i,r,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,i,r,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:REVISION}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=REVISION);const three_module=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AlphaFormat,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AmbientLightProbe,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxBufferGeometry,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleBufferGeometry,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleBufferGeometry,CircleGeometry,ClampToEdgeWrapping,Clock,Color,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedTexture,CompressedTextureLoader,ConeBufferGeometry,ConeGeometry,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderBufferGeometry,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTexture2DArray,DataTexture3D,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DodecahedronBufferGeometry,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher,ExtrudeBufferGeometry,ExtrudeGeometry,FileLoader:FileLoader$1,Float16BufferAttribute,Float32BufferAttribute,Float64BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterDepth,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group:Group$1,HalfFloatType,HemisphereLight,HemisphereLightHelper,HemisphereLightProbe,IcosahedronBufferGeometry,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,ImmediateRenderObject,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheBufferGeometry,LatheGeometry,Layers,LessDepth,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearEncoding,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace,LinearToneMapping,Loader,LoaderUtils,Lo
3144adingManager,LoopOnce,LoopPingPong,LoopRepeat,LuminanceAlphaFormat,LuminanceFormat,MOUSE,Material,MaterialLoader,MathUtils,Matrix3,Matrix4,MaxEquation,Mesh,MeshBasicMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,MinEquation,MirroredRepeatWrapping,MixOperation,MultiplyBlending,MultiplyOperation,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronBufferGeometry,OctahedronGeometry,OneFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneBufferGeometry,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronBufferGeometry,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,REVISION,RGBADepthPacking,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingBufferGeometry,RingGeometry,SRGBColorSpace,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeBufferGeometry,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereBufferGeometry,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronBufferGeometry,TetrahedronGeometry,Texture,TextureLoader,TorusBufferGeometry,TorusGeometry,TorusKnotBufferGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeBufferGeometry,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL1Renderer,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLMultisampleRenderTarget,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,_SRGBAFormat,sRGBEncoding},Symbol.toStringTag,{value:"Module"})),VEC2_ZERO=new Vector2(0,0),VEC3_ZERO=new Vector3(0,0,0),VEC3_X=new Vector3(1,0,0),VEC3_Y=new Vector3(0,1,0),VEC3_Z=new Vector3(0,0,1),stringToImage=n=>{let e=document.createElementNS("http://www.w3.org/1999/xhtml","img");return e.src=n,e},pathFromCoords=(n,e)=>{let t="x";return t+=splitNumberToPath(n),t+="z",t+=splitNumberToPath(e),t=t.substring(0,t.length-1),t},splitNumberToPath=n=>{let e="";n<0&&(n=-n,e+="-");let t=n.toString();for(let i=0;i<t.length;i++)e+=t.charAt(i)+"/";return e},hashTile=(n,e)=>`x${n}z${e}`,generateCacheHash=()=>Math.round(Math.random()*1e6),dispatchEvent=(n,e,t={})=>
3144{if(!(!n||!n.dispatchEvent))return n.dispatchEvent(new CustomEvent(e,{detail:t}))},alert=(n,e,t="info")=>{dispatchEvent(n,"bluemapAlert",{message:e,level:t})!==!1&&(t==="info"?console.log(`[BlueMap/${t}]`,e):t==="warning"?console.warn(`[BlueMap/${t}]`,e):t==="error"?console.error(`[BlueMap/${t}]`,e):console.debug(`[BlueMap/${t}]`,e))},htmlToElement=n=>{let e=document.createElement("template");return e.innerHTML=n.trim(),e.content.firstChild},htmlToElements=n=>{let e=document.createElement("template");return e.innerHTML=n,e.content.childNodes},animate=function(n,e=1e3,t=null){let i={animationStart:-1,lastFrame:-1,cancelled:!1,frame:function(r){if(this.cancelled)return;this.animationStart===-1&&(this.animationStart=r,this.lastFrame=r);let s=e===0?1:MathUtils.clamp((r-this.animationStart)/e,0,1),a=r-this.lastFrame;n(s,a),s<1?window.requestAnimationFrame(o=>this.frame(o)):t&&t(!0),this.lastFrame=r},cancel:function(){this.cancelled=!0,t&&t(!1)}};return e!==0?window.requestAnimationFrame(r=>i.frame(r)):i.frame(0),i},EasingFunctions={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>n*(2-n),easeInOutQuad:n=>n<.5?2*n*n:-1+(4-2*n)*n,easeInCubic:n=>n*n*n,easeOutCubic:n=>--n*n*n+1,easeInOutCubic:n=>n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1- --n*n*n*n,easeInOutQuart:n=>n<.5?8*n*n*n*n:1-8*--n*n*n*n,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1+--n*n*n*n*n,easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n},elementOffset=n=>{let e=n.getBoundingClientRect(),t=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+t}},deepEquals=(n,e)=>{if(Object.is(n,e))return!0;let t=typeof n;if(t!==typeof e||t==="number"||t==="boolean"||t==="string")return!1;if(Array.isArray(n)){let i=n.length;if(i!==e.length)return!1;for(let r=0;r<i;r++)if(!deepEquals(n[r],e[r]))return!1;return!0}for(let i in n)if(n.hasOwnProperty(i)&&!deepEquals(n[i],e[i]))return!1;return!0},addEventListeners=(n,e,t,i)=>{Array.isArray(e)||(e=e.trim().split(" ")),e.forEach(r=>n.addEventListener(r,t,i))},removeEventListeners=(n,e,t,i)=>{Array.isArray(e)||(e=e.trim().split(" ")),e.forEach(r=>n.removeEventListener(r,t,i))},softMin=(n,e,t)=>{if(n>=e)return n;let i=e-n;return i<1e-4?e:n+i*t},softMax=(n,e,t)=>{if(n<=e)return n;let i=n-e;return i<1e-4?e:n-i*t},softClamp=(n,e,t,i)=>softMax(softMin(n,e,i),t,i),softSet=(n,e,t)=>softClamp(n,e,e,t),vecArrToObj=(n,e=!1)=>n&&n.length>=2?e?{x:n[0],z:n[1]}:{x:n[0],y:n[1]}:{},pixel=document.createElement("canvas");pixel.width=1;pixel.height=1;const pixelContext=pixel.getContext("2d",{willReadFrequently:!0}),getPixel=(n,e,t)=>(pixelContext.drawImage(n,Math.floor(e),Math.floor(t),1,1,0,0,1,1),pixelContext.getImageData(0,0,1,1).data),_sfc_main$m={name:"SvgButton",props:{active:Boolean}};function _sfc_render$m(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["svg-button",{active:t.active}]),onClick:e[0]||(e[0]=a=>n.$emit("action",a))},[renderSlot(n.$slots,"default")],2)}const SvgButton=_export_sfc(_sfc_main$m,[["render",_sfc_render$m]]);let animation$1;const _sfc_main$l={name:"Compass",components:{SvgButton},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data}},computed:{style(){return{transform:"translate(-50%, -50%) rotate("+-this.controls.rotation+"rad)"}}},methods:{action(n){n.preventDefault(),animation$1&&animation$1.cancel();let e=this.controls.rotation;animation$1=animate(t=>{this.controls.rotation=e*(1-EasingFunctions.easeOutQuad(t))},300)}}},_hoisted_1$j=createBaseVNode("path",{class:"north",d:`M14.792,1.04c0.114-0.354,0.299-0.354,0.412,0l4.089,12.729c0.114,0.353-0.097,0.642-0.468,0.642 3145 l-7.651,0.001c-0.371,0-0.581-0.288-0.468-0.642L14.792,1.04z`},null,-1),_hoisted_2$e=createBaseVNode("path",{class:"south",d:`M10.707,16.23c-0.114-0.353,0.097-0.642,0.468-0.642l7.651-0.001c0.371,0,0.581,0.289,0.468,0.642 3146 l-4.086,12.73c-0.113,0.353-0.299,0.353-0.412,0L10.707,16.23z`},null,-1),_hoisted_3$d=[_hoisted_1$j,_hoisted_2$e];function _sfc_render$l(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:"compass",onAction:s.action},{default:withCtx(()=>[(openBlock(),createElementBlock("svg",{viewBox:"0 0 30 30",style:normalizeStyle(s.style)},_hoisted_3$d,4))]),_:1},8,["onAction"])}const Compass=_export_sfc(_sfc_main$l,[["render",_sfc_render$l]]);let animation;const _sfc_main$k={name:"DayNightSwitch",components:{SvgButton},data(){return{mapViewer:this.$bluemap.mapViewer.data}},computed:{isDay(){return this.mapViewer.uniforms.sunlightStrength.value>.6}},methods:{action(n){n.preventDefault(),animation&&animation.cancel();let e=this.mapViewer.uniforms.sunlightStrength.value,t=this.isDay?.25:1;animation=animate(i=>{let r=EasingFunctions.easeOutQuad(i);this.mapViewer.uniforms.sunlightStrength.value=e*(1-r)+t*r,this.$bluemap.mapViewer.redraw()},300)}}},_hoisted_1$i=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M17.011,19.722c-3.778-1.613-5.533-5.982-3.921-9.76c0.576-1.348,1.505-2.432,2.631-3.204 3147 c-3.418-0.243-6.765,1.664-8.186,4.992c-1.792,4.197,0.159,9.053,4.356,10.844c3.504,1.496,7.462,0.377,9.717-2.476 3148 C20.123,20.465,18.521,20.365,17.011,19.722z`}),createBaseVNode("circle",{cx:"5.123",cy:"7.64",r:"1.196"}),createBaseVNode("circle",{cx:"23.178",cy:"5.249",r:"1.195"}),createBaseVNode("circle",{cx:"20.412",cy:"13.805",r:"1.195"}),createBaseVNode("circle",{cx:"25.878",cy:"23.654",r:"1.195"})],-1);function _sfc_render$k(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:"day-night-switch",active:!s.isDay,onAction:s.action},{default:withCtx(()=>[_hoisted_1$i]),_:1},8,["active","onAction"])}const DayNightSwitch=_export_sfc(_sfc_main$k,[["render",_sfc_render$k]]),_sfc_main$j={name:"ControlsSwitch",components:{SvgButton},data(){return{controls:this.$bluemap.appState.controls,mapViewer:this.$bluemap.mapViewer.data}},computed:{isPerspectiveView(){return this.controls.state==="perspective"},isFlatView(){return this.controls.state==="flat"},isFreeFlight(){return this.controls.state==="free"}},methods:{setPerspectiveView(){this.$bluemap.setPerspectiveView(500,this.isFreeFlight?100:0)},setFlatView(){this.$bluemap.setFlatView(500,this.isFreeFlight?100:0)},setFreeFlight(){this.$bluemap.setFreeFlight(500)}}},_hoisted_1$h={class:"controls-switch"},_hoisted_2$d=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M19.475,10.574c-0.166-0.021-0.337-0.036-0.51-0.045c-0.174-0.009-0.35-0.013-0.525-0.011 3149 c-0.176,0.002-0.353,0.01-0.526,0.024c-0.175,0.015-0.347,0.036-0.515,0.063l-13.39,2.189 3150 c-0.372,0.061-0.7,0.146-0.975,0.247c-0.276,0.102-0.5,0.221-0.66,0.349c-0.161,0.129-0.259,0.268-0.282,0.408 3151 c-0.024,0.141,0.028,0.285,0.165,0.421l5.431,5.511c0.086,0.087,0.191,0.167,0.314,0.241s0.263,0.142,0.417,0.202 3152 c0.155,0.062,0.323,0.115,0.502,0.162c0.18,0.046,0.371,0.085,0.569,0.116s0.405,0.054,0.616,0.068 3153 c0.211,0.015,0.427,0.021,0.645,0.017c0.217-0.003,0.436-0.016,0.652-0.037c0.217-0.022,0.431-0.054,0.641-0.095L27.12,17.43 3154 c0.371-0.073,0.679-0.175,0.917-0.296c0.236-0.12,0.404-0.259,0.497-0.407c0.093-0.147,0.111-0.305,0.052-0.461 3155 c-0.059-0.156-0.195-0.313-0.415-0.46l-7.089-4.742c-0.089-0.06-0.192-0.115-0.308-0.166 3156 c-0.116-0.051-0.243-0.097-0.381-0.138c-0.137-0.041-0.283-0.078-0.438-0.108C19.803,10.621,19.641,10.595,19.475,10.574`})],-1),_hoisted_3$c=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:"M22.371,4.158c1.65,0,3,1.35,3,3v15.684c0,1.65-1.35,3-3,3H7.629c-1.65,0-3-1.35-3-3V7.158c0-1.65,1.35-3,3-3H22.371z"})],-1),_hoisted_4$8=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M21.927,11.253c-0.256-0.487-0.915-0.885-1.465-0.885h-2.004c-0.55,0-0.726-0.356-0.39-0.792c0,0,0.698-0.905,0.698-2.041 3157 c0-2.08-1.687-3.767-3.767-3.767s-3.767,1.687-3.767,3.767c0,1.136,0.698,2.041,0.698,2.041c0.336,0.436,0.161,0.794-0.389,0.797 3158 l-2.005,0.01c-0.55,0.002-1.21,0.403-1.467,0.889l-3.656,6.924c-0.257,0.487-0.088,1.128,0.375,1.425l1.824,1.171 3159 c0.462,0.297,1.116,0.184,1.451-0.253l0.839-1.092c0.335-0.437,0.662-0.346,0.726,0.2l0.637,5.415
3160 c0.064,0.546,0.567,0.993,1.117,0.993h7.234c0.55,0,1.053-0.447,1.117-0.993l0.635-5.401c0.064-0.546,0.392-0.637,0.727-0.2 3161 l0.828,1.078c0.335,0.437,0.988,0.55,1.451,0.253l1.823-1.171c0.463-0.297,0.633-0.938,0.377-1.425L21.927,11.253z`})],-1);function _sfc_render$j(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createElementBlock("div",_hoisted_1$h,[r.mapViewer.map.perspectiveView?(openBlock(),createBlock(a,{key:0,active:s.isPerspectiveView,onAction:s.setPerspectiveView,title:n.$t("controls.perspective.tooltip")},{default:withCtx(()=>[_hoisted_2$d]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0),r.mapViewer.map.flatView?(openBlock(),createBlock(a,{key:1,active:s.isFlatView,onAction:s.setFlatView,title:n.$t("controls.flatView.tooltip")},{default:withCtx(()=>[_hoisted_3$c]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0),r.mapViewer.map.freeFlightView?(openBlock(),createBlock(a,{key:2,active:s.isFreeFlight,onAction:s.setFreeFlight,title:n.$t("controls.freeFlight.tooltip")},{default:withCtx(()=>[_hoisted_4$8]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0)])}const ControlsSwitch=_export_sfc(_sfc_main$j,[["render",_sfc_render$j]]),_sfc_main$i={name:"MenuButton",components:{SvgButton},props:{close:Boolean,back:Boolean}},_hoisted_1$g=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0 3162 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,15c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0 3163 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,13.539,25.004,14.193,25.004,15L25.004,15z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0 3164 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})])],-1);function _sfc_render$i(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:normalizeClass(["menu-button",{close:t.close,back:t.back}])},{default:withCtx(()=>[_hoisted_1$g]),_:1},8,["class"])}const MenuButton=_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]),_sfc_main$h={name:"ControlBar",components:{SvgButton,MenuButton,ControlsSwitch,DayNightSwitch,PositionInput,Compass},data(){return{appState:this.$bluemap.appState,markers:this.$bluemap.mapViewer.markers.data,mapViewer:this.$bluemap.mapViewer.data}},computed:{playerMarkerSet(){for(let n of this.markers.markerSets)if(n.id==="bm-players")return n;return{id:"bm-players",label:"Players",markerSets:[],markers:[],fake:!0}},showMapMenu(){return this.mapViewer.mapState==="loading"||this.mapViewer.mapState==="loaded"},showViewControls(){return this.mapViewer.map?this.mapViewer.map.views.length>1:!1},showMarkerMenu(){return this.hasMarkers(this.markers)}},methods:{openPlayerList(){let n=this.playerMarkerSet;this.appState.menu.openPage("markers",this.$t("players.title"),{markerSet:n})},hasMarkers(n){if(n.markers.length>0)return!0;for(let e of n.markerSets)if(e.id!=="bm-players"&&e.id!=="bm-popup-set"&&this.hasMarkers(e))return!0;return!1}}},_hoisted_1$f={class:"control-bar"},_hoisted_2$c=createBaseVNode("div",{class:"space thin-hide"},null,-1),_hoisted_3$b=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("polygon",{points:"26.708,22.841 19.049,25.186 11.311,20.718 3.292,22.841 7.725,5.96 13.475,4.814 19.314,7.409 25.018,6.037 "})],-1),_hoisted_4$7=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M15,3.563c-4.459,0-8.073,3.615-8.073,8.073c0,6.483,8.196,14.802,8.196,14.802s7.951-8.013,7.951-14.802 3165 C23.073,7.177,19.459,3.563,15,3.563z M15,15.734c-2.263,0-4.098-1.835-4.098-4.099c0-2.263,1.835-4.098,4.098-4.098 3166 c2.263,0,4.098,1.835,4.098,4.098C19.098,13.899,17.263,15.734,15,15.734z`})],-1),_hoisted_5$3=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M8.95,14.477c0.409-0.77,1.298-1.307,2.164-1.309h0.026c-0.053-0.234-0.087-0.488-0.087-0.755
3167 c0-1.381,0.715-2.595,1.791-3.301c-0.01,0-0.021-0.006-0.03-0.006h-1.427c-0.39,0-0.514-0.251-0.276-0.563 3168 c0,0,0.497-0.645,0.497-1.452c0-1.48-1.2-2.681-2.679-2.681c-1.481,0-2.679,1.2-2.679,2.681c0,0.807,0.496,1.452,0.496,1.452 3169 c0.24,0.311,0.114,0.565-0.275,0.565L5.042,9.118C4.649,9.119,4.182,9.405,3.998,9.75l-2.601,4.927 3170 c-0.184,0.347-0.062,0.802,0.265,1.015l1.297,0.83c0.332,0.213,0.794,0.135,1.034-0.18l0.598-0.775 3171 c0.238-0.31,0.471-0.245,0.516,0.141l0.454,3.854c0.035,0.311,0.272,0.566,0.564,0.66c0.018-0.279,0.087-0.561,0.225-0.82 3172 L8.95,14.477z`}),createBaseVNode("path",{d:`M28.604,14.677l-2.597-4.94c-0.185-0.346-0.65-0.631-1.042-0.631h-1.428c-0.39,0-0.514-0.251-0.274-0.563 3173 c0,0,0.496-0.645,0.496-1.452c0-1.48-1.2-2.681-2.68-2.681c-1.481,0-2.679,1.2-2.679,2.681c0,0.807,0.496,1.452,0.496,1.452 3174 c0.239,0.311,0.114,0.565-0.275,0.565l-1.428,0.009c-0.005,0-0.009,0.002-0.015,0.002c1.067,0.708,1.774,1.917,1.774,3.292 3175 c0,0.263-0.031,0.513-0.084,0.744h0.02c0.868,0,1.758,0.537,2.166,1.305l2.598,4.944c0.137,0.262,0.205,0.539,0.222,0.818 3176 c0.296-0.092,0.538-0.35,0.574-0.664l0.451-3.842c0.044-0.389,0.28-0.452,0.519-0.143l0.588,0.768 3177 c0.239,0.313,0.702,0.391,1.033,0.182l1.297-0.833C28.667,15.479,28.787,15.026,28.604,14.677z`})]),createBaseVNode("path",{d:`M19.932,15.058c-0.184-0.346-0.651-0.63-1.043-0.63h-1.427c-0.39,0-0.515-0.252-0.275-0.564c0,0,0.496-0.645,0.496-1.451 3178 c0-1.479-1.199-2.68-2.679-2.68c-1.482,0-2.679,1.201-2.679,2.68c0,0.806,0.496,1.451,0.496,1.451 3179 c0.24,0.312,0.114,0.566-0.275,0.566l-1.427,0.009c-0.393,0.001-0.861,0.287-1.045,0.632l-2.602,4.925 3180 c-0.185,0.348-0.062,0.803,0.266,1.016l1.297,0.832c0.332,0.213,0.794,0.133,1.034-0.18l0.598-0.775 3181 c0.239-0.311,0.472-0.246,0.517,0.141l0.454,3.854c0.043,0.389,0.403,0.705,0.794,0.705h5.148c0.392,0,0.749-0.316,0.794-0.705 3182 l0.45-3.844c0.045-0.389,0.282-0.451,0.52-0.143l0.587,0.768c0.239,0.313,0.703,0.393,1.033,0.182l1.297-0.832 3183 c0.331-0.213,0.451-0.666,0.269-1.016L19.932,15.058z`})],-1),_hoisted_6$3=createBaseVNode("div",{class:"space thin-hide greedy"},null,-1),_hoisted_7$3=createBaseVNode("div",{class:"space thin-hide"},null,-1),_hoisted_8$3={key:5,class:"space thin-hide"},_hoisted_9$2=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("rect",{x:"7.085",y:"4.341",transform:"matrix(0.9774 0.2116 -0.2116 0.9774 3.2046 -1.394)",width:"2.063",height:"19.875"}),createBaseVNode("path",{d:`M12.528,5.088c0,0,3.416-0.382,4.479-0.031c1.005,0.332,2.375,2.219,3.382,2.545c1.096,0.354,4.607-0.089,4.607-0.089 3184 l-2.738,8.488c0,0-3.285,0.641-4.344,0.381c-1.049-0.257-2.607-2.015-3.642-2.324c-0.881-0.264-3.678-0.052-3.678-0.052 3185 L12.528,5.088z`})],-1);function _sfc_render$h(n,e,t,i,r,s){const a=resolveComponent("MenuButton"),o=resolveComponent("SvgButton"),l=resolveComponent("DayNightSwitch"),c=resolveComponent("ControlsSwitch"),u=resolveComponent("PositionInput"),d=resolveComponent("Compass");return openBlock(),createElementBlock("div",_hoisted_1$f,[createVNode(a,{close:r.appState.menu.isOpen,back:!1,onAction:e[0]||(e[0]=f=>r.appState.menu.reOpenPage()),title:n.$t("menu.tooltip")},null,8,["close","title"]),_hoisted_2$c,r.appState.maps.length>1?(openBlock(),createBlock(o,{key:0,class:"thin-hide",title:n.$t("maps.tooltip"),onAction:e[1]||(e[1]=f=>r.appState.menu.openPage("maps",n.$t("maps.title")))},{default:withCtx(()=>[_hoisted_3$b]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu&&s.showMarkerMenu?(openBlock(),createBlock(o,{key:1,class:"thin-hide",title:n.$t("markers.tooltip"),onAction:e[2]||(e[2]=f=>r.appState.menu.openPage("markers",n.$t("markers.title"),{markerSet:r.markers}))},{default:withCtx(()=>[_hoisted_4$7]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu&&!s.playerMarkerSet.fake?(openBlock(),createBlock(o,{key:2,class:"thin-hide",title:n.$t("players.tooltip"),onAction:s.openPlayerList},{default:withCtx(()=>[_hoisted_5$3]),_:1},8,["title","onAction"])):createCommentVNode("",!0),_hoisted_6$3,s.showMapMenu?(openBlock(),createBlock(l,{key:3,class:"thin-hide",title:n.$t("lighting.dayNightSwitch.tooltip")},null,8,["title"])):createCommentVNode("",!0),_hoisted_7$3,s.showMapMenu&&s.showViewControl
3185s?(openBlock(),createBlock(c,{key:4,class:"thin-hide"})):createCommentVNode("",!0),s.showViewControls?(openBlock(),createElementBlock("div",_hoisted_8$3)):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(o,{key:6,class:"thin-hide",title:n.$t("resetCamera.tooltip"),onAction:e[3]||(e[3]=f=>n.$bluemap.resetCamera())},{default:withCtx(()=>[_hoisted_9$2]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(u,{key:7,class:"pos-input"})):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(d,{key:8,title:n.$t("compass.tooltip")},null,8,["title"])):createCommentVNode("",!0)])}const ControlBar=_export_sfc(_sfc_main$h,[["render",_sfc_render$h]]),_sfc_main$g={name:"SideMenu",components:{MenuButton},props:{title:{type:String,default:"Menu"},open:{type:Boolean,default:!0},back:Boolean},data(){return{rendered:!1}},methods:{async buttonEnterAnimation(){this.rendered=!1,await this.$nextTick(),await this.$nextTick(),this.rendered=!0}}},_hoisted_1$e={key:0,class:"side-menu"},_hoisted_2$b={class:"title"},_hoisted_3$a={class:"content"};function _sfc_render$g(n,e,t,i,r,s){const a=resolveComponent("MenuButton");return openBlock(),createBlock(Transition,{name:"side-menu",onEnter:e[2]||(e[2]=o=>{s.buttonEnterAnimation(),n.$emit("enter",o)})},{default:withCtx(()=>[t.open?(openBlock(),createElementBlock("div",_hoisted_1$e,[createVNode(a,{close:t.open&&r.rendered,back:t.back,onAction:e[0]||(e[0]=o=>n.$emit("back",o))},null,8,["close","back"]),t.open&&t.back?(openBlock(),createBlock(a,{key:0,class:"full-close",close:!0,onAction:e[1]||(e[1]=o=>n.$emit("close",o))})):createCommentVNode("",!0),createBaseVNode("div",_hoisted_2$b,toDisplayString$1(t.title),1),createBaseVNode("div",_hoisted_3$a,[renderSlot(n.$slots,"default")])])):createCommentVNode("",!0)]),_:3})}const SideMenu=_export_sfc(_sfc_main$g,[["render",_sfc_render$g]]),_sfc_main$f={name:"SimpleButton",props:{submenu:Boolean,active:{type:Boolean,default:!1}}},_hoisted_1$d={class:"label"},_hoisted_2$a={key:0,class:"submenu-icon"},_hoisted_3$9=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0 3186 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0 3187 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})],-1),_hoisted_4$6=[_hoisted_3$9];function _sfc_render$f(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["simple-button",{active:t.active}]),onClick:e[0]||(e[0]=a=>n.$emit("action"))},[createBaseVNode("div",_hoisted_1$d,[renderSlot(n.$slots,"default")]),t.submenu?(openBlock(),createElementBlock("div",_hoisted_2$a,_hoisted_4$6)):createCommentVNode("",!0)],2)}const SimpleButton=_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]),_sfc_main$e={name:"Group",props:{title:String}},_hoisted_1$c={class:"group"},_hoisted_2$9={class:"title"},_hoisted_3$8={class:"content"};function _sfc_render$e(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$c,[createBaseVNode("span",_hoisted_2$9,toDisplayString$1(t.title),1),createBaseVNode("div",_hoisted_3$8,[renderSlot(n.$slots,"default")])])}const Group=_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);function countDecimals(n){return Math.floor(n)===n?0:n.toString().split(".")[1].length||0}const _sfc_main$d={name:"Slider",props:{value:Number,min:Number,max:Number,step:Number,formatter:{type:Function,default:function(n){return parseFloat(n).toFixed(countDecimals(this.step))}}}},_hoisted_1$b={class:"slider"},_hoisted_2$8={class:"label"},_hoisted_3$7={class:"value"},_hoisted_4$5=["min","max","step","value"];function _sfc_render$d(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$b,[createBaseVNode("div",_hoisted_2$8,[render
3187Slot(n.$slots,"default"),createTextVNode(": "),createBaseVNode("span",_hoisted_3$7,toDisplayString$1(t.formatter(t.value)),1)]),createBaseVNode("label",null,[createBaseVNode("input",{type:"range",min:t.min,max:t.max,step:t.step,value:t.value,onInput:e[0]||(e[0]=a=>n.$emit("update",parseFloat(a.target.value))),onChange:e[1]||(e[1]=a=>n.$emit("lazy",parseFloat(a.target.value)))},null,40,_hoisted_4$5)])])}const Slider=_export_sfc(_sfc_main$d,[["render",_sfc_render$d]]),_sfc_main$c={name:"SwitchHandle",props:{on:Boolean}};function _sfc_render$c(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["switch",{on:t.on}])},null,2)}const SwitchHandle=_export_sfc(_sfc_main$c,[["render",_sfc_render$c]]),_sfc_main$b={name:"SwitchButton",components:{SwitchHandle},props:{on:Boolean}},_hoisted_1$a={class:"label"};function _sfc_render$b(n,e,t,i,r,s){const a=resolveComponent("SwitchHandle");return openBlock(),createElementBlock("div",{class:"switch-button",onClick:e[0]||(e[0]=o=>n.$emit("action"))},[createBaseVNode("div",_hoisted_1$a,[renderSlot(n.$slots,"default")]),createVNode(a,{on:t.on},null,8,["on"])])}const SwitchButton=_export_sfc(_sfc_main$b,[["render",_sfc_render$b]]);/*! 3188 * shared v9.14.5 3189 * (c) 2025 kazuya kawaguchi 3190 * Released under the MIT License. 3191 */function warn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const inBrowser=typeof window<"u",makeSymbol=(n,e=!1)=>e?Symbol.for(n):Symbol(n),generateFormatCacheKey=(n,e,t)=>friendlyJSONstringify({l:n,k:e,s:t}),friendlyJSONstringify=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=n=>typeof n=="number"&&isFinite(n),isDate=n=>toTypeString(n)==="[object Date]",isRegExp=n=>toTypeString(n)==="[object RegExp]",isEmptyObject=n=>isPlainObject(n)&&Object.keys(n).length===0,assign$1=Object.assign,_create=Object.create,create=(n=null)=>_create(n);let _globalThis;const getGlobalThis=()=>_globalThis||(_globalThis=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:create());function escapeHtml(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function escapeAttributeValue(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function sanitizeTranslatedHtml(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(i,r,s)=>`${r}="${escapeAttributeValue(s)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(i,r,s)=>`${r}='${escapeAttributeValue(s)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(i=>{n=n.replace(i,"$1javascript:")}),n}const hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(n,e){return hasOwnProperty.call(n,e)}const isArray=Array.isArray,isFunction=n=>typeof n=="function",isString$1=n=>typeof n=="string",isBoolean=n=>typeof n=="boolean",isObject$1=n=>n!==null&&typeof n=="object",isPromise=n=>isObject$1(n)&&isFunction(n.then)&&isFunction(n.catch),objectToString=Object.prototype.toString,toTypeString=n=>objectToString.call(n),isPlainObject=n=>{if(!isObject$1(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},toDisplayString=n=>n==null?"":isArray(n)||isPlainObject(n)&&n.toString===objectToString?JSON.stringify(n,null,2):String(n);function join$1(n,e=""){return n.reduce((t,i,r)=>r===0?t+i:t+e+i,"")}function incrementer(n){let e=n;return()=>++e}const isNotObjectOrIsArray=n=>!isObject$1(n)||isArray(n);function deepCopy(n,e){if(isNotObjectOrIsArray(n)||isNotObjectOrIsArray(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:i,des:r}=t.pop();
vendor: 14,612 bytes, lines 3191-3196
3191Object.keys(i).forEach(s=>{s!=="__proto__"&&(isObject$1(i[s])&&!isObject$1(r[s])&&(r[s]=Array.isArray(i[s])?[]:create()),isNotObjectOrIsArray(r[s])||isNotObjectOrIsArray(i[s])?r[s]=i[s]:t.push({src:i[s],des:r[s]}))})}}/*! 3192 * message-compiler v9.14.5 3193 * (c) 2025 kazuya kawaguchi 3194 * Released under the MIT License. 3195 */function createPosition(n,e,t){return{line:n,column:e,offset:t}}function createLocation(n,e,t){return{start:n,end:e}}const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(n,...e){return e.length===1&&isObject(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(RE_ARGS,(t,i)=>e.hasOwnProperty(i)?e[i]:"")}const assign=Object.assign,isString=n=>typeof n=="string",isObject=n=>n!==null&&typeof n=="object";function join(n,e=""){return n.reduce((t,i,r)=>r===0?t+i:t+e+i,"")}const CompileWarnCodes={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},warnMessages={[CompileWarnCodes.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function createCompileWarn(n,e,...t){const i=format$1(warnMessages[n],...t||[]),r={message:String(i),code:n};return e&&(r.location=e),r}const CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},errorMessages={[CompileErrorCodes.EXPECTED_TOKEN]:"Expected token: '{0}'",[CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[CompileErrorCodes.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[CompileErrorCodes.EMPTY_PLACEHOLDER]:"Empty placeholder",[CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[CompileErrorCodes.INVALID_LINKED_FORMAT]:"Invalid linked format",[CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function createCompileError(n,e,t={}){const{domain:i,messages:r,args:s}=t,a=format$1((r||errorMessages)[n]||"",...s||[]),o=new SyntaxError(String(a));return o.code=n,e&&(o.location=e),o.domain=i,o}function defaultOnError(n){throw n}const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF=` 3196`,CHAR_LS="\u2028",CHAR_PS="\u2029";function createScanner(n){const e=n;let t=0,i=1,r=1,s=0;const a=R=>e[R]===CHAR_CR&&e[R+1]===CHAR_LF,o=R=>e[R]===CHAR_LF,l=R=>e[R]===CHAR_PS,c=R=>e[R]===CHAR_LS,u=R=>a(R)||o(R)||l(R)||c(R),d=()=>t,f=()=>i,m=()=>r,v=()=>s,_=R=>a(R)||l(R)||c(R)?CHAR_LF:e[R],g=()=>_(t),x=()=>_(t+s);function S(){return s=0,u(t)&&(i++,r=0),a(t)&&t++,t++,r++,e[t]}function y(){return a(t+s)&&s++,s++,e[t+s]}function b(){t=0,i=1,r=1,s=0}function w(R=0){s=R}function C(){const R=t+s;for(;R!==t;)S();s=0}return{index:d,line:f,column:m,peekOffset:v,charAt:_,currentChar:g,currentPeek:x,next:S,peek:y,reset:b,resetPeek:w,skipToPeek:C}}const EOF=void 0,DOT=".",LITERAL_DELIMITER="'",ERROR_DOMAIN$3="tokenizer";function createTokenizer(n,e={}){const t=e.location!==!1,i=createScanner(n),r=()=>i.index(),s=()=>createPosition(i.line(),i.column(),i.index()),a=s(),o=r(),l={currentType:14,offset:o,startLoc:a,endLoc:a,lastType:14,lastOffset:o,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function d(P,N,T,...E){const z=c();if(N.column+=T,N.offset+=T,u){const K=t?createLocation(z.startLoc,N):null,V=createCompileError(P,K,{domain:ERROR_DOMAIN$3,args:E});u(V)}}function f(P,N,T){P.endLoc=s(),P.currentType=N;const E={type:N};return t&&(E.loc=createLocation(P.startLoc,P.endLoc)),T!=null&&(E.value=T),E}const m=P=>f(P,14);function v(P,N){return P.currentChar()===N?(P.next(),N):(d(CompileErrorCodes.EXPECTED_TOKEN,s(),0,N),"")}function _(P){let N="";for(;P.currentPeek()===CHAR_SP||P.currentPeek()===CHAR_LF;)N+=P.currentPeek(),P.peek();return N}function g(P){const N=_(P);return P.skipToPeek(),N}function x(P){if(P===EOF)return!1;const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N===95}function S(P){if(P===EOF)return!1;const N=P.charCodeAt(0);return N>=48&&N<=57}function y(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=x(P.currentPeek());return P.resetPeek(),E}function b(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=P.currentPeek()==="-"?P.peek():P.currentPeek(),z=S(E);return P.resetPeek(),z}function w(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=P.currentPeek()===LITERAL_DELIMITER;return P.resetPeek(),E}function C(P,N){const{currentType:T}=N;if(T!==8)return!1;_(P);const E=P.currentPeek()===".";return P.resetPeek(),E}function R(P,N){const{currentType:T}=N;if(T!==9)return!1;_(P);const E=x(P.currentPeek());return P.resetPeek(),E}function M(P,N){const{currentType:T}=N;if(!(T===8||T===12))return!1;_(P);const E=P.currentPeek()===":";return P.resetPeek(),E}function L(P,N){const{currentType:T}=N;if(T!==10)return!1;const E=()=>{const K=P.currentPeek();return K==="{"?x(P.peek()):K==="@"||K==="%"||K==="|"||K===":"||K==="."||K===CHAR_SP||!K?!1:K===CHAR_LF?(P.peek(),E()):W(P,!1)},z=E();return P.resetPeek(),z}function B(P){_(P);const N=P.currentPeek()==="|";return P.resetPeek(),N}function Z(P){const N=_(P),T=P.currentPeek()==="%"&&P.peek()==="{";return P.resetPeek(),{isModulo:T,hasSpace:N.length>0}}function W(P,N=!0){const T=(z=!1,K="",V=!1)=>{const $=P.currentPeek();return $==="{"?K==="%"?!1:z:$==="@"||!$?K==="%"?!0:z:$==="%"?(P.peek(),T(z,"%",!0)):$==="|"?K==="%"||V?!0:!(K===CHAR_SP||K===CHAR_LF):$===CHAR_SP?(P.peek(),T(!0,CHAR_SP,V)):$===CHAR_LF?(P.peek(),T(!0,CHAR_LF,V)):!0},E=T();return N&&P.resetPeek(),E}function X(P,N){const T=P.currentChar();return T===EOF?EOF:N(T)?(P.next(),T):null}function G(P){const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36}function le(P){return X(P,G)}function he(P){const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36||N===45}function ue(P){return X(P,he)}function ie(P){const N=P.charCodeAt(0);return N>=48&&N<=57}function ve(P){return X(P,ie)}function _e(P){const N=P.charCodeAt(0);return N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102}function Q(P){return X(P,_e)}function ne(P){let N="",T="";for(;N=ve(P);)T+=N;return T}function ye(P){g(P);const N=P.currentChar();return N!=="%"&&d(CompileErrorCodes.EXPECTED_TOKEN,s(),0,N),P.next(),"%"}function Me(P){let N="";for(;;){const T=P.currentChar();if(T==="{"||T==="}"||T==="@"||T==="|"||!T)break;if(T==="%")if(W(P))N+=T,P.next();else break;else if(T===CHAR_SP||T===CHAR_LF)if(W(P))N+=T,P.next();else{if(B(P))break;N+=T,P.next()}else N+=T,P.next()}return N}function Te(P){g(P);let N="",T="";for(;N=ue(P);)T+=N;return P.currentChar()===EOF&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T}function ae(P){g(P);let N="";return P.currentChar()==="-"?(P.next(),N+=`-${ne(P)}`):N+=ne(P),P.currentChar()===EOF&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),N}function Le(P){return P!==LITERAL_DELIMITER&&P!==CHAR_LF}function Ee(P){g(P),v(P,"'");let N="",T="";for(;N=X(P,Le);)N==="\\"?T+=Ce(P):T+=N;const E=P.currentChar();return E===CHAR_LF||E===EOF?(d(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),E===CHAR_LF&&(P.next(),v(P,"'")),T):(v(P,"'"),T)}function Ce(P){const N=P.currentChar();switch(N){case"\\":case"'":return P.next(),`\\${N}`;case"u":return we(P,N,4);case"U":return we(P,N,6);default:return d(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),0,N),""}}function we(P,N,T){v(P,N);let E="";for(let z=0;z<T;z++){const K=Q(P);if(!K){d(CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${N}${E}${P.currentChar()}`);break}E+=K}return`\\${N}${E}`}function O(P){return P!=="{"&&P!=="}"&&P!==CHAR_SP&&P!==CHAR_LF}function D(P){g(P);let N="",T="";for(;N=X(P,O);)T+=N;return T}function k(P){let N="",T="";for(;N=le(P);)T+=N;return T}function H(P){const N=T=>{const E=P.currentChar();return E==="{"||E==="%"||E==="@"||E==="|"||E==="("||E===")"||!E||E===CHAR_SP?T:(T+=E,P.next(),N(T))};return N("")}function j(P){g(P);const N=v(P,"|");return g(P),N}function Y(P,N){let T=null;switch(P.currentChar()){case"{":return N.braceNest>=1&&d(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),P.next(),T=f(N,2,"{"),g(P),N.braceNest++,T;case"}":return N.braceNest>0&&N.currentType===2&&d(CompileErrorCodes.EMPTY_PLACEHOLDER,s(),0),P.next(),T=f(N,3,"}"),N.braceNest--,N.braceNest>0&&g(P),N.inLinked&&N.braceNest===0&&(N.inLinked=!1),T;case"@":return N.braceNest>0&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T=ce(P,N)||m(N),N.braceNest=0,T;default:{let z=!0,K=!0,V=!0;if(B(P))return N.braceNest>0&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,T;if(N.braceNest>0&&(N.currentType===5||N.currentType===6||N.currentType===7))return d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),N.braceNest=0,re(P,N);if(z=y(P,N))return T=f(N,5,Te(P)),g(P),T;if(K=b(P,N))return T=f(N,6,ae(P)),g(P),T;if(V=w(P,N))return T=f(N,7,Ee(P)),g(P),T;if(!z&&!K&&!V)return T=f(N,13,D(P)),d(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,T.value),g(P),T;break}}return T}function ce(P,N){const{currentType:T}=N;let E=null;const z=P.currentChar();switch((T===8||T===9||T===12||T===10)&&(z===CHAR_LF||z===CHAR_SP)&&d(CompileErrorCodes.INVALID_LINKED_FORMAT,s(),0),z){case"@":return P.next(),E=f(N,8,"@"),N.inLinked=!0,E;case".":return g(P),P.next(),f(N,9,".");case":":return g(P),P.next(),f(N,10,":");default:return B(P)?(E=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,E):C(P,N)||M(P,N)?(g(P),ce(P,N)):R(P,N)?(g(P),f(N,12,k(P))):L(P,N)?(g(P),z==="{"?Y(P,N)||E:f(N,11,H(P))):(T===8&&d(CompileErrorCodes.INVALID_LINKED_FORMAT,s(),0),N.braceNest=0,N.inLinked=!1,re(P,N))}}function re(P,N){let T={type:14};if(N.braceNest>0)return Y(P,N)||m(N);if(N.inLinked)return ce(P,N)||m(N);switch(P.currentChar()){case"{":return Y(P,N)||m(N);case"}":return d(CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),0),P.next(),f(N,3,"}");case"@":return ce(P,N)||m(N);default:{if(B(P))return T=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,T;const{isModulo:z,hasSpace:K}=Z(P);if(z)return K?f(N,0,Me(P)):f(N,4,ye(P));if(W(P))return f(N,0,Me(P));break}}return T}function se(){const{currentType:P,offset:N,startLoc:T,endLoc:E}=l;return l.lastType=P,l.lastOffset=N,l.lastStartLoc=T,l.lastEndLoc=E,l.offset=r(),l.startLoc=s(),i.currentChar()===EOF?f(l,14):re(i,l)}return{nextToken:se,currentOffset:r,currentPosition:s,context:c}}const ERROR_DOMAIN$2="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function createParser(n={}){const e=n.location!==!1,{onError:t,onWarn:i}=n;function r(y,b,w,C,...R){const M=y.currentPosition();if(M.offset+=C,M.column+=C,t){const L=e?createLocation(w,M):null,B=createCompileError(b,L,{domain:ERROR_DOMAIN$2,args:R});t(B)}}function s(y,b,w,C,...R){const M=y.currentPosition();if(M.offset+=C,M.column+=C,i){const L=e?createLocation(w,M):null;i(createCompileWarn(b,L,R))}}function a(y,b,w){const C={type:y};return e&&(C.start=b,C.end=b,C.loc={start:w,end:w}),C}function o(y,b,w,C){e&&(y.end=b,y.loc&&(y.loc.end=w))}function l(y,b){const w=y.context(),C=a(3,w.offset,w.startLoc);return C.value=b,o(C,y.currentOffset(),y.currentPosition()),C}function c(y,b){const w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(5,C,R);return M.index=parseInt(b,10),y.nextToken(),o(M,y.currentOffset(),y.currentPosition()),M}function u(y,b,w){const C=y.context(),{lastOffset:R,lastStartLoc:M}=C,L=a(4,R,M);return L.key=b,w===!0&&(L.modulo=!0),y.nextToken(),o(L,y.currentOffset(),y.currentPosition()),L}function d(y,b){const w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(9,C,R);return M.value=b.replace(KNOWN_ESCAPES,fromEscapeSequence),y.nextToken(),o(M,y.currentOffset(),y.currentPosition()),M}function f(y){const b=y.nextToken(),w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(8,C,R);return b.type!==12?(r(y,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),M.value="",o(M,C,R),{nextConsumeToken:b,node:M}):(b.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,getTokenCaption(b)),M.value=b.value||"",o(M,y.currentOffset(),y.currentPosition()),{node:M})}function m(y,b){const w=y.context(),C=a(7,w.offset,w.startLoc);return C.value=b,o(C,y.currentOffset(),y.currentPosition()),C}function v(y){const b=y.context(),w=a(6,b.offset,b.startLoc);let C=y.nextToken();if(C.type===9){const R=f(y);w.modifier=R.node,C=R.nextConsumeToken||y.nextToken()}switch(C.type!==10&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),C=y.nextToken(),C.type===2&&(C=y.nextToken()),C.type){case 11:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=m(y,C.value||"");break;case 5:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=u(y,C.value||"");break;case 6:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=c(y,C.value||"");break;case 7:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=d(y,C.value||"");break;default:{r(y,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,b.lastStartLoc,0);const R=y.context(),M=a(7,R.offset,R.startLoc);return M.value="",o(M,R.offset,R.startLoc),w.key=M,o(w,R.offset,R.startLoc),{nextConsumeToken:C,node:w}}}return o(w,y.currentOffset(),y.currentPosition()),{node:w}}function _(y){const b=y.context(),w=b.currentType===1?y.currentOffset():b.offset,C=b.currentType===1?b.endLoc:b.startLoc,R=a(2,w,C);R.items=[];
3196let M=null,L=null;do{const W=M||y.nextToken();switch(M=null,W.type){case 0:W.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(W)),R.items.push(l(y,W.value||""));break;case 6:W.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(W)),R.items.push(c(y,W.value||""));break;case 4:L=!0;break;case 5:W.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(W)),R.items.push(u(y,W.value||"",!!L)),L&&(s(y,CompileWarnCodes.USE_MODULO_SYNTAX,b.lastStartLoc,0,getTokenCaption(W)),L=null);break;case 7:W.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(W)),R.items.push(d(y,W.value||""));break;case 8:{const X=v(y);R.items.push(X.node),M=X.nextConsumeToken||null;break}}}while(b.currentType!==14&&b.currentType!==1);const B=b.currentType===1?b.lastOffset:y.currentOffset(),Z=b.currentType===1?b.lastEndLoc:y.currentPosition();return o(R,B,Z),R}function g(y,b,w,C){const R=y.context();let M=C.items.length===0;const L=a(1,b,w);L.cases=[],L.cases.push(C);do{const B=_(y);M||(M=B.items.length===0),L.cases.push(B)}while(R.currentType!==14);return M&&r(y,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),o(L,y.currentOffset(),y.currentPosition()),L}function x(y){const b=y.context(),{offset:w,startLoc:C}=b,R=_(y);return b.currentType===14?R:g(y,w,C,R)}function S(y){const b=createTokenizer(y,assign({},n)),w=b.context(),C=a(0,w.offset,w.startLoc);return e&&C.loc&&(C.loc.source=y),C.body=x(b),n.onCacheKey&&(C.cacheKey=n.onCacheKey(y)),w.currentType!==14&&r(b,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,y[w.offset]||""),o(C,b.currentOffset(),b.currentPosition()),C}return{parse:S}}function getTokenCaption(n){if(n.type===14)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function createTransformer(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function traverseNodes(n,e){for(let t=0;t<n.length;t++)traverseNode(n[t],e)}function traverseNode(n,e){switch(n.type){case 1:traverseNodes(n.cases,e),e.helper("plural");break;case 2:traverseNodes(n.items,e);break;case 6:{traverseNode(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function transform(n,e={}){const t=createTransformer(n);t.helper("normalize"),n.body&&traverseNode(n.body,t);const i=t.context();n.helpers=Array.from(i.helpers)}function optimize(n){const e=n.body;return e.type===2?optimizeMessageNode(e):e.cases.forEach(t=>optimizeMessageNode(t)),n}function optimizeMessageNode(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const i=n.items[t];if(!(i.type===3||i.type===9)||i.value==null)break;e.push(i.value)}if(e.length===n.items.length){n.static=join(e);for(let t=0;t<n.items.length;t++){const i=n.items[t];(i.type===3||i.type===9)&&delete i.value}}}}const ERROR_DOMAIN$1="minifier";function minify(n){switch(n.t=n.type,n.type){case 0:{const e=n;minify(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let i=0;i<t.length;i++)minify(t[i]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let i=0;i<t.length;i++)minify(t[i]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;minify(e.key),e.k=e.key,delete e.key,e.modifier&&(minify(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:throw createCompileError(CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:ERROR_DOMAIN$1,args:[n.type]})}delete n.type}const ERROR_DOMAIN="parser";function createCodeGenerator(n,e){const{filename:t,breakLineCode:i,needIndent:r}
3196=e,s=e.location!==!1,a={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:i,needIndent:r,indentLevel:0};s&&n.loc&&(a.source=n.loc.source);const o=()=>a;function l(_,g){a.code+=_}function c(_,g=!0){const x=g?i:"";l(r?x+" ".repeat(_):x)}function u(_=!0){const g=++a.indentLevel;_&&c(g)}function d(_=!0){const g=--a.indentLevel;_&&c(g)}function f(){c(a.indentLevel)}return{context:o,push:l,indent:u,deindent:d,newline:f,helper:_=>`_${_}`,needIndent:()=>a.needIndent}}function generateLinkedNode(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),generateNode(n,e.key),e.modifier?(n.push(", "),generateNode(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function generateMessageNode(n,e){const{helper:t,needIndent:i}=n;n.push(`${t("normalize")}([`),n.indent(i());const r=e.items.length;for(let s=0;s<r&&(generateNode(n,e.items[s]),s!==r-1);s++)n.push(", ");n.deindent(i()),n.push("])")}function generatePluralNode(n,e){const{helper:t,needIndent:i}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(i());const r=e.cases.length;for(let s=0;s<r&&(generateNode(n,e.cases[s]),s!==r-1);s++)n.push(", ");n.deindent(i()),n.push("])")}}function generateResource(n,e){e.body?generateNode(n,e.body):n.push("null")}function generateNode(n,e){const{helper:t}=n;switch(e.type){case 0:generateResource(n,e);break;case 1:generatePluralNode(n,e);break;case 2:generateMessageNode(n,e);break;case 6:generateLinkedNode(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:throw createCompileError(CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:ERROR_DOMAIN,args:[e.type]})}}const generate=(n,e={})=>{const t=isString(e.mode)?e.mode:"normal",i=isString(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` 3197`,s=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],o=createCodeGenerator(n,{filename:i,breakLineCode:r,needIndent:s});o.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),o.indent(s),a.length>0&&(o.push(`const { ${join(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),o.newline()),o.push("return "),generateNode(o,n),o.deindent(s),o.push("}"),delete n.helpers;const{code:l,map:c}=o.context();return{ast:n,code:l,map:c?c.toJSON():void 0}};function baseCompile$1(n,e={}){const t=assign({},e),i=!!t.jit,r=!!t.minify,s=t.optimize==null?!0:t.optimize,o=createParser(t).parse(n);return i?(s&&optimize(o),r&&minify(o),{ast:o,code:""}):(transform(o,t),generate(o,t))}/*! 3198 * core-base v9.14.5 3199 * (c) 2025 kazuya kawaguchi 3200 * Released under the MIT License. 3201 */function initFeatureFlags$1(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(getGlobalThis().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function isMessageAST(n){return isObject$1(n)&&resolveType(n)===0&&(hasOwn(n,"b")||hasOwn(n,"body"))}const PROPS_BODY=["b","body"];function resolveBody(n){return resolveProps(n,PROPS_BODY)}const PROPS_CASES=["c","cases"];function resolveCases(n){return resolveProps(n,PROPS_CASES,[])}const PROPS_STATIC=["s","static"];function resolveStatic(n){return resolveProps(n,PROPS_STATIC)}const PROPS_ITEMS=["i","items"];function resolveItems(n){return resolveProps(n,PROPS_ITEMS,[])}const PROPS_TYPE=["t","type"];function resolveType(n){return resolveProps(n,PROPS_TYPE)}const PROPS_VALUE=["v","value"];function resolveValue$1(n,e){const t=resolveProps(n,PROPS_VALUE);if(t!=null)return t;throw createUnhandleNodeError(e)}const PROPS_MODIFIER=["m","modifier"];function resolveLinkedModifier(n){return resolveProps(n,PROPS_MODIFIER)}const PROPS_KEY=["k","key"];function resolveLinkedKey(n){const e=resolveProps(n,PROPS_KEY);if(e)return e;throw createUnhandleNodeError(6)}function resolveProps(n,e,t){for(let i=0;i<e.length;i++){const r=e[i];if(hasOwn(n,r)&&n[r]!=null)return n[r]}return t}
3201const AST_NODE_PROPS_KEYS=[...PROPS_BODY,...PROPS_CASES,...PROPS_STATIC,...PROPS_ITEMS,...PROPS_KEY,...PROPS_MODIFIER,...PROPS_VALUE,...PROPS_TYPE];function createUnhandleNodeError(n){return new Error(`unhandled node type: ${n}`)}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]};pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]};pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]};pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]};pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]};pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]};pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(n){return literalValueRE.test(n)}function stripQuotes(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function getPathCharType(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function formatSubPath(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:isLiteral(e)?stripQuotes(e):"*"+e}function parse(n){const e=[];let t=-1,i=0,r=0,s,a,o,l,c,u,d;const f=[];f[0]=()=>{a===void 0?a=o:a+=o},f[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},f[2]=()=>{f[0](),r++},f[3]=()=>{if(r>0)r--,i=4,f[0]();else{if(r=0,a===void 0||(a=formatSubPath(a),a===!1))return!1;f[1]()}};function m(){const v=n[t+1];if(i===5&&v==="'"||i===6&&v==='"')return t++,o="\\"+v,f[0](),!0}for(;i!==null;)if(t++,s=n[t],!(s==="\\"&&m())){if(l=getPathCharType(s),d=pathStateMachine[i],c=d[l]||d.l||8,c===8||(i=c[0],c[1]!==void 0&&(u=f[c[1]],u&&(o=s,u()===!1))))return;if(i===7)return e}}const cache=new Map;function resolveWithKeyValue(n,e){return isObject$1(n)?n[e]:null}function resolveValue(n,e){if(!isObject$1(n))return null;let t=cache.get(e);if(t||(t=parse(e),t&&cache.set(e,t)),!t)return null;const i=t.length;let r=n,s=0;for(;s<i;){const a=t[s];if(AST_NODE_PROPS_KEYS.includes(a)&&isMessageAST(r))return null;const o=r[a];if(o===void 0||isFunction(r))return null;r=o,s++}return r}const DEFAULT_MODIFIER=n=>n,DEFAULT_MESSAGE=n=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=n=>n.length===0?"":join$1(n),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function getPluralIndex(n){const e=isNumber(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(isNumber(n.named.count)||isNumber(n.named.n))?isNumber(n.named.count)?n.named.count:isNumber(n.named.n)?n.named.n:e:e}function normalizeNamed(n,e){e.count||(e.count=n),e.n||(e.n=n)}function createMessageContext(n={}){const e=n.locale,t=getPluralIndex(n),i=isObject$1(n.pluralRules)&&isString$1(e)&&isFunction(n.pluralRules[e])?n.pluralRules[e]:pluralDefault,r=isObject$1(n.pluralRules)&&isString$1(e)&&isFunction(n.pluralRules[e])?pluralDefault:void 0,s=x=>x[i(t,x.length,r)],a=n.list||[],o=x=>a[x],l=n.named||create();isNumber(n.pluralIndex)&&normalizeNamed(t,l);const c=x=>l[x];function u(x){const S=isFunction(n.messages)?n.messages(x):isObject$1(n.messages)?n.messages[x]:!1;return S||(n.parent?n.parent.message(x):DEFAULT_MESSAGE)}const d=x=>n.modifiers?n.modifiers[x]:DEFAULT_MODIFIER,f=isPlainObject(n.processor)&&isFunction(n.processor.normalize)?n.processor.normalize:DEFAULT_NORMALIZE,m=isPlainObject(n.processor)&&isFunction(n.processor.interpolate)?n.processor.interpolate:DEFAULT_INTERPOLATE,v=isPlainObject(n.processor)&&isString$1(n.processor.type)?n.processor.type:DEFAULT_MESSAGE_DATA_TYPE,g={list:o,named:c,plural:s,linked:(x,...S)=>{const[y,b]=S;let w="text",C="";S.length===1?isObject$1(y)?(C=y.modifier||C,w=y.type||w):isString$1(y)&&(C=y||C):S.length===2&&(isString$1(y)&&(C=y||C),isString$1(b)&&(w=b||w));const R=u(x)(g),M=w==="vnode"&&isArray(R)&&C?R[0]:R;return C?d(C)(M,w):M},message:u,type:v,interpolate:m,normalize:f,values:assign$1(create(),a,l)};return g}const code$1$1=CompileWarnCodes.__EXTEND_POINT__,inc$1$1=incrementer(code$1$1),CoreWarnCodes={FALLBACK_TO_TRANSLATE:inc$1$1(),CANNOT_FORMAT_NUM
3201BER:inc$1$1(),FALLBACK_TO_NUMBER_FORMAT:inc$1$1(),CANNOT_FORMAT_DATE:inc$1$1(),FALLBACK_TO_DATE_FORMAT:inc$1$1(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:inc$1$1(),__EXTEND_POINT__:inc$1$1()},code$2=CompileErrorCodes.__EXTEND_POINT__,inc$2=incrementer(code$2),CoreErrorCodes={INVALID_ARGUMENT:code$2,INVALID_DATE_ARGUMENT:inc$2(),INVALID_ISO_DATE_ARGUMENT:inc$2(),NOT_SUPPORT_NON_STRING_MESSAGE:inc$2(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:inc$2(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:inc$2(),NOT_SUPPORT_LOCALE_TYPE:inc$2(),__EXTEND_POINT__:inc$2()};function createCoreError(n){return createCompileError(n,null,void 0)}function getLocale(n,e){return e.locale!=null?resolveLocale(e.locale):resolveLocale(n.locale)}let _resolveLocale;function resolveLocale(n){if(isString$1(n))return n;if(isFunction(n)){if(n.resolvedOnce&&_resolveLocale!=null)return _resolveLocale;if(n.constructor.name==="Function"){const e=n();if(isPromise(e))throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=e}else throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(n,e,t){return[...new Set([t,...isArray(e)?e:isObject$1(e)?Object.keys(e):isString$1(e)?[e]:[t]])]}function fallbackWithLocaleChain(n,e,t){const i=isString$1(t)?t:DEFAULT_LOCALE,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let s=r.__localeChainCache.get(i);if(!s){s=[];let a=[t];for(;isArray(a);)a=appendBlockToChain(s,a,e);const o=isArray(e)||!isPlainObject(e)?e:e.default?e.default:null;a=isString$1(o)?[o]:o,isArray(a)&&appendBlockToChain(s,a,!1),r.__localeChainCache.set(i,s)}return s}function appendBlockToChain(n,e,t){let i=!0;for(let r=0;r<e.length&&isBoolean(i);r++){const s=e[r];isString$1(s)&&(i=appendLocaleToChain(n,e[r],t))}return i}function appendLocaleToChain(n,e,t){let i;const r=e.split("-");do{const s=r.join("-");i=appendItemToChain(n,s,t),r.splice(-1,1)}while(r.length&&i===!0);return i}function appendItemToChain(n,e,t){let i=!1;if(!n.includes(e)&&(i=!0,e)){i=e[e.length-1]!=="!";const r=e.replace(/!/g,"");n.push(r),(isArray(t)||isPlainObject(t))&&t[r]&&(i=t[r])}return i}const VERSION$1="9.14.5",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(n,e)=>e==="text"&&isString$1(n)?n.toUpperCase():e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&isString$1(n)?n.toLowerCase():e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&isString$1(n)?capitalize(n):e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?capitalize(n.children):n}}let _compiler;function registerMessageCompiler(n){_compiler=n}let _resolver;function registerMessageResolver(n){_resolver=n}let _fallbacker;function registerLocaleFallbacker(n){_fallbacker=n}const setAdditionalMeta=n=>{};let _fallbackContext=null;const setFallbackContext=n=>{_fallbackContext=n},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(n={}){const e=isFunction(n.onWarn)?n.onWarn:warn,t=isString$1(n.version)?n.version:VERSION$1,i=isString$1(n.locale)||isFunction(n.locale)?n.locale:DEFAULT_LOCALE,r=isFunction(i)?DEFAULT_LOCALE:i,s=isArray(n.fallbackLocale)||isPlainObject(n.fallbackLocale)||isString$1(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=isPlainObject(n.messages)?n.messages:createResources(r),o=isPlainObject(n.datetimeFormats)?n.datetimeFormats:createResources(r),l=isPlainObject(n.numberFormats)?n.numberFormats:createResources(r),c=assign$1(create(),n.modifiers,getDefaultLinkedModifiers()),u=n.pluralRules||create(),d=isFunction(n.missing)?n.missing:null,f=isBoolean(n.missingWarn)||isRegExp(n.missingWarn)?n.missingWarn:!0,m=isBoolean(n.fallbackWarn)||isRegExp(n.fallbackWarn)?n.fallbackWarn:!0,v=!!n.fallbackFormat,_=!!n.unresolving,g=isFunction(n.postTranslation)?n.postTranslation:null,x=isPlainObject(n.processor)?n.processor:null,S=isBoolean(n.warnHtmlMessage)?n.warnHtmlMessage:!0,y=!!n.escapeParameter,b=isFunction(n.messageCompiler)?n.messageCompiler:_compiler,w=isFunction(n.messageResolver)?n.messageResolver:_resolver||resolveWithKeyValue,C=isFunction(n.localeFallbacker)?n.localeFallbacker:_fallbacker||fallbackWithSimple,R=isObject$1(n.fallbackContext)?n.fallbackContext:void 0,M=n,L=isObject$1(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,B=isObject$1(M.__numberFormatters)?M.__numberFormatters:new Map,Z=isObject$1(M.__meta)?M.__meta:{};_cid++;const W={version:t,cid:_cid,locale:i,fallbackLocale:s,messages:a,modifiers:c,pluralRules:u,missing:d,missingWarn:f,fallbackWarn:m,fallbackFormat:v,unresolving:_,postTranslation:g,processor:x,warnHtmlMessage:S,escapeParameter:y,messageCompiler:b,messageResolver:w,localeFallbacker:C,fallbackContext:R,onWarn:e,__meta:Z};return W.datetimeFormats=o,W.numberFormats=l,W.__datetimeFormatters=L,W.__numberFormatters=B,W}const createResources=n=>({[n]:create()});function handleMissing(n,e,t,i,r){const{missing:s,onWarn:a}=n;if(s!==null){const o=s(n,t,e,r);return isString$1(o)?o:e}else return e}function updateFallbackLocale(n,e,t){const i=n;i.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function isAlmostSameLocale(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function isImplicitFallback(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let i=t+1;i<e.length;i++)if(isAlmostSameLocale(n,e[i]))return!0;return!1}function format(n){return t=>formatParts(t,n)}function formatParts(n,e){const t=resolveBody(e);if(t==null)throw createUnhandleNodeError(0);if(resolveType(t)===1){const s=resolveCases(t);return n.plural(s.reduce((a,o)=>[...a,formatMessageParts(n,o)],[]))}else return formatMessageParts(n,t)}function formatMessageParts(n,e){const t=resolveStatic(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const i=resolveItems(e).reduce((r,s)=>[...r,formatMessagePart(n,s)],[]);return n.normalize(i)}}function formatMessagePart(n,e){const t=resolveType(e);switch(t){case 3:return resolveValue$1(e,t);case 9:return resolveValue$1(e,t);case 4:{const i=e;if(hasOwn(i,"k")&&i.k)return n.interpolate(n.named(i.k));if(hasOwn(i,"key")&&i.key)return n.interpolate(n.named(i.key));throw createUnhandleNodeError(t)}case 5:{const i=e;if(hasOwn(i,"i")&&isNumber(i.i))return n.interpolate(n.list(i.i));if(hasOwn(i,"index")&&isNumber(i.index))return n.interpolate(n.list(i.index));throw createUnhandleNodeError(t)}case 6:{const i=e,r=resolveLinkedModifier(i),s=resolveLinkedKey(i);return n.linked(formatMessagePart(n,s),r?formatMessagePart(n,r):void 0,n.type)}case 7:return resolveValue$1(e,t);case 8:return resolveValue$1(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const defaultOnCacheKey=n=>n;let compileCache=create();function baseCompile(n,e={}){let t=!1;const i=e.onError||defaultOnError;return e.onError=r=>{t=!0,i(r)},{...baseCompile$1(n,e),detectError:t}}const compileToFunction=(n,e)=>{if(!isString$1(n))throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);{isBoolean(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||defaultOnCacheKey)(n),r=compileCache[i];if(r)return r;const{code:s,detectError:a}=baseCompile(n,e),o=new Function(`return ${s}`)();return a?o:compileCache[i]=o}};function compile(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&isString$1(n)){isBoolean(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||defaultOnCacheKey)(n),r=compileCache[i];if(r)return r;const{ast:s,detectError:a}=baseCompile(n,{...e,location:!1,jit:!0}),o=format(s);return a?o:compileCache[i]=o}else{const t=n.cacheKey;if(t){const i=compileCache[t];
3201return i||(compileCache[t]=format(n))}else return format(n)}}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=n=>isFunction(n);function translate(n,...e){const{fallbackFormat:t,postTranslation:i,unresolving:r,messageCompiler:s,fallbackLocale:a,messages:o}=n,[l,c]=parseTranslateArgs(...e),u=isBoolean(c.missingWarn)?c.missingWarn:n.missingWarn,d=isBoolean(c.fallbackWarn)?c.fallbackWarn:n.fallbackWarn,f=isBoolean(c.escapeParameter)?c.escapeParameter:n.escapeParameter,m=!!c.resolvedMessage,v=isString$1(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:t?s?l:()=>l:"",_=t||v!=="",g=getLocale(n,c);f&&escapeParams(c);let[x,S,y]=m?[l,g,o[g]||create()]:resolveMessageFormat(n,l,g,a,d,u),b=x,w=l;if(!m&&!(isString$1(b)||isMessageAST(b)||isMessageFunction(b))&&_&&(b=v,w=b),!m&&(!(isString$1(b)||isMessageAST(b)||isMessageFunction(b))||!isString$1(S)))return r?NOT_REOSLVED:l;let C=!1;const R=()=>{C=!0},M=isMessageFunction(b)?b:compileMessageFormat(n,l,S,b,w,R);if(C)return b;const L=getMessageContextOptions(n,S,y,c),B=createMessageContext(L),Z=evaluateMessage(n,M,B);let W=i?i(Z,l):Z;return f&&isString$1(W)&&(W=sanitizeTranslatedHtml(W)),W}function escapeParams(n){isArray(n.list)?n.list=n.list.map(e=>isString$1(e)?escapeHtml(e):e):isObject$1(n.named)&&Object.keys(n.named).forEach(e=>{isString$1(n.named[e])&&(n.named[e]=escapeHtml(n.named[e]))})}function resolveMessageFormat(n,e,t,i,r,s){const{messages:a,onWarn:o,messageResolver:l,localeFallbacker:c}=n,u=c(n,i,t);let d=create(),f,m=null;const v="translate";for(let _=0;_<u.length&&(f=u[_],d=a[f]||create(),(m=l(d,e))===null&&(m=d[e]),!(isString$1(m)||isMessageAST(m)||isMessageFunction(m)));_++)if(!isImplicitFallback(f,u)){const g=handleMissing(n,e,f,s,v);g!==e&&(m=g)}return[m,f,d]}function compileMessageFormat(n,e,t,i,r,s){const{messageCompiler:a,warnHtmlMessage:o}=n;if(isMessageFunction(i)){const c=i;return c.locale=c.locale||t,c.key=c.key||e,c}if(a==null){const c=()=>i;return c.locale=t,c.key=e,c}const l=a(i,getCompileContext(n,t,r,i,o,s));return l.locale=t,l.key=e,l.source=i,l}function evaluateMessage(n,e,t){return e(t)}function parseTranslateArgs(...n){const[e,t,i]=n,r=create();if(!isString$1(e)&&!isNumber(e)&&!isMessageFunction(e)&&!isMessageAST(e))throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(e)?String(e):(isMessageFunction(e),e);return isNumber(t)?r.plural=t:isString$1(t)?r.default=t:isPlainObject(t)&&!isEmptyObject(t)?r.named=t:isArray(t)&&(r.list=t),isNumber(i)?r.plural=i:isString$1(i)?r.default=i:isPlainObject(i)&&assign$1(r,i),[s,r]}function getCompileContext(n,e,t,i,r,s){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw s&&s(a),a},onCacheKey:a=>generateFormatCacheKey(e,t,a)}}function getMessageContextOptions(n,e,t,i){const{modifiers:r,pluralRules:s,messageResolver:a,fallbackLocale:o,fallbackWarn:l,missingWarn:c,fallbackContext:u}=n,f={locale:e,modifiers:r,pluralRules:s,messages:m=>{let v=a(t,m);if(v==null&&u){const[,,_]=resolveMessageFormat(u,m,e,o,l,c);v=a(_,m)}if(isString$1(v)||isMessageAST(v)){let _=!1;const x=compileMessageFormat(n,m,e,v,m,()=>{_=!0});return _?NOOP_MESSAGE_FUNCTION:x}else return isMessageFunction(v)?v:NOOP_MESSAGE_FUNCTION}};return n.processor&&(f.processor=n.processor),i.list&&(f.list=i.list),i.named&&(f.named=i.named),isNumber(i.plural)&&(f.pluralIndex=i.plural),f}function datetime(n,...e){const{datetimeFormats:t,unresolving:i,fallbackLocale:r,onWarn:s,localeFallbacker:a}=n,{__datetimeFormatters:o}=n,[l,c,u,d]=parseDateTimeArgs(...e),f=isBoolean(u.missingWarn)?u.missingWarn:n.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const m=!!u.part,v=getLocale(n,u),_=a(n,r,v);if(!isString$1(l)||l==="")return new Intl.DateTimeFormat(v,d).format(c);let g={},x,S=null;const y="datetime format";for(let C=0;C<_.length&&(x=_[C],g=t[x]||{},S=g[l],!isPlainObject(S));C++)handleMissing(n,l,x,f,y);if(!isPlainObject(S)||!isString$1(x))return i?NOT_REOSLVED:l;let b=`${x}__${l}`;isEmptyObject(d)||(b=`${b}__${JSON.stringify(d)}`);let w=o.get(b);return w||(w=new Intl.DateTimeFormat(x,assign$1({},S,d)),o.set(b,w)),m?w.formatToParts(c):w.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...n){const[e,t,i,r]=n,s=create();let a=create(),o;if(isString$1(e)){const l=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!l)throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const c=l[3]?l[3].trim().startsWith("T")?`${l[1].trim()}${l[3].trim()}`:`${l[1].trim()}T${l[3].trim()}`:l[1].trim();o=new Date(c);try{o.toISOString()}catch{throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(e)){if(isNaN(e.getTime()))throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT);o=e}else if(isNumber(e))o=e;else throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);return isString$1(t)?s.key=t:isPlainObject(t)&&Object.keys(t).forEach(l=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(l)?a[l]=t[l]:s[l]=t[l]}),isString$1(i)?s.locale=i:isPlainObject(i)&&(a=i),isPlainObject(r)&&(a=r),[s.key||"",o,s,a]}function clearDateTimeFormat(n,e,t){const i=n;for(const r in t){const s=`${e}__${r}`;i.__datetimeFormatters.has(s)&&i.__datetimeFormatters.delete(s)}}function number(n,...e){const{numberFormats:t,unresolving:i,fallbackLocale:r,onWarn:s,localeFallbacker:a}=n,{__numberFormatters:o}=n,[l,c,u,d]=parseNumberArgs(...e),f=isBoolean(u.missingWarn)?u.missingWarn:n.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const m=!!u.part,v=getLocale(n,u),_=a(n,r,v);if(!isString$1(l)||l==="")return new Intl.NumberFormat(v,d).format(c);let g={},x,S=null;const y="number format";for(let C=0;C<_.length&&(x=_[C],g=t[x]||{},S=g[l],!isPlainObject(S));
3201C++)handleMissing(n,l,x,f,y);if(!isPlainObject(S)||!isString$1(x))return i?NOT_REOSLVED:l;let b=`${x}__${l}`;isEmptyObject(d)||(b=`${b}__${JSON.stringify(d)}`);let w=o.get(b);return w||(w=new Intl.NumberFormat(x,assign$1({},S,d)),o.set(b,w)),m?w.formatToParts(c):w.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...n){const[e,t,i,r]=n,s=create();let a=create();if(!isNumber(e))throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);const o=e;return isString$1(t)?s.key=t:isPlainObject(t)&&Object.keys(t).forEach(l=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(l)?a[l]=t[l]:s[l]=t[l]}),isString$1(i)?s.locale=i:isPlainObject(i)&&(a=i),isPlainObject(r)&&(a=r),[s.key||"",o,s,a]}function clearNumberFormat(n,e,t){const i=n;for(const r in t){const s=`${e}__${r}`;i.__numberFormatters.has(s)&&i.__numberFormatters.delete(s)}}initFeatureFlags$1();/*! 3202 * vue-i18n v9.14.5 3203 * (c) 2025 kazuya kawaguchi 3204 * Released under the MIT License. 3205 */const VERSION="9.14.5";function initFeatureFlags(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(getGlobalThis().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const code$1=CoreWarnCodes.__EXTEND_POINT__,inc$1=incrementer(code$1);inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1();const code=CoreErrorCodes.__EXTEND_POINT__,inc=incrementer(code),I18nErrorCodes={UNEXPECTED_RETURN_TYPE:code,INVALID_ARGUMENT:inc(),MUST_BE_CALL_SETUP_TOP:inc(),NOT_INSTALLED:inc(),NOT_AVAILABLE_IN_LEGACY_MODE:inc(),REQUIRED_VALUE:inc(),INVALID_VALUE:inc(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:inc(),NOT_INSTALLED_WITH_PROVIDE:inc(),UNEXPECTED_ERROR:inc(),NOT_COMPATIBLE_LEGACY_VUE_I18N:inc(),BRIDGE_SUPPORT_VUE_2_ONLY:inc(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:inc(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:inc(),__EXTEND_POINT__:inc()};function createI18nError(n,...e){return createCompileError(n,null,void 0)}const TranslateVNodeSymbol=makeSymbol("__translateVNode"),DatetimePartsSymbol=makeSymbol("__datetimeParts"),NumberPartsSymbol=makeSymbol("__numberParts"),SetPluralRulesSymbol=makeSymbol("__setPluralRules"),InejctWithOptionSymbol=makeSymbol("__injectWithOption"),DisposeSymbol=makeSymbol("__dispose");function handleFlatJson(n){if(!isObject$1(n)||isMessageAST(n))return n;for(const e in n)if(hasOwn(n,e))if(!e.includes("."))isObject$1(n[e])&&handleFlatJson(n[e]);else{const t=e.split("."),i=t.length-1;let r=n,s=!1;for(let a=0;a<i;a++){if(t[a]==="__proto__")throw new Error(`unsafe key: ${t[a]}`);if(t[a]in r||(r[t[a]]=create()),!isObject$1(r[t[a]])){s=!0;break}r=r[t[a]]}if(s||(isMessageAST(r)?AST_NODE_PROPS_KEYS.includes(t[i])||delete n[e]:(r[t[i]]=n[e],delete n[e])),!isMessageAST(r)){const a=r[t[i]];isObject$1(a)&&handleFlatJson(a)}}return n}function getLocaleMessages(n,e){const{messages:t,__i18n:i,messageResolver:r,flatJson:s}=e,a=isPlainObject(t)?t:isArray(i)?create():{[n]:create()};if(isArray(i)&&i.forEach(o=>{if("locale"in o&&"resource"in o){const{locale:l,resource:c}=o;l?(a[l]=a[l]||create(),deepCopy(c,a[l])):deepCopy(c,a)}else isString$1(o)&&deepCopy(JSON.parse(o),a)}),r==null&&s)for(const o in a)hasOwn(a,o)&&handleFlatJson(a[o]);return a}function getComponentOptions(n){return n.type}function adjustI18nResources(n,e,t){let i=isObject$1(e.messages)?e.messages:create();"__i18nGlobal"in t&&(i=getLocaleMessages(n.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const r=Object.keys(i);r.length&&r.forEach(s=>{n.mergeLocaleMessage(s,i[s])});{if(isObject$1(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(isObject$1(e.numberFormats)){const s=Object.keys(e.numberFormats);
3205s.length&&s.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function createTextNode(n){return createVNode(Text,null,n,0)}const DEVTOOLS_META="__INTLIFY_META__",NOOP_RETURN_ARRAY=()=>[],NOOP_RETURN_FALSE=()=>!1;let composerID=0;function defineCoreMissingHandler(n){return(e,t,i,r)=>n(t,i,getCurrentInstance()||void 0,r)}const getMetaInfo=()=>{const n=getCurrentInstance();let e=null;return n&&(e=getComponentOptions(n)[DEVTOOLS_META])?{[DEVTOOLS_META]:e}:null};function createComposer(n={},e){const{__root:t,__injectWithOption:i}=n,r=t===void 0,s=n.flatJson,a=inBrowser?ref:shallowRef,o=!!n.translateExistCompatible;let l=isBoolean(n.inheritLocale)?n.inheritLocale:!0;const c=a(t&&l?t.locale.value:isString$1(n.locale)?n.locale:DEFAULT_LOCALE),u=a(t&&l?t.fallbackLocale.value:isString$1(n.fallbackLocale)||isArray(n.fallbackLocale)||isPlainObject(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:c.value),d=a(getLocaleMessages(c.value,n)),f=a(isPlainObject(n.datetimeFormats)?n.datetimeFormats:{[c.value]:{}}),m=a(isPlainObject(n.numberFormats)?n.numberFormats:{[c.value]:{}});let v=t?t.missingWarn:isBoolean(n.missingWarn)||isRegExp(n.missingWarn)?n.missingWarn:!0,_=t?t.fallbackWarn:isBoolean(n.fallbackWarn)||isRegExp(n.fallbackWarn)?n.fallbackWarn:!0,g=t?t.fallbackRoot:isBoolean(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,S=isFunction(n.missing)?n.missing:null,y=isFunction(n.missing)?defineCoreMissingHandler(n.missing):null,b=isFunction(n.postTranslation)?n.postTranslation:null,w=t?t.warnHtmlMessage:isBoolean(n.warnHtmlMessage)?n.warnHtmlMessage:!0,C=!!n.escapeParameter;const R=t?t.modifiers:isPlainObject(n.modifiers)?n.modifiers:{};let M=n.pluralRules||t&&t.pluralRules,L;L=(()=>{r&&setFallbackContext(null);const V={version:VERSION,locale:c.value,fallbackLocale:u.value,messages:d.value,modifiers:R,pluralRules:M,missing:y===null?void 0:y,missingWarn:v,fallbackWarn:_,fallbackFormat:x,unresolving:!0,postTranslation:b===null?void 0:b,warnHtmlMessage:w,escapeParameter:C,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};V.datetimeFormats=f.value,V.numberFormats=m.value,V.__datetimeFormatters=isPlainObject(L)?L.__datetimeFormatters:void 0,V.__numberFormatters=isPlainObject(L)?L.__numberFormatters:void 0;const $=createCoreContext(V);return r&&setFallbackContext($),$})(),updateFallbackLocale(L,c.value,u.value);function Z(){return[c.value,u.value,d.value,f.value,m.value]}const W=computed({get:()=>c.value,set:V=>{c.value=V,L.locale=c.value}}),X=computed({get:()=>u.value,set:V=>{u.value=V,L.fallbackLocale=u.value,updateFallbackLocale(L,c.value,V)}}),G=computed(()=>d.value),le=computed(()=>f.value),he=computed(()=>m.value);function ue(){return isFunction(b)?b:null}function ie(V){b=V,L.postTranslation=V}function ve(){return S}function _e(V){V!==null&&(y=defineCoreMissingHandler(V)),S=V,L.missing=y}const Q=(V,$,be,ge,oe,Ie)=>{Z();let Ne;try{r||(L.fallbackContext=t?getFallbackContext():void 0),Ne=V(L)}finally{r||(L.fallbackContext=void 0)}if(be!=="translate exists"&&isNumber(Ne)&&Ne===NOT_REOSLVED||be==="translate exists"&&!Ne){const[Fe,Re]=$();return t&&g?ge(t):oe(Fe)}else{if(Ie(Ne))return Ne;throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE)}};function ne(...V){return Q($=>Reflect.apply(translate,null,[$,...V]),()=>parseTranslateArgs(...V),"translate",$=>Reflect.apply($.t,$,[...V]),$=>$,$=>isString$1($))}function ye(...V){const[$,be,ge]=V;if(ge&&!isObject$1(ge))throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);return ne($,be,assign$1({resolvedMessage:!0},ge||{}))}function Me(...V){return Q($=>Reflect.apply(datetime,null,[$,...V]),()=>parseDateTimeArgs(...V),"datetime format",$=>Reflect.apply($.d,$,[...V]),()=>MISSING_RESOLVE_VALUE,$=>isString$1($))}function Te(...V){return Q($=>Reflect.apply(number,null,[$,...V]),()=>parseNumberArgs(...V),"number format",$=>Reflect.apply($.n,$,[...V]),()=>MISSING_RESOLVE_VALUE,$=>isString$1($))}function ae(V){return V.map($=>isString$1($)||isNumber($)||isBoolean($)?createTextNode(String($)):$)}const Ee={normalize:ae,interpolate:V=>V,type:"vnode"};function Ce(...V){return Q($=>{let be;const ge=$;try{ge.processor=Ee,be=Reflect.apply(translate,null,[ge,...V])}finally{ge.processor=null}return be},()=>parseTranslateArgs(...V),"translate",$=>$[TranslateVNodeSymbol](...V),$=>[createTextNode($)],$=>isArray($))}function we(...V){return Q($=>Reflect.apply(number,null,[$,...V]),()=>parseNumberArgs(...V),"number format",$=>$[NumberPartsSymbol](...V),NOOP_RETURN_ARRAY,$=>isString$1($)||isArray($))}function O(...V){return Q($=>Reflect.apply(datetime,null,[$,...V]),()=>parseDateTimeArgs(...V),"datetime format",$=>$[DatetimePartsSymbol](...V),NOOP_RETURN_ARRAY,$=>isString$1($)||isArray($))}function D(V){M=V,L.pluralRules=M}function k(V,$){return Q(()=>
3205{if(!V)return!1;const be=isString$1($)?$:c.value,ge=Y(be),oe=L.messageResolver(ge,V);return o?oe!=null:isMessageAST(oe)||isMessageFunction(oe)||isString$1(oe)},()=>[V],"translate exists",be=>Reflect.apply(be.te,be,[V,$]),NOOP_RETURN_FALSE,be=>isBoolean(be))}function H(V){let $=null;const be=fallbackWithLocaleChain(L,u.value,c.value);for(let ge=0;ge<be.length;ge++){const oe=d.value[be[ge]]||{},Ie=L.messageResolver(oe,V);if(Ie!=null){$=Ie;break}}return $}function j(V){const $=H(V);return $??(t?t.tm(V)||{}:{})}function Y(V){return d.value[V]||{}}function ce(V,$){if(s){const be={[V]:$};for(const ge in be)hasOwn(be,ge)&&handleFlatJson(be[ge]);$=be[V]}d.value[V]=$,L.messages=d.value}function re(V,$){d.value[V]=d.value[V]||{};const be={[V]:$};if(s)for(const ge in be)hasOwn(be,ge)&&handleFlatJson(be[ge]);$=be[V],deepCopy($,d.value[V]),L.messages=d.value}function se(V){return f.value[V]||{}}function P(V,$){f.value[V]=$,L.datetimeFormats=f.value,clearDateTimeFormat(L,V,$)}function N(V,$){f.value[V]=assign$1(f.value[V]||{},$),L.datetimeFormats=f.value,clearDateTimeFormat(L,V,$)}function T(V){return m.value[V]||{}}function E(V,$){m.value[V]=$,L.numberFormats=m.value,clearNumberFormat(L,V,$)}function z(V,$){m.value[V]=assign$1(m.value[V]||{},$),L.numberFormats=m.value,clearNumberFormat(L,V,$)}composerID++,t&&inBrowser&&(watch(t.locale,V=>{l&&(c.value=V,L.locale=V,updateFallbackLocale(L,c.value,u.value))}),watch(t.fallbackLocale,V=>{l&&(u.value=V,L.fallbackLocale=V,updateFallbackLocale(L,c.value,u.value))}));const K={id:composerID,locale:W,fallbackLocale:X,get inheritLocale(){return l},set inheritLocale(V){l=V,V&&t&&(c.value=t.locale.value,u.value=t.fallbackLocale.value,updateFallbackLocale(L,c.value,u.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:G,get modifiers(){return R},get pluralRules(){return M||{}},get isGlobal(){return r},get missingWarn(){return v},set missingWarn(V){v=V,L.missingWarn=v},get fallbackWarn(){return _},set fallbackWarn(V){_=V,L.fallbackWarn=_},get fallbackRoot(){return g},set fallbackRoot(V){g=V},get fallbackFormat(){return x},set fallbackFormat(V){x=V,L.fallbackFormat=x},get warnHtmlMessage(){return w},set warnHtmlMessage(V){w=V,L.warnHtmlMessage=V},get escapeParameter(){return C},set escapeParameter(V){C=V,L.escapeParameter=V},t:ne,getLocaleMessage:Y,setLocaleMessage:ce,mergeLocaleMessage:re,getPostTranslationHandler:ue,setPostTranslationHandler:ie,getMissingHandler:ve,setMissingHandler:_e,[SetPluralRulesSymbol]:D};return K.datetimeFormats=le,K.numberFormats=he,K.rt=ye,K.te=k,K.tm=j,K.d=Me,K.n=Te,K.getDateTimeFormat=se,K.setDateTimeFormat=P,K.mergeDateTimeFormat=N,K.getNumberFormat=T,K.setNumberFormat=E,K.mergeNumberFormat=z,K[InejctWithOptionSymbol]=i,K[TranslateVNodeSymbol]=Ce,K[DatetimePartsSymbol]=O,K[NumberPartsSymbol]=we,K}const baseFormatProps={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function getInterpolateArg({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((i,r)=>[...i,...r.type===Fragment?r.children:[r]],[]):e.reduce((t,i)=>{const r=n[i];return r&&(t[i]=r()),t},create())}function getFragmentableTag(n){return Fragment}const TranslationImpl=defineComponent({name:"i18n-t",props:assign$1({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>isNumber(n)||!isNaN(n)}},baseFormatProps),setup(n,e){const{slots:t,attrs:i}=e,r=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(d=>d!=="_"),a=create();n.locale&&(a.locale=n.locale),n.plural!==void 0&&(a.plural=isString$1(n.plural)?+n.plural:n.plural);const o=getInterpolateArg(e,s),l=r[TranslateVNodeSymbol](n.keypath,o,a),c=assign$1(create(),i),u=isString$1(n.tag)||isObject$1(n.tag)?n.tag:getFragmentableTag();return h(u,c,l)}}}),Translation=TranslationImpl;function isVNode(n){return isArray(n)&&!isString$1(n[0])}function renderFormatter(n,e,t,i){const{slots:r,attrs:s}=e;return()=>{const a={part:!0};let o=create();n.locale&&(a.locale=n.locale),isString$1(n.format)?a.key=n.format:isObject$1(n.format)&&(isString$1(n.format.key)&&(a.key=n.format.key),o=Object.keys(n.format).reduce((f,m)=>t.includes(m)?assign$1(create(),f,{[m]:n.format[m]}
3205):f,create()));const l=i(n.value,a,o);let c=[a.key];isArray(l)?c=l.map((f,m)=>{const v=r[f.type],_=v?v({[f.type]:f.value,index:m,parts:l}):[f.value];return isVNode(_)&&(_[0].key=`${f.type}-${m}`),_}):isString$1(l)&&(c=[l]);const u=assign$1(create(),s),d=isString$1(n.tag)||isObject$1(n.tag)?n.tag:getFragmentableTag();return h(d,u,c)}}const NumberFormatImpl=defineComponent({name:"i18n-n",props:assign$1({value:{type:Number,required:!0},format:{type:[String,Object]}},baseFormatProps),setup(n,e){const t=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return renderFormatter(n,e,NUMBER_FORMAT_OPTIONS_KEYS,(...i)=>t[NumberPartsSymbol](...i))}}),NumberFormat=NumberFormatImpl,DatetimeFormatImpl=defineComponent({name:"i18n-d",props:assign$1({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},baseFormatProps),setup(n,e){const t=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return renderFormatter(n,e,DATETIME_FORMAT_OPTIONS_KEYS,(...i)=>t[DatetimePartsSymbol](...i))}}),DatetimeFormat=DatetimeFormatImpl;function getComposer$2(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const i=t.__getInstance(e);return i!=null?i.__composer:n.global.__composer}}function vTDirective(n){const e=a=>{const{instance:o,modifiers:l,value:c}=a;if(!o||!o.$)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);const u=getComposer$2(n,o.$),d=parseValue(c);return[Reflect.apply(u.t,u,[...makeParams(d)]),u]};return{created:(a,o)=>{const[l,c]=e(o);inBrowser&&n.global===c&&(a.__i18nWatcher=watch(c.locale,()=>{o.instance&&o.instance.$forceUpdate()})),a.__composer=c,a.textContent=l},unmounted:a=>{inBrowser&&a.__i18nWatcher&&(a.__i18nWatcher(),a.__i18nWatcher=void 0,delete a.__i18nWatcher),a.__composer&&(a.__composer=void 0,delete a.__composer)},beforeUpdate:(a,{value:o})=>{if(a.__composer){const l=a.__composer,c=parseValue(o);a.textContent=Reflect.apply(l.t,l,[...makeParams(c)])}},getSSRProps:a=>{const[o]=e(a);return{textContent:o}}}}function parseValue(n){if(isString$1(n))return{path:n};if(isPlainObject(n)){if(!("path"in n))throw createI18nError(I18nErrorCodes.REQUIRED_VALUE,"path");return n}else throw createI18nError(I18nErrorCodes.INVALID_VALUE)}function makeParams(n){const{path:e,locale:t,args:i,choice:r,plural:s}=n,a={},o=i||{};return isString$1(t)&&(a.locale=t),isNumber(r)&&(a.plural=r),isNumber(s)&&(a.plural=s),[e,o,a]}function apply(n,e,...t){const i=isPlainObject(t[0])?t[0]:{},r=!!i.useI18nComponentName;(isBoolean(i.globalInstall)?i.globalInstall:!0)&&([r?"i18n":Translation.name,"I18nT"].forEach(a=>n.component(a,Translation)),[NumberFormat.name,"I18nN"].forEach(a=>n.component(a,NumberFormat)),[DatetimeFormat.name,"I18nD"].forEach(a=>n.component(a,DatetimeFormat))),n.directive("t",vTDirective(e))}const I18nInjectionKey=makeSymbol("global-vue-i18n");function createI18n(n={},e){const t=isBoolean(n.globalInjection)?n.globalInjection:!0,i=!0,r=new Map,[s,a]=createGlobal(n),o=makeSymbol("");function l(d){return r.get(d)||null}function c(d,f){r.set(d,f)}function u(d){r.delete(d)}{const d={get mode(){return"composition"},get allowComposition(){return i},async install(f,...m){if(f.__VUE_I18N_SYMBOL__=o,f.provide(f.__VUE_I18N_SYMBOL__,d),isPlainObject(m[0])){const g=m[0];d.__composerExtend=g.__composerExtend,d.__vueI18nExtend=g.__vueI18nExtend}let v=null;t&&(v=injectGlobalFields(f,d.global)),apply(f,d,...m);const _=f.unmount;f.unmount=()=>{v&&v(),d.dispose(),_()}},get global(){return a},dispose(){s.stop()},__instances:r,__getInstance:l,__setInstance:c,__deleteInstance:u};return d}}function useI18n(n={}){const e=getCurrentInstance();if(e==null)throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw createI18nError(I18nErrorCodes.NOT_INSTALLED);const t=getI18nInstance(e),i=getGlobalComposer(t),r=getComponentOptions(e),s=getScope(n,r);if(s==="global")return adjustI18nResources(i,n,r),i;if(s==="parent"){let l=getComposer(t,e,n.__useComponent);return l==null&&(l=i),l}const a=t;let o=a.__getInstance(e);if(o==null){const l=assign$1({},n);"__i18n"in r&&(l.__i18n=r.__i18n),i&&(l.__root=i),o=createComposer(l),a.__composerExtend&&(o[DisposeSymbol]=a.__composerExtend(o)),setupLifeCycle(a,e,o),a.__setInstance(e,o)}return o}function createGlobal(n,e,t){const i=effectScope();{const r=i.run(()=>createComposer(n));if(r==null)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);return[i,r]}}function getI18nInstance(n){{const e=inject(n.isCE?I18nInjectionKey:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw createI18nError(n.isCE?I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE:I18nErrorCodes.UNEXPECTED_ERROR);return e}}function getScope(n,e){return isEmptyObject(n)?"__i18n"in e?"local":"global":n.useScope?n.use
3205Scope:"local"}function getGlobalComposer(n){return n.mode==="composition"?n.global:n.global.__composer}function getComposer(n,e,t=!1){let i=null;const r=e.root;let s=getParentComponentInstance(e,t);for(;s!=null;){const a=n;if(n.mode==="composition"&&(i=a.__getInstance(s)),i!=null||r===s)break;s=s.parent}return i}function getParentComponentInstance(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function setupLifeCycle(n,e,t){onMounted(()=>{},e),onUnmounted(()=>{const i=t;n.__deleteInstance(e);const r=i[DisposeSymbol];r&&(r(),delete i[DisposeSymbol])},e)}const globalExportProps=["locale","fallbackLocale","availableLocales"],globalExportMethods=["t","rt","d","n","tm","te"];function injectGlobalFields(n,e){const t=Object.create(null);return globalExportProps.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);const a=isRef(s.value)?{get(){return s.value.value},set(o){s.value.value=o}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,r,a)}),n.config.globalProperties.$i18n=t,globalExportMethods.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s||!s.value)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,s)}),()=>{delete n.config.globalProperties.$i18n,globalExportMethods.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}initFeatureFlags();__INTLIFY_JIT_COMPILATION__?registerMessageCompiler(compile):registerMessageCompiler(compileToFunction);registerMessageResolver(resolveValue);registerLocaleFallbacker(fallbackWithLocaleChain);function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hoconParser$1={exports:{}},hoconParser=hoconParser$1.exports,hasRequiredHoconParser;function requireHoconParser(){return hasRequiredHoconParser||(hasRequiredHoconParser=1,function(module){(function(n,e){module.exports?module.exports=e():n.parseHocon=e()})(hoconParser,function(){function parseHocon(text){var index=0,result=readHocon(text);return handleSubtitutions(result);function readHocon(n){for(var e=!1,t="",i=!1,r=!1,s=!1,a=!1,o=!1,l=!1,c=!1,u=!1,d="",f="",m={};index<n.length;){var v=n[index];if(index++,l&&!u){(v==="\r"||v===` 3206`)&&(l=!1);continue}if(!i&&v==='"'&&index+1<n.length&&n[index]==='"'&&n[index+1]==='"'){if(u){g(),u=!1,e=!1,a=!1,index+=2;continue}u=!0,e=!0,a=!0,index+=2;continue}if(!i&&!u&&(v==="'"||v==='"')){if(e&&t===v){a?g():a=!0,e=!1;continue}e=!0,t=v;continue}if(u&&_(v)){f+=v;continue}if(e&&v==="\\"){i=!0;continue}if(i=!1,!e)switch(v){case" ":{if(d!==""&&!a){d+=v;continue}if(f==="")continue;if(s&&a){f+=v;continue}}case" ":case"\r":case` 3207`:{if(s&&a){if(f==="")continue;g();continue}if(!d)continue;if(!a){a=!0;continue}if(a&&f){g();continue}continue}case"{":{if(r||s||d){index--,d=d.trim(),f=readHocon(n),g();continue}r=!0;continue}case"}":{if(!r)throw"What";if(f)g();else if(d)return d;return m}case":":case"=":{if(o)throw"Already met seperator";a=!0,o=!0,d=d.trim();continue}case",":{a&&f&&g();continue}case"[":{if(r||s||d){index--,f=readHocon(n),g();continue}a=!0,s=!0,m=[];continue}case"]":{if(!s)throw"not in an array";return f&&(f=f.trim(),g()),m}case"$":{if(!f){f="${"+readHocon(n)+"}",g();continue}break}case"#":{l=!0;continue}case"/":{if(c){l=!0,c=!1;continue}c=!0;continue}}a?f+=v:d+=v}if(r)throw"Expected closing curly bracket";if(s)throw"Expected closing square bracket";return a&&g(),m;function _(x){return['"',"\\"].indexOf(x)!==-1}function g(y,b){var y=y||d,b=b||m,w=y.indexOf(".");if(!s&&w>0){var C=y.substring(0,w);b[C]=b[C]||{},g(y.substring(w+1),b[C]);return}!e&&typeof f=="string"&&(/^\d+$/.test(f)?f=parseInt(f):/^\d+\.\d+$/.test(f)?f=parseFloat(f):f==="true"?f=!0:f==="false"?f=!1:f==="null"&&(f=null)),s?b.push(f):(typeof b[y]=="object"&&typeof f=="object"?extend(b[y],f):b[y]=f,a=!1),o=!1,d="",f=""}}function handleSubtitutions(mainObj,intermidiateObj,loops){if(loops=loops||0,loops>8)return null;if(intermidiateObj=typeof intermidiateObj>"u"?mainObj:intermidiateObj,intermidiateObj==null)return intermidiateObj;
3207if(Array.isArray(intermidiateObj))intermidiateObj.forEach(function(n,e){intermidiateObj[e]=handleSubtitutions(mainObj,n)});else if(typeof intermidiateObj=="string"){var match=/^\$\{(.+?)\}$/.exec(intermidiateObj);if(match&&match.length==2){var val=eval("mainObj."+match[1]);return typeof val>"u"?null:handleSubtitutions(mainObj,val,loops+1)}}else typeof intermidiateObj=="object"&&Object.keys(intermidiateObj).forEach(function(n,e){intermidiateObj[n]=handleSubtitutions(mainObj,intermidiateObj[n])});return intermidiateObj}function extend(){for(var n=1;n<arguments.length;n++)for(var e in arguments[n])arguments[n].hasOwnProperty(e)&&(typeof arguments[0][e]=="object"&&typeof arguments[n][e]=="object"?extend(arguments[0][e],arguments[n][e]):arguments[0][e]=arguments[n][e]);return arguments[0]}}return parseHocon})}(hoconParser$1)),hoconParser$1.exports}var hoconParserExports=requireHoconParser();const parseHocon=getDefaultExportFromCjs(hoconParserExports),setLocalStorage=(n,e)=>{localStorage.setItem(n,JSON.stringify(e))},getLocalStorage=n=>{const e=localStorage.getItem(n);if(e!=null)try{return JSON.parse(e)}catch{return e}},round=(n,e)=>{let t=Math.pow(10,e);return Math.round(n*t)/t},fetchHocon=async n=>fetch(n).then(e=>e.text()).then(e=>parseHocon(e)),i18nModule=createI18n({locale:"none",fallbackLocale:"en",warnHtmlMessage:!1,messages:{}}),i18n=i18nModule.global;async function setLanguage(n){return loadLanguage(n),i18n.locale.value=n,document.querySelector("html").setAttribute("lang",n),nextTick()}async function loadLanguage(n){try{if(!i18n.availableLocales.includes(n)){let e=await fetchHocon(`./lang/${n}.conf`);i18n.setLocaleMessage(n,e)}}catch(e){console.error(`Failed to load language '${n}'!`,e)}}async function loadLanguageSettings(){let n=await fetchHocon("./lang/settings.conf"),e=null;if(n.useBrowserLanguage){const t=n.languages.map(i=>i.locale);for(let i of navigator.languages){if(e=t.find(s=>s===i),e)break;let r=i.split("-")[0];if(e=t.find(s=>s.startsWith(r)),e)break}}e||(e=n.default),await loadLanguage("en"),await loadLanguage(n.default),i18nModule.global.fallbackLocale=[n.default,"en"],i18n.languages=n.languages,await setLanguage(e)}const themes=[{get name(){return i18n.t("theme.default")},value:null},{get name(){return i18n.t("theme.dark")},value:"dark"},{get name(){return i18n.t("theme.light")},value:"light"},{get name(){return i18n.t("theme.contrast")},value:"contrast"}],qualityStages=[{get name(){return i18n.t("resolution.high")},value:2},{get name(){return i18n.t("resolution.normal")},value:1},{get name(){return i18n.t("resolution.low")},value:.5}],_sfc_main$a={name:"SettingsMenu",components:{SwitchButton,Slider,SimpleButton,Group},data(){return{appState:this.$bluemap.appState,mapViewer:this.$bluemap.mapViewer.data,settings:{hiresSliderMax:500,hiresSliderMin:50,lowresSliderMax:1e4,lowresSliderMin:500,...this.$bluemap.settings},languages:i18n.languages,qualityStages,themes}},computed:{showViewControls(){return this.mapViewer.map?this.mapViewer.map.views.length>1:!1}},methods:{switchChunkBorders(){this.$bluemap.setChunkBorders(!this.mapViewer.uniforms.chunkBorders.value)},switchDebug(){this.$bluemap.setDebug(!this.appState.debug)},renderDistanceFormatter(n){let e=parseFloat(n);return e===0?this.$t("renderDistance.off"):e.toFixed(0)},async changeLanguage(n){await setLanguage(n),this.$bluemap.updatePageAddress(),this.$bluemap.saveUserSettings()}}};function _sfc_render$a(n,e,t,i,r,s){const a=resolveComponent("SimpleButton"),o=resolveComponent("Group"),l=resolveComponent("Slider"),c=resolveComponent("SwitchButton");return openBlock(),createElementBlock("div",null,[s.showViewControls?(openBlock(),createBlock(o,{key:0,title:n.$t("controls.title")},{default:withCtx(()=>[r.mapViewer.map.perspectiveView?(openBlock(),createBlock(a,{key:0,active:r.appState.controls.state==="perspective",onAction:e[0]||(e[0]=u=>n.$bluemap.setPerspectiveView(500,r.appState.controls.state==="free"?100:0))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.perspective.button")),1)]),_:1},8,["active"])):createCommentVNode("",!0),r.mapViewer.map.flatView?(openBlock(),createBlock(a,{key:1,active:r.appState.controls.state==="flat",onAction:e[1]||(e[1]=u=>n.$bluemap.setFlatView(500,r.appState.controls.state==="free"?100:0))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.flatView.button")),1
3207)]),_:1},8,["active"])):createCommentVNode("",!0),r.mapViewer.map.freeFlightView?(openBlock(),createBlock(a,{key:2,active:r.appState.controls.state==="free",onAction:e[2]||(e[2]=u=>n.$bluemap.setFreeFlight(500))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.freeFlight.button")),1)]),_:1},8,["active"])):createCommentVNode("",!0)]),_:1},8,["title"])):createCommentVNode("",!0),createVNode(o,{title:n.$t("lighting.title")},{default:withCtx(()=>[createVNode(l,{value:r.mapViewer.uniforms.sunlightStrength.value,min:0,max:1,step:.01,onUpdate:e[3]||(e[3]=u=>{r.mapViewer.uniforms.sunlightStrength.value=u,n.$bluemap.mapViewer.redraw()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("lighting.sunlight")),1)]),_:1},8,["value","step"]),createVNode(l,{value:r.mapViewer.uniforms.ambientLight.value,min:0,max:1,step:.01,onUpdate:e[4]||(e[4]=u=>{r.mapViewer.uniforms.ambientLight.value=u,n.$bluemap.mapViewer.redraw()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("lighting.ambientLight")),1)]),_:1},8,["value","step"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("resolution.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.qualityStages,u=>(openBlock(),createBlock(a,{key:u.name,active:r.mapViewer.superSampling===u.value,onAction:d=>{n.$bluemap.mapViewer.superSampling=u.value,n.$bluemap.saveUserSettings(),n.$bluemap.mapViewer.redraw()}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"]),createVNode(o,{title:n.$t("renderDistance.title")},{default:withCtx(()=>[createVNode(l,{value:r.mapViewer.loadedHiresViewDistance,min:r.settings.hiresSliderMin,max:r.settings.hiresSliderMax,step:10,formatter:s.renderDistanceFormatter,onUpdate:e[5]||(e[5]=u=>{r.mapViewer.loadedHiresViewDistance=u,n.$bluemap.mapViewer.updateLoadedMapArea()}),onLazy:e[6]||(e[6]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.hiresLayer")),1)]),_:1},8,["value","min","max","formatter"]),createVNode(l,{value:r.mapViewer.loadedLowresViewDistance,min:r.settings.lowresSliderMin,max:r.settings.lowresSliderMax,step:100,onUpdate:e[7]||(e[7]=u=>{r.mapViewer.loadedLowresViewDistance=u,n.$bluemap.mapViewer.updateLoadedMapArea()}),onLazy:e[8]||(e[8]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.lowersLayer")),1)]),_:1},8,["value","min","max"]),createVNode(c,{on:!r.appState.controls.pauseTileLoading,onAction:e[9]||(e[9]=u=>{r.appState.controls.pauseTileLoading=!r.appState.controls.pauseTileLoading,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.loadHiresWhileMoving")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("mapControls.title")},{default:withCtx(()=>[createVNode(c,{on:r.appState.controls.showZoomButtons,onAction:e[10]||(e[10]=u=>{r.appState.controls.showZoomButtons=!r.appState.controls.showZoomButtons,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("mapControls.showZoomButtons")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("freeFlightControls.title")},{default:withCtx(()=>[createVNode(l,{value:r.appState.controls.mouseSensitivity,min:.1,max:5,step:.05,onUpdate:e[11]||(e[11]=u=>{r.appState.controls.mouseSensitivity=u,n.$bluemap.updateControlsSettings()}),onLazy:e[12]||(e[12]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("freeFlightControls.mouseSensitivity")),1)]),_:1},8,["value","min","step"]),createVNode(c,{on:r.appState.controls.invertMouse,onAction:e[13]||(e[13]=u=>{r.appState.controls.invertMouse=!r.appState.controls.invertMouse,n.$bluemap.updateControlsSettings(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("freeFlightControls.invertMouseY")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("theme.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.themes,u=>(openBlock(),createBlock(a,{key:u.name,active:r.appState.theme===u.value,onAction:d=>{n.$bluemap.setTheme(u.value),n.$bluemap.saveUserSettings()}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"]),createVNode(o,{title:n.$t("screenshot.title")},{default:withCtx(()=>[createVNode(c,{on:r.appState.screenshot.clipboard,onAction:e[14]||(e[14]=u=>{r.appState.screenshot.clipboard=!r.appState.screenshot.clipboard,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("screenshot.clipboard")),1)]),_:1},8,["on"])]),_:1},8,["title"]),r.languages.length>1?(openBlock(),createBlock(o,{key:1,title:n.$t("language.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.languages,u=>(openBlock(),createBlock(a,{key:u.locale,active:u.locale===n.$i18n.locale,onAction:d=>{s.changeLanguage(u.locale)}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"])):createCommentVNode("",!0),createVNode(c,{on:r.mapViewer.uniforms.chunkBorders.value,onAction:e[15]||(e[15]=u=>{s.switchChunkBorders(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("chunkBorders.button")),1
3207)]),_:1},8,["on"]),createVNode(c,{on:r.appState.debug,onAction:e[16]||(e[16]=u=>{s.switchDebug(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("debug.button")),1)]),_:1},8,["on"]),createVNode(a,{onAction:e[17]||(e[17]=u=>n.$bluemap.resetSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("resetAllSettings.button")),1)]),_:1})])}const SettingsMenu=_export_sfc(_sfc_main$a,[["render",_sfc_render$a]]);var Nt;let MainMenu$1=(Nt=class{constructor(){this.isOpen=!1,this.pageStack=[]}currentPage(){return this.pageStack.length===0?Nt.NULL_PAGE:this.pageStack[this.pageStack.length-1]}openPage(e="root",t=()=>i18n.t("menu.title"),i={}){this.isOpen||(this.pageStack.splice(0,this.pageStack.length),this.isOpen=!0),typeof t=="function"?this.pageStack.push({id:e,get title(){return t()},...i}):this.pageStack.push({id:e,title:t,...i})}closePage(){this.pageStack.splice(this.pageStack.length-1,1),this.pageStack.length<1&&(this.isOpen=!1)}reOpenPage(){this.pageStack.length===0?this.openPage():this.pageStack[0].id!=="root"?(this.pageStack.splice(0,this.pageStack.length),this.openPage()):this.isOpen=!0}closeAll(){this.isOpen=!1}},me(Nt,"NULL_PAGE",{id:"-",title:"-"}),Nt);const _sfc_main$9={name:"MarkerItem",props:{marker:Object},data(){return{appState:this.$bluemap.appState,controls:this.$bluemap.mapViewer.controlsManager.data,mapId:this.$bluemap.mapViewer.data.map.id}},computed:{markerLabel(){switch(this.marker.type){case"player":return this.marker.name}if(this.marker.label){let n=/^(?:<[^>]*>\s*)*([^<>]*\S[^<>]*)(?:<|$)/gi.exec(this.marker.label);if(n&&n.length>1)return n[1]}return this.marker.id},position(){return n=>Math.floor(n)}},methods:{async click(n){let e=this.$bluemap.mapViewer.controlsManager;if(e.controls&&e.controls.stopFollowingPlayerMarker&&e.controls.stopFollowingPlayerMarker(),this.marker.type==="player"){if(this.marker.foreign){let t=await this.$bluemap.findPlayerMap(this.marker.playerUuid);if(!t)return;await this.$bluemap.switchMap(t.data.id)}n&&e.controls&&e.controls.followPlayerMarker&&this.marker.visible&&e.controls.followPlayerMarker(this.marker)}else if(!this.marker.visible)return;e.position.copy(this.marker.position)},steve(n){n.target.src="assets/steve.png"}}},_hoisted_1$9=["title"],_hoisted_2$7={key:0,class:"icon"},_hoisted_3$6=["src"],_hoisted_4$4={class:"info"},_hoisted_5$2={class:"label"},_hoisted_6$2={class:"stats"},_hoisted_7$2={key:0},_hoisted_8$2=["title"],_hoisted_9$1=createStaticVNode('<svg viewBox="0 0 30 30"><circle fill="none" stroke-width="3" stroke-miterlimit="10" cx="15" cy="15" r="10.375"></circle><line fill="none" stroke-width="3" stroke-miterlimit="10" x1="3.25" y1="15" x2="1.063" y2="15"></line><line fill="none" stroke-width="3" stroke-miterlimit="10" x1="15" y1="26.75" x2="15" y2="28.938"></line><line fill="none" stroke-width="3" stroke-miterlimit="10" x1="26.75" y1="15" x2="28.938" y2="15"></line><line fill="none" stroke-width="3" stroke-miterlimit="10" x1="15" y1="3.25" x2="15" y2="1.063"></line><circle stroke="none" cx="15" cy="15" r="6.042"></circle></svg>',1),_hoisted_10$1=[_hoisted_9$1];function _sfc_render$9(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["marker-item",{"marker-hidden":!t.marker.visible}])},[createBaseVNode("div",{class:"marker-button",title:t.marker.id,onClick:e[1]||(e[1]=a=>s.click(!1))},[t.marker.type==="player"?(openBlock(),createElementBlock("div",_hoisted_2$7,[createBaseVNode("img",{src:"maps/"+r.mapId+"/assets/playerheads/"+t.marker.playerUuid+".png",alt:"playerhead",onError:e[0]||(e[0]=(...a)=>s.steve&&s.steve(...a))},null,40,_hoisted_3$6)])):createCommentVNode("",!0),createBaseVNode("div",_hoisted_4$4,[createBaseVNode("div",_hoisted_5$2,toDisplayString$1(s.markerLabel),1),createBaseVNode("div",_hoisted_6$2,[r.appState.debug?(openBlock(),createElementBlock("div",_hoisted_7$2,toDisplayString$1(t.marker.type)+"-marker ",1)):createCommentVNode("",!0),createBaseVNode("div",null," ("+toDisplayString$1(s.position(t.marker.position.x))+" | "+toDisplayString$1(s.position(t.marker.position.y))+" | "+toDisplayString$1(s.position(t.marker.position.z))+") ",1)])])],8,_hoisted_1$9),t.marker.type==="player"?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(["follow-player-button",{active:r.controls.controls.followingPlayer&&r.controls.controls.followingPlayer.id===t.marker.id}]),onClick:e[2]||(e[2]=a=>s.click(!0)),title:n.$t("markers.followPlayerTitle")},_hoisted_10$1,10,_hoisted_8$2)):createCommentVNode("",!0)],2)}const MarkerItem=_export_sfc(_sfc_main$9,[["render",_sfc_render$9]]),_sfc_main$8={name:"TextInput",props:{value:String}},_hoisted_1$8=["value"];function _sfc_render$8(n,e,t,i,r,s){return openBlock(),createElementBlock("input",{class:"text-input",type:"text",value:t.value,onInput:e[0]||(e[0]=a=>n.$emit("input",a)),onKeydown:e[1]||(e[1]=a=>a.stopPropagation())},null,40,_hoisted_1$8)}const TextInput=_export_sfc(_sfc_main$8,[["render",_sfc_render$8]]),_sfc_main$7={name:"MarkerSet",components:{SwitchHandle},props:{markerSet:Object},computed:{filteredMarkerSetCount(){let n=0;for(let e of this.markerSet.markerSets)e.listed&&n++;return n},filteredMarkerCount(){let n=0;for(let e of this.markerSet.markers)e.listed&&n++;return n},label(){return this.markerSet.id==="bm-players"?this.$t("players.title"):this.markerSet.label},active(){for(let n of this.markerSet.markers)if(n.listed)return!0;for(let n of this.markerSet.markerSets)if(n.listed)return!0;return!1}}
3207,methods:{toggle(){this.markerSet.toggleable&&(this.markerSet.visible=!this.markerSet.visible,this.markerSet.saveState())},more(n){this.active&&this.$emit("more",n)}}},_hoisted_1$7=["title"],_hoisted_2$6={class:"marker-set-switch"},_hoisted_3$5={class:"label"},_hoisted_4$3={class:"stats"},_hoisted_5$1={key:0},_hoisted_6$1={key:1},_hoisted_7$1=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0 3208 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0 3209 c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})],-1),_hoisted_8$1=[_hoisted_7$1];function _sfc_render$7(n,e,t,i,r,s){const a=resolveComponent("SwitchHandle");return openBlock(),createElementBlock("div",{class:"marker-set",title:t.markerSet.id},[createBaseVNode("div",{class:"info",onClick:e[0]||(e[0]=(...o)=>s.toggle&&s.toggle(...o))},[createBaseVNode("div",_hoisted_2$6,[createBaseVNode("div",_hoisted_3$5,toDisplayString$1(s.label),1),t.markerSet.toggleable?(openBlock(),createBlock(a,{key:0,on:t.markerSet.visible},null,8,["on"])):createCommentVNode("",!0)]),createBaseVNode("div",_hoisted_4$3,[s.filteredMarkerCount>0?(openBlock(),createElementBlock("div",_hoisted_5$1,toDisplayString$1(s.filteredMarkerCount)+" "+toDisplayString$1(n.$t("markers.marker",s.filteredMarkerCount)),1)):createCommentVNode("",!0),s.filteredMarkerSetCount>0?(openBlock(),createElementBlock("div",_hoisted_6$1,toDisplayString$1(s.filteredMarkerSetCount)+" "+toDisplayString$1(n.$t("markers.markerSet",s.filteredMarkerSetCount)),1)):createCommentVNode("",!0)])]),createBaseVNode("div",{class:normalizeClass(["open-menu-button",{active:s.active}]),onClick:e[1]||(e[1]=o=>s.more(o))},_hoisted_8$1,2)],8,_hoisted_1$7)}const MarkerSet$1=_export_sfc(_sfc_main$7,[["render",_sfc_render$7]]),_sfc_main$6={name:"ChoiceBox",props:{title:{type:String,required:!1,default:""},choices:Array,selection:String}},_hoisted_1$6={class:"choice-box"},_hoisted_2$5={key:0,class:"title"},_hoisted_3$4={class:"choices"},_hoisted_4$2=["onClick"];function _sfc_render$6(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$6,[t.title?(openBlock(),createElementBlock("div",_hoisted_2$5,toDisplayString$1(t.title),1)):createCommentVNode("",!0),createBaseVNode("div",_hoisted_3$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(t.choices,a=>(openBlock(),createElementBlock("div",{class:normalizeClass(["choice",{selected:t.selection===a.id}]),key:a.id,onClick:o=>n.$emit("choice",a)},toDisplayString$1(a.name),11,_hoisted_4$2))),128))])])}const ChoiceBox=_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]),_sfc_main$5={name:"MarkerSetMenu",components:{ChoiceBox,SimpleButton,MarkerSet:MarkerSet$1,TextInput,MarkerItem,Group},props:{menu:MainMenu$1},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data,filter:{search:"",order:"default"}}},computed:{thisMarkerSet(){return this.menu.currentPage().markerSet},filteredMarkers(){return this.thisMarkerSet.markers.filter(n=>n.listed?!this.filter.search||n.id.includesCI(this.filter.search)||n.label&&n.label.includesCI(this.filter.search)?!0:n.type==="player"&&(n.name.includesCI(this.filter.search)||n.playerUuid.includesCI(this.filter.search)):!1).sort((n,e)=>{if(this.filter.order==="label"){let t=(n.type==="player"?n.name:n.label).toLowerCase(),i=(e.type==="player"?e.name:e.label).toLowerCase();return t<i?-1:t>i?1:0}return this.filter.order==="distance"?n.position.distanceToSquared(this.controls.position)-e.position.distanceToSquared(this.controls.position):(n.sorting||0)-(e.sorting||0)})},filteredMarkerSets(){return this.thisMarkerSet.markerSets.filter(n=>n.listed).sort((n,e)=>(n.sorting||0)-(e.sorting||0))}},methods:{openMore(n){this.menu.openPage(this.menu.currentPage().id,this.menu.currentPage().title+" > "+this.labelOf(n),{markerSet:n})},labelOf(n){return n.id==="bm-players"?this.$t("players.title"):n.label}}},_hoisted_1$5={class:"marker-sets"},_hoisted_2$4={key:0},_hoisted_3$3={key:1,class:"markers"};function _sfc_render$5(n,e,t,i,r,s){const a=resolveComponent("MarkerSet"),o=resolveComponent("TextInput"),l=resolveComponent("ChoiceBox"),c=resolveComponent("MarkerItem");return openBlock(),createElementBlock("div",null,[createBaseVNode("div",_hoisted_1$5,[(openBlock(!0),createElementBlock(Fragment,null,renderList(s.filteredMarkerSets,u=>(openBlock(),createBlock(a,{key:u.id,"marker-set":u,onMore:d=>
3209s.openMore(u)},null,8,["marker-set","onMore"]))),128))]),s.filteredMarkerSets.length>0&s.thisMarkerSet.markers.length>0?(openBlock(),createElementBlock("hr",_hoisted_2$4)):createCommentVNode("",!0),s.thisMarkerSet.markers.length>0?(openBlock(),createElementBlock("div",_hoisted_3$3,[createVNode(o,{value:r.filter.search,onInput:e[0]||(e[0]=u=>r.filter.search=u.target.value),placeholder:n.$t("markers.searchPlaceholder")},null,8,["value","placeholder"]),createVNode(l,{title:n.$t("markers.sort.title"),choices:[{id:"default",name:n.$t("markers.sort.by.default")},{id:"label",name:n.$t("markers.sort.by.label")},{id:"distance",name:n.$t("markers.sort.by.distance")}],selection:r.filter.order,onChoice:e[1]||(e[1]=u=>r.filter.order=u.id)},null,8,["title","choices","selection"]),(openBlock(!0),createElementBlock(Fragment,null,renderList(s.filteredMarkers,u=>(openBlock(),createBlock(c,{key:u.id,marker:u},null,8,["marker"]))),128))])):createCommentVNode("",!0)])}const MarkerSetMenu=_export_sfc(_sfc_main$5,[["render",_sfc_render$5]]),_sfc_main$4={name:"MapButton",props:{map:Object},data(){return{mapViewer:this.$bluemap.mapViewer.data,appState:this.$bluemap.appState}},computed:{selectedMapId(){return this.mapViewer.map?this.mapViewer.map.id:null}},methods:{switchMap(n){this.$bluemap.switchMap(n)}}},_hoisted_1$4=["title"],_hoisted_2$3={class:"name"};function _sfc_render$4(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["map-button",{selected:t.map.id===s.selectedMapId}]),onClick:e[0]||(e[0]=a=>s.switchMap(t.map.id)),title:t.map.id},[createBaseVNode("span",{class:"sky",style:normalizeStyle({color:"rgb("+t.map.skyColor.r*255+","+t.map.skyColor.g*255+","+t.map.skyColor.b*255+")"})},"•",4),createBaseVNode("span",_hoisted_2$3,toDisplayString$1(t.map.name),1)],10,_hoisted_1$4)}const MapButton=_export_sfc(_sfc_main$4,[["render",_sfc_render$4]]),_sfc_main$3={name:"MainMenu",components:{MapButton,MarkerSetMenu,SettingsMenu,SimpleButton,SideMenu},props:{menu:MainMenu$1},data(){return{appState:this.$bluemap.appState,markers:this.$bluemap.mapViewer.markers.data}},methods:{goFullscreen(){document.body.requestFullscreen()}}},_hoisted_1$3={key:0},_hoisted_2$2=createBaseVNode("hr",null,null,-1),_hoisted_3$2={key:1},_hoisted_4$1=["innerHTML"];function _sfc_render$3(n,e,t,i,r,s){const a=resolveComponent("SimpleButton"),o=resolveComponent("MapButton"),l=resolveComponent("MarkerSetMenu"),c=resolveComponent("SettingsMenu"),u=resolveComponent("SideMenu");return openBlock(),createBlock(u,{open:t.menu.isOpen,title:t.menu.currentPage().title,back:t.menu.pageStack.length>1,onBack:e[7]||(e[7]=d=>t.menu.closePage()),onClose:e[8]||(e[8]=d=>t.menu.closeAll())},{default:withCtx(()=>[t.menu.currentPage().id==="root"?(openBlock(),createElementBlock("div",_hoisted_1$3,[createVNode(a,{onAction:e[0]||(e[0]=d=>t.menu.openPage("maps",()=>n.$t("maps.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("maps.button")),1)]),_:1}),createVNode(a,{onAction:e[1]||(e[1]=d=>t.menu.openPage("markers",()=>n.$t("markers.title"),{markerSet:r.markers})),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("markers.button")),1)]),_:1}),createVNode(a,{onAction:e[2]||(e[2]=d=>t.menu.openPage("settings",()=>n.$t("settings.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("settings.button")),1)]),_:1}),createVNode(a,{onAction:e[3]||(e[3]=d=>t.menu.openPage("info",()=>n.$t("info.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("info.button")),1)]),_:1}),_hoisted_2$2,createVNode(a,{onAction:s.goFullscreen},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("goFullscreen.button")),1)]),_:1},8,["onAction"]),createVNode(a,{onAction:e[4]||(e[4]=d=>n.$bluemap.resetCamera())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("resetCamera.button")),1)]),_:1}),createVNode(a,{onAction:e[5]||(e[5]=d=>n.$bluemap.takeScreenshot())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("screenshot.button")),1)]),_:1}),createVNode(a,{onAction:e[6]||(e[6]=d=>n.$bluemap.updateMap()),title:n.$t("updateMap.tooltip")},{default:withCtx(()=>
3209[createTextVNode(toDisplayString$1(n.$t("updateMap.button")),1)]),_:1},8,["title"])])):createCommentVNode("",!0),t.menu.currentPage().id==="maps"?(openBlock(),createElementBlock("div",_hoisted_3$2,[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.appState.maps,d=>(openBlock(),createBlock(o,{key:d.id,map:d},null,8,["map"]))),128))])):createCommentVNode("",!0),t.menu.currentPage().id==="markers"?(openBlock(),createBlock(l,{key:2,menu:t.menu},null,8,["menu"])):createCommentVNode("",!0),t.menu.currentPage().id==="settings"?(openBlock(),createBlock(c,{key:3})):createCommentVNode("",!0),t.menu.currentPage().id==="info"?(openBlock(),createElementBlock("div",{key:4,class:"info-content",innerHTML:n.$t("info.content",{version:n.$bluemap.settings.version})},null,8,_hoisted_4$1)):createCommentVNode("",!0)]),_:1},8,["open","title","back"])}const MainMenu=_export_sfc(_sfc_main$3,[["render",_sfc_render$3]]),_sfc_main$2={name:"FreeFlightMobileControls",data(){return{enabled:!1,forward:0,forwardPointer:-1,up:0,upPointer:-1}},methods:{onTouchStop(n){console.log("Stop: ",n),n.changedTouches[0].identifier===this.forwardPointer&&(this.forward=0),n.changedTouches[0].identifier===this.upPointer&&(this.up=0)},onFrame(n){let e=this.$bluemap.mapViewer.controlsManager;e.position.x+=this.forward*Math.sin(e.rotation)*n.detail.delta*.02,e.position.z+=this.forward*-Math.cos(e.rotation)*n.detail.delta*.02,e.position.y+=this.up*n.detail.delta*.01},enable(){this.enabled=!0}},mounted(){window.addEventListener("touchstart",this.enable,{passive:!0}),window.addEventListener("touchend",this.onTouchStop),window.addEventListener("touchcancel",this.onTouchStop),this.$bluemap.events.addEventListener("bluemapRenderFrame",this.onFrame)},beforeUnmount(){window.removeEventListener("touchstart",this.enable),window.removeEventListener("touchend",this.onTouchStop),window.removeEventListener("touchcancel",this.onTouchStop),this.$bluemap.events.removeEventListener("bluemapRenderFrame",this.onFrame)}},_hoisted_1$2={class:"move-fields"},_hoisted_2$1=createBaseVNode("svg",{viewBox:"0 0 100 50"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792 3210 c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_3$1=[_hoisted_2$1],_hoisted_4=createBaseVNode("svg",{viewBox:"0 0 100 50",class:"down"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792 3211 c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_5=[_hoisted_4],_hoisted_6={class:"height-fields"},_hoisted_7=createBaseVNode("svg",{viewBox:"0 0 100 50"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792 3212 c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_8=[_hoisted_7],_hoisted_9=createBaseVNode("svg",{viewBox:"0 0 100 50",class:"down"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792 3213 c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_10=[_hoisted_9];function _sfc_render$2(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{id:"ff-mobile-controls",class:normalizeClass({disabled:!r.enabled})},[createBaseVNode("div",_hoisted_1$2,[createBaseVNode("div",{class:"button up-button",onTouchstartPassive:e[0]||(e[0]=a=>{r.forward=1,r.forwardPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_3$1,32),createBaseVNode("div",{class:"button down-button",onTouchstartPassive:e[1]||(e[1]=a=>{r.forward=-1,r.forwardPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_5,32)]),createBaseVNode("div",_hoisted_6,[createBaseVNode("div",{class:"button up-button",onTouchstartPassive:e[2]||(e[2]=a=>{r.up=1,r.upPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_8,32),createBaseVNode("div",{class:"button down-button",onTouchstartPassive:e[3]||(e[3]=a=>{r.up=-1,r.upPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_10,32)])],2)}const FreeFlightMobileControls=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),_sfc_main$1={name:"ZoomButtons",components:{SvgButton},methods:{zoom(n){var t;let e=(t=this.$bluemap.mapViewer.controlsManager.controls)==null?void 0:t.mouseZoom;e&&(e.deltaZoom+=n)}}},_hoisted_1$1={id:"zoom-buttons"},_hoisted_2=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M22.471,12.95H17.05V7.527c0-1.297-0.917-2.348-2.05-2.348c-1.132,0-2.05,1.051-2.05,2.348v5.423H7.527 3214 c-1.297,0-2.348,0.917-2.348,2.05c0,1.132,1.051,2.05,2.348,2.05h5.423v5.421c0,1.299,0.918,2.351,2.05,2.351 3215 c1.133,0,2.05-1.052,2.05-2.351V17.05h5.421c1.299,0,2.351-0.918,2.351-2.05C24.821,13.867,23.77,12.95,22.471,12.95z`})],-1),_hoisted_3=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M24.821,15c0,1.132-1.052,2.05-2.351,2.05H7.527c-1.297,0-2.348-0.918-2.348-2.05l0,0c0-1.133,1.051-2.05,2.348-2.05 3216 h14.944C23.77,12.95,24.821,13.867,24.821,15L24.821,15z`})])],-1);function _sfc_render$1(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createElementBlock("div",_hoisted_1$1,[createVNode(a,{onAction:e[0]||(e[0]=o=>s.zoom(-3))},{default:withCtx(()=>[_hoisted_2]),_:1}),createVNode(a,{onAction:e[1]||(e[1]=o=>s.zoom(3))},{default:withCtx(()=>[_hoisted_3]),_:1})])}const ZoomButtons=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]),_sfc_main={name:"App",components:{FreeFlightMobileControls,MainMenu,ControlBar,ZoomButtons},computed:{showMapMenu(){return this.mapViewer.mapState==="loading"||this.mapViewer.mapState==="loaded"}},data(){return{appState:this.$bluemap.appState,mapViewer:this.$bluemap.mapViewer.data}}},_hoisted_1={key:2,class:"map-state-message"};function _sfc_render(n,e,t,i,r,s){const a=resolveComponent("FreeFlightMobileControls"),o=resolveComponent("ZoomButtons"),l=resolveComponent("ControlBar"),c=resolveComponent("MainMenu");return openBlock(),createElementBlock("div",{id:"app",class:normalizeClass({"theme-light":r.appState.theme==="light","theme-dark":r.appState.theme==="dark","theme-contrast":r.appState.theme==="contrast"})},[r.mapViewer.mapState==="loaded"&&r.appState.controls.state==="free"?(openBlock(),createBlock(a,{key:0})):createCommentVNode("",!0),s.showMapMenu&&r.appState.controls.showZoomButtons&&r.appState.controls.state!=="free"?(openBlock(),createBlock(o,{key:1})):createCommentVNode("",!0),createVNode(l),r.mapViewer.mapState!=="loaded"?(openBlock(),createElementBlock("div",_hoisted_1,toDisplayString$1(n.$t("map."+r.mapViewer.mapState)),1
vendor: 21,180 bytes, lines 3216-3222
3216)):createCommentVNode("",!0),createVNode(c,{menu:r.appState.menu},null,8,["menu"])],2)}const App=_export_sfc(_sfc_main,[["render",_sfc_render]]);var hammer={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 3217 * http://hammerjs.github.io/ 3218 * 3219 * Copyright (c) 2016 Jorik Tangelder; 3220 * Licensed under the MIT license */var hasRequiredHammer;function requireHammer(){return hasRequiredHammer||(hasRequiredHammer=1,function(n){(function(e,t,i,r){var s=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),o="function",l=Math.round,c=Math.abs,u=Date.now;function d(A,I,U){return setTimeout(y(A,U),I)}function f(A,I,U){return Array.isArray(A)?(m(A,U[I],U),!0):!1}function m(A,I,U){var te;if(A)if(A.forEach)A.forEach(I,U);else if(A.length!==r)for(te=0;te<A.length;)I.call(U,A[te],te,A),te++;else for(te in A)A.hasOwnProperty(te)&&I.call(U,A[te],te,A)}function v(A,I,U){var te="DEPRECATED METHOD: "+I+` 3221`+U+` AT 3222`;return function(){var xe=new Error("get-stack-trace"),Pe=xe&&xe.stack?xe.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",qe=e.console&&(e.console.warn||e.console.log);return qe&&qe.call(e.console,te,Pe),A.apply(this,arguments)}}var _;typeof Object.assign!="function"?_=function(I){if(I===r||I===null)throw new TypeError("Cannot convert undefined or null to object");for(var U=Object(I),te=1;te<arguments.length;te++){var xe=arguments[te];if(xe!==r&&xe!==null)for(var Pe in xe)xe.hasOwnProperty(Pe)&&(U[Pe]=xe[Pe])}return U}:_=Object.assign;var g=v(function(I,U,te){for(var xe=Object.keys(U),Pe=0;Pe<xe.length;)(!te||te&&I[xe[Pe]]===r)&&(I[xe[Pe]]=U[xe[Pe]]),Pe++;return I},"extend","Use `assign`."),x=v(function(I,U){return g(I,U,!0)},"merge","Use `assign`.");function S(A,I,U){var te=I.prototype,xe;xe=A.prototype=Object.create(te),xe.constructor=A,xe._super=te,U&&_(xe,U)}function y(A,I){return function(){return A.apply(I,arguments)}}function b(A,I){return typeof A==o?A.apply(I&&I[0]||r,I):A}function w(A,I){return A===r?I:A}function C(A,I,U){m(B(I),function(te){A.addEventListener(te,U,!1)})}function R(A,I,U){m(B(I),function(te){A.removeEventListener(te,U,!1)})}function M(A,I){for(;A;){if(A==I)return!0;A=A.parentNode}return!1}function L(A,I){return A.indexOf(I)>-1}function B(A){return A.trim().split(/\s+/g)}function Z(A,I,U){if(A.indexOf&&!U)return A.indexOf(I);for(var te=0;te<A.length;){if(U&&A[te][U]==I||!U&&A[te]===I)return te;te++}return-1}function W(A){return Array.prototype.slice.call(A,0)}function X(A,I,U){for(var te=[],xe=[],Pe=0;Pe<A.length;){var qe=A[Pe][I];Z(xe,qe)<0&&te.push(A[Pe]),xe[Pe]=qe,Pe++}return te=te.sort(function(ot,ht){return ot[I]>ht[I]}),te}function G(A,I){for(var U,te,xe=I[0].toUpperCase()+I.slice(1),Pe=0;Pe<s.length;){if(U=s[Pe],te=U?U+xe:I,te in A)return te;Pe++}return r}var le=1;function he(){return le++}function ue(A){var I=A.ownerDocument||A;return I.defaultView||I.parentWindow||e}var ie=/mobile|tablet|ip(ad|hone|od)|android/i,ve="ontouchstart"in e,_e=G(e,"PointerEvent")!==r,Q=ve&&ie.test(navigator.userAgent),ne="touch",ye="pen",Me="mouse",Te="kinect",ae=25,Le=1,Ee=2,Ce=4,we=8,O=1,D=2,k=4,H=8,j=16,Y=D|k,ce=H|j,re=Y|ce,se=["x","y"],P=["clientX","clientY"];function N(A,I){var U=this;this.manager=A,this.callback=I,this.element=A.element,this.target=A.options.inputTarget,this.domHandler=function(te){b(A.options.enable,[A])&&U.handler(te)},this.init()}N.prototype={handler:function(){},init:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(ue(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&R(this.element,this.evEl,this.domHandler),this.evTarget&&R(this.target,this.evTarget,this.domHandler),this.evWin&&R(ue(this.element),this.evWin,this.domHandler)}};function T(A){var I,U=A.options.inputClass;return U?I=U:_e?I=Oe:Q?I=Lt:ve?I=F:I=et,new I(A,E)}function E(A,I,U){var te=U.pointers.length,xe=U.changedPointers.length,Pe=I&Le&&te-xe===0,qe=I&(Ce|we)&&te-xe===0;U.isFirst=!!Pe,U.isFinal=!!qe,Pe&&(A.session={}),U.eventType=I,z(A,U),A.emit("hammer.input",U),A.recognize(U),A.session.prevInput=U}function z(A,I){var U=A.session,te=I.pointers,xe=te.length;U.firstInput||(U.firstInput=$(I)),xe>1&&!U.firstMultiple?U.firstMultiple=$(I):xe===1&&(U.firstMultiple=!1);var Pe=U.firstInput,qe=U.firstMultiple,rt=qe?qe.center:Pe.center,ot=I.center=be(te);I.timeStamp=u(),I.deltaTime=I.timeStamp-Pe.timeStamp,I.angle=Ne(rt,ot),I.distance=Ie(rt,ot),K(U,I),I.offsetDirection=oe(I.deltaX,I.deltaY);var ht=ge(I.deltaTime,I.deltaX,I.deltaY);I.overallVelocityX=ht.x,I.overallVelocityY=ht.y,I.overallVelocity=c(ht.x)>c(ht.y)?ht.x:ht.y,I.scale=qe?Re(qe.pointers,te):1,I.rotation=qe?Fe(qe.pointers,te):0,I.maxPointers=U.prevInput?I.pointers.length>U.prevInput.maxPointers?I.pointers.length:U.prevInput.maxPointers:I.pointers.length,V(U,I);var bt=A.element;M(I.srcEvent.target,bt)&&(bt=I.srcEvent.target),I.target=bt}function K(A,I){var U=I.center,te=A.offsetDelta||{},xe=A.prevDelta||{},Pe=A.prevInput||{};(I.eventType===Le||Pe.eventType===Ce)&&(xe=A.prevDelta={x:Pe.deltaX||0,y:Pe.deltaY||0},te=A.offsetDelta={x:U.x,y:U.y}),I.deltaX=xe.x+(U.x-te.x),I.deltaY=xe.y+(U.y-te.y)}function V(A,I){var U=A.lastInterval||I,te=I.timeStamp-U.timeStamp,xe,Pe,qe,rt;if(I.eventType!=we&&(te>ae||U.velocity===r)){var ot=I.deltaX-U.deltaX,ht=I.deltaY-U.deltaY,bt=ge(te,ot,ht);Pe=bt.x,qe=bt.y,xe=c(bt.x)>c(bt.y)?bt.x:bt.y,rt=oe(ot,ht),A.lastInterval=I}else xe=U.velocity,Pe=U.velocityX,qe=U.velocityY,rt=U.direction;I.velocity=xe,I.velocityX=Pe,I.velocityY=qe,I.direction=rt}function $(A){for(var I=[],U=0;U<A.pointers.length;)I[U]={clientX:l(A.pointers[U].clientX),clientY:l(A.pointers[U].clientY)},U++;return{timeStamp:u(),pointers:I,center:be(I),deltaX:A.deltaX,deltaY:A.deltaY}}function be(A){var I=A.length;if(I===1)return{x:l(A[0].clientX),y:l(A[0].clientY)};for(var U=0,te=0,xe=0;xe<I;)U+=A[xe].clientX,te+=A[xe].clientY,xe++;return{x:l(U/I),y:l(te/I)}}function ge(A,I,U){return{x:I/A||0,y:U/A||0}}function oe(A,I){return A===I?O:c(A)>=c(I)?A<0?D:k:I<0?H:j}function Ie(A,I,U){U||(U=se);var te=I[U[0]]-A[U[0]],xe=I[U[1]]-A[U[1]];return Math.sqrt(te*te+xe*xe)}function Ne(A,I,U){U||(U=se);var te=I[U[0]]-A[U[0]],xe=I[U[1]]-A[U[1]];return Math.atan2(xe,te)*180/Math.PI}function Fe(A,I){return Ne(I[1],I[0],P)+Ne(A[1],A[0],P)}function Re(A,I){return Ie(I[0],I[1],P)/Ie(A[0],A[1],P)}var De={mousedown:Le,mousemove:Ee,mouseup:Ce},We="mousedown",je="mousemove mouseup";function et(){this.evEl=We,this.evWin=je,this.pressed=!1,N.apply(this,arguments)}S(et,N,{handler:function(I){var U=De[I.type];U&Le&&I.button===0&&(this.pressed=!0),U&Ee&&I.which!==1&&(U=Ce),this.pressed&&(U&Ce&&(this.pressed=!1),this.callback(this.manager,U,{pointers:[I],changedPointers:[I],pointerType:Me,srcEvent:I}))}});var q={pointerdown:Le,pointermove:Ee,pointerup:Ce,pointercancel:we,pointerout:we},fe={2:ne,3:ye,4:Me,5:Te},Se="pointerdown",Ae="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(Se="MSPointerDown",Ae="MSPointerMove MSPointerUp MSPointerCancel");function Oe(){this.evEl=Se,this.evWin=Ae,N.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}S(Oe,N,{handler:function(I){var U=this.store,te=!1,xe=I.type.toLowerCase().replace("ms",""),Pe=q[xe],qe=fe[I.pointerType]||I.pointerType,rt=qe==ne,ot=Z(U,I.pointerId,"pointerId");Pe&Le&&(I.button===0||rt)?ot<0&&(U.push(I),ot=U.length-1):Pe&(Ce|we)&&(te=!0),!(ot<0)&&(U[ot]=I,this.callback(this.manager,Pe,{pointers:U,changedPointers:[I],pointerType:qe,srcEvent:I}),te&&U.splice(ot,1))}});var Xe={touchstart:Le,touchmove:Ee,touchend:Ce,touchcancel:we},tt="touchstart",it="touchstart touchmove touchend touchcancel";function vt(){this.evTarget=tt,this.evWin=it,this.started=!1,N.apply(this,arguments)}S(vt,N,{handler:function(I){var U=Xe[I.type];if(U===Le&&(this.started=!0),!!this.started){var te=Ke.call(this,I,U);U&(Ce|we)&&te[0].length-te[1].length===0&&(this.started=!1),this.callback(this.manager,U,{pointers:te[0],changedPointers:te[1],pointerType:ne,srcEvent:I})}}});function Ke(A,I){var U=W(A.touches),te=W(A.changedTouches);return I&(Ce|we)&&(U=X(U.concat(te),"identifier")),[U,te]}var mt={touchstart:Le,touchmove:Ee,touchend:Ce,touchcancel:we},ut="touchstart touchmove touchend touchcancel";function Lt(){this.evTarget=ut,this.targetIds={},N.apply(this,arguments)}S(Lt,N,{handler:function(I){var U=mt[I.type],te=Ht.call(this,I,U);te&&this.callback(this.manager,U,{pointers:te[0],changedPointers:te[1],pointerType:ne,srcEvent:I})}});function Ht(A,I){var U=W(A.touches),te=this.targetIds;if(I&(Le|Ee)&&U.length===1)return te[U[0].identifier]=!0,[U,U];var xe,Pe,qe=W(A.changedTouches),rt=[],ot=this.target;if(Pe=U.filter(function(ht){return M(ht.target,ot)}),I===Le)for(xe=0;xe<Pe.length;)te[Pe[xe].identifier]=!0,xe++;for(xe=0;xe<qe.length;)te[qe[xe].identifier]&&rt.push(qe[xe]),I&(Ce|we)&&delete te[qe[xe].identifier],xe++;if(rt.length)return[X(Pe.concat(rt),"identifier"),rt]}var Wt=2500,zt=25;function F(){N.apply(this,arguments);var A=y(this.handler,this);this.touch=new Lt(this.manager,A),this.mouse=new et(this.manager,A),this.primaryTouch=null,this.lastTouches=[]}S(F,N,{handler:function(I,U,te){var xe=te.pointerType==ne,Pe=te.pointerType==Me;if(!(Pe&&te.sourceCapabilities&&te.sourceCapabilities.firesTouchEvents)){if(xe)ee.call(this,U,te);else if(Pe&&J.call(this,te))return;this.callback(I,U,te)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ee(A,I){A&Le?(this.primaryTouch=I.changedPointers[0].identifier,de.call(this,I)):A&(Ce|we)&&de.call(this,I)}function de(A){var I=A.changedPointers[0];if(I.identifier===this.primaryTouch){var U={x:I.clientX,y:I.clientY};this.lastTouches.push(U);var te=this.lastTouches,xe=function(){var Pe=te.indexOf(U);Pe>-1&&te.splice(Pe,1)};setTimeout(xe,Wt)}}function J(A){for(var I=A.srcEvent.clientX,U=A.srcEvent.clientY,te=0;te<this.lastTouches.length;te++){var xe=this.lastTouches[te],Pe=Math.abs(I-xe.x),qe=Math.abs(U-xe.y);if(Pe<=zt&&qe<=zt)return!0}return!1}var pe=G(a.style,"touchAction"),Be=pe!==r,Ve="compute",Ue="auto",ze="manipulation",$e="none",Ge="pan-x",He="pan-y",Ze=Mt();function st(A,I){this.manager=A,this.set(I)}st.prototype={set:function(A){A==Ve&&(A=this.compute()),Be&&this.manager.element.style&&Ze[A]&&(this.manager.element.style[pe]=A),this.actions=A.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var A=[];return m(this.manager.recognizers,function(I){b(I.options.enable,[I])&&(A=A.concat(I.getTouchAction()))}),gt(A.join(" "))},preventDefaults:function(A){var I=A.srcEvent,U=A.offsetDirection;if(this.manager.session.prevented){I.preventDefault();return}var te=this.actions,xe=L(te,$e)&&!Ze[$e],Pe=L(te,He)&&!Ze[He],qe=L(te,Ge)&&!Ze[Ge];if(xe){var rt=A.pointers.length===1,ot=A.distance<2,ht=A.deltaTime<250;if(rt&&ot&&ht)return}if(!(qe&&Pe)&&(xe||Pe&&U&Y||qe&&U&ce))return this.preventSrc(I)},preventSrc:function(A){this.manager.session.prevented=!0,A.preventDefault()}};function gt(A){if(L(A,$e))return $e;var I=L(A,Ge),U=L(A,He);return I&&U?$e:I||U?I?Ge:He:L(A,ze)?ze:Ue}function Mt(){if(!Be)return!1;var A={},I=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(U){A[U]=I?e.CSS.supports("touch-action",U):!0}),A}var Je=1,ke=2,yt=4,Ye=8,at=Ye,wt=16,lt=32;function dt(A){this.options=_({},this.defaults,A||{}),this.id=he(),this.manager=null,this.options.enable=w(this.options.enable,!0),this.state=Je,this.simultaneous={},this.requireFail=[]}dt.prototype={defaults:{},set:function(A){return _(this.options,A),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(A){if(f(A,"recognizeWith",this))return this;var I=this.simultaneous;return A=Tt(A,this),I[A.id]||(I[A.id]=A,A.recognizeWith(this)),this},dropRecognizeWith:function(A){return f(A,"dropRecognizeWith",this)?this:(A=Tt(A,this),delete this.simultaneous[A.id],this)},requireFailure:function(A){if(f(A,"requireFailure",this))return this;var I=this.requireFail;return A=Tt(A,this),Z(I,A)===-1&&(I.push(A),A.requireFailure(this)),this},dropRequireFailure:function(A){if(f(A,"dropRequireFailure",this))return this;A=Tt(A,this);var I=Z(this.requireFail,A);return I>-1&&this.requireFail.splice(I,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(A){return!!this.simultaneous[A.id]},emit:function(A){var I=this,U=this.state;function te(xe){I.manager.emit(xe,A)}U<Ye&&te(I.options.event+nt(U)),te(I.options.event),A.additionalEvent&&te(A.additionalEvent),U>=Ye&&te(I.options.event+nt(U))},tryEmit:function(A){if(this.canEmit())return this.emit(A);this.state=lt},canEmit:function(){for(var A=0;A<this.requireFail.length;){if(!(this.requireFail[A].state&(lt|Je)))return!1;A++}return!0},recognize:function(A){var I=_({},A);if(!b(this.options.enable,[this,I])){this.reset(),this.state=lt;return}this.state&(at|wt|lt)&&(this.state=Je),this.state=this.process(I),this.state&(ke|yt|Ye|wt)&&this.tryEmit(I)},process:function(A){},getTouchAction:function(){},reset:function(){}};function nt(A){return A&wt?"cancel":A&Ye?"end":A&yt?"move":A&ke?"start":""}function xt(A){return A==j?"down":A==H?"up":A==D?"left":A==k?"right":""}function Tt(A,I){var U=I.manager;return U?U.get(A):A}function Qe(){dt.apply(this,arguments)}S(Qe,dt,{defaults:{pointers:1},attrTest:function(A){var I=this.options.pointers;return I===0||A.pointers.length===I},process:function(A){var I=this.state,U=A.eventType,te=I&(ke|yt),xe=this.attrTest(A);return te&&(U&we||!xe)?I|wt:te||xe?U&Ce?I|Ye:I&ke?I|yt:ke:lt}});function Et(){Qe.apply(this,arguments),this.pX=null,this.pY=null}S(Et,Qe,{defaults:{event:"pan",threshold:10,pointers:1,direction:re},getTouchAction:function(){var A=this.options.direction,I=[];return A&Y&&I.push(He),A&ce&&I.push(Ge),I},directionTest:function(A){var I=this.options,U=!0,te=A.distance,xe=A.direction,Pe=A.deltaX,qe=A.deltaY;return xe&I.direction||(I.direction&Y?(xe=Pe===0?O:Pe<0?D:k,U=Pe!=this.pX,te=Math.abs(A.deltaX)):(xe=qe===0?O:qe<0?H:j,U=qe!=this.pY,te=Math.abs(A.deltaY))),A.direction=xe,U&&te>I.threshold&&xe&I.direction},attrTest:function(A){return Qe.prototype.attrTest.call(this,A)&&(this.state&ke||!(this.state&ke)&&this.directionTest(A))},emit:function(A){this.pX=A.deltaX,this.pY=A.deltaY;var I=xt(A.direction);I&&(A.additionalEvent=this.options.event+I),this._super.emit.call(this,A)}});function Ot(){Qe.apply(this,arguments)}S(Ot,Qe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[$e]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.scale-1)>this.options.threshold||this.state&ke)},emit:function(A){if(A.scale!==1){var I=A.scale<1?"in":"out";A.additionalEvent=this.options.event+I}this._super.emit.call(this,A)}});function Ft(){dt.apply(this,arguments),this._timer=null,this._input=null}S(Ft,dt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ue]},process:function(A){var I=this.options,U=A.pointers.length===I.pointers,te=A.distance<I.threshold,xe=A.deltaTime>I.time;if(this._input=A,!te||!U||A.eventType&(Ce|we)&&!xe)this.reset();else if(A.eventType&Le)this.reset(),this._timer=d(function(){this.state=at,this.tryEmit()},I.time,this);else if(A.eventType&Ce)return at;return lt},reset:function(){clearTimeout(this._timer)},emit:function(A){this.state===at&&(A&&A.eventType&Ce?this.manager.emit(this.options.event+"up",A):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function qt(){Qe.apply(this,arguments)}S(qt,Qe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[$e]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.rotation)>this.options.threshold||this.state&ke)}});function Xt(){Qe.apply(this,arguments)}S(Xt,Qe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Y|ce,pointers:1},getTouchAction:function(){return Et.prototype.getTouchAction.call(this)},attrTest:function(A){var I=this.options.direction,U;return I&(Y|ce)?U=A.overallVelocity:I&Y?U=A.overallVelocityX:I&ce&&(U=A.overallVelocityY),this._super.attrTest.call(this,A)&&I&A.offsetDirection&&A.distance>this.options.threshold&&A.maxPointers==this.options.pointers&&c(U)>this.options.velocity&&A.eventType&Ce},emit:function(A){var I=xt(A.offsetDirection);I&&this.manager.emit(this.options.event+I,A),this.manager.emit(this.options.event,A)}});function $t(){dt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}S($t,dt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ze]},process:function(A){var I=this.options,U=A.pointers.length===I.pointers,te=A.distance<I.threshold,xe=A.deltaTime<I.time;if(this.reset(),A.eventType&Le&&this.count===0)return this.failTimeout();if(te&&xe&&U){if(A.eventType!=Ce)return this.failTimeout();var Pe=this.pTime?A.timeStamp-this.pTime<I.interval:!0,qe=!this.pCenter||Ie(this.pCenter,A.center)<I.posThreshold;this.pTime=A.timeStamp,this.pCenter=A.center,!qe||!Pe?this.count=1:this.count+=1,this._input=A;var rt=this.count%I.taps;if(rt===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=at,this.tryEmit()},I.interval,this),ke):at}return lt},failTimeout:function(){return this._timer=d(function(){this.state=lt},this.options.interval,this),lt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==at&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ct(A,I){return I=I||{},I.recognizers=w(I.recognizers,Ct.defaults.preset),new Yt(A,I)}Ct.VERSION="2.0.7",Ct.defaults={domEvents:!1,touchAction:Ve,enable:!0,inputTarget:null,inputClass:null,preset:[[qt,{enable:!1}],[Ot,{enable:!1},["rotate"]],[Xt,{direction:Y}],[Et,{direction:Y},["swipe"]],[$t],[$t,{event:"doubletap",taps:2},["tap"]],[Ft]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Zt=1,jt=2;function Yt(A,I){this.options=_({},Ct.defaults,I||{}),this.options.inputTarget=this.options.inputTarget||A,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=A,this.input=T(this),this.touchAction=new st(this,this.options.touchAction),Kt(this,!0),m(this.options.recognizers,function(U){var te=this.add(new U[0](U[1]));U[2]&&te.recognizeWith(U[2]),U[3]&&te.requireFailure(U[3])},this)}Yt.prototype={set:function(A){return _(this.options,A),A.touchAction&&this.touchAction.update(),A.inputTarget&&(this.input.destroy(),this.input.target=A.inputTarget,this.input.init()),this},stop:function(A){this.session.stopped=A?jt:Zt},recognize:function(A){var I=this.session;if(!I.stopped){this.touchAction.preventDefaults(A);var U,te=this.recognizers,xe=I.curRecognizer;(!xe||xe&&xe.state&at)&&(xe=I.curRecognizer=null);for(var Pe=0;Pe<te.length;)U=te[Pe],I.stopped!==jt&&(!xe||U==xe||U.canRecognizeWith(xe))?U.recognize(A):U.reset(),!xe&&U.state&(ke|yt|Ye)&&(xe=I.curRecognizer=U),Pe++}},get:function(A){if(A instanceof dt)return A;for(var I=this.recognizers,U=0;U<I.length;U++)if(I[U].options.event==A)return I[U];return null},add:function(A){if(f(A,"add",this))return this;var I=this.get(A.options.event);return I&&this.remove(I),this.recognizers.push(A),A.manager=this,this.touchAction.update(),A},remove:function(A){if(f(A,"remove",this))return this;if(A=this.get(A),A){var I=this.recognizers,U=Z(I,A);U!==-1&&(I.splice(U,1),this.touchAction.update())}return this},on:function(A,I){if(A!==r&&I!==r){var U=this.handlers;return m(B(A),function(te){U[te]=U[te]||[],U[te].push(I)}),this}},off:function(A,I){if(A!==r){var U=this.handlers;return m(B(A),function(te){I?U[te]&&U[te].splice(Z(U[te],I),1):delete U[te]}),this}},emit:function(A,I){this.options.domEvents&&Jt(A,I);var U=this.handlers[A]&&this.handlers[A].slice();if(!(!U||!U.length)){I.type=A,I.preventDefault=function(){I.srcEvent.preventDefault()};for(var te=0;te<U.length;)U[te](I),te++}},destroy:function(){this.element&&Kt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Kt(A,I){var U=A.element;if(U.style){var te;m(A.options.cssProps,function(xe,Pe){te=G(U.style,Pe),I?(A.oldCssProps[te]=U.style[te],U.style[te]=xe):U.style[te]=A.oldCssProps[te]||""}),I||(A.oldCssProps={})}}function Jt(A,I){var U=t.createEvent("Event");U.initEvent(A,!0,!0),U.gesture=I,I.target.dispatchEvent(U)}_(Ct,{INPUT_START:Le,INPUT_MOVE:Ee,INPUT_END:Ce,INPUT_CANCEL:we,STATE_POSSIBLE:Je,STATE_BEGAN:ke,STATE_CHANGED:yt,STATE_ENDED:Ye,STATE_RECOGNIZED:at,STATE_CANCELLED:wt,STATE_FAILED:lt,DIRECTION_NONE:O,DIRECTION_LEFT:D,DIRECTION_RIGHT:k,DIRECTION_UP:H,DIRECTION_DOWN:j,DIRECTION_HORIZONTAL:Y,DIRECTION_VERTICAL:ce,DIRECTION_ALL:re,Manager:Yt,Input:N,TouchAction:st,TouchInput:Lt,MouseInput:et,PointerEventInput:Oe,TouchMouseInput:F,SingleTouchInput:vt,Recognizer:dt,AttrRecognizer:Qe,Tap:$t,Pan:Et,Swipe:Xt,Pinch:Ot,Rotate:qt,Press:Ft,on:C,off:R,each:m,merge:x,extend:g,assign:_,inherit:S,bindFn:y,prefixed:G});var Qt=typeof e<"u"?e:typeof self<"u"?self:{};
3222Qt.Hammer=Ct,n.exports?n.exports=Ct:e[i]=Ct})(window,document,"Hammer")}(hammer)),hammer.exports}var hammerExports=requireHammer();const At=class At{constructor(e,...t){this.code=e,this.ctrl=t.includes(At.CTRL)||this.code==="CtrlLeft"||this.code==="CtrlRight",this.shift=t.includes(At.SHIFT)||this.code==="ShiftLeft"||this.code==="ShiftRight",this.alt=t.includes(At.ALT)||this.code==="AltLeft"||this.code==="AltRight"}testDown(e){return this.code===e.code&&this.ctrl===e.ctrlKey&&this.shift===e.shiftKey&&this.alt===e.altKey}testUp(e){return this.code===e.code}static oneDown(e,...t){for(let i of t)if(i.testDown(e))return!0;return!1}static oneUp(e,...t){for(let i of t)if(i.testUp(e))return!0;return!1}};me(At,"CTRL",0),me(At,"SHIFT",1),me(At,"ALT",2);let KeyCombination=At;var ct;let KeyMoveControls$1=(ct=class{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneUp(e,...ct.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.DOWN)&&(this.down=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...ct.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...ct.KEYS.DOWN)&&(this.down=!1),KeyCombination.oneUp(e,...ct.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...ct.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1,this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaPosition=new Vector2,this.up=!1,this.down=!1,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaPosition.y-=1),this.down&&(this.deltaPosition.y+=1),this.left&&(this.deltaPosition.x-=1),this.right&&(this.deltaPosition.x+=1),this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=ct.temp_v2.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.speed*e*.06,this.manager.position.z+=r.y*i*this.speed*e*.06,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}},me(ct,"KEYS",{LEFT:[new KeyCombination("ArrowLeft"),new KeyCombination("KeyA")],UP:[new KeyCombination("ArrowUp"),new
3222KeyCombination("KeyW")],RIGHT:[new KeyCombination("ArrowRight"),new KeyCombination("KeyD")],DOWN:[new KeyCombination("ArrowDown"),new KeyCombination("KeyS")]}),me(ct,"temp_v2",new Vector2),ct),MouseRotateControls$1=class{constructor(e,t,i,r,s){me(this,"onMouseDown",e=>{this.moving=!0,this.deltaRotation=0,this.lastX=e.x});me(this,"onMouseMove",e=>{document.pointerLockElement?this.deltaRotation-=e.movementX*this.speedCapture*this.pixelToSpeedMultiplier:this.moving&&(e.buttons===1?this.deltaRotation-=(e.x-this.lastX)*this.speedLeft*this.pixelToSpeedMultiplier:this.deltaRotation-=(e.x-this.lastX)*this.speedRight*this.pixelToSpeedMultiplier),this.lastX=e.x});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplier=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight)});this.target=e,this.manager=null,this.moving=!1,this.lastX=0,this.deltaRotation=0,this.speedLeft=t,this.speedRight=i,this.speedCapture=r,this.stiffness=s,this.pixelToSpeedMultiplier=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}},MouseAngleControls$1=class{constructor(e,t,i,r,s){me(this,"onMouseDown",e=>{this.moving=!0,this.deltaAngle=0,this.lastY=e.y});me(this,"onMouseMove",e=>{document.pointerLockElement?this.deltaAngle+=e.movementY*this.speedCapture*this.pixelToSpeedMultiplier:this.moving&&(e.buttons===1?this.deltaAngle+=(e.y-this.lastY)*this.speedLeft*this.pixelToSpeedMultiplier:this.deltaAngle+=(e.y-this.lastY)*this.speedRight*this.pixelToSpeedMultiplier),this.lastY=e.y});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplier=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.speedLeft=t,this.speedRight=i,this.speedCapture=r,this.stiffness=s,this.pixelToSpeedMultiplier=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i,this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}};const Pt=class Pt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneUp(e,...Pt.KEYS.UP)?(this.up=!0,e.preventDefault()):KeyCombination.oneUp(e,...Pt.KEYS.DOWN)&&(this.down=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Pt.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...Pt.KEYS.DOWN)&&(this.down=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1});this.target=e,this.manager=null,this.deltaY=0,this.up=!1,this.down=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaY+=1),this.down&&(this.deltaY-=1),this.deltaY===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.position.y+=this.deltaY*i*this.speed*e*.06,this.deltaY*=1-i,Math.abs(this.deltaY)<1e-4&&(this.deltaY=0)}};me(Pt,"KEYS",{UP:[new KeyCombination("Space"),new KeyCombination("PageUp")],DOWN:[new KeyCombination("ShiftLeft"),new KeyCombination("ShiftRight"),new KeyCombination("PageDown")]});let KeyHeightControls=Pt;
3222const Gt=class Gt{constructor(e,t,i,r){me(this,"onTouchDown",e=>{e.pointerType!=="mouse"&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.center.x,e.center.y))});me(this,"onTouchMove",e=>{if(e.pointerType==="mouse")return;let t=Gt.tempVec2_1.set(e.center.x,e.center.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onTouchUp",e=>{e.pointerType!=="mouse"&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("movestart",this.onTouchDown),this.hammer.on("movemove",this.onTouchMove),this.hammer.on("moveend",this.onTouchUp),this.hammer.on("movecancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("movestart",this.onTouchDown),this.hammer.off("movemove",this.onTouchMove),this.hammer.off("moveend",this.onTouchUp),this.hammer.off("movecancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaPosition.x*this.speed*this.pixelToSpeedMultiplierX*this.stiffness,this.manager.angle-=this.deltaPosition.y*this.speed*this.pixelToSpeedMultiplierY*this.stiffness,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(Gt,"tempVec2_1",new Vector2);let TouchPanControls=Gt;const DEG2RAD=Math.PI/180,Bt=class Bt{constructor(e){me(this,"onContextMenu",e=>{e.preventDefault()});me(this,"onMouseDown",e=>{this.clickStart.set(e.x,e.y)});me(this,"onMouseUp",e=>{Math.abs(this.clickStart.x-e.x)>5||Math.abs(this.clickStart.y-e.y)>5||document.body.requestFullscreen().finally(()=>{this.target.requestPointerLock()})});me(this,"onWheel",e=>{e.preventDefault();let t=e.deltaY;e.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(t*=.01),e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(t*=.33),this.moveSpeed*=Math.pow(1.5,-t*.25),this.moveSpeed=MathUtils.clamp(this.moveSpeed,.05,5),this.keyMove.speed=this.moveSpeed,this.keyHeight.speed=this.moveSpeed});this.target=e,this.manager=null,this.data=reactive({followingPlayer:null}),this.hammer=new hammerExports.Manager(this.target),this.initializeHammer(),this.keyMove=new KeyMoveControls$1(this.target,.5,.1),this.keyHeight=new KeyHeightControls(this.target,.5,.2),this.mouseRotate=new MouseRotateControls$1(this.target,1.5,-2,-1.5,.5),this.mouseAngle=new MouseAngleControls$1(this.target,1.5,-2,-1.5,.5),this.touchPan=new TouchPanControls(this.target,this.hammer,5,.15),this.started=!1,this.clickStart=new Vector2,this.moveSpeed=.5,this.animationTargetHeight=0}start(e){this.manager=e,this.keyMove.start(e),this.keyHeight.start(e),this.mouseRotate.start(e),this.mouseAngle.start(e),this.touchPan.start(e),this.target.addEventListener("contextmenu",this.onContextMenu),this.target.addEventListener("mousedown",this.onMouseDown),this.target.addEventListener("mouseup",this.onMouseUp),this.target.addEventListener("wheel",this.onWheel,{passive:!1})}stop(){this.keyMove.stop(),this.keyHeight.stop(),this.mouseRotate.stop(),this.mouseAngle.stop(),this.touchPan.stop(),this.target.removeEventListener("contextmenu",this.onContextMenu),this.target.removeEventListener("mousedown",this.onMouseDown),this.target.removeEventListener("mouseup",this.onMouseUp),this.target.removeEventListener("wheel",this.onWheel)}update(e,t){Bt._beforeMoveTemp.copy(this.manager.position);let i=this.manager.rotation,r=this.manager.angle;this.keyMove.update(e,t),this.keyHeight.update(e,t),this.mouseRotate.update(e,t),this.mouseAngle.update(e,t),this.touchPan.update(e,t),this.data.followingPlayer&&(!Bt._beforeMoveTemp.equals(this.manager.position)||i!==this.manager.rotation||r!==this.manager.angle)&&this.stopFollowingPlayerMarker(),this.data.followingPlayer&&(this.manager.position.copy(this.data.followingPlayer.position),this.manager.rotation=(this.data.followingPlayer.rotation.yaw-180)*DEG2RAD,this.manager.angle=-(this.data.followingPlayer.rotation.pitch-90)*DEG2RAD),this.manager.angle=MathUtils.clamp(this.manager.angle,0,Math.PI),this.manager.distance=0,this.manager.ortho=0}initializeHammer(){let e=new hammerExports.Pan({event:"move",pointers:1,direction:hammerExports.DIRECTION_ALL,threshold:0});this.hammer.add(e)}followPlayerMarker(e){e.isPlayerMarker&&(e=e.data),this.data.followingPlayer=e,this.keyMove.deltaPosition.set(0,0)}stopFollowingPlayerMarker(){this.data.followingPlayer=null}};me(Bt,"_beforeMoveTemp",new Vector3);let FreeFlightControls=Bt;
3222const kt=class kt{constructor(e,t,i){me(this,"onMouseDown",e=>{(e.buttons!==void 0?e.buttons===1:e.button===0)&&!e.altKey&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.x,e.y))});me(this,"onMouseMove",e=>{let t=kt.tempVec2_1.set(e.x,e.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onMouseUp",e=>{e.button===0&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=kt.tempVec2_1.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierX,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierY,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(kt,"tempVec2_1",new Vector2);let MouseMoveControls=kt;class MouseZoomControls{constructor(e,t,i){me(this,"onMouseWheel",e=>{e.preventDefault();let t=e.deltaY;e.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(t*=.01),e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(t*=.33),this.deltaZoom+=t});this.target=e,this.manager=null,this.stiffness=i,this.speed=t,this.deltaZoom=0}start(e){this.manager=e,this.target.addEventListener("wheel",this.onMouseWheel,{passive:!1})}stop(){this.target.removeEventListener("wheel",this.onMouseWheel)}update(e,t){if(this.deltaZoom===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.distance*=Math.pow(1.5,this.deltaZoom*i*this.speed),this.manager.angle=Math.min(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance)),this.deltaZoom*=1-i,Math.abs(this.deltaZoom)<1e-4&&(this.deltaZoom=0)}reset(){this.deltaZoom=0}}class MouseRotateControls{constructor(e,t,i){me(this,"onMouseDown",e=>{((e.buttons!==void 0?e.buttons===2:e.button===2)||(e.altKey||e.ctrlKey)&&(e.buttons!==void 0?e.buttons===1:e.button===0))&&(this.moving=!0,this.deltaRotation=0,this.lastX=e.x)});me(this,"onMouseMove",e=>{this.moving&&(this.deltaRotation+=e.x-this.lastX),this.lastX=e.x});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth});this.target=e,this.manager=null,this.moving=!1,this.lastX=0,this.deltaRotation=0,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierX=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed*this.pixelToSpeedMultiplierX,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}}class MouseAngleControls{constructor(e,t,i){me(this,"onMouseDown",e=>{((e.buttons!==void 0?e.buttons===2:e.button===2)||(e.altKey||e.ctrlKey)&&
3222(e.buttons!==void 0?e.buttons===1:e.button===0))&&(this.moving=!0,this.deltaAngle=0,this.lastY=e.y,this.startDistance=this.manager.distance,this.dynamicDistance=this.manager.distance<1e3)});me(this,"onMouseMove",e=>{this.moving&&(this.deltaAngle-=e.y-this.lastY),this.lastY=e.y});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"onWheel",e=>{this.dynamicDistance=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.dynamicDistance=!1,this.startDistance=0,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("wheel",this.onWheel),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("wheel",this.onWheel),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);if(i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*this.pixelToSpeedMultiplierY,this.dynamicDistance){let r=this.startDistance;r=Math.min(r,MapControls.getMaxDistanceForPerspectiveAngle(this.manager.angle)),r=Math.max(r,this.manager.controls.minDistance),this.manager.distance=softSet(this.manager.distance,r,.4),this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(r),.8)}else this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8);this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}}class MapHeightControls{constructor(e,t){this.manager=null,this.cameraHeightStiffness=e,this.targetHeightStiffness=t,this.targetHeight=0,this.cameraHeight=0,this.minCameraHeight=0,this.distanceTagretHeight=0}start(e){this.manager=e}stop(){}update(e,t){this.updateHeights(e,t),this.manager.position.y=Math.max(this.manager.position.y,this.getSuggestedHeight())}updateHeights(e,t){let i=this.targetHeightStiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=t.terrainHeightAt(this.manager.position.x,this.manager.position.z)+3||0,s=r-this.targetHeight;this.targetHeight+=s*i,Math.abs(s)<.001&&(this.targetHeight=r),this.minCameraHeight=0;let a=MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance);if(a>=.1){let o=this.cameraHeightStiffness/(16.666/e);o=MathUtils.clamp(o,0,1);let l=t.terrainHeightAt(this.manager.camera.position.x,this.manager.camera.position.z)||0,c=l-this.cameraHeight;this.cameraHeight+=c*o,Math.abs(c)<.001&&(this.cameraHeight=l);let u=Math.cos(a)*this.manager.distance;this.minCameraHeight=this.cameraHeight-u+1}this.distanceTagretHeight=MathUtils.lerp(this.targetHeight,0,Math.min(this.manager.distance/500,1))}getSuggestedHeight(){return Math.max(this.distanceTagretHeight,this.minCameraHeight)}}const ft=class ft{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...ft.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.DOWN)&&(this.down=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...ft.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...ft.KEYS.DOWN)&&(this.down=!1),KeyCombination.oneUp(e,...ft.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...ft.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1,this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaPosition=new Vector2,this.up=!1,this.down=!1,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaPosition.y-=1),this.down&&(this.deltaPosition.y+=1),this.left&&(this.deltaPosition.x-=1),this.right&&(this.deltaPosition.x+=1),this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=ft.temp_v2.copy(this.deltaPosition);
3222r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*e*.06,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*e*.06,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}};me(ft,"KEYS",{LEFT:[new KeyCombination("ArrowLeft"),new KeyCombination("KeyA")],UP:[new KeyCombination("ArrowUp"),new KeyCombination("KeyW")],RIGHT:[new KeyCombination("ArrowRight"),new KeyCombination("KeyD")],DOWN:[new KeyCombination("ArrowDown"),new KeyCombination("KeyS")]}),me(ft,"temp_v2",new Vector2);let KeyMoveControls=ft;const Rt=class Rt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...Rt.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneDown(e,...Rt.KEYS.DOWN)&&(this.down=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Rt.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...Rt.KEYS.DOWN)&&(this.down=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1});this.target=e,this.manager=null,this.deltaAngle=0,this.up=!1,this.down=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaAngle-=1),this.down&&(this.deltaAngle+=1),this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*e*.06,this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8),this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}};me(Rt,"KEYS",{UP:[new KeyCombination("ArrowUp",KeyCombination.ALT),new KeyCombination("KeyW",KeyCombination.ALT),new KeyCombination("PageUp")],DOWN:[new KeyCombination("ArrowDown",KeyCombination.ALT),new KeyCombination("KeyS",KeyCombination.ALT),new KeyCombination("PageDown")]});let KeyAngleControls=Rt;const It=class It{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...It.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneDown(e,...It.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...It.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...It.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaRotation=0,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.left&&(this.deltaRotation+=1),this.right&&(this.deltaRotation-=1),this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed*e*.06,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}};me(It,"KEYS",{LEFT:[new KeyCombination("ArrowLeft",KeyCombination.ALT),new KeyCombination("KeyA",KeyCombination.ALT),new KeyCombination("Delete")],RIGHT:[new KeyCombination("ArrowRight",KeyCombination.ALT),new KeyCombination("KeyD",KeyCombination.ALT),new KeyCombination("End")]});let KeyRotateControls=It;const Dt=class Dt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...Dt.KEYS.IN)&&(this.in=!0,e.preventDefault()),KeyCombination.oneDown(e,...Dt.KEYS.OUT)&&(this.out=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Dt.KEYS.IN)&&(this.in=!1),KeyCombination.oneUp(e,...Dt.KEYS.OUT)&&(this.out=!1)});me(this,"onStop",e=>{this.in=!1,this.out=!1});this.target=e,this.manager=null,this.deltaZoom=0,this.in=!1,this.out=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.in&&(this.deltaZoom-=1),this.out&&(this.deltaZoom+=1),this.deltaZoom===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.distance*=Math.pow(1.5,this.deltaZoom*i*this.speed*e*.06),this.manager.angle=Math.min(this.manager.angle,MapControl
3222s.getMaxPerspectiveAngleForDistance(this.manager.distance)),this.deltaZoom*=1-i,Math.abs(this.deltaZoom)<1e-4&&(this.deltaZoom=0)}};me(Dt,"KEYS",{IN:[new KeyCombination("NumpadAdd"),new KeyCombination("Insert")],OUT:[new KeyCombination("NumpadSubtract"),new KeyCombination("Home")]});let KeyZoomControls=Dt;const Vt=class Vt{constructor(e,t,i,r){me(this,"onTouchDown",e=>{e.pointerType!=="mouse"&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.center.x,e.center.y))});me(this,"onTouchMove",e=>{if(e.pointerType==="mouse")return;let t=Vt.tempVec2_1.set(e.center.x,e.center.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onTouchUp",e=>{e.pointerType!=="mouse"&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("movestart",this.onTouchDown),this.hammer.on("movemove",this.onTouchMove),this.hammer.on("moveend",this.onTouchUp),this.hammer.on("movecancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("movestart",this.onTouchDown),this.hammer.off("movemove",this.onTouchMove),this.hammer.off("moveend",this.onTouchUp),this.hammer.off("movecancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=Vt.tempVec2_1.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierX,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierY,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(Vt,"tempVec2_1",new Vector2);let TouchMoveControls=Vt;class TouchRotateControls{constructor(e,t,i){me(this,"onTouchDown",e=>{this.moving=!0,this.deltaRotation=0,this.lastRotation=e.rotation});me(this,"onTouchMove",e=>{if(this.moving){let t=e.rotation-this.lastRotation;t>180&&(t-=360),t<-180&&(t+=360),this.deltaRotation-=t}this.lastRotation=e.rotation});me(this,"onTouchUp",e=>{this.moving=!1});this.hammer=e,this.manager=null,this.moving=!1,this.lastRotation=0,this.deltaRotation=0,this.speed=t,this.stiffness=i}start(e){this.manager=e,this.hammer.on("rotatestart",this.onTouchDown),this.hammer.on("rotatemove",this.onTouchMove),this.hammer.on("rotateend",this.onTouchUp),this.hammer.on("rotatecancel",this.onTouchUp)}stop(){this.hammer.off("rotatestart",this.onTouchDown),this.hammer.off("rotatemove",this.onTouchMove),this.hammer.off("rotateend",this.onTouchUp),this.hammer.off("rotatecancel",this.onTouchUp)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}}class TouchAngleControls{constructor(e,t,i,r){me(this,"onTouchDown",e=>{this.moving=!0,this.deltaAngle=0,this.lastY=e.center.y});me(this,"onTouchMove",e=>{this.moving&&(this.deltaAngle-=e.center.y-this.lastY),this.lastY=e.center.y});me(this,"onTouchUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("tiltstart",this.onTouchDown),this.hammer.on("tiltmove",this.onTouchMove),this.hammer.on("tiltend",this.onTouchUp
3222),this.hammer.on("tiltcancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("tiltstart",this.onTouchDown),this.hammer.off("tiltmove",this.onTouchMove),this.hammer.off("tiltend",this.onTouchUp),this.hammer.off("tiltcancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*this.pixelToSpeedMultiplierY,this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8),this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}}class TouchZoomControls{constructor(e){me(this,"onTouchDown",e=>{this.moving=!0,this.lastZoom=1});me(this,"onTouchMove",e=>{this.moving&&(this.deltaZoom*=e.scale/this.lastZoom,this.manager.angle=Math.min(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance))),this.lastZoom=e.scale});me(this,"onTouchUp",e=>{this.moving=!1});this.hammer=e,this.manager=null,this.moving=!1,this.deltaZoom=1,this.lastZoom=1}start(e){this.manager=e,this.hammer.on("zoomstart",this.onTouchDown),this.hammer.on("zoommove",this.onTouchMove),this.hammer.on("zoomend",this.onTouchUp),this.hammer.on("zoomcancel",this.onTouchUp)}stop(){this.hammer.off("zoomstart",this.onTouchDown),this.hammer.off("zoommove",this.onTouchMove),this.hammer.off("zoomend",this.onTouchUp),this.hammer.off("zoomcancel",this.onTouchUp)}update(e,t){this.deltaZoom!==1&&(this.manager.distance/=this.deltaZoom,this.deltaZoom=1)}reset(){this.deltaZoom=1}}const HALF_PI=Math.PI*.5,HALF_PI_DIV=1/HALF_PI,Ut=class Ut{constructor(e,t){me(this,"onContextMenu",e=>{e.preventDefault()});me(this,"onTap",e=>{let t=!1,i=new Vector2(e.center.x,e.center.y),r=Date.now();this.lastTap>0&&this.lastTapCenter&&r-this.lastTap<500&&this.lastTapCenter.distanceTo(i)<5?(t=!0,this.lastTap=-1):(this.lastTap=r,this.lastTapCenter=i),this.manager.handleMapInteraction(new Vector2(e.center.x,e.center.y),{doubleTap:t})});this.rootElement=e,this.scrollCaptureElement=t,this.data=reactive({followingPlayer:null}),this.manager=null,this.hammer=new hammerExports.Manager(this.rootElement),this.initializeHammer(),this.mouseMove=new MouseMoveControls(this.rootElement,1.5,.3),this.mouseRotate=new MouseRotateControls(this.rootElement,6,.3),this.mouseAngle=new MouseAngleControls(this.rootElement,3,.3),this.mouseZoom=new MouseZoomControls(this.scrollCaptureElement,1,.2),this.keyMove=new KeyMoveControls(this.rootElement,.025,.2),this.keyRotate=new Key
3222RotateControls(this.rootElement,.06,.15),this.keyAngle=new KeyAngleControls(this.rootElement,.04,.15),this.keyZoom=new KeyZoomControls(this.rootElement,.2,.15),this.touchMove=new TouchMoveControls(this.rootElement,this.hammer,1.5,.3),this.touchRotate=new TouchRotateControls(this.hammer,.0174533,.3),this.touchAngle=new TouchAngleControls(this.rootElement,this.hammer,3,.3),this.touchZoom=new TouchZoomControls(this.hammer),this.mapHeight=new MapHeightControls(.2,.1),this.lastTap=-1,this.lastTapCenter=null,this.minDistance=5,this.maxDistance=1e5}start(e){this.manager=e,this.rootElement.addEventListener("contextmenu",this.onContextMenu),this.hammer.on("tap",this.onTap),this.mouseMove.start(e),this.mouseRotate.start(e),this.mouseAngle.start(e),this.mouseZoom.start(e),this.keyMove.start(e),this.keyRotate.start(e),this.keyAngle.start(e),this.keyZoom.start(e),this.touchMove.start(e),this.touchRotate.start(e),this.touchAngle.start(e),this.touchZoom.start(e),this.mapHeight.start(e)}stop(){this.stopFollowingPlayerMarker(),this.rootElement.removeEventListener("contextmenu",this.onContextMenu),this.hammer.off("tap",this.onTap),this.mouseMove.stop(),this.mouseRotate.stop(),this.mouseAngle.stop(),this.mouseZoom.stop(),this.keyMove.stop(),this.keyRotate.stop(),this.keyAngle.stop(),this.keyZoom.stop(),this.touchMove.stop(),this.touchRotate.stop(),this.touchAngle.stop(),this.touchZoom.stop(),this.mapHeight.stop()}update(e,t){this.manager.position.y=-1e4,Ut._beforeMoveTemp.copy(this.manager.position),this.mouseMove.update(e,t),this.keyMove.update(e,t),this.touchMove.update(e,t),this.data.followingPlayer&&!Ut._beforeMoveTemp.equals(this.manager.position)&&this.stopFollowingPlayerMarker(),this.data.followingPlayer&&this.manager.position.copy(this.data.followingPlayer.position),this.mouseZoom.update(e,t),this.keyZoom.update(e,t),this.touchZoom.update(e,t),this.manager.distance=softClamp(this.manager.distance,this.minDistance,this.maxDistance,.8),this.mouseRotate.update(e,t),this.keyRotate.update(e,t),this.touchRotate.update(e,t);const i=this.mouseRotate.moving||this.touchRotate.moving||this.keyRotate.left||this.keyRotate.right;this.manager.ortho!==0&&Math.abs(this.manager.rotation)<(i?.05:.3)&&(this.manager.rotation=softClamp(this.manager.rotation,0,0,.1)),this.manager.ortho===0&&(this.mouseAngle.update(e,t),this.keyAngle.update(e,t),this.touchAngle.update(e,t),this.manager.angle=softClamp(this.manager.angle,0,HALF_PI,.8)),(this.manager.ortho===0||this.manager.angle===0)&&this.mapHeight.update(e,t)}reset(){this.mouseMove.reset(),this.mouseRotate.reset(),this.mouseAngle.reset(),this.mouseZoom.reset(),this.touchMove.reset(),this.touchRotate.reset(),this.touchAngle.reset(),this.touchZoom.reset()}static getMaxPerspectiveAngleForDistance(e){return MathUtils.clamp((1-Math.pow(Math.max(e-5,.001)*5e-4,.5))*HALF_PI,0,HALF_PI)}static getMaxDistanceForPerspectiveAngle(e){return Math.pow(-(e*HALF_PI_DIV)+1,2)*2e3+5}initializeHammer(){let e=new hammerExports.Tap({event:"tap",pointers:1,taps:1,threshold:5}),t=new hammerExports.Pan({event:"move",pointers:1,direction:hammerExports.DIRECTION_ALL,threshold:0}),i=new hammerExports.Pan({event:"tilt",pointers:2,direction:hammerExports.DIRECTION_VERTICAL,threshold:0}),r=new hammerExports.Rotate({event:"rotate",pointers:2,threshold:0}),s=new hammerExports.Pinch({event:"zoom",pointers:2,threshold:0});t.recognizeWith(r),t.recognizeWith(i),t.recognizeWith(s),i.recognizeWith(r),i.recognizeWith(s),r.recognizeWith(s),this.hammer.add(e),this.hammer.add(i),this.hammer.add(t),this.hammer.add(r),this.hammer.add(s)}followPlayerMarker(e){e.isPlayerMarker&&(e=e.data),this.data.followingPlayer=e}stopFollowingPlayerMarker(){this.data.followingPlayer=null}};me(Ut,"_beforeMoveTemp",new Vector3);let MapControls=Ut;class Tile{constructor(e,t,i,r){Object.defineProperty(this,"isTile",{value:!0}),this.model=null,this.onLoad=i,this.onUnload=r,this.x=e,this.z=t,this.unloaded=!0,this.loading=!1}load(e){return this.loading?Promise.reject("tile is already loading!"):(this.loading=!0,this.unload(),this.unloaded=!1,e.load(this.x,this.z,()=>this.unloaded).then(t=>{if(this.unloaded){Tile.disposeModel(t);return}this.model=t,this.onLoad(this)},()=>{this.unload()}).finally(()=>{this.loading=!1}))}unload(){this.unloaded=!0,this.model&&(this.onUnload(this),Tile.disposeModel(this.model),this.model=null)}static disposeModel(e){var t,i;
3222((t=e.userData)==null?void 0:t.tileType)==="hires"?e.geometry.dispose():((i=e.userData)==null?void 0:i.tileType)==="lowres"&&(e.material.uniforms.textureImage.value.dispose(),e.material.dispose())}get loaded(){return!!this.model}}class TileMap{constructor(e,t){this.canvas=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.canvas.width=e,this.canvas.height=t,this.tileMapContext=this.canvas.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.texture=new Texture(this.canvas),this.texture.generateMipmaps=!1,this.texture.magFilter=LinearFilter,this.texture.minFilter=LinearFilter,this.texture.wrapS=ClampToEdgeWrapping,this.texture.wrapT=ClampToEdgeWrapping,this.texture.flipY=!1,this.texture.needsUpdate=!0}setAll(e){this.tileMapContext.fillStyle=e,this.tileMapContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.texture.needsUpdate=!0}setTile(e,t,i){this.tileMapContext.fillStyle=i,this.tileMapContext.fillRect(e,t,1,1),this.texture.needsUpdate=!0}}me(TileMap,"EMPTY","#000"),me(TileMap,"LOADED","#fff");const pt=class pt{constructor(e,t=null,i=null,r=null){me(this,"loadCloseTiles",()=>{this.unloaded||this.loadNextTile()&&(this.loadTimeout&&clearTimeout(this.loadTimeout),this.currentlyLoading<8?this.loadTimeout=setTimeout(this.loadCloseTiles,0):this.loadTimeout=setTimeout(this.loadCloseTiles,1e3))});me(this,"handleLoadedTile",e=>{this.tileMap.setTile(e.x-this.centerTile.x+pt.tileMapHalfSize,e.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.LOADED),this.scene.add(e.model),this.onTileLoad(e)});me(this,"handleUnloadedTile",e=>{this.tileMap.setTile(e.x-this.centerTile.x+pt.tileMapHalfSize,e.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.EMPTY),this.scene.remove(e.model),this.onTileUnload(e)});Object.defineProperty(this,"isTileManager",{value:!0}),this.sceneParent=new Scene,this.scene=new Group$1,this.sceneParent.add(this.scene),this.events=r,this.tileLoader=e,this.onTileLoad=t||function(){},this.onTileUnload=i||function(){},this.viewDistanceX=1,this.viewDistanceZ=1,this.centerTile=new Vector2(0,0),this.currentlyLoading=0,this.loadTimeout=null,this.tiles=new Map,this.tileMap=new TileMap(pt.tileMapSize,pt.tileMapSize),this.unloaded=!0}loadAroundTile(e,t,i,r){this.unloaded=!1;let s=!1;if((this.viewDistanceX>i||this.viewDistanceZ>r)&&(s=!0),this.viewDistanceX=i,this.viewDistanceZ=r,i<=0||r<=0){this.removeAllTiles();return}(s||this.centerTile.x!==e||this.centerTile.y!==t)&&(this.centerTile.set(e,t),this.removeFarTiles(),this.tileMap.setAll(TileMap.EMPTY),this.tiles.forEach(a=>{!a.loading&&!a.unloaded&&this.tileMap.setTile(a.x-this.centerTile.x+pt.tileMapHalfSize,a.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.LOADED)})),this.loadCloseTiles()}unload(){this.unloaded=!0,this.removeAllTiles()}removeFarTiles(){this.tiles.forEach((e,t,i)=>{(e.x+this.viewDistanceX<this.centerTile.x||e.x-this.viewDistanceX>this.centerTile.x||e.z+this.viewDistanceZ<this.centerTile.y||e.z-this.viewDistanceZ>this.centerTile.y)&&(e.unload(),i.delete(t))})}removeAllTiles(){this.tileMap.setAll(TileMap.EMPTY),this.tiles.forEach(e=>{e.unload()}),this.tiles.clear()}loadNextTile(){if(this.unloaded)return!1;let e=0,t=0,i=1,r=1;for(;r<Math.max(this.viewDistanceX,this.viewDistanceZ)*2+1;){for(;2*e*i<r;){if(this.tryLoadTile(this.centerTile.x+e,this.centerTile.y+t))return!0;e=e+i}for(;2*t*i<r;){if(this.tryLoadTile(this.centerTile.x+e,this.centerTile.y+t))return!0;t=t+i}i=-1*i,r=r+1}return!1}tryLoadTile(e,t){if(this.unloaded||Math.abs(e-this.centerTile.x)>this.viewDistanceX||Math.abs(t-this.centerTile.y)>this.viewDistanceZ)return!1;let i=hashTile(e,t),r=this.tiles.get(i);return r!==void 0?!1:(this.currentlyLoading++,r=new Tile(e,t,this.handleLoadedTile,this.handleUnloadedTile),this.tiles.set(i,r),r.load(this.tileLoader).then(()=>{dispatchEvent(this.events,"bluemapTileLoaded",{tileManager:this,tile:r}),this.loadTimeout&&clearTimeout(this.loadTimeout),this.loadTimeout=setTimeout(this.loadCloseTiles,0)}).catch(s=>{}).finally(()=>{this.currentlyLoading--}),!0)}};me(pt,"tileMapSize",100),me(pt,"tileMapHalfSize",pt.tileMapSize/2);let TileManager=pt,bigEndianPlatform=null;function isBigEndianPlatform(){if(bigEndianPlatform===null){let n=new ArrayBuffer(2),e=new Uint8Array(n),t=new Uint16Array(n);e[0]=170,e[1]=187,bigEndianPlatform=t[0]===43707}return bigEndianPlatform}let InvertedEncodingTypes=[null,Float32Array,null,Int8Array,Int16Array,null,Int32Array,Uint8Array,Uint16Array,null,Uint32Array],getMethods={Uint16Array:"getUint16",Uint32Array:"getUint32",Int16Array:"getInt16",Int32Array:"getInt32",Float32Array:"getFloat32",Float64Array:"getFloat64"};function copyFromBuffer(n,e,t,i,r){let s=e.BYTES_PER_ELEMENT,a;
3222if(r===isBigEndianPlatform()||s===1)a=new e(n,t,i);else{console.debug("PRWM file has opposite encoding, loading will be slow...");let o=new DataView(n,t,i*s),l=getMethods[e.name],c=!r,u=0;for(a=new e(i);u<i;u++)a[u]=o[l](u*s,c)}return a}function decodePrwm(n,e){e=e||0;let t=new Uint8Array(n,e),i=t[0],r=t[1],s=!!(r>>7&1),a=r>>6&1,o=(r>>5&1)===1,l=r&31,c=0,u=0;if(o?(c=(t[2]<<16)+(t[3]<<8)+t[4],u=(t[5]<<16)+(t[6]<<8)+t[7]):(c=t[2]+(t[3]<<8)+(t[4]<<16),u=t[5]+(t[6]<<8)+(t[7]<<16)),e/4%1!==0)throw new Error("PRWM decoder: Offset should be a multiple of 4, received "+e);if(i===0)throw new Error("PRWM decoder: Invalid format version: 0");if(i!==1)throw new Error("PRWM decoder: Unsupported format version: "+i);if(!s){if(a!==0)throw new Error("PRWM decoder: Indices type must be set to 0 for non-indexed geometries");if(u!==0)throw new Error("PRWM decoder: Number of indices must be set to 0 for non-indexed geometries")}let d=8,f={},m,v,_,g,x,S,y,b,w,C,R,M;for(M=0;M<l;M++){for(m="";d<t.length&&(v=t[d],d++,v!==0);)m+=String.fromCharCode(v);r=t[d],_=r>>7&1,S=r>>6&1,g=(r>>4&3)+1,x=r&15,y=InvertedEncodingTypes[x],d++,d=Math.ceil(d/4)*4,b=copyFromBuffer(n,y,d+e,g*c,o),d+=y.BYTES_PER_ELEMENT*g*c,f[m]={type:_,cardinality:g,values:b,normalized:S===1}}for(w=null,s&&(d=Math.ceil(d/4)*4,w=copyFromBuffer(n,a===1?Uint32Array:Uint16Array,d+e,u,o)),C=[],d=Math.ceil(d/4)*4;d<t.length;){if(R=read4ByteInt(t,d),R===-1){d+=4;break}C.push({materialIndex:R,start:read4ByteInt(t,d+4),count:read4ByteInt(t,d+8)}),d+=12}return{version:i,attributes:f,indices:w,groups:C}}function read4ByteInt(n,e){return n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24}class PRBMLoader{constructor(e){this.manager=e!==void 0?e:DefaultLoadingManager}load(e,t,i,r){let s=this;e=e.replace(/\*/g,isBigEndianPlatform()?"be":"le");let a=new FileLoader(s.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.load(e,function(o){t(s.parse(o))},i,r)}setPath(e){return this.path=e,this}parse(e,t){let i=decodePrwm(e,t),r=Object.keys(i.attributes),s=new BufferGeometry,a,o,l;for(l=0;l<r.length;l++)a=i.attributes[r[l]],o=new BufferAttribute(a.values,a.cardinality,a.normalized),o.gpuType=FloatType,s.setAttribute(r[l],o);return i.indices!==null&&s.setIndex(new BufferAttribute(i.indices,1)),s.groups=i.groups,s}isBigEndianPlatform(){return isBigEndianPlatform()}}class TileLoader{constructor(e,t,i,r=()=>Promise.resolve(),s=0){me(this,"load",(e,t,i=()=>!1)=>{let r=this.tilePath+pathFromCoords(e,t)+".prbm";return new Promise((s,a)=>{this.fileLoader.load(r+"?"+this.tileCacheHash,async o=>{if(await this.loadBlocker(),i()){a({status:"cancelled"});return}let l=this.bufferGeometryLoader.parse(o),c=new Mesh(l,this.material),u=this.tileSettings.tileSize,d=this.tileSettings.translate,f=this.tileSettings.scale;c.position.set(e*u.x+d.x,0,t*u.z+d.z),c.scale.set(f.x,1,f.z),c.userData.tileUrl=r,c.userData.tileType="hires",c.updateMatrixWorld(!0),s(c)},()=>{},a)})});Object.defineProperty(this,"isTileLoader",{value:!0}),this.tilePath=e,this.material=t,this.tileSettings=i,this.tileCacheHash=s,this.loadBlocker=r,this.fileLoader=new FileLoader$1,this.fileLoader.setResponseType("arraybuffer"),this.bufferGeometryLoader=new PRBMLoader}}class LowresTileLoader{constructor(e,t,i,r,s,a,o=()=>Promise.resolve(),l=0){me(this,"load",(e,t,i=()=>!1)=>{let r=this.tilePath+this.lod+"/"+pathFromCoords(e,t)+".png";return new Promise((s,a)=>{this.textureLoader.load(r+"?"+this.tileCacheHash,async o=>{if(o.anisotropy=1,o.generateMipmaps=!1,o.magFilter=NearestFilter,o.minFilter=o.generateMipmaps?NearestMipMapLinearFilter:NearestFilter,o.wrapS=ClampToEdgeWrapping,o.wrapT=ClampToEdgeWrapping,o.flipY=!1,o.flatShading=!0,await this.loadBlocker(),i()){o.dispose(),a({status:"cancelled"});return}const l=Math.pow(this.tileSettings.lodFactor,this.lod-1);let c=new ShaderMaterial({uniforms:{...this.uniforms,tileSize:{value:new Vector2(this.tileSettings.tileSize.x,this.tileSettings.tileSize.z)},textureSize:{value:new Vector2(o.image.width,o.image.height)},textureImage:{type:"t",value:o},lod:{value:this.lod},lodScale:{value:l}},vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1}),u=new Mesh(this.geometry,c);u.position.set(e*this.tileSettings.tileSize.x*l,0,t*this.tileSettings.tileSize.z*l),u.scale.set(l,1,l),u.userData.tileUrl=r,u.userData.tileType="lowres",u.updateMatrixWorld(!0),s(u)},void 0,a)})});Object.defineProperty(this,"isLowresTileLoader",{value:!0}),this.tilePath=e,this.tileSettings=t,this.lod=i,this.loadBlocker=o,this.tileCacheHash=l,this.vertexShader=r,this.fragmentShader=s,this.uniforms=a,this.textureLoader=new TextureLoader,this.geometry=new PlaneGeometry(t.tileSize.x+1,t.tileSize.z+1,Math.ceil(100/(i*2)),Math.ceil(100/(i*2))),this.geometry.deleteAttribute("normal"),this.geometry.deleteAttribute("uv"),this.geometry.rotateX(-Math.PI/2),this.geometry.translate(t.tileSize.x/2+1,0,t.tileSize.x/2+1)}}class TextureAnimation{constructor(e,t){this.uniforms=e,this.data={interpolate:!1,width:1,height:1,frametime:1,...t},this.frameImages=1,this.frameDelta=0,this.frameTime=this.data.frametime*50,this.frames=1,this.frameIndex=0}init(e,t){this.frameImages=t/e,this.uniforms.animationFrameHeight.value=1/this.frameImages,this.frames=this.frameImages,this.data.frames&&this.data.frames.length>0?this.frames=this.data.frames.length:this.data.frames=null}step(e){if(this.frameDelta+=e,this.frameDelta>this.frameTime)if(this.frameDelta-=this.frameTime,this.frameDelta%=this.frameTime,this.frameIndex++,this.frameIndex%=this.frames,this.data.frames){let t=this.data.frames[this.frameIndex],i=this.data.frames[(this.frameIndex+1)%this.frames];this.uniforms.animationFrameIndex.value=t.index,this.uniforms.animationInterpolationFrameIndex.value=i.index,this.frameTime=t.time*50}else this.uniforms.animationFrameIndex.value=this.frameIndex,this.uniforms.animationInterpolationFrameIndex.value=(this.frameIndex+1)%this.frames;this.data.interpolate&&(this.uniforms.animationInterpolation.value=this.frameDelta/this.frameTime)}}let Map$1=class{constructor(e,t,i,r,s=null){me(this,"onTileLoad",e=>t=>{dispatchEvent(this.events,"bluemapMapTileLoaded",{tile:t,layer:e})});me(this,"onTileUnload",e=>t=>{dispatchEvent(this.events,"bluemapMapTileUnloaded",{tile:t,layer:e})});Object.defineProperty(this,"isMap",{value:!0}),this.loadBlocker=r,this.events=s,this.data=reactive({id:e,sorting:1e6,mapDataRoot:t,liveDataRoot:i,settingsUrl:t+"/settings.json",texturesUrl:t+"/textures.json",name:e,startPos:{x:0,z:0},skyColor:new Color,voidColor:new Color(0,0,0),ambientLight:0,skyLight:1,hires:{tileSize:{x:32,z:32},scale:{x:1,z:1},translate:{x:2,z:2}},lowres:{tileSize:{x:32,z:32},lodFactor:5,lodCount:3},perspectiveView:!1,flatView:!1,freeFlightView:!1,views:["perspective","flat","free"]}),this.raycaster=new Raycaster,this.hiresMaterial=null,this.lowresMaterial=null,this.loadedTextures=[],this.animations=[],this.hiresTileManager=null,this.lowresTileManager=null}load(e,t,i,r,s,a=0){this.unload();let o=this.loadSettings(a),l=this.loadTexturesFile(a);return this.lowresMaterial=this.createLowresMaterial(i,r,s),Promise.all([o,l]).then(c=>{let u=c[1];if(u===null)throw new Error("Failed to parse textures.json!");this.hiresMaterial=this.createHiresMaterial(e,t,s,u),this.hiresTileManager=new TileManager(new TileLoader(`${this.data.mapDataRoot}/tiles/0/`,this.hiresMaterial,this.data.hires,this.loadBlocker,a),this.onTileLoad("hires"),this.onTileUnload("hires"),this.events),this.hiresTileManager.scene.matrixWorldAutoUpdate=!1,this.lowresTileManager=[];for(let d=0;d<this.data.lowres.lodCount;d++)this.lowresTileManager[d]=new TileManager(new LowresTileLoader(`${this.data.mapDataRoot}/tiles/`,this.data.lowres,d+1,i,r,s,async()=>{},a),this.onTileLoad("lowres"),this.onTileUnload("lowres"),this.events),this.lowresTileManager[d].scene.matrixWorldAutoUpdate=!1;alert(this.events,`Map '${this.data.id}' is loaded.`,"fine")})}loadSettings(e){return this.loadSettingsFile(e).then(t=>{this.data.name=t.name?t.name:this.data.name,this.data.sorting=Number.isInteger(t.sorting)?t.sorting:this.data.sorting,this.data.startPos={...this.data.startPos,...vecArrToObj(t.startPos,!0)},t.skyColor&&t.skyColor.length>=3&&this.data.skyColor.setRGB(t.skyColor[0],t.skyColor[1],t.skyColor[2]),t.voidColor&&t.voidColor.length>=3&&this.data.voidColor.setRGB(t.voidColor[0],t.voidColor[1],t.voidColor[2]),this.data.ambientLight=t.ambientLight?t.ambientLight:this.data.ambientLight,this.data.skyLight=t.skyLight?t.skyLight:this.data.skyLight,t.hires===void 0&&(t.hires={}),t.lowres===void 0&&(t.lowres={}),this.data.hires={tileSize:{...this.data.hires.tileSize,...vecArrToObj(t.hires.tileSize,!0)},scale:{...this.data.hires.scale,...vecArrToObj(t.hires.scale,!0)},translate:{...this.data.hires.translate,...vecArrToObj(t.hires.translate,!0)}},this.data.lowres={tileSize:{...this.data.lowres.tileSize,...vecArrToObj(t.lowres.tileSize,!0)},lodFactor:t.lowres.lodFactor!==void 0?t.lowres.lodFactor:this.data.lowres.lodFactor,lodCount:t.lowres.lodCount!==void 0?t.lowres.lodCount:this.data.lowres.lodCount},this.data.perspectiveView=t.perspectiveView!==void 0?t.perspectiveView:this.data.perspectiveView,this.data.flatView=t.flatView!==void 0?t.flatView:this.data.flatView,this.data.freeFlightView=t.freeFlightView!==void 0?t.freeFlightView:this.data.freeFlightView,this.data.views=[],this.data.perspectiveView&&this.data.views.push("perspective"),this.data.flatView&&this.data.views.push("flat"),this.data.freeFlightView&&this.data.views.push("free"),alert(this.events,`Settings for map '${this.data.id}' loaded.`,"fine")})}loadMapArea(e,t,i,r){if(!this.isLoaded)return;for(let c=this.lowresTileManager.length-1;c>=0;c--){const u=c+1,d=Math.pow(this.data.lowres.lodFactor,u-1),f=Math.floor(e/(this.data.lowres.tileSize.x*d)),m=Math.floor(t/(this.data.lowres.tileSize.z*d)),v=Math.floor(r/this.data.lowres.tileSize.x),_=Math.floor(r/this.data.lowres.tileSize.z);this.lowresTileManager[c].loadAroundTile(f,m,v,_)}const s=Math.floor((e-this.data.hires.translate.x)/this.data.hires.tileSize.x),a=Math.floor((t-this.data.hires.translate.z)/this.data.hires.tileSize.z),o=Math.floor(i/this.data.hires.tileSize.x),l=Math.floor(i/this.data.hires.tileSize.z);this.hiresTileManager.loadAroundTile(s,a,o,l)}loadSettingsFile(e){return new Promise((t,i)=>{alert(this.events,`Loading settings for map '${this.data.id}'...`,"fine");let r=new FileLoader$1;r.setResponseType("json"),r.load(this.data.settingsUrl+"?"+e,t,()=>{},()=>i(`Failed to load the settings.json for map: ${this.data.id}`))})}loadTexturesFile(e){return new Promise((t,i)=>{alert(this.events,`Loading textures for map '${this.data.id}'...`,"fine");let r=new FileLoader$1;r.setResponseType("json"),r.load(this.data.texturesUrl+"?"+e,t,()=>{},()=>i(`Failed to load the textures.json for map: ${this.data.id}`))})}createHiresMaterial(e,t,i,r){let s=[];if(!Array.isArray(r))throw new Error("Invalid texture.json: 'textures' is not an array!");for(let a=0;a<r.length;a++){let o=r[a],l=o.color;(!Array.isArray(l)||l.length<4)&&(l=[0,0,0,0]);let c=l[3]===1,u=!!o.halfTransparent,d=new Texture;
3222d.image=stringToImage(o.texture),d.anisotropy=1,d.generateMipmaps=c||u,d.magFilter=NearestFilter,d.minFilter=d.generateMipmaps?NearestMipMapLinearFilter:NearestFilter,d.wrapS=ClampToEdgeWrapping,d.wrapT=ClampToEdgeWrapping,d.flipY=!1,d.flatShading=!0;let f={animationFrameHeight:{value:1},animationFrameIndex:{value:0},animationInterpolationFrameIndex:{value:0},animationInterpolation:{value:0}},m=null;o.animation&&(m=new TextureAnimation(f,o.animation),this.animations.push(m)),d.image.addEventListener("load",()=>{d.needsUpdate=!0,m&&m.init(d.image.naturalWidth,d.image.naturalHeight)}),this.loadedTextures.push(d);let v=new ShaderMaterial({uniforms:{...i,textureImage:{type:"t",value:d},...f},vertexShader:e,fragmentShader:t,transparent:u,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1});v.needsUpdate=!0,s[a]=v}return s}createLowresMaterial(e,t,i){return new ShaderMaterial({uniforms:i,vertexShader:e,fragmentShader:t,transparent:!1,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1})}unload(){if(this.hiresTileManager&&this.hiresTileManager.unload(),this.hiresTileManager=null,this.lowresTileManager){for(let e=0;e<this.lowresTileManager.length;e++)this.lowresTileManager[e].unload();this.lowresTileManager=null}this.hiresMaterial&&this.hiresMaterial.forEach(e=>e.dispose()),this.hiresMaterial=null,this.lowresMaterial&&this.lowresMaterial.dispose(),this.lowresMaterial=null,this.loadedTextures.forEach(e=>e.dispose()),this.loadedTextures=[],this.animations=[]}terrainHeightAt(e,t){var s,a,o;if(!this.isLoaded)return!1;this.raycaster.set(new Vector3(e,300,t),new Vector3(0,-1,0)),this.raycaster.near=1,this.raycaster.far=300,this.raycaster.layers.enableAll();let i=hashTile(Math.floor((e-this.data.hires.translate.x)/this.data.hires.tileSize.x),Math.floor((t-this.data.hires.translate.z)/this.data.hires.tileSize.z)),r=this.hiresTileManager.tiles.get(i);if(r!=null&&r.model)try{let l=this.raycaster.intersectObjects([r.model]);if(l.length>0)return l[0].point.y}catch{}for(let l=0;l<this.lowresTileManager.length;l++){const c=l+1,u=Math.pow(this.data.lowres.lodFactor,c-1),d={x:this.data.lowres.tileSize.x*u,z:this.data.lowres.tileSize.z*u},f=Math.floor(e/d.x),m=Math.floor(t/d.z);let v=hashTile(f,m);if(r=this.lowresTileManager[l].tiles.get(v),!r||!r.model)continue;const _=(o=(a=(s=r.model.material.uniforms)==null?void 0:s.textureImage)==null?void 0:a.value)==null?void 0:o.image;if(_==null)continue;const g=getPixel(_,e-f*d.x,t-m*d.z+this.data.lowres.tileSize.z+1);let x=g[1]*256+g[2];return x>=32768?-(65535-x):x}return!1}hasView(e){return this.data.views.some(t=>t===e)}dispose(){this.unload()}get isLoaded(){return!!(this.hiresMaterial&&this.lowresMaterial)}};class ControlsManager{constructor(e,t){Object.defineProperty(this,"isControlsManager",{value:!0}),this.data=reactive({mapViewer:null,camera:null,controls:null,position:new Vector3(0,0,0),rotation:0,angle:0,tilt:0}),this.mapViewer=e,this.camera=t,this.lastPosition=this.position.clone(),this.lastRotation=this.rotation,this.lastAngle=this.angle,this.lastDistance=this.distance,this.lastOrtho=this.ortho,this.lastTilt=this.tilt,this.lastMapUpdatePosition=null,this.lastMapUpdateDistance=null,this.averageDeltaTime=16,this._controls=null,this.distance=300,this.position.set(0,0,0),this.rotation=0,this.angle=0,this.tilt=0,this.ortho=0,this.updateCamera()}update(e,t){e>50&&(e=50),this.averageDeltaTime=this.averageDeltaTime*.9+e*.1,this._controls&&this._controls.update(this.averageDeltaTime,t),this.updateCamera()}updateCamera(){let e=this.isValueChanged();if(e){for(this.resetValueChanged();this.rotation>=Math.PI;)this.rotation-=Math.PI*2;for(;this.rotation<=-Math.PI;)this.rotation+=Math.PI*2;let t=this.angle;Math.abs(t)<=1e-4?t=1e-4:Math.abs(t)-Math.PI<=1e-4&&(t=t-1e-4);let i=this.distance;Math.abs(i)<=1e-4&&(i=1e-4),this.ortho>0&&(i=MathUtils.lerp(i,Math.max(i,300),Math.pow(this.ortho,8)));let r=new Vector3(Math.sin(this.rotation),0,-Math.cos(this.rotation)),s=new Vector3(0,1,0).cross(r);if(r.applyAxisAngle(s,Math.PI/2-t),r.multiplyScalar(i),this.camera.rotation.set(0,0,0),this.camera.position.copy(this.position).sub(r),this.camera.lookAt(this.position),this.camera.rotateZ(this.tilt+t<0?Math.PI:0),this.ortho<=0){let a=MathUtils.clamp(i/1e3,.01,1),o=MathUtils.clamp(i*2,Math.max(a+1,2e3),i+5e3);o-a>1e4&&(a=o-1e4),this.camera.near=a,this.camera.far=o}else this.angle===0?(this.camera.near=1,this.camera.far=i+300):(this.camera.near=1,this.camera.far=1e5);dispatchEvent(this.mapViewer.events,"bluemapCameraMoved",{controlsManager:this,camera:this.camera})}if(this.mapViewer.map){let t=1;e&&(this.distance>300?t=this.mapViewer.data.loadedLowresViewDistance*.5:t=this.mapViewer.data.loadedHiresViewDistance*.5),(this.lastMapUpdatePosition===null||this.lastMapUpdateDistance===null||Math.abs(this.lastMapUpdatePosition.x-this.position.x)>=t||Math.abs(this.lastMapUpdatePosition.z-this.position.z)>=t||this.distance<1e3&&this.lastMapUpdateDistance>=1e3)&&(this.lastMapUpdatePosition=this.position.clone(),this.lastMapUpdateDistance=this.distance,this.mapViewer.loadMapArea(this.position.x,this.position.z))}}handleMapInteraction(e,t={}){this.mapViewer.handleMapInteraction(e,t)}isValueChanged(){return!(this.data.position.equals(this.lastPosition)&&this.data.rotation===this.lastRotation&&this.data.angle===this.lastAngle&&this.distance===this.lastDistance&&this.ortho===this.lastOrtho&&this.data.tilt===this.lastTilt)}resetValueChanged(){this.lastPosition.copy(this.data.position),this.lastRotation=this.data.rotation,this.lastAngle=this.data.angle,this.lastDistance=this.distance,this.lastOrtho=this.ortho,this.lastTilt=this.data.tilt}get ortho(){return this.camera.ortho}set ortho(e){this.camera.ortho=e}get distance(){return this.camera.distance}set distance(e){this.camera.distance=e}set controls(e){this._controls&&this._controls.stop&&this._controls.stop(),this._controls=e,e&&(this.data.controls=e.data||null),this._controls&&this._controls.start&&this._controls.start(this)}get controls(){return this._controls}get mapViewer(){return this._mapViewer}set mapViewer(e){this._mapViewer=e,this.data.mapViewer=e.data}get camera(){return this._camera}set camera(e){this._camera=e,this.data.camera=e.data}get position(){return this.data.position}set position(e){this.data.position=e}get rotation(){return this.data.rotation}set rotation(e){this.data.rotation=e}get angle(){return this.data.angle}set angle(e){this.data.angle=e}get tilt(){return this.data.tilt}set tilt(e){this.data.tilt=e}}const HIRES_FRAGMENT_SHADER=` 3223${ShaderChunk.logdepthbuf_pars_fragment} 3224 3225#ifndef texture 3226 #define texture texture2D 3227#endif 3228 3229uniform float distance; 3230uniform sampler2D textureImage; 3231uniform float sunlightStrength; 3232uniform float ambientLight; 3233uniform float animationFrameHeight; 3234uniform float animationFrameIndex; 3235uniform float animationInterpolationFrameIndex; 3236uniform float animationInterpolation; 3237uniform bool chunkBorders; 3238 3239varying vec3 vPosition; 3240varying vec3 vWorldPosition; 3241varying vec3 vNormal; 3242varying vec2 vUv; 3243varying vec3 vColor; 3244varying float vAo; 3245varying float vSunlight; 3246varying float vBlocklight; 3247//varying float vDistance; 3248 3249void main() { 3250 3251 vec4 color = texture(textureImage, vec2(vUv.x, animationFrameHeight * (vUv.y + animationFrameIndex))); 3252 if (animationInterpolation > 0.0) { 3253 color = mix(color, texture(textureImage, vec2(vUv.x, animationFrameHeight * (vUv.y + animationInterpolationFrameIndex))), animationInterpolation); 3254 } 3255 3256 if (color.a <= 0.01) discard; 3257 3258 //apply vertex-color 3259 color.rgb *= vColor.rgb; 3260 3261 //apply ao 3262 color.rgb *= vAo; 3263 3264 //apply light 3265 float light = mix(vBlocklight, max(vSunlight, vBlocklight), sunlightStrength); 3266 color.rgb *= mix(ambientLight, 1.0, light / 15.0); 3267 3268 if (chunkBorders) { 3269 vec4 lineColour = vec4(1.0, 0.0, 1.0, 0.4); 3270 float lineInterval = 16.0; 3271 float lineThickness = 0.125; //width of two Minecraft pixels 3272 float offset = 0.5; 3273 3274 vec2 worldPos = vWorldPosition.xz; 3275 worldPos += offset; 3276 float x = abs(mod(worldPos.x, lineInterval) - offset); 3277 float y = abs(mod(worldPos.y, lineInterval) - offset); 3278 bool isChunkBorder = x < lineThickness || y < lineThickness; 3279 3280 //only show line on upwards facing surfaces 3281 bool showChunkBorder = isChunkBorder && vNormal.y > 0.1; 3282
3283 float distFac = smoothstep(200.0, 600.0, distance); 3284 color.rgb = mix(mix(color.rgb, lineColour.rgb, float(showChunkBorder) * lineColour.a), color.rgb, distFac); 3285 } 3286 3287 gl_FragColor = color; 3288 3289 ${ShaderChunk.logdepthbuf_fragment} 3290} 3291`,HIRES_VERTEX_SHADER=` 3292#include <common> 3293${ShaderChunk.logdepthbuf_pars_vertex} 3294 3295const vec2 lightDirection = normalize(vec2(1.0, 0.5)); 3296 3297uniform float distance; 3298 3299attribute float ao; 3300attribute float sunlight; 3301attribute float blocklight; 3302 3303varying vec3 vPosition; 3304varying vec3 vWorldPosition; 3305varying vec3 vNormal; 3306varying vec2 vUv; 3307varying vec3 vColor; 3308varying float vAo; 3309varying float vSunlight; 3310varying float vBlocklight; 3311 3312void main() { 3313 vPosition = position; 3314 vec4 worldPos = modelMatrix * vec4(vPosition, 1); 3315 vWorldPosition = worldPos.xyz; 3316 vNormal = normal; 3317 vUv = uv; 3318 vColor = color; 3319 vAo = ao; 3320 vSunlight = sunlight; 3321 vBlocklight = blocklight; 3322 3323 // apply directional lighting 3324 if (vNormal.y != 0.0 || abs(abs(vNormal.x) - abs(vNormal.z)) != 0.0) { 3325 float distFac = smoothstep(1000.0, 50.0, distance); 3326 vAo *= 1.0 - abs(dot(vNormal.xz, lightDirection)) * 0.4 * distFac; 3327 vAo *= 1.0 - max(0.0, -vNormal.y) * 0.6 * distFac; 3328 } 3329 3330 gl_Position = projectionMatrix * (viewMatrix * modelMatrix * vec4(position, 1)); 3331 3332 ${ShaderChunk.logdepthbuf_vertex} 3333} 3334`,LOWRES_FRAGMENT_SHADER=` 3335${ShaderChunk.logdepthbuf_pars_fragment} 3336 3337#define PI 3.1415926535897932 3338 3339#ifndef texture 3340 #define texture texture2D 3341#endif 3342 3343struct TileMap { 3344 sampler2D map; 3345 float size; 3346 vec2 scale; 3347 vec2 translate; 3348 vec2 pos; 3349}; 3350 3351uniform float distance; 3352uniform float sunlightStrength; 3353uniform float ambientLight; 3354uniform TileMap hiresTileMap; 3355uniform sampler2D textureImage; 3356uniform vec2 tileSize; 3357uniform vec2 textureSize; 3358uniform float lod; 3359uniform float lodScale; 3360uniform vec3 voidColor; 3361uniform bool chunkBorders; 3362 3363varying vec3 vPosition; 3364varying vec3 vWorldPosition; 3365varying float vDistance; 3366 3367float metaToHeight(vec4 meta) { 3368 float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0; 3369 if (heightUnsigned >= 32768.0) { 3370 return -(65535.0 - heightUnsigned); 3371 } else { 3372 return heightUnsigned; 3373 } 3374} 3375 3376float metaToLight(vec4 meta) { 3377 return meta.r * 255.0; 3378} 3379 3380vec2 posToColorUV(vec2 pos) { 3381 return vec2(pos.x / textureSize.x, min(pos.y, tileSize.y) / textureSize.y); 3382} 3383 3384vec2 posToMetaUV(vec2 pos) { 3385 return vec2(pos.x / textureSize.x, pos.y / textureSize.y + 0.5); 3386} 3387 3388vec3 adjustColor(vec3 color) { 3389 return vec3(color * max(sunlightStrength * sunlightStrength, ambientLight)); 3390} 3391 3392void main() { 3393 //discard if hires tile is loaded at that position 3394 if (distance < 1000.0 && texture(hiresTileMap.map, ((vWorldPosition.xz - hiresTileMap.translate) / hiresTileMap.scale - hiresTileMap.pos) / hiresTileMap.size + 0.5).r > 0.75) discard; 3395 3396 vec4 color = texture(textureImage, posToColorUV(vPosition.xz)); 3397 if (distance < 800.0 && color.a == 0.0) discard; 3398 3399 // blend out lowres if too close 3400 if (lod > 1.0 && vDistance < 10.0 * lodScale * lod) discard; 3401 3402 vec4 meta = texture(textureImage, posToMetaUV(vPosition.xz)); 3403 3404 float height = metaToHeight(meta); 3405 3406 float heightX = metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(1.0, 0.0)))); 3407 float heightZ = metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(0.0, 1.0)))); 3408 float heightDiff = ((height - heightX) + (height - heightZ)) / lodScale; 3409 float shade = clamp(heightDiff * 0.06, -0.2, 0.04); 3410 3411 float ao = 0.0; 3412 float aoStrength = 0.0; 3413 float distFac = smoothstep(200.0, 600.0, distance); 3414 if(lod == 1.0) { 3415 aoStrength = smoothstep(PI - 0.8, PI - 0.2, acos(-clamp(viewMatrix[1][2], 0.0, 1.0))); 3416 aoStrength *= 1.0 - distFac; 3417 3418 if (aoStrength > 0.0) { 3419 const float r = 3.0; 3420 const float step = 0.2; 3421 const float o = step / r * 0.1; 3422 for (float vx = -r; vx <= r; vx++) { 3423 for (float vz = -r; vz <= r; vz++) { 3424 heightDiff = height - metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(vx * step, vz * step)))); 3425 if (heightDiff < 0.0) { 3426 ao -= o; 3427 } 3428 } 3429 } 3430 } 3431 } 3432 3433 color.rgb += mix(shade, shade * 0.3 + ao, aoStrength); 3434 3435 float blockLight = metaToLight(meta); 3436 float light = mix(blockLight, 15.0, sunlightStrength); 3437 color.rgb *= mix(ambientLight, 1.0, light / 15.0); 3438 3439 if (chunkBorders) { 3440 vec4 lineColour = vec4(1.0, 0.0, 1.0, 0.4); 3441 float lineInterval = 16.0; 3442 float lineThickness = 0.125; //width of two Minecraft pixels 3443 float offset = 0.5; 3444 3445 vec2 worldPos = vWorldPosition.xz; 3446 worldPos += offset; 3447 float x = abs(mod(worldPos.x, lineInterval) - offset); 3448 float y = abs(mod(worldPos.y, lineInterval) - offset); 3449 bool isChunkBorder = x < lineThickness || y < lineThickness; 3450 3451 color.rgb = mix(mix(color.rgb, lineColour.rgb, float(isChunkBorder) * lineColour.a), color.rgb, distFac); 3452 } 3453 3454 vec3 adjustedVoidColor = adjustColor(voidColor); 3455 //where there's transparency, there is void that needs to be coloured 3456 color.rgb = mix(adjustedVoidColor, color.rgb, color.a); 3457 color.a = 1.0; //but don't actually display the transparency 3458 3459 gl_FragColor = color; 3460 3461 ${ShaderChunk.logdepthbuf_fragment} 3462} 3463 3464`,LOWRES_VERTEX_SHADER=` 3465#include <common> 3466${ShaderChunk.logdepthbuf_pars_vertex} 3467 3468uniform sampler2D textureImage; 3469uniform vec2 tileSize; 3470uniform vec2 textureSize; 3471 3472varying vec3 vPosition; 3473varying vec3 vWorldPosition; 3474varying float vDistance; 3475 3476float metaToHeight(vec4 meta) { 3477 float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0; 3478 if (heightUnsigned >= 32768.0) { 3479 return -(65535.0 - heightUnsigned); 3480 } else { 3481 return heightUnsigned; 3482 } 3483} 3484 3485vec2 posToMetaUV(vec2 pos) { 3486 return vec2(pos.x / textureSize.x, pos.y / textureSize.y + 0.5); 3487} 3488 3489void main() { 3490 vPosition = position; 3491 3492 vec4 meta = texture(textureImage, posToMetaUV(position.xz)); 3493 vPosition.y = metaToHeight(meta) + 1.0 - position.x * 0.0001 - position.z * 0.0002; //including small offset-tilt to prevent z-fighting 3494 3495 vec4 worldPos = modelMatrix * vec4(vPosition, 1); 3496 vec4 viewPos = viewMatrix * worldPos; 3497 3498 vWorldPosition = worldPos.xyz; 3499 vDistance = -viewPos.z; 3500 3501 gl_Position = projectionMatrix * viewPos; 3502 3503 ${ShaderChunk.logdepthbuf_vertex} 3504} 3505 3506`;UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ShaderLib.line={uniforms:UniformsUtils.merge([UniformsLib.common,UniformsLib.fog,UniformsLib.line]),vertexShader:` 3507 #include <common> 3508 #include <color_pars_vertex> 3509 #include <fog_pars_vertex> 3510 #include <logdepthbuf_pars_vertex> 3511 #include <clipping_planes_pars_vertex> 3512 3513 uniform float linewidth; 3514 uniform vec2 resolution; 3515 3516 attribute vec3 instanceStart; 3517 attribute vec3 instanceEnd; 3518 3519 attribute vec3 instanceColorStart; 3520 attribute vec3 instanceColorEnd; 3521
3522 #ifdef WORLD_UNITS 3523 3524 varying vec4 worldPos; 3525 varying vec3 worldStart; 3526 varying vec3 worldEnd; 3527 3528 #ifdef USE_DASH 3529 3530 varying vec2 vUv; 3531 3532 #endif 3533 3534 #else 3535 3536 varying vec2 vUv; 3537 3538 #endif 3539 3540 #ifdef USE_DASH 3541 3542 uniform float dashScale; 3543 attribute float instanceDistanceStart; 3544 attribute float instanceDistanceEnd; 3545 varying float vLineDistance; 3546 3547 #endif 3548 3549 void trimSegment( const in vec4 start, inout vec4 end ) { 3550 3551 // trim end segment so it terminates between the camera plane and the near plane 3552 3553 // conservative estimate of the near plane 3554 float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column 3555 float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column 3556 float nearEstimate = - 0.5 * b / a; 3557 3558 float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); 3559 3560 end.xyz = mix( start.xyz, end.xyz, alpha ); 3561 3562 } 3563 3564 void main() { 3565 3566 #ifdef USE_COLOR 3567 3568 vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; 3569 3570 #endif 3571 3572 #ifdef USE_DASH 3573 3574 vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; 3575 vUv = uv; 3576 3577 #endif 3578 3579 float aspect = resolution.x / resolution.y; 3580 3581 // camera space 3582 vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); 3583 vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); 3584 3585 #ifdef WORLD_UNITS 3586 3587 worldStart = start.xyz; 3588 worldEnd = end.xyz; 3589 3590 #else 3591 3592 vUv = uv; 3593 3594 #endif 3595 3596 // special case for perspective projection, and segments that terminate either in, or behind, the camera plane 3597 // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space 3598 // but we need to perform ndc-space calculations in the shader, so we must address this issue directly 3599 // perhaps there is a more elegant solution -- WestLangley 3600 3601 bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column 3602 3603 if ( perspective ) { 3604 3605 if ( start.z < 0.0 && end.z >= 0.0 ) { 3606 3607 trimSegment( start, end ); 3608 3609 } else if ( end.z < 0.0 && start.z >= 0.0 ) { 3610 3611 trimSegment( end, start ); 3612 3613 } 3614 3615 } 3616 3617 // clip space 3618 vec4 clipStart = projectionMatrix * start; 3619 vec4 clipEnd = projectionMatrix * end; 3620 3621 // ndc space 3622 vec3 ndcStart = clipStart.xyz / clipStart.w; 3623 vec3 ndcEnd = clipEnd.xyz / clipEnd.w; 3624 3625 // direction 3626 vec2 dir = ndcEnd.xy - ndcStart.xy; 3627 3628 // account for clip-space aspect ratio 3629 dir.x *= aspect; 3630 dir = normalize( dir ); 3631 3632 #ifdef WORLD_UNITS 3633 3634 // get the offset direction as perpendicular to the view vector 3635 vec3 worldDir = normalize( end.xyz - start.xyz ); 3636 vec3 offset; 3637 if ( position.y < 0.5 ) { 3638 3639 offset = normalize( cross( start.xyz, worldDir ) ); 3640 3641 } else { 3642 3643 offset = normalize( cross( end.xyz, worldDir ) ); 3644 3645 } 3646 3647 // sign flip 3648 if ( position.x < 0.0 ) offset *= - 1.0; 3649 3650 float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) ); 3651 3652 // don't extend the line if we're rendering dashes because we 3653 // won't be rendering the endcaps 3654 #ifndef USE_DASH 3655 3656 // extend the line bounds to encompass endcaps 3657 start.xyz += - worldDir * linewidth * 0.5; 3658 end.xyz += worldDir * linewidth * 0.5; 3659 3660 // shift the position of the quad so it hugs the forward edge of the line 3661 offset.xy -= dir * forwardOffset; 3662 offset.z += 0.5; 3663 3664 #endif 3665 3666 // endcaps 3667 if ( position.y > 1.0 || position.y < 0.0 ) { 3668 3669 offset.xy += dir * 2.0 * forwardOffset; 3670 3671 } 3672 3673 // adjust for linewidth 3674 offset *= linewidth * 0.5; 3675 3676 // set the world position 3677 worldPos = ( position.y < 0.5 ) ? start : end; 3678 worldPos.xyz += offset; 3679 3680 // project the worldpos 3681 vec4 clip = projectionMatrix * worldPos; 3682 3683 // shift the depth of the projected points so the line 3684 // segments overlap neatly 3685 vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; 3686 clip.z = clipPose.z * clip.w; 3687 3688 #else 3689 3690 vec2 offset = vec2( dir.y, - dir.x ); 3691 // undo aspect ratio adjustment 3692 dir.x /= aspect; 3693 offset.x /= aspect; 3694 3695 // sign flip 3696 if ( position.x < 0.0 ) offset *= - 1.0; 3697 3698 // endcaps 3699 if ( position.y < 0.0 ) { 3700 3701 offset += - dir; 3702 3703 } else if ( position.y > 1.0 ) { 3704 3705 offset += dir; 3706 3707 } 3708 3709 // adjust for linewidth 3710 offset *= linewidth; 3711 3712 // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... 3713 offset /= resolution.y; 3714 3715 // select end 3716 vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; 3717 3718 // back to clip space 3719 offset *= clip.w; 3720 3721 clip.xy += offset; 3722 3723 #endif 3724 3725 gl_Position = clip; 3726 3727 vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation 3728 3729 #include <logdepthbuf_vertex> 3730 #include <clipping_planes_vertex> 3731 #include <fog_vertex> 3732 3733 } 3734 `,fragmentShader:` 3735 uniform vec3 diffuse; 3736 uniform float opacity; 3737 uniform float linewidth; 3738 3739 #ifdef USE_DASH 3740 3741 uniform float dashOffset; 3742 uniform float dashSize; 3743 uniform float gapSize; 3744 3745 #endif 3746 3747 varying float vLineDistance; 3748 3749 #ifdef WORLD_UNITS 3750 3751 varying vec4 worldPos; 3752 varying vec3 worldStart; 3753 varying vec3 worldEnd; 3754 3755 #ifdef USE_DASH 3756 3757 varying vec2 vUv; 3758 3759 #endif 3760 3761 #else 3762 3763 varying vec2 vUv; 3764 3765 #endif 3766 3767 #include <common> 3768 #include <color_pars_fragment> 3769 #include <fog_pars_fragment> 3770 #include <logdepthbuf_pars_fragment> 3771 #include <clipping_planes_pars_fragment> 3772 3773 vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { 3774 3775 float mua; 3776 float mub; 3777 3778 vec3 p13 = p1 - p3; 3779 vec3 p43 = p4 - p3; 3780 3781 vec3 p21 = p2 - p1; 3782 3783 float d1343 = dot( p13, p43 );
3784 float d4321 = dot( p43, p21 ); 3785 float d1321 = dot( p13, p21 ); 3786 float d4343 = dot( p43, p43 ); 3787 float d2121 = dot( p21, p21 ); 3788 3789 float denom = d2121 * d4343 - d4321 * d4321; 3790 3791 float numer = d1343 * d4321 - d1321 * d4343; 3792 3793 mua = numer / denom; 3794 mua = clamp( mua, 0.0, 1.0 ); 3795 mub = ( d1343 + d4321 * ( mua ) ) / d4343; 3796 mub = clamp( mub, 0.0, 1.0 ); 3797 3798 return vec2( mua, mub ); 3799 3800 } 3801 3802 void main() { 3803 3804 #include <clipping_planes_fragment> 3805 3806 #ifdef USE_DASH 3807 3808 if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps 3809 3810 if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX 3811 3812 #endif 3813 3814 float alpha = opacity; 3815 3816 #ifdef WORLD_UNITS 3817 3818 // Find the closest points on the view ray and the line segment 3819 vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; 3820 vec3 lineDir = worldEnd - worldStart; 3821 vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); 3822 3823 vec3 p1 = worldStart + lineDir * params.x; 3824 vec3 p2 = rayEnd * params.y; 3825 vec3 delta = p1 - p2; 3826 float len = length( delta ); 3827 float norm = len / linewidth; 3828 3829 #ifndef USE_DASH 3830 3831 #ifdef USE_ALPHA_TO_COVERAGE 3832 3833 float dnorm = fwidth( norm ); 3834 alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); 3835 3836 #else 3837 3838 if ( norm > 0.5 ) { 3839 3840 discard; 3841 3842 } 3843 3844 #endif 3845 3846 #endif 3847 3848 #else 3849 3850 #ifdef USE_ALPHA_TO_COVERAGE 3851 3852 // artifacts appear on some hardware if a derivative is taken within a conditional 3853 float a = vUv.x; 3854 float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; 3855 float len2 = a * a + b * b; 3856 float dlen = fwidth( len2 ); 3857 3858 if ( abs( vUv.y ) > 1.0 ) { 3859 3860 alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); 3861 3862 } 3863 3864 #else 3865 3866 if ( abs( vUv.y ) > 1.0 ) { 3867 3868 float a = vUv.x; 3869 float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; 3870 float len2 = a * a + b * b; 3871 3872 if ( len2 > 1.0 ) discard; 3873 3874 } 3875 3876 #endif 3877 3878 #endif 3879 3880 vec4 diffuseColor = vec4( diffuse, alpha ); 3881 3882 #include <logdepthbuf_fragment> 3883 #include <color_fragment> 3884 3885 gl_FragColor = vec4( diffuseColor.rgb, alpha ); 3886 3887 #include <tonemapping_fragment> 3888 #include <encodings_fragment> 3889 #include <fog_fragment> 3890 #include <premultiplied_alpha_fragment> 3891 3892 } 3893 `};class LineMaterial extends ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:UniformsUtils.clone(ShaderLib.line.uniforms),vertexShader:ShaderLib.line.vertexShader,fragmentShader:ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const MARKER_FILL_VERTEX_SHADER=` 3894#include <common> 3895${ShaderChunk.logdepthbuf_pars_vertex} 3896 3897varying vec3 vPosition; 3898//varying vec3 vWorldPosition; 3899//varying vec3 vNormal; 3900//varying vec2 vUv;
3901//varying vec3 vColor; 3902varying float vDistance; 3903 3904void main() { 3905 vec4 worldPos = modelMatrix * vec4(position, 1); 3906 vec4 viewPos = viewMatrix * worldPos; 3907 3908 vPosition = position; 3909 //vWorldPosition = worldPos.xyz; 3910 //vNormal = normal; 3911 //vUv = uv; 3912 //vColor = vec3(1.0); 3913 vDistance = -viewPos.z; 3914 3915 gl_Position = projectionMatrix * viewPos; 3916 3917 ${ShaderChunk.logdepthbuf_vertex} 3918} 3919`,MARKER_FILL_FRAGMENT_SHADER=` 3920${ShaderChunk.logdepthbuf_pars_fragment} 3921 3922#define FLT_MAX 3.402823466e+38 3923 3924varying vec3 vPosition; 3925//varying vec3 vWorldPosition; 3926//varying vec3 vNormal; 3927//varying vec2 vUv; 3928//varying vec3 vColor; 3929varying float vDistance; 3930 3931uniform vec3 markerColor; 3932uniform float markerOpacity; 3933 3934uniform float fadeDistanceMax; 3935uniform float fadeDistanceMin; 3936 3937void main() { 3938 vec4 color = vec4(markerColor, markerOpacity); 3939 3940 // distance fading 3941 float fdMax = FLT_MAX; 3942 if ( fadeDistanceMax > 0.0 ) fdMax = fadeDistanceMax; 3943 3944 float minDelta = (vDistance - fadeDistanceMin) / fadeDistanceMin; 3945 float maxDelta = (vDistance - fadeDistanceMax) / (fadeDistanceMax * 0.5); 3946 float distanceOpacity = min( 3947 clamp(minDelta, 0.0, 1.0), 3948 1.0 - clamp(maxDelta + 1.0, 0.0, 1.0) 3949 ); 3950 3951 color.a *= distanceOpacity; 3952 3953 // apply vertex-color 3954 //color.rgb *= vColor.rgb; 3955 3956 gl_FragColor = color; 3957 3958 ${ShaderChunk.logdepthbuf_fragment} 3959} 3960`,_box$1=new Box3,_vector=new Vector3;class LineSegmentsGeometry extends InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(e,3)),this.setAttribute("uv",new Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),_box$1.setFromBufferAttribute(t),this.boundingBox.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)_vector.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(_vector)),_vector.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(_vector));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}const _start=new Vector3,_end=new Vector3,_start4=new Vector4,_end4=new Vector4,_ssOrigin=new Vector4,_ssOrigin3=new Vector3,_mvMatrix=new Matrix4,_line=new Line3,_closestPoint=new Vector3,_box=new Box3,_sphere=new Sphere,_clipToWorldVector=new Vector4;let _ray,_instanceStart,_instanceEnd,_lineWidth;function getWorldSpaceHalfWidth(n,e,t){return _clipToWorldVector.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),_clipToWorldVector.multiplyScalar(1/_clipToWorldVector.w),_clipToWorldVector.x=_lineWidth/t.width,_clipToWorldVector.y=_lineWidth/t.height,_clipToWorldVector.applyMatrix4(n.projectionMatrixInverse),_clipToWorldVector.multiplyScalar(1/_clipToWorldVector.w),Math.abs(Math.max(_clipToWorldVector.x,_clipToWorldVector.y))}function raycastWorldUnits(n,e){const t=n.matrixWorld;for(let i=0,r=_instanceStart.count;i<r;i++){_line.start.fromBufferAttribute(_instanceStart,i),_line.end.fromBufferAttribute(_instanceEnd,i),_line.applyM
3960atrix4(t);const s=new Vector3,a=new Vector3;_ray.distanceSqToSegment(_line.start,_line.end,a,s),a.distanceTo(s)<_lineWidth*.5&&e.push({point:a,pointOnLine:s,distance:_ray.origin.distanceTo(a),object:n,face:null,faceIndex:i,uv:null,uv2:null})}}function raycastScreenSpace(n,e,t){const i=e.projectionMatrix,s=n.material.resolution,a=n.matrixWorld,o=n.geometry,l=o.attributes.instanceStart,c=o.attributes.instanceEnd,u=-e.near;_ray.at(1,_ssOrigin),_ssOrigin.w=1,_ssOrigin.applyMatrix4(e.matrixWorldInverse),_ssOrigin.applyMatrix4(i),_ssOrigin.multiplyScalar(1/_ssOrigin.w),_ssOrigin.x*=s.x/2,_ssOrigin.y*=s.y/2,_ssOrigin.z=0,_ssOrigin3.copy(_ssOrigin),_mvMatrix.multiplyMatrices(e.matrixWorldInverse,a);for(let d=0,f=l.count;d<f;d++){if(_start4.fromBufferAttribute(l,d),_end4.fromBufferAttribute(c,d),_start4.w=1,_end4.w=1,_start4.applyMatrix4(_mvMatrix),_end4.applyMatrix4(_mvMatrix),_start4.z>u&&_end4.z>u)continue;if(_start4.z>u){const S=_start4.z-_end4.z,y=(_start4.z-u)/S;_start4.lerp(_end4,y)}else if(_end4.z>u){const S=_end4.z-_start4.z,y=(_end4.z-u)/S;_end4.lerp(_start4,y)}_start4.applyMatrix4(i),_end4.applyMatrix4(i),_start4.multiplyScalar(1/_start4.w),_end4.multiplyScalar(1/_end4.w),_start4.x*=s.x/2,_start4.y*=s.y/2,_end4.x*=s.x/2,_end4.y*=s.y/2,_line.start.copy(_start4),_line.start.z=0,_line.end.copy(_end4),_line.end.z=0;const v=_line.closestPointToPointParameter(_ssOrigin3,!0);_line.at(v,_closestPoint);const _=MathUtils.lerp(_start4.z,_end4.z,v),g=_>=-1&&_<=1,x=_ssOrigin3.distanceTo(_closestPoint)<_lineWidth*.5;if(g&&x){_line.start.fromBufferAttribute(l,d),_line.end.fromBufferAttribute(c,d),_line.start.applyMatrix4(a),_line.end.applyMatrix4(a);const S=new Vector3,y=new Vector3;_ray.distanceSqToSegment(_line.start,_line.end,y,S),t.push({point:y,pointOnLine:S,distance:_ray.origin.distanceTo(y),object:n,face:null,faceIndex:d,uv:null,uv2:null})}}}class LineSegments2 extends Mesh{constructor(e=new LineSegmentsGeometry,t=new LineMaterial({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)_start.fromBufferAttribute(t,a),_end.fromBufferAttribute(i,a),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+_start.distanceTo(_end);const s=new InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new InterleavedBufferAttribute(s,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;_ray=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;_lineWidth=l.linewidth+s,_instanceStart=o.attributes.instanceStart,_instanceEnd=o.attributes.instanceEnd,o.boundingSphere===null&&o.computeBoundingSphere(),_sphere.copy(o.boundingSphere).applyMatrix4(a);let c;if(i)c=_lineWidth*.5;else{const d=Math.max(r.near,_sphere.distanceToPoint(_ray.origin));c=getWorldSpaceHalfWidth(r,d,l.resolution)}if(_sphere.radius+=c,_ray.intersectsSphere(_sphere)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),_box.copy(o.boundingBox).applyMatrix4(a);let u;if(i)u=_lineWidth*.5;else{const d=Math.max(r.near,_box.distanceToPoint(_ray.origin));u=getWorldSpaceHalfWidth(r,d,l.resolution)}_box.expandByScalar(u),_ray.intersectsBox(_box)!==!1&&(i?raycastWorldUnits(this,t):raycastScreenSpace(this,r,t))}}class LineGeometry extends LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setColors(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Line2 extends LineSegments2{constructor(e=new LineGeometry,t=new LineMaterial({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const St=class St extends Object3D{constructor(e){super(),Object.defineProperty(this,"isMarker",{value:!0}),this.data=reactive({id:e,type:"marker",sorting:0,listed:!0,position:this.position,visible:this.visible}),Object.defineProperty(this,"position",{get(){return this.data.position},set(t){this.data.position=t}}),Object.defineProperty(this,"visible",{get(){return this.data.visible},set(t){this.data.visible=t}})}dispose(){}updateFromData(e){}static calculateDistanceOpacity(e,t,i,r){let s=St.calculateDistanceToCameraPlane(e,t),a=(s-i)/i,o=(s-r)/(r*.5);return Math.min(MathUtils.clamp(a,0,1),1-MathUtils.clamp(o+1,0,1))}static calculateDistanceToCameraPlane(e,t){return St._posRelativeToCamera.subVectors(e,t.position),t.getWorldDirection(St._cameraDirection),St._posRelativeToCamera.dot(St._cameraDirection)}};me(St,"_posRelativeToCamera",new Vector3),me(St,"_cameraDirection",new Vector3);let Marker=St;class CSS2DObject extends Object3D{constructor(e){super(),this.element=document.createElement("div"),e.parentNode.replaceChild(this.element,e),this.element.appendChild(e),this.element.style.position="absolute",this.anchor=new Vector2,this.events=null,this.addEventListener("removed",function(){this.traverse(function(s){s.element instanceof Element&&s.element.parentNode!==null&&s.element.parentNode.removeChild(s.element)})});let i=-1,r=s=>{let a=!1,o=Date.now();o-i<500&&(a=!0),i=o;let l={doubleTap:a};this.onClick({event:s,data:l})?(s.preventDefault(),s.stopPropagation()):dispatchEvent(this.events,"bluemapMapInteraction",{data:l,object:this})};this.element.addEventListener("click",r),this.element.addEventListener("touch",r)}}var CSS2DRenderer=function(n=null){var e=this,t,i,r,s,a=new Vector3,o=new Matrix4,l=new Matrix4,c={objects:new WeakMap},u=document.createElement("div");u.style.overflow="hidden",this.domElement=u,this.events=n,this.get
3960Size=function(){return{width:t,height:i}},this.setSize=function(_,g){t=_,i=g,r=t/2,s=i/2,u.style.width=_+"px",u.style.height=g+"px"};var d=function(_,g,x,S){if(_ instanceof CSS2DObject){_.events=e.events,_.onBeforeRender(e,g,x),a.setFromMatrixPosition(_.matrixWorld),a.applyMatrix4(l);var y=_.element,b="translate("+(a.x*r+r-_.anchor.x)+"px,"+(-a.y*s+s-_.anchor.y)+"px)";y.style.WebkitTransform=b,y.style.MozTransform=b,y.style.oTransform=b,y.style.transform=b,y.style.display=S&&_.visible&&a.z>=-1&&a.z<=1&&y.style.opacity!=="0"?"":"none";var w={distanceToCameraSquared:f(x,_)};c.objects.set(_,w),y.parentNode!==u&&u.appendChild(y),_.onAfterRender(e,g,x)}for(var C=0,R=_.children.length;C<R;C++)d(_.children[C],g,x,S&&_.visible)},f=function(){var _=new Vector3,g=new Vector3;return function(x,S){return _.setFromMatrixPosition(x.matrixWorld),g.setFromMatrixPosition(S.matrixWorld),_.distanceToSquared(g)}}(),m=function(_){var g=[];return _.traverse(function(x){x instanceof CSS2DObject&&g.push(x)}),g},v=function(_){for(var g=m(_).sort(function(b,w){var C=c.objects.get(b).distanceToCameraSquared,R=c.objects.get(w).distanceToCameraSquared;return C-R}),x=g.length,S=0,y=g.length;S<y;
3960S++){let b=g[S];b.element.style.zIndex=b.disableDepthTest?x+1:x-S}};this.render=function(_,g){_.matrixWorldAutoUpdate===!0&&_.updateMatrixWorld(),g.parent===null&&g.updateMatrixWorld(),o.copy(g.matrixWorldInverse),l.multiplyMatrices(g.projectionMatrix,o),d(_,_,g,!0),v(_)}};class ObjectMarker extends Marker{constructor(e){super(e),Object.defineProperty(this,"isObjectMarker",{value:!0}),this.data.type="object",this.data.label=null,this.data.detail=null,this.data.link=null,this.data.newTab=!0,this.lastClick=-1}onClick(e){let t=new Vector3;if(e.intersection&&(t.copy(e.intersection.pointOnLine||e.intersection.point),t.sub(this.position)),e.data.doubleTap)return!1;if(this.data.detail||this.data.label){let i=new LabelPopup(this.data.detail||this.data.label);i.position.copy(t),this.add(i),i.open()}return this.data.link&&window.open(this.data.link,this.data.newTab?"_blank":"_self"),!0}updateFromData(e){let t=e.position||{};this.position.setX(t.x||0),this.position.setY(t.y||0),this.position.setZ(t.z||0),this.data.label=e.label||null,this.data.detail=e.detail||null,this.data.sorting=e.sorting||0,this.data.listed=e.listed===void 0?!0:e.listed,this.data.link=e.link||null,this.data.newTab=!!e.newTab}}class LabelPopup extends CSS2DObject{constructor(e){super(htmlToElement(`<div class="bm-marker-labelpopup">${e}</div>`))}open(e=!0){let t=this.element.style.opacity||1;this.element.style.opacity=0;let i=animate(r=>{this.element.style.opacity=(r*t).toString()},300);if(e){let r=s=>{s.composedPath().includes(this.element)||(i.cancel(),this.close(),window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r),window.removeEventListener("keydown",r),window.removeEventListener("mousewheel",r))};window.setTimeout(()=>{window.addEventListener("mousedown",r),window.addEventListener("touchstart",r,{passive:!0}),window.addEventListener("keydown",r),window.addEventListener("mousewheel",r)},100)}}close(e=!0){let t=parseFloat(this.element.style.opacity);animate(i=>{this.element.style.opacity=(t-i*t).toString()},300,i=>{e&&i&&this.parent&&this.parent.remove(this)})}}const lineShader={uniforms:UniformsUtils.merge([UniformsLib.common,UniformsLib.fog,UniformsLib.line]),vertexShader:` 3961 #include <common> 3962 #include <color_pars_vertex> 3963 #include <fog_pars_vertex> 3964 #include <logdepthbuf_pars_vertex> 3965 #include <clipping_planes_pars_vertex> 3966 3967 uniform float linewidth; 3968 uniform vec2 resolution; 3969 3970 attribute vec3 instanceStart; 3971 attribute vec3 instanceEnd; 3972 3973 attribute vec3 instanceColorStart; 3974 attribute vec3 instanceColorEnd; 3975 3976 varying vec2 vUv; 3977 3978 varying float vDistance; 3979 3980 #ifdef USE_DASH 3981 3982 uniform float dashScale; 3983 attribute float instanceDistanceStart; 3984 attribute float instanceDistanceEnd; 3985 varying float vLineDistance; 3986 3987 #endif 3988 3989 void trimSegment( const in vec4 start, inout vec4 end ) { 3990 3991 // trim end segment so it terminates between the camera plane and the near plane 3992 3993 // conservative estimate of the near plane 3994 float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column 3995 float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column 3996 float nearEstimate = - 0.5 * b / a; 3997 3998 float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); 3999 4000 end.xyz = mix( start.xyz, end.xyz, alpha ); 4001 4002 } 4003 4004 void main() { 4005 4006 #ifdef USE_COLOR 4007 4008 vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; 4009 4010 #endif 4011 4012 #ifdef USE_DASH 4013 4014 vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; 4015 4016 #endif 4017 4018 float aspect = resolution.x / resolution.y; 4019 4020 vUv = uv; 4021 4022 // camera space 4023 vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); 4024 vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); 4025 4026 // special case for perspective projection, and segments that terminate either in, or behind, the camera plane 4027 // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space 4028 // but we need to perform ndc-space calculations in the shader, so we must address this issue directly 4029 // perhaps there is a more elegant solution -- WestLangley 4030 4031 bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column 4032 4033 if ( perspective ) { 4034 4035 if ( start.z < 0.0 && end.z >= 0.0 ) { 4036 4037 trimSegment( start, end ); 4038 4039 } else if ( end.z < 0.0 && start.z >= 0.0 ) { 4040 4041 trimSegment( end, start ); 4042 4043 } 4044 4045 } 4046 4047 // clip space 4048 vec4 clipStart = projectionMatrix * start; 4049 vec4 clipEnd = projectionMatrix * end; 4050 4051 // ndc space 4052 vec2 ndcStart = clipStart.xy / clipStart.w; 4053 vec2 ndcEnd = clipEnd.xy / clipEnd.w; 4054 4055 // direction 4056 vec2 dir = ndcEnd - ndcStart; 4057 4058 // account for clip-space aspect ratio 4059 dir.x *= aspect; 4060 dir = normalize( dir ); 4061 4062 // perpendicular to dir 4063 vec2 offset = vec2( dir.y, - dir.x ); 4064 4065 // undo aspect ratio adjustment 4066 dir.x /= aspect; 4067 offset.x /= aspect; 4068 4069 // sign flip 4070 if ( position.x < 0.0 ) offset *= - 1.0; 4071 4072 // endcaps 4073 if ( position.y < 0.0 ) { 4074 4075 offset += - dir; 4076 4077 } else if ( position.y > 1.0 ) { 4078 4079 offset += dir; 4080 4081 } 4082 4083 // adjust for linewidth 4084 offset *= linewidth; 4085 4086 // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... 4087 offset /= resolution.y; 4088 4089 // select end 4090 vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; 4091 4092 // back to clip space 4093 offset *= clip.w; 4094 4095 clip.xy += offset; 4096 4097 gl_Position = clip; 4098 4099 vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation 4100 4101 vDistance = -mvPosition.z; 4102 4103 #include <logdepthbuf_vertex> 4104 #include <clipping_planes_vertex> 4105 #include <fog_vertex> 4106 4107 } 4108 `,fragmentShader:` 4109 #define FLT_MAX 3.402823466e+38 4110 4111 uniform vec3 diffuse; 4112 uniform float opacity; 4113 4114 uniform float fadeDistanceMax; 4115 uniform float fadeDistanceMin; 4116 4117 #ifdef USE_DASH 4118 4119 uniform float dashSize; 4120 uniform float gapSize; 4121 4122 #endif 4123 4124 varying float vLineDistance; 4125 4126 #include <common> 4127 #include <color_pars_fragment> 4128 #include <fog_pars_fragment> 4129 #include <logdepthbuf_pars_fragment> 4130 #include <clipping_planes_pars_fragment> 4131 4132 varying vec2 vUv; 4133 4134 varying float vDistance; 4135 4136 void main() { 4137 4138 #include <clipping_planes_fragment> 4139 4140 #ifdef USE_DASH 4141 4142 if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps 4143 4144 if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX 4145 4146 #endif 4147 4148 if ( abs( vUv.y ) > 1.0 ) { 4149 4150 float a = vUv.x; 4151 float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; 4152 float len2 = a * a + b * b; 4153 4154 if ( len2 > 1.0 ) discard; 4155 4156 } 4157 4158 // distance fading 4159 float fdMax = FLT_MAX; 4160 if ( fadeDistanceMax > 0.0 ) fdMax = fadeDistanceMax; 4161 4162 float minDelta = (vDistance - fadeDistanceMin) / fadeDistanceMin; 4163 float maxDelta = (vDistance - fadeDistanceMax) / (fadeDistanceMax * 0.5); 4164 float distanceOpacity = min( 4165 clamp(minDelta, 0.0, 1.0), 4166 1.0 - clamp(maxDelta + 1.0, 0.0, 1.0) 4167 ); 4168 4169 vec4 diffuseColor = vec4( diffuse, opacity * distanceOpacity ); 4170 4171 #include <logdepthbuf_fragment> 4172 #include <color_fragment> 4173 4174 gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a ); 4175 4176 #include <tonemapping_fragment> 4177 #include <encodings_fragment> 4178 #include <fog_fragment> 4179 #include <premultiplied_alpha_fragment> 4180 4181 } 4182 `};class ExtrudeMarker extends ObjectMarker{constructor(e){super(e),Object.defineProperty(this,"isExtrudeMarker",{value:!0}),this.data.type="extrude";let t=new Vector2,i=new Shape([t,t,t]);this.fill=new ExtrudeMarkerFill(i),this.border=new ExtrudeMarkerBorder(i),this.border.renderOrder=-1,this.add(this.border,this.fill),this._markerData={}}setShapeY(e,t){let i=t-this.position.y,r=t-e;this.fill.position.y=i,this.border.position.y=i,this.fill.scale.y=r,this.border.scale.y=r}setShape(e){this.fill.updateGeometry(e),this.border.updateGeometry(e)}updateFromData(e){super.updateFromData(e),(!this._markerData.shape||!deepEquals(e.shape,this._markerData.shape)||!this._markerData.holes||!deepEquals(e.holes,this._markerData.holes)||!this._markerData.position||!deepEquals(e.position,this._markerData.position))&&this.setShape(this.createShapeWithHolesFromData(e.shape,e.holes)),this.setShapeY((e.shapeMinY||0)-.01,(e.shapeMaxY||0)+.01),this.border.depthTest=!!e.depthTest,this.fill.depthTest=!!e.depthTest,this.border.line
4182width=e.lineWidth!==void 0?e.lineWidth:2;let t=e.lineColor||{};this.border.color.setRGB((t.r||0)/255,(t.g||0)/255,(t.b||0)/255),this.border.opacity=t.a||0;let i=e.fillColor||{};this.fill.color.setRGB((i.r||0)/255,(i.g||0)/255,(i.b||0)/255),this.fill.opacity=i.a||0;let r=e.minDistance||0,s=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE;this.border.fadeDistanceMin=r,this.border.fadeDistanceMax=s,this.fill.fadeDistanceMin=r,this.fill.fadeDistanceMax=s,this._markerData=e}dispose(){super.dispose(),this.fill.dispose(),this.border.dispose()}createShapeFromData(e){let t=[];return Array.isArray(e)?(e.forEach(i=>{let r=(i.x||0)-this.position.x+.01,s=(i.z||0)-this.position.z+.01;t.push(new Vector2(r,s))}),new Shape(t)):!1}createShapeWithHolesFromData(e,t){const i=this.createShapeFromData(e);return i&&Array.isArray(t)&&t.forEach(r=>{const s=this.createShapeFromData(r);s&&i.holes.push(s)}),i}}class ExtrudeMarkerFill extends Mesh{constructor(e){let t=ExtrudeMarkerFill.createGeometry(e),i=new ShaderMaterial({vertexShader:MARKER_FILL_VERTEX_SHADER,fragmentShader:MARKER_FILL_FRAGMENT_SHADER,side:DoubleSide,depthTest:!0,transparent:!0,uniforms:{markerColor:{value:new Color},markerOpacity:{value:0},fadeDistanceMin:{value:0},fadeDistanceMax:{value:Number.MAX_VALUE}}});super(t,i)}get color(){return this.material.uniforms.markerColor.value}get opacity(){return this.material.uniforms.markerOpacity.value}set opacity(e){this.material.uniforms.markerOpacity.value=e,this.visible=e>0}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance<this.fadeDistanceMin)?!1:super.onClick(e)}updateGeometry(e){this.geometry.dispose(),this.geometry=ExtrudeMarkerFill.createGeometry(e)}dispose(){this.geometry.dispose(),this.material.dispose()}static createGeometry(e){let t=new ExtrudeGeometry(e,{depth:1,steps:5,bevelEnabled:!1});return t.rotateX(Math.PI/2),t}}class ExtrudeMarkerBorder extends Line2{constructor(e){let t=new LineSegmentsGeometry;t.setPositions(ExtrudeMarkerBorder.createLinePoints(e));let i=new LineMaterial({color:new Color,opacity:0,transparent:!0,linewidth:1,depthTest:!0,vertexColors:!1,dashed:!1,uniforms:UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader});i.uniforms.fadeDistanceMin={value:0},i.uniforms.fadeDistanceMax={value:Number.MAX_VALUE},i.resolution.set(window.innerWidth,window.innerHeight),super(t,i),this.computeLineDistances()}get color(){return this.material.color}get opacity(){return this.material.opacity}set opacity(e){this.material.opacity=e,this.visible=e>0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance<this.fadeDistanceMin)?!1:super.onClick(e)}updateGeometry(e){this.geometry=new LineSegmentsGeometry,this.geometry.setPositions(ExtrudeMarkerBorder.createLinePoints(e)),this.computeLineDistances()}onBeforeRender(e){e.getSize(this.material.resolution)}dispose(){this.geometry.dispose(),this.material.dispose()}static createLinePoints(e){let t=[];return t.push(...this.convertPoints(e.getPoints(5))),e.getPointsHoles(5).forEach(i=>t.push(...this.convertPoints(i))),t}static convertPoints(e){let t=[];e.push(e[0]);let i=null;return e.forEach(r=>{t.push(r.x,0,r.y),t.push(r.x,-1,r.y),i&&(t.push(i.x,0,i.y),t.push(r.x,0,r.y),t.push(i.x,-1,i.y),t.push(r.x,-1,r.y)),i=r}),t}}class HtmlMarker extends Marker{constructor(e){super(e),Object.defineProperty(this,"isHtmlMarker",{value:!0}),this.data.type="html",this.data.label=null,this.data.classes=[],this.elementObject=ne
4182w CSS2DObject(htmlToElement(`<div id="bm-marker-${this.data.id}" class="bm-marker-${this.data.type}"></div>`)),this.elementObject.onBeforeRender=(t,i,r)=>this.onBeforeRender(t,i,r),this.fadeDistanceMin=0,this.fadeDistanceMax=Number.MAX_VALUE,this.addEventListener("removed",()=>{var t;(t=this.element)!=null&&t.parentNode&&this.element.parentNode.removeChild(this.element)}),this.add(this.elementObject)}onBeforeRender(e,t,i){this.fadeDistanceMax===Number.MAX_VALUE&&this.fadeDistanceMin<=0?this.element.parentNode.style.opacity=void 0:this.element.parentNode.style.opacity=Marker.calculateDistanceOpacity(this.position,i,this.fadeDistanceMin,this.fadeDistanceMax).toString()}get html(){return this.element.innerHTML}set html(e){this.element.innerHTML=e}get anchor(){return this.elementObject.anchor}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}updateFromData(e){let t=e.position||{};this.position.setX(t.x||0),this.position.setY(t.y||0),this.position.setZ(t.z||0),this.data.label!==e.label&&(this.data.label=e.label||null),this.data.sorting!==e.sorting&&(this.data.sorting=e.sorting||0),this.data.listed!==e.listed&&(this.data.listed=e.listed===void 0?!0:e.listed);let i=e.anchor||{};this.anchor.setX(i.x||0),this.anchor.setY(i.y||0),this.element.innerHTML!==e.html&&(this.element.innerHTML=e.html),this.data.classes!==e.classes&&(this.data.classes=e.classes,this.element.classList.value=`bm-marker-${this.data.type}`,this.element.classList.add(...e.classes)),this.fadeDistanceMin=e.minDistance||0,this.fadeDistanceMax=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE}dispose(){super.dispose(),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class LineMarker extends ObjectMarker{constructor(e){super(e),Object.defineProperty(this,"isLineMarker",{value:!0}),this.data.type="line",this.line=new LineMarkerLine([0,0,0]),this.add(this.line),this._markerData={}}setLine(e){let t;if((e.type==="Curve"||e.type==="CurvePath")&&(e=e.getPoints(5)),Array.isArray(e))e.length===0?t=[]:e[0].isVector3?(t=[],e.forEach(i=>{t.push(i.x,i.y,i.z)})):t=e;else throw new Error("Invalid argument type!");this.line.updateGeometry(t)}updateFromData(e){super.updateFromData(e),(!this._markerData.line||!deepEquals(e.line,this._markerData.line)||!this._markerData.position||!deepEquals(e.position,this._markerData.position))&&this.setLine(this.createPointsFromData(e.line)),this.line.depthTest=!!e.depthTest,this.line.linewidth=e.lineWidth!==void 0?e.lineWidth:2;let t=e.lineColor||{};this.line.color.setRGB((t.r||0)/255,(t.g||0)/255,(t.b||0)/255),this.line.opacity=t.a||0;let i=e.minDistance||0,r=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE;this.line.fadeDistanceMin=i,this.line.fadeDistanceMax=r,this._markerData=e}dispose(){super.dispose(),this.line.dispose()}createPointsFromData(e){let t=[];return Array.isArray(e)&&e.forEach(i=>{let r=(i.x||0)-this.position.x,s=(i.y||0)-this.position.y,a=(i.z||0)-this.position.z;t.push(r,s,a)}),t}}class LineMarkerLine extends Line2{constructor(e){let t=new LineGeometry;t.setPositions(e);let i=new LineMaterial({color:new Color,opacity:0,transparent:!0,linewidth:1,depthTest:!0,vertexColors:!1,dashed:!1,uniforms:UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader});i.uniforms.fadeDistanceMin={value:0},i.uniforms.fadeDistanceMax={value:Number.MAX_VALUE},i.resolution.set(window.innerWidth,window.innerHeight),super(t,i),this.computeLineDistances()}get color(){return this.material.color}get opacity(){return this.material.opacity}set opacity(e){this.material.opacity=e,this.visible=e>0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance<this.fadeDistanceMin)?!1:super.onClick(e)}updateGeometry(e){this.geometry=new LineGeometry,this.geometry.setPositions(e),this.computeLineDistances()}onBeforeRender(e){e.getSize(this.material.resolution)}dispose(){this.geometry.dispose(),this.material.dispose()}}class ShapeMarker extends ObjectMarker{constructor(e){super(e),Object.defineProperty(this,"isShapeMarker",{value:!0}),this.data.type="shape";let t=new Vector2,i=new Shape([t,t,t]);this.fill=new ShapeMarkerFill(i),this.border=new ShapeMarkerBorder(i),this.border.renderOrder=-1,this.add(this.border,this.fill),this._markerData={}}setShapeY(e){let t=e-this.position.y;this.fill.position.y=t,this.border.position.y=t}setShape(e){this.fill.updateGeometry(e),this.border.updateGeometry(e)}updateFromData(e){super.updateFromData(e),(!this._markerData.shape||!deepEquals(e.shape,this._markerData.shape)||!this._markerData.holes||!deepEquals(e.holes,this._markerData.holes)||!this._markerData.position||!deepEquals(e.position,this._markerData.position))&&this.setShape(this.createShapeWithHolesFromData(e.shape,e.holes)),this.setShapeY((e.shapeY||e.height||0)+.01),this.border.depthTest=!!e.depthTest,this.fill.depthTest=!!e.depthTest,this.border.line
4182width=e.lineWidth!==void 0?e.lineWidth:2;let t=e.lineColor||e.borderColor||{};this.border.color.setRGB((t.r||0)/255,(t.g||0)/255,(t.b||0)/255),this.border.opacity=t.a||0;let i=e.fillColor||{};this.fill.color.setRGB((i.r||0)/255,(i.g||0)/255,(i.b||0)/255),this.fill.opacity=i.a||0;let r=e.minDistance||0,s=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE;this.border.fadeDistanceMin=r,this.border.fadeDistanceMax=s,this.fill.fadeDistanceMin=r,this.fill.fadeDistanceMax=s,this._markerData=e}dispose(){super.dispose(),this.fill.dispose(),this.border.dispose()}createShapeFromData(e){let t=[];return Array.isArray(e)?(e.forEach(i=>{let r=(i.x||0)-this.position.x,s=(i.z||0)-this.position.z;t.push(new Vector2(r,s))}),new Shape(t)):!1}createShapeWithHolesFromData(e,t){const i=this.createShapeFromData(e);return i&&Array.isArray(t)&&t.forEach(r=>{const s=this.createShapeFromData(r);s&&i.holes.push(s)}),i}}class ShapeMarkerFill extends Mesh{constructor(e){let t=ShapeMarkerFill.createGeometry(e),i=new ShaderMaterial({vertexShader:MARKER_FILL_VERTEX_SHADER,fragmentShader:MARKER_FILL_FRAGMENT_SHADER,side:DoubleSide,depthTest:!0,transparent:!0,uniforms:{markerColor:{value:new Color},markerOpacity:{value:0},fadeDistanceMin:{value:0},fadeDistanceMax:{value:Number.MAX_VALUE}}});super(t,i)}get color(){return this.material.uniforms.markerColor.value}get opacity(){return this.material.uniforms.markerOpacity.value}set opacity(e){this.material.uniforms.markerOpacity.value=e,this.visible=e>0}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance<this.fadeDistanceMin)?!1:super.onClick(e)}updateGeometry(e){this.geometry.dispose(),this.geometry=ShapeMarkerFill.createGeometry(e)}dispose(){this.geometry.dispose(),this.material.dispose()}static createGeometry(e){let t=new ShapeGeometry(e,5);return t.rotateX(Math.PI/2),t}}class ShapeMarkerBorder extends Line2{constructor(e){let t=new LineSegmentsGeometry;t.setPositions(ShapeMarkerBorder.createLinePoints(e));let i=new LineMaterial({color:new Color,opacity:0,transparent:!0,linewidth:1,depthTest:!0,vertexColors:!1,dashed:!1,uniforms:UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader});i.uniforms.fadeDistanceMin={value:0},i.uniforms.fadeDistanceMax={value:Number.MAX_VALUE},i.resolution.set(window.innerWidth,window.innerHeight),super(t,i),this.computeLineDistances()}get color(){return this.material.color}get opacity(){return this.material.opacity}set opacity(e){this.material.opacity=e,this.visible=e>0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance<this.fadeDistanceMin)?!1:super.onClick(e)}updateGeometry(e){this.geometry=new LineSegmentsGeometry,this.geometry.setPositions(ShapeMarkerBorder.createLinePoints(e)),this.computeLineDistances()}onBeforeRender(e){e.getSize(this.material.resolution)}dispose(){this.geometry.dispose(),this.material.dispose()}static createLinePoints(e){let t=[];return t.push(...this.convertPoints(e.getPoints(5))),e.getPointsHoles(5).forEach(i=>t.push(...this.convertPoints(i))),t}static convertPoints(e){e.push(e[0]);let t=[],i=null;return e.forEach(r=>{i&&(t.push(i.x,0,i.y),t.push(r.x,0,r.y)),i=r}),t}}class PoiMarker extends HtmlMarker{constructor(e){super(e),Object.defineProperty(this,"isPoiMarker",{value:!0}),this.data.type="poi",this.data.detail=null,this.html=`<img src="" alt="POI Icon (${this.data.id})" class="bm-marker-poi-icon" draggable="false" style="pointer-events: auto"><div class="bm-marker-poi-label"></div>`,this.iconElement=this.element.getElementsByTagName("img").item(0),this.labelElement=this.element.getElementsByTagName("div").item(0),this._lastIcon=null}
4182onClick(e){if(e.data.doubleTap)return!1;if(this.highlight||!this.data.label)return!0;this.highlight=!0;let t=i=>{i.composedPath().includes(this.element)||(this.highlight=!1,window.removeEventListener("mousedown",t),window.removeEventListener("touchstart",t),window.removeEventListener("keydown",t),window.removeEventListener("mousewheel",t))};return setTimeout(function(){window.addEventListener("mousedown",t),window.addEventListener("touchstart",t,{passive:!0}),window.addEventListener("keydown",t),window.addEventListener("mousewheel",t)},0),!0}set highlight(e){e?this.element.classList.add("bm-marker-highlight"):this.element.classList.remove("bm-marker-highlight")}get highlight(){return this.element.classList.contains("bm-marker-highlight")}updateFromData(e){let t=e.position||{};this.position.setX(t.x||0),this.position.setY(t.y||0),this.position.setZ(t.z||0);let i=e.anchor||e.iconAnchor||{};if(this.iconElement.style.transform=`translate(${-i.x}px, ${-i.y}px)`,this.data.label!==e.label&&(this.data.label=e.label||""),this.data.sorting!==e.sorting&&(this.data.sorting=e.sorting||0),this.data.listed!==e.listed&&(this.data.listed=e.listed===void 0?!0:e.listed),this.data.detail!==e.detail&&(this.data.detail=e.detail||this.data.label,this.labelElement.innerHTML=this.data.detail||""),this._lastIcon!==e.icon&&(this.iconElement.src=e.icon||"assets/poi.svg",this._lastIcon=e.icon),this.data.classes!==e.classes){this.data.classes=e.classes;let r=this.element.classList.contains("bm-marker-highlight");this.element.classList.value="bm-marker-html",r&&this.element.classList.add("bm-marker-highlight"),this.element.classList.add(...e.classes)}this.fadeDistanceMin=e.minDistance||0,this.fadeDistanceMax=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE}}class MarkerSet extends Scene{constructor(e,t=null){if(super(),Object.defineProperty(this,"isMarkerSet",{value:!0}),this.markerSets=new Map,this.markers=new Map,this.data=reactive({id:e,label:e,toggleable:!0,defaultHide:!1,sorting:0,markerSets:[],markers:[],visible:this.visible,get listed(){return this.toggleable||this.markers.filter(i=>i.listed).length>0||this.markerSets.filter(i=>i.listed).length>0},saveState:()=>{setLocalStorage(this.localStorageKey("visible"),this.visible)}}),Object.defineProperty(this,"visible",{get(){return this.data.visible},set(i){this.data.visible=i}}),t&&this.updateFromData(t),this.data.toggleable){let i=getLocalStorage(this.localStorageKey("visible"));i!==void 0?this.visible=!!i:this.data.defaultHide&&(this.visible=!1)}}updateFromData(e){this.data.label=e.label||this.data.id,this.data.toggleable=!!e.toggleable,this.data.defaultHide=!!e.defaultHidden,this.data.sorting=e.sorting||this.data.sorting,this.updateMarkerSetsFromData(e.markerSets),this.updateMarkersFromData(e.markers)}updateMarkerSetsFromData(e={},t=[]){let i=new Set(t);Object.keys(e).forEach(r=>{if(i.has(r))return;i.add(r);let s=e[r];try{this.updateMarkerSetFromData(r,s)}catch(a){alert(this.events,a,"fine")}}),this.markerSets.forEach((r,s)=>{i.has(s)||this.remove(r)})}updateMarkerSetFromData(e,t){let i=this.markerSets.get(e);i?i.updateFromData(t):(i=new MarkerSet(e,t),this.add(i))}updateMarkersFromData(e={},t=[]){let i=new Set(t);Object.keys(e).forEach(r=>{if(i.has(r))return;let s=e[r];try{this.updateMarkerFromData(r,s),i.add(r)}catch(a){alert(this.events,a,"fine"),console.debug(a)}}),this.markers.forEach((r,s)=>{i.has(s)||this.remove(r)})}updateMarkerFromData(e,t){if(!t.type)throw new Error("marker-data has no type!");let i=this.markers.get(e);if(!i||i.data.type!==t.type){switch(i&&this.remove(i),t.type){case"shape":i=new ShapeMarker(e);break;case"extrude":i=new ExtrudeMarker(e);break;case"line":i=new LineMarker(e);break;case"html":i=new HtmlMarker(e);break;case"poi":i=new PoiMarker(e);break;default:throw new Error(`Unknown marker-type: '${t.type}'`)}this.add(i)}i.updateFromData(t)}clear(){[...this.markerSets.values()].forEach(e=>this.remove(e)),[...this.markers.values()].forEach(e=>this.remove(e))}add(...e){if(e.length===1){let t=e[0];t.isMarkerSet&&!this.markerSets.has(t.data.id)&&(this.markerSets.set(t.data.id,t),this.data.markerSets.push(t.data)),t.isMarker&&!this.markers.has(t.data.id)&&(this.markers.set(t.data.id,t),this.data.markers.push(t.data))}return super.add(...e)}remove(...e){if(e.length===1){let t=e[0];if(t.isMarkerSet){let i=this.data.markerSets.indexOf(t.data);i>-1&&this.data.markerSets.splice(i,1),this.markerSets.delete(t.data.id),t.dis
4182pose()}if(t.isMarker){let i=this.data.markers.indexOf(t.data);i>-1&&this.data.markers.splice(i,1),this.markers.delete(t.data.id),t.dispose()}}return super.remove(...e)}dispose(){this.children.forEach(e=>{e.dispose&&e.dispose()})}localStorageKey(e){return"bluemap-markerset-"+encodeURIComponent(this.data.id)+"-"+e}}class MarkerManager{constructor(e,t,i=null){Object.defineProperty(this,"isMarkerManager",{value:!0}),this.root=e,this.fileUrl=t,this.events=i,this.disposed=!1,this._updateInterval=null}setAutoUpdateInterval(e){if(this._updateInterval&&clearTimeout(this._updateInterval),e>0){let t=()=>{this.disposed||this.update().then(i=>{i?this._updateInterval=setTimeout(t,e):this._updateInterval=setTimeout(t,Math.max(e,15e3))}).catch(i=>{alert(this.events,i,"warning"),this._updateInterval=setTimeout(t,Math.max(e,15e3))})};this._updateInterval=setTimeout(t,e)}}update(){return this.loadMarkerFile().then(e=>this.updateFromData(e)).catch(()=>this.clear())}updateFromData(e){}dispose(){this.disposed=!0,this.setAutoUpdateInterval(0),this.clear()}clear(){this.root.clear()}loadMarkerFile(){return new Promise((e,t)=>{let i=new FileLoader$1;i.setResponseType("json"),i.load(this.fileUrl+"?"+generateCacheHash(),r=>{r?e(r):t(`Failed to parse '${this.fileUrl}'!`)},()=>{},()=>t(`Failed to load '${this.fileUrl}'!`))})}}class PlayerMarker extends Marker{constructor(e,t,i="assets/steve.png"){super(e),Object.defineProperty(this,"isPlayerMarker",{value:!0}),this.data.type="player",this.data.playerUuid=t,this.data.name=t,this.data.playerHead=i,this.data.rotation={pitch:0,yaw:0}
4182,this.elementObject=new CSS2DObject(htmlToElement(` 4183<div id="bm-marker-${this.data.id}" class="bm-marker-${this.data.type}"> 4184 <img src="${this.data.playerHead}" alt="playerhead" draggable="false"> 4185 <div class="bm-player-name"></div> 4186</div> 4187 `)),this.elementObject.onBeforeRender=(r,s,a)=>this.onBeforeRender(r,s,a),this.playerHeadElement=this.element.getElementsByTagName("img")[0],this.playerNameElement=this.element.getElementsByTagName("div")[0],this.addEventListener("removed",()=>{this.element.parentNode&&this.element.parentNode.removeChild(this.element)}),this.playerHeadElement.addEventListener("error",()=>{this.playerHeadElement.src="assets/steve.png"},{once:!0}),this.add(this.elementObject)}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}onBeforeRender(e,t,i){let r=Marker.calculateDistanceToCameraPlane(this.position,i),s="near";r>1e3&&(s="med"),r>5e3&&(s="far"),this.element.setAttribute("distance-data",s)}updateFromData(e){let t=e.position||{},i=e.rotation||{};if(!this.position.x&&!this.position.y&&!this.position.z)this.position.set(t.x||0,(t.y||0)+1.8,t.z||0),this.data.rotation.pitch=i.pitch||0,this.data.rotation.yaw=i.yaw||0;else{let s={x:this.position.x,y:this.position.y,z:this.position.z,pitch:this.data.rotation.pitch,yaw:this.data.rotation.yaw},a={x:(t.x||0)-s.x,y:(t.y||0)+1.8-s.y,z:(t.z||0)-s.z,pitch:(i.pitch||0)-s.pitch,yaw:(i.yaw||0)-s.yaw};for(;a.yaw>180;)a.yaw-=360;for(;a.yaw<-180;)a.yaw+=360;(a.x||a.y||a.z||a.pitch||a.yaw)&&animate(o=>{let l=EasingFunctions.easeInOutCubic(o);this.position.set(s.x+a.x*l||0,s.y+a.y*l||0,s.z+a.z*l||0),this.data.rotation.pitch=s.pitch+a.pitch*l||0,this.data.rotation.yaw=s.yaw+a.yaw*l||0},1e3)}let r=e.name||this.data.playerUuid;this.data.name=r,this.playerNameElement.innerHTML!==r&&(this.playerNameElement.innerHTML=r),this.data.foreign=e.foreign}dispose(){super.dispose();let e=this.elementObject.element;e.parentNode&&e.parentNode.removeChild(e)}}class PlayerMarkerSet extends MarkerSet{constructor(e,t,i=null){super(e,i),this.data.label="Player",this.data.toggleable=!0,this.data.defaultHide=!1,this.data.playerheadsUrl=t}updateFromPlayerData(e){if(!Array.isArray(e.players))return this.clear(),!1;let t=new Set;return e.players.forEach(i=>{try{let r=this.updatePlayerMarkerFromData(i);t.add(r)}catch(r){alert(this.events,r,"fine")}}),this.markers.forEach(i=>{t.has(i)||this.remove(i)}),!0}updatePlayerMarkerFromData(e){let t=e.uuid;if(!t)throw new Error("player-data has no uuid!");let i=this.getPlayerMarkerId(t),r=this.markers.get(i);return(!r||!r.isPlayerMarker)&&(r&&this.remove(r),r=new PlayerMarker(i,t,`${this.data.playerheadsUrl}${t}.png`),this.add(r)),r.updateFromData(e),r.visible=!e.foreign,r}getPlayerMarker(e){return this.markers.get(this.getPlayerMarkerId(e))}getPlayerMarkerId(e){return"bm-player-"+e}}const PLAYER_MARKER_SET_ID="bm-players";class PlayerMarkerManager extends MarkerManager{constructor(e,t,i,r=null){super(e,t,r),this.playerheadsUrl=i}updateFromData(e){let t=this.getPlayerMarkerSet(Array.isArray(e.players));return t?t.updateFromPlayerData(e):!1}getPlayerMarkerSet(e=!0){let t=this.root.markerSets.get(PLAYER_MARKER_SET_ID);return!t&&e&&(t=new PlayerMarkerSet(PLAYER_MARKER_SET_ID,this.playerheadsUrl),this.root.add(t)),t}getPlayerMarker(e){return this.getPlayerMarkerSet().getPlayerMarker(e)}clear(){var e;(e=this.getPlayerMarkerSet(!1))==null||e.clear()}}class NormalMarkerManager extends MarkerManager{constructor(e,t,i=null){super(e,t,i)}updateFromData(e){return this.root.updateMarkerSetsFromData(e,[PLAYER_MARKER_SET_ID,"bm-popup-set"]),!0}clear(){this.root.updateMarkerSetsFromData({},[PLAYER_MARKER_SET_ID,"bm-popup-set"])}}const SKY_FRAGMENT_SHADER=` 4188uniform float sunlightStrength; 4189uniform float ambientLight; 4190uniform vec3 skyColor; 4191uniform vec3 voidColor; 4192 4193varying vec3 vPosition; 4194 4195vec3 adjustColor(vec3 color) { 4196 return vec3(color * max(sunlightStrength * sunlightStrength, ambientLight)); 4197} 4198 4199void main() { 4200 float horizonWidth = 0.005; 4201 float horizonHeight = 0.0; 4202 4203 vec3 adjustedSkyColor = adjustColor(skyColor); 4204 vec3 adjustedVoidColor = adjustColor(voidColor); 4205 float voidMultiplier = (clamp(vPosition.y - horizonHeight, -horizonWidth, horizonWidth) + horizonWidth) / (horizonWidth * 2.0); 4206 vec3 color = mix(adjustedVoidColor, adjustedSkyColor, voidMultiplier); 4207 4208 gl_FragColor = vec4(color, 1.0); 4209} 4210`,SKY_VERTEX_SHADER=` 4211varying vec3 vPosition; 4212void main() { 4213 vPosition = position; 4214 4215 gl_Position = 4216 projectionMatrix * 4217 modelViewMatrix * 4218 vec4(position, 1); 4219} 4220`;class SkyboxScene extends Scene{constructor(e){super(),this.matrixWorldAutoUpdate=!1,Object.defineProperty(this,"isSkyboxScene",{value:!0});let t=new SphereGeometry(1,40,5),i=new ShaderMaterial({uniforms:e,vertexShader:SKY_VERTEX_SHADER,fragmentShader:SKY_FRAGMENT_SHADER,side:BackSide}),r=new Mesh(t,i);this.add(r)}}class CombinedCamera extends PerspectiveCamera{constructor(e,t,i,r,s){super(e,t,i,r),this.needsUpdate=!0,this.data=reactive({fov:this.fov,aspect:this.aspect,near:this.near,far:this.far,zoom:this.zoom,ortho:s,distance:1}),Object.defineProperty(this,"fov",{get(){return this.data.fov},set(a){a!==this.data.fov&&(this.data.fov=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"aspect",{get(){return this.data.aspect},set(a){a!==this.data.aspect&&(this.data.aspect=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"near",{get(){return this.data.near},set(a){a!==this.data.near&&(this.data.near=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"far",{get(){return this.data.far},set(a){a!==this.data.far&&(this.data.far=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"zoom",{get(){return this.data.zoom}
4220,set(a){a!==this.data.zoom&&(this.data.zoom=a,this.needsUpdate=!0)}}),this.updateProjectionMatrix()}updateProjectionMatrix(){if(!this.needsUpdate)return;this.ortographicProjection||(this.ortographicProjection=new Matrix4),this.perspectiveProjection||(this.perspectiveProjection=new Matrix4);const e=this.near;let t=e*Math.tan(MathUtils.DEG2RAD*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const m=a.fullWidth,v=a.fullHeight;s+=a.offsetX*r/m,t-=a.offsetY*i/v,r*=a.width/m,i*=a.height/v}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth());let l=-Math.pow(this.ortho-1,6)+1,c=Math.max(this.distance,1e-4)*Math.tan(MathUtils.DEG2RAD*.5*this.fov)/this.zoom,u=2*c,d=this.aspect*u,f=-.5*d;this.perspectiveProjection.makePerspective(s,s+r,t,t-i,e,this.far),this.ortographicProjection.makeOrthographic(f,f+d,c,c-u,e,this.far);for(let m=0;m<16;m++)this.projectionMatrix.elements[m]=this.perspectiveProjection.elements[m]*(1-l)+this.ortographicProjection.elements[m]*l;this.projectionMatrixInverse.copy(this.projectionMatrix).invert(),this.needsUpdate=!1}get isPerspectiveCamera(){return this.ortho<1}set isPerspectiveCamera(e){}get isOrthographicCamera(){return!this.isPerspectiveCamera}set isOrthographicCamera(e){}get type(){return this.isPerspectiveCamera?"PerspectiveCamera":"OrthographicCamera"}set type(e){}get ortho(){return this.data.ortho}set ortho(e){e!==this.data.ortho&&(this.data.ortho=e,this.needsUpdate=!0)}get distance(){return this.data.distance}set distance(e){e!==this.data.distance&&(this.data.distance=e,this.needsUpdate=!0)}}let Stats=function(){let n=0,e=document.createElement("div");e.style.cssText="position:absolute;bottom:5px;right:5px;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++n%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(let v=0;v<e.children.length;v++)e.children[v].style.display=v===m?"block":"none";n=m}function r(){i(-1)}let s=(performance||Date).now(),a=s,o=0,l=s,c=t(new Stats.Panel("FPS","#0ff","#002")),u=t(new Stats.Panel("MS (render)","#0f0","#020")),d=t(new Stats.Panel("MS (all)","#f80","#210")),f=null;return self.performance&&self.performance.memory&&(f=t(new Stats.Panel("MB","#f08","#201"))),i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,hide:r,begin:function(){s=(performance||Date).now()},end:function(){o++;let m=(performance||Date).now();if(u.update(m-s,200),d.update(m-l,200),m>=a+1e3&&(c.update(o*1e3/(m-a),100),a=m,o=0,f)){let v=performance.memory;f.update(v.usedJSHeapSize/1048576,v.jsHeapSizeLimit/1048576)}return m},update:function(){s=this.end(),l=s},domElement:e,setMode:i}};Stats.Panel=function(n,e,t){let i=1/0,r=0,s=Math.round,a=s(window.devicePixelRatio||1),o=160*a,l=96*a,c=3*a,u=3*a,d=3*a,f=15*a,m=154*a,v=77*a,_=document.createElement("canvas");_.width=o,_.height=l,_.style.cssText="width:160px;height:96px";let g=_.getContext("2d");return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=t,g.fillRect(0,0,o,l),g.fillStyle=e,g.fillText(n,c,u),g.fillRect(d,f,m,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(d,f,m,v),{dom:_,update:function(x,S){i=Math.min(i,x),r=Math.max(r,x),g.fillStyle=t,g.globalAlpha=1,g.fillRect(0,0,o,f),g.fillStyle=e,g.fillText(s(x)+" "+n+" ("+s(i)+"-"+s(r)+")",c,u),g.drawImage(_,d+a,f,m-a,v,d,f,m-a,v),g.fillRect(d+m-a,f,a,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(d+m-a,f,a,s((1-x/S)*v))}}};class WebGL{static isWebGLAvailable(){try{const e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}static isWebGL2Available(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}static getWebGLErrorMessage(){return this.getErrorMessage(1)}static getWebGL2ErrorMessage(){return this.getErrorMessage(2)}static getErrorMessage(e){const t={1:"WebGL",2:"WebGL 2"},i={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext};
4220let r='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';const s=document.createElement("div");return s.id="webglmessage",s.style.fontFamily="monospace",s.style.fontSize="13px",s.style.fontWeight="normal",s.style.textAlign="center",s.style.background="#fff",s.style.color="#000",s.style.padding="1.5em",s.style.width="400px",s.style.margin="5em auto 0",i[e]?r=r.replace("$0","graphics card"):r=r.replace("$0","browser"),r=r.replace("$1",t[e]),s.innerHTML=r,s}}class MapViewer{constructor(e,t=e){me(this,"handleContainerResize",()=>{this.renderer.setSize(this.rootElement.clientWidth,this.rootElement.clientHeight),this.renderer.setPixelRatio(window.devicePixelRatio*this.superSampling),this.css2dRenderer.setSize(this.rootElement.clientWidth,this.rootElement.clientHeight),this.camera.aspect=this.rootElement.clientWidth/this.rootElement.clientHeight,this.camera.updateProjectionMatrix(),this.redraw()});me(this,"redraw",()=>{this.lastRedrawChange=Date.now()});me(this,"renderLoop",e=>{requestAnimationFrame(this.renderLoop),this.lastFrame<=0&&(this.lastFrame=e);let t=e-this.lastFrame;this.stats.begin(),this.map!=null&&this.controlsManager.update(t,this.map),(t>=50||Date.now()-this.lastRedrawChange<1e3)&&(this.lastFrame=e,this.render(t)),this.stats.update()});me(this,"updateLoadedMapArea",()=>{this.map&&(this.controlsManager.distance<1e3?this.map.loadMapArea(this.data.loadedCenter.x,this.data.loadedCenter.y,this.data.loadedHiresViewDistance,this.data.loadedLowresViewDistance):this.map.loadMapArea(this.data.loadedCenter.x,this.data.loadedCenter.y,0,this.data.loadedLowresViewDistance))});if(Object.defineProperty(this,"isMapViewer",{value:!0}),this.rootElement=e,this.events=t,this.data=reactive({map:null,mapState:"unloaded",camera:null,controlsManager:null,uniforms:{distance:{value:0},sunlightStrength:{value:1},ambientLight:{value:0},skyColor:{value:new Color(.5,.5,1)},voidColor:{value:new Color(0,0,0)},chunkBorders:{value:!1},hiresTileMap:{value:{map:null,size:TileManager.tileMapSize,scale:new Vector2(1,1),translate:new Vector2,pos:new Vector2}}},superSampling:1,loadedCenter:new Vector2(0,0),loadedHiresViewDistance:200,loadedLowresViewDistance:2e3}),this.tileCacheHash=generateCacheHash(),this.stats=new Stats,this.stats.hide(),!WebGL.isWebGL2Available())throw new Error("WebGL2 is not available in your browser. It's not bluemaps fault, i promise ;_; !");this.renderer=new WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0}),this.renderer.autoClear=!1,this.renderer.uniforms=this.data.uniforms,this.css2dRenderer=new CSS2DRenderer(this.events),this.skyboxScene=new SkyboxScene(this.data.uniforms),this.camera=new CombinedCamera(75,1,.1,1e4,0),this.skyboxCamera=new PerspectiveCamera(75,1,.1,1e4),this.skyboxCamera.updateProjectionMatrix(),this.controlsManager=new ControlsManager(this,this.camera),this.raycaster=new Raycaster,this.raycaster.layers.enableAll(),this.raycaster.params.Line2={threshold:20},this.map=null,this.markers=new MarkerSet("bm-root"),this.lastFrame=0,this.lastRedrawChange=0,t.addEventListener("bluemapCameraMoved",this.redraw),t.addEventListener("bluemapTileLoaded",this.redraw),this.initializeRootElement(),window.addEventListener("resize",this.handleContainerResize),requestAnimationFrame(this.renderLoop)}initializeRootElement(){this.rootElement.innerHTML="";let e=htmlToElement('<div style="position: relative; width: 100%; height: 100%; overflow: hidden;"></div>');this.rootElement.appendChild(e),e.appendChild(this.renderer.domElement),this.css2dRenderer.domElement.style.position="absolute",this.css2dRenderer.domElement.style.top="0",this.css2dRenderer.domElement.style.left="0",this.css2dRenderer.domElement.style.pointerEvents="none",e.appendChild(this.css2dRenderer.domElement),e.appendChild(this.stats.dom),this.handleContainerResize()}handleMapInteraction(e,t={}){let i=elementOffset(this.rootElement),r=new Vector2((e.x-i.left)/this.rootElement.clientWidth*2-1,-((e.y-i.top)/this.rootElement.clientHeight)*2+1);if(this.map&&this.map.isLoaded){this.camera.updateMatrixWorld(),this.raycaster.setFromCamera(r,this.camera);let s=this.map.hiresTileManager.scene.position;s.x=0,s.z=0,this.map.hiresTileManager.scene.updateMatrixWorld();const a=[this.map.hiresTileManager.scene,this.markers];for(let f=0;f<this.map.lowresTileManager.length;f++){let m=this.map.lowresTileManager[f].scene.position;m.x=0,m.z=0,this.map.lowresTileManager[f].scene.updateMatrixWorld(),a.push(this.map.lowresTileManager[f].scene)}let o=this.raycaster.intersectObjects(a,!0),l=null,c=[],u=null,d=!1;for(let f=0;f<o.length;f++)if(o[f].object){let m=o[f].object,v=m,_=v.visible;for(;_&&v.parent;)v=v.parent,_=v.visible;if(_){l||(l=o[f]);let g=m;for(;g.parent;)g=g.parent;for(let x=0;x<this.map.lowresTileManager.length;x++)g===this.map.lowresTileManager[x].sceneParent&&(c[x]||(c[x]=o[f]));if(g===this.map.hiresTileManager.sceneParent&&(u||(u=o[f])),(!d||m.material&&!m.material.depthTest)&&m.onClick&&m.onClick({data:t,intersection:o[f]}))return;g!==this.map.lowresTileManager[0].sceneParent&&(d=!0)}}dispatchEvent(this.events,"bluemapMapInteraction",{data:t,hit:l,hiresHit:u,lowresHits:c,intersections:o,ray:this.raycaster.ray}
4220)}}render(e){if(dispatchEvent(this.events,"bluemapRenderFrame",{delta:e}),this.renderer.clear(),this.skyboxCamera.rotation.copy(this.camera.rotation),this.renderer.render(this.skyboxScene,this.skyboxCamera),this.renderer.clearDepth(),this.map&&this.map.isLoaded){this.map.animations.forEach(o=>o.step(e));const t=1e4,i=Math.round(this.camera.position.x/t)*t,r=Math.round(this.camera.position.z/t)*t;this.camera.position.x-=i,this.camera.position.z-=r,this.data.uniforms.distance.value=this.controlsManager.distance,this.data.uniforms.hiresTileMap.value.pos.copy(this.map.hiresTileManager.centerTile),this.data.uniforms.hiresTileMap.value.translate.set(this.map.data.hires.translate.x-i,this.map.data.hires.translate.z-r);const s=this.camera.far;this.controlsManager.distance<1e3&&(this.camera.far=1e6),this.camera.updateProjectionMatrix();const a=this.map.lowresTileManager.length-1;for(let o=this.map.lowresTileManager.length-1;o>=0;o--)if(o===a||this.controlsManager.distance<1e3*Math.pow(this.map.data.lowres.lodFactor,o+1)){let l=this.map.lowresTileManager[o].scene.position;l.x=-i,l.z=-r,o===0&&(this.camera.far=s,this.camera.updateProjectionMatrix()),this.renderer.render(this.map.lowresTileManager[o].sceneParent,this.camera),o!==0&&this.renderer.clearDepth()}if(this.camera.far=s,this.controlsManager.distance<1e3){this.camera.updateProjectionMatrix();let o=this.map.hiresTileManager.scene.position;o.x=-i,o.z=-r,this.renderer.render(this.map.hiresTileManager.sceneParent,this.camera)}this.camera.position.x+=i,this.camera.position.z+=r}this.renderer.render(this.markers,this.camera),this.css2dRenderer.render(this.markers,this.camera)}switchMap(e=null){return this.map&&this.map.isMap&&this.map.unload(),this.data.mapState="loading",this.map=e,this.map&&this.map.isMap?e.load(HIRES_VERTEX_SHADER,HIRES_FRAGMENT_SHADER,LOWRES_VERTEX_SHADER,LOWRES_FRAGMENT_SHADER,this.data.uniforms,this.tileCacheHash).then(()=>{for(let t of this.map.loadedTextures)this.renderer.initTexture(t);this.data.uniforms.distance.value=this.controlsManager.distance,this.data.uniforms.skyColor.value=e.data.skyColor,this.data.uniforms.voidColor.value=e.data.voidColor,this.data.uniforms.ambientLight.value=e.data.ambientLight,this.data.uniforms.sunlightStrength.value=e.data.skyLight,this.data.uniforms.hiresTileMap.value.map=e.hiresTileManager.tileMap.texture,this.data.uniforms.hiresTileMap.value.scale.set(e.data.hires.tileSize.x,e.data.hires.tileSize.z),this.data.uniforms.hiresTileMap.value.translate.set(e.data.hires.translate.x,e.data.hires.translate.z),setTimeout(this.updateLoadedMapArea),this.data.mapState="loaded",dispatchEvent(this.events,"bluemapMapChanged",{map:e})}).catch(t=>{throw this.data.mapState="errored",this.map=null,t}):Promise.resolve()}loadMapArea(e,t,i=-1,r=-1){this.data.loadedCenter.set(e,t),i>=0&&(this.data.loadedHiresViewDistance=i),r>=0&&(this.data.loadedLowresViewDistance=r),this.updateLoadedMapArea()}clearTileCache(e){if(e||(e=generateCacheHash()),this.tileCacheHash=e,this.map){for(let t=0;t<this.map.lowresTileManager.length;t++)this.map.lowresTileManager[t].tileLoader.tileCacheHash=this.tileCacheHash;this.map.hiresTileManager.tileLoader.tileCacheHash=this.tileCacheHash}}get superSampling(){return this.data.superSampling}set superSampling(e){this.data.superSampling=e,this.handleContainerResize()}get camera(){return this._camera}set camera(e){this._camera=e,this.data.camera=e.data}get controlsManager(){return this._controlsManager}set controlsManager(e){this._controlsManager=e,this.data.controlsManager=e.data}get map(){return this._map}set map(e){this._map=e,e&&(this.data.map=e.data)}}const _t=class _t extends Marker{constructor(t,i,r){super(t);me(this,"onMapInteraction",t=>{var s,a,o,l,c,u;let i=!0,r=t.detail.hiresHit;if(t.detail.lowresHits)for(let d=0;d<t.detail.lowresHits.length&&!r;d++)i=!1,r=t.detail.lowresHits[d];if(r){if(this.position.copy(r.pointOnLine||r.point).add(t.detail.ray.direction.clone().multiplyScalar(.05)).floor(),i?this.element.innerHTML=` 4221 <div class="group" 4222 data-tooltip="${i18n.t("blockTooltip.clipboard")}" 4223 onclick="BlueMap.PopupMarker.copyToClipboard('${_t.blockClipboardFormat(this.position,!0)}')" > 4224 <div class="label">${i18n.t("blockTooltip.block")}:</div> 4225 <div class="content"> 4226 <div class="entry"><span class="label">x: </span><span class="value">${this.position.x}</span></div> 4227 <div class="entry"><span class="label">y: </span><span class="value">${this.position.y}</span></div> 4228 <div class="entry"><span class="label">z: </span><span class="value">${this.position.z}</span></div> 4229 </div> 4230 </div> 4231 `:this.element.innerHTML=` 4232 <div class="group" 4233 data-tooltip="${i18n.t("blockTooltip.clipboard")}" 4234 onclick="BlueMap.PopupMarker.copyToClipboard('${_t.blockClipboardFormat(this.position,!1)}')" > 4235 <div class="label">${i18n.t("blockTooltip.position")}:</div> 4236 <div class="content"> 4237 <div class="entry"><span class="label">x: </span><span class="value">${this.position.x}</span></div> 4238 <div class="entry"><span class="label">z: </span><span class="value">${this.position.z}</span></div> 4239 </div> 4240 </div> 4241 `,this.appState.debug){let d=this.position.clone().divideScalar(16).floor(),f=new Vector2(this.position.x,this.position.z).divideScalar(512).floor(),m=`r.${f.x}.${f.y}.mca`;i?this.element.innerHTML+=` 4242 <hr> 4243 <div class="group" 4244 data-tooltip="${i18n.t("blockTooltip.clipboard")}" 4245 onclick="BlueMap.PopupMarker.copyToClipboard('${_t.chunkClipboardFormat(d,!0)}')" > 4246 <div class="label">${i18n.t("blockTooltip.chunk")}:</div> 4247 <div class="content"> 4248 <div class="entry"><span class="label">x: </span><span class="value">${d.x}</span></div> 4249 <div class="entry"><span class="label">y: </span><span class="value">${d.y}</span></div> 4250 <div class="entry"><span class="label">z: </span><span class="value">${d.z}</span></div> 4251 </div> 4252 </div> 4253 `:this.element.innerHTML+=` 4254 <hr> 4255 <div class="group" 4256 data-tooltip="${i18n.t("blockTooltip.clipboard")}" 4257 onclick="BlueMap.PopupMarker.copyToClipboard('${_t.chunkClipboardFormat(d,!1)}')" > 4258 <div class="label">${i18n.t("blockTooltip.chunk")}:</div> 4259 <div class="content"> 4260 <div class="entry"><span class="label">x: </span><span class="value">${d.x}</span></div> 4261 <div class="entry"><span class="label">z: </span><span class="value">${d.z}</span></div> 4262 </div> 4263 </div> 4264 `,this.element.innerHTML+=` 4265 <hr> 4266 <div class="group" 4267 data-tooltip="${i18n.t("blockTooltip.clipboard")}" 4268 onclick="BlueMap.PopupMarker.copyToClipboard('${_t.regionClipboardFormat(f)}')" > 4269 <div class="label">${i18n.t("blockTooltip.region.region")}:</div> 4270 <div class="content"> 4271 <div class="entry"><span class="label">x: </span><span class="value">${f.x}</span></div> 4272 <div class="entry"><span class="label">z: </span><span class="value">${f.y}</span></div> 4273 </div> 4274 <div class="content"> 4275 <div class="entry"><span class="label">${i18n.t("blockTooltip.region.file")}: </span><span class="value">${m}</span></div> 4276 </div> 4277 </div> 4278 `}if(this.appState.debug){let d=r.faceIndex,f=r.object.geometry.attributes;if(f.sunlight&&f.blocklight){let m=f.sunlight.array[d*3],v=f.blocklight.array[d*3];this.element.innerHTML+=` 4279 <hr> 4280 <div class="group"> 4281 <div class="label">${i18n.t("blockTooltip.light.light")}:</div> 4282 <div class="content"> 4283 <div class="entry"><span class="label">${i18n.t("blockTooltip.light.sun")}: </span><span class="value">${m}</span></div> 4284 <div class="entry"><span class="label">${i18n.t("blockTooltip.light.block")}: </span><span class="value">${v}</span></div> 4285 </div> 4286 </div> 4287 `}}if(this.appState.debug){let d="";if(i){let f=(o=(a=(s=t.detail.hiresHit)==null?void 0:s.object)==null?void 0:a.userData)==null?void 0:o.tileUrl;d+=`<div>${f}</div>`}if(t.detail.lowresHits)for(let f=0;f<t.detail.lowresHits.length;f++){let m=(u=(c=(l=t.detail.lowresHits[f])==null?void 0:l.object)==null?void 0:c.userData)==null?void 0:u.tileUrl;m&&(d+=`<div>${m}</div>`)}this.element.innerHTML+=` 4288 <hr> 4289 <div class="files"> 4290 ${d} 4291 </div> 4292 `}this.appState.debug&&console.debug("Clicked Position Data:",t.detail),this.open()}});me(this,"removeHandler",t=>{t.composedPath().includes(this.element)||this.close()});this.data.type="popup",this.data.label="Last Map Interaction",this.data.listed=!1,this.appState=i,this.events=r,this.visible=!1,this.elementObject=ne
4292w CSS2DObject(htmlToElement(`<div id="bm-marker-${this.data.id}" class="bm-marker-${this.data.type}">Test</div>`)),this.elementObject.position.set(.5,1,.5),this.elementObject.disableDepthTest=!0,this.addEventListener("removed",()=>{this.element.parentNode&&this.element.parentNode.removeChild(this.element)});let s=new BoxGeometry(1.01,1.01,1.01).translate(.5,.5,.5),a=new MeshBasicMaterial({color:16777215,opacity:.5,transparent:!0});this.cube=new Mesh(s,a),this.cube.onClick=o=>this.onClick(o),this.add(this.elementObject),this.add(this.cube),this.animation=null,this.events.addEventListener("bluemapMapInteraction",o=>window.setTimeout(()=>this.onMapInteraction(o))),window.addEventListener("mousedown",this.removeHandler),window.addEventListener("touchstart",this.removeHandler,{passive:!0}),window.addEventListener("keydown",this.removeHandler),window.addEventListener("mousewheel",this.removeHandler)}onClick(t){return!0}open(){this.animation&&this.animation.cancel(),this.visible=!0,this.cube.visible=!0;let t=1;this.element.style.opacity="0",this.animation=animate(i=>{this.element.style.opacity=(i*t).toString()},300)}close(){this.animation&&this.animation.cancel(),this.cube.visible=!1;let t=parseFloat(this.element.style.opacity);this.animation=animate(i=>{this.element.style.opacity=(t-i*t).toString()},300,i=>{i&&(this.visible=!1)})}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}dispose(){super.dispose(),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}};me(_t,"copyToClipboard",t=>{var r;if((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)navigator.clipboard.writeText(t).catch(s=>console.error(s));else{let s=function(a){a.clipboardData.setData("text/plain",t),a.preventDefault()};var i=s;document.addEventListener("copy",s),document.execCommand("copy"),document.removeEventListener("copy",s)}}),me(_t,"blockClipboardFormat",(t,i)=>i?`${t.x} ${t.y} ${t.z}`:`${t.x} ${t.z}`),me(_t,"chunkClipboardFormat",(t,i)=>i?`${t.x} ${t.y} ${t.z}`:`${t.x} ${t.z}`),me(_t,"regionClipboardFormat",t=>`r.${t.x}.${t.y}.mca`);let PopupMarker=_t;class BlueMapApp{constructor(e){me(this,"update",async()=>{await this.followPlayerMarkerWorld(),this.updateLoop=setTimeout(this.update,1e3)});me(this,"cameraMoved",()=>{this.hashUpdateTimeout&&clearTimeout(this.hashUpdateTimeout),this.hashUpdateTimeout=setTimeout(this.updatePageAddress,1500),this.lastCameraMove=Date.now()});me(this,"loadBlocker",async()=>{if(!this.appState.controls.pauseTileLoading)return;let e;do e=250-(Date.now()-this.lastCameraMove),e>0&&await this.sleep(e);while(e>0)});me(this,"updatePageAddress",()=>{let e="#";if(this.mapViewer.map){e+=this.mapViewer.map.data.id;let t=this.mapViewer.controlsManager;e+=":"+round(t.position.x,0),e+=":"+round(t.position.y,0),e+=":"+round(t.position.z,0),e+=":"+round(t.distance,0),e+=":"+round(t.rotation,2),e+=":"+round(t.angle,2),e+=":"+round(t.tilt,2),e+=":"+round(t.ortho,0),e+=":"+this.appState.controls.state}history.replaceState(void 0,void 0,e),document.title=i18n.t("pageTitle",{map:this.mapViewer.map?this.mapViewer.map.data.name:"?",version:this.settings.version})});me(this,"loadPageAddress",async()=>{var r;let t=(((r=window.location.hash)==null?void 0:r.substring(1))||this.settings.startLocation||"").split(":");if(t.length===1&&(!this.mapViewer.map||this.mapViewer.map.data.id!==t[0])){try{await this.switchMap(t[0])}catch{return!1}return!0}if(t.length!==10)return!1;let i=this.mapViewer.controlsManager;if(i.controls=null,!this.mapViewer.map||this.mapViewer.map.data.id!==t[0])try{await this.switchMap(t[0])}catch{return!1}switch(t[9]){case"flat":this.setFlatView(0);break;case"free":this.setFreeFlight(0,i.position.y);break;default:this.setPerspectiveView(0);break}return i.position.x=parseFloat(t[1]),i.position.y=parseFloat(t[2]),i.position.z=parseFloat(t[3]),i.distance=parseFloat(t[4]),i.rotation=parseFloat(t[5]),i.angle=parseFloat(t[6]),i.tilt=parseFloat(t[7]),i.ortho=parseFloat(t[8]),this.updatePageAddress(),this.mapViewer.updateLoadedMapArea(),!0});me(this,"mapInteraction",e=>{var t,i;if(e.detail.data.doubleTap){let r=this.mapViewer.controlsManager,s=((t=e.detail.hit)==null?void 0:t.point)||((i=e.detail.object)==null?void 0:i.getWorldPosition(new Vector3));if(!s)return;let a=r.distance,o=Math.max(a*.25,5),l=r.position.x,c=s.x,u=r.position.z,d=s.z;this.viewAnimation=animate(f=>{let m=EasingFunctions.easeInOutQuad(f);r.distance=MathUtils.lerp(a,o,m),r.position.x=MathUtils.lerp(l,c,m),r.position.z=MathUtils.lerp(u,d,m)},500)}});me(this,"takeScreenshot",()=>{let e=document.createElement("a");e.download="bluemap-screenshot.png",e.href=this.mapViewer.renderer.domElement.toDataURL("image/png"),e.click(),this.appState.screenshot.clipboard&&this.mapViewer.renderer.domElement.toBlob(t=>{navigator.clipboard.write([new ClipboardItem({"image/png":t})]).catch(i=>{alert(this.events,"Failed to copy screenshot to clipboard: "+i,"error")})})});this.events=e,this.mapViewer=new MapViewer(e,this.events),this.mapControl
4292s=new MapControls(this.mapViewer.renderer.domElement,e),this.freeFlightControls=new FreeFlightControls(this.mapViewer.renderer.domElement),this.playerMarkerManager=null,this.markerFileManager=null,this.settings=null,this.savedUserSettings=new Map,this.maps=[],this.mapsMap=new Map,this.lastCameraMove=0,this.mainMenu=reactive(new MainMenu$1),this.appState=reactive({controls:{state:"perspective",mouseSensitivity:1,showZoomButtons:!0,invertMouse:!1,pauseTileLoading:!1},menu:this.mainMenu,maps:[],theme:null,screenshot:{clipboard:!0},debug:!1}),this.updateControlsSettings(),this.initGeneralEvents(),this.popupMarkerSet=new MarkerSet("bm-popup-set"),this.popupMarkerSet.data.toggleable=!1,this.popupMarker=new PopupMarker("bm-popup",this.appState,this.events),this.popupMarkerSet.add(this.popupMarker),this.mapViewer.markers.add(this.popupMarkerSet),this.updateLoop=null,this.hashUpdateTimeout=null,this.viewAnimation=null}async load(){let e=this.maps;if(this.maps=[],this.appState.maps.splice(0,this.appState.maps.length),this.mapsMap.clear(),await this.get
4292Settings(),this.mapControls.minDistance=this.settings.minZoomDistance,this.mapControls.maxDistance=this.settings.maxZoomDistance,this.settings.styles)for(let t of this.settings.styles){let i=document.createElement("link");i.rel="stylesheet",i.href=t,alert(this.events,"Loading style: "+t,"fine"),document.head.appendChild(i)}await this.mapViewer.switchMap(null),e.forEach(t=>t.dispose()),await this.loadUserSettings(),this.maps=await this.loadMaps();for(let t of this.maps)this.mapsMap.set(t.data.id,t),this.appState.maps.push(t.data);try{await this.loadPageAddress()||(this.maps.length>0&&await this.switchMap(this.maps[0].data.id),this.resetCamera())}catch(t){console.error("Failed to load map!",t)}if(window.addEventListener("hashchange",this.loadPageAddress),this.events.addEventListener("bluemapCameraMoved",this.cameraMoved),this.events.addEventListener("bluemapMapInteraction",this.mapInteraction),this.updateLoop&&clearTimeout(this.updateLoop),this.updateLoop=setTimeout(this.update,1e3),this.saveUserSettings(),this.settings.scripts)for(let t of this.settings.scripts){let i=document.createElement("script");i.src=t,alert(this.events,"Loading script: "+t,"fine"),document.body.appendChild(i)}}async followPlayerMarkerWorld(){var t;let e=(t=this.mapViewer.controlsManager.controls)==null?void 0:t.data.followingPlayer;if(this.mapViewer.map&&e&&e.foreign){let i=await this.findPlayerMap(e.playerUuid);if(i){this.mainMenu.closeAll(),await this.switchMap(i.data.id,!1);let r=this.playerMarkerManager.getPlayerMarker(e.playerUuid);r&&this.mapViewer.controlsManager.controls.followPlayerMarker&&this.mapViewer.controlsManager.controls.followPlayerMarker(r)}else this.mapViewer.controlsManager.controls.stopFollowingPlayerMarker&&this.mapViewer.controlsManager.controls.stopFollowingPlayerMarker()}}async findPlayerMap(e){let t=null;if(this.maps.length<20)for(let i of this.maps){let r=await this.loadPlayerData(i);if(Array.isArray(r.players)){for(let s of r.players)if(s.uuid===e&&!s.foreign){t=i;break}if(t)break}}return t}async switchMap(e,t=!0){let i=this.mapsMap.get(e);if(!i)return Promise.reject(`There is no map with the id "${e}" loaded!`);this.playerMarkerManager&&this.playerMarkerManager.dispose(),this.markerFileManager&&this.markerFileManager.dispose(),await this.mapViewer.switchMap(i),(t||!this.mapViewer.map.hasView(this.appState.controls.state))&&this.resetCamera(),this.updatePageAddress(),await Promise.all([this.initPlayerMarkerManager(),this.initMarkerFileManager()])}resetCamera(){let e=this.mapViewer.map,t=this.mapViewer.controlsManager;e&&(t.position.set(e.data.startPos.x,0,e.data.startPos.z),t.distance=1500,t.angle=0,t.rotation=0,t.tilt=0,t.ortho=0),t.controls=this.mapControls,this.appState.controls.state="perspective",this.settings.defaultToFlatView&&e.hasView("flat")?this.setFlatView():e.hasView("perspective")||(e.hasView("flat")?this.setFlatView():this.setFreeFlight()),this.updatePageAddress()}async loadMaps(){let e=this.settings,t=[];if(e.maps!==void 0){let i=e.maps.map(r=>{let s=new Map$1(r,e.mapDataRoot+"/"+r,e.liveDataRoot+"/"+r,this.loadBlocker,this.mapViewer.events);return t.push(s),s.loadSettings(this.mapViewer.tileCacheHash).catch(a=>{alert(this.events,`Failed to load settings for map '${s.data.id}':`+a,"warning")})});await Promise.all(i)}return t.sort((i,r)=>{let s=i.data.sorting-r.data.sorting;return isNaN(s)?0:s}),t}async getSettings(){if(!this.settings){let e=await this.loadSettings();this.settings={version:"?",useCookies:!1,defaultToFlatView:!1,resolutionDefault:1,minZoomDistance:5,maxZoomDistance:1e5,hiresSliderMax:500,hiresSliderDefault:100,hiresSliderMin:0,lowresSliderMax:7e3,lowresSliderDefault:2e3,lowresSliderMin:500,mapDataRoot:"maps",liveDataRoot:"maps",maps:["world","world_the_end","world_nether"],scripts:[],styles:[],...e}}return this.settings}loadSettings(){return new Promise((e,t)=>{let i=new FileLoader$1;i.setResponseType("json"),i.load("settings.json?"+generateCacheHash(),e,()=>{},()=>t("Failed to load the settings.json!"))})}loadPlayerData(e){return new Promise((t,i)=>{let r=new FileLoader$1;r.setResponseType("json"),r.load(e.data.liveDataRoot+"/live/players.json?"+generateCacheHash(),s=>{s?t(s):i(`Failed to parse '${this.fileUrl}'!`)},()=>{},()=>i(`Failed to load '${this.fileUrl}'!`))})}initPlayerMarkerManager(){this.playerMarkerManager&&this.playerMarkerManager.dispose();const e=this.mapViewer.map;if(e)return this.playerMarkerManager=new PlayerMarkerManager(this.mapViewer.markers,e.data.liveDataRoot+"/live/players.json",e.data.mapDataRoot+"/assets/playerheads/",this.events),this.playerMarkerManager.setAutoUpdateInterval(0),this.playerMarkerManager.update(
4292).then(()=>{this.playerMarkerManager.setAutoUpdateInterval(1e3)}).catch(t=>{alert(this.events,t,"warning"),this.playerMarkerManager.dispose()})}initMarkerFileManager(){this.markerFileManager&&this.markerFileManager.dispose();const e=this.mapViewer.map;if(e)return this.markerFileManager=new NormalMarkerManager(this.mapViewer.markers,e.data.liveDataRoot+"/live/markers.json",this.events),this.markerFileManager.update().then(()=>{this.markerFileManager.setAutoUpdateInterval(1e3*10)}).catch(t=>{alert(this.events,t,"warning"),this.markerFileManager.dispose()})}updateControlsSettings(){let e=this.appState.controls.invertMouse?-1:1;this.freeFlightControls.mouseRotate.speedCapture=-1.5*this.appState.controls.mouseSensitivity,this.freeFlightControls.mouseAngle.speedCapture=-1.5*this.appState.controls.mouseSensitivity*e,this.freeFlightControls.mouseRotate.speedRight=-2*this.appState.controls.mouseSensitivity,this.freeFlightControls.mouseAngle.speedRight=-2*this.appState.controls.mouseSensitivity*e}initGeneralEvents(){document.addEventListener("fullscreenchange",e=>{document.fullscreenElement&&this.mainMenu.closeAll()})}setPerspectiveView(e=0,t=5){if(!this.mapViewer.map||!this.mapViewer.map.data.perspectiveView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=Math.max(5,t,r),a=i.position.y,o=MathUtils.lerp(this.mapViewer.map.terrainHeightAt(i.position.x,i.position.z)+3,0,s/500),l=i.angle,c=Math.min(Math.PI/2,l,MapControls.getMaxPerspectiveAngleForDistance(s)),u=i.ortho,d=i.tilt;this.viewAnimation=animate(f=>{let m=EasingFunctions.easeInOutQuad(f);i.position.y=MathUtils.lerp(a,o,m),i.distance=MathUtils.lerp(r,s,m),i.angle=MathUtils.lerp(l,c,m),i.ortho=MathUtils.lerp(u,0,f),i.tilt=MathUtils.lerp(d,0,m)},e,f=>{this.mapControls.reset(),f&&(i.controls=this.mapControls,this.updatePageAddress())}),this.appState.controls.state="perspective"}setFlatView(e=0,t=5){if(!this.mapViewer.map||!this.mapViewer.map.data.flatView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=Math.max(5,t,r),a=i.rotation,o=i.angle,l=i.ortho,c=i.tilt;this.viewAnimation=animate(u=>{let d=EasingFunctions.easeInOutQuad(u);i.distance=MathUtils.lerp(r,s,d),i.rotation=MathUtils.lerp(a,0,d),i.angle=MathUtils.lerp(o,0,d),i.ortho=MathUtils.lerp(l,1,u),i.tilt=MathUtils.lerp(c,0,d)},e,u=>{this.mapControls.reset(),u&&(i.controls=this.mapControls,this.updatePageAddress())}),this.appState.controls.state="flat"}setFreeFlight(e=0,t=void 0){if(!this.mapViewer.map||!this.mapViewer.map.data.freeFlightView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=i.position.y;t||(t=this.mapViewer.map.terrainHeightAt(i.position.x,i.position.z)+3||s);let a=i.angle,o=Math.PI/2,l=i.ortho,c=i.tilt;this.viewAnimation=animate(u=>{let d=EasingFunctions.easeInOutQuad(u);i.position.y=MathUtils.lerp(s,t,d),i.distance=MathUtils.lerp(r,0,d),i.angle=MathUtils.lerp(a,o,d),i.ortho=MathUtils.lerp(l,0,Math.min(u*2,1)),i.tilt=MathUtils.lerp(c,0,d)},e,u=>{u&&(i.controls=this.freeFlightControls,this.updatePageAddress())}),this.appState.controls.state="free"}setChunkBorders(e){this.mapViewer.data.uniforms.chunkBorders.value=e}setDebug(e){this.appState.debug=e,e?this.mapViewer.stats.showPanel(0):this.mapViewer.stats.showPanel(-1)}setTheme(e){this.appState.theme=e,e==="light"?(this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.remove("theme-contrast"),this.mapViewer.rootElement.classList.add("theme-light")):e==="dark"?(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-contrast"),this.mapViewer.rootElement.classList.add("theme-dark")):e==="contrast"?(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.add("theme-contrast")):(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.remove("theme-contrast"))}setScreenshotClipboard(e){this.appState.screenshot.clipboard=e}async updateMap(){try{this.mapViewer.clearTileCache(),this.mapViewer.map&&await this.switchMap(this.mapViewer.map.data.id,!1),this.saveUserSettings()}catch(e){alert(this.events,e,"error")}}resetSettings(){this.saveUserSetting("resetSettings",!0),location.reload()}async loadUserSettings(){if(isNaN(this.settings.resolutionDefault)||(this.mapViewer.data.superSampling=this.settings.resolutionDefault),isNaN(this.settings.hiresSliderDefault)||(this.mapViewer.data.loadedHiresViewDistance=this.settings.hiresSliderDefault),isNaN(this.settings.lowresSliderDefault)||(this.mapViewer.data.loadedLowresViewDistance=this.settings.lowresSliderDefault),!this.settings.useCookies)return;if(this.loadUserSetting("resetSettings",!1)){alert(this.events,"Settings reset!","info"),this.saveUserSettings();return}const[e]=performance.getEntriesByType("navigation");e.type!="reload"&&this.mapViewer.clearTileCache(this.loadUserSetting("tileCacheHash",this.mapViewer.tileCacheHash)),this.mapViewer.superSampling=this.loadUserSetting("superSampling",this.mapViewer.data.superSampling),this.mapViewer.data.loadedHiresViewDistance=this.loadUserSetting("hiresViewDistance",this.mapViewer.data.loadedHiresViewDistance),this.mapViewer.data.loadedLowresViewDistance=this.loadUserSetting("lowresViewDistance",this.mapViewer.data.loadedLowresViewDistance),this.mapViewer.updateLoadedMapArea(),this.appState.controls.mouseSensitivity=this.loadUserSetting("mouseSensitivity",this.appState.controls.mouseSensitivity),this.appState.controls.invertMouse=this.loadUserSetting("invertMouse",this.appState.controls.invertMouse),this.appState.controls.pauseTileLoading=this.loadUserSetting("pauseTileLoading",this.appState.controls.pauseTileLoading),this.appState.controls.showZoomButtons=this.loadUserSetting("showZoomButtons",this.appState.controls.showZoomButtons),this.updateControlsSettings(),this.setTheme(this.loadUserSetting("theme",this.appState.theme)),this.setScreenshotClipboard(this.loadUserSetting("screenshotClipboard",this.appState.screenshot.clipboard)),await setLanguage(this.loadUserSetting("lang",i18n.locale.value)),this.setChunkBorders(this.loadUserSetting("chunkBorders",this.mapViewer.data.uniforms.chunkBorders.value)),this.setDebug(this.loadUserSetting("debug",this.appState.debug)),alert(this.events,"Settings loaded!","info")}saveUserSettings(){this.settings.useCookies&&(this.saveUserSetting("resetSettings",!1),this.saveUserSetting("tileCacheHash",this.mapViewer.tileCacheHash),this.saveUserSetting("superSampling",this.mapViewer.data.superSampling),this.saveUserSetting("hiresViewDistance",this.mapViewer.data.loadedHiresViewDistance),this.saveUserSetting("lowresViewDistance",this.mapViewer.data.loadedLowresViewDistance),this.saveUserSetting("mouseSensitivity",this.appState.controls.mouseSensitivity),this.saveUserSetting("invertMouse",this.appState.controls.invertMouse),this.saveUserSetting("pauseTileLoading",this.appState.controls.pauseTileLoading),this.saveUserSetting("showZoomButtons",this.appState.controls.showZoomButtons),this.saveUserSetting("theme",this.appState.theme),this.saveUserSetting("screenshotClipboard",this.appState.screenshot.clipboard),this.saveUserSetting("lang",i18n.locale.value),this.saveUserSetting("chunkBorders",this.mapViewer.data.uniforms.chunkBorders.value),this.saveUserSetting("debug",this.appState.debug),alert(this.events,"Settings saved!","info"))}loadUserSetting(e,t){let i=getLocalStorage("bluemap-"+e);return i===void 0?t:i}saveUserSetting(e,t){this.savedUserSettings.get(e)!==t&&(this.savedUserSettings.set(e,t),setLocalStorage("bluemap-"+e,t))}sleep(e){return new Promise(t=>setTimeout(t,e))}}Object3D.prototype.onClick=function(n){return this.parent?(Array.isArray(n.eventStack)||(n.eventStack=[]),n.eventStack.push(this),this.parent.onClick(n)):!1};const BlueMap=Object.freeze(Object.defineProperty({__proto__:null,BlueMapApp,CSS2DObject,CSS2DRenderer,CombinedCamera,ControlsManager,EasingFunctions,ExtrudeMarker,FreeFlightControls,FreeFlightKeyMoveControls:KeyMoveControls$1,FreeFlightMouseAngleControls:MouseAngleControls$1,FreeFlightMouseRotateControls:MouseRotateControls$1,HIRES_FRAGMENT_SHADER,HIRES_VERTEX_SHADER,HtmlMarker,KeyAngleControls,KeyCombination,KeyHeightControls,KeyRotateControls,KeyZoomControls,LOWRES_FRAGMENT_SHADER,LOWRES_VERTEX_SHADER,LabelPopup,LineMarker,LowresTileLoader,MARKER_FILL_FRAGMENT_SHADER,MARKER_FILL_VERTEX_SHADER,MainMenu:MainMenu$1,Map:Map$1,MapControl
4292s,MapHeightControls,MapKeyMoveControls:KeyMoveControls,MapMouseAngleControls:MouseAngleControls,MapMouseRotateControls:MouseRotateControls,MapViewer,Marker,MarkerManager,MarkerSet,MouseMoveControls,MouseZoomControls,NormalMarkerManager,ObjectMarker,PLAYER_MARKER_SET_ID,PlayerMarker,PlayerMarkerManager,PlayerMarkerSet,PoiMarker,PopupMarker,SKY_FRAGMENT_SHADER,SKY_VERTEX_SHADER,ShapeMarker,SkyboxScene,Three:three_module,Tile,TileLoader,TileManager,TileMap,TouchAngleControls,TouchMoveControls,TouchPanControls,TouchRotateControls,TouchZoomControls,VEC2_ZERO,VEC3_X,VEC3_Y,VEC3_Z,VEC3_ZERO,addEventListeners,alert,animate,deepEquals,dispatchEvent,elementOffset,fetchHocon,generateCacheHash,getLocalStorage,getPixel,hashTile,htmlToElement,htmlToElements,lineShader,pathFromCoords,removeEventListeners,round,setLocalStorage,softClamp,softMax,softMin,softSet,stringToImage,vecArrToObj},Symbol.toStringTag,{value:"Module"}));String.prototype.includesCI=function(n){return this.toLowerCase().includes(n.toLowerCase())};async function load(){try{const n=new BlueMapApp(document.getElementById("map-container"));window.bluemap=n,window.BlueMap=BlueMap;const e=createApp(App,{i18nModule,render:i=>i(App)});e.config.globalProperties.$bluemap=n,e.use(i18nModule),await loadLanguageSettings(),await e.mount("#app").$nextTick(),await n.load()}catch(n){console.error("Failed to load BlueMap webapp!",n),document.body.innerHTML=` 4293 <div id="bm-app-err"> 4294 <div> 4295 <img src="assets/logo.png" alt="bluemap logo"> 4296 <div class="bm-app-err-main">Failed to load BlueMap webapp!</div> 4297 <div class="bm-app-err-hint">Make sure you have <a href="https://get.webgl.org/webgl2/">WebGL2</a> enabled on your browser.</div> 4298 </div> 4299 </div> 4300 `}}load().catch(n=>console.error(n)); 4301//# sourceMappingURL=index-ZbCQNBFs.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.