@epigraph/configurator 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +98 -98
  2. package/dist/index.js +10 -10
  3. package/package.json +89 -89
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@
69
69
  :host {
70
70
  display: none;
71
71
  }
72
- `;let s=ju;c$1([e$2("#qrCodeCanvas")],s.prototype,"_qrCodeGenCanvasRef");window.customElements.get(s.webComponentName)===void 0&&window.customElements.define(s.webComponentName,s);var e$1=(kt=>(kt.millimeter="mm",kt.centimeter="cm",kt.decimeter="dm",kt.meter="m",kt.decameter="dam",kt.hectometer="hm",kt.kilometer="km",kt.inch="in",kt.foot="ft",kt.yard="yd",kt.mile="mi",kt))(e$1||{});let r$3={};r$3[`${e$1.millimeter}-${e$1.meter}`]=.001;r$3[`${e$1.meter}-${e$1.millimeter}`]=1e3;r$3[`${e$1.centimeter}-${e$1.meter}`]=.01;r$3[`${e$1.meter}-${e$1.centimeter}`]=100;r$3[`${e$1.decimeter}-${e$1.meter}`]=.1;r$3[`${e$1.meter}-${e$1.decimeter}`]=10;r$3[`${e$1.meter}-${e$1.meter}`]=1;r$3[`${e$1.decameter}-${e$1.meter}`]=10;r$3[`${e$1.meter}-${e$1.decameter}`]=.1;r$3[`${e$1.hectometer}-${e$1.meter}`]=100;r$3[`${e$1.meter}-${e$1.hectometer}`]=.01;r$3[`${e$1.kilometer}-${e$1.meter}`]=1e3;r$3[`${e$1.meter}-${e$1.kilometer}`]=.001;r$3[`${e$1.inch}-${e$1.meter}`]=.0254;r$3[`${e$1.meter}-${e$1.inch}`]=39.3701;r$3[`${e$1.foot}-${e$1.meter}`]=.3048;r$3[`${e$1.meter}-${e$1.foot}`]=3.28084;r$3[`${e$1.yard}-${e$1.meter}`]=.9144;r$3[`${e$1.meter}-${e$1.yard}`]=1.09361;r$3[`${e$1.mile}-${e$1.meter}`]=1609.34;r$3[`${e$1.meter}-${e$1.mile}`]=621371e-9;const ENV={}.VITE_APP_ENV,ASSETS_SOURCE_ROOT="https://asset.myepigraph.com/configurator-assets",IS_DEV_ENV=!1,LOGGER=new a$1("CONFIGURATOR"),GHOST_LAYER=2,DEFAULT_INVENTORY=99999,DEFAULT_PRODUCT_PRICE=99999,DEFAULT_PRODUCT_COMPARE_AT_PRICE=0,FETCH_CONFIG_ENDPOINT_FB="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=";LOGGER.info({title:"Logger Test"});ENV==="staging"?LOGGER.setCurrentMode(t$3.Staging):LOGGER.setCurrentMode(t$3.Release);const ALL_PROJECTS_ASSET_DATA_ROOT_URL=`${ASSETS_SOURCE_ROOT}/configurator`,GENERIC_PROJECT_ASSET_DATA_ROOT_URL=`${ALL_PROJECTS_ASSET_DATA_ROOT_URL}/generic`,PUBLIC_DESIGN_ASSETS_ENDPOINT="https://storage.googleapis.com/gsc-epigraph-design/product-assets",ALERT_TYPES=Object.freeze({info:{id:"info",level:1e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info.svg",color:"#2E6CDF",cssClass:"alert-info",background:"#D3E0F8",filter:"invert(39%) sepia(41%) saturate(5002%) hue-rotate(208deg) brightness(91%) contrast(92%)"},warn:{id:"warn",level:3e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Warning.svg",color:"#E2B236",cssClass:"alert-warn",background:"#F9EED2",filter:"invert(83%) sepia(67%) saturate(1578%) hue-rotate(328deg) brightness(93%) contrast(90%)"},error:{id:"error",level:4e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Block.svg",color:"#D0342C",cssClass:"alert-error",background:"#F6D7D5",filter:"invert(24%) sepia(96%) saturate(1914%) hue-rotate(349deg) brightness(95%) contrast(81%)"},success:{id:"success",level:2e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),CAMERA_ACTION=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),CURSORS={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},UIModal=({stores:kt,zIndex:_e,open:Dt,setOpen:Vt,heading:Gt,inputValue:zt,buttonText:jt,inputPlaceholder:Ht,formFieldExists:Wt,dualOptions:qt,modalText:Xt,onSubmit:Kt=()=>{},onCancel:Yt=()=>{},shareModal:Zt,loading:Jt,buttonClassName:nn=""})=>{const rn=kt.uiSceneStore(dn=>dn.CORE_API),Qt=reactExports.useRef(null),en=reactExports.useRef(null);reactExports.useState(Dt);const[tn,sn]=reactExports.useState(""),[cn,un]=reactExports.useState(Jt||null);reactExports.useEffect(()=>(un(Jt),()=>{}),[Jt]);function hn(dn){sn(dn.target.value)}return reactExports.useEffect(()=>{en.current&&(kt.uiSceneStore.setState({dialogPopupOpen:Dt}),Dt&&en.current.focus())},[Dt,en]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{ref:Qt,className:Dt===!0?"uiModal open":"uiModal",children:[jsxRuntimeExports.jsxs("div",{className:"modalDialog",children:[jsxRuntimeExports.jsx("div",{className:"modalCloseContainer",children:jsxRuntimeExports.jsx("div",{ref:en,role:"button","aria-label":"Close Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"closeButton",onClick:()=>{Yt(),Vt(!1),rn.coreWCRef.focus()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:dn=>{dn.target.src="https://placehold.co/150"}})})}),jsxRuntimeExports.jsx("h2",{className:"modalHeading",children:Gt}),Xt&&jsxRuntimeExports.jsx("p",{className:"modalText",children:Xt}),jsxRuntimeExports.jsx("div",{className:Zt?"shareModal":"noShareModal",children:cn?jsxRuntimeExports.jsx("div",{className:"shareModalChildDiv",children:jsxRuntimeExports.jsx("img",{alt:"Loading...",className:"shareModalLoaderImg",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:dn=>{dn.target.src="https://placehold.co/150"}})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Wt&&(zt!==void 0?jsxRuntimeExports.jsx("input",{tabIndex:-1,"aria-hidden":!1,type:"text",value:zt,"aria-label":"Shareable Link",autoComplete:"off",readOnly:!0}):jsxRuntimeExports.jsx("input",{tabIndex:Dt?0:-1,"aria-hidden":!Dt,placeholder:Ht||"",type:"text","aria-label":""+Ht,value:tn,autoComplete:"off",onChange:dn=>{hn(dn)}})),qt?jsxRuntimeExports.jsxs("div",{className:"UIModalButtonParentDiv",children:[jsxRuntimeExports.jsx("button",{role:"button","aria-label":jt+" Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,onClick:()=>{Vt(!1),Kt(),rn.coreWCRef.focus()},children:jt}),jsxRuntimeExports.jsx("button",{role:"button","aria-label":"Cancel Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,onClick:()=>{Vt(!1),Yt(),rn.coreWCRef.focus()},className:"uiModalCancelButton",children:"Cancel"})]}):jsxRuntimeExports.jsx("button",{role:"button","aria-label":jt+" Button",tabIndex:Dt?0:-1,"aria-hidden":!Dt,className:nn||"",onClick:()=>{Zt||Vt(!1),Kt(),rn.coreWCRef.focus()},children:jt})]})})]}),jsxRuntimeExports.jsx("div",{className:"modalOverlay"})]})})};function _defineProperties(kt,_e){for(var Dt=0;Dt<_e.length;Dt++){var Vt=_e[Dt];Vt.enumerable=Vt.enumerable||!1,Vt.configurable=!0,"value"in Vt&&(Vt.writable=!0),Object.defineProperty(kt,Vt.key,Vt)}}function _createClass(kt,_e,Dt){return _e&&_defineProperties(kt.prototype,_e),Dt&&_defineProperties(kt,Dt),Object.defineProperty(kt,"prototype",{writable:!1}),kt}var MEDIA_PREFERS_REDUCED_MOTION="(prefers-reduced-motion: reduce)",CREATED=1,MOUNTED=2,IDLE=3,MOVING=4,SCROLLING=5,DRAGGING=6,DESTROYED=7,STATES={CREATED,MOUNTED,IDLE,MOVING,SCROLLING,DRAGGING,DESTROYED};function empty(kt){kt.length=0}function slice$3(kt,_e,Dt){return Array.prototype.slice.call(kt,_e,Dt)}function apply(kt){return kt.bind.apply(kt,[null].concat(slice$3(arguments,1)))}var nextTick=setTimeout,noop$3=function(){};function raf(kt){return requestAnimationFrame(kt)}function typeOf(kt,_e){return typeof _e===kt}function isObject$8(kt){return!isNull(kt)&&typeOf("object",kt)}var isArray$5=Array.isArray,isFunction$5=apply(typeOf,"function"),isString=apply(typeOf,"string"),isUndefined=apply(typeOf,"undefined");function isNull(kt){return kt===null}function isHTMLElement(kt){try{return kt instanceof(kt.ownerDocument.defaultView||window).HTMLElement}catch{return!1}}function toArray(kt){return isArray$5(kt)?kt:[kt]}function forEach$1(kt,_e){toArray(kt).forEach(_e)}function includes(kt,_e){return kt.indexOf(_e)>-1}function push$3(kt,_e){return kt.push.apply(kt,toArray(_e)),kt}function toggleClass(kt,_e,Dt){kt&&forEach$1(_e,function(Vt){Vt&&kt.classList[Dt?"add":"remove"](Vt)})}function addClass(kt,_e){toggleClass(kt,isString(_e)?_e.split(" "):_e,!0)}function append(kt,_e){forEach$1(_e,kt.appendChild.bind(kt))}function before(kt,_e){forEach$1(kt,function(Dt){var Vt=(_e||Dt).parentNode;Vt&&Vt.insertBefore(Dt,_e)})}function matches(kt,_e){return isHTMLElement(kt)&&(kt.msMatchesSelector||kt.matches).call(kt,_e)}function children(kt,_e){var Dt=kt?slice$3(kt.children):[];return _e?Dt.filter(function(Vt){return matches(Vt,_e)}):Dt}function child(kt,_e){return _e?children(kt,_e)[0]:kt.firstElementChild}var ownKeys$2=Object.keys;function forOwn$2(kt,_e,Dt){return kt&&(Dt?ownKeys$2(kt).reverse():ownKeys$2(kt)).forEach(function(Vt){Vt!=="__proto__"&&_e(kt[Vt],Vt)}),kt}function assign(kt){return slice$3(arguments,1).forEach(function(_e){forOwn$2(_e,function(Dt,Vt){kt[Vt]=_e[Vt]})}),kt}function merge(kt){return slice$3(arguments,1).forEach(function(_e){forOwn$2(_e,function(Dt,Vt){isArray$5(Dt)?kt[Vt]=Dt.slice():isObject$8(Dt)?kt[Vt]=merge({},isObject$8(kt[Vt])?kt[Vt]:{},Dt):kt[Vt]=Dt})}),kt}function omit(kt,_e){forEach$1(_e||ownKeys$2(kt),function(Dt){delete kt[Dt]})}function removeAttribute(kt,_e){forEach$1(kt,function(Dt){forEach$1(_e,function(Vt){Dt&&Dt.removeAttribute(Vt)})})}function setAttribute(kt,_e,Dt){isObject$8(_e)?forOwn$2(_e,function(Vt,Gt){setAttribute(kt,Gt,Vt)}):forEach$1(kt,function(Vt){isNull(Dt)||Dt===""?removeAttribute(Vt,_e):Vt.setAttribute(_e,String(Dt))})}function create$3(kt,_e,Dt){var Vt=document.createElement(kt);return _e&&(isString(_e)?addClass(Vt,_e):setAttribute(Vt,_e)),Dt&&append(Dt,Vt),Vt}function style(kt,_e,Dt){if(isUndefined(Dt))return getComputedStyle(kt)[_e];isNull(Dt)||(kt.style[_e]=""+Dt)}function display(kt,_e){style(kt,"display",_e)}function focus(kt){kt.setActive&&kt.setActive()||kt.focus({preventScroll:!0})}function getAttribute$1(kt,_e){return kt.getAttribute(_e)}function hasClass(kt,_e){return kt&&kt.classList.contains(_e)}function rect(kt){return kt.getBoundingClientRect()}function remove(kt){forEach$1(kt,function(_e){_e&&_e.parentNode&&_e.parentNode.removeChild(_e)})}function parseHtml(kt){return child(new DOMParser().parseFromString(kt,"text/html").body)}function prevent(kt,_e){kt.preventDefault(),_e&&(kt.stopPropagation(),kt.stopImmediatePropagation())}function query$1(kt,_e){return kt&&kt.querySelector(_e)}function queryAll(kt,_e){return _e?slice$3(kt.querySelectorAll(_e)):[]}function removeClass(kt,_e){toggleClass(kt,_e,!1)}function timeOf(kt){return kt.timeStamp}function unit(kt){return isString(kt)?kt:kt?kt+"px":""}var PROJECT_CODE="splide",DATA_ATTRIBUTE="data-"+PROJECT_CODE;function assert(kt,_e){if(!kt)throw new Error("["+PROJECT_CODE+"] "+(_e||""))}var min=Math.min,max$1=Math.max,floor=Math.floor,ceil=Math.ceil,abs=Math.abs;function approximatelyEqual(kt,_e,Dt){return abs(kt-_e)<Dt}function between(kt,_e,Dt,Vt){var Gt=min(_e,Dt),zt=max$1(_e,Dt);return Vt?Gt<kt&&kt<zt:Gt<=kt&&kt<=zt}function clamp$3(kt,_e,Dt){var Vt=min(_e,Dt),Gt=max$1(_e,Dt);return min(max$1(Vt,kt),Gt)}function sign$1(kt){return+(kt>0)-+(kt<0)}function format(kt,_e){return forEach$1(_e,function(Dt){kt=kt.replace("%s",""+Dt)}),kt}function pad(kt){return kt<10?"0"+kt:""+kt}var ids={};function uniqueId(kt){return""+kt+pad(ids[kt]=(ids[kt]||0)+1)}function EventBinder(){var kt=[];function _e(jt,Ht,Wt,qt){Gt(jt,Ht,function(Xt,Kt,Yt){var Zt="addEventListener"in Xt,Jt=Zt?Xt.removeEventListener.bind(Xt,Kt,Wt,qt):Xt.removeListener.bind(Xt,Wt);Zt?Xt.addEventListener(Kt,Wt,qt):Xt.addListener(Wt),kt.push([Xt,Kt,Yt,Wt,Jt])})}function Dt(jt,Ht,Wt){Gt(jt,Ht,function(qt,Xt,Kt){kt=kt.filter(function(Yt){return Yt[0]===qt&&Yt[1]===Xt&&Yt[2]===Kt&&(!Wt||Yt[3]===Wt)?(Yt[4](),!1):!0})})}function Vt(jt,Ht,Wt){var qt,Xt=!0;return typeof CustomEvent=="function"?qt=new CustomEvent(Ht,{bubbles:Xt,detail:Wt}):(qt=document.createEvent("CustomEvent"),qt.initCustomEvent(Ht,Xt,!1,Wt)),jt.dispatchEvent(qt),qt}function Gt(jt,Ht,Wt){forEach$1(jt,function(qt){qt&&forEach$1(Ht,function(Xt){Xt.split(" ").forEach(function(Kt){var Yt=Kt.split(".");Wt(qt,Yt[0],Yt[1])})})})}function zt(){kt.forEach(function(jt){jt[4]()}),empty(kt)}return{bind:_e,unbind:Dt,dispatch:Vt,destroy:zt}}var EVENT_MOUNTED="mounted",EVENT_READY="ready",EVENT_MOVE="move",EVENT_MOVED="moved",EVENT_CLICK="click",EVENT_ACTIVE="active",EVENT_INACTIVE="inactive",EVENT_VISIBLE="visible",EVENT_HIDDEN="hidden",EVENT_REFRESH="refresh",EVENT_UPDATED="updated",EVENT_RESIZE="resize",EVENT_RESIZED="resized",EVENT_DRAG="drag",EVENT_DRAGGING="dragging",EVENT_DRAGGED="dragged",EVENT_SCROLL="scroll",EVENT_SCROLLED="scrolled",EVENT_OVERFLOW="overflow",EVENT_DESTROY="destroy",EVENT_ARROWS_MOUNTED="arrows:mounted",EVENT_ARROWS_UPDATED="arrows:updated",EVENT_PAGINATION_MOUNTED="pagination:mounted",EVENT_PAGINATION_UPDATED="pagination:updated",EVENT_NAVIGATION_MOUNTED="navigation:mounted",EVENT_AUTOPLAY_PLAY="autoplay:play",EVENT_AUTOPLAY_PLAYING="autoplay:playing",EVENT_AUTOPLAY_PAUSE="autoplay:pause",EVENT_LAZYLOAD_LOADED="lazyload:loaded",EVENT_SLIDE_KEYDOWN="sk",EVENT_SHIFTED="sh",EVENT_END_INDEX_CHANGED="ei";function EventInterface(kt){var _e=kt?kt.event.bus:document.createDocumentFragment(),Dt=EventBinder();function Vt(zt,jt){Dt.bind(_e,toArray(zt).join(" "),function(Ht){jt.apply(jt,isArray$5(Ht.detail)?Ht.detail:[])})}function Gt(zt){Dt.dispatch(_e,zt,slice$3(arguments,1))}return kt&&kt.event.on(EVENT_DESTROY,Dt.destroy),assign(Dt,{bus:_e,on:Vt,off:apply(Dt.unbind,_e),emit:Gt})}function RequestInterval(kt,_e,Dt,Vt){var Gt=Date.now,zt,jt=0,Ht,Wt=!0,qt=0;function Xt(){if(!Wt){if(jt=kt?min((Gt()-zt)/kt,1):1,Dt&&Dt(jt),jt>=1&&(_e(),zt=Gt(),Vt&&++qt>=Vt))return Yt();Ht=raf(Xt)}}function Kt(Qt){Qt||Jt(),zt=Gt()-(Qt?jt*kt:0),Wt=!1,Ht=raf(Xt)}function Yt(){Wt=!0}function Zt(){zt=Gt(),jt=0,Dt&&Dt(jt)}function Jt(){Ht&&cancelAnimationFrame(Ht),jt=0,Ht=0,Wt=!0}function nn(Qt){kt=Qt}function rn(){return Wt}return{start:Kt,rewind:Zt,pause:Yt,cancel:Jt,set:nn,isPaused:rn}}function State(kt){var _e=kt;function Dt(Gt){_e=Gt}function Vt(Gt){return includes(toArray(Gt),_e)}return{set:Dt,is:Vt}}function Throttle(kt,_e){var Dt=RequestInterval(_e||0,kt,null,1);return function(){Dt.isPaused()&&Dt.start()}}function Media(kt,_e,Dt){var Vt=kt.state,Gt=Dt.breakpoints||{},zt=Dt.reducedMotion||{},jt=EventBinder(),Ht=[];function Wt(){var Jt=Dt.mediaQuery==="min";ownKeys$2(Gt).sort(function(nn,rn){return Jt?+nn-+rn:+rn-+nn}).forEach(function(nn){Xt(Gt[nn],"("+(Jt?"min":"max")+"-width:"+nn+"px)")}),Xt(zt,MEDIA_PREFERS_REDUCED_MOTION),Kt()}function qt(Jt){Jt&&jt.destroy()}function Xt(Jt,nn){var rn=matchMedia(nn);jt.bind(rn,"change",Kt),Ht.push([Jt,rn])}function Kt(){var Jt=Vt.is(DESTROYED),nn=Dt.direction,rn=Ht.reduce(function(Qt,en){return merge(Qt,en[1].matches?en[0]:{})},{});omit(Dt),Zt(rn),Dt.destroy?kt.destroy(Dt.destroy==="completely"):Jt?(qt(!0),kt.mount()):nn!==Dt.direction&&kt.refresh()}function Yt(Jt){matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches&&(Jt?merge(Dt,zt):omit(Dt,ownKeys$2(zt)))}function Zt(Jt,nn,rn){merge(Dt,Jt),nn&&merge(Object.getPrototypeOf(Dt),Jt),(rn||!Vt.is(CREATED))&&kt.emit(EVENT_UPDATED,Dt)}return{setup:Wt,destroy:qt,reduce:Yt,set:Zt}}var ARROW="Arrow",ARROW_LEFT=ARROW+"Left",ARROW_RIGHT=ARROW+"Right",ARROW_UP=ARROW+"Up",ARROW_DOWN=ARROW+"Down",RTL="rtl",TTB="ttb",ORIENTATION_MAP={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[ARROW_UP,ARROW_RIGHT],ArrowRight:[ARROW_DOWN,ARROW_LEFT]};function Direction(kt,_e,Dt){function Vt(zt,jt,Ht){Ht=Ht||Dt.direction;var Wt=Ht===RTL&&!jt?1:Ht===TTB?0:-1;return ORIENTATION_MAP[zt]&&ORIENTATION_MAP[zt][Wt]||zt.replace(/width|left|right/i,function(qt,Xt){var Kt=ORIENTATION_MAP[qt.toLowerCase()][Wt]||qt;return Xt>0?Kt.charAt(0).toUpperCase()+Kt.slice(1):Kt})}function Gt(zt){return zt*(Dt.direction===RTL?1:-1)}return{resolve:Vt,orient:Gt}}var ROLE="role",TAB_INDEX="tabindex",DISABLED="disabled",ARIA_PREFIX="aria-",ARIA_CONTROLS=ARIA_PREFIX+"controls",ARIA_CURRENT=ARIA_PREFIX+"current",ARIA_SELECTED=ARIA_PREFIX+"selected",ARIA_LABEL=ARIA_PREFIX+"label",ARIA_LABELLEDBY=ARIA_PREFIX+"labelledby",ARIA_HIDDEN=ARIA_PREFIX+"hidden",ARIA_ORIENTATION=ARIA_PREFIX+"orientation",ARIA_ROLEDESCRIPTION=ARIA_PREFIX+"roledescription",ARIA_LIVE=ARIA_PREFIX+"live",ARIA_BUSY=ARIA_PREFIX+"busy",ARIA_ATOMIC=ARIA_PREFIX+"atomic",ALL_ATTRIBUTES=[ROLE,TAB_INDEX,DISABLED,ARIA_CONTROLS,ARIA_CURRENT,ARIA_LABEL,ARIA_LABELLEDBY,ARIA_HIDDEN,ARIA_ORIENTATION,ARIA_ROLEDESCRIPTION],CLASS_PREFIX=PROJECT_CODE+"__",STATUS_CLASS_PREFIX="is-",CLASS_ROOT=PROJECT_CODE,CLASS_TRACK=CLASS_PREFIX+"track",CLASS_LIST=CLASS_PREFIX+"list",CLASS_SLIDE=CLASS_PREFIX+"slide",CLASS_CLONE=CLASS_SLIDE+"--clone",CLASS_CONTAINER=CLASS_SLIDE+"__container",CLASS_ARROWS=CLASS_PREFIX+"arrows",CLASS_ARROW=CLASS_PREFIX+"arrow",CLASS_ARROW_PREV=CLASS_ARROW+"--prev",CLASS_ARROW_NEXT=CLASS_ARROW+"--next",CLASS_PAGINATION=CLASS_PREFIX+"pagination",CLASS_PAGINATION_PAGE=CLASS_PAGINATION+"__page",CLASS_PROGRESS=CLASS_PREFIX+"progress",CLASS_PROGRESS_BAR=CLASS_PROGRESS+"__bar",CLASS_TOGGLE=CLASS_PREFIX+"toggle",CLASS_SPINNER=CLASS_PREFIX+"spinner",CLASS_SR=CLASS_PREFIX+"sr",CLASS_INITIALIZED=STATUS_CLASS_PREFIX+"initialized",CLASS_ACTIVE=STATUS_CLASS_PREFIX+"active",CLASS_PREV=STATUS_CLASS_PREFIX+"prev",CLASS_NEXT=STATUS_CLASS_PREFIX+"next",CLASS_VISIBLE=STATUS_CLASS_PREFIX+"visible",CLASS_LOADING=STATUS_CLASS_PREFIX+"loading",CLASS_FOCUS_IN=STATUS_CLASS_PREFIX+"focus-in",CLASS_OVERFLOW=STATUS_CLASS_PREFIX+"overflow",STATUS_CLASSES=[CLASS_ACTIVE,CLASS_VISIBLE,CLASS_PREV,CLASS_NEXT,CLASS_LOADING,CLASS_FOCUS_IN,CLASS_OVERFLOW],CLASSES={slide:CLASS_SLIDE,clone:CLASS_CLONE,arrows:CLASS_ARROWS,arrow:CLASS_ARROW,prev:CLASS_ARROW_PREV,next:CLASS_ARROW_NEXT,pagination:CLASS_PAGINATION,page:CLASS_PAGINATION_PAGE,spinner:CLASS_SPINNER};function closest(kt,_e){if(isFunction$5(kt.closest))return kt.closest(_e);for(var Dt=kt;Dt&&Dt.nodeType===1&&!matches(Dt,_e);)Dt=Dt.parentElement;return Dt}var FRICTION=5,LOG_INTERVAL=200,POINTER_DOWN_EVENTS="touchstart mousedown",POINTER_MOVE_EVENTS="touchmove mousemove",POINTER_UP_EVENTS="touchend touchcancel mouseup click";function Elements(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=kt.root,Ht=Dt.i18n,Wt={},qt=[],Xt=[],Kt=[],Yt,Zt,Jt;function nn(){tn(),sn(),en()}function rn(){Gt(EVENT_REFRESH,Qt),Gt(EVENT_REFRESH,nn),Gt(EVENT_UPDATED,en),zt(document,POINTER_DOWN_EVENTS+" keydown",function(hn){Jt=hn.type==="keydown"},{capture:!0}),zt(jt,"focusin",function(){toggleClass(jt,CLASS_FOCUS_IN,!!Jt)})}function Qt(hn){var dn=ALL_ATTRIBUTES.concat("style");empty(qt),removeClass(jt,Xt),removeClass(Yt,Kt),removeAttribute([Yt,Zt],dn),removeAttribute(jt,hn?dn:["style",ARIA_ROLEDESCRIPTION])}function en(){removeClass(jt,Xt),removeClass(Yt,Kt),Xt=un(CLASS_ROOT),Kt=un(CLASS_TRACK),addClass(jt,Xt),addClass(Yt,Kt),setAttribute(jt,ARIA_LABEL,Dt.label),setAttribute(jt,ARIA_LABELLEDBY,Dt.labelledby)}function tn(){Yt=cn("."+CLASS_TRACK),Zt=child(Yt,"."+CLASS_LIST),assert(Yt&&Zt,"A track/list element is missing."),push$3(qt,children(Zt,"."+CLASS_SLIDE+":not(."+CLASS_CLONE+")")),forOwn$2({arrows:CLASS_ARROWS,pagination:CLASS_PAGINATION,prev:CLASS_ARROW_PREV,next:CLASS_ARROW_NEXT,bar:CLASS_PROGRESS_BAR,toggle:CLASS_TOGGLE},function(hn,dn){Wt[dn]=cn("."+hn)}),assign(Wt,{root:jt,track:Yt,list:Zt,slides:qt})}function sn(){var hn=jt.id||uniqueId(PROJECT_CODE),dn=Dt.role;jt.id=hn,Yt.id=Yt.id||hn+"-track",Zt.id=Zt.id||hn+"-list",!getAttribute$1(jt,ROLE)&&jt.tagName!=="SECTION"&&dn&&setAttribute(jt,ROLE,dn),setAttribute(jt,ARIA_ROLEDESCRIPTION,Ht.carousel),setAttribute(Zt,ROLE,"presentation")}function cn(hn){var dn=query$1(jt,hn);return dn&&closest(dn,"."+CLASS_ROOT)===jt?dn:void 0}function un(hn){return[hn+"--"+Dt.type,hn+"--"+Dt.direction,Dt.drag&&hn+"--draggable",Dt.isNavigation&&hn+"--nav",hn===CLASS_ROOT&&CLASS_ACTIVE]}return assign(Wt,{setup:nn,mount:rn,destroy:Qt})}var SLIDE="slide",LOOP="loop",FADE="fade";function Slide$1(kt,_e,Dt,Vt){var Gt=EventInterface(kt),zt=Gt.on,jt=Gt.emit,Ht=Gt.bind,Wt=kt.Components,qt=kt.root,Xt=kt.options,Kt=Xt.isNavigation,Yt=Xt.updateOnMove,Zt=Xt.i18n,Jt=Xt.pagination,nn=Xt.slideFocus,rn=Wt.Direction.resolve,Qt=getAttribute$1(Vt,"style"),en=getAttribute$1(Vt,ARIA_LABEL),tn=Dt>-1,sn=child(Vt,"."+CLASS_CONTAINER),cn;function un(){tn||(Vt.id=qt.id+"-slide"+pad(_e+1),setAttribute(Vt,ROLE,Jt?"tabpanel":"group"),setAttribute(Vt,ARIA_ROLEDESCRIPTION,Zt.slide),setAttribute(Vt,ARIA_LABEL,en||format(Zt.slideLabel,[_e+1,kt.length]))),hn()}function hn(){Ht(Vt,"click",apply(jt,EVENT_CLICK,yn)),Ht(Vt,"keydown",apply(jt,EVENT_SLIDE_KEYDOWN,yn)),zt([EVENT_MOVED,EVENT_SHIFTED,EVENT_SCROLLED],mn),zt(EVENT_NAVIGATION_MOUNTED,pn),Yt&&zt(EVENT_MOVE,fn)}function dn(){cn=!0,Gt.destroy(),removeClass(Vt,STATUS_CLASSES),removeAttribute(Vt,ALL_ATTRIBUTES),setAttribute(Vt,"style",Qt),setAttribute(Vt,ARIA_LABEL,en||"")}function pn(){var Sn=kt.splides.map(function(wn){var xn=wn.splide.Components.Slides.getAt(_e);return xn?xn.slide.id:""}).join(" ");setAttribute(Vt,ARIA_LABEL,format(Zt.slideX,(tn?Dt:_e)+1)),setAttribute(Vt,ARIA_CONTROLS,Sn),setAttribute(Vt,ROLE,nn?"button":""),nn&&removeAttribute(Vt,ARIA_ROLEDESCRIPTION)}function fn(){cn||mn()}function mn(){if(!cn){var Sn=kt.index;vn(),_n(),toggleClass(Vt,CLASS_PREV,_e===Sn-1),toggleClass(Vt,CLASS_NEXT,_e===Sn+1)}}function vn(){var Sn=An();Sn!==hasClass(Vt,CLASS_ACTIVE)&&(toggleClass(Vt,CLASS_ACTIVE,Sn),setAttribute(Vt,ARIA_CURRENT,Kt&&Sn||""),jt(Sn?EVENT_ACTIVE:EVENT_INACTIVE,yn))}function _n(){var Sn=Tn(),wn=!Sn&&(!An()||tn);if(kt.state.is([MOVING,SCROLLING])||setAttribute(Vt,ARIA_HIDDEN,wn||""),setAttribute(queryAll(Vt,Xt.focusableNodes||""),TAB_INDEX,wn?-1:""),nn&&setAttribute(Vt,TAB_INDEX,wn?-1:0),Sn!==hasClass(Vt,CLASS_VISIBLE)&&(toggleClass(Vt,CLASS_VISIBLE,Sn),jt(Sn?EVENT_VISIBLE:EVENT_HIDDEN,yn)),!Sn&&document.activeElement===Vt){var xn=Wt.Slides.getAt(kt.index);xn&&focus(xn.slide)}}function En(Sn,wn,xn){style(xn&&sn||Vt,Sn,wn)}function An(){var Sn=kt.index;return Sn===_e||Xt.cloneStatus&&Sn===Dt}function Tn(){if(kt.is(FADE))return An();var Sn=rect(Wt.Elements.track),wn=rect(Vt),xn=rn("left",!0),Rn=rn("right",!0);return floor(Sn[xn])<=ceil(wn[xn])&&floor(wn[Rn])<=ceil(Sn[Rn])}function Cn(Sn,wn){var xn=abs(Sn-_e);return!tn&&(Xt.rewind||kt.is(LOOP))&&(xn=min(xn,kt.length-xn)),xn<=wn}var yn={index:_e,slideIndex:Dt,slide:Vt,container:sn,isClone:tn,mount:un,destroy:dn,update:mn,style:En,isWithin:Cn};return yn}function Slides(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=_e.Elements,Wt=Ht.slides,qt=Ht.list,Xt=[];function Kt(){Yt(),Gt(EVENT_REFRESH,Zt),Gt(EVENT_REFRESH,Yt)}function Yt(){Wt.forEach(function(mn,vn){nn(mn,vn,-1)})}function Zt(){cn(function(mn){mn.destroy()}),empty(Xt)}function Jt(){cn(function(mn){mn.update()})}function nn(mn,vn,_n){var En=Slide$1(kt,vn,_n,mn);En.mount(),Xt.push(En),Xt.sort(function(An,Tn){return An.index-Tn.index})}function rn(mn){return mn?un(function(vn){return!vn.isClone}):Xt}function Qt(mn){var vn=_e.Controller,_n=vn.toIndex(mn),En=vn.hasFocus()?1:Dt.perPage;return un(function(An){return between(An.index,_n,_n+En-1)})}function en(mn){return un(mn)[0]}function tn(mn,vn){forEach$1(mn,function(_n){if(isString(_n)&&(_n=parseHtml(_n)),isHTMLElement(_n)){var En=Wt[vn];En?before(_n,En):append(qt,_n),addClass(_n,Dt.classes.slide),dn(_n,apply(zt,EVENT_RESIZE))}}),zt(EVENT_REFRESH)}function sn(mn){remove(un(mn).map(function(vn){return vn.slide})),zt(EVENT_REFRESH)}function cn(mn,vn){rn(vn).forEach(mn)}function un(mn){return Xt.filter(isFunction$5(mn)?mn:function(vn){return isString(mn)?matches(vn.slide,mn):includes(toArray(mn),vn.index)})}function hn(mn,vn,_n){cn(function(En){En.style(mn,vn,_n)})}function dn(mn,vn){var _n=queryAll(mn,"img"),En=_n.length;En?_n.forEach(function(An){jt(An,"load error",function(){--En||vn()})}):vn()}function pn(mn){return mn?Wt.length:Xt.length}function fn(){return Xt.length>Dt.perPage}return{mount:Kt,destroy:Zt,update:Jt,register:nn,get:rn,getIn:Qt,getAt:en,add:tn,remove:sn,forEach:cn,filter:un,style:hn,getLength:pn,isEnough:fn}}function Layout(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=_e.Slides,Wt=_e.Direction.resolve,qt=_e.Elements,Xt=qt.root,Kt=qt.track,Yt=qt.list,Zt=Ht.getAt,Jt=Ht.style,nn,rn,Qt;function en(){tn(),zt(window,"resize load",Throttle(apply(jt,EVENT_RESIZE))),Gt([EVENT_UPDATED,EVENT_REFRESH],tn),Gt(EVENT_RESIZE,sn)}function tn(){nn=Dt.direction===TTB,style(Xt,"maxWidth",unit(Dt.width)),style(Kt,Wt("paddingLeft"),cn(!1)),style(Kt,Wt("paddingRight"),cn(!0)),sn(!0)}function sn(yn){var Sn=rect(Xt);(yn||rn.width!==Sn.width||rn.height!==Sn.height)&&(style(Kt,"height",un()),Jt(Wt("marginRight"),unit(Dt.gap)),Jt("width",dn()),Jt("height",pn(),!0),rn=Sn,jt(EVENT_RESIZED),Qt!==(Qt=Cn())&&(toggleClass(Xt,CLASS_OVERFLOW,Qt),jt(EVENT_OVERFLOW,Qt)))}function cn(yn){var Sn=Dt.padding,wn=Wt(yn?"right":"left");return Sn&&unit(Sn[wn]||(isObject$8(Sn)?0:Sn))||"0px"}function un(){var yn="";return nn&&(yn=hn(),assert(yn,"height or heightRatio is missing."),yn="calc("+yn+" - "+cn(!1)+" - "+cn(!0)+")"),yn}function hn(){return unit(Dt.height||rect(Yt).width*Dt.heightRatio)}function dn(){return Dt.autoWidth?null:unit(Dt.fixedWidth)||(nn?"":fn())}function pn(){return unit(Dt.fixedHeight)||(nn?Dt.autoHeight?null:fn():hn())}function fn(){var yn=unit(Dt.gap);return"calc((100%"+(yn&&" + "+yn)+")/"+(Dt.perPage||1)+(yn&&" - "+yn)+")"}function mn(){return rect(Yt)[Wt("width")]}function vn(yn,Sn){var wn=Zt(yn||0);return wn?rect(wn.slide)[Wt("width")]+(Sn?0:An()):0}function _n(yn,Sn){var wn=Zt(yn);if(wn){var xn=rect(wn.slide)[Wt("right")],Rn=rect(Yt)[Wt("left")];return abs(xn-Rn)+(Sn?0:An())}return 0}function En(yn){return _n(kt.length-1)-_n(0)+vn(0,yn)}function An(){var yn=Zt(0);return yn&&parseFloat(style(yn.slide,Wt("marginRight")))||0}function Tn(yn){return parseFloat(style(Kt,Wt("padding"+(yn?"Right":"Left"))))||0}function Cn(){return kt.is(FADE)||En(!0)>mn()}return{mount:en,resize:sn,listSize:mn,slideSize:vn,sliderSize:En,totalSize:_n,getPadding:Tn,isOverflow:Cn}}var MULTIPLIER=2;function Clones(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=_e.Elements,jt=_e.Slides,Ht=_e.Direction.resolve,Wt=[],qt;function Xt(){Gt(EVENT_REFRESH,Kt),Gt([EVENT_UPDATED,EVENT_RESIZE],Zt),(qt=rn())&&(Jt(qt),_e.Layout.resize(!0))}function Kt(){Yt(),Xt()}function Yt(){remove(Wt),empty(Wt),Vt.destroy()}function Zt(){var Qt=rn();qt!==Qt&&(qt<Qt||!Qt)&&Vt.emit(EVENT_REFRESH)}function Jt(Qt){var en=jt.get().slice(),tn=en.length;if(tn){for(;en.length<Qt;)push$3(en,en);push$3(en.slice(-Qt),en.slice(0,Qt)).forEach(function(sn,cn){var un=cn<Qt,hn=nn(sn.slide,cn);un?before(hn,en[0].slide):append(zt.list,hn),push$3(Wt,hn),jt.register(hn,cn-Qt+(un?0:tn),sn.index)})}}function nn(Qt,en){var tn=Qt.cloneNode(!0);return addClass(tn,Dt.classes.clone),tn.id=kt.root.id+"-clone"+pad(en+1),tn}function rn(){var Qt=Dt.clones;if(!kt.is(LOOP))Qt=0;else if(isUndefined(Qt)){var en=Dt[Ht("fixedWidth")]&&_e.Layout.slideSize(0),tn=en&&ceil(rect(zt.track)[Ht("width")]/en);Qt=tn||Dt[Ht("autoWidth")]&&kt.length||Dt.perPage*MULTIPLIER}return Qt}return{mount:Xt,destroy:Yt}}function Move(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=kt.state.set,Ht=_e.Layout,Wt=Ht.slideSize,qt=Ht.getPadding,Xt=Ht.totalSize,Kt=Ht.listSize,Yt=Ht.sliderSize,Zt=_e.Direction,Jt=Zt.resolve,nn=Zt.orient,rn=_e.Elements,Qt=rn.list,en=rn.track,tn;function sn(){tn=_e.Transition,Gt([EVENT_MOUNTED,EVENT_RESIZED,EVENT_UPDATED,EVENT_REFRESH],cn)}function cn(){_e.Controller.isBusy()||(_e.Scroll.cancel(),hn(kt.index),_e.Slides.update())}function un(wn,xn,Rn,Dn){wn!==xn&&yn(wn>Rn)&&(mn(),dn(fn(En(),wn>Rn),!0)),jt(MOVING),zt(EVENT_MOVE,xn,Rn,wn),tn.start(xn,function(){jt(IDLE),zt(EVENT_MOVED,xn,Rn,wn),Dn&&Dn()})}function hn(wn){dn(_n(wn,!0))}function dn(wn,xn){if(!kt.is(FADE)){var Rn=xn?wn:pn(wn);style(Qt,"transform","translate"+Jt("X")+"("+Rn+"px)"),wn!==Rn&&zt(EVENT_SHIFTED)}}function pn(wn){if(kt.is(LOOP)){var xn=vn(wn),Rn=xn>_e.Controller.getEnd(),Dn=xn<0;(Dn||Rn)&&(wn=fn(wn,Rn))}return wn}function fn(wn,xn){var Rn=wn-Cn(xn),Dn=Yt();return wn-=nn(Dn*(ceil(abs(Rn)/Dn)||1))*(xn?1:-1),wn}function mn(){dn(En(),!0),tn.cancel()}function vn(wn){for(var xn=_e.Slides.get(),Rn=0,Dn=1/0,kn=0;kn<xn.length;kn++){var Fn=xn[kn].index,Pn=abs(_n(Fn,!0)-wn);if(Pn<=Dn)Dn=Pn,Rn=Fn;else break}return Rn}function _n(wn,xn){var Rn=nn(Xt(wn-1)-Tn(wn));return xn?An(Rn):Rn}function En(){var wn=Jt("left");return rect(Qt)[wn]-rect(en)[wn]+nn(qt(!1))}function An(wn){return Dt.trimSpace&&kt.is(SLIDE)&&(wn=clamp$3(wn,0,nn(Yt(!0)-Kt()))),wn}function Tn(wn){var xn=Dt.focus;return xn==="center"?(Kt()-Wt(wn,!0))/2:+xn*Wt(wn)||0}function Cn(wn){return _n(wn?_e.Controller.getEnd():0,!!Dt.trimSpace)}function yn(wn){var xn=nn(fn(En(),wn));return wn?xn>=0:xn<=Qt[Jt("scrollWidth")]-rect(en)[Jt("width")]}function Sn(wn,xn){xn=isUndefined(xn)?En():xn;var Rn=wn!==!0&&nn(xn)<nn(Cn(!1)),Dn=wn!==!1&&nn(xn)>nn(Cn(!0));return Rn||Dn}return{mount:sn,move:un,jump:hn,translate:dn,shift:fn,cancel:mn,toIndex:vn,toPosition:_n,getPosition:En,getLimit:Cn,exceededLimit:Sn,reposition:cn}}function Controller$1(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=_e.Move,Ht=jt.getPosition,Wt=jt.getLimit,qt=jt.toPosition,Xt=_e.Slides,Kt=Xt.isEnough,Yt=Xt.getLength,Zt=Dt.omitEnd,Jt=kt.is(LOOP),nn=kt.is(SLIDE),rn=apply(En,!1),Qt=apply(En,!0),en=Dt.start||0,tn,sn=en,cn,un,hn;function dn(){pn(),Gt([EVENT_UPDATED,EVENT_REFRESH,EVENT_END_INDEX_CHANGED],pn),Gt(EVENT_RESIZED,fn)}function pn(){cn=Yt(!0),un=Dt.perMove,hn=Dt.perPage,tn=yn();var Pn=clamp$3(en,0,Zt?tn:cn-1);Pn!==en&&(en=Pn,jt.reposition())}function fn(){tn!==yn()&&zt(EVENT_END_INDEX_CHANGED)}function mn(Pn,Bn,qn){if(!Fn()){var tr=_n(Pn),lr=Cn(tr);lr>-1&&(Bn||lr!==en)&&(Rn(lr),jt.move(tr,lr,sn,qn))}}function vn(Pn,Bn,qn,tr){_e.Scroll.scroll(Pn,Bn,qn,function(){var lr=Cn(jt.toIndex(Ht()));Rn(Zt?min(lr,tn):lr),tr&&tr()})}function _n(Pn){var Bn=en;if(isString(Pn)){var qn=Pn.match(/([+\-<>])(\d+)?/)||[],tr=qn[1],lr=qn[2];tr==="+"||tr==="-"?Bn=An(en+ +(""+tr+(+lr||1)),en):tr===">"?Bn=lr?Sn(+lr):rn(!0):tr==="<"&&(Bn=Qt(!0))}else Bn=Jt?Pn:clamp$3(Pn,0,tn);return Bn}function En(Pn,Bn){var qn=un||(kn()?1:hn),tr=An(en+qn*(Pn?-1:1),en,!(un||kn()));return tr===-1&&nn&&!approximatelyEqual(Ht(),Wt(!Pn),1)?Pn?0:tn:Bn?tr:Cn(tr)}function An(Pn,Bn,qn){if(Kt()||kn()){var tr=Tn(Pn);tr!==Pn&&(Bn=Pn,Pn=tr,qn=!1),Pn<0||Pn>tn?!un&&(between(0,Pn,Bn,!0)||between(tn,Bn,Pn,!0))?Pn=Sn(wn(Pn)):Jt?Pn=qn?Pn<0?-(cn%hn||hn):cn:Pn:Dt.rewind?Pn=Pn<0?tn:0:Pn=-1:qn&&Pn!==Bn&&(Pn=Sn(wn(Bn)+(Pn<Bn?-1:1)))}else Pn=-1;return Pn}function Tn(Pn){if(nn&&Dt.trimSpace==="move"&&Pn!==en)for(var Bn=Ht();Bn===qt(Pn,!0)&&between(Pn,0,kt.length-1,!Dt.rewind);)Pn<en?--Pn:++Pn;return Pn}function Cn(Pn){return Jt?(Pn+cn)%cn||0:Pn}function yn(){for(var Pn=cn-(kn()||Jt&&un?1:hn);Zt&&Pn-- >0;)if(qt(cn-1,!0)!==qt(Pn,!0)){Pn++;break}return clamp$3(Pn,0,cn-1)}function Sn(Pn){return clamp$3(kn()?Pn:hn*Pn,0,tn)}function wn(Pn){return kn()?min(Pn,tn):floor((Pn>=tn?cn-1:Pn)/hn)}function xn(Pn){var Bn=jt.toIndex(Pn);return nn?clamp$3(Bn,0,tn):Bn}function Rn(Pn){Pn!==en&&(sn=en,en=Pn)}function Dn(Pn){return Pn?sn:en}function kn(){return!isUndefined(Dt.focus)||Dt.isNavigation}function Fn(){return kt.state.is([MOVING,SCROLLING])&&!!Dt.waitForTransition}return{mount:dn,go:mn,scroll:vn,getNext:rn,getPrev:Qt,getAdjacent:En,getEnd:yn,setIndex:Rn,getIndex:Dn,toIndex:Sn,toPage:wn,toDest:xn,hasFocus:kn,isBusy:Fn}}var XML_NAME_SPACE="http://www.w3.org/2000/svg",PATH="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",SIZE=40;function Arrows(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=Dt.classes,Wt=Dt.i18n,qt=_e.Elements,Xt=_e.Controller,Kt=qt.arrows,Yt=qt.track,Zt=Kt,Jt=qt.prev,nn=qt.next,rn,Qt,en={};function tn(){cn(),Gt(EVENT_UPDATED,sn)}function sn(){un(),tn()}function cn(){var vn=Dt.arrows;vn&&!(Jt&&nn)&&pn(),Jt&&nn&&(assign(en,{prev:Jt,next:nn}),display(Zt,vn?"":"none"),addClass(Zt,Qt=CLASS_ARROWS+"--"+Dt.direction),vn&&(hn(),mn(),setAttribute([Jt,nn],ARIA_CONTROLS,Yt.id),jt(EVENT_ARROWS_MOUNTED,Jt,nn)))}function un(){Vt.destroy(),removeClass(Zt,Qt),rn?(remove(Kt?[Jt,nn]:Zt),Jt=nn=null):removeAttribute([Jt,nn],ALL_ATTRIBUTES)}function hn(){Gt([EVENT_MOUNTED,EVENT_MOVED,EVENT_REFRESH,EVENT_SCROLLED,EVENT_END_INDEX_CHANGED],mn),zt(nn,"click",apply(dn,">")),zt(Jt,"click",apply(dn,"<"))}function dn(vn){Xt.go(vn,!0)}function pn(){Zt=Kt||create$3("div",Ht.arrows),Jt=fn(!0),nn=fn(!1),rn=!0,append(Zt,[Jt,nn]),!Kt&&before(Zt,Yt)}function fn(vn){var _n='<button class="'+Ht.arrow+" "+(vn?Ht.prev:Ht.next)+'" type="button"><svg xmlns="'+XML_NAME_SPACE+'" viewBox="0 0 '+SIZE+" "+SIZE+'" width="'+SIZE+'" height="'+SIZE+'" focusable="false"><path d="'+(Dt.arrowPath||PATH)+'" />';return parseHtml(_n)}function mn(){if(Jt&&nn){var vn=kt.index,_n=Xt.getPrev(),En=Xt.getNext(),An=_n>-1&&vn<_n?Wt.last:Wt.prev,Tn=En>-1&&vn>En?Wt.first:Wt.next;Jt.disabled=_n<0,nn.disabled=En<0,setAttribute(Jt,ARIA_LABEL,An),setAttribute(nn,ARIA_LABEL,Tn),jt(EVENT_ARROWS_UPDATED,Jt,nn,_n,En)}}return{arrows:en,mount:tn,destroy:un,update:mn}}var INTERVAL_DATA_ATTRIBUTE=DATA_ATTRIBUTE+"-interval";function Autoplay(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=RequestInterval(Dt.interval,kt.go.bind(kt,">"),hn),Wt=Ht.isPaused,qt=_e.Elements,Xt=_e.Elements,Kt=Xt.root,Yt=Xt.toggle,Zt=Dt.autoplay,Jt,nn,rn=Zt==="pause";function Qt(){Zt&&(en(),Yt&&setAttribute(Yt,ARIA_CONTROLS,qt.track.id),rn||tn(),un())}function en(){Dt.pauseOnHover&&zt(Kt,"mouseenter mouseleave",function(pn){Jt=pn.type==="mouseenter",cn()}),Dt.pauseOnFocus&&zt(Kt,"focusin focusout",function(pn){nn=pn.type==="focusin",cn()}),Yt&&zt(Yt,"click",function(){rn?tn():sn(!0)}),Gt([EVENT_MOVE,EVENT_SCROLL,EVENT_REFRESH],Ht.rewind),Gt(EVENT_MOVE,dn)}function tn(){Wt()&&_e.Slides.isEnough()&&(Ht.start(!Dt.resetProgress),nn=Jt=rn=!1,un(),jt(EVENT_AUTOPLAY_PLAY))}function sn(pn){pn===void 0&&(pn=!0),rn=!!pn,un(),Wt()||(Ht.pause(),jt(EVENT_AUTOPLAY_PAUSE))}function cn(){rn||(Jt||nn?sn(!1):tn())}function un(){Yt&&(toggleClass(Yt,CLASS_ACTIVE,!rn),setAttribute(Yt,ARIA_LABEL,Dt.i18n[rn?"play":"pause"]))}function hn(pn){var fn=qt.bar;fn&&style(fn,"width",pn*100+"%"),jt(EVENT_AUTOPLAY_PLAYING,pn)}function dn(pn){var fn=_e.Slides.getAt(pn);Ht.set(fn&&+getAttribute$1(fn.slide,INTERVAL_DATA_ATTRIBUTE)||Dt.interval)}return{mount:Qt,destroy:Ht.cancel,play:tn,pause:sn,isPaused:Wt}}function Cover(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on;function zt(){Dt.cover&&(Gt(EVENT_LAZYLOAD_LOADED,apply(Ht,!0)),Gt([EVENT_MOUNTED,EVENT_UPDATED,EVENT_REFRESH],apply(jt,!0)))}function jt(Wt){_e.Slides.forEach(function(qt){var Xt=child(qt.container||qt.slide,"img");Xt&&Xt.src&&Ht(Wt,Xt,qt)})}function Ht(Wt,qt,Xt){Xt.style("background",Wt?'center/cover no-repeat url("'+qt.src+'")':"",!0),display(qt,Wt?"none":"")}return{mount:zt,destroy:apply(jt,!1)}}var BOUNCE_DIFF_THRESHOLD=10,BOUNCE_DURATION=600,FRICTION_FACTOR=.6,BASE_VELOCITY=1.5,MIN_DURATION=800;function Scroll(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=kt.state.set,Ht=_e.Move,Wt=Ht.getPosition,qt=Ht.getLimit,Xt=Ht.exceededLimit,Kt=Ht.translate,Yt=kt.is(SLIDE),Zt,Jt,nn=1;function rn(){Gt(EVENT_MOVE,sn),Gt([EVENT_UPDATED,EVENT_REFRESH],cn)}function Qt(hn,dn,pn,fn,mn){var vn=Wt();if(sn(),pn&&(!Yt||!Xt())){var _n=_e.Layout.sliderSize(),En=sign$1(hn)*_n*floor(abs(hn)/_n)||0;hn=Ht.toPosition(_e.Controller.toDest(hn%_n))+En}var An=approximatelyEqual(vn,hn,1);nn=1,dn=An?0:dn||max$1(abs(hn-vn)/BASE_VELOCITY,MIN_DURATION),Jt=fn,Zt=RequestInterval(dn,en,apply(tn,vn,hn,mn),1),jt(SCROLLING),zt(EVENT_SCROLL),Zt.start()}function en(){jt(IDLE),Jt&&Jt(),zt(EVENT_SCROLLED)}function tn(hn,dn,pn,fn){var mn=Wt(),vn=hn+(dn-hn)*un(fn),_n=(vn-mn)*nn;Kt(mn+_n),Yt&&!pn&&Xt()&&(nn*=FRICTION_FACTOR,abs(_n)<BOUNCE_DIFF_THRESHOLD&&Qt(qt(Xt(!0)),BOUNCE_DURATION,!1,Jt,!0))}function sn(){Zt&&Zt.cancel()}function cn(){Zt&&!Zt.isPaused()&&(sn(),en())}function un(hn){var dn=Dt.easingFunc;return dn?dn(hn):1-Math.pow(1-hn,4)}return{mount:rn,destroy:sn,scroll:Qt,cancel:cn}}var SCROLL_LISTENER_OPTIONS={passive:!1,capture:!0};function Drag(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=Vt.unbind,Wt=kt.state,qt=_e.Move,Xt=_e.Scroll,Kt=_e.Controller,Yt=_e.Elements.track,Zt=_e.Media.reduce,Jt=_e.Direction,nn=Jt.resolve,rn=Jt.orient,Qt=qt.getPosition,en=qt.exceededLimit,tn,sn,cn,un,hn,dn=!1,pn,fn,mn;function vn(){jt(Yt,POINTER_MOVE_EVENTS,noop$3,SCROLL_LISTENER_OPTIONS),jt(Yt,POINTER_UP_EVENTS,noop$3,SCROLL_LISTENER_OPTIONS),jt(Yt,POINTER_DOWN_EVENTS,En,SCROLL_LISTENER_OPTIONS),jt(Yt,"click",Cn,{capture:!0}),jt(Yt,"dragstart",prevent),Gt([EVENT_MOUNTED,EVENT_UPDATED],_n)}function _n(){var Hn=Dt.drag;ur(!Hn),un=Hn==="free"}function En(Hn){if(pn=!1,!fn){var sr=lr(Hn);tr(Hn.target)&&(sr||!Hn.button)&&(Kt.isBusy()?prevent(Hn,!0):(mn=sr?Yt:window,hn=Wt.is([MOVING,SCROLLING]),cn=null,jt(mn,POINTER_MOVE_EVENTS,An,SCROLL_LISTENER_OPTIONS),jt(mn,POINTER_UP_EVENTS,Tn,SCROLL_LISTENER_OPTIONS),qt.cancel(),Xt.cancel(),yn(Hn)))}}function An(Hn){if(Wt.is(DRAGGING)||(Wt.set(DRAGGING),zt(EVENT_DRAG)),Hn.cancelable)if(hn){qt.translate(tn+qn(kn(Hn)));var sr=Fn(Hn)>LOG_INTERVAL,vr=dn!==(dn=en());(sr||vr)&&yn(Hn),pn=!0,zt(EVENT_DRAGGING),prevent(Hn)}else xn(Hn)&&(hn=wn(Hn),prevent(Hn))}function Tn(Hn){Wt.is(DRAGGING)&&(Wt.set(IDLE),zt(EVENT_DRAGGED)),hn&&(Sn(Hn),prevent(Hn)),Ht(mn,POINTER_MOVE_EVENTS,An),Ht(mn,POINTER_UP_EVENTS,Tn),hn=!1}function Cn(Hn){!fn&&pn&&prevent(Hn,!0)}function yn(Hn){cn=sn,sn=Hn,tn=Qt()}function Sn(Hn){var sr=Rn(Hn),vr=Dn(sr),fr=Dt.rewind&&Dt.rewindByDrag;Zt(!1),un?Kt.scroll(vr,0,Dt.snap):kt.is(FADE)?Kt.go(rn(sign$1(sr))<0?fr?"<":"-":fr?">":"+"):kt.is(SLIDE)&&dn&&fr?Kt.go(en(!0)?">":"<"):Kt.go(Kt.toDest(vr),!0),Zt(!0)}function wn(Hn){var sr=Dt.dragMinThreshold,vr=isObject$8(sr),fr=vr&&sr.mouse||0,Un=(vr?sr.touch:+sr)||10;return abs(kn(Hn))>(lr(Hn)?Un:fr)}function xn(Hn){return abs(kn(Hn))>abs(kn(Hn,!0))}function Rn(Hn){if(kt.is(LOOP)||!dn){var sr=Fn(Hn);if(sr&&sr<LOG_INTERVAL)return kn(Hn)/sr}return 0}function Dn(Hn){return Qt()+sign$1(Hn)*min(abs(Hn)*(Dt.flickPower||600),un?1/0:_e.Layout.listSize()*(Dt.flickMaxPages||1))}function kn(Hn,sr){return Bn(Hn,sr)-Bn(Pn(Hn),sr)}function Fn(Hn){return timeOf(Hn)-timeOf(Pn(Hn))}function Pn(Hn){return sn===Hn&&cn||sn}function Bn(Hn,sr){return(lr(Hn)?Hn.changedTouches[0]:Hn)["page"+nn(sr?"Y":"X")]}function qn(Hn){return Hn/(dn&&kt.is(SLIDE)?FRICTION:1)}function tr(Hn){var sr=Dt.noDrag;return!matches(Hn,"."+CLASS_PAGINATION_PAGE+", ."+CLASS_ARROW)&&(!sr||!matches(Hn,sr))}function lr(Hn){return typeof TouchEvent<"u"&&Hn instanceof TouchEvent}function zn(){return hn}function ur(Hn){fn=Hn}return{mount:vn,disable:ur,isDragging:zn}}var NORMALIZATION_MAP={Spacebar:" ",Right:ARROW_RIGHT,Left:ARROW_LEFT,Up:ARROW_UP,Down:ARROW_DOWN};function normalizeKey(kt){return kt=isString(kt)?kt:kt.key,NORMALIZATION_MAP[kt]||kt}var KEYBOARD_EVENT="keydown";function Keyboard(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.unbind,Ht=kt.root,Wt=_e.Direction.resolve,qt,Xt;function Kt(){Yt(),Gt(EVENT_UPDATED,Zt),Gt(EVENT_UPDATED,Yt),Gt(EVENT_MOVE,nn)}function Yt(){var Qt=Dt.keyboard;Qt&&(qt=Qt==="global"?window:Ht,zt(qt,KEYBOARD_EVENT,rn))}function Zt(){jt(qt,KEYBOARD_EVENT)}function Jt(Qt){Xt=Qt}function nn(){var Qt=Xt;Xt=!0,nextTick(function(){Xt=Qt})}function rn(Qt){if(!Xt){var en=normalizeKey(Qt);en===Wt(ARROW_LEFT)?kt.go("<"):en===Wt(ARROW_RIGHT)&&kt.go(">")}}return{mount:Kt,destroy:Zt,disable:Jt}}var SRC_DATA_ATTRIBUTE=DATA_ATTRIBUTE+"-lazy",SRCSET_DATA_ATTRIBUTE=SRC_DATA_ATTRIBUTE+"-srcset",IMAGE_SELECTOR="["+SRC_DATA_ATTRIBUTE+"], ["+SRCSET_DATA_ATTRIBUTE+"]";function LazyLoad(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.off,jt=Vt.bind,Ht=Vt.emit,Wt=Dt.lazyLoad==="sequential",qt=[EVENT_MOVED,EVENT_SCROLLED],Xt=[];function Kt(){Dt.lazyLoad&&(Yt(),Gt(EVENT_REFRESH,Yt))}function Yt(){empty(Xt),Zt(),Wt?Qt():(zt(qt),Gt(qt,Jt),Jt())}function Zt(){_e.Slides.forEach(function(en){queryAll(en.slide,IMAGE_SELECTOR).forEach(function(tn){var sn=getAttribute$1(tn,SRC_DATA_ATTRIBUTE),cn=getAttribute$1(tn,SRCSET_DATA_ATTRIBUTE);if(sn!==tn.src||cn!==tn.srcset){var un=Dt.classes.spinner,hn=tn.parentElement,dn=child(hn,"."+un)||create$3("span",un,hn);Xt.push([tn,en,dn]),tn.src||display(tn,"none")}})})}function Jt(){Xt=Xt.filter(function(en){var tn=Dt.perPage*((Dt.preloadPages||1)+1)-1;return en[1].isWithin(kt.index,tn)?nn(en):!0}),Xt.length||zt(qt)}function nn(en){var tn=en[0];addClass(en[1].slide,CLASS_LOADING),jt(tn,"load error",apply(rn,en)),setAttribute(tn,"src",getAttribute$1(tn,SRC_DATA_ATTRIBUTE)),setAttribute(tn,"srcset",getAttribute$1(tn,SRCSET_DATA_ATTRIBUTE)),removeAttribute(tn,SRC_DATA_ATTRIBUTE),removeAttribute(tn,SRCSET_DATA_ATTRIBUTE)}function rn(en,tn){var sn=en[0],cn=en[1];removeClass(cn.slide,CLASS_LOADING),tn.type!=="error"&&(remove(en[2]),display(sn,""),Ht(EVENT_LAZYLOAD_LOADED,sn,cn),Ht(EVENT_RESIZE)),Wt&&Qt()}function Qt(){Xt.length&&nn(Xt.shift())}return{mount:Kt,destroy:apply(empty,Xt),check:Jt}}function Pagination(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=_e.Slides,Wt=_e.Elements,qt=_e.Controller,Xt=qt.hasFocus,Kt=qt.getIndex,Yt=qt.go,Zt=_e.Direction.resolve,Jt=Wt.pagination,nn=[],rn,Qt;function en(){tn(),Gt([EVENT_UPDATED,EVENT_REFRESH,EVENT_END_INDEX_CHANGED],en);var fn=Dt.pagination;Jt&&display(Jt,fn?"":"none"),fn&&(Gt([EVENT_MOVE,EVENT_SCROLL,EVENT_SCROLLED],pn),sn(),pn(),zt(EVENT_PAGINATION_MOUNTED,{list:rn,items:nn},dn(kt.index)))}function tn(){rn&&(remove(Jt?slice$3(rn.children):rn),removeClass(rn,Qt),empty(nn),rn=null),Vt.destroy()}function sn(){var fn=kt.length,mn=Dt.classes,vn=Dt.i18n,_n=Dt.perPage,En=Xt()?qt.getEnd()+1:ceil(fn/_n);rn=Jt||create$3("ul",mn.pagination,Wt.track.parentElement),addClass(rn,Qt=CLASS_PAGINATION+"--"+hn()),setAttribute(rn,ROLE,"tablist"),setAttribute(rn,ARIA_LABEL,vn.select),setAttribute(rn,ARIA_ORIENTATION,hn()===TTB?"vertical":"");for(var An=0;An<En;An++){var Tn=create$3("li",null,rn),Cn=create$3("button",{class:mn.page,type:"button"},Tn),yn=Ht.getIn(An).map(function(wn){return wn.slide.id}),Sn=!Xt()&&_n>1?vn.pageX:vn.slideX;jt(Cn,"click",apply(cn,An)),Dt.paginationKeyboard&&jt(Cn,"keydown",apply(un,An)),setAttribute(Tn,ROLE,"presentation"),setAttribute(Cn,ROLE,"tab"),setAttribute(Cn,ARIA_CONTROLS,yn.join(" ")),setAttribute(Cn,ARIA_LABEL,format(Sn,An+1)),setAttribute(Cn,TAB_INDEX,-1),nn.push({li:Tn,button:Cn,page:An})}}function cn(fn){Yt(">"+fn,!0)}function un(fn,mn){var vn=nn.length,_n=normalizeKey(mn),En=hn(),An=-1;_n===Zt(ARROW_RIGHT,!1,En)?An=++fn%vn:_n===Zt(ARROW_LEFT,!1,En)?An=(--fn+vn)%vn:_n==="Home"?An=0:_n==="End"&&(An=vn-1);var Tn=nn[An];Tn&&(focus(Tn.button),Yt(">"+An),prevent(mn,!0))}function hn(){return Dt.paginationDirection||Dt.direction}function dn(fn){return nn[qt.toPage(fn)]}function pn(){var fn=dn(Kt(!0)),mn=dn(Kt());if(fn){var vn=fn.button;removeClass(vn,CLASS_ACTIVE),removeAttribute(vn,ARIA_SELECTED),setAttribute(vn,TAB_INDEX,-1)}if(mn){var _n=mn.button;addClass(_n,CLASS_ACTIVE),setAttribute(_n,ARIA_SELECTED,!0),setAttribute(_n,TAB_INDEX,"")}zt(EVENT_PAGINATION_UPDATED,{list:rn,items:nn},fn,mn)}return{items:nn,mount:en,destroy:tn,getAt:dn,update:pn}}var TRIGGER_KEYS=[" ","Enter"];function Sync(kt,_e,Dt){var Vt=Dt.isNavigation,Gt=Dt.slideFocus,zt=[];function jt(){kt.splides.forEach(function(Jt){Jt.isParent||(qt(kt,Jt.splide),qt(Jt.splide,kt))}),Vt&&Xt()}function Ht(){zt.forEach(function(Jt){Jt.destroy()}),empty(zt)}function Wt(){Ht(),jt()}function qt(Jt,nn){var rn=EventInterface(Jt);rn.on(EVENT_MOVE,function(Qt,en,tn){nn.go(nn.is(LOOP)?tn:Qt)}),zt.push(rn)}function Xt(){var Jt=EventInterface(kt),nn=Jt.on;nn(EVENT_CLICK,Yt),nn(EVENT_SLIDE_KEYDOWN,Zt),nn([EVENT_MOUNTED,EVENT_UPDATED],Kt),zt.push(Jt),Jt.emit(EVENT_NAVIGATION_MOUNTED,kt.splides)}function Kt(){setAttribute(_e.Elements.list,ARIA_ORIENTATION,Dt.direction===TTB?"vertical":"")}function Yt(Jt){kt.go(Jt.index)}function Zt(Jt,nn){includes(TRIGGER_KEYS,normalizeKey(nn))&&(Yt(Jt),prevent(nn))}return{setup:apply(_e.Media.set,{slideFocus:isUndefined(Gt)?Vt:Gt},!0),mount:jt,destroy:Ht,remount:Wt}}function Wheel(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.bind,zt=0;function jt(){Dt.wheel&&Gt(_e.Elements.track,"wheel",Ht,SCROLL_LISTENER_OPTIONS)}function Ht(qt){if(qt.cancelable){var Xt=qt.deltaY,Kt=Xt<0,Yt=timeOf(qt),Zt=Dt.wheelMinThreshold||0,Jt=Dt.wheelSleep||0;abs(Xt)>Zt&&Yt-zt>Jt&&(kt.go(Kt?"<":">"),zt=Yt),Wt(Kt)&&prevent(qt)}}function Wt(qt){return!Dt.releaseWheel||kt.state.is(MOVING)||_e.Controller.getAdjacent(qt)!==-1}return{mount:jt}}var SR_REMOVAL_DELAY=90;function Live(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=_e.Elements.track,jt=Dt.live&&!Dt.isNavigation,Ht=create$3("span",CLASS_SR),Wt=RequestInterval(SR_REMOVAL_DELAY,apply(Xt,!1));function qt(){jt&&(Yt(!_e.Autoplay.isPaused()),setAttribute(zt,ARIA_ATOMIC,!0),Ht.textContent="…",Gt(EVENT_AUTOPLAY_PLAY,apply(Yt,!0)),Gt(EVENT_AUTOPLAY_PAUSE,apply(Yt,!1)),Gt([EVENT_MOVED,EVENT_SCROLLED],apply(Xt,!0)))}function Xt(Zt){setAttribute(zt,ARIA_BUSY,Zt),Zt?(append(zt,Ht),Wt.start()):(remove(Ht),Wt.cancel())}function Kt(){removeAttribute(zt,[ARIA_LIVE,ARIA_ATOMIC,ARIA_BUSY]),remove(Ht)}function Yt(Zt){jt&&setAttribute(zt,ARIA_LIVE,Zt?"off":"polite")}return{mount:qt,disable:Yt,destroy:Kt}}var ComponentConstructors=Object.freeze({__proto__:null,Media,Direction,Elements,Slides,Layout,Clones,Move,Controller:Controller$1,Arrows,Autoplay,Cover,Scroll,Drag,Keyboard,LazyLoad,Pagination,Sync,Wheel,Live}),I18N={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},DEFAULTS$1={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:CLASSES,i18n:I18N,reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function Fade(kt,_e,Dt){var Vt=_e.Slides;function Gt(){EventInterface(kt).on([EVENT_MOUNTED,EVENT_REFRESH],zt)}function zt(){Vt.forEach(function(Ht){Ht.style("transform","translateX(-"+100*Ht.index+"%)")})}function jt(Ht,Wt){Vt.style("transition","opacity "+Dt.speed+"ms "+Dt.easing),nextTick(Wt)}return{mount:Gt,start:jt,cancel:noop$3}}function Slide(kt,_e,Dt){var Vt=_e.Move,Gt=_e.Controller,zt=_e.Scroll,jt=_e.Elements.list,Ht=apply(style,jt,"transition"),Wt;function qt(){EventInterface(kt).bind(jt,"transitionend",function(Zt){Zt.target===jt&&Wt&&(Kt(),Wt())})}function Xt(Zt,Jt){var nn=Vt.toPosition(Zt,!0),rn=Vt.getPosition(),Qt=Yt(Zt);abs(nn-rn)>=1&&Qt>=1?Dt.useScroll?zt.scroll(nn,Qt,!1,Jt):(Ht("transform "+Qt+"ms "+Dt.easing),Vt.translate(nn,!0),Wt=Jt):(Vt.jump(Zt),Jt())}function Kt(){Ht(""),zt.cancel()}function Yt(Zt){var Jt=Dt.rewindSpeed;if(kt.is(SLIDE)&&Jt){var nn=Gt.getIndex(!0),rn=Gt.getEnd();if(nn===0&&Zt>=rn||nn>=rn&&Zt===0)return Jt}return Dt.speed}return{mount:qt,start:Xt,cancel:Kt}}var _Splide=function(){function kt(Dt,Vt){this.event=EventInterface(),this.Components={},this.state=State(CREATED),this.splides=[],this._o={},this._E={};var Gt=isString(Dt)?query$1(document,Dt):Dt;assert(Gt,Gt+" is invalid."),this.root=Gt,Vt=merge({label:getAttribute$1(Gt,ARIA_LABEL)||"",labelledby:getAttribute$1(Gt,ARIA_LABELLEDBY)||""},DEFAULTS$1,kt.defaults,Vt||{});try{merge(Vt,JSON.parse(getAttribute$1(Gt,DATA_ATTRIBUTE)))}catch{assert(!1,"Invalid JSON")}this._o=Object.create(merge({},Vt))}var _e=kt.prototype;return _e.mount=function(Vt,Gt){var zt=this,jt=this.state,Ht=this.Components;assert(jt.is([CREATED,DESTROYED]),"Already mounted!"),jt.set(CREATED),this._C=Ht,this._T=Gt||this._T||(this.is(FADE)?Fade:Slide),this._E=Vt||this._E;var Wt=assign({},ComponentConstructors,this._E,{Transition:this._T});return forOwn$2(Wt,function(qt,Xt){var Kt=qt(zt,Ht,zt._o);Ht[Xt]=Kt,Kt.setup&&Kt.setup()}),forOwn$2(Ht,function(qt){qt.mount&&qt.mount()}),this.emit(EVENT_MOUNTED),addClass(this.root,CLASS_INITIALIZED),jt.set(IDLE),this.emit(EVENT_READY),this},_e.sync=function(Vt){return this.splides.push({splide:Vt}),Vt.splides.push({splide:this,isParent:!0}),this.state.is(IDLE)&&(this._C.Sync.remount(),Vt.Components.Sync.remount()),this},_e.go=function(Vt){return this._C.Controller.go(Vt),this},_e.on=function(Vt,Gt){return this.event.on(Vt,Gt),this},_e.off=function(Vt){return this.event.off(Vt),this},_e.emit=function(Vt){var Gt;return(Gt=this.event).emit.apply(Gt,[Vt].concat(slice$3(arguments,1))),this},_e.add=function(Vt,Gt){return this._C.Slides.add(Vt,Gt),this},_e.remove=function(Vt){return this._C.Slides.remove(Vt),this},_e.is=function(Vt){return this._o.type===Vt},_e.refresh=function(){return this.emit(EVENT_REFRESH),this},_e.destroy=function(Vt){Vt===void 0&&(Vt=!0);var Gt=this.event,zt=this.state;return zt.is(CREATED)?EventInterface(this).on(EVENT_READY,this.destroy.bind(this,Vt)):(forOwn$2(this._C,function(jt){jt.destroy&&jt.destroy(Vt)},!0),Gt.emit(EVENT_DESTROY),Gt.destroy(),Vt&&empty(this.splides),zt.set(DESTROYED)),this},_createClass(kt,[{key:"options",get:function(){return this._o},set:function(Vt){this._C.Media.set(Vt,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),kt}(),Splide=_Splide;Splide.defaults={};Splide.STATES=STATES;var EVENTS=[[EVENT_MOUNTED,"onMounted"],[EVENT_READY,"onReady"],[EVENT_MOVE,"onMove"],[EVENT_MOVED,"onMoved"],[EVENT_CLICK,"onClick"],[EVENT_ACTIVE,"onActive"],[EVENT_INACTIVE,"onInactive"],[EVENT_VISIBLE,"onVisible"],[EVENT_HIDDEN,"onHidden"],[EVENT_REFRESH,"onRefresh"],[EVENT_UPDATED,"onUpdated"],[EVENT_RESIZE,"onResize"],[EVENT_RESIZED,"onResized"],[EVENT_DRAG,"onDrag"],[EVENT_DRAGGING,"onDragging"],[EVENT_DRAGGED,"onDragged"],[EVENT_SCROLL,"onScroll"],[EVENT_SCROLLED,"onScrolled"],[EVENT_DESTROY,"onDestroy"],[EVENT_ARROWS_MOUNTED,"onArrowsMounted"],[EVENT_ARROWS_UPDATED,"onArrowsUpdated"],[EVENT_PAGINATION_MOUNTED,"onPaginationMounted"],[EVENT_PAGINATION_UPDATED,"onPaginationUpdated"],[EVENT_NAVIGATION_MOUNTED,"onNavigationMounted"],[EVENT_AUTOPLAY_PLAY,"onAutoplayPlay"],[EVENT_AUTOPLAY_PLAYING,"onAutoplayPlaying"],[EVENT_AUTOPLAY_PAUSE,"onAutoplayPause"],[EVENT_LAZYLOAD_LOADED,"onLazyLoadLoaded"]];function classNames(...kt){return kt.filter(Boolean).join(" ")}function isObject2(kt){return kt!==null&&typeof kt=="object"}function isEqualDeep(kt,_e){if(Array.isArray(kt)&&Array.isArray(_e))return kt.length===_e.length&&!kt.some((Dt,Vt)=>!isEqualDeep(Dt,_e[Vt]));if(isObject2(kt)&&isObject2(_e)){const Dt=Object.keys(kt),Vt=Object.keys(_e);return Dt.length===Vt.length&&!Dt.some(Gt=>!Object.prototype.hasOwnProperty.call(_e,Gt)||!isEqualDeep(kt[Gt],_e[Gt]))}return kt===_e}function isEqualShallow(kt,_e){return kt.length===_e.length&&!kt.some((Dt,Vt)=>Dt!==_e[Vt])}function forOwn2(kt,_e){if(kt){const Dt=Object.keys(kt);for(let Vt=0;Vt<Dt.length;Vt++){const Gt=Dt[Vt];if(Gt!=="__proto__"&&_e(kt[Gt],Gt)===!1)break}}return kt}function merge2(kt,_e){const Dt=kt;return forOwn2(_e,(Vt,Gt)=>{Array.isArray(Vt)?Dt[Gt]=Vt.slice():isObject2(Vt)?Dt[Gt]=merge2(isObject2(Dt[Gt])?Dt[Gt]:{},Vt):Dt[Gt]=Vt}),Dt}var SplideTrack=({children:kt,className:_e,...Dt})=>React.createElement("div",{className:classNames("splide__track",_e),...Dt},React.createElement("ul",{className:"splide__list"},kt)),Splide2=class extends React.Component{constructor(){super(...arguments),this.splideRef=React.createRef(),this.slides=[]}componentDidMount(){const{options:kt,extensions:_e,transition:Dt}=this.props,{current:Vt}=this.splideRef;Vt&&(this.splide=new Splide(Vt,kt),this.bind(this.splide),this.splide.mount(_e,Dt),this.options=merge2({},kt||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:kt}=this.props;kt&&!isEqualDeep(this.options,kt)&&(this.splide.options=kt,this.options=merge2({},kt));const _e=this.getSlides();isEqualShallow(this.slides,_e)||(this.splide.refresh(),this.slides=_e)}sync(kt){var _e;(_e=this.splide)==null||_e.sync(kt)}go(kt){var _e;(_e=this.splide)==null||_e.go(kt)}getSlides(){var kt;if(this.splide){const _e=(kt=this.splide.Components.Elements)==null?void 0:kt.list.children;return _e&&Array.prototype.slice.call(_e)||[]}return[]}bind(kt){EVENTS.forEach(([_e,Dt])=>{const Vt=this.props[Dt];typeof Vt=="function"&&kt.on(_e,(...Gt)=>{Vt(kt,...Gt)})})}omit(kt,_e){return _e.forEach(Dt=>{Object.prototype.hasOwnProperty.call(kt,Dt)&&delete kt[Dt]}),kt}render(){const{className:kt,tag:_e="div",hasTrack:Dt=!0,children:Vt,...Gt}=this.props;return React.createElement(_e,{className:classNames("splide",kt),ref:this.splideRef,...this.omit(Gt,["options",...EVENTS.map(zt=>zt[1])])},Dt?React.createElement(SplideTrack,null,Vt):Vt)}},SplideSlide=({children:kt,className:_e,...Dt})=>React.createElement("li",{className:classNames("splide__slide",_e),...Dt},kt);/*!
72
+ `;let s=ju;c$1([e$2("#qrCodeCanvas")],s.prototype,"_qrCodeGenCanvasRef");window.customElements.get(s.webComponentName)===void 0&&window.customElements.define(s.webComponentName,s);var e$1=(kt=>(kt.millimeter="mm",kt.centimeter="cm",kt.decimeter="dm",kt.meter="m",kt.decameter="dam",kt.hectometer="hm",kt.kilometer="km",kt.inch="in",kt.foot="ft",kt.yard="yd",kt.mile="mi",kt))(e$1||{});let r$3={};r$3[`${e$1.millimeter}-${e$1.meter}`]=.001;r$3[`${e$1.meter}-${e$1.millimeter}`]=1e3;r$3[`${e$1.centimeter}-${e$1.meter}`]=.01;r$3[`${e$1.meter}-${e$1.centimeter}`]=100;r$3[`${e$1.decimeter}-${e$1.meter}`]=.1;r$3[`${e$1.meter}-${e$1.decimeter}`]=10;r$3[`${e$1.meter}-${e$1.meter}`]=1;r$3[`${e$1.decameter}-${e$1.meter}`]=10;r$3[`${e$1.meter}-${e$1.decameter}`]=.1;r$3[`${e$1.hectometer}-${e$1.meter}`]=100;r$3[`${e$1.meter}-${e$1.hectometer}`]=.01;r$3[`${e$1.kilometer}-${e$1.meter}`]=1e3;r$3[`${e$1.meter}-${e$1.kilometer}`]=.001;r$3[`${e$1.inch}-${e$1.meter}`]=.0254;r$3[`${e$1.meter}-${e$1.inch}`]=39.3701;r$3[`${e$1.foot}-${e$1.meter}`]=.3048;r$3[`${e$1.meter}-${e$1.foot}`]=3.28084;r$3[`${e$1.yard}-${e$1.meter}`]=.9144;r$3[`${e$1.meter}-${e$1.yard}`]=1.09361;r$3[`${e$1.mile}-${e$1.meter}`]=1609.34;r$3[`${e$1.meter}-${e$1.mile}`]=621371e-9;const ENV={}.VITE_APP_ENV,ASSETS_SOURCE_ROOT="https://asset.myepigraph.com/configurator-assets",IS_DEV_ENV=!1,LOGGER$1=new a$1("CONFIGURATOR"),GHOST_LAYER=2,DEFAULT_INVENTORY=99999,DEFAULT_PRODUCT_PRICE=99999,DEFAULT_PRODUCT_COMPARE_AT_PRICE=0,FETCH_CONFIG_ENDPOINT_FB="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=";LOGGER$1.info({title:"Logger Test"});ENV==="staging"?LOGGER$1.setCurrentMode(t$3.Staging):LOGGER$1.setCurrentMode(t$3.Release);const ALL_PROJECTS_ASSET_DATA_ROOT_URL=`${ASSETS_SOURCE_ROOT}/configurator`,GENERIC_PROJECT_ASSET_DATA_ROOT_URL=`${ALL_PROJECTS_ASSET_DATA_ROOT_URL}/generic`,PUBLIC_DESIGN_ASSETS_ENDPOINT="https://storage.googleapis.com/gsc-epigraph-design/product-assets",ALERT_TYPES=Object.freeze({info:{id:"info",level:1e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info.svg",color:"#2E6CDF",cssClass:"alert-info",background:"#D3E0F8",filter:"invert(39%) sepia(41%) saturate(5002%) hue-rotate(208deg) brightness(91%) contrast(92%)"},warn:{id:"warn",level:3e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Warning.svg",color:"#E2B236",cssClass:"alert-warn",background:"#F9EED2",filter:"invert(83%) sepia(67%) saturate(1578%) hue-rotate(328deg) brightness(93%) contrast(90%)"},error:{id:"error",level:4e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Block.svg",color:"#D0342C",cssClass:"alert-error",background:"#F6D7D5",filter:"invert(24%) sepia(96%) saturate(1914%) hue-rotate(349deg) brightness(95%) contrast(81%)"},success:{id:"success",level:2e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),CAMERA_ACTION=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),CURSORS={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},UIModal=({stores:kt,zIndex:_e,open:Dt,setOpen:Vt,heading:Gt,inputValue:zt,buttonText:jt,inputPlaceholder:Ht,formFieldExists:Wt,dualOptions:qt,modalText:Xt,onSubmit:Kt=()=>{},onCancel:Yt=()=>{},shareModal:Zt,loading:Jt,buttonClassName:nn=""})=>{const rn=kt.uiSceneStore(dn=>dn.CORE_API),Qt=reactExports.useRef(null),en=reactExports.useRef(null);reactExports.useState(Dt);const[tn,sn]=reactExports.useState(""),[cn,un]=reactExports.useState(Jt||null);reactExports.useEffect(()=>(un(Jt),()=>{}),[Jt]);function hn(dn){sn(dn.target.value)}return reactExports.useEffect(()=>{en.current&&(kt.uiSceneStore.setState({dialogPopupOpen:Dt}),Dt&&en.current.focus())},[Dt,en]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{ref:Qt,className:Dt===!0?"uiModal open":"uiModal",children:[jsxRuntimeExports.jsxs("div",{className:"modalDialog",children:[jsxRuntimeExports.jsx("div",{className:"modalCloseContainer",children:jsxRuntimeExports.jsx("div",{ref:en,role:"button","aria-label":"Close Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"closeButton",onClick:()=>{Yt(),Vt(!1),rn.coreWCRef.focus()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:dn=>{dn.target.src="https://placehold.co/150"}})})}),jsxRuntimeExports.jsx("h2",{className:"modalHeading",children:Gt}),Xt&&jsxRuntimeExports.jsx("p",{className:"modalText",children:Xt}),jsxRuntimeExports.jsx("div",{className:Zt?"shareModal":"noShareModal",children:cn?jsxRuntimeExports.jsx("div",{className:"shareModalChildDiv",children:jsxRuntimeExports.jsx("img",{alt:"Loading...",className:"shareModalLoaderImg",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:dn=>{dn.target.src="https://placehold.co/150"}})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Wt&&(zt!==void 0?jsxRuntimeExports.jsx("input",{tabIndex:-1,"aria-hidden":!1,type:"text",value:zt,"aria-label":"Shareable Link",autoComplete:"off",readOnly:!0}):jsxRuntimeExports.jsx("input",{tabIndex:Dt?0:-1,"aria-hidden":!Dt,placeholder:Ht||"",type:"text","aria-label":""+Ht,value:tn,autoComplete:"off",onChange:dn=>{hn(dn)}})),qt?jsxRuntimeExports.jsxs("div",{className:"UIModalButtonParentDiv",children:[jsxRuntimeExports.jsx("button",{role:"button","aria-label":jt+" Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,onClick:()=>{Vt(!1),Kt(),rn.coreWCRef.focus()},children:jt}),jsxRuntimeExports.jsx("button",{role:"button","aria-label":"Cancel Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,onClick:()=>{Vt(!1),Yt(),rn.coreWCRef.focus()},className:"uiModalCancelButton",children:"Cancel"})]}):jsxRuntimeExports.jsx("button",{role:"button","aria-label":jt+" Button",tabIndex:Dt?0:-1,"aria-hidden":!Dt,className:nn||"",onClick:()=>{Zt||Vt(!1),Kt(),rn.coreWCRef.focus()},children:jt})]})})]}),jsxRuntimeExports.jsx("div",{className:"modalOverlay"})]})})};function _defineProperties(kt,_e){for(var Dt=0;Dt<_e.length;Dt++){var Vt=_e[Dt];Vt.enumerable=Vt.enumerable||!1,Vt.configurable=!0,"value"in Vt&&(Vt.writable=!0),Object.defineProperty(kt,Vt.key,Vt)}}function _createClass(kt,_e,Dt){return _e&&_defineProperties(kt.prototype,_e),Dt&&_defineProperties(kt,Dt),Object.defineProperty(kt,"prototype",{writable:!1}),kt}var MEDIA_PREFERS_REDUCED_MOTION="(prefers-reduced-motion: reduce)",CREATED=1,MOUNTED=2,IDLE=3,MOVING=4,SCROLLING=5,DRAGGING=6,DESTROYED=7,STATES={CREATED,MOUNTED,IDLE,MOVING,SCROLLING,DRAGGING,DESTROYED};function empty(kt){kt.length=0}function slice$3(kt,_e,Dt){return Array.prototype.slice.call(kt,_e,Dt)}function apply(kt){return kt.bind.apply(kt,[null].concat(slice$3(arguments,1)))}var nextTick=setTimeout,noop$3=function(){};function raf(kt){return requestAnimationFrame(kt)}function typeOf(kt,_e){return typeof _e===kt}function isObject$8(kt){return!isNull(kt)&&typeOf("object",kt)}var isArray$5=Array.isArray,isFunction$5=apply(typeOf,"function"),isString=apply(typeOf,"string"),isUndefined=apply(typeOf,"undefined");function isNull(kt){return kt===null}function isHTMLElement(kt){try{return kt instanceof(kt.ownerDocument.defaultView||window).HTMLElement}catch{return!1}}function toArray(kt){return isArray$5(kt)?kt:[kt]}function forEach$1(kt,_e){toArray(kt).forEach(_e)}function includes(kt,_e){return kt.indexOf(_e)>-1}function push$3(kt,_e){return kt.push.apply(kt,toArray(_e)),kt}function toggleClass(kt,_e,Dt){kt&&forEach$1(_e,function(Vt){Vt&&kt.classList[Dt?"add":"remove"](Vt)})}function addClass(kt,_e){toggleClass(kt,isString(_e)?_e.split(" "):_e,!0)}function append(kt,_e){forEach$1(_e,kt.appendChild.bind(kt))}function before(kt,_e){forEach$1(kt,function(Dt){var Vt=(_e||Dt).parentNode;Vt&&Vt.insertBefore(Dt,_e)})}function matches(kt,_e){return isHTMLElement(kt)&&(kt.msMatchesSelector||kt.matches).call(kt,_e)}function children(kt,_e){var Dt=kt?slice$3(kt.children):[];return _e?Dt.filter(function(Vt){return matches(Vt,_e)}):Dt}function child(kt,_e){return _e?children(kt,_e)[0]:kt.firstElementChild}var ownKeys$2=Object.keys;function forOwn$2(kt,_e,Dt){return kt&&(Dt?ownKeys$2(kt).reverse():ownKeys$2(kt)).forEach(function(Vt){Vt!=="__proto__"&&_e(kt[Vt],Vt)}),kt}function assign(kt){return slice$3(arguments,1).forEach(function(_e){forOwn$2(_e,function(Dt,Vt){kt[Vt]=_e[Vt]})}),kt}function merge(kt){return slice$3(arguments,1).forEach(function(_e){forOwn$2(_e,function(Dt,Vt){isArray$5(Dt)?kt[Vt]=Dt.slice():isObject$8(Dt)?kt[Vt]=merge({},isObject$8(kt[Vt])?kt[Vt]:{},Dt):kt[Vt]=Dt})}),kt}function omit(kt,_e){forEach$1(_e||ownKeys$2(kt),function(Dt){delete kt[Dt]})}function removeAttribute(kt,_e){forEach$1(kt,function(Dt){forEach$1(_e,function(Vt){Dt&&Dt.removeAttribute(Vt)})})}function setAttribute(kt,_e,Dt){isObject$8(_e)?forOwn$2(_e,function(Vt,Gt){setAttribute(kt,Gt,Vt)}):forEach$1(kt,function(Vt){isNull(Dt)||Dt===""?removeAttribute(Vt,_e):Vt.setAttribute(_e,String(Dt))})}function create$3(kt,_e,Dt){var Vt=document.createElement(kt);return _e&&(isString(_e)?addClass(Vt,_e):setAttribute(Vt,_e)),Dt&&append(Dt,Vt),Vt}function style(kt,_e,Dt){if(isUndefined(Dt))return getComputedStyle(kt)[_e];isNull(Dt)||(kt.style[_e]=""+Dt)}function display(kt,_e){style(kt,"display",_e)}function focus(kt){kt.setActive&&kt.setActive()||kt.focus({preventScroll:!0})}function getAttribute$1(kt,_e){return kt.getAttribute(_e)}function hasClass(kt,_e){return kt&&kt.classList.contains(_e)}function rect(kt){return kt.getBoundingClientRect()}function remove(kt){forEach$1(kt,function(_e){_e&&_e.parentNode&&_e.parentNode.removeChild(_e)})}function parseHtml(kt){return child(new DOMParser().parseFromString(kt,"text/html").body)}function prevent(kt,_e){kt.preventDefault(),_e&&(kt.stopPropagation(),kt.stopImmediatePropagation())}function query$1(kt,_e){return kt&&kt.querySelector(_e)}function queryAll(kt,_e){return _e?slice$3(kt.querySelectorAll(_e)):[]}function removeClass(kt,_e){toggleClass(kt,_e,!1)}function timeOf(kt){return kt.timeStamp}function unit(kt){return isString(kt)?kt:kt?kt+"px":""}var PROJECT_CODE="splide",DATA_ATTRIBUTE="data-"+PROJECT_CODE;function assert(kt,_e){if(!kt)throw new Error("["+PROJECT_CODE+"] "+(_e||""))}var min=Math.min,max$1=Math.max,floor=Math.floor,ceil=Math.ceil,abs=Math.abs;function approximatelyEqual(kt,_e,Dt){return abs(kt-_e)<Dt}function between(kt,_e,Dt,Vt){var Gt=min(_e,Dt),zt=max$1(_e,Dt);return Vt?Gt<kt&&kt<zt:Gt<=kt&&kt<=zt}function clamp$3(kt,_e,Dt){var Vt=min(_e,Dt),Gt=max$1(_e,Dt);return min(max$1(Vt,kt),Gt)}function sign$1(kt){return+(kt>0)-+(kt<0)}function format(kt,_e){return forEach$1(_e,function(Dt){kt=kt.replace("%s",""+Dt)}),kt}function pad(kt){return kt<10?"0"+kt:""+kt}var ids={};function uniqueId(kt){return""+kt+pad(ids[kt]=(ids[kt]||0)+1)}function EventBinder(){var kt=[];function _e(jt,Ht,Wt,qt){Gt(jt,Ht,function(Xt,Kt,Yt){var Zt="addEventListener"in Xt,Jt=Zt?Xt.removeEventListener.bind(Xt,Kt,Wt,qt):Xt.removeListener.bind(Xt,Wt);Zt?Xt.addEventListener(Kt,Wt,qt):Xt.addListener(Wt),kt.push([Xt,Kt,Yt,Wt,Jt])})}function Dt(jt,Ht,Wt){Gt(jt,Ht,function(qt,Xt,Kt){kt=kt.filter(function(Yt){return Yt[0]===qt&&Yt[1]===Xt&&Yt[2]===Kt&&(!Wt||Yt[3]===Wt)?(Yt[4](),!1):!0})})}function Vt(jt,Ht,Wt){var qt,Xt=!0;return typeof CustomEvent=="function"?qt=new CustomEvent(Ht,{bubbles:Xt,detail:Wt}):(qt=document.createEvent("CustomEvent"),qt.initCustomEvent(Ht,Xt,!1,Wt)),jt.dispatchEvent(qt),qt}function Gt(jt,Ht,Wt){forEach$1(jt,function(qt){qt&&forEach$1(Ht,function(Xt){Xt.split(" ").forEach(function(Kt){var Yt=Kt.split(".");Wt(qt,Yt[0],Yt[1])})})})}function zt(){kt.forEach(function(jt){jt[4]()}),empty(kt)}return{bind:_e,unbind:Dt,dispatch:Vt,destroy:zt}}var EVENT_MOUNTED="mounted",EVENT_READY="ready",EVENT_MOVE="move",EVENT_MOVED="moved",EVENT_CLICK="click",EVENT_ACTIVE="active",EVENT_INACTIVE="inactive",EVENT_VISIBLE="visible",EVENT_HIDDEN="hidden",EVENT_REFRESH="refresh",EVENT_UPDATED="updated",EVENT_RESIZE="resize",EVENT_RESIZED="resized",EVENT_DRAG="drag",EVENT_DRAGGING="dragging",EVENT_DRAGGED="dragged",EVENT_SCROLL="scroll",EVENT_SCROLLED="scrolled",EVENT_OVERFLOW="overflow",EVENT_DESTROY="destroy",EVENT_ARROWS_MOUNTED="arrows:mounted",EVENT_ARROWS_UPDATED="arrows:updated",EVENT_PAGINATION_MOUNTED="pagination:mounted",EVENT_PAGINATION_UPDATED="pagination:updated",EVENT_NAVIGATION_MOUNTED="navigation:mounted",EVENT_AUTOPLAY_PLAY="autoplay:play",EVENT_AUTOPLAY_PLAYING="autoplay:playing",EVENT_AUTOPLAY_PAUSE="autoplay:pause",EVENT_LAZYLOAD_LOADED="lazyload:loaded",EVENT_SLIDE_KEYDOWN="sk",EVENT_SHIFTED="sh",EVENT_END_INDEX_CHANGED="ei";function EventInterface(kt){var _e=kt?kt.event.bus:document.createDocumentFragment(),Dt=EventBinder();function Vt(zt,jt){Dt.bind(_e,toArray(zt).join(" "),function(Ht){jt.apply(jt,isArray$5(Ht.detail)?Ht.detail:[])})}function Gt(zt){Dt.dispatch(_e,zt,slice$3(arguments,1))}return kt&&kt.event.on(EVENT_DESTROY,Dt.destroy),assign(Dt,{bus:_e,on:Vt,off:apply(Dt.unbind,_e),emit:Gt})}function RequestInterval(kt,_e,Dt,Vt){var Gt=Date.now,zt,jt=0,Ht,Wt=!0,qt=0;function Xt(){if(!Wt){if(jt=kt?min((Gt()-zt)/kt,1):1,Dt&&Dt(jt),jt>=1&&(_e(),zt=Gt(),Vt&&++qt>=Vt))return Yt();Ht=raf(Xt)}}function Kt(Qt){Qt||Jt(),zt=Gt()-(Qt?jt*kt:0),Wt=!1,Ht=raf(Xt)}function Yt(){Wt=!0}function Zt(){zt=Gt(),jt=0,Dt&&Dt(jt)}function Jt(){Ht&&cancelAnimationFrame(Ht),jt=0,Ht=0,Wt=!0}function nn(Qt){kt=Qt}function rn(){return Wt}return{start:Kt,rewind:Zt,pause:Yt,cancel:Jt,set:nn,isPaused:rn}}function State(kt){var _e=kt;function Dt(Gt){_e=Gt}function Vt(Gt){return includes(toArray(Gt),_e)}return{set:Dt,is:Vt}}function Throttle(kt,_e){var Dt=RequestInterval(_e||0,kt,null,1);return function(){Dt.isPaused()&&Dt.start()}}function Media(kt,_e,Dt){var Vt=kt.state,Gt=Dt.breakpoints||{},zt=Dt.reducedMotion||{},jt=EventBinder(),Ht=[];function Wt(){var Jt=Dt.mediaQuery==="min";ownKeys$2(Gt).sort(function(nn,rn){return Jt?+nn-+rn:+rn-+nn}).forEach(function(nn){Xt(Gt[nn],"("+(Jt?"min":"max")+"-width:"+nn+"px)")}),Xt(zt,MEDIA_PREFERS_REDUCED_MOTION),Kt()}function qt(Jt){Jt&&jt.destroy()}function Xt(Jt,nn){var rn=matchMedia(nn);jt.bind(rn,"change",Kt),Ht.push([Jt,rn])}function Kt(){var Jt=Vt.is(DESTROYED),nn=Dt.direction,rn=Ht.reduce(function(Qt,en){return merge(Qt,en[1].matches?en[0]:{})},{});omit(Dt),Zt(rn),Dt.destroy?kt.destroy(Dt.destroy==="completely"):Jt?(qt(!0),kt.mount()):nn!==Dt.direction&&kt.refresh()}function Yt(Jt){matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches&&(Jt?merge(Dt,zt):omit(Dt,ownKeys$2(zt)))}function Zt(Jt,nn,rn){merge(Dt,Jt),nn&&merge(Object.getPrototypeOf(Dt),Jt),(rn||!Vt.is(CREATED))&&kt.emit(EVENT_UPDATED,Dt)}return{setup:Wt,destroy:qt,reduce:Yt,set:Zt}}var ARROW="Arrow",ARROW_LEFT=ARROW+"Left",ARROW_RIGHT=ARROW+"Right",ARROW_UP=ARROW+"Up",ARROW_DOWN=ARROW+"Down",RTL="rtl",TTB="ttb",ORIENTATION_MAP={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[ARROW_UP,ARROW_RIGHT],ArrowRight:[ARROW_DOWN,ARROW_LEFT]};function Direction(kt,_e,Dt){function Vt(zt,jt,Ht){Ht=Ht||Dt.direction;var Wt=Ht===RTL&&!jt?1:Ht===TTB?0:-1;return ORIENTATION_MAP[zt]&&ORIENTATION_MAP[zt][Wt]||zt.replace(/width|left|right/i,function(qt,Xt){var Kt=ORIENTATION_MAP[qt.toLowerCase()][Wt]||qt;return Xt>0?Kt.charAt(0).toUpperCase()+Kt.slice(1):Kt})}function Gt(zt){return zt*(Dt.direction===RTL?1:-1)}return{resolve:Vt,orient:Gt}}var ROLE="role",TAB_INDEX="tabindex",DISABLED="disabled",ARIA_PREFIX="aria-",ARIA_CONTROLS=ARIA_PREFIX+"controls",ARIA_CURRENT=ARIA_PREFIX+"current",ARIA_SELECTED=ARIA_PREFIX+"selected",ARIA_LABEL=ARIA_PREFIX+"label",ARIA_LABELLEDBY=ARIA_PREFIX+"labelledby",ARIA_HIDDEN=ARIA_PREFIX+"hidden",ARIA_ORIENTATION=ARIA_PREFIX+"orientation",ARIA_ROLEDESCRIPTION=ARIA_PREFIX+"roledescription",ARIA_LIVE=ARIA_PREFIX+"live",ARIA_BUSY=ARIA_PREFIX+"busy",ARIA_ATOMIC=ARIA_PREFIX+"atomic",ALL_ATTRIBUTES=[ROLE,TAB_INDEX,DISABLED,ARIA_CONTROLS,ARIA_CURRENT,ARIA_LABEL,ARIA_LABELLEDBY,ARIA_HIDDEN,ARIA_ORIENTATION,ARIA_ROLEDESCRIPTION],CLASS_PREFIX=PROJECT_CODE+"__",STATUS_CLASS_PREFIX="is-",CLASS_ROOT=PROJECT_CODE,CLASS_TRACK=CLASS_PREFIX+"track",CLASS_LIST=CLASS_PREFIX+"list",CLASS_SLIDE=CLASS_PREFIX+"slide",CLASS_CLONE=CLASS_SLIDE+"--clone",CLASS_CONTAINER=CLASS_SLIDE+"__container",CLASS_ARROWS=CLASS_PREFIX+"arrows",CLASS_ARROW=CLASS_PREFIX+"arrow",CLASS_ARROW_PREV=CLASS_ARROW+"--prev",CLASS_ARROW_NEXT=CLASS_ARROW+"--next",CLASS_PAGINATION=CLASS_PREFIX+"pagination",CLASS_PAGINATION_PAGE=CLASS_PAGINATION+"__page",CLASS_PROGRESS=CLASS_PREFIX+"progress",CLASS_PROGRESS_BAR=CLASS_PROGRESS+"__bar",CLASS_TOGGLE=CLASS_PREFIX+"toggle",CLASS_SPINNER=CLASS_PREFIX+"spinner",CLASS_SR=CLASS_PREFIX+"sr",CLASS_INITIALIZED=STATUS_CLASS_PREFIX+"initialized",CLASS_ACTIVE=STATUS_CLASS_PREFIX+"active",CLASS_PREV=STATUS_CLASS_PREFIX+"prev",CLASS_NEXT=STATUS_CLASS_PREFIX+"next",CLASS_VISIBLE=STATUS_CLASS_PREFIX+"visible",CLASS_LOADING=STATUS_CLASS_PREFIX+"loading",CLASS_FOCUS_IN=STATUS_CLASS_PREFIX+"focus-in",CLASS_OVERFLOW=STATUS_CLASS_PREFIX+"overflow",STATUS_CLASSES=[CLASS_ACTIVE,CLASS_VISIBLE,CLASS_PREV,CLASS_NEXT,CLASS_LOADING,CLASS_FOCUS_IN,CLASS_OVERFLOW],CLASSES={slide:CLASS_SLIDE,clone:CLASS_CLONE,arrows:CLASS_ARROWS,arrow:CLASS_ARROW,prev:CLASS_ARROW_PREV,next:CLASS_ARROW_NEXT,pagination:CLASS_PAGINATION,page:CLASS_PAGINATION_PAGE,spinner:CLASS_SPINNER};function closest(kt,_e){if(isFunction$5(kt.closest))return kt.closest(_e);for(var Dt=kt;Dt&&Dt.nodeType===1&&!matches(Dt,_e);)Dt=Dt.parentElement;return Dt}var FRICTION=5,LOG_INTERVAL=200,POINTER_DOWN_EVENTS="touchstart mousedown",POINTER_MOVE_EVENTS="touchmove mousemove",POINTER_UP_EVENTS="touchend touchcancel mouseup click";function Elements(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=kt.root,Ht=Dt.i18n,Wt={},qt=[],Xt=[],Kt=[],Yt,Zt,Jt;function nn(){tn(),sn(),en()}function rn(){Gt(EVENT_REFRESH,Qt),Gt(EVENT_REFRESH,nn),Gt(EVENT_UPDATED,en),zt(document,POINTER_DOWN_EVENTS+" keydown",function(hn){Jt=hn.type==="keydown"},{capture:!0}),zt(jt,"focusin",function(){toggleClass(jt,CLASS_FOCUS_IN,!!Jt)})}function Qt(hn){var dn=ALL_ATTRIBUTES.concat("style");empty(qt),removeClass(jt,Xt),removeClass(Yt,Kt),removeAttribute([Yt,Zt],dn),removeAttribute(jt,hn?dn:["style",ARIA_ROLEDESCRIPTION])}function en(){removeClass(jt,Xt),removeClass(Yt,Kt),Xt=un(CLASS_ROOT),Kt=un(CLASS_TRACK),addClass(jt,Xt),addClass(Yt,Kt),setAttribute(jt,ARIA_LABEL,Dt.label),setAttribute(jt,ARIA_LABELLEDBY,Dt.labelledby)}function tn(){Yt=cn("."+CLASS_TRACK),Zt=child(Yt,"."+CLASS_LIST),assert(Yt&&Zt,"A track/list element is missing."),push$3(qt,children(Zt,"."+CLASS_SLIDE+":not(."+CLASS_CLONE+")")),forOwn$2({arrows:CLASS_ARROWS,pagination:CLASS_PAGINATION,prev:CLASS_ARROW_PREV,next:CLASS_ARROW_NEXT,bar:CLASS_PROGRESS_BAR,toggle:CLASS_TOGGLE},function(hn,dn){Wt[dn]=cn("."+hn)}),assign(Wt,{root:jt,track:Yt,list:Zt,slides:qt})}function sn(){var hn=jt.id||uniqueId(PROJECT_CODE),dn=Dt.role;jt.id=hn,Yt.id=Yt.id||hn+"-track",Zt.id=Zt.id||hn+"-list",!getAttribute$1(jt,ROLE)&&jt.tagName!=="SECTION"&&dn&&setAttribute(jt,ROLE,dn),setAttribute(jt,ARIA_ROLEDESCRIPTION,Ht.carousel),setAttribute(Zt,ROLE,"presentation")}function cn(hn){var dn=query$1(jt,hn);return dn&&closest(dn,"."+CLASS_ROOT)===jt?dn:void 0}function un(hn){return[hn+"--"+Dt.type,hn+"--"+Dt.direction,Dt.drag&&hn+"--draggable",Dt.isNavigation&&hn+"--nav",hn===CLASS_ROOT&&CLASS_ACTIVE]}return assign(Wt,{setup:nn,mount:rn,destroy:Qt})}var SLIDE="slide",LOOP="loop",FADE="fade";function Slide$1(kt,_e,Dt,Vt){var Gt=EventInterface(kt),zt=Gt.on,jt=Gt.emit,Ht=Gt.bind,Wt=kt.Components,qt=kt.root,Xt=kt.options,Kt=Xt.isNavigation,Yt=Xt.updateOnMove,Zt=Xt.i18n,Jt=Xt.pagination,nn=Xt.slideFocus,rn=Wt.Direction.resolve,Qt=getAttribute$1(Vt,"style"),en=getAttribute$1(Vt,ARIA_LABEL),tn=Dt>-1,sn=child(Vt,"."+CLASS_CONTAINER),cn;function un(){tn||(Vt.id=qt.id+"-slide"+pad(_e+1),setAttribute(Vt,ROLE,Jt?"tabpanel":"group"),setAttribute(Vt,ARIA_ROLEDESCRIPTION,Zt.slide),setAttribute(Vt,ARIA_LABEL,en||format(Zt.slideLabel,[_e+1,kt.length]))),hn()}function hn(){Ht(Vt,"click",apply(jt,EVENT_CLICK,yn)),Ht(Vt,"keydown",apply(jt,EVENT_SLIDE_KEYDOWN,yn)),zt([EVENT_MOVED,EVENT_SHIFTED,EVENT_SCROLLED],mn),zt(EVENT_NAVIGATION_MOUNTED,pn),Yt&&zt(EVENT_MOVE,fn)}function dn(){cn=!0,Gt.destroy(),removeClass(Vt,STATUS_CLASSES),removeAttribute(Vt,ALL_ATTRIBUTES),setAttribute(Vt,"style",Qt),setAttribute(Vt,ARIA_LABEL,en||"")}function pn(){var Sn=kt.splides.map(function(wn){var xn=wn.splide.Components.Slides.getAt(_e);return xn?xn.slide.id:""}).join(" ");setAttribute(Vt,ARIA_LABEL,format(Zt.slideX,(tn?Dt:_e)+1)),setAttribute(Vt,ARIA_CONTROLS,Sn),setAttribute(Vt,ROLE,nn?"button":""),nn&&removeAttribute(Vt,ARIA_ROLEDESCRIPTION)}function fn(){cn||mn()}function mn(){if(!cn){var Sn=kt.index;vn(),_n(),toggleClass(Vt,CLASS_PREV,_e===Sn-1),toggleClass(Vt,CLASS_NEXT,_e===Sn+1)}}function vn(){var Sn=An();Sn!==hasClass(Vt,CLASS_ACTIVE)&&(toggleClass(Vt,CLASS_ACTIVE,Sn),setAttribute(Vt,ARIA_CURRENT,Kt&&Sn||""),jt(Sn?EVENT_ACTIVE:EVENT_INACTIVE,yn))}function _n(){var Sn=Tn(),wn=!Sn&&(!An()||tn);if(kt.state.is([MOVING,SCROLLING])||setAttribute(Vt,ARIA_HIDDEN,wn||""),setAttribute(queryAll(Vt,Xt.focusableNodes||""),TAB_INDEX,wn?-1:""),nn&&setAttribute(Vt,TAB_INDEX,wn?-1:0),Sn!==hasClass(Vt,CLASS_VISIBLE)&&(toggleClass(Vt,CLASS_VISIBLE,Sn),jt(Sn?EVENT_VISIBLE:EVENT_HIDDEN,yn)),!Sn&&document.activeElement===Vt){var xn=Wt.Slides.getAt(kt.index);xn&&focus(xn.slide)}}function En(Sn,wn,xn){style(xn&&sn||Vt,Sn,wn)}function An(){var Sn=kt.index;return Sn===_e||Xt.cloneStatus&&Sn===Dt}function Tn(){if(kt.is(FADE))return An();var Sn=rect(Wt.Elements.track),wn=rect(Vt),xn=rn("left",!0),Rn=rn("right",!0);return floor(Sn[xn])<=ceil(wn[xn])&&floor(wn[Rn])<=ceil(Sn[Rn])}function Cn(Sn,wn){var xn=abs(Sn-_e);return!tn&&(Xt.rewind||kt.is(LOOP))&&(xn=min(xn,kt.length-xn)),xn<=wn}var yn={index:_e,slideIndex:Dt,slide:Vt,container:sn,isClone:tn,mount:un,destroy:dn,update:mn,style:En,isWithin:Cn};return yn}function Slides(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=_e.Elements,Wt=Ht.slides,qt=Ht.list,Xt=[];function Kt(){Yt(),Gt(EVENT_REFRESH,Zt),Gt(EVENT_REFRESH,Yt)}function Yt(){Wt.forEach(function(mn,vn){nn(mn,vn,-1)})}function Zt(){cn(function(mn){mn.destroy()}),empty(Xt)}function Jt(){cn(function(mn){mn.update()})}function nn(mn,vn,_n){var En=Slide$1(kt,vn,_n,mn);En.mount(),Xt.push(En),Xt.sort(function(An,Tn){return An.index-Tn.index})}function rn(mn){return mn?un(function(vn){return!vn.isClone}):Xt}function Qt(mn){var vn=_e.Controller,_n=vn.toIndex(mn),En=vn.hasFocus()?1:Dt.perPage;return un(function(An){return between(An.index,_n,_n+En-1)})}function en(mn){return un(mn)[0]}function tn(mn,vn){forEach$1(mn,function(_n){if(isString(_n)&&(_n=parseHtml(_n)),isHTMLElement(_n)){var En=Wt[vn];En?before(_n,En):append(qt,_n),addClass(_n,Dt.classes.slide),dn(_n,apply(zt,EVENT_RESIZE))}}),zt(EVENT_REFRESH)}function sn(mn){remove(un(mn).map(function(vn){return vn.slide})),zt(EVENT_REFRESH)}function cn(mn,vn){rn(vn).forEach(mn)}function un(mn){return Xt.filter(isFunction$5(mn)?mn:function(vn){return isString(mn)?matches(vn.slide,mn):includes(toArray(mn),vn.index)})}function hn(mn,vn,_n){cn(function(En){En.style(mn,vn,_n)})}function dn(mn,vn){var _n=queryAll(mn,"img"),En=_n.length;En?_n.forEach(function(An){jt(An,"load error",function(){--En||vn()})}):vn()}function pn(mn){return mn?Wt.length:Xt.length}function fn(){return Xt.length>Dt.perPage}return{mount:Kt,destroy:Zt,update:Jt,register:nn,get:rn,getIn:Qt,getAt:en,add:tn,remove:sn,forEach:cn,filter:un,style:hn,getLength:pn,isEnough:fn}}function Layout(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=_e.Slides,Wt=_e.Direction.resolve,qt=_e.Elements,Xt=qt.root,Kt=qt.track,Yt=qt.list,Zt=Ht.getAt,Jt=Ht.style,nn,rn,Qt;function en(){tn(),zt(window,"resize load",Throttle(apply(jt,EVENT_RESIZE))),Gt([EVENT_UPDATED,EVENT_REFRESH],tn),Gt(EVENT_RESIZE,sn)}function tn(){nn=Dt.direction===TTB,style(Xt,"maxWidth",unit(Dt.width)),style(Kt,Wt("paddingLeft"),cn(!1)),style(Kt,Wt("paddingRight"),cn(!0)),sn(!0)}function sn(yn){var Sn=rect(Xt);(yn||rn.width!==Sn.width||rn.height!==Sn.height)&&(style(Kt,"height",un()),Jt(Wt("marginRight"),unit(Dt.gap)),Jt("width",dn()),Jt("height",pn(),!0),rn=Sn,jt(EVENT_RESIZED),Qt!==(Qt=Cn())&&(toggleClass(Xt,CLASS_OVERFLOW,Qt),jt(EVENT_OVERFLOW,Qt)))}function cn(yn){var Sn=Dt.padding,wn=Wt(yn?"right":"left");return Sn&&unit(Sn[wn]||(isObject$8(Sn)?0:Sn))||"0px"}function un(){var yn="";return nn&&(yn=hn(),assert(yn,"height or heightRatio is missing."),yn="calc("+yn+" - "+cn(!1)+" - "+cn(!0)+")"),yn}function hn(){return unit(Dt.height||rect(Yt).width*Dt.heightRatio)}function dn(){return Dt.autoWidth?null:unit(Dt.fixedWidth)||(nn?"":fn())}function pn(){return unit(Dt.fixedHeight)||(nn?Dt.autoHeight?null:fn():hn())}function fn(){var yn=unit(Dt.gap);return"calc((100%"+(yn&&" + "+yn)+")/"+(Dt.perPage||1)+(yn&&" - "+yn)+")"}function mn(){return rect(Yt)[Wt("width")]}function vn(yn,Sn){var wn=Zt(yn||0);return wn?rect(wn.slide)[Wt("width")]+(Sn?0:An()):0}function _n(yn,Sn){var wn=Zt(yn);if(wn){var xn=rect(wn.slide)[Wt("right")],Rn=rect(Yt)[Wt("left")];return abs(xn-Rn)+(Sn?0:An())}return 0}function En(yn){return _n(kt.length-1)-_n(0)+vn(0,yn)}function An(){var yn=Zt(0);return yn&&parseFloat(style(yn.slide,Wt("marginRight")))||0}function Tn(yn){return parseFloat(style(Kt,Wt("padding"+(yn?"Right":"Left"))))||0}function Cn(){return kt.is(FADE)||En(!0)>mn()}return{mount:en,resize:sn,listSize:mn,slideSize:vn,sliderSize:En,totalSize:_n,getPadding:Tn,isOverflow:Cn}}var MULTIPLIER=2;function Clones(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=_e.Elements,jt=_e.Slides,Ht=_e.Direction.resolve,Wt=[],qt;function Xt(){Gt(EVENT_REFRESH,Kt),Gt([EVENT_UPDATED,EVENT_RESIZE],Zt),(qt=rn())&&(Jt(qt),_e.Layout.resize(!0))}function Kt(){Yt(),Xt()}function Yt(){remove(Wt),empty(Wt),Vt.destroy()}function Zt(){var Qt=rn();qt!==Qt&&(qt<Qt||!Qt)&&Vt.emit(EVENT_REFRESH)}function Jt(Qt){var en=jt.get().slice(),tn=en.length;if(tn){for(;en.length<Qt;)push$3(en,en);push$3(en.slice(-Qt),en.slice(0,Qt)).forEach(function(sn,cn){var un=cn<Qt,hn=nn(sn.slide,cn);un?before(hn,en[0].slide):append(zt.list,hn),push$3(Wt,hn),jt.register(hn,cn-Qt+(un?0:tn),sn.index)})}}function nn(Qt,en){var tn=Qt.cloneNode(!0);return addClass(tn,Dt.classes.clone),tn.id=kt.root.id+"-clone"+pad(en+1),tn}function rn(){var Qt=Dt.clones;if(!kt.is(LOOP))Qt=0;else if(isUndefined(Qt)){var en=Dt[Ht("fixedWidth")]&&_e.Layout.slideSize(0),tn=en&&ceil(rect(zt.track)[Ht("width")]/en);Qt=tn||Dt[Ht("autoWidth")]&&kt.length||Dt.perPage*MULTIPLIER}return Qt}return{mount:Xt,destroy:Yt}}function Move(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=kt.state.set,Ht=_e.Layout,Wt=Ht.slideSize,qt=Ht.getPadding,Xt=Ht.totalSize,Kt=Ht.listSize,Yt=Ht.sliderSize,Zt=_e.Direction,Jt=Zt.resolve,nn=Zt.orient,rn=_e.Elements,Qt=rn.list,en=rn.track,tn;function sn(){tn=_e.Transition,Gt([EVENT_MOUNTED,EVENT_RESIZED,EVENT_UPDATED,EVENT_REFRESH],cn)}function cn(){_e.Controller.isBusy()||(_e.Scroll.cancel(),hn(kt.index),_e.Slides.update())}function un(wn,xn,Rn,Dn){wn!==xn&&yn(wn>Rn)&&(mn(),dn(fn(En(),wn>Rn),!0)),jt(MOVING),zt(EVENT_MOVE,xn,Rn,wn),tn.start(xn,function(){jt(IDLE),zt(EVENT_MOVED,xn,Rn,wn),Dn&&Dn()})}function hn(wn){dn(_n(wn,!0))}function dn(wn,xn){if(!kt.is(FADE)){var Rn=xn?wn:pn(wn);style(Qt,"transform","translate"+Jt("X")+"("+Rn+"px)"),wn!==Rn&&zt(EVENT_SHIFTED)}}function pn(wn){if(kt.is(LOOP)){var xn=vn(wn),Rn=xn>_e.Controller.getEnd(),Dn=xn<0;(Dn||Rn)&&(wn=fn(wn,Rn))}return wn}function fn(wn,xn){var Rn=wn-Cn(xn),Dn=Yt();return wn-=nn(Dn*(ceil(abs(Rn)/Dn)||1))*(xn?1:-1),wn}function mn(){dn(En(),!0),tn.cancel()}function vn(wn){for(var xn=_e.Slides.get(),Rn=0,Dn=1/0,kn=0;kn<xn.length;kn++){var Fn=xn[kn].index,Pn=abs(_n(Fn,!0)-wn);if(Pn<=Dn)Dn=Pn,Rn=Fn;else break}return Rn}function _n(wn,xn){var Rn=nn(Xt(wn-1)-Tn(wn));return xn?An(Rn):Rn}function En(){var wn=Jt("left");return rect(Qt)[wn]-rect(en)[wn]+nn(qt(!1))}function An(wn){return Dt.trimSpace&&kt.is(SLIDE)&&(wn=clamp$3(wn,0,nn(Yt(!0)-Kt()))),wn}function Tn(wn){var xn=Dt.focus;return xn==="center"?(Kt()-Wt(wn,!0))/2:+xn*Wt(wn)||0}function Cn(wn){return _n(wn?_e.Controller.getEnd():0,!!Dt.trimSpace)}function yn(wn){var xn=nn(fn(En(),wn));return wn?xn>=0:xn<=Qt[Jt("scrollWidth")]-rect(en)[Jt("width")]}function Sn(wn,xn){xn=isUndefined(xn)?En():xn;var Rn=wn!==!0&&nn(xn)<nn(Cn(!1)),Dn=wn!==!1&&nn(xn)>nn(Cn(!0));return Rn||Dn}return{mount:sn,move:un,jump:hn,translate:dn,shift:fn,cancel:mn,toIndex:vn,toPosition:_n,getPosition:En,getLimit:Cn,exceededLimit:Sn,reposition:cn}}function Controller$1(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=_e.Move,Ht=jt.getPosition,Wt=jt.getLimit,qt=jt.toPosition,Xt=_e.Slides,Kt=Xt.isEnough,Yt=Xt.getLength,Zt=Dt.omitEnd,Jt=kt.is(LOOP),nn=kt.is(SLIDE),rn=apply(En,!1),Qt=apply(En,!0),en=Dt.start||0,tn,sn=en,cn,un,hn;function dn(){pn(),Gt([EVENT_UPDATED,EVENT_REFRESH,EVENT_END_INDEX_CHANGED],pn),Gt(EVENT_RESIZED,fn)}function pn(){cn=Yt(!0),un=Dt.perMove,hn=Dt.perPage,tn=yn();var Pn=clamp$3(en,0,Zt?tn:cn-1);Pn!==en&&(en=Pn,jt.reposition())}function fn(){tn!==yn()&&zt(EVENT_END_INDEX_CHANGED)}function mn(Pn,Bn,qn){if(!Fn()){var tr=_n(Pn),lr=Cn(tr);lr>-1&&(Bn||lr!==en)&&(Rn(lr),jt.move(tr,lr,sn,qn))}}function vn(Pn,Bn,qn,tr){_e.Scroll.scroll(Pn,Bn,qn,function(){var lr=Cn(jt.toIndex(Ht()));Rn(Zt?min(lr,tn):lr),tr&&tr()})}function _n(Pn){var Bn=en;if(isString(Pn)){var qn=Pn.match(/([+\-<>])(\d+)?/)||[],tr=qn[1],lr=qn[2];tr==="+"||tr==="-"?Bn=An(en+ +(""+tr+(+lr||1)),en):tr===">"?Bn=lr?Sn(+lr):rn(!0):tr==="<"&&(Bn=Qt(!0))}else Bn=Jt?Pn:clamp$3(Pn,0,tn);return Bn}function En(Pn,Bn){var qn=un||(kn()?1:hn),tr=An(en+qn*(Pn?-1:1),en,!(un||kn()));return tr===-1&&nn&&!approximatelyEqual(Ht(),Wt(!Pn),1)?Pn?0:tn:Bn?tr:Cn(tr)}function An(Pn,Bn,qn){if(Kt()||kn()){var tr=Tn(Pn);tr!==Pn&&(Bn=Pn,Pn=tr,qn=!1),Pn<0||Pn>tn?!un&&(between(0,Pn,Bn,!0)||between(tn,Bn,Pn,!0))?Pn=Sn(wn(Pn)):Jt?Pn=qn?Pn<0?-(cn%hn||hn):cn:Pn:Dt.rewind?Pn=Pn<0?tn:0:Pn=-1:qn&&Pn!==Bn&&(Pn=Sn(wn(Bn)+(Pn<Bn?-1:1)))}else Pn=-1;return Pn}function Tn(Pn){if(nn&&Dt.trimSpace==="move"&&Pn!==en)for(var Bn=Ht();Bn===qt(Pn,!0)&&between(Pn,0,kt.length-1,!Dt.rewind);)Pn<en?--Pn:++Pn;return Pn}function Cn(Pn){return Jt?(Pn+cn)%cn||0:Pn}function yn(){for(var Pn=cn-(kn()||Jt&&un?1:hn);Zt&&Pn-- >0;)if(qt(cn-1,!0)!==qt(Pn,!0)){Pn++;break}return clamp$3(Pn,0,cn-1)}function Sn(Pn){return clamp$3(kn()?Pn:hn*Pn,0,tn)}function wn(Pn){return kn()?min(Pn,tn):floor((Pn>=tn?cn-1:Pn)/hn)}function xn(Pn){var Bn=jt.toIndex(Pn);return nn?clamp$3(Bn,0,tn):Bn}function Rn(Pn){Pn!==en&&(sn=en,en=Pn)}function Dn(Pn){return Pn?sn:en}function kn(){return!isUndefined(Dt.focus)||Dt.isNavigation}function Fn(){return kt.state.is([MOVING,SCROLLING])&&!!Dt.waitForTransition}return{mount:dn,go:mn,scroll:vn,getNext:rn,getPrev:Qt,getAdjacent:En,getEnd:yn,setIndex:Rn,getIndex:Dn,toIndex:Sn,toPage:wn,toDest:xn,hasFocus:kn,isBusy:Fn}}var XML_NAME_SPACE="http://www.w3.org/2000/svg",PATH="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",SIZE=40;function Arrows(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=Dt.classes,Wt=Dt.i18n,qt=_e.Elements,Xt=_e.Controller,Kt=qt.arrows,Yt=qt.track,Zt=Kt,Jt=qt.prev,nn=qt.next,rn,Qt,en={};function tn(){cn(),Gt(EVENT_UPDATED,sn)}function sn(){un(),tn()}function cn(){var vn=Dt.arrows;vn&&!(Jt&&nn)&&pn(),Jt&&nn&&(assign(en,{prev:Jt,next:nn}),display(Zt,vn?"":"none"),addClass(Zt,Qt=CLASS_ARROWS+"--"+Dt.direction),vn&&(hn(),mn(),setAttribute([Jt,nn],ARIA_CONTROLS,Yt.id),jt(EVENT_ARROWS_MOUNTED,Jt,nn)))}function un(){Vt.destroy(),removeClass(Zt,Qt),rn?(remove(Kt?[Jt,nn]:Zt),Jt=nn=null):removeAttribute([Jt,nn],ALL_ATTRIBUTES)}function hn(){Gt([EVENT_MOUNTED,EVENT_MOVED,EVENT_REFRESH,EVENT_SCROLLED,EVENT_END_INDEX_CHANGED],mn),zt(nn,"click",apply(dn,">")),zt(Jt,"click",apply(dn,"<"))}function dn(vn){Xt.go(vn,!0)}function pn(){Zt=Kt||create$3("div",Ht.arrows),Jt=fn(!0),nn=fn(!1),rn=!0,append(Zt,[Jt,nn]),!Kt&&before(Zt,Yt)}function fn(vn){var _n='<button class="'+Ht.arrow+" "+(vn?Ht.prev:Ht.next)+'" type="button"><svg xmlns="'+XML_NAME_SPACE+'" viewBox="0 0 '+SIZE+" "+SIZE+'" width="'+SIZE+'" height="'+SIZE+'" focusable="false"><path d="'+(Dt.arrowPath||PATH)+'" />';return parseHtml(_n)}function mn(){if(Jt&&nn){var vn=kt.index,_n=Xt.getPrev(),En=Xt.getNext(),An=_n>-1&&vn<_n?Wt.last:Wt.prev,Tn=En>-1&&vn>En?Wt.first:Wt.next;Jt.disabled=_n<0,nn.disabled=En<0,setAttribute(Jt,ARIA_LABEL,An),setAttribute(nn,ARIA_LABEL,Tn),jt(EVENT_ARROWS_UPDATED,Jt,nn,_n,En)}}return{arrows:en,mount:tn,destroy:un,update:mn}}var INTERVAL_DATA_ATTRIBUTE=DATA_ATTRIBUTE+"-interval";function Autoplay(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.emit,Ht=RequestInterval(Dt.interval,kt.go.bind(kt,">"),hn),Wt=Ht.isPaused,qt=_e.Elements,Xt=_e.Elements,Kt=Xt.root,Yt=Xt.toggle,Zt=Dt.autoplay,Jt,nn,rn=Zt==="pause";function Qt(){Zt&&(en(),Yt&&setAttribute(Yt,ARIA_CONTROLS,qt.track.id),rn||tn(),un())}function en(){Dt.pauseOnHover&&zt(Kt,"mouseenter mouseleave",function(pn){Jt=pn.type==="mouseenter",cn()}),Dt.pauseOnFocus&&zt(Kt,"focusin focusout",function(pn){nn=pn.type==="focusin",cn()}),Yt&&zt(Yt,"click",function(){rn?tn():sn(!0)}),Gt([EVENT_MOVE,EVENT_SCROLL,EVENT_REFRESH],Ht.rewind),Gt(EVENT_MOVE,dn)}function tn(){Wt()&&_e.Slides.isEnough()&&(Ht.start(!Dt.resetProgress),nn=Jt=rn=!1,un(),jt(EVENT_AUTOPLAY_PLAY))}function sn(pn){pn===void 0&&(pn=!0),rn=!!pn,un(),Wt()||(Ht.pause(),jt(EVENT_AUTOPLAY_PAUSE))}function cn(){rn||(Jt||nn?sn(!1):tn())}function un(){Yt&&(toggleClass(Yt,CLASS_ACTIVE,!rn),setAttribute(Yt,ARIA_LABEL,Dt.i18n[rn?"play":"pause"]))}function hn(pn){var fn=qt.bar;fn&&style(fn,"width",pn*100+"%"),jt(EVENT_AUTOPLAY_PLAYING,pn)}function dn(pn){var fn=_e.Slides.getAt(pn);Ht.set(fn&&+getAttribute$1(fn.slide,INTERVAL_DATA_ATTRIBUTE)||Dt.interval)}return{mount:Qt,destroy:Ht.cancel,play:tn,pause:sn,isPaused:Wt}}function Cover(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on;function zt(){Dt.cover&&(Gt(EVENT_LAZYLOAD_LOADED,apply(Ht,!0)),Gt([EVENT_MOUNTED,EVENT_UPDATED,EVENT_REFRESH],apply(jt,!0)))}function jt(Wt){_e.Slides.forEach(function(qt){var Xt=child(qt.container||qt.slide,"img");Xt&&Xt.src&&Ht(Wt,Xt,qt)})}function Ht(Wt,qt,Xt){Xt.style("background",Wt?'center/cover no-repeat url("'+qt.src+'")':"",!0),display(qt,Wt?"none":"")}return{mount:zt,destroy:apply(jt,!1)}}var BOUNCE_DIFF_THRESHOLD=10,BOUNCE_DURATION=600,FRICTION_FACTOR=.6,BASE_VELOCITY=1.5,MIN_DURATION=800;function Scroll(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=kt.state.set,Ht=_e.Move,Wt=Ht.getPosition,qt=Ht.getLimit,Xt=Ht.exceededLimit,Kt=Ht.translate,Yt=kt.is(SLIDE),Zt,Jt,nn=1;function rn(){Gt(EVENT_MOVE,sn),Gt([EVENT_UPDATED,EVENT_REFRESH],cn)}function Qt(hn,dn,pn,fn,mn){var vn=Wt();if(sn(),pn&&(!Yt||!Xt())){var _n=_e.Layout.sliderSize(),En=sign$1(hn)*_n*floor(abs(hn)/_n)||0;hn=Ht.toPosition(_e.Controller.toDest(hn%_n))+En}var An=approximatelyEqual(vn,hn,1);nn=1,dn=An?0:dn||max$1(abs(hn-vn)/BASE_VELOCITY,MIN_DURATION),Jt=fn,Zt=RequestInterval(dn,en,apply(tn,vn,hn,mn),1),jt(SCROLLING),zt(EVENT_SCROLL),Zt.start()}function en(){jt(IDLE),Jt&&Jt(),zt(EVENT_SCROLLED)}function tn(hn,dn,pn,fn){var mn=Wt(),vn=hn+(dn-hn)*un(fn),_n=(vn-mn)*nn;Kt(mn+_n),Yt&&!pn&&Xt()&&(nn*=FRICTION_FACTOR,abs(_n)<BOUNCE_DIFF_THRESHOLD&&Qt(qt(Xt(!0)),BOUNCE_DURATION,!1,Jt,!0))}function sn(){Zt&&Zt.cancel()}function cn(){Zt&&!Zt.isPaused()&&(sn(),en())}function un(hn){var dn=Dt.easingFunc;return dn?dn(hn):1-Math.pow(1-hn,4)}return{mount:rn,destroy:sn,scroll:Qt,cancel:cn}}var SCROLL_LISTENER_OPTIONS={passive:!1,capture:!0};function Drag(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=Vt.unbind,Wt=kt.state,qt=_e.Move,Xt=_e.Scroll,Kt=_e.Controller,Yt=_e.Elements.track,Zt=_e.Media.reduce,Jt=_e.Direction,nn=Jt.resolve,rn=Jt.orient,Qt=qt.getPosition,en=qt.exceededLimit,tn,sn,cn,un,hn,dn=!1,pn,fn,mn;function vn(){jt(Yt,POINTER_MOVE_EVENTS,noop$3,SCROLL_LISTENER_OPTIONS),jt(Yt,POINTER_UP_EVENTS,noop$3,SCROLL_LISTENER_OPTIONS),jt(Yt,POINTER_DOWN_EVENTS,En,SCROLL_LISTENER_OPTIONS),jt(Yt,"click",Cn,{capture:!0}),jt(Yt,"dragstart",prevent),Gt([EVENT_MOUNTED,EVENT_UPDATED],_n)}function _n(){var Hn=Dt.drag;ur(!Hn),un=Hn==="free"}function En(Hn){if(pn=!1,!fn){var sr=lr(Hn);tr(Hn.target)&&(sr||!Hn.button)&&(Kt.isBusy()?prevent(Hn,!0):(mn=sr?Yt:window,hn=Wt.is([MOVING,SCROLLING]),cn=null,jt(mn,POINTER_MOVE_EVENTS,An,SCROLL_LISTENER_OPTIONS),jt(mn,POINTER_UP_EVENTS,Tn,SCROLL_LISTENER_OPTIONS),qt.cancel(),Xt.cancel(),yn(Hn)))}}function An(Hn){if(Wt.is(DRAGGING)||(Wt.set(DRAGGING),zt(EVENT_DRAG)),Hn.cancelable)if(hn){qt.translate(tn+qn(kn(Hn)));var sr=Fn(Hn)>LOG_INTERVAL,vr=dn!==(dn=en());(sr||vr)&&yn(Hn),pn=!0,zt(EVENT_DRAGGING),prevent(Hn)}else xn(Hn)&&(hn=wn(Hn),prevent(Hn))}function Tn(Hn){Wt.is(DRAGGING)&&(Wt.set(IDLE),zt(EVENT_DRAGGED)),hn&&(Sn(Hn),prevent(Hn)),Ht(mn,POINTER_MOVE_EVENTS,An),Ht(mn,POINTER_UP_EVENTS,Tn),hn=!1}function Cn(Hn){!fn&&pn&&prevent(Hn,!0)}function yn(Hn){cn=sn,sn=Hn,tn=Qt()}function Sn(Hn){var sr=Rn(Hn),vr=Dn(sr),fr=Dt.rewind&&Dt.rewindByDrag;Zt(!1),un?Kt.scroll(vr,0,Dt.snap):kt.is(FADE)?Kt.go(rn(sign$1(sr))<0?fr?"<":"-":fr?">":"+"):kt.is(SLIDE)&&dn&&fr?Kt.go(en(!0)?">":"<"):Kt.go(Kt.toDest(vr),!0),Zt(!0)}function wn(Hn){var sr=Dt.dragMinThreshold,vr=isObject$8(sr),fr=vr&&sr.mouse||0,Un=(vr?sr.touch:+sr)||10;return abs(kn(Hn))>(lr(Hn)?Un:fr)}function xn(Hn){return abs(kn(Hn))>abs(kn(Hn,!0))}function Rn(Hn){if(kt.is(LOOP)||!dn){var sr=Fn(Hn);if(sr&&sr<LOG_INTERVAL)return kn(Hn)/sr}return 0}function Dn(Hn){return Qt()+sign$1(Hn)*min(abs(Hn)*(Dt.flickPower||600),un?1/0:_e.Layout.listSize()*(Dt.flickMaxPages||1))}function kn(Hn,sr){return Bn(Hn,sr)-Bn(Pn(Hn),sr)}function Fn(Hn){return timeOf(Hn)-timeOf(Pn(Hn))}function Pn(Hn){return sn===Hn&&cn||sn}function Bn(Hn,sr){return(lr(Hn)?Hn.changedTouches[0]:Hn)["page"+nn(sr?"Y":"X")]}function qn(Hn){return Hn/(dn&&kt.is(SLIDE)?FRICTION:1)}function tr(Hn){var sr=Dt.noDrag;return!matches(Hn,"."+CLASS_PAGINATION_PAGE+", ."+CLASS_ARROW)&&(!sr||!matches(Hn,sr))}function lr(Hn){return typeof TouchEvent<"u"&&Hn instanceof TouchEvent}function zn(){return hn}function ur(Hn){fn=Hn}return{mount:vn,disable:ur,isDragging:zn}}var NORMALIZATION_MAP={Spacebar:" ",Right:ARROW_RIGHT,Left:ARROW_LEFT,Up:ARROW_UP,Down:ARROW_DOWN};function normalizeKey(kt){return kt=isString(kt)?kt:kt.key,NORMALIZATION_MAP[kt]||kt}var KEYBOARD_EVENT="keydown";function Keyboard(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.bind,jt=Vt.unbind,Ht=kt.root,Wt=_e.Direction.resolve,qt,Xt;function Kt(){Yt(),Gt(EVENT_UPDATED,Zt),Gt(EVENT_UPDATED,Yt),Gt(EVENT_MOVE,nn)}function Yt(){var Qt=Dt.keyboard;Qt&&(qt=Qt==="global"?window:Ht,zt(qt,KEYBOARD_EVENT,rn))}function Zt(){jt(qt,KEYBOARD_EVENT)}function Jt(Qt){Xt=Qt}function nn(){var Qt=Xt;Xt=!0,nextTick(function(){Xt=Qt})}function rn(Qt){if(!Xt){var en=normalizeKey(Qt);en===Wt(ARROW_LEFT)?kt.go("<"):en===Wt(ARROW_RIGHT)&&kt.go(">")}}return{mount:Kt,destroy:Zt,disable:Jt}}var SRC_DATA_ATTRIBUTE=DATA_ATTRIBUTE+"-lazy",SRCSET_DATA_ATTRIBUTE=SRC_DATA_ATTRIBUTE+"-srcset",IMAGE_SELECTOR="["+SRC_DATA_ATTRIBUTE+"], ["+SRCSET_DATA_ATTRIBUTE+"]";function LazyLoad(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.off,jt=Vt.bind,Ht=Vt.emit,Wt=Dt.lazyLoad==="sequential",qt=[EVENT_MOVED,EVENT_SCROLLED],Xt=[];function Kt(){Dt.lazyLoad&&(Yt(),Gt(EVENT_REFRESH,Yt))}function Yt(){empty(Xt),Zt(),Wt?Qt():(zt(qt),Gt(qt,Jt),Jt())}function Zt(){_e.Slides.forEach(function(en){queryAll(en.slide,IMAGE_SELECTOR).forEach(function(tn){var sn=getAttribute$1(tn,SRC_DATA_ATTRIBUTE),cn=getAttribute$1(tn,SRCSET_DATA_ATTRIBUTE);if(sn!==tn.src||cn!==tn.srcset){var un=Dt.classes.spinner,hn=tn.parentElement,dn=child(hn,"."+un)||create$3("span",un,hn);Xt.push([tn,en,dn]),tn.src||display(tn,"none")}})})}function Jt(){Xt=Xt.filter(function(en){var tn=Dt.perPage*((Dt.preloadPages||1)+1)-1;return en[1].isWithin(kt.index,tn)?nn(en):!0}),Xt.length||zt(qt)}function nn(en){var tn=en[0];addClass(en[1].slide,CLASS_LOADING),jt(tn,"load error",apply(rn,en)),setAttribute(tn,"src",getAttribute$1(tn,SRC_DATA_ATTRIBUTE)),setAttribute(tn,"srcset",getAttribute$1(tn,SRCSET_DATA_ATTRIBUTE)),removeAttribute(tn,SRC_DATA_ATTRIBUTE),removeAttribute(tn,SRCSET_DATA_ATTRIBUTE)}function rn(en,tn){var sn=en[0],cn=en[1];removeClass(cn.slide,CLASS_LOADING),tn.type!=="error"&&(remove(en[2]),display(sn,""),Ht(EVENT_LAZYLOAD_LOADED,sn,cn),Ht(EVENT_RESIZE)),Wt&&Qt()}function Qt(){Xt.length&&nn(Xt.shift())}return{mount:Kt,destroy:apply(empty,Xt),check:Jt}}function Pagination(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=Vt.emit,jt=Vt.bind,Ht=_e.Slides,Wt=_e.Elements,qt=_e.Controller,Xt=qt.hasFocus,Kt=qt.getIndex,Yt=qt.go,Zt=_e.Direction.resolve,Jt=Wt.pagination,nn=[],rn,Qt;function en(){tn(),Gt([EVENT_UPDATED,EVENT_REFRESH,EVENT_END_INDEX_CHANGED],en);var fn=Dt.pagination;Jt&&display(Jt,fn?"":"none"),fn&&(Gt([EVENT_MOVE,EVENT_SCROLL,EVENT_SCROLLED],pn),sn(),pn(),zt(EVENT_PAGINATION_MOUNTED,{list:rn,items:nn},dn(kt.index)))}function tn(){rn&&(remove(Jt?slice$3(rn.children):rn),removeClass(rn,Qt),empty(nn),rn=null),Vt.destroy()}function sn(){var fn=kt.length,mn=Dt.classes,vn=Dt.i18n,_n=Dt.perPage,En=Xt()?qt.getEnd()+1:ceil(fn/_n);rn=Jt||create$3("ul",mn.pagination,Wt.track.parentElement),addClass(rn,Qt=CLASS_PAGINATION+"--"+hn()),setAttribute(rn,ROLE,"tablist"),setAttribute(rn,ARIA_LABEL,vn.select),setAttribute(rn,ARIA_ORIENTATION,hn()===TTB?"vertical":"");for(var An=0;An<En;An++){var Tn=create$3("li",null,rn),Cn=create$3("button",{class:mn.page,type:"button"},Tn),yn=Ht.getIn(An).map(function(wn){return wn.slide.id}),Sn=!Xt()&&_n>1?vn.pageX:vn.slideX;jt(Cn,"click",apply(cn,An)),Dt.paginationKeyboard&&jt(Cn,"keydown",apply(un,An)),setAttribute(Tn,ROLE,"presentation"),setAttribute(Cn,ROLE,"tab"),setAttribute(Cn,ARIA_CONTROLS,yn.join(" ")),setAttribute(Cn,ARIA_LABEL,format(Sn,An+1)),setAttribute(Cn,TAB_INDEX,-1),nn.push({li:Tn,button:Cn,page:An})}}function cn(fn){Yt(">"+fn,!0)}function un(fn,mn){var vn=nn.length,_n=normalizeKey(mn),En=hn(),An=-1;_n===Zt(ARROW_RIGHT,!1,En)?An=++fn%vn:_n===Zt(ARROW_LEFT,!1,En)?An=(--fn+vn)%vn:_n==="Home"?An=0:_n==="End"&&(An=vn-1);var Tn=nn[An];Tn&&(focus(Tn.button),Yt(">"+An),prevent(mn,!0))}function hn(){return Dt.paginationDirection||Dt.direction}function dn(fn){return nn[qt.toPage(fn)]}function pn(){var fn=dn(Kt(!0)),mn=dn(Kt());if(fn){var vn=fn.button;removeClass(vn,CLASS_ACTIVE),removeAttribute(vn,ARIA_SELECTED),setAttribute(vn,TAB_INDEX,-1)}if(mn){var _n=mn.button;addClass(_n,CLASS_ACTIVE),setAttribute(_n,ARIA_SELECTED,!0),setAttribute(_n,TAB_INDEX,"")}zt(EVENT_PAGINATION_UPDATED,{list:rn,items:nn},fn,mn)}return{items:nn,mount:en,destroy:tn,getAt:dn,update:pn}}var TRIGGER_KEYS=[" ","Enter"];function Sync(kt,_e,Dt){var Vt=Dt.isNavigation,Gt=Dt.slideFocus,zt=[];function jt(){kt.splides.forEach(function(Jt){Jt.isParent||(qt(kt,Jt.splide),qt(Jt.splide,kt))}),Vt&&Xt()}function Ht(){zt.forEach(function(Jt){Jt.destroy()}),empty(zt)}function Wt(){Ht(),jt()}function qt(Jt,nn){var rn=EventInterface(Jt);rn.on(EVENT_MOVE,function(Qt,en,tn){nn.go(nn.is(LOOP)?tn:Qt)}),zt.push(rn)}function Xt(){var Jt=EventInterface(kt),nn=Jt.on;nn(EVENT_CLICK,Yt),nn(EVENT_SLIDE_KEYDOWN,Zt),nn([EVENT_MOUNTED,EVENT_UPDATED],Kt),zt.push(Jt),Jt.emit(EVENT_NAVIGATION_MOUNTED,kt.splides)}function Kt(){setAttribute(_e.Elements.list,ARIA_ORIENTATION,Dt.direction===TTB?"vertical":"")}function Yt(Jt){kt.go(Jt.index)}function Zt(Jt,nn){includes(TRIGGER_KEYS,normalizeKey(nn))&&(Yt(Jt),prevent(nn))}return{setup:apply(_e.Media.set,{slideFocus:isUndefined(Gt)?Vt:Gt},!0),mount:jt,destroy:Ht,remount:Wt}}function Wheel(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.bind,zt=0;function jt(){Dt.wheel&&Gt(_e.Elements.track,"wheel",Ht,SCROLL_LISTENER_OPTIONS)}function Ht(qt){if(qt.cancelable){var Xt=qt.deltaY,Kt=Xt<0,Yt=timeOf(qt),Zt=Dt.wheelMinThreshold||0,Jt=Dt.wheelSleep||0;abs(Xt)>Zt&&Yt-zt>Jt&&(kt.go(Kt?"<":">"),zt=Yt),Wt(Kt)&&prevent(qt)}}function Wt(qt){return!Dt.releaseWheel||kt.state.is(MOVING)||_e.Controller.getAdjacent(qt)!==-1}return{mount:jt}}var SR_REMOVAL_DELAY=90;function Live(kt,_e,Dt){var Vt=EventInterface(kt),Gt=Vt.on,zt=_e.Elements.track,jt=Dt.live&&!Dt.isNavigation,Ht=create$3("span",CLASS_SR),Wt=RequestInterval(SR_REMOVAL_DELAY,apply(Xt,!1));function qt(){jt&&(Yt(!_e.Autoplay.isPaused()),setAttribute(zt,ARIA_ATOMIC,!0),Ht.textContent="…",Gt(EVENT_AUTOPLAY_PLAY,apply(Yt,!0)),Gt(EVENT_AUTOPLAY_PAUSE,apply(Yt,!1)),Gt([EVENT_MOVED,EVENT_SCROLLED],apply(Xt,!0)))}function Xt(Zt){setAttribute(zt,ARIA_BUSY,Zt),Zt?(append(zt,Ht),Wt.start()):(remove(Ht),Wt.cancel())}function Kt(){removeAttribute(zt,[ARIA_LIVE,ARIA_ATOMIC,ARIA_BUSY]),remove(Ht)}function Yt(Zt){jt&&setAttribute(zt,ARIA_LIVE,Zt?"off":"polite")}return{mount:qt,disable:Yt,destroy:Kt}}var ComponentConstructors=Object.freeze({__proto__:null,Media,Direction,Elements,Slides,Layout,Clones,Move,Controller:Controller$1,Arrows,Autoplay,Cover,Scroll,Drag,Keyboard,LazyLoad,Pagination,Sync,Wheel,Live}),I18N={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},DEFAULTS$1={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:CLASSES,i18n:I18N,reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function Fade(kt,_e,Dt){var Vt=_e.Slides;function Gt(){EventInterface(kt).on([EVENT_MOUNTED,EVENT_REFRESH],zt)}function zt(){Vt.forEach(function(Ht){Ht.style("transform","translateX(-"+100*Ht.index+"%)")})}function jt(Ht,Wt){Vt.style("transition","opacity "+Dt.speed+"ms "+Dt.easing),nextTick(Wt)}return{mount:Gt,start:jt,cancel:noop$3}}function Slide(kt,_e,Dt){var Vt=_e.Move,Gt=_e.Controller,zt=_e.Scroll,jt=_e.Elements.list,Ht=apply(style,jt,"transition"),Wt;function qt(){EventInterface(kt).bind(jt,"transitionend",function(Zt){Zt.target===jt&&Wt&&(Kt(),Wt())})}function Xt(Zt,Jt){var nn=Vt.toPosition(Zt,!0),rn=Vt.getPosition(),Qt=Yt(Zt);abs(nn-rn)>=1&&Qt>=1?Dt.useScroll?zt.scroll(nn,Qt,!1,Jt):(Ht("transform "+Qt+"ms "+Dt.easing),Vt.translate(nn,!0),Wt=Jt):(Vt.jump(Zt),Jt())}function Kt(){Ht(""),zt.cancel()}function Yt(Zt){var Jt=Dt.rewindSpeed;if(kt.is(SLIDE)&&Jt){var nn=Gt.getIndex(!0),rn=Gt.getEnd();if(nn===0&&Zt>=rn||nn>=rn&&Zt===0)return Jt}return Dt.speed}return{mount:qt,start:Xt,cancel:Kt}}var _Splide=function(){function kt(Dt,Vt){this.event=EventInterface(),this.Components={},this.state=State(CREATED),this.splides=[],this._o={},this._E={};var Gt=isString(Dt)?query$1(document,Dt):Dt;assert(Gt,Gt+" is invalid."),this.root=Gt,Vt=merge({label:getAttribute$1(Gt,ARIA_LABEL)||"",labelledby:getAttribute$1(Gt,ARIA_LABELLEDBY)||""},DEFAULTS$1,kt.defaults,Vt||{});try{merge(Vt,JSON.parse(getAttribute$1(Gt,DATA_ATTRIBUTE)))}catch{assert(!1,"Invalid JSON")}this._o=Object.create(merge({},Vt))}var _e=kt.prototype;return _e.mount=function(Vt,Gt){var zt=this,jt=this.state,Ht=this.Components;assert(jt.is([CREATED,DESTROYED]),"Already mounted!"),jt.set(CREATED),this._C=Ht,this._T=Gt||this._T||(this.is(FADE)?Fade:Slide),this._E=Vt||this._E;var Wt=assign({},ComponentConstructors,this._E,{Transition:this._T});return forOwn$2(Wt,function(qt,Xt){var Kt=qt(zt,Ht,zt._o);Ht[Xt]=Kt,Kt.setup&&Kt.setup()}),forOwn$2(Ht,function(qt){qt.mount&&qt.mount()}),this.emit(EVENT_MOUNTED),addClass(this.root,CLASS_INITIALIZED),jt.set(IDLE),this.emit(EVENT_READY),this},_e.sync=function(Vt){return this.splides.push({splide:Vt}),Vt.splides.push({splide:this,isParent:!0}),this.state.is(IDLE)&&(this._C.Sync.remount(),Vt.Components.Sync.remount()),this},_e.go=function(Vt){return this._C.Controller.go(Vt),this},_e.on=function(Vt,Gt){return this.event.on(Vt,Gt),this},_e.off=function(Vt){return this.event.off(Vt),this},_e.emit=function(Vt){var Gt;return(Gt=this.event).emit.apply(Gt,[Vt].concat(slice$3(arguments,1))),this},_e.add=function(Vt,Gt){return this._C.Slides.add(Vt,Gt),this},_e.remove=function(Vt){return this._C.Slides.remove(Vt),this},_e.is=function(Vt){return this._o.type===Vt},_e.refresh=function(){return this.emit(EVENT_REFRESH),this},_e.destroy=function(Vt){Vt===void 0&&(Vt=!0);var Gt=this.event,zt=this.state;return zt.is(CREATED)?EventInterface(this).on(EVENT_READY,this.destroy.bind(this,Vt)):(forOwn$2(this._C,function(jt){jt.destroy&&jt.destroy(Vt)},!0),Gt.emit(EVENT_DESTROY),Gt.destroy(),Vt&&empty(this.splides),zt.set(DESTROYED)),this},_createClass(kt,[{key:"options",get:function(){return this._o},set:function(Vt){this._C.Media.set(Vt,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),kt}(),Splide=_Splide;Splide.defaults={};Splide.STATES=STATES;var EVENTS=[[EVENT_MOUNTED,"onMounted"],[EVENT_READY,"onReady"],[EVENT_MOVE,"onMove"],[EVENT_MOVED,"onMoved"],[EVENT_CLICK,"onClick"],[EVENT_ACTIVE,"onActive"],[EVENT_INACTIVE,"onInactive"],[EVENT_VISIBLE,"onVisible"],[EVENT_HIDDEN,"onHidden"],[EVENT_REFRESH,"onRefresh"],[EVENT_UPDATED,"onUpdated"],[EVENT_RESIZE,"onResize"],[EVENT_RESIZED,"onResized"],[EVENT_DRAG,"onDrag"],[EVENT_DRAGGING,"onDragging"],[EVENT_DRAGGED,"onDragged"],[EVENT_SCROLL,"onScroll"],[EVENT_SCROLLED,"onScrolled"],[EVENT_DESTROY,"onDestroy"],[EVENT_ARROWS_MOUNTED,"onArrowsMounted"],[EVENT_ARROWS_UPDATED,"onArrowsUpdated"],[EVENT_PAGINATION_MOUNTED,"onPaginationMounted"],[EVENT_PAGINATION_UPDATED,"onPaginationUpdated"],[EVENT_NAVIGATION_MOUNTED,"onNavigationMounted"],[EVENT_AUTOPLAY_PLAY,"onAutoplayPlay"],[EVENT_AUTOPLAY_PLAYING,"onAutoplayPlaying"],[EVENT_AUTOPLAY_PAUSE,"onAutoplayPause"],[EVENT_LAZYLOAD_LOADED,"onLazyLoadLoaded"]];function classNames(...kt){return kt.filter(Boolean).join(" ")}function isObject2(kt){return kt!==null&&typeof kt=="object"}function isEqualDeep(kt,_e){if(Array.isArray(kt)&&Array.isArray(_e))return kt.length===_e.length&&!kt.some((Dt,Vt)=>!isEqualDeep(Dt,_e[Vt]));if(isObject2(kt)&&isObject2(_e)){const Dt=Object.keys(kt),Vt=Object.keys(_e);return Dt.length===Vt.length&&!Dt.some(Gt=>!Object.prototype.hasOwnProperty.call(_e,Gt)||!isEqualDeep(kt[Gt],_e[Gt]))}return kt===_e}function isEqualShallow(kt,_e){return kt.length===_e.length&&!kt.some((Dt,Vt)=>Dt!==_e[Vt])}function forOwn2(kt,_e){if(kt){const Dt=Object.keys(kt);for(let Vt=0;Vt<Dt.length;Vt++){const Gt=Dt[Vt];if(Gt!=="__proto__"&&_e(kt[Gt],Gt)===!1)break}}return kt}function merge2(kt,_e){const Dt=kt;return forOwn2(_e,(Vt,Gt)=>{Array.isArray(Vt)?Dt[Gt]=Vt.slice():isObject2(Vt)?Dt[Gt]=merge2(isObject2(Dt[Gt])?Dt[Gt]:{},Vt):Dt[Gt]=Vt}),Dt}var SplideTrack=({children:kt,className:_e,...Dt})=>React.createElement("div",{className:classNames("splide__track",_e),...Dt},React.createElement("ul",{className:"splide__list"},kt)),Splide2=class extends React.Component{constructor(){super(...arguments),this.splideRef=React.createRef(),this.slides=[]}componentDidMount(){const{options:kt,extensions:_e,transition:Dt}=this.props,{current:Vt}=this.splideRef;Vt&&(this.splide=new Splide(Vt,kt),this.bind(this.splide),this.splide.mount(_e,Dt),this.options=merge2({},kt||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:kt}=this.props;kt&&!isEqualDeep(this.options,kt)&&(this.splide.options=kt,this.options=merge2({},kt));const _e=this.getSlides();isEqualShallow(this.slides,_e)||(this.splide.refresh(),this.slides=_e)}sync(kt){var _e;(_e=this.splide)==null||_e.sync(kt)}go(kt){var _e;(_e=this.splide)==null||_e.go(kt)}getSlides(){var kt;if(this.splide){const _e=(kt=this.splide.Components.Elements)==null?void 0:kt.list.children;return _e&&Array.prototype.slice.call(_e)||[]}return[]}bind(kt){EVENTS.forEach(([_e,Dt])=>{const Vt=this.props[Dt];typeof Vt=="function"&&kt.on(_e,(...Gt)=>{Vt(kt,...Gt)})})}omit(kt,_e){return _e.forEach(Dt=>{Object.prototype.hasOwnProperty.call(kt,Dt)&&delete kt[Dt]}),kt}render(){const{className:kt,tag:_e="div",hasTrack:Dt=!0,children:Vt,...Gt}=this.props;return React.createElement(_e,{className:classNames("splide",kt),ref:this.splideRef,...this.omit(Gt,["options",...EVENTS.map(zt=>zt[1])])},Dt?React.createElement(SplideTrack,null,Vt):Vt)}},SplideSlide=({children:kt,className:_e,...Dt})=>React.createElement("li",{className:classNames("splide__slide",_e),...Dt},kt);/*!
73
73
  * Splide.js
74
74
  * Version : 4.1.3
75
75
  * License : MIT
@@ -3933,7 +3933,7 @@ void main() {
3933
3933
 
3934
3934
  }
3935
3935
 
3936
- }`;class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(_e,Dt,Vt){if(this.texture===null){const Gt=new Texture,zt=_e.properties.get(Gt);zt.__webglTexture=Dt.texture,(Dt.depthNear!=Vt.depthNear||Dt.depthFar!=Vt.depthFar)&&(this.depthNear=Dt.depthNear,this.depthFar=Dt.depthFar),this.texture=Gt}}render(_e,Dt){if(this.texture!==null){if(this.mesh===null){const Vt=Dt.cameras[0].viewport,Gt=new ShaderMaterial({vertexShader:_occlusion_vertex,fragmentShader:_occlusion_fragment,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Vt.z},depthHeight:{value:Vt.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),Gt)}_e.render(this.mesh,Dt)}}reset(){this.texture=null,this.mesh=null}}class WebXRManager extends EventDispatcher$2{constructor(_e,Dt){super();const Vt=this;let Gt=null,zt=1,jt=null,Ht="local-floor",Wt=1,qt=null,Xt=null,Kt=null,Yt=null,Zt=null,Jt=null;const nn=new WebXRDepthSensing,rn=Dt.getContextAttributes();let Qt=null,en=null;const tn=[],sn=[],cn=new Vector2;let un=null;const hn=new PerspectiveCamera;hn.layers.enable(1),hn.viewport=new Vector4;const dn=new PerspectiveCamera;dn.layers.enable(2),dn.viewport=new Vector4;const pn=[hn,dn],fn=new ArrayCamera;fn.layers.enable(1),fn.layers.enable(2);let mn=null,vn=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getTargetRaySpace()},this.getControllerGrip=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getGripSpace()},this.getHand=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getHandSpace()};function _n(kn){const Fn=sn.indexOf(kn.inputSource);if(Fn===-1)return;const Pn=tn[Fn];Pn!==void 0&&(Pn.update(kn.inputSource,kn.frame,qt||jt),Pn.dispatchEvent({type:kn.type,data:kn.inputSource}))}function En(){Gt.removeEventListener("select",_n),Gt.removeEventListener("selectstart",_n),Gt.removeEventListener("selectend",_n),Gt.removeEventListener("squeeze",_n),Gt.removeEventListener("squeezestart",_n),Gt.removeEventListener("squeezeend",_n),Gt.removeEventListener("end",En),Gt.removeEventListener("inputsourceschange",An);for(let kn=0;kn<tn.length;kn++){const Fn=sn[kn];Fn!==null&&(sn[kn]=null,tn[kn].disconnect(Fn))}mn=null,vn=null,nn.reset(),_e.setRenderTarget(Qt),Zt=null,Yt=null,Kt=null,Gt=null,en=null,Dn.stop(),Vt.isPresenting=!1,_e.setPixelRatio(un),_e.setSize(cn.width,cn.height,!1),Vt.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(kn){zt=kn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(kn){Ht=kn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return qt||jt},this.setReferenceSpace=function(kn){qt=kn},this.getBaseLayer=function(){return Yt!==null?Yt:Zt},this.getBinding=function(){return Kt},this.getFrame=function(){return Jt},this.getSession=function(){return Gt},this.setSession=async function(kn){if(Gt=kn,Gt!==null){if(Qt=_e.getRenderTarget(),Gt.addEventListener("select",_n),Gt.addEventListener("selectstart",_n),Gt.addEventListener("selectend",_n),Gt.addEventListener("squeeze",_n),Gt.addEventListener("squeezestart",_n),Gt.addEventListener("squeezeend",_n),Gt.addEventListener("end",En),Gt.addEventListener("inputsourceschange",An),rn.xrCompatible!==!0&&await Dt.makeXRCompatible(),un=_e.getPixelRatio(),_e.getSize(cn),Gt.renderState.layers===void 0){const Fn={antialias:rn.antialias,alpha:!0,depth:rn.depth,stencil:rn.stencil,framebufferScaleFactor:zt};Zt=new XRWebGLLayer(Gt,Dt,Fn),Gt.updateRenderState({baseLayer:Zt}),_e.setPixelRatio(1),_e.setSize(Zt.framebufferWidth,Zt.framebufferHeight,!1),en=new WebGLRenderTarget(Zt.framebufferWidth,Zt.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,colorSpace:_e.outputColorSpace,stencilBuffer:rn.stencil})}else{let Fn=null,Pn=null,Bn=null;rn.depth&&(Bn=rn.stencil?Dt.DEPTH24_STENCIL8:Dt.DEPTH_COMPONENT24,Fn=rn.stencil?DepthStencilFormat:DepthFormat,Pn=rn.stencil?UnsignedInt248Type:UnsignedIntType);const qn={colorFormat:Dt.RGBA8,depthFormat:Bn,scaleFactor:zt};Kt=new XRWebGLBinding(Gt,Dt),Yt=Kt.createProjectionLayer(qn),Gt.updateRenderState({layers:[Yt]}),_e.setPixelRatio(1),_e.setSize(Yt.textureWidth,Yt.textureHeight,!1),en=new WebGLRenderTarget(Yt.textureWidth,Yt.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(Yt.textureWidth,Yt.textureHeight,Pn,void 0,void 0,void 0,void 0,void 0,void 0,Fn),stencilBuffer:rn.stencil,colorSpace:_e.outputColorSpace,samples:rn.antialias?4:0});const tr=_e.properties.get(en);tr.__ignoreDepthValues=Yt.ignoreDepthValues}en.isXRRenderTarget=!0,this.setFoveation(Wt),qt=null,jt=await Gt.requestReferenceSpace(Ht),Dn.setContext(Gt),Dn.start(),Vt.isPresenting=!0,Vt.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Gt!==null)return Gt.environmentBlendMode};function An(kn){for(let Fn=0;Fn<kn.removed.length;Fn++){const Pn=kn.removed[Fn],Bn=sn.indexOf(Pn);Bn>=0&&(sn[Bn]=null,tn[Bn].disconnect(Pn))}for(let Fn=0;Fn<kn.added.length;Fn++){const Pn=kn.added[Fn];let Bn=sn.indexOf(Pn);if(Bn===-1){for(let tr=0;tr<tn.length;tr++)if(tr>=sn.length){sn.push(Pn),Bn=tr;break}else if(sn[tr]===null){sn[tr]=Pn,Bn=tr;break}if(Bn===-1)break}const qn=tn[Bn];qn&&qn.connect(Pn)}}const Tn=new Vector3,Cn=new Vector3;function yn(kn,Fn,Pn){Tn.setFromMatrixPosition(Fn.matrixWorld),Cn.setFromMatrixPosition(Pn.matrixWorld);const Bn=Tn.distanceTo(Cn),qn=Fn.projectionMatrix.elements,tr=Pn.projectionMatrix.elements,lr=qn[14]/(qn[10]-1),zn=qn[14]/(qn[10]+1),ur=(qn[9]+1)/qn[5],Hn=(qn[9]-1)/qn[5],sr=(qn[8]-1)/qn[0],vr=(tr[8]+1)/tr[0],fr=lr*sr,Un=lr*vr,In=Bn/(-sr+vr),jn=In*-sr;Fn.matrixWorld.decompose(kn.position,kn.quaternion,kn.scale),kn.translateX(jn),kn.translateZ(In),kn.matrixWorld.compose(kn.position,kn.quaternion,kn.scale),kn.matrixWorldInverse.copy(kn.matrixWorld).invert();const or=lr+In,cr=zn+In,ar=fr-jn,gr=Un+(Bn-jn),mr=ur*zn/cr*or,Ar=Hn*zn/cr*or;kn.projectionMatrix.makePerspective(ar,gr,mr,Ar,or,cr),kn.projectionMatrixInverse.copy(kn.projectionMatrix).invert()}function Sn(kn,Fn){Fn===null?kn.matrixWorld.copy(kn.matrix):kn.matrixWorld.multiplyMatrices(Fn.matrixWorld,kn.matrix),kn.matrixWorldInverse.copy(kn.matrixWorld).invert()}this.updateCamera=function(kn){if(Gt===null)return;nn.texture!==null&&(kn.near=nn.depthNear,kn.far=nn.depthFar),fn.near=dn.near=hn.near=kn.near,fn.far=dn.far=hn.far=kn.far,(mn!==fn.near||vn!==fn.far)&&(Gt.updateRenderState({depthNear:fn.near,depthFar:fn.far}),mn=fn.near,vn=fn.far,hn.near=mn,hn.far=vn,dn.near=mn,dn.far=vn,hn.updateProjectionMatrix(),dn.updateProjectionMatrix(),kn.updateProjectionMatrix());const Fn=kn.parent,Pn=fn.cameras;Sn(fn,Fn);for(let Bn=0;Bn<Pn.length;Bn++)Sn(Pn[Bn],Fn);Pn.length===2?yn(fn,hn,dn):fn.projectionMatrix.copy(hn.projectionMatrix),wn(kn,fn,Fn)};function wn(kn,Fn,Pn){Pn===null?kn.matrix.copy(Fn.matrixWorld):(kn.matrix.copy(Pn.matrixWorld),kn.matrix.invert(),kn.matrix.multiply(Fn.matrixWorld)),kn.matrix.decompose(kn.position,kn.quaternion,kn.scale),kn.updateMatrixWorld(!0),kn.projectionMatrix.copy(Fn.projectionMatrix),kn.projectionMatrixInverse.copy(Fn.projectionMatrixInverse),kn.isPerspectiveCamera&&(kn.fov=RAD2DEG*2*Math.atan(1/kn.projectionMatrix.elements[5]),kn.zoom=1)}this.getCamera=function(){return fn},this.getFoveation=function(){if(!(Yt===null&&Zt===null))return Wt},this.setFoveation=function(kn){Wt=kn,Yt!==null&&(Yt.fixedFoveation=kn),Zt!==null&&Zt.fixedFoveation!==void 0&&(Zt.fixedFoveation=kn)},this.hasDepthSensing=function(){return nn.texture!==null};let xn=null;function Rn(kn,Fn){if(Xt=Fn.getViewerPose(qt||jt),Jt=Fn,Xt!==null){const Pn=Xt.views;Zt!==null&&(_e.setRenderTargetFramebuffer(en,Zt.framebuffer),_e.setRenderTarget(en));let Bn=!1;Pn.length!==fn.cameras.length&&(fn.cameras.length=0,Bn=!0);for(let tr=0;tr<Pn.length;tr++){const lr=Pn[tr];let zn=null;if(Zt!==null)zn=Zt.getViewport(lr);else{const Hn=Kt.getViewSubImage(Yt,lr);zn=Hn.viewport,tr===0&&(_e.setRenderTargetTextures(en,Hn.colorTexture,Yt.ignoreDepthValues?void 0:Hn.depthStencilTexture),_e.setRenderTarget(en))}let ur=pn[tr];ur===void 0&&(ur=new PerspectiveCamera,ur.layers.enable(tr),ur.viewport=new Vector4,pn[tr]=ur),ur.matrix.fromArray(lr.transform.matrix),ur.matrix.decompose(ur.position,ur.quaternion,ur.scale),ur.projectionMatrix.fromArray(lr.projectionMatrix),ur.projectionMatrixInverse.copy(ur.projectionMatrix).invert(),ur.viewport.set(zn.x,zn.y,zn.width,zn.height),tr===0&&(fn.matrix.copy(ur.matrix),fn.matrix.decompose(fn.position,fn.quaternion,fn.scale)),Bn===!0&&fn.cameras.push(ur)}const qn=Gt.enabledFeatures;if(qn&&qn.includes("depth-sensing")){const tr=Kt.getDepthInformation(Pn[0]);tr&&tr.isValid&&tr.texture&&nn.init(_e,tr,Gt.renderState)}}for(let Pn=0;Pn<tn.length;Pn++){const Bn=sn[Pn],qn=tn[Pn];Bn!==null&&qn!==void 0&&qn.update(Bn,Fn,qt||jt)}nn.render(_e,fn),xn&&xn(kn,Fn),Fn.detectedPlanes&&Vt.dispatchEvent({type:"planesdetected",data:Fn}),Jt=null}const Dn=new WebGLAnimation;Dn.setAnimationLoop(Rn),this.setAnimationLoop=function(kn){xn=kn},this.dispose=function(){}}}const _e1=new Euler,_m1=new Matrix4;function WebGLMaterials(kt,_e){function Dt(rn,Qt){rn.matrixAutoUpdate===!0&&rn.updateMatrix(),Qt.value.copy(rn.matrix)}function Vt(rn,Qt){Qt.color.getRGB(rn.fogColor.value,getUnlitUniformColorSpace(kt)),Qt.isFog?(rn.fogNear.value=Qt.near,rn.fogFar.value=Qt.far):Qt.isFogExp2&&(rn.fogDensity.value=Qt.density)}function Gt(rn,Qt,en,tn,sn){Qt.isMeshBasicMaterial||Qt.isMeshLambertMaterial?zt(rn,Qt):Qt.isMeshToonMaterial?(zt(rn,Qt),Kt(rn,Qt)):Qt.isMeshPhongMaterial?(zt(rn,Qt),Xt(rn,Qt)):Qt.isMeshStandardMaterial?(zt(rn,Qt),Yt(rn,Qt),Qt.isMeshPhysicalMaterial&&Zt(rn,Qt,sn)):Qt.isMeshMatcapMaterial?(zt(rn,Qt),Jt(rn,Qt)):Qt.isMeshDepthMaterial?zt(rn,Qt):Qt.isMeshDistanceMaterial?(zt(rn,Qt),nn(rn,Qt)):Qt.isMeshNormalMaterial?zt(rn,Qt):Qt.isLineBasicMaterial?(jt(rn,Qt),Qt.isLineDashedMaterial&&Ht(rn,Qt)):Qt.isPointsMaterial?Wt(rn,Qt,en,tn):Qt.isSpriteMaterial?qt(rn,Qt):Qt.isShadowMaterial?(rn.color.value.copy(Qt.color),rn.opacity.value=Qt.opacity):Qt.isShaderMaterial&&(Qt.uniformsNeedUpdate=!1)}function zt(rn,Qt){rn.opacity.value=Qt.opacity,Qt.color&&rn.diffuse.value.copy(Qt.color),Qt.emissive&&rn.emissive.value.copy(Qt.emissive).multiplyScalar(Qt.emissiveIntensity),Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.bumpMap&&(rn.bumpMap.value=Qt.bumpMap,Dt(Qt.bumpMap,rn.bumpMapTransform),rn.bumpScale.value=Qt.bumpScale,Qt.side===BackSide&&(rn.bumpScale.value*=-1)),Qt.normalMap&&(rn.normalMap.value=Qt.normalMap,Dt(Qt.normalMap,rn.normalMapTransform),rn.normalScale.value.copy(Qt.normalScale),Qt.side===BackSide&&rn.normalScale.value.negate()),Qt.displacementMap&&(rn.displacementMap.value=Qt.displacementMap,Dt(Qt.displacementMap,rn.displacementMapTransform),rn.displacementScale.value=Qt.displacementScale,rn.displacementBias.value=Qt.displacementBias),Qt.emissiveMap&&(rn.emissiveMap.value=Qt.emissiveMap,Dt(Qt.emissiveMap,rn.emissiveMapTransform)),Qt.specularMap&&(rn.specularMap.value=Qt.specularMap,Dt(Qt.specularMap,rn.specularMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest);const en=_e.get(Qt),tn=en.envMap,sn=en.envMapRotation;if(tn&&(rn.envMap.value=tn,_e1.copy(sn),_e1.x*=-1,_e1.y*=-1,_e1.z*=-1,tn.isCubeTexture&&tn.isRenderTargetTexture===!1&&(_e1.y*=-1,_e1.z*=-1),rn.envMapRotation.value.setFromMatrix4(_m1.makeRotationFromEuler(_e1)),rn.flipEnvMap.value=tn.isCubeTexture&&tn.isRenderTargetTexture===!1?-1:1,rn.reflectivity.value=Qt.reflectivity,rn.ior.value=Qt.ior,rn.refractionRatio.value=Qt.refractionRatio),Qt.lightMap){rn.lightMap.value=Qt.lightMap;const cn=kt._useLegacyLights===!0?Math.PI:1;rn.lightMapIntensity.value=Qt.lightMapIntensity*cn,Dt(Qt.lightMap,rn.lightMapTransform)}Qt.aoMap&&(rn.aoMap.value=Qt.aoMap,rn.aoMapIntensity.value=Qt.aoMapIntensity,Dt(Qt.aoMap,rn.aoMapTransform))}function jt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform))}function Ht(rn,Qt){rn.dashSize.value=Qt.dashSize,rn.totalSize.value=Qt.dashSize+Qt.gapSize,rn.scale.value=Qt.scale}function Wt(rn,Qt,en,tn){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.size.value=Qt.size*en,rn.scale.value=tn*.5,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.uvTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function qt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.rotation.value=Qt.rotation,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function Xt(rn,Qt){rn.specular.value.copy(Qt.specular),rn.shininess.value=Math.max(Qt.shininess,1e-4)}function Kt(rn,Qt){Qt.gradientMap&&(rn.gradientMap.value=Qt.gradientMap)}function Yt(rn,Qt){rn.metalness.value=Qt.metalness,Qt.metalnessMap&&(rn.metalnessMap.value=Qt.metalnessMap,Dt(Qt.metalnessMap,rn.metalnessMapTransform)),rn.roughness.value=Qt.roughness,Qt.roughnessMap&&(rn.roughnessMap.value=Qt.roughnessMap,Dt(Qt.roughnessMap,rn.roughnessMapTransform)),Qt.envMap&&(rn.envMapIntensity.value=Qt.envMapIntensity)}function Zt(rn,Qt,en){rn.ior.value=Qt.ior,Qt.sheen>0&&(rn.sheenColor.value.copy(Qt.sheenColor).multiplyScalar(Qt.sheen),rn.sheenRoughness.value=Qt.sheenRoughness,Qt.sheenColorMap&&(rn.sheenColorMap.value=Qt.sheenColorMap,Dt(Qt.sheenColorMap,rn.sheenColorMapTransform)),Qt.sheenRoughnessMap&&(rn.sheenRoughnessMap.value=Qt.sheenRoughnessMap,Dt(Qt.sheenRoughnessMap,rn.sheenRoughnessMapTransform))),Qt.clearcoat>0&&(rn.clearcoat.value=Qt.clearcoat,rn.clearcoatRoughness.value=Qt.clearcoatRoughness,Qt.clearcoatMap&&(rn.clearcoatMap.value=Qt.clearcoatMap,Dt(Qt.clearcoatMap,rn.clearcoatMapTransform)),Qt.clearcoatRoughnessMap&&(rn.clearcoatRoughnessMap.value=Qt.clearcoatRoughnessMap,Dt(Qt.clearcoatRoughnessMap,rn.clearcoatRoughnessMapTransform)),Qt.clearcoatNormalMap&&(rn.clearcoatNormalMap.value=Qt.clearcoatNormalMap,Dt(Qt.clearcoatNormalMap,rn.clearcoatNormalMapTransform),rn.clearcoatNormalScale.value.copy(Qt.clearcoatNormalScale),Qt.side===BackSide&&rn.clearcoatNormalScale.value.negate())),Qt.iridescence>0&&(rn.iridescence.value=Qt.iridescence,rn.iridescenceIOR.value=Qt.iridescenceIOR,rn.iridescenceThicknessMinimum.value=Qt.iridescenceThicknessRange[0],rn.iridescenceThicknessMaximum.value=Qt.iridescenceThicknessRange[1],Qt.iridescenceMap&&(rn.iridescenceMap.value=Qt.iridescenceMap,Dt(Qt.iridescenceMap,rn.iridescenceMapTransform)),Qt.iridescenceThicknessMap&&(rn.iridescenceThicknessMap.value=Qt.iridescenceThicknessMap,Dt(Qt.iridescenceThicknessMap,rn.iridescenceThicknessMapTransform))),Qt.transmission>0&&(rn.transmission.value=Qt.transmission,rn.transmissionSamplerMap.value=en.texture,rn.transmissionSamplerSize.value.set(en.width,en.height),Qt.transmissionMap&&(rn.transmissionMap.value=Qt.transmissionMap,Dt(Qt.transmissionMap,rn.transmissionMapTransform)),rn.thickness.value=Qt.thickness,Qt.thicknessMap&&(rn.thicknessMap.value=Qt.thicknessMap,Dt(Qt.thicknessMap,rn.thicknessMapTransform)),rn.attenuationDistance.value=Qt.attenuationDistance,rn.attenuationColor.value.copy(Qt.attenuationColor)),Qt.anisotropy>0&&(rn.anisotropyVector.value.set(Qt.anisotropy*Math.cos(Qt.anisotropyRotation),Qt.anisotropy*Math.sin(Qt.anisotropyRotation)),Qt.anisotropyMap&&(rn.anisotropyMap.value=Qt.anisotropyMap,Dt(Qt.anisotropyMap,rn.anisotropyMapTransform))),rn.specularIntensity.value=Qt.specularIntensity,rn.specularColor.value.copy(Qt.specularColor),Qt.specularColorMap&&(rn.specularColorMap.value=Qt.specularColorMap,Dt(Qt.specularColorMap,rn.specularColorMapTransform)),Qt.specularIntensityMap&&(rn.specularIntensityMap.value=Qt.specularIntensityMap,Dt(Qt.specularIntensityMap,rn.specularIntensityMapTransform))}function Jt(rn,Qt){Qt.matcap&&(rn.matcap.value=Qt.matcap)}function nn(rn,Qt){const en=_e.get(Qt).light;rn.referencePosition.value.setFromMatrixPosition(en.matrixWorld),rn.nearDistance.value=en.shadow.camera.near,rn.farDistance.value=en.shadow.camera.far}return{refreshFogUniforms:Vt,refreshMaterialUniforms:Gt}}function WebGLUniformsGroups(kt,_e,Dt,Vt){let Gt={},zt={},jt=[];const Ht=kt.getParameter(kt.MAX_UNIFORM_BUFFER_BINDINGS);function Wt(en,tn){const sn=tn.program;Vt.uniformBlockBinding(en,sn)}function qt(en,tn){let sn=Gt[en.id];sn===void 0&&(Jt(en),sn=Xt(en),Gt[en.id]=sn,en.addEventListener("dispose",rn));const cn=tn.program;Vt.updateUBOMapping(en,cn);const un=_e.render.frame;zt[en.id]!==un&&(Yt(en),zt[en.id]=un)}function Xt(en){const tn=Kt();en.__bindingPointIndex=tn;const sn=kt.createBuffer(),cn=en.__size,un=en.usage;return kt.bindBuffer(kt.UNIFORM_BUFFER,sn),kt.bufferData(kt.UNIFORM_BUFFER,cn,un),kt.bindBuffer(kt.UNIFORM_BUFFER,null),kt.bindBufferBase(kt.UNIFORM_BUFFER,tn,sn),sn}function Kt(){for(let en=0;en<Ht;en++)if(jt.indexOf(en)===-1)return jt.push(en),en;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function Yt(en){const tn=Gt[en.id],sn=en.uniforms,cn=en.__cache;kt.bindBuffer(kt.UNIFORM_BUFFER,tn);for(let un=0,hn=sn.length;un<hn;un++){const dn=Array.isArray(sn[un])?sn[un]:[sn[un]];for(let pn=0,fn=dn.length;pn<fn;pn++){const mn=dn[pn];if(Zt(mn,un,pn,cn)===!0){const vn=mn.__offset,_n=Array.isArray(mn.value)?mn.value:[mn.value];let En=0;for(let An=0;An<_n.length;An++){const Tn=_n[An],Cn=nn(Tn);typeof Tn=="number"||typeof Tn=="boolean"?(mn.__data[0]=Tn,kt.bufferSubData(kt.UNIFORM_BUFFER,vn+En,mn.__data)):Tn.isMatrix3?(mn.__data[0]=Tn.elements[0],mn.__data[1]=Tn.elements[1],mn.__data[2]=Tn.elements[2],mn.__data[3]=0,mn.__data[4]=Tn.elements[3],mn.__data[5]=Tn.elements[4],mn.__data[6]=Tn.elements[5],mn.__data[7]=0,mn.__data[8]=Tn.elements[6],mn.__data[9]=Tn.elements[7],mn.__data[10]=Tn.elements[8],mn.__data[11]=0):(Tn.toArray(mn.__data,En),En+=Cn.storage/Float32Array.BYTES_PER_ELEMENT)}kt.bufferSubData(kt.UNIFORM_BUFFER,vn,mn.__data)}}}kt.bindBuffer(kt.UNIFORM_BUFFER,null)}function Zt(en,tn,sn,cn){const un=en.value,hn=tn+"_"+sn;if(cn[hn]===void 0)return typeof un=="number"||typeof un=="boolean"?cn[hn]=un:cn[hn]=un.clone(),!0;{const dn=cn[hn];if(typeof un=="number"||typeof un=="boolean"){if(dn!==un)return cn[hn]=un,!0}else if(dn.equals(un)===!1)return dn.copy(un),!0}return!1}function Jt(en){const tn=en.uniforms;let sn=0;const cn=16;for(let hn=0,dn=tn.length;hn<dn;hn++){const pn=Array.isArray(tn[hn])?tn[hn]:[tn[hn]];for(let fn=0,mn=pn.length;fn<mn;fn++){const vn=pn[fn],_n=Array.isArray(vn.value)?vn.value:[vn.value];for(let En=0,An=_n.length;En<An;En++){const Tn=_n[En],Cn=nn(Tn),yn=sn%cn;yn!==0&&cn-yn<Cn.boundary&&(sn+=cn-yn),vn.__data=new Float32Array(Cn.storage/Float32Array.BYTES_PER_ELEMENT),vn.__offset=sn,sn+=Cn.storage}}}const un=sn%cn;return un>0&&(sn+=cn-un),en.__size=sn,en.__cache={},this}function nn(en){const tn={boundary:0,storage:0};return typeof en=="number"||typeof en=="boolean"?(tn.boundary=4,tn.storage=4):en.isVector2?(tn.boundary=8,tn.storage=8):en.isVector3||en.isColor?(tn.boundary=16,tn.storage=12):en.isVector4?(tn.boundary=16,tn.storage=16):en.isMatrix3?(tn.boundary=48,tn.storage=48):en.isMatrix4?(tn.boundary=64,tn.storage=64):en.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",en),tn}function rn(en){const tn=en.target;tn.removeEventListener("dispose",rn);const sn=jt.indexOf(tn.__bindingPointIndex);jt.splice(sn,1),kt.deleteBuffer(Gt[tn.id]),delete Gt[tn.id],delete zt[tn.id]}function Qt(){for(const en in Gt)kt.deleteBuffer(Gt[en]);jt=[],Gt={},zt={}}return{bind:Wt,update:qt,dispose:Qt}}class WebGLRenderer{constructor(_e={}){const{canvas:Dt=createCanvasElement(),context:Vt=null,depth:Gt=!0,stencil:zt=!1,alpha:jt=!1,antialias:Ht=!1,premultipliedAlpha:Wt=!0,preserveDrawingBuffer:qt=!1,powerPreference:Xt="default",failIfMajorPerformanceCaveat:Kt=!1}=_e;this.isWebGLRenderer=!0;let Yt;if(Vt!==null){if(typeof WebGLRenderingContext<"u"&&Vt instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");Yt=Vt.getContextAttributes().alpha}else Yt=jt;const Zt=new Uint32Array(4),Jt=new Int32Array(4);let nn=null,rn=null;const Qt=[],en=[];this.domElement=Dt,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=SRGBColorSpace$1,this._useLegacyLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const tn=this;let sn=!1,cn=0,un=0,hn=null,dn=-1,pn=null;const fn=new Vector4,mn=new Vector4;let vn=null;const _n=new Color$1(0);let En=0,An=Dt.width,Tn=Dt.height,Cn=1,yn=null,Sn=null;const wn=new Vector4(0,0,An,Tn),xn=new Vector4(0,0,An,Tn);let Rn=!1;const Dn=new Frustum;let kn=!1,Fn=!1;const Pn=new Matrix4,Bn=new Vector2,qn=new Vector3,tr={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function lr(){return hn===null?Cn:1}let zn=Vt;function ur(On,Gn){const Wn=Dt.getContext(On,Gn);return Wn!==null?Wn:null}try{const On={alpha:!0,depth:Gt,stencil:zt,antialias:Ht,premultipliedAlpha:Wt,preserveDrawingBuffer:qt,powerPreference:Xt,failIfMajorPerformanceCaveat:Kt};if("setAttribute"in Dt&&Dt.setAttribute("data-engine",`three.js r${REVISION}`),Dt.addEventListener("webglcontextlost",Dr,!1),Dt.addEventListener("webglcontextrestored",_r,!1),Dt.addEventListener("webglcontextcreationerror",Gr,!1),zn===null){const Gn="webgl2";if(zn=ur(Gn,On),zn===null)throw ur(Gn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(On){throw console.error("THREE.WebGLRenderer: "+On.message),On}let Hn,sr,vr,fr,Un,In,jn,or,cr,ar,gr,mr,Ar,Lr,Cr,Rr,zr,Pr,Fr,os,rs,Qr,cs,fs;function Br(){Hn=new WebGLExtensions(zn),Hn.init(),sr=new WebGLCapabilities(zn,Hn,_e),Qr=new WebGLUtils(zn,Hn),vr=new WebGLState(zn),fr=new WebGLInfo(zn),Un=new WebGLProperties,In=new WebGLTextures(zn,Hn,vr,Un,sr,Qr,fr),jn=new WebGLCubeMaps(tn),or=new WebGLCubeUVMaps(tn),cr=new WebGLAttributes(zn),cs=new WebGLBindingStates(zn,cr),ar=new WebGLGeometries(zn,cr,fr,cs),gr=new WebGLObjects(zn,ar,cr,fr),Fr=new WebGLMorphtargets(zn,sr,In),Rr=new WebGLClipping(Un),mr=new WebGLPrograms(tn,jn,or,Hn,sr,cs,Rr),Ar=new WebGLMaterials(tn,Un),Lr=new WebGLRenderLists,Cr=new WebGLRenderStates(Hn),Pr=new WebGLBackground(tn,jn,or,vr,gr,Yt,Wt),zr=new WebGLShadowMap(tn,gr,sr),fs=new WebGLUniformsGroups(zn,fr,sr,vr),os=new WebGLBufferRenderer(zn,Hn,fr),rs=new WebGLIndexedBufferRenderer(zn,Hn,fr),fr.programs=mr.programs,tn.capabilities=sr,tn.extensions=Hn,tn.properties=Un,tn.renderLists=Lr,tn.shadowMap=zr,tn.state=vr,tn.info=fr}Br();const rr=new WebXRManager(tn,zn);this.xr=rr,this.getContext=function(){return zn},this.getContextAttributes=function(){return zn.getContextAttributes()},this.forceContextLoss=function(){const On=Hn.get("WEBGL_lose_context");On&&On.loseContext()},this.forceContextRestore=function(){const On=Hn.get("WEBGL_lose_context");On&&On.restoreContext()},this.getPixelRatio=function(){return Cn},this.setPixelRatio=function(On){On!==void 0&&(Cn=On,this.setSize(An,Tn,!1))},this.getSize=function(On){return On.set(An,Tn)},this.setSize=function(On,Gn,Wn=!0){if(rr.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}An=On,Tn=Gn,Dt.width=Math.floor(On*Cn),Dt.height=Math.floor(Gn*Cn),Wn===!0&&(Dt.style.width=On+"px",Dt.style.height=Gn+"px"),this.setViewport(0,0,On,Gn)},this.getDrawingBufferSize=function(On){return On.set(An*Cn,Tn*Cn).floor()},this.setDrawingBufferSize=function(On,Gn,Wn){An=On,Tn=Gn,Cn=Wn,Dt.width=Math.floor(On*Wn),Dt.height=Math.floor(Gn*Wn),this.setViewport(0,0,On,Gn)},this.getCurrentViewport=function(On){return On.copy(fn)},this.getViewport=function(On){return On.copy(wn)},this.setViewport=function(On,Gn,Wn,er){On.isVector4?wn.set(On.x,On.y,On.z,On.w):wn.set(On,Gn,Wn,er),vr.viewport(fn.copy(wn).multiplyScalar(Cn).round())},this.getScissor=function(On){return On.copy(xn)},this.setScissor=function(On,Gn,Wn,er){On.isVector4?xn.set(On.x,On.y,On.z,On.w):xn.set(On,Gn,Wn,er),vr.scissor(mn.copy(xn).multiplyScalar(Cn).round())},this.getScissorTest=function(){return Rn},this.setScissorTest=function(On){vr.setScissorTest(Rn=On)},this.setOpaqueSort=function(On){yn=On},this.setTransparentSort=function(On){Sn=On},this.getClearColor=function(On){return On.copy(Pr.getClearColor())},this.setClearColor=function(){Pr.setClearColor.apply(Pr,arguments)},this.getClearAlpha=function(){return Pr.getClearAlpha()},this.setClearAlpha=function(){Pr.setClearAlpha.apply(Pr,arguments)},this.clear=function(On=!0,Gn=!0,Wn=!0){let er=0;if(On){let ir=!1;if(hn!==null){const pr=hn.texture.format;ir=pr===RGBAIntegerFormat||pr===RGIntegerFormat||pr===RedIntegerFormat}if(ir){const pr=hn.texture.type,Sr=pr===UnsignedByteType||pr===UnsignedIntType||pr===UnsignedShortType||pr===UnsignedInt248Type||pr===UnsignedShort4444Type||pr===UnsignedShort5551Type,Er=Pr.getClearColor(),wr=Pr.getClearAlpha(),Tr=Er.r,Ur=Er.g,Mr=Er.b;Sr?(Zt[0]=Tr,Zt[1]=Ur,Zt[2]=Mr,Zt[3]=wr,zn.clearBufferuiv(zn.COLOR,0,Zt)):(Jt[0]=Tr,Jt[1]=Ur,Jt[2]=Mr,Jt[3]=wr,zn.clearBufferiv(zn.COLOR,0,Jt))}else er|=zn.COLOR_BUFFER_BIT}Gn&&(er|=zn.DEPTH_BUFFER_BIT),Wn&&(er|=zn.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),zn.clear(er)},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(){Dt.removeEventListener("webglcontextlost",Dr,!1),Dt.removeEventListener("webglcontextrestored",_r,!1),Dt.removeEventListener("webglcontextcreationerror",Gr,!1),Lr.dispose(),Cr.dispose(),Un.dispose(),jn.dispose(),or.dispose(),gr.dispose(),cs.dispose(),fs.dispose(),mr.dispose(),rr.dispose(),rr.removeEventListener("sessionstart",Vs),rr.removeEventListener("sessionend",Gs),to.stop()};function Dr(On){On.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),sn=!0}function _r(){console.log("THREE.WebGLRenderer: Context Restored."),sn=!1;const On=fr.autoReset,Gn=zr.enabled,Wn=zr.autoUpdate,er=zr.needsUpdate,ir=zr.type;Br(),fr.autoReset=On,zr.enabled=Gn,zr.autoUpdate=Wn,zr.needsUpdate=er,zr.type=ir}function Gr(On){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",On.statusMessage)}function Yr(On){const Gn=On.target;Gn.removeEventListener("dispose",Yr),Es(Gn)}function Es(On){gs(On),Un.remove(On)}function gs(On){const Gn=Un.get(On).programs;Gn!==void 0&&(Gn.forEach(function(Wn){mr.releaseProgram(Wn)}),On.isShaderMaterial&&mr.releaseShaderCache(On))}this.renderBufferDirect=function(On,Gn,Wn,er,ir,pr){Gn===null&&(Gn=tr);const Sr=ir.isMesh&&ir.matrixWorld.determinant()<0,Er=qo(On,Gn,Wn,er,ir);vr.setMaterial(er,Sr);let wr=Wn.index,Tr=1;if(er.wireframe===!0){if(wr=ar.getWireframeAttribute(Wn),wr===void 0)return;Tr=2}const Ur=Wn.drawRange,Mr=Wn.attributes.position;let Nr=Ur.start*Tr,qr=(Ur.start+Ur.count)*Tr;pr!==null&&(Nr=Math.max(Nr,pr.start*Tr),qr=Math.min(qr,(pr.start+pr.count)*Tr)),wr!==null?(Nr=Math.max(Nr,0),qr=Math.min(qr,wr.count)):Mr!=null&&(Nr=Math.max(Nr,0),qr=Math.min(qr,Mr.count));const jr=qr-Nr;if(jr<0||jr===1/0)return;cs.setup(ir,er,Er,Wn,wr);let _i,Wr=os;if(wr!==null&&(_i=cr.get(wr),Wr=rs,Wr.setIndex(_i)),ir.isMesh)er.wireframe===!0?(vr.setLineWidth(er.wireframeLinewidth*lr()),Wr.setMode(zn.LINES)):Wr.setMode(zn.TRIANGLES);else if(ir.isLine){let Or=er.linewidth;Or===void 0&&(Or=1),vr.setLineWidth(Or*lr()),ir.isLineSegments?Wr.setMode(zn.LINES):ir.isLineLoop?Wr.setMode(zn.LINE_LOOP):Wr.setMode(zn.LINE_STRIP)}else ir.isPoints?Wr.setMode(zn.POINTS):ir.isSprite&&Wr.setMode(zn.TRIANGLES);if(ir.isBatchedMesh)Wr.renderMultiDraw(ir._multiDrawStarts,ir._multiDrawCounts,ir._multiDrawCount);else if(ir.isInstancedMesh)Wr.renderInstances(Nr,jr,ir.count);else if(Wn.isInstancedBufferGeometry){const Or=Wn._maxInstanceCount!==void 0?Wn._maxInstanceCount:1/0,Jr=Math.min(Wn.instanceCount,Or);Wr.renderInstances(Nr,jr,Jr)}else Wr.render(Nr,jr)};function Ts(On,Gn,Wn){On.transparent===!0&&On.side===DoubleSide&&On.forceSinglePass===!1?(On.side=BackSide,On.needsUpdate=!0,ks(On,Gn,Wn),On.side=FrontSide,On.needsUpdate=!0,ks(On,Gn,Wn),On.side=DoubleSide):ks(On,Gn,Wn)}this.compile=function(On,Gn,Wn=null){Wn===null&&(Wn=On),rn=Cr.get(Wn),rn.init(),en.push(rn),Wn.traverseVisible(function(ir){ir.isLight&&ir.layers.test(Gn.layers)&&(rn.pushLight(ir),ir.castShadow&&rn.pushShadow(ir))}),On!==Wn&&On.traverseVisible(function(ir){ir.isLight&&ir.layers.test(Gn.layers)&&(rn.pushLight(ir),ir.castShadow&&rn.pushShadow(ir))}),rn.setupLights(tn._useLegacyLights);const er=new Set;return On.traverse(function(ir){const pr=ir.material;if(pr)if(Array.isArray(pr))for(let Sr=0;Sr<pr.length;Sr++){const Er=pr[Sr];Ts(Er,Wn,ir),er.add(Er)}else Ts(pr,Wn,ir),er.add(pr)}),en.pop(),rn=null,er},this.compileAsync=function(On,Gn,Wn=null){const er=this.compile(On,Gn,Wn);return new Promise(ir=>{function pr(){if(er.forEach(function(Sr){Un.get(Sr).currentProgram.isReady()&&er.delete(Sr)}),er.size===0){ir(On);return}setTimeout(pr,10)}Hn.get("KHR_parallel_shader_compile")!==null?pr():setTimeout(pr,10)})};let Ps=null;function bs(On){Ps&&Ps(On)}function Vs(){to.stop()}function Gs(){to.start()}const to=new WebGLAnimation;to.setAnimationLoop(bs),typeof self<"u"&&to.setContext(self),this.setAnimationLoop=function(On){Ps=On,rr.setAnimationLoop(On),On===null?to.stop():to.start()},rr.addEventListener("sessionstart",Vs),rr.addEventListener("sessionend",Gs),this.render=function(On,Gn){if(Gn!==void 0&&Gn.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(sn===!0)return;On.matrixWorldAutoUpdate===!0&&On.updateMatrixWorld(),Gn.parent===null&&Gn.matrixWorldAutoUpdate===!0&&Gn.updateMatrixWorld(),rr.enabled===!0&&rr.isPresenting===!0&&(rr.cameraAutoUpdate===!0&&rr.updateCamera(Gn),Gn=rr.getCamera()),On.isScene===!0&&On.onBeforeRender(tn,On,Gn,hn),rn=Cr.get(On,en.length),rn.init(),en.push(rn),Pn.multiplyMatrices(Gn.projectionMatrix,Gn.matrixWorldInverse),Dn.setFromProjectionMatrix(Pn),Fn=this.localClippingEnabled,kn=Rr.init(this.clippingPlanes,Fn),nn=Lr.get(On,Qt.length),nn.init(),Qt.push(nn),Fo(On,Gn,0,tn.sortObjects),nn.finish(),tn.sortObjects===!0&&nn.sort(yn,Sn),this.info.render.frame++,kn===!0&&Rr.beginShadows();const Wn=rn.state.shadowsArray;if(zr.render(Wn,On,Gn),kn===!0&&Rr.endShadows(),this.info.autoReset===!0&&this.info.reset(),(rr.enabled===!1||rr.isPresenting===!1||rr.hasDepthSensing()===!1)&&Pr.render(nn,On),rn.setupLights(tn._useLegacyLights),Gn.isArrayCamera){const er=Gn.cameras;for(let ir=0,pr=er.length;ir<pr;ir++){const Sr=er[ir];Bo(nn,On,Sr,Sr.viewport)}}else Bo(nn,On,Gn);hn!==null&&(In.updateMultisampleRenderTarget(hn),In.updateRenderTargetMipmap(hn)),On.isScene===!0&&On.onAfterRender(tn,On,Gn),cs.resetDefaultState(),dn=-1,pn=null,en.pop(),en.length>0?rn=en[en.length-1]:rn=null,Qt.pop(),Qt.length>0?nn=Qt[Qt.length-1]:nn=null};function Fo(On,Gn,Wn,er){if(On.visible===!1)return;if(On.layers.test(Gn.layers)){if(On.isGroup)Wn=On.renderOrder;else if(On.isLOD)On.autoUpdate===!0&&On.update(Gn);else if(On.isLight)rn.pushLight(On),On.castShadow&&rn.pushShadow(On);else if(On.isSprite){if(!On.frustumCulled||Dn.intersectsSprite(On)){er&&qn.setFromMatrixPosition(On.matrixWorld).applyMatrix4(Pn);const Sr=gr.update(On),Er=On.material;Er.visible&&nn.push(On,Sr,Er,Wn,qn.z,null)}}else if((On.isMesh||On.isLine||On.isPoints)&&(!On.frustumCulled||Dn.intersectsObject(On))){const Sr=gr.update(On),Er=On.material;if(er&&(On.boundingSphere!==void 0?(On.boundingSphere===null&&On.computeBoundingSphere(),qn.copy(On.boundingSphere.center)):(Sr.boundingSphere===null&&Sr.computeBoundingSphere(),qn.copy(Sr.boundingSphere.center)),qn.applyMatrix4(On.matrixWorld).applyMatrix4(Pn)),Array.isArray(Er)){const wr=Sr.groups;for(let Tr=0,Ur=wr.length;Tr<Ur;Tr++){const Mr=wr[Tr],Nr=Er[Mr.materialIndex];Nr&&Nr.visible&&nn.push(On,Sr,Nr,Wn,qn.z,Mr)}}else Er.visible&&nn.push(On,Sr,Er,Wn,qn.z,null)}}const pr=On.children;for(let Sr=0,Er=pr.length;Sr<Er;Sr++)Fo(pr[Sr],Gn,Wn,er)}function Bo(On,Gn,Wn,er){const ir=On.opaque,pr=On.transmissive,Sr=On.transparent;rn.setupLightsView(Wn),kn===!0&&Rr.setGlobalState(tn.clippingPlanes,Wn),pr.length>0&&vo(ir,pr,Gn,Wn),er&&vr.viewport(fn.copy(er)),ir.length>0&&oo(ir,Gn,Wn),pr.length>0&&oo(pr,Gn,Wn),Sr.length>0&&oo(Sr,Gn,Wn),vr.buffers.depth.setTest(!0),vr.buffers.depth.setMask(!0),vr.buffers.color.setMask(!0),vr.setPolygonOffset(!1)}function vo(On,Gn,Wn,er){if((Wn.isScene===!0?Wn.overrideMaterial:null)!==null)return;if(rn.state.transmissionRenderTarget===null){rn.state.transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Hn.has("EXT_color_buffer_half_float")||Hn.has("EXT_color_buffer_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:4,stencilBuffer:zt});const Tr=Un.get(rn.state.transmissionRenderTarget);Tr.__isTransmissionRenderTarget=!0}const pr=rn.state.transmissionRenderTarget;tn.getDrawingBufferSize(Bn),pr.setSize(Bn.x,Bn.y);const Sr=tn.getRenderTarget();tn.setRenderTarget(pr),tn.getClearColor(_n),En=tn.getClearAlpha(),En<1&&tn.setClearColor(16777215,.5),tn.clear();const Er=tn.toneMapping;tn.toneMapping=NoToneMapping,oo(On,Wn,er),In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr);let wr=!1;for(let Tr=0,Ur=Gn.length;Tr<Ur;Tr++){const Mr=Gn[Tr],Nr=Mr.object,qr=Mr.geometry,jr=Mr.material,_i=Mr.group;if(jr.side===DoubleSide&&Nr.layers.test(er.layers)){const Wr=jr.side;jr.side=BackSide,jr.needsUpdate=!0,ao(Nr,Wn,er,qr,jr,_i),jr.side=Wr,jr.needsUpdate=!0,wr=!0}}wr===!0&&(In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr)),tn.setRenderTarget(Sr),tn.setClearColor(_n,En),tn.toneMapping=Er}function oo(On,Gn,Wn){const er=Gn.isScene===!0?Gn.overrideMaterial:null;for(let ir=0,pr=On.length;ir<pr;ir++){const Sr=On[ir],Er=Sr.object,wr=Sr.geometry,Tr=er===null?Sr.material:er,Ur=Sr.group;Er.layers.test(Wn.layers)&&ao(Er,Gn,Wn,wr,Tr,Ur)}}function ao(On,Gn,Wn,er,ir,pr){On.onBeforeRender(tn,Gn,Wn,er,ir,pr),On.modelViewMatrix.multiplyMatrices(Wn.matrixWorldInverse,On.matrixWorld),On.normalMatrix.getNormalMatrix(On.modelViewMatrix),ir.onBeforeRender(tn,Gn,Wn,er,On,pr),ir.transparent===!0&&ir.side===DoubleSide&&ir.forceSinglePass===!1?(ir.side=BackSide,ir.needsUpdate=!0,tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),ir.side=FrontSide,ir.needsUpdate=!0,tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),ir.side=DoubleSide):tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),On.onAfterRender(tn,Gn,Wn,er,ir,pr)}function ks(On,Gn,Wn){Gn.isScene!==!0&&(Gn=tr);const er=Un.get(On),ir=rn.state.lights,pr=rn.state.shadowsArray,Sr=ir.state.version,Er=mr.getParameters(On,ir.state,pr,Gn,Wn),wr=mr.getProgramCacheKey(Er);let Tr=er.programs;er.environment=On.isMeshStandardMaterial?Gn.environment:null,er.fog=Gn.fog,er.envMap=(On.isMeshStandardMaterial?or:jn).get(On.envMap||er.environment),er.envMapRotation=er.environment!==null&&On.envMap===null?Gn.environmentRotation:On.envMapRotation,Tr===void 0&&(On.addEventListener("dispose",Yr),Tr=new Map,er.programs=Tr);let Ur=Tr.get(wr);if(Ur!==void 0){if(er.currentProgram===Ur&&er.lightsStateVersion===Sr)return Ro(On,Er),Ur}else Er.uniforms=mr.getUniforms(On),On.onBuild(Wn,Er,tn),On.onBeforeCompile(Er,tn),Ur=mr.acquireProgram(Er,wr),Tr.set(wr,Ur),er.uniforms=Er.uniforms;const Mr=er.uniforms;return(!On.isShaderMaterial&&!On.isRawShaderMaterial||On.clipping===!0)&&(Mr.clippingPlanes=Rr.uniform),Ro(On,Er),er.needsLights=$n(On),er.lightsStateVersion=Sr,er.needsLights&&(Mr.ambientLightColor.value=ir.state.ambient,Mr.lightProbe.value=ir.state.probe,Mr.directionalLights.value=ir.state.directional,Mr.directionalLightShadows.value=ir.state.directionalShadow,Mr.spotLights.value=ir.state.spot,Mr.spotLightShadows.value=ir.state.spotShadow,Mr.rectAreaLights.value=ir.state.rectArea,Mr.ltc_1.value=ir.state.rectAreaLTC1,Mr.ltc_2.value=ir.state.rectAreaLTC2,Mr.pointLights.value=ir.state.point,Mr.pointLightShadows.value=ir.state.pointShadow,Mr.hemisphereLights.value=ir.state.hemi,Mr.directionalShadowMap.value=ir.state.directionalShadowMap,Mr.directionalShadowMatrix.value=ir.state.directionalShadowMatrix,Mr.spotShadowMap.value=ir.state.spotShadowMap,Mr.spotLightMatrix.value=ir.state.spotLightMatrix,Mr.spotLightMap.value=ir.state.spotLightMap,Mr.pointShadowMap.value=ir.state.pointShadowMap,Mr.pointShadowMatrix.value=ir.state.pointShadowMatrix),er.currentProgram=Ur,er.uniformsList=null,Ur}function ss(On){if(On.uniformsList===null){const Gn=On.currentProgram.getUniforms();On.uniformsList=WebGLUniforms.seqWithValue(Gn.seq,On.uniforms)}return On.uniformsList}function Ro(On,Gn){const Wn=Un.get(On);Wn.outputColorSpace=Gn.outputColorSpace,Wn.batching=Gn.batching,Wn.instancing=Gn.instancing,Wn.instancingColor=Gn.instancingColor,Wn.instancingMorph=Gn.instancingMorph,Wn.skinning=Gn.skinning,Wn.morphTargets=Gn.morphTargets,Wn.morphNormals=Gn.morphNormals,Wn.morphColors=Gn.morphColors,Wn.morphTargetsCount=Gn.morphTargetsCount,Wn.numClippingPlanes=Gn.numClippingPlanes,Wn.numIntersection=Gn.numClipIntersection,Wn.vertexAlphas=Gn.vertexAlphas,Wn.vertexTangents=Gn.vertexTangents,Wn.toneMapping=Gn.toneMapping}function qo(On,Gn,Wn,er,ir){Gn.isScene!==!0&&(Gn=tr),In.resetTextureUnits();const pr=Gn.fog,Sr=er.isMeshStandardMaterial?Gn.environment:null,Er=hn===null?tn.outputColorSpace:hn.isXRRenderTarget===!0?hn.texture.colorSpace:LinearSRGBColorSpace$1,wr=(er.isMeshStandardMaterial?or:jn).get(er.envMap||Sr),Tr=er.vertexColors===!0&&!!Wn.attributes.color&&Wn.attributes.color.itemSize===4,Ur=!!Wn.attributes.tangent&&(!!er.normalMap||er.anisotropy>0),Mr=!!Wn.morphAttributes.position,Nr=!!Wn.morphAttributes.normal,qr=!!Wn.morphAttributes.color;let jr=NoToneMapping;er.toneMapped&&(hn===null||hn.isXRRenderTarget===!0)&&(jr=tn.toneMapping);const _i=Wn.morphAttributes.position||Wn.morphAttributes.normal||Wn.morphAttributes.color,Wr=_i!==void 0?_i.length:0,Or=Un.get(er),Jr=rn.state.lights;if(kn===!0&&(Fn===!0||On!==pn)){const ys=On===pn&&er.id===dn;Rr.setState(er,On,ys)}let Hr=!1;er.version===Or.__version?(Or.needsLights&&Or.lightsStateVersion!==Jr.state.version||Or.outputColorSpace!==Er||ir.isBatchedMesh&&Or.batching===!1||!ir.isBatchedMesh&&Or.batching===!0||ir.isInstancedMesh&&Or.instancing===!1||!ir.isInstancedMesh&&Or.instancing===!0||ir.isSkinnedMesh&&Or.skinning===!1||!ir.isSkinnedMesh&&Or.skinning===!0||ir.isInstancedMesh&&Or.instancingColor===!0&&ir.instanceColor===null||ir.isInstancedMesh&&Or.instancingColor===!1&&ir.instanceColor!==null||ir.isInstancedMesh&&Or.instancingMorph===!0&&ir.morphTexture===null||ir.isInstancedMesh&&Or.instancingMorph===!1&&ir.morphTexture!==null||Or.envMap!==wr||er.fog===!0&&Or.fog!==pr||Or.numClippingPlanes!==void 0&&(Or.numClippingPlanes!==Rr.numPlanes||Or.numIntersection!==Rr.numIntersection)||Or.vertexAlphas!==Tr||Or.vertexTangents!==Ur||Or.morphTargets!==Mr||Or.morphNormals!==Nr||Or.morphColors!==qr||Or.toneMapping!==jr||Or.morphTargetsCount!==Wr)&&(Hr=!0):(Hr=!0,Or.__version=er.version);let hs=Or.currentProgram;Hr===!0&&(hs=ks(er,Gn,ir));let es=!1,vs=!1,Ls=!1;const us=hs.getUniforms(),Cs=Or.uniforms;if(vr.useProgram(hs.program)&&(es=!0,vs=!0,Ls=!0),er.id!==dn&&(dn=er.id,vs=!0),es||pn!==On){us.setValue(zn,"projectionMatrix",On.projectionMatrix),us.setValue(zn,"viewMatrix",On.matrixWorldInverse);const ys=us.map.cameraPosition;ys!==void 0&&ys.setValue(zn,qn.setFromMatrixPosition(On.matrixWorld)),sr.logarithmicDepthBuffer&&us.setValue(zn,"logDepthBufFC",2/(Math.log(On.far+1)/Math.LN2)),(er.isMeshPhongMaterial||er.isMeshToonMaterial||er.isMeshLambertMaterial||er.isMeshBasicMaterial||er.isMeshStandardMaterial||er.isShaderMaterial)&&us.setValue(zn,"isOrthographic",On.isOrthographicCamera===!0),pn!==On&&(pn=On,vs=!0,Ls=!0)}if(ir.isSkinnedMesh){us.setOptional(zn,ir,"bindMatrix"),us.setOptional(zn,ir,"bindMatrixInverse");const ys=ir.skeleton;ys&&(ys.boneTexture===null&&ys.computeBoneTexture(),us.setValue(zn,"boneTexture",ys.boneTexture,In))}ir.isBatchedMesh&&(us.setOptional(zn,ir,"batchingTexture"),us.setValue(zn,"batchingTexture",ir._matricesTexture,In));const ds=Wn.morphAttributes;if((ds.position!==void 0||ds.normal!==void 0||ds.color!==void 0)&&Fr.update(ir,Wn,hs),(vs||Or.receiveShadow!==ir.receiveShadow)&&(Or.receiveShadow=ir.receiveShadow,us.setValue(zn,"receiveShadow",ir.receiveShadow)),er.isMeshGouraudMaterial&&er.envMap!==null&&(Cs.envMap.value=wr,Cs.flipEnvMap.value=wr.isCubeTexture&&wr.isRenderTargetTexture===!1?-1:1),er.isMeshStandardMaterial&&er.envMap===null&&Gn.environment!==null&&(Cs.envMapIntensity.value=Gn.environmentIntensity),vs&&(us.setValue(zn,"toneMappingExposure",tn.toneMappingExposure),Or.needsLights&&Ln(Cs,Ls),pr&&er.fog===!0&&Ar.refreshFogUniforms(Cs,pr),Ar.refreshMaterialUniforms(Cs,er,Cn,Tn,rn.state.transmissionRenderTarget),WebGLUniforms.upload(zn,ss(Or),Cs,In)),er.isShaderMaterial&&er.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(zn,ss(Or),Cs,In),er.uniformsNeedUpdate=!1),er.isSpriteMaterial&&us.setValue(zn,"center",ir.center),us.setValue(zn,"modelViewMatrix",ir.modelViewMatrix),us.setValue(zn,"normalMatrix",ir.normalMatrix),us.setValue(zn,"modelMatrix",ir.matrixWorld),er.isShaderMaterial||er.isRawShaderMaterial){const ys=er.uniformsGroups;for(let ms=0,ps=ys.length;ms<ps;ms++){const ws=ys[ms];fs.update(ws,hs),fs.bind(ws,hs)}}return hs}function Ln(On,Gn){On.ambientLightColor.needsUpdate=Gn,On.lightProbe.needsUpdate=Gn,On.directionalLights.needsUpdate=Gn,On.directionalLightShadows.needsUpdate=Gn,On.pointLights.needsUpdate=Gn,On.pointLightShadows.needsUpdate=Gn,On.spotLights.needsUpdate=Gn,On.spotLightShadows.needsUpdate=Gn,On.rectAreaLights.needsUpdate=Gn,On.hemisphereLights.needsUpdate=Gn}function $n(On){return On.isMeshLambertMaterial||On.isMeshToonMaterial||On.isMeshPhongMaterial||On.isMeshStandardMaterial||On.isShadowMaterial||On.isShaderMaterial&&On.lights===!0}this.getActiveCubeFace=function(){return cn},this.getActiveMipmapLevel=function(){return un},this.getRenderTarget=function(){return hn},this.setRenderTargetTextures=function(On,Gn,Wn){Un.get(On.texture).__webglTexture=Gn,Un.get(On.depthTexture).__webglTexture=Wn;const er=Un.get(On);er.__hasExternalTextures=!0,er.__autoAllocateDepthBuffer=Wn===void 0,er.__autoAllocateDepthBuffer||Hn.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),er.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(On,Gn){const Wn=Un.get(On);Wn.__webglFramebuffer=Gn,Wn.__useDefaultFramebuffer=Gn===void 0},this.setRenderTarget=function(On,Gn=0,Wn=0){hn=On,cn=Gn,un=Wn;let er=!0,ir=null,pr=!1,Sr=!1;if(On){const wr=Un.get(On);wr.__useDefaultFramebuffer!==void 0?(vr.bindFramebuffer(zn.FRAMEBUFFER,null),er=!1):wr.__webglFramebuffer===void 0?In.setupRenderTarget(On):wr.__hasExternalTextures&&In.rebindTextures(On,Un.get(On.texture).__webglTexture,Un.get(On.depthTexture).__webglTexture);const Tr=On.texture;(Tr.isData3DTexture||Tr.isDataArrayTexture||Tr.isCompressedArrayTexture)&&(Sr=!0);const Ur=Un.get(On).__webglFramebuffer;On.isWebGLCubeRenderTarget?(Array.isArray(Ur[Gn])?ir=Ur[Gn][Wn]:ir=Ur[Gn],pr=!0):On.samples>0&&In.useMultisampledRTT(On)===!1?ir=Un.get(On).__webglMultisampledFramebuffer:Array.isArray(Ur)?ir=Ur[Wn]:ir=Ur,fn.copy(On.viewport),mn.copy(On.scissor),vn=On.scissorTest}else fn.copy(wn).multiplyScalar(Cn).floor(),mn.copy(xn).multiplyScalar(Cn).floor(),vn=Rn;if(vr.bindFramebuffer(zn.FRAMEBUFFER,ir)&&er&&vr.drawBuffers(On,ir),vr.viewport(fn),vr.scissor(mn),vr.setScissorTest(vn),pr){const wr=Un.get(On.texture);zn.framebufferTexture2D(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,zn.TEXTURE_CUBE_MAP_POSITIVE_X+Gn,wr.__webglTexture,Wn)}else if(Sr){const wr=Un.get(On.texture),Tr=Gn||0;zn.framebufferTextureLayer(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,wr.__webglTexture,Wn||0,Tr)}dn=-1},this.readRenderTargetPixels=function(On,Gn,Wn,er,ir,pr,Sr){if(!(On&&On.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Er=Un.get(On).__webglFramebuffer;if(On.isWebGLCubeRenderTarget&&Sr!==void 0&&(Er=Er[Sr]),Er){vr.bindFramebuffer(zn.FRAMEBUFFER,Er);try{const wr=On.texture,Tr=wr.format,Ur=wr.type;if(Tr!==RGBAFormat&&Qr.convert(Tr)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Mr=Ur===HalfFloatType&&(Hn.has("EXT_color_buffer_half_float")||Hn.has("EXT_color_buffer_float"));if(Ur!==UnsignedByteType&&Qr.convert(Ur)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_TYPE)&&Ur!==FloatType&&!Mr){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Gn>=0&&Gn<=On.width-er&&Wn>=0&&Wn<=On.height-ir&&zn.readPixels(Gn,Wn,er,ir,Qr.convert(Tr),Qr.convert(Ur),pr)}finally{const wr=hn!==null?Un.get(hn).__webglFramebuffer:null;vr.bindFramebuffer(zn.FRAMEBUFFER,wr)}}},this.copyFramebufferToTexture=function(On,Gn,Wn=0){const er=Math.pow(2,-Wn),ir=Math.floor(Gn.image.width*er),pr=Math.floor(Gn.image.height*er);In.setTexture2D(Gn,0),zn.copyTexSubImage2D(zn.TEXTURE_2D,Wn,0,0,On.x,On.y,ir,pr),vr.unbindTexture()},this.copyTextureToTexture=function(On,Gn,Wn,er=0){const ir=Gn.image.width,pr=Gn.image.height,Sr=Qr.convert(Wn.format),Er=Qr.convert(Wn.type);In.setTexture2D(Wn,0),zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,Wn.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wn.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,Wn.unpackAlignment),Gn.isDataTexture?zn.texSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,ir,pr,Sr,Er,Gn.image.data):Gn.isCompressedTexture?zn.compressedTexSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,Gn.mipmaps[0].width,Gn.mipmaps[0].height,Sr,Gn.mipmaps[0].data):zn.texSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,Sr,Er,Gn.image),er===0&&Wn.generateMipmaps&&zn.generateMipmap(zn.TEXTURE_2D),vr.unbindTexture()},this.copyTextureToTexture3D=function(On,Gn,Wn,er,ir=0){const pr=Math.round(On.max.x-On.min.x),Sr=Math.round(On.max.y-On.min.y),Er=On.max.z-On.min.z+1,wr=Qr.convert(er.format),Tr=Qr.convert(er.type);let Ur;if(er.isData3DTexture)In.setTexture3D(er,0),Ur=zn.TEXTURE_3D;else if(er.isDataArrayTexture||er.isCompressedArrayTexture)In.setTexture2DArray(er,0),Ur=zn.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,er.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,er.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,er.unpackAlignment);const Mr=zn.getParameter(zn.UNPACK_ROW_LENGTH),Nr=zn.getParameter(zn.UNPACK_IMAGE_HEIGHT),qr=zn.getParameter(zn.UNPACK_SKIP_PIXELS),jr=zn.getParameter(zn.UNPACK_SKIP_ROWS),_i=zn.getParameter(zn.UNPACK_SKIP_IMAGES),Wr=Wn.isCompressedTexture?Wn.mipmaps[ir]:Wn.image;zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Wr.width),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,Wr.height),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,On.min.x),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,On.min.y),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,On.min.z),Wn.isDataTexture||Wn.isData3DTexture?zn.texSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Tr,Wr.data):er.isCompressedArrayTexture?zn.compressedTexSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Wr.data):zn.texSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Tr,Wr),zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Mr),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,Nr),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,qr),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,jr),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,_i),ir===0&&er.generateMipmaps&&zn.generateMipmap(Ur),vr.unbindTexture()},this.initTexture=function(On){On.isCubeTexture?In.setTextureCube(On,0):On.isData3DTexture?In.setTexture3D(On,0):On.isDataArrayTexture||On.isCompressedArrayTexture?In.setTexture2DArray(On,0):In.setTexture2D(On,0),vr.unbindTexture()},this.resetState=function(){cn=0,un=0,hn=null,vr.reset(),cs.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(_e){this._outputColorSpace=_e;const Dt=this.getContext();Dt.drawingBufferColorSpace=_e===DisplayP3ColorSpace?"display-p3":"srgb",Dt.unpackColorSpace=ColorManagement.workingColorSpace===LinearDisplayP3ColorSpace?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(_e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=_e}}class FogExp2{constructor(_e,Dt=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(_e),this.density=Dt}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fog{constructor(_e,Dt=1,Vt=1e3){this.isFog=!0,this.name="",this.color=new Color$1(_e),this.near=Dt,this.far=Vt}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,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.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(_e,Dt){return super.copy(_e,Dt),_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,this.backgroundRotation.copy(_e.backgroundRotation),this.environmentIntensity=_e.environmentIntensity,this.environmentRotation.copy(_e.environmentRotation),_e.overrideMaterial!==null&&(this.overrideMaterial=_e.overrideMaterial.clone()),this.matrixAutoUpdate=_e.matrixAutoUpdate,this}toJSON(_e){const Dt=super.toJSON(_e);return this.fog!==null&&(Dt.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Dt.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(Dt.object.backgroundIntensity=this.backgroundIntensity),Dt.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(Dt.object.environmentIntensity=this.environmentIntensity),Dt.object.environmentRotation=this.environmentRotation.toArray(),Dt}}class InterleavedBuffer{constructor(_e,Dt){this.isInterleavedBuffer=!0,this.array=_e,this.stride=Dt,this.count=_e!==void 0?_e.length/Dt:0,this.usage=StaticDrawUsage,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(_e){_e===!0&&this.version++}get updateRange(){return warnOnce("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(_e){return this.usage=_e,this}addUpdateRange(_e,Dt){this.updateRanges.push({start:_e,count:Dt})}clearUpdateRanges(){this.updateRanges.length=0}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,Dt,Vt){_e*=this.stride,Vt*=Dt.stride;for(let Gt=0,zt=this.stride;Gt<zt;Gt++)this.array[_e+Gt]=Dt.array[Vt+Gt];return this}set(_e,Dt=0){return this.array.set(_e,Dt),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 Dt=new this.array.constructor(_e.arrayBuffers[this.array.buffer._uuid]),Vt=new this.constructor(Dt,this.stride);return Vt.setUsage(this.usage),Vt}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,Dt,Vt,Gt=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=_e,this.itemSize=Dt,this.offset=Vt,this.normalized=Gt}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(_e){this.data.needsUpdate=_e}applyMatrix4(_e){for(let Dt=0,Vt=this.data.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyMatrix4(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyNormalMatrix(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.transformDirection(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}getComponent(_e,Dt){let Vt=this.array[_e*this.data.stride+this.offset+Dt];return this.normalized&&(Vt=denormalize(Vt,this.array)),Vt}setComponent(_e,Dt,Vt){return this.normalized&&(Vt=normalize(Vt,this.array)),this.data.array[_e*this.data.stride+this.offset+Dt]=Vt,this}setX(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset]=Dt,this}setY(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+1]=Dt,this}setZ(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+2]=Dt,this}setW(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+3]=Dt,this}getX(_e){let Dt=this.data.array[_e*this.data.stride+this.offset];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getY(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+1];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getZ(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+2];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getW(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+3];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}setXY(_e,Dt,Vt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this}setXYZ(_e,Dt,Vt,Gt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this}setXYZW(_e,Dt,Vt,Gt,zt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array),zt=normalize(zt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this.data.array[_e+3]=zt,this}clone(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return new BufferAttribute(new this.array.constructor(Dt),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 Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Dt,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$1(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=new SpriteMaterial){if(super(),this.isSprite=!0,this.type="Sprite",_geometry===void 0){_geometry=new BufferGeometry;const Dt=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),Vt=new InterleavedBuffer(Dt,5);_geometry.setIndex([0,1,2,0,2,3]),_geometry.setAttribute("position",new InterleavedBufferAttribute(Vt,3,0,!1)),_geometry.setAttribute("uv",new InterleavedBufferAttribute(Vt,2,3,!1))}this.geometry=_geometry,this.material=_e,this.center=new Vector2(.5,.5)}raycast(_e,Dt){_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 Vt=this.material.rotation;let Gt,zt;Vt!==0&&(zt=Math.cos(Vt),Gt=Math.sin(Vt));const jt=this.center;transformVertex(_vA.set(-.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vB.set(.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vC.set(.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvA.set(0,0),_uvB.set(1,0),_uvC.set(1,1);let Ht=_e.ray.intersectTriangle(_vA,_vB,_vC,!1,_intersectPoint);if(Ht===null&&(transformVertex(_vB.set(-.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvB.set(0,1),Ht=_e.ray.intersectTriangle(_vA,_vC,_vB,!1,_intersectPoint),Ht===null))return;const Wt=_e.ray.origin.distanceTo(_intersectPoint);Wt<_e.near||Wt>_e.far||Dt.push({distance:Wt,point:_intersectPoint.clone(),uv:Triangle.getInterpolation(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(_e,Dt){return super.copy(_e,Dt),_e.center!==void 0&&this.center.copy(_e.center),this.material=_e.material,this}}function transformVertex(kt,_e,Dt,Vt,Gt,zt){_alignedPosition.subVectors(kt,Dt).addScalar(.5).multiply(Vt),Gt!==void 0?(_rotatedPosition.x=zt*_alignedPosition.x-Gt*_alignedPosition.y,_rotatedPosition.y=Gt*_alignedPosition.x+zt*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),kt.copy(_e),kt.x+=_rotatedPosition.x,kt.y+=_rotatedPosition.y,kt.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 Dt=_e.levels;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Dt[Vt];this.addLevel(zt.object.clone(),zt.distance,zt.hysteresis)}return this.autoUpdate=_e.autoUpdate,this}addLevel(_e,Dt=0,Vt=0){Dt=Math.abs(Dt);const Gt=this.levels;let zt;for(zt=0;zt<Gt.length&&!(Dt<Gt[zt].distance);zt++);return Gt.splice(zt,0,{distance:Dt,hysteresis:Vt,object:_e}),this.add(_e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(_e){const Dt=this.levels;if(Dt.length>0){let Vt,Gt;for(Vt=1,Gt=Dt.length;Vt<Gt;Vt++){let zt=Dt[Vt].distance;if(Dt[Vt].object.visible&&(zt-=zt*Dt[Vt].hysteresis),_e<zt)break}return Dt[Vt-1].object}return null}raycast(_e,Dt){if(this.levels.length>0){_v1$2.setFromMatrixPosition(this.matrixWorld);const Gt=_e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(Gt).raycast(_e,Dt)}}update(_e){const Dt=this.levels;if(Dt.length>1){_v1$2.setFromMatrixPosition(_e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const Vt=_v1$2.distanceTo(_v2$1)/_e.zoom;Dt[0].object.visible=!0;let Gt,zt;for(Gt=1,zt=Dt.length;Gt<zt;Gt++){let jt=Dt[Gt].distance;if(Dt[Gt].object.visible&&(jt-=jt*Dt[Gt].hysteresis),Vt>=jt)Dt[Gt-1].object.visible=!1,Dt[Gt].object.visible=!0;else break}for(this._currentLevel=Gt-1;Gt<zt;Gt++)Dt[Gt].object.visible=!1}}toJSON(_e){const Dt=super.toJSON(_e);this.autoUpdate===!1&&(Dt.object.autoUpdate=!1),Dt.object.levels=[];const Vt=this.levels;for(let Gt=0,zt=Vt.length;Gt<zt;Gt++){const jt=Vt[Gt];Dt.object.levels.push({object:jt.object.uuid,distance:jt.distance,hysteresis:jt.hysteresis})}return Dt}}const _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector3=new Vector3,_matrix4=new Matrix4,_vertex=new Vector3,_sphere$4=new Sphere,_inverseMatrix$2=new Matrix4,_ray$2=new Ray;class SkinnedMesh extends Mesh{constructor(_e,Dt){super(_e,Dt),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=AttachedBindMode,this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const _e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingBox.expandByPoint(_vertex)}computeBoundingSphere(){const _e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingSphere.expandByPoint(_vertex)}copy(_e,Dt){return super.copy(_e,Dt),this.bindMode=_e.bindMode,this.bindMatrix.copy(_e.bindMatrix),this.bindMatrixInverse.copy(_e.bindMatrixInverse),this.skeleton=_e.skeleton,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}raycast(_e,Dt){const Vt=this.material,Gt=this.matrixWorld;Vt!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$4.copy(this.boundingSphere),_sphere$4.applyMatrix4(Gt),_e.ray.intersectsSphere(_sphere$4)!==!1&&(_inverseMatrix$2.copy(Gt).invert(),_ray$2.copy(_e.ray).applyMatrix4(_inverseMatrix$2),!(this.boundingBox!==null&&_ray$2.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(_e,Dt,_ray$2)))}getVertexPosition(_e,Dt){return super.getVertexPosition(_e,Dt),this.applyBoneTransform(_e,Dt),Dt}bind(_e,Dt){this.skeleton=_e,Dt===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Dt=this.matrixWorld),this.bindMatrix.copy(Dt),this.bindMatrixInverse.copy(Dt).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const _e=new Vector4,Dt=this.geometry.attributes.skinWeight;for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){_e.fromBufferAttribute(Dt,Vt);const zt=1/_e.manhattanLength();zt!==1/0?_e.multiplyScalar(zt):_e.set(1,0,0,0),Dt.setXYZW(Vt,_e.x,_e.y,_e.z,_e.w)}}updateMatrixWorld(_e){super.updateMatrixWorld(_e),this.bindMode===AttachedBindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===DetachedBindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(_e,Dt){const Vt=this.skeleton,Gt=this.geometry;_skinIndex.fromBufferAttribute(Gt.attributes.skinIndex,_e),_skinWeight.fromBufferAttribute(Gt.attributes.skinWeight,_e),_basePosition.copy(Dt).applyMatrix4(this.bindMatrix),Dt.set(0,0,0);for(let zt=0;zt<4;zt++){const jt=_skinWeight.getComponent(zt);if(jt!==0){const Ht=_skinIndex.getComponent(zt);_matrix4.multiplyMatrices(Vt.bones[Ht].matrixWorld,Vt.boneInverses[Ht]),Dt.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4),jt)}}return Dt.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(_e=null,Dt=1,Vt=1,Gt,zt,jt,Ht,Wt,qt=NearestFilter,Xt=NearestFilter,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isDataTexture=!0,this.image={data:_e,width:Dt,height:Vt},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _offsetMatrix=new Matrix4,_identityMatrix$1=new Matrix4;class Skeleton{constructor(_e=[],Dt=[]){this.uuid=generateUUID(),this.bones=_e.slice(0),this.boneInverses=Dt,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const _e=this.bones,Dt=this.boneInverses;if(this.boneMatrices=new Float32Array(_e.length*16),Dt.length===0)this.calculateInverses();else if(_e.length!==Dt.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let Vt=0,Gt=this.bones.length;Vt<Gt;Vt++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=new Matrix4;this.bones[_e]&&Vt.copy(this.bones[_e].matrixWorld).invert(),this.boneInverses.push(Vt)}}pose(){for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&Vt.matrixWorld.copy(this.boneInverses[_e]).invert()}for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&(Vt.parent&&Vt.parent.isBone?(Vt.matrix.copy(Vt.parent.matrixWorld).invert(),Vt.matrix.multiply(Vt.matrixWorld)):Vt.matrix.copy(Vt.matrixWorld),Vt.matrix.decompose(Vt.position,Vt.quaternion,Vt.scale))}}update(){const _e=this.bones,Dt=this.boneInverses,Vt=this.boneMatrices,Gt=this.boneTexture;for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt]?_e[zt].matrixWorld:_identityMatrix$1;_offsetMatrix.multiplyMatrices(Ht,Dt[zt]),_offsetMatrix.toArray(Vt,zt*16)}Gt!==null&&(Gt.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let _e=Math.sqrt(this.bones.length*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4);Dt.set(this.boneMatrices);const Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);return Vt.needsUpdate=!0,this.boneMatrices=Dt,this.boneTexture=Vt,this}getBoneByName(_e){for(let Dt=0,Vt=this.bones.length;Dt<Vt;Dt++){const Gt=this.bones[Dt];if(Gt.name===_e)return Gt}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(_e,Dt){this.uuid=_e.uuid;for(let Vt=0,Gt=_e.bones.length;Vt<Gt;Vt++){const zt=_e.bones[Vt];let jt=Dt[zt];jt===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",zt),jt=new Bone),this.bones.push(jt),this.boneInverses.push(new Matrix4().fromArray(_e.boneInverses[Vt]))}return this.init(),this}toJSON(){const _e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};_e.uuid=this.uuid;const Dt=this.bones,Vt=this.boneInverses;for(let Gt=0,zt=Dt.length;Gt<zt;Gt++){const jt=Dt[Gt];_e.bones.push(jt.uuid);const Ht=Vt[Gt];_e.boneInverses.push(Ht.toArray())}return _e}}class InstancedBufferAttribute extends BufferAttribute{constructor(_e,Dt,Vt,Gt=1){super(_e,Dt,Vt),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Gt}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=[],_box3=new Box3,_identity=new Matrix4,_mesh$1=new Mesh,_sphere$3=new Sphere;class InstancedMesh extends Mesh{constructor(_e,Dt,Vt){super(_e,Dt),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Vt*16),16),this.instanceColor=null,this.morphTexture=null,this.count=Vt,this.boundingBox=null,this.boundingSphere=null;for(let Gt=0;Gt<Vt;Gt++)this.setMatrixAt(Gt,_identity)}computeBoundingBox(){const _e=this.geometry,Dt=this.count;this.boundingBox===null&&(this.boundingBox=new Box3),_e.boundingBox===null&&_e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_box3.copy(_e.boundingBox).applyMatrix4(_instanceLocalMatrix),this.boundingBox.union(_box3)}computeBoundingSphere(){const _e=this.geometry,Dt=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sphere),_e.boundingSphere===null&&_e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_sphere$3.copy(_e.boundingSphere).applyMatrix4(_instanceLocalMatrix),this.boundingSphere.union(_sphere$3)}copy(_e,Dt){return super.copy(_e,Dt),this.instanceMatrix.copy(_e.instanceMatrix),_e.morphTexture!==null&&(this.morphTexture=_e.morphTexture.clone()),_e.instanceColor!==null&&(this.instanceColor=_e.instanceColor.clone()),this.count=_e.count,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}getColorAt(_e,Dt){Dt.fromArray(this.instanceColor.array,_e*3)}getMatrixAt(_e,Dt){Dt.fromArray(this.instanceMatrix.array,_e*16)}getMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=this.morphTexture.source.data.data,zt=Vt.length+1,jt=_e*zt+1;for(let Ht=0;Ht<Vt.length;Ht++)Vt[Ht]=Gt[jt+Ht]}raycast(_e,Dt){const Vt=this.matrixWorld,Gt=this.count;if(_mesh$1.geometry=this.geometry,_mesh$1.material=this.material,_mesh$1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$3.copy(this.boundingSphere),_sphere$3.applyMatrix4(Vt),_e.ray.intersectsSphere(_sphere$3)!==!1))for(let zt=0;zt<Gt;zt++){this.getMatrixAt(zt,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(Vt,_instanceLocalMatrix),_mesh$1.matrixWorld=_instanceWorldMatrix,_mesh$1.raycast(_e,_instanceIntersects);for(let jt=0,Ht=_instanceIntersects.length;jt<Ht;jt++){const Wt=_instanceIntersects[jt];Wt.instanceId=zt,Wt.object=this,Dt.push(Wt)}_instanceIntersects.length=0}}setColorAt(_e,Dt){this.instanceColor===null&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count*3),3)),Dt.toArray(this.instanceColor.array,_e*3)}setMatrixAt(_e,Dt){Dt.toArray(this.instanceMatrix.array,_e*16)}setMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=Vt.length+1;this.morphTexture===null&&(this.morphTexture=new DataTexture(new Float32Array(Gt*this.count),Gt,this.count,RedFormat,FloatType));const zt=this.morphTexture.source.data.data;let jt=0;for(let qt=0;qt<Vt.length;qt++)jt+=Vt[qt];const Ht=this.geometry.morphTargetsRelative?1:1-jt,Wt=Gt*_e;zt[Wt]=Ht,zt.set(Vt,Wt+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function sortOpaque(kt,_e){return kt.z-_e.z}function sortTransparent(kt,_e){return _e.z-kt.z}class MultiDrawRenderList{constructor(){this.index=0,this.pool=[],this.list=[]}push(_e,Dt){const Vt=this.pool,Gt=this.list;this.index>=Vt.length&&Vt.push({start:-1,count:-1,z:-1});const zt=Vt[this.index];Gt.push(zt),this.index++,zt.start=_e.start,zt.count=_e.count,zt.z=Dt}reset(){this.list.length=0,this.index=0}}const ID_ATTR_NAME="batchId",_matrix$1=new Matrix4,_invMatrixWorld=new Matrix4,_identityMatrix$2=new Matrix4,_projScreenMatrix$2=new Matrix4,_frustum=new Frustum,_box$1=new Box3,_sphere$2=new Sphere,_vector$5=new Vector3,_renderList=new MultiDrawRenderList,_mesh=new Mesh,_batchIntersects=[];function copyAttributeData(kt,_e,Dt=0){const Vt=_e.itemSize;if(kt.isInterleavedBufferAttribute||kt.array.constructor!==_e.array.constructor){const Gt=kt.count;for(let zt=0;zt<Gt;zt++)for(let jt=0;jt<Vt;jt++)_e.setComponent(zt+Dt,jt,kt.getComponent(zt,jt))}else _e.array.set(kt.array,Dt*Vt);_e.needsUpdate=!0}class BatchedMesh extends Mesh{get maxGeometryCount(){return this._maxGeometryCount}constructor(_e,Dt,Vt=Dt*2,Gt){super(new BufferGeometry,Gt),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=_e,this._maxVertexCount=Dt,this._maxIndexCount=Vt,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(_e),this._multiDrawStarts=new Int32Array(_e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let _e=Math.sqrt(this._maxGeometryCount*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4),Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);this._matricesTexture=Vt}_initializeGeometry(_e){const Dt=this.geometry,Vt=this._maxVertexCount,Gt=this._maxGeometryCount,zt=this._maxIndexCount;if(this._geometryInitialized===!1){for(const Ht in _e.attributes){const Wt=_e.getAttribute(Ht),{array:qt,itemSize:Xt,normalized:Kt}=Wt,Yt=new qt.constructor(Vt*Xt),Zt=new BufferAttribute(Yt,Xt,Kt);Dt.setAttribute(Ht,Zt)}if(_e.getIndex()!==null){const Ht=Vt>65536?new Uint32Array(zt):new Uint16Array(zt);Dt.setIndex(new BufferAttribute(Ht,1))}const jt=Gt>65536?new Uint32Array(Vt):new Uint16Array(Vt);Dt.setAttribute(ID_ATTR_NAME,new BufferAttribute(jt,1)),this._geometryInitialized=!0}}_validateGeometry(_e){if(_e.getAttribute(ID_ATTR_NAME))throw new Error(`BatchedMesh: Geometry cannot use attribute "${ID_ATTR_NAME}"`);const Dt=this.geometry;if(!!_e.getIndex()!=!!Dt.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const Vt in Dt.attributes){if(Vt===ID_ATTR_NAME)continue;if(!_e.hasAttribute(Vt))throw new Error(`BatchedMesh: Added geometry missing "${Vt}". All geometries must have consistent attributes.`);const Gt=_e.getAttribute(Vt),zt=Dt.getAttribute(Vt);if(Gt.itemSize!==zt.itemSize||Gt.normalized!==zt.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(_e){return this.customSort=_e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const _e=this._geometryCount,Dt=this.boundingBox,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingBoxAt(Gt,_box$1).applyMatrix4(_matrix$1),Dt.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere);const _e=this._geometryCount,Dt=this.boundingSphere,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingSphereAt(Gt,_sphere$2).applyMatrix4(_matrix$1),Dt.union(_sphere$2))}addGeometry(_e,Dt=-1,Vt=-1){if(this._initializeGeometry(_e),this._validateGeometry(_e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const Gt={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let zt=null;const jt=this._reservedRanges,Ht=this._drawRanges,Wt=this._bounds;this._geometryCount!==0&&(zt=jt[jt.length-1]),Dt===-1?Gt.vertexCount=_e.getAttribute("position").count:Gt.vertexCount=Dt,zt===null?Gt.vertexStart=0:Gt.vertexStart=zt.vertexStart+zt.vertexCount;const qt=_e.getIndex(),Xt=qt!==null;if(Xt&&(Vt===-1?Gt.indexCount=qt.count:Gt.indexCount=Vt,zt===null?Gt.indexStart=0:Gt.indexStart=zt.indexStart+zt.indexCount),Gt.indexStart!==-1&&Gt.indexStart+Gt.indexCount>this._maxIndexCount||Gt.vertexStart+Gt.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const Kt=this._visibility,Yt=this._active,Zt=this._matricesTexture,Jt=this._matricesTexture.image.data;Kt.push(!0),Yt.push(!0);const nn=this._geometryCount;this._geometryCount++,_identityMatrix$2.toArray(Jt,nn*16),Zt.needsUpdate=!0,jt.push(Gt),Ht.push({start:Xt?Gt.indexStart:Gt.vertexStart,count:-1}),Wt.push({boxInitialized:!1,box:new Box3,sphereInitialized:!1,sphere:new Sphere});const rn=this.geometry.getAttribute(ID_ATTR_NAME);for(let Qt=0;Qt<Gt.vertexCount;Qt++)rn.setX(Gt.vertexStart+Qt,nn);return rn.needsUpdate=!0,this.setGeometryAt(nn,_e),nn}setGeometryAt(_e,Dt){if(_e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Dt);const Vt=this.geometry,Gt=Vt.getIndex()!==null,zt=Vt.getIndex(),jt=Dt.getIndex(),Ht=this._reservedRanges[_e];if(Gt&&jt.count>Ht.indexCount||Dt.attributes.position.count>Ht.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const Wt=Ht.vertexStart,qt=Ht.vertexCount;for(const Zt in Vt.attributes){if(Zt===ID_ATTR_NAME)continue;const Jt=Dt.getAttribute(Zt),nn=Vt.getAttribute(Zt);copyAttributeData(Jt,nn,Wt);const rn=Jt.itemSize;for(let Qt=Jt.count,en=qt;Qt<en;Qt++){const tn=Wt+Qt;for(let sn=0;sn<rn;sn++)nn.setComponent(tn,sn,0)}nn.needsUpdate=!0,nn.addUpdateRange(Wt*rn,qt*rn)}if(Gt){const Zt=Ht.indexStart;for(let Jt=0;Jt<jt.count;Jt++)zt.setX(Zt+Jt,Wt+jt.getX(Jt));for(let Jt=jt.count,nn=Ht.indexCount;Jt<nn;Jt++)zt.setX(Zt+Jt,Wt);zt.needsUpdate=!0,zt.addUpdateRange(Zt,Ht.indexCount)}const Xt=this._bounds[_e];Dt.boundingBox!==null?(Xt.box.copy(Dt.boundingBox),Xt.boxInitialized=!0):Xt.boxInitialized=!1,Dt.boundingSphere!==null?(Xt.sphere.copy(Dt.boundingSphere),Xt.sphereInitialized=!0):Xt.sphereInitialized=!1;const Kt=this._drawRanges[_e],Yt=Dt.getAttribute("position");return Kt.count=Gt?jt.count:Yt.count,this._visibilityChanged=!0,_e}deleteGeometry(_e){const Dt=this._active;return _e>=Dt.length||Dt[_e]===!1?this:(Dt[_e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.box,jt=this.geometry;if(Gt.boxInitialized===!1){zt.makeEmpty();const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];for(let Xt=qt.start,Kt=qt.start+qt.count;Xt<Kt;Xt++){let Yt=Xt;Ht&&(Yt=Ht.getX(Yt)),zt.expandByPoint(_vector$5.fromBufferAttribute(Wt,Yt))}Gt.boxInitialized=!0}return Dt.copy(zt),Dt}getBoundingSphereAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.sphere,jt=this.geometry;if(Gt.sphereInitialized===!1){zt.makeEmpty(),this.getBoundingBoxAt(_e,_box$1),_box$1.getCenter(zt.center);const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];let Xt=0;for(let Kt=qt.start,Yt=qt.start+qt.count;Kt<Yt;Kt++){let Zt=Kt;Ht&&(Zt=Ht.getX(Zt)),_vector$5.fromBufferAttribute(Wt,Zt),Xt=Math.max(Xt,zt.center.distanceToSquared(_vector$5))}zt.radius=Math.sqrt(Xt),Gt.sphereInitialized=!0}return Dt.copy(zt),Dt}setMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture,zt=this._matricesTexture.image.data,jt=this._geometryCount;return _e>=jt||Vt[_e]===!1?this:(Dt.toArray(zt,_e*16),Gt.needsUpdate=!0,this)}getMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture.image.data,zt=this._geometryCount;return _e>=zt||Vt[_e]===!1?null:Dt.fromArray(Gt,_e*16)}setVisibleAt(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._geometryCount;return _e>=zt||Gt[_e]===!1||Vt[_e]===Dt?this:(Vt[_e]=Dt,this._visibilityChanged=!0,this)}getVisibleAt(_e){const Dt=this._visibility,Vt=this._active,Gt=this._geometryCount;return _e>=Gt||Vt[_e]===!1?!1:Dt[_e]}raycast(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._drawRanges,jt=this._geometryCount,Ht=this.matrixWorld,Wt=this.geometry;_mesh.material=this.material,_mesh.geometry.index=Wt.index,_mesh.geometry.attributes=Wt.attributes,_mesh.geometry.boundingBox===null&&(_mesh.geometry.boundingBox=new Box3),_mesh.geometry.boundingSphere===null&&(_mesh.geometry.boundingSphere=new Sphere);for(let qt=0;qt<jt;qt++){if(!Vt[qt]||!Gt[qt])continue;const Xt=zt[qt];_mesh.geometry.setDrawRange(Xt.start,Xt.count),this.getMatrixAt(qt,_mesh.matrixWorld).premultiply(Ht),this.getBoundingBoxAt(qt,_mesh.geometry.boundingBox),this.getBoundingSphereAt(qt,_mesh.geometry.boundingSphere),_mesh.raycast(_e,_batchIntersects);for(let Kt=0,Yt=_batchIntersects.length;Kt<Yt;Kt++){const Zt=_batchIntersects[Kt];Zt.object=this,Zt.batchId=qt,Dt.push(Zt)}_batchIntersects.length=0}_mesh.material=null,_mesh.geometry.index=null,_mesh.geometry.attributes={},_mesh.geometry.setDrawRange(0,1/0)}copy(_e){return super.copy(_e),this.geometry=_e.geometry.clone(),this.perObjectFrustumCulled=_e.perObjectFrustumCulled,this.sortObjects=_e.sortObjects,this.boundingBox=_e.boundingBox!==null?_e.boundingBox.clone():null,this.boundingSphere=_e.boundingSphere!==null?_e.boundingSphere.clone():null,this._drawRanges=_e._drawRanges.map(Dt=>({...Dt})),this._reservedRanges=_e._reservedRanges.map(Dt=>({...Dt})),this._visibility=_e._visibility.slice(),this._active=_e._active.slice(),this._bounds=_e._bounds.map(Dt=>({boxInitialized:Dt.boxInitialized,box:Dt.box.clone(),sphereInitialized:Dt.sphereInitialized,sphere:Dt.sphere.clone()})),this._maxGeometryCount=_e._maxGeometryCount,this._maxVertexCount=_e._maxVertexCount,this._maxIndexCount=_e._maxIndexCount,this._geometryInitialized=_e._geometryInitialized,this._geometryCount=_e._geometryCount,this._multiDrawCounts=_e._multiDrawCounts.slice(),this._multiDrawStarts=_e._multiDrawStarts.slice(),this._matricesTexture=_e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(_e,Dt,Vt,Gt,zt){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const jt=Gt.getIndex(),Ht=jt===null?1:jt.array.BYTES_PER_ELEMENT,Wt=this._active,qt=this._visibility,Xt=this._multiDrawStarts,Kt=this._multiDrawCounts,Yt=this._drawRanges,Zt=this.perObjectFrustumCulled;Zt&&(_projScreenMatrix$2.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse).multiply(this.matrixWorld),_frustum.setFromProjectionMatrix(_projScreenMatrix$2,_e.coordinateSystem));let Jt=0;if(this.sortObjects){_invMatrixWorld.copy(this.matrixWorld).invert(),_vector$5.setFromMatrixPosition(Vt.matrixWorld).applyMatrix4(_invMatrixWorld);for(let Qt=0,en=qt.length;Qt<en;Qt++)if(qt[Qt]&&Wt[Qt]){this.getMatrixAt(Qt,_matrix$1),this.getBoundingSphereAt(Qt,_sphere$2).applyMatrix4(_matrix$1);let tn=!1;if(Zt&&(tn=!_frustum.intersectsSphere(_sphere$2)),!tn){const sn=_vector$5.distanceTo(_sphere$2.center);_renderList.push(Yt[Qt],sn)}}const nn=_renderList.list,rn=this.customSort;rn===null?nn.sort(zt.transparent?sortTransparent:sortOpaque):rn.call(this,nn,Vt);for(let Qt=0,en=nn.length;Qt<en;Qt++){const tn=nn[Qt];Xt[Jt]=tn.start*Ht,Kt[Jt]=tn.count,Jt++}_renderList.reset()}else for(let nn=0,rn=qt.length;nn<rn;nn++)if(qt[nn]&&Wt[nn]){let Qt=!1;if(Zt&&(this.getMatrixAt(nn,_matrix$1),this.getBoundingSphereAt(nn,_sphere$2).applyMatrix4(_matrix$1),Qt=!_frustum.intersectsSphere(_sphere$2)),!Qt){const en=Yt[nn];Xt[Jt]=en.start*Ht,Kt[Jt]=en.count,Jt++}}this._multiDrawCount=Jt,this._visibilityChanged=!1}onBeforeShadow(_e,Dt,Vt,Gt,zt,jt){this.onBeforeRender(_e,null,Gt,zt,jt)}}class LineBasicMaterial extends Material{constructor(_e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color$1(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.linewidth=_e.linewidth,this.linecap=_e.linecap,this.linejoin=_e.linejoin,this.fog=_e.fog,this}}const _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,Dt=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[0];for(let Gt=1,zt=Dt.count;Gt<zt;Gt++)_start$1.fromBufferAttribute(Dt,Gt-1),_end$1.fromBufferAttribute(Dt,Gt),Vt[Gt]=Vt[Gt-1],Vt[Gt]+=_start$1.distanceTo(_end$1);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Line.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$1.copy(Vt.boundingSphere),_sphere$1.applyMatrix4(Gt),_sphere$1.radius+=zt,_e.ray.intersectsSphere(_sphere$1)===!1)return;_inverseMatrix$1.copy(Gt).invert(),_ray$1.copy(_e.ray).applyMatrix4(_inverseMatrix$1);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=new Vector3,Xt=new Vector3,Kt=new Vector3,Yt=new Vector3,Zt=this.isLineSegments?2:1,Jt=Vt.index,rn=Vt.attributes.position;if(Jt!==null){const Qt=Math.max(0,jt.start),en=Math.min(Jt.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){const cn=Jt.getX(tn),un=Jt.getX(tn+1);if(qt.fromBufferAttribute(rn,cn),Xt.fromBufferAttribute(rn,un),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const dn=_e.ray.origin.distanceTo(Yt);dn<_e.near||dn>_e.far||Dt.push({distance:dn,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}else{const Qt=Math.max(0,jt.start),en=Math.min(rn.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){if(qt.fromBufferAttribute(rn,tn),Xt.fromBufferAttribute(rn,tn+1),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const un=_e.ray.origin.distanceTo(Yt);un<_e.near||un>_e.far||Dt.push({distance:un,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}const _start=new Vector3,_end=new Vector3;class LineSegments extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[];for(let Gt=0,zt=Dt.count;Gt<zt;Gt+=2)_start.fromBufferAttribute(Dt,Gt),_end.fromBufferAttribute(Dt,Gt+1),Vt[Gt]=Gt===0?0:Vt[Gt-1],Vt[Gt+1]=Vt[Gt]+_start.distanceTo(_end);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(_e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color$1(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=new Ray,_sphere$7=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(_e=new BufferGeometry,Dt=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Points.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$7.copy(Vt.boundingSphere),_sphere$7.applyMatrix4(Gt),_sphere$7.radius+=zt,_e.ray.intersectsSphere(_sphere$7)===!1)return;_inverseMatrix.copy(Gt).invert(),_ray.copy(_e.ray).applyMatrix4(_inverseMatrix);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=Vt.index,Kt=Vt.attributes.position;if(qt!==null){const Yt=Math.max(0,jt.start),Zt=Math.min(qt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++){const rn=qt.getX(Jt);_position$2.fromBufferAttribute(Kt,rn),testPoint(_position$2,rn,Wt,Gt,_e,Dt,this)}}else{const Yt=Math.max(0,jt.start),Zt=Math.min(Kt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++)_position$2.fromBufferAttribute(Kt,Jt),testPoint(_position$2,Jt,Wt,Gt,_e,Dt,this)}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}function testPoint(kt,_e,Dt,Vt,Gt,zt,jt){const Ht=_ray.distanceSqToPoint(kt);if(Ht<Dt){const Wt=new Vector3;_ray.closestPointToPoint(kt,Wt),Wt.applyMatrix4(Vt);const qt=Gt.ray.origin.distanceTo(Wt);if(qt<Gt.near||qt>Gt.far)return;zt.push({distance:qt,distanceToRay:Math.sqrt(Ht),point:Wt,index:_e,face:null,object:jt})}}class VideoTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isVideoTexture=!0,this.minFilter=jt!==void 0?jt:LinearFilter,this.magFilter=zt!==void 0?zt:LinearFilter,this.generateMipmaps=!1;const Xt=this;function Kt(){Xt.needsUpdate=!0,_e.requestVideoFrameCallback(Kt)}"requestVideoFrameCallback"in _e&&_e.requestVideoFrameCallback(Kt)}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,Dt){super({width:_e,height:Dt}),this.isFramebufferTexture=!0,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isCompressedTexture=!0,this.image={width:Dt,height:Vt},this.mipmaps=_e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,zt,jt),this.isCompressedArrayTexture=!0,this.image.depth=Gt,this.wrapR=ClampToEdgeWrapping}}class CompressedCubeTexture extends CompressedTexture{constructor(_e,Dt,Vt){super(void 0,_e[0].width,_e[0].height,Dt,Vt,CubeReflectionMapping),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=_e}}class CanvasTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),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,Dt){const Vt=this.getUtoTmapping(_e);return this.getPoint(Vt,Dt)}getPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return Dt}getSpacedPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPointAt(Vt/_e));return Dt}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 Dt=[];let Vt,Gt=this.getPoint(0),zt=0;Dt.push(0);for(let jt=1;jt<=_e;jt++)Vt=this.getPoint(jt/_e),zt+=Vt.distanceTo(Gt),Dt.push(zt),Gt=Vt;return this.cacheArcLengths=Dt,Dt}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(_e,Dt){const Vt=this.getLengths();let Gt=0;const zt=Vt.length;let jt;Dt?jt=Dt:jt=_e*Vt[zt-1];let Ht=0,Wt=zt-1,qt;for(;Ht<=Wt;)if(Gt=Math.floor(Ht+(Wt-Ht)/2),qt=Vt[Gt]-jt,qt<0)Ht=Gt+1;else if(qt>0)Wt=Gt-1;else{Wt=Gt;break}if(Gt=Wt,Vt[Gt]===jt)return Gt/(zt-1);const Xt=Vt[Gt],Yt=Vt[Gt+1]-Xt,Zt=(jt-Xt)/Yt;return(Gt+Zt)/(zt-1)}getTangent(_e,Dt){let Gt=_e-1e-4,zt=_e+1e-4;Gt<0&&(Gt=0),zt>1&&(zt=1);const jt=this.getPoint(Gt),Ht=this.getPoint(zt),Wt=Dt||(jt.isVector2?new Vector2:new Vector3);return Wt.copy(Ht).sub(jt).normalize(),Wt}getTangentAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getTangent(Vt,Dt)}computeFrenetFrames(_e,Dt){const Vt=new Vector3,Gt=[],zt=[],jt=[],Ht=new Vector3,Wt=new Matrix4;for(let Zt=0;Zt<=_e;Zt++){const Jt=Zt/_e;Gt[Zt]=this.getTangentAt(Jt,new Vector3)}zt[0]=new Vector3,jt[0]=new Vector3;let qt=Number.MAX_VALUE;const Xt=Math.abs(Gt[0].x),Kt=Math.abs(Gt[0].y),Yt=Math.abs(Gt[0].z);Xt<=qt&&(qt=Xt,Vt.set(1,0,0)),Kt<=qt&&(qt=Kt,Vt.set(0,1,0)),Yt<=qt&&Vt.set(0,0,1),Ht.crossVectors(Gt[0],Vt).normalize(),zt[0].crossVectors(Gt[0],Ht),jt[0].crossVectors(Gt[0],zt[0]);for(let Zt=1;Zt<=_e;Zt++){if(zt[Zt]=zt[Zt-1].clone(),jt[Zt]=jt[Zt-1].clone(),Ht.crossVectors(Gt[Zt-1],Gt[Zt]),Ht.length()>Number.EPSILON){Ht.normalize();const Jt=Math.acos(clamp$2(Gt[Zt-1].dot(Gt[Zt]),-1,1));zt[Zt].applyMatrix4(Wt.makeRotationAxis(Ht,Jt))}jt[Zt].crossVectors(Gt[Zt],zt[Zt])}if(Dt===!0){let Zt=Math.acos(clamp$2(zt[0].dot(zt[_e]),-1,1));Zt/=_e,Gt[0].dot(Ht.crossVectors(zt[0],zt[_e]))>0&&(Zt=-Zt);for(let Jt=1;Jt<=_e;Jt++)zt[Jt].applyMatrix4(Wt.makeRotationAxis(Gt[Jt],Zt*Jt)),jt[Jt].crossVectors(Gt[Jt],zt[Jt])}return{tangents:Gt,normals:zt,binormals:jt}}clone(){return new this.constructor().copy(this)}copy(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}toJSON(){const _e={metadata:{version:4.6,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,Dt=0,Vt=1,Gt=1,zt=0,jt=Math.PI*2,Ht=!1,Wt=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=_e,this.aY=Dt,this.xRadius=Vt,this.yRadius=Gt,this.aStartAngle=zt,this.aEndAngle=jt,this.aClockwise=Ht,this.aRotation=Wt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=Math.PI*2;let zt=this.aEndAngle-this.aStartAngle;const jt=Math.abs(zt)<Number.EPSILON;for(;zt<0;)zt+=Gt;for(;zt>Gt;)zt-=Gt;zt<Number.EPSILON&&(jt?zt=0:zt=Gt),this.aClockwise===!0&&!jt&&(zt===Gt?zt=-Gt:zt=zt-Gt);const Ht=this.aStartAngle+_e*zt;let Wt=this.aX+this.xRadius*Math.cos(Ht),qt=this.aY+this.yRadius*Math.sin(Ht);if(this.aRotation!==0){const Xt=Math.cos(this.aRotation),Kt=Math.sin(this.aRotation),Yt=Wt-this.aX,Zt=qt-this.aY;Wt=Yt*Xt-Zt*Kt+this.aX,qt=Yt*Kt+Zt*Xt+this.aY}return Vt.set(Wt,qt)}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,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,Vt,Gt,zt,jt),this.isArcCurve=!0,this.type="ArcCurve"}}function CubicPoly(){let kt=0,_e=0,Dt=0,Vt=0;function Gt(zt,jt,Ht,Wt){kt=zt,_e=Ht,Dt=-3*zt+3*jt-2*Ht-Wt,Vt=2*zt-2*jt+Ht+Wt}return{initCatmullRom:function(zt,jt,Ht,Wt,qt){Gt(jt,Ht,qt*(Ht-zt),qt*(Wt-jt))},initNonuniformCatmullRom:function(zt,jt,Ht,Wt,qt,Xt,Kt){let Yt=(jt-zt)/qt-(Ht-zt)/(qt+Xt)+(Ht-jt)/Xt,Zt=(Ht-jt)/Xt-(Wt-jt)/(Xt+Kt)+(Wt-Ht)/Kt;Yt*=Xt,Zt*=Xt,Gt(jt,Ht,Yt,Zt)},calc:function(zt){const jt=zt*zt,Ht=jt*zt;return kt+_e*zt+Dt*jt+Vt*Ht}}}const tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;class CatmullRomCurve3 extends Curve{constructor(_e=[],Dt=!1,Vt="centripetal",Gt=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=_e,this.closed=Dt,this.curveType=Vt,this.tension=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.points,zt=Gt.length,jt=(zt-(this.closed?0:1))*_e;let Ht=Math.floor(jt),Wt=jt-Ht;this.closed?Ht+=Ht>0?0:(Math.floor(Math.abs(Ht)/zt)+1)*zt:Wt===0&&Ht===zt-1&&(Ht=zt-2,Wt=1);let qt,Xt;this.closed||Ht>0?qt=Gt[(Ht-1)%zt]:(tmp.subVectors(Gt[0],Gt[1]).add(Gt[0]),qt=tmp);const Kt=Gt[Ht%zt],Yt=Gt[(Ht+1)%zt];if(this.closed||Ht+2<zt?Xt=Gt[(Ht+2)%zt]:(tmp.subVectors(Gt[zt-1],Gt[zt-2]).add(Gt[zt-1]),Xt=tmp),this.curveType==="centripetal"||this.curveType==="chordal"){const Zt=this.curveType==="chordal"?.5:.25;let Jt=Math.pow(qt.distanceToSquared(Kt),Zt),nn=Math.pow(Kt.distanceToSquared(Yt),Zt),rn=Math.pow(Yt.distanceToSquared(Xt),Zt);nn<1e-4&&(nn=1),Jt<1e-4&&(Jt=nn),rn<1e-4&&(rn=nn),px.initNonuniformCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,Jt,nn,rn),py.initNonuniformCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,Jt,nn,rn),pz.initNonuniformCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,Jt,nn,rn)}else this.curveType==="catmullrom"&&(px.initCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,this.tension),py.initCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,this.tension),pz.initCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,this.tension));return Vt.set(px.calc(Wt),py.calc(Wt),pz.calc(Wt)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e.closed=this.closed,_e.curveType=this.curveType,_e.tension=this.tension,_e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector3().fromArray(Gt))}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}}function CatmullRom(kt,_e,Dt,Vt,Gt){const zt=(Vt-_e)*.5,jt=(Gt-Dt)*.5,Ht=kt*kt,Wt=kt*Ht;return(2*Dt-2*Vt+zt+jt)*Wt+(-3*Dt+3*Vt-2*zt-jt)*Ht+zt*kt+Dt}function QuadraticBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*_e}function QuadraticBezierP1(kt,_e){return 2*(1-kt)*kt*_e}function QuadraticBezierP2(kt,_e){return kt*kt*_e}function QuadraticBezier(kt,_e,Dt,Vt){return QuadraticBezierP0(kt,_e)+QuadraticBezierP1(kt,Dt)+QuadraticBezierP2(kt,Vt)}function CubicBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*Dt*_e}function CubicBezierP1(kt,_e){const Dt=1-kt;return 3*Dt*Dt*kt*_e}function CubicBezierP2(kt,_e){return 3*(1-kt)*kt*kt*_e}function CubicBezierP3(kt,_e){return kt*kt*kt*_e}function CubicBezier(kt,_e,Dt,Vt,Gt){return CubicBezierP0(kt,_e)+CubicBezierP1(kt,Dt)+CubicBezierP2(kt,Vt)+CubicBezierP3(kt,Gt)}class CubicBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2,Gt=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y)),Vt}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,Dt=new Vector3,Vt=new Vector3,Gt=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y),CubicBezier(_e,Gt.z,zt.z,jt.z,Ht.z)),Vt}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,Dt=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector2){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector2){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}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,Dt=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector3){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector3){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}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,Dt=new Vector2,Vt=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y)),Vt}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,Dt=new Vector3,Vt=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y),QuadraticBezier(_e,Gt.z,zt.z,jt.z)),Vt}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,Dt=new Vector2){const Vt=Dt,Gt=this.points,zt=(Gt.length-1)*_e,jt=Math.floor(zt),Ht=zt-jt,Wt=Gt[jt===0?jt:jt-1],qt=Gt[jt],Xt=Gt[jt>Gt.length-2?Gt.length-1:jt+1],Kt=Gt[jt>Gt.length-3?Gt.length-1:jt+2];return Vt.set(CatmullRom(Ht,Wt.x,qt.x,Xt.x,Kt.x),CatmullRom(Ht,Wt.y,qt.y,Xt.y,Kt.y)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector2().fromArray(Gt))}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),Dt=this.curves[this.curves.length-1].getPoint(1);if(!_e.equals(Dt)){const Vt=_e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Curves[Vt](Dt,_e))}return this}getPoint(_e,Dt){const Vt=_e*this.getLength(),Gt=this.getCurveLengths();let zt=0;for(;zt<Gt.length;){if(Gt[zt]>=Vt){const jt=Gt[zt]-Vt,Ht=this.curves[zt],Wt=Ht.getLength(),qt=Wt===0?0:1-jt/Wt;return Ht.getPointAt(qt,Dt)}zt++}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 Dt=0;for(let Vt=0,Gt=this.curves.length;Vt<Gt;Vt++)Dt+=this.curves[Vt].getLength(),_e.push(Dt);return this.cacheLengths=_e,_e}getSpacedPoints(_e=40){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return this.autoClose&&Dt.push(Dt[0]),Dt}getPoints(_e=12){const Dt=[];let Vt;for(let Gt=0,zt=this.curves;Gt<zt.length;Gt++){const jt=zt[Gt],Ht=jt.isEllipseCurve?_e*2:jt.isLineCurve||jt.isLineCurve3?1:jt.isSplineCurve?_e*jt.points.length:_e,Wt=jt.getPoints(Ht);for(let qt=0;qt<Wt.length;qt++){const Xt=Wt[qt];Vt&&Vt.equals(Xt)||(Dt.push(Xt),Vt=Xt)}}return this.autoClose&&Dt.length>1&&!Dt[Dt.length-1].equals(Dt[0])&&Dt.push(Dt[0]),Dt}copy(_e){super.copy(_e),this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(Gt.clone())}return this.autoClose=_e.autoClose,this}toJSON(){const _e=super.toJSON();_e.autoClose=this.autoClose,_e.curves=[];for(let Dt=0,Vt=this.curves.length;Dt<Vt;Dt++){const Gt=this.curves[Dt];_e.curves.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.autoClose=_e.autoClose,this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(new Curves[Gt.type]().fromJSON(Gt))}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 Dt=1,Vt=_e.length;Dt<Vt;Dt++)this.lineTo(_e[Dt].x,_e[Dt].y);return this}moveTo(_e,Dt){return this.currentPoint.set(_e,Dt),this}lineTo(_e,Dt){const Vt=new LineCurve(this.currentPoint.clone(),new Vector2(_e,Dt));return this.curves.push(Vt),this.currentPoint.set(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){const zt=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt));return this.curves.push(zt),this.currentPoint.set(Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){const Ht=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt),new Vector2(zt,jt));return this.curves.push(Ht),this.currentPoint.set(zt,jt),this}splineThru(_e){const Dt=[this.currentPoint.clone()].concat(_e),Vt=new SplineCurve(Dt);return this.curves.push(Vt),this.currentPoint.copy(_e[_e.length-1]),this}arc(_e,Dt,Vt,Gt,zt,jt){const Ht=this.currentPoint.x,Wt=this.currentPoint.y;return this.absarc(_e+Ht,Dt+Wt,Vt,Gt,zt,jt),this}absarc(_e,Dt,Vt,Gt,zt,jt){return this.absellipse(_e,Dt,Vt,Vt,Gt,zt,jt),this}ellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=this.currentPoint.x,Xt=this.currentPoint.y;return this.absellipse(_e+qt,Dt+Xt,Vt,Gt,zt,jt,Ht,Wt),this}absellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=new EllipseCurve(_e,Dt,Vt,Gt,zt,jt,Ht,Wt);if(this.curves.length>0){const Kt=qt.getPoint(0);Kt.equals(this.currentPoint)||this.lineTo(Kt.x,Kt.y)}this.curves.push(qt);const Xt=qt.getPoint(1);return this.currentPoint.copy(Xt),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)],Dt=12,Vt=0,Gt=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:_e,segments:Dt,phiStart:Vt,phiLength:Gt},Dt=Math.floor(Dt),Gt=clamp$2(Gt,0,Math.PI*2);const zt=[],jt=[],Ht=[],Wt=[],qt=[],Xt=1/Dt,Kt=new Vector3,Yt=new Vector2,Zt=new Vector3,Jt=new Vector3,nn=new Vector3;let rn=0,Qt=0;for(let en=0;en<=_e.length-1;en++)switch(en){case 0:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,nn.copy(Zt),Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z);break;case _e.length-1:Wt.push(nn.x,nn.y,nn.z);break;default:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,Jt.copy(Zt),Zt.x+=nn.x,Zt.y+=nn.y,Zt.z+=nn.z,Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z),nn.copy(Jt)}for(let en=0;en<=Dt;en++){const tn=Vt+en*Xt*Gt,sn=Math.sin(tn),cn=Math.cos(tn);for(let un=0;un<=_e.length-1;un++){Kt.x=_e[un].x*sn,Kt.y=_e[un].y,Kt.z=_e[un].x*cn,jt.push(Kt.x,Kt.y,Kt.z),Yt.x=en/Dt,Yt.y=un/(_e.length-1),Ht.push(Yt.x,Yt.y);const hn=Wt[3*un+0]*sn,dn=Wt[3*un+1],pn=Wt[3*un+0]*cn;qt.push(hn,dn,pn)}}for(let en=0;en<Dt;en++)for(let tn=0;tn<_e.length-1;tn++){const sn=tn+en*_e.length,cn=sn,un=sn+_e.length,hn=sn+_e.length+1,dn=sn+1;zt.push(cn,un,dn),zt.push(hn,dn,un)}this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("uv",new Float32BufferAttribute(Ht,2)),this.setAttribute("normal",new Float32BufferAttribute(qt,3))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new LatheGeometry(_e.points,_e.segments,_e.phiStart,_e.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(_e=1,Dt=1,Vt=4,Gt=8){const zt=new Path;zt.absarc(0,-Dt/2,_e,Math.PI*1.5,0),zt.absarc(0,Dt/2,_e,0,Math.PI*.5),super(zt.getPoints(Vt),Gt),this.type="CapsuleGeometry",this.parameters={radius:_e,length:Dt,capSegments:Vt,radialSegments:Gt}}static fromJSON(_e){return new CapsuleGeometry(_e.radius,_e.length,_e.capSegments,_e.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=0,Gt=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:_e,segments:Dt,thetaStart:Vt,thetaLength:Gt},Dt=Math.max(3,Dt);const zt=[],jt=[],Ht=[],Wt=[],qt=new Vector3,Xt=new Vector2;jt.push(0,0,0),Ht.push(0,0,1),Wt.push(.5,.5);for(let Kt=0,Yt=3;Kt<=Dt;Kt++,Yt+=3){const Zt=Vt+Kt/Dt*Gt;qt.x=_e*Math.cos(Zt),qt.y=_e*Math.sin(Zt),jt.push(qt.x,qt.y,qt.z),Ht.push(0,0,1),Xt.x=(jt[Yt]/_e+1)/2,Xt.y=(jt[Yt+1]/_e+1)/2,Wt.push(Xt.x,Xt.y)}for(let Kt=1;Kt<=Dt;Kt++)zt.push(Kt,Kt+1,0);this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("normal",new Float32BufferAttribute(Ht,3)),this.setAttribute("uv",new Float32BufferAttribute(Wt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CircleGeometry(_e.radius,_e.segments,_e.thetaStart,_e.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(_e=1,Dt=1,Vt=1,Gt=32,zt=1,jt=!1,Ht=0,Wt=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:_e,radiusBottom:Dt,height:Vt,radialSegments:Gt,heightSegments:zt,openEnded:jt,thetaStart:Ht,thetaLength:Wt};const qt=this;Gt=Math.floor(Gt),zt=Math.floor(zt);const Xt=[],Kt=[],Yt=[],Zt=[];let Jt=0;const nn=[],rn=Vt/2;let Qt=0;en(),jt===!1&&(_e>0&&tn(!0),Dt>0&&tn(!1)),this.setIndex(Xt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function en(){const sn=new Vector3,cn=new Vector3;let un=0;const hn=(Dt-_e)/Vt;for(let dn=0;dn<=zt;dn++){const pn=[],fn=dn/zt,mn=fn*(Dt-_e)+_e;for(let vn=0;vn<=Gt;vn++){const _n=vn/Gt,En=_n*Wt+Ht,An=Math.sin(En),Tn=Math.cos(En);cn.x=mn*An,cn.y=-fn*Vt+rn,cn.z=mn*Tn,Kt.push(cn.x,cn.y,cn.z),sn.set(An,hn,Tn).normalize(),Yt.push(sn.x,sn.y,sn.z),Zt.push(_n,1-fn),pn.push(Jt++)}nn.push(pn)}for(let dn=0;dn<Gt;dn++)for(let pn=0;pn<zt;pn++){const fn=nn[pn][dn],mn=nn[pn+1][dn],vn=nn[pn+1][dn+1],_n=nn[pn][dn+1];Xt.push(fn,mn,_n),Xt.push(mn,vn,_n),un+=6}qt.addGroup(Qt,un,0),Qt+=un}function tn(sn){const cn=Jt,un=new Vector2,hn=new Vector3;let dn=0;const pn=sn===!0?_e:Dt,fn=sn===!0?1:-1;for(let vn=1;vn<=Gt;vn++)Kt.push(0,rn*fn,0),Yt.push(0,fn,0),Zt.push(.5,.5),Jt++;const mn=Jt;for(let vn=0;vn<=Gt;vn++){const En=vn/Gt*Wt+Ht,An=Math.cos(En),Tn=Math.sin(En);hn.x=pn*Tn,hn.y=rn*fn,hn.z=pn*An,Kt.push(hn.x,hn.y,hn.z),Yt.push(0,fn,0),un.x=An*.5+.5,un.y=Tn*.5*fn+.5,Zt.push(un.x,un.y),Jt++}for(let vn=0;vn<Gt;vn++){const _n=cn+vn,En=mn+vn;sn===!0?Xt.push(En,En+1,_n):Xt.push(En+1,En,_n),dn+=3}qt.addGroup(Qt,dn,sn===!0?1:2),Qt+=dn}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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,Dt=1,Vt=32,Gt=1,zt=!1,jt=0,Ht=Math.PI*2){super(0,_e,Dt,Vt,Gt,zt,jt,Ht),this.type="ConeGeometry",this.parameters={radius:_e,height:Dt,radialSegments:Vt,heightSegments:Gt,openEnded:zt,thetaStart:jt,thetaLength:Ht}}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=[],Dt=[],Vt=1,Gt=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:_e,indices:Dt,radius:Vt,detail:Gt};const zt=[],jt=[];Ht(Gt),qt(Vt),Xt(),this.setAttribute("position",new Float32BufferAttribute(zt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2)),Gt===0?this.computeVertexNormals():this.normalizeNormals();function Ht(en){const tn=new Vector3,sn=new Vector3,cn=new Vector3;for(let un=0;un<Dt.length;un+=3)Zt(Dt[un+0],tn),Zt(Dt[un+1],sn),Zt(Dt[un+2],cn),Wt(tn,sn,cn,en)}function Wt(en,tn,sn,cn){const un=cn+1,hn=[];for(let dn=0;dn<=un;dn++){hn[dn]=[];const pn=en.clone().lerp(sn,dn/un),fn=tn.clone().lerp(sn,dn/un),mn=un-dn;for(let vn=0;vn<=mn;vn++)vn===0&&dn===un?hn[dn][vn]=pn:hn[dn][vn]=pn.clone().lerp(fn,vn/mn)}for(let dn=0;dn<un;dn++)for(let pn=0;pn<2*(un-dn)-1;pn++){const fn=Math.floor(pn/2);pn%2===0?(Yt(hn[dn][fn+1]),Yt(hn[dn+1][fn]),Yt(hn[dn][fn])):(Yt(hn[dn][fn+1]),Yt(hn[dn+1][fn+1]),Yt(hn[dn+1][fn]))}}function qt(en){const tn=new Vector3;for(let sn=0;sn<zt.length;sn+=3)tn.x=zt[sn+0],tn.y=zt[sn+1],tn.z=zt[sn+2],tn.normalize().multiplyScalar(en),zt[sn+0]=tn.x,zt[sn+1]=tn.y,zt[sn+2]=tn.z}function Xt(){const en=new Vector3;for(let tn=0;tn<zt.length;tn+=3){en.x=zt[tn+0],en.y=zt[tn+1],en.z=zt[tn+2];const sn=rn(en)/2/Math.PI+.5,cn=Qt(en)/Math.PI+.5;jt.push(sn,1-cn)}Jt(),Kt()}function Kt(){for(let en=0;en<jt.length;en+=6){const tn=jt[en+0],sn=jt[en+2],cn=jt[en+4],un=Math.max(tn,sn,cn),hn=Math.min(tn,sn,cn);un>.9&&hn<.1&&(tn<.2&&(jt[en+0]+=1),sn<.2&&(jt[en+2]+=1),cn<.2&&(jt[en+4]+=1))}}function Yt(en){zt.push(en.x,en.y,en.z)}function Zt(en,tn){const sn=en*3;tn.x=_e[sn+0],tn.y=_e[sn+1],tn.z=_e[sn+2]}function Jt(){const en=new Vector3,tn=new Vector3,sn=new Vector3,cn=new Vector3,un=new Vector2,hn=new Vector2,dn=new Vector2;for(let pn=0,fn=0;pn<zt.length;pn+=9,fn+=6){en.set(zt[pn+0],zt[pn+1],zt[pn+2]),tn.set(zt[pn+3],zt[pn+4],zt[pn+5]),sn.set(zt[pn+6],zt[pn+7],zt[pn+8]),un.set(jt[fn+0],jt[fn+1]),hn.set(jt[fn+2],jt[fn+3]),dn.set(jt[fn+4],jt[fn+5]),cn.copy(en).add(tn).add(sn).divideScalar(3);const mn=rn(cn);nn(un,fn+0,en,mn),nn(hn,fn+2,tn,mn),nn(dn,fn+4,sn,mn)}}function nn(en,tn,sn,cn){cn<0&&en.x===1&&(jt[tn]=en.x-1),sn.x===0&&sn.z===0&&(jt[tn]=cn/2/Math.PI+.5)}function rn(en){return Math.atan2(en.z,-en.x)}function Qt(en){return Math.atan2(-en.y,Math.sqrt(en.x*en.x+en.z*en.z))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new PolyhedronGeometry(_e.vertices,_e.indices,_e.radius,_e.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=1/Vt,zt=[-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,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,0,-Vt,0,-Gt,Vt,0,-Gt,-Vt,0,Gt,Vt,0,Gt],jt=[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,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(zt,jt,_e,Dt),this.type="DodecahedronGeometry",this.parameters={radius:_e,detail:Dt}}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,Dt=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:_e,thresholdAngle:Dt},_e!==null){const Gt=Math.pow(10,4),zt=Math.cos(DEG2RAD$1*Dt),jt=_e.getIndex(),Ht=_e.getAttribute("position"),Wt=jt?jt.count:Ht.count,qt=[0,0,0],Xt=["a","b","c"],Kt=new Array(3),Yt={},Zt=[];for(let Jt=0;Jt<Wt;Jt+=3){jt?(qt[0]=jt.getX(Jt),qt[1]=jt.getX(Jt+1),qt[2]=jt.getX(Jt+2)):(qt[0]=Jt,qt[1]=Jt+1,qt[2]=Jt+2);const{a:nn,b:rn,c:Qt}=_triangle;if(nn.fromBufferAttribute(Ht,qt[0]),rn.fromBufferAttribute(Ht,qt[1]),Qt.fromBufferAttribute(Ht,qt[2]),_triangle.getNormal(_normal),Kt[0]=`${Math.round(nn.x*Gt)},${Math.round(nn.y*Gt)},${Math.round(nn.z*Gt)}`,Kt[1]=`${Math.round(rn.x*Gt)},${Math.round(rn.y*Gt)},${Math.round(rn.z*Gt)}`,Kt[2]=`${Math.round(Qt.x*Gt)},${Math.round(Qt.y*Gt)},${Math.round(Qt.z*Gt)}`,!(Kt[0]===Kt[1]||Kt[1]===Kt[2]||Kt[2]===Kt[0]))for(let en=0;en<3;en++){const tn=(en+1)%3,sn=Kt[en],cn=Kt[tn],un=_triangle[Xt[en]],hn=_triangle[Xt[tn]],dn=`${sn}_${cn}`,pn=`${cn}_${sn}`;pn in Yt&&Yt[pn]?(_normal.dot(Yt[pn].normal)<=zt&&(Zt.push(un.x,un.y,un.z),Zt.push(hn.x,hn.y,hn.z)),Yt[pn]=null):dn in Yt||(Yt[dn]={index0:qt[en],index1:qt[tn],normal:_normal.clone()})}}for(const Jt in Yt)if(Yt[Jt]){const{index0:nn,index1:rn}=Yt[Jt];_v0.fromBufferAttribute(Ht,nn),_v1$1.fromBufferAttribute(Ht,rn),Zt.push(_v0.x,_v0.y,_v0.z),Zt.push(_v1$1.x,_v1$1.y,_v1$1.z)}this.setAttribute("position",new Float32BufferAttribute(Zt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}class Shape extends Path{constructor(_e){super(_e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(_e){const Dt=[];for(let Vt=0,Gt=this.holes.length;Vt<Gt;Vt++)Dt[Vt]=this.holes[Vt].getPoints(_e);return Dt}extractPoints(_e){return{shape:this.getPoints(_e),holes:this.getPointsHoles(_e)}}copy(_e){super.copy(_e),this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.uuid=this.uuid,_e.holes=[];for(let Dt=0,Vt=this.holes.length;Dt<Vt;Dt++){const Gt=this.holes[Dt];_e.holes.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.uuid=_e.uuid,this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(new Path().fromJSON(Gt))}return this}}const Earcut={triangulate:function(kt,_e,Dt=2){const Vt=_e&&_e.length,Gt=Vt?_e[0]*Dt:kt.length;let zt=linkedList(kt,0,Gt,Dt,!0);const jt=[];if(!zt||zt.next===zt.prev)return jt;let Ht,Wt,qt,Xt,Kt,Yt,Zt;if(Vt&&(zt=eliminateHoles(kt,_e,zt,Dt)),kt.length>80*Dt){Ht=qt=kt[0],Wt=Xt=kt[1];for(let Jt=Dt;Jt<Gt;Jt+=Dt)Kt=kt[Jt],Yt=kt[Jt+1],Kt<Ht&&(Ht=Kt),Yt<Wt&&(Wt=Yt),Kt>qt&&(qt=Kt),Yt>Xt&&(Xt=Yt);Zt=Math.max(qt-Ht,Xt-Wt),Zt=Zt!==0?32767/Zt:0}return earcutLinked(zt,jt,Dt,Ht,Wt,Zt,0),jt}};function linkedList(kt,_e,Dt,Vt,Gt){let zt,jt;if(Gt===signedArea(kt,_e,Dt,Vt)>0)for(zt=_e;zt<Dt;zt+=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);else for(zt=Dt-Vt;zt>=_e;zt-=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);return jt&&equals(jt,jt.next)&&(removeNode(jt),jt=jt.next),jt}function filterPoints(kt,_e){if(!kt)return kt;_e||(_e=kt);let Dt=kt,Vt;do if(Vt=!1,!Dt.steiner&&(equals(Dt,Dt.next)||area$1(Dt.prev,Dt,Dt.next)===0)){if(removeNode(Dt),Dt=_e=Dt.prev,Dt===Dt.next)break;Vt=!0}else Dt=Dt.next;while(Vt||Dt!==_e);return _e}function earcutLinked(kt,_e,Dt,Vt,Gt,zt,jt){if(!kt)return;!jt&&zt&&indexCurve(kt,Vt,Gt,zt);let Ht=kt,Wt,qt;for(;kt.prev!==kt.next;){if(Wt=kt.prev,qt=kt.next,zt?isEarHashed(kt,Vt,Gt,zt):isEar(kt)){_e.push(Wt.i/Dt|0),_e.push(kt.i/Dt|0),_e.push(qt.i/Dt|0),removeNode(kt),kt=qt.next,Ht=qt.next;continue}if(kt=qt,kt===Ht){jt?jt===1?(kt=cureLocalIntersections(filterPoints(kt),_e,Dt),earcutLinked(kt,_e,Dt,Vt,Gt,zt,2)):jt===2&&splitEarcut(kt,_e,Dt,Vt,Gt,zt):earcutLinked(filterPoints(kt),_e,Dt,Vt,Gt,zt,1);break}}}function isEar(kt){const _e=kt.prev,Dt=kt,Vt=kt.next;if(area$1(_e,Dt,Vt)>=0)return!1;const Gt=_e.x,zt=Dt.x,jt=Vt.x,Ht=_e.y,Wt=Dt.y,qt=Vt.y,Xt=Gt<zt?Gt<jt?Gt:jt:zt<jt?zt:jt,Kt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Yt=Gt>zt?Gt>jt?Gt:jt:zt>jt?zt:jt,Zt=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt;let Jt=Vt.next;for(;Jt!==_e;){if(Jt.x>=Xt&&Jt.x<=Yt&&Jt.y>=Kt&&Jt.y<=Zt&&pointInTriangle(Gt,Ht,zt,Wt,jt,qt,Jt.x,Jt.y)&&area$1(Jt.prev,Jt,Jt.next)>=0)return!1;Jt=Jt.next}return!0}function isEarHashed(kt,_e,Dt,Vt){const Gt=kt.prev,zt=kt,jt=kt.next;if(area$1(Gt,zt,jt)>=0)return!1;const Ht=Gt.x,Wt=zt.x,qt=jt.x,Xt=Gt.y,Kt=zt.y,Yt=jt.y,Zt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Jt=Xt<Kt?Xt<Yt?Xt:Yt:Kt<Yt?Kt:Yt,nn=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt,rn=Xt>Kt?Xt>Yt?Xt:Yt:Kt>Yt?Kt:Yt,Qt=zOrder(Zt,Jt,_e,Dt,Vt),en=zOrder(nn,rn,_e,Dt,Vt);let tn=kt.prevZ,sn=kt.nextZ;for(;tn&&tn.z>=Qt&&sn&&sn.z<=en;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0||(tn=tn.prevZ,sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0))return!1;sn=sn.nextZ}for(;tn&&tn.z>=Qt;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0)return!1;tn=tn.prevZ}for(;sn&&sn.z<=en;){if(sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0)return!1;sn=sn.nextZ}return!0}function cureLocalIntersections(kt,_e,Dt){let Vt=kt;do{const Gt=Vt.prev,zt=Vt.next.next;!equals(Gt,zt)&&intersects(Gt,Vt,Vt.next,zt)&&locallyInside(Gt,zt)&&locallyInside(zt,Gt)&&(_e.push(Gt.i/Dt|0),_e.push(Vt.i/Dt|0),_e.push(zt.i/Dt|0),removeNode(Vt),removeNode(Vt.next),Vt=kt=zt),Vt=Vt.next}while(Vt!==kt);return filterPoints(Vt)}function splitEarcut(kt,_e,Dt,Vt,Gt,zt){let jt=kt;do{let Ht=jt.next.next;for(;Ht!==jt.prev;){if(jt.i!==Ht.i&&isValidDiagonal(jt,Ht)){let Wt=splitPolygon(jt,Ht);jt=filterPoints(jt,jt.next),Wt=filterPoints(Wt,Wt.next),earcutLinked(jt,_e,Dt,Vt,Gt,zt,0),earcutLinked(Wt,_e,Dt,Vt,Gt,zt,0);return}Ht=Ht.next}jt=jt.next}while(jt!==kt)}function eliminateHoles(kt,_e,Dt,Vt){const Gt=[];let zt,jt,Ht,Wt,qt;for(zt=0,jt=_e.length;zt<jt;zt++)Ht=_e[zt]*Vt,Wt=zt<jt-1?_e[zt+1]*Vt:kt.length,qt=linkedList(kt,Ht,Wt,Vt,!1),qt===qt.next&&(qt.steiner=!0),Gt.push(getLeftmost(qt));for(Gt.sort(compareX),zt=0;zt<Gt.length;zt++)Dt=eliminateHole(Gt[zt],Dt);return Dt}function compareX(kt,_e){return kt.x-_e.x}function eliminateHole(kt,_e){const Dt=findHoleBridge(kt,_e);if(!Dt)return _e;const Vt=splitPolygon(Dt,kt);return filterPoints(Vt,Vt.next),filterPoints(Dt,Dt.next)}function findHoleBridge(kt,_e){let Dt=_e,Vt=-1/0,Gt;const zt=kt.x,jt=kt.y;do{if(jt<=Dt.y&&jt>=Dt.next.y&&Dt.next.y!==Dt.y){const Yt=Dt.x+(jt-Dt.y)*(Dt.next.x-Dt.x)/(Dt.next.y-Dt.y);if(Yt<=zt&&Yt>Vt&&(Vt=Yt,Gt=Dt.x<Dt.next.x?Dt:Dt.next,Yt===zt))return Gt}Dt=Dt.next}while(Dt!==_e);if(!Gt)return null;const Ht=Gt,Wt=Gt.x,qt=Gt.y;let Xt=1/0,Kt;Dt=Gt;do zt>=Dt.x&&Dt.x>=Wt&&zt!==Dt.x&&pointInTriangle(jt<qt?zt:Vt,jt,Wt,qt,jt<qt?Vt:zt,jt,Dt.x,Dt.y)&&(Kt=Math.abs(jt-Dt.y)/(zt-Dt.x),locallyInside(Dt,kt)&&(Kt<Xt||Kt===Xt&&(Dt.x>Gt.x||Dt.x===Gt.x&&sectorContainsSector(Gt,Dt)))&&(Gt=Dt,Xt=Kt)),Dt=Dt.next;while(Dt!==Ht);return Gt}function sectorContainsSector(kt,_e){return area$1(kt.prev,kt,_e.prev)<0&&area$1(_e.next,kt,kt.next)<0}function indexCurve(kt,_e,Dt,Vt){let Gt=kt;do Gt.z===0&&(Gt.z=zOrder(Gt.x,Gt.y,_e,Dt,Vt)),Gt.prevZ=Gt.prev,Gt.nextZ=Gt.next,Gt=Gt.next;while(Gt!==kt);Gt.prevZ.nextZ=null,Gt.prevZ=null,sortLinked(Gt)}function sortLinked(kt){let _e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt=1;do{for(Dt=kt,kt=null,zt=null,jt=0;Dt;){for(jt++,Vt=Dt,Ht=0,_e=0;_e<qt&&(Ht++,Vt=Vt.nextZ,!!Vt);_e++);for(Wt=qt;Ht>0||Wt>0&&Vt;)Ht!==0&&(Wt===0||!Vt||Dt.z<=Vt.z)?(Gt=Dt,Dt=Dt.nextZ,Ht--):(Gt=Vt,Vt=Vt.nextZ,Wt--),zt?zt.nextZ=Gt:kt=Gt,Gt.prevZ=zt,zt=Gt;Dt=Vt}zt.nextZ=null,qt*=2}while(jt>1);return kt}function zOrder(kt,_e,Dt,Vt,Gt){return kt=(kt-Dt)*Gt|0,_e=(_e-Vt)*Gt|0,kt=(kt|kt<<8)&16711935,kt=(kt|kt<<4)&252645135,kt=(kt|kt<<2)&858993459,kt=(kt|kt<<1)&1431655765,_e=(_e|_e<<8)&16711935,_e=(_e|_e<<4)&252645135,_e=(_e|_e<<2)&858993459,_e=(_e|_e<<1)&1431655765,kt|_e<<1}function getLeftmost(kt){let _e=kt,Dt=kt;do(_e.x<Dt.x||_e.x===Dt.x&&_e.y<Dt.y)&&(Dt=_e),_e=_e.next;while(_e!==kt);return Dt}function pointInTriangle(kt,_e,Dt,Vt,Gt,zt,jt,Ht){return(Gt-jt)*(_e-Ht)>=(kt-jt)*(zt-Ht)&&(kt-jt)*(Vt-Ht)>=(Dt-jt)*(_e-Ht)&&(Dt-jt)*(zt-Ht)>=(Gt-jt)*(Vt-Ht)}function isValidDiagonal(kt,_e){return kt.next.i!==_e.i&&kt.prev.i!==_e.i&&!intersectsPolygon(kt,_e)&&(locallyInside(kt,_e)&&locallyInside(_e,kt)&&middleInside(kt,_e)&&(area$1(kt.prev,kt,_e.prev)||area$1(kt,_e.prev,_e))||equals(kt,_e)&&area$1(kt.prev,kt,kt.next)>0&&area$1(_e.prev,_e,_e.next)>0)}function area$1(kt,_e,Dt){return(_e.y-kt.y)*(Dt.x-_e.x)-(_e.x-kt.x)*(Dt.y-_e.y)}function equals(kt,_e){return kt.x===_e.x&&kt.y===_e.y}function intersects(kt,_e,Dt,Vt){const Gt=sign(area$1(kt,_e,Dt)),zt=sign(area$1(kt,_e,Vt)),jt=sign(area$1(Dt,Vt,kt)),Ht=sign(area$1(Dt,Vt,_e));return!!(Gt!==zt&&jt!==Ht||Gt===0&&onSegment(kt,Dt,_e)||zt===0&&onSegment(kt,Vt,_e)||jt===0&&onSegment(Dt,kt,Vt)||Ht===0&&onSegment(Dt,_e,Vt))}function onSegment(kt,_e,Dt){return _e.x<=Math.max(kt.x,Dt.x)&&_e.x>=Math.min(kt.x,Dt.x)&&_e.y<=Math.max(kt.y,Dt.y)&&_e.y>=Math.min(kt.y,Dt.y)}function sign(kt){return kt>0?1:kt<0?-1:0}function intersectsPolygon(kt,_e){let Dt=kt;do{if(Dt.i!==kt.i&&Dt.next.i!==kt.i&&Dt.i!==_e.i&&Dt.next.i!==_e.i&&intersects(Dt,Dt.next,kt,_e))return!0;Dt=Dt.next}while(Dt!==kt);return!1}function locallyInside(kt,_e){return area$1(kt.prev,kt,kt.next)<0?area$1(kt,_e,kt.next)>=0&&area$1(kt,kt.prev,_e)>=0:area$1(kt,_e,kt.prev)<0||area$1(kt,kt.next,_e)<0}function middleInside(kt,_e){let Dt=kt,Vt=!1;const Gt=(kt.x+_e.x)/2,zt=(kt.y+_e.y)/2;do Dt.y>zt!=Dt.next.y>zt&&Dt.next.y!==Dt.y&&Gt<(Dt.next.x-Dt.x)*(zt-Dt.y)/(Dt.next.y-Dt.y)+Dt.x&&(Vt=!Vt),Dt=Dt.next;while(Dt!==kt);return Vt}function splitPolygon(kt,_e){const Dt=new Node$2(kt.i,kt.x,kt.y),Vt=new Node$2(_e.i,_e.x,_e.y),Gt=kt.next,zt=_e.prev;return kt.next=_e,_e.prev=kt,Dt.next=Gt,Gt.prev=Dt,Vt.next=Dt,Dt.prev=Vt,zt.next=Vt,Vt.prev=zt,Vt}function insertNode(kt,_e,Dt,Vt){const Gt=new Node$2(kt,_e,Dt);return Vt?(Gt.next=Vt.next,Gt.prev=Vt,Vt.next.prev=Gt,Vt.next=Gt):(Gt.prev=Gt,Gt.next=Gt),Gt}function removeNode(kt){kt.next.prev=kt.prev,kt.prev.next=kt.next,kt.prevZ&&(kt.prevZ.nextZ=kt.nextZ),kt.nextZ&&(kt.nextZ.prevZ=kt.prevZ)}function Node$2(kt,_e,Dt){this.i=kt,this.x=_e,this.y=Dt,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(kt,_e,Dt,Vt){let Gt=0;for(let zt=_e,jt=Dt-Vt;zt<Dt;zt+=Vt)Gt+=(kt[jt]-kt[zt])*(kt[zt+1]+kt[jt+1]),jt=zt;return Gt}class ShapeUtils{static area(_e){const Dt=_e.length;let Vt=0;for(let Gt=Dt-1,zt=0;zt<Dt;Gt=zt++)Vt+=_e[Gt].x*_e[zt].y-_e[zt].x*_e[Gt].y;return Vt*.5}static isClockWise(_e){return ShapeUtils.area(_e)<0}static triangulateShape(_e,Dt){const Vt=[],Gt=[],zt=[];removeDupEndPts(_e),addContour(Vt,_e);let jt=_e.length;Dt.forEach(removeDupEndPts);for(let Wt=0;Wt<Dt.length;Wt++)Gt.push(jt),jt+=Dt[Wt].length,addContour(Vt,Dt[Wt]);const Ht=Earcut.triangulate(Vt,Gt);for(let Wt=0;Wt<Ht.length;Wt+=3)zt.push(Ht.slice(Wt,Wt+3));return zt}}function removeDupEndPts(kt){const _e=kt.length;_e>2&&kt[_e-1].equals(kt[0])&&kt.pop()}function addContour(kt,_e){for(let Dt=0;Dt<_e.length;Dt++)kt.push(_e[Dt].x),kt.push(_e[Dt].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)]),Dt={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:_e,options:Dt},_e=Array.isArray(_e)?_e:[_e];const Vt=this,Gt=[],zt=[];for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht];jt(qt)}this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("uv",new Float32BufferAttribute(zt,2)),this.computeVertexNormals();function jt(Ht){const Wt=[],qt=Dt.curveSegments!==void 0?Dt.curveSegments:12,Xt=Dt.steps!==void 0?Dt.steps:1,Kt=Dt.depth!==void 0?Dt.depth:1;let Yt=Dt.bevelEnabled!==void 0?Dt.bevelEnabled:!0,Zt=Dt.bevelThickness!==void 0?Dt.bevelThickness:.2,Jt=Dt.bevelSize!==void 0?Dt.bevelSize:Zt-.1,nn=Dt.bevelOffset!==void 0?Dt.bevelOffset:0,rn=Dt.bevelSegments!==void 0?Dt.bevelSegments:3;const Qt=Dt.extrudePath,en=Dt.UVGenerator!==void 0?Dt.UVGenerator:WorldUVGenerator;let tn,sn=!1,cn,un,hn,dn;Qt&&(tn=Qt.getSpacedPoints(Xt),sn=!0,Yt=!1,cn=Qt.computeFrenetFrames(Xt,!1),un=new Vector3,hn=new Vector3,dn=new Vector3),Yt||(rn=0,Zt=0,Jt=0,nn=0);const pn=Ht.extractPoints(qt);let fn=pn.shape;const mn=pn.holes;if(!ShapeUtils.isClockWise(fn)){fn=fn.reverse();for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];ShapeUtils.isClockWise(sr)&&(mn[ur]=sr.reverse())}}const _n=ShapeUtils.triangulateShape(fn,mn),En=fn;for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];fn=fn.concat(sr)}function An(ur,Hn,sr){return Hn||console.error("THREE.ExtrudeGeometry: vec does not exist"),ur.clone().addScaledVector(Hn,sr)}const Tn=fn.length,Cn=_n.length;function yn(ur,Hn,sr){let vr,fr,Un;const In=ur.x-Hn.x,jn=ur.y-Hn.y,or=sr.x-ur.x,cr=sr.y-ur.y,ar=In*In+jn*jn,gr=In*cr-jn*or;if(Math.abs(gr)>Number.EPSILON){const mr=Math.sqrt(ar),Ar=Math.sqrt(or*or+cr*cr),Lr=Hn.x-jn/mr,Cr=Hn.y+In/mr,Rr=sr.x-cr/Ar,zr=sr.y+or/Ar,Pr=((Rr-Lr)*cr-(zr-Cr)*or)/(In*cr-jn*or);vr=Lr+In*Pr-ur.x,fr=Cr+jn*Pr-ur.y;const Fr=vr*vr+fr*fr;if(Fr<=2)return new Vector2(vr,fr);Un=Math.sqrt(Fr/2)}else{let mr=!1;In>Number.EPSILON?or>Number.EPSILON&&(mr=!0):In<-Number.EPSILON?or<-Number.EPSILON&&(mr=!0):Math.sign(jn)===Math.sign(cr)&&(mr=!0),mr?(vr=-jn,fr=In,Un=Math.sqrt(ar)):(vr=In,fr=jn,Un=Math.sqrt(ar/2))}return new Vector2(vr/Un,fr/Un)}const Sn=[];for(let ur=0,Hn=En.length,sr=Hn-1,vr=ur+1;ur<Hn;ur++,sr++,vr++)sr===Hn&&(sr=0),vr===Hn&&(vr=0),Sn[ur]=yn(En[ur],En[sr],En[vr]);const wn=[];let xn,Rn=Sn.concat();for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];xn=[];for(let vr=0,fr=sr.length,Un=fr-1,In=vr+1;vr<fr;vr++,Un++,In++)Un===fr&&(Un=0),In===fr&&(In=0),xn[vr]=yn(sr[vr],sr[Un],sr[In]);wn.push(xn),Rn=Rn.concat(xn)}for(let ur=0;ur<rn;ur++){const Hn=ur/rn,sr=Zt*Math.cos(Hn*Math.PI/2),vr=Jt*Math.sin(Hn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],vr);Bn(In.x,In.y,-sr)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,or=In.length;jn<or;jn++){const cr=An(In[jn],xn[jn],vr);Bn(cr.x,cr.y,-sr)}}}const Dn=Jt+nn;for(let ur=0;ur<Tn;ur++){const Hn=Yt?An(fn[ur],Rn[ur],Dn):fn[ur];sn?(hn.copy(cn.normals[0]).multiplyScalar(Hn.x),un.copy(cn.binormals[0]).multiplyScalar(Hn.y),dn.copy(tn[0]).add(hn).add(un),Bn(dn.x,dn.y,dn.z)):Bn(Hn.x,Hn.y,0)}for(let ur=1;ur<=Xt;ur++)for(let Hn=0;Hn<Tn;Hn++){const sr=Yt?An(fn[Hn],Rn[Hn],Dn):fn[Hn];sn?(hn.copy(cn.normals[ur]).multiplyScalar(sr.x),un.copy(cn.binormals[ur]).multiplyScalar(sr.y),dn.copy(tn[ur]).add(hn).add(un),Bn(dn.x,dn.y,dn.z)):Bn(sr.x,sr.y,Kt/Xt*ur)}for(let ur=rn-1;ur>=0;ur--){const Hn=ur/rn,sr=Zt*Math.cos(Hn*Math.PI/2),vr=Jt*Math.sin(Hn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],vr);Bn(In.x,In.y,Kt+sr)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,or=In.length;jn<or;jn++){const cr=An(In[jn],xn[jn],vr);sn?Bn(cr.x,cr.y+tn[Xt-1].y,tn[Xt-1].x+sr):Bn(cr.x,cr.y,Kt+sr)}}}kn(),Fn();function kn(){const ur=Gt.length/3;if(Yt){let Hn=0,sr=Tn*Hn;for(let vr=0;vr<Cn;vr++){const fr=_n[vr];qn(fr[2]+sr,fr[1]+sr,fr[0]+sr)}Hn=Xt+rn*2,sr=Tn*Hn;for(let vr=0;vr<Cn;vr++){const fr=_n[vr];qn(fr[0]+sr,fr[1]+sr,fr[2]+sr)}}else{for(let Hn=0;Hn<Cn;Hn++){const sr=_n[Hn];qn(sr[2],sr[1],sr[0])}for(let Hn=0;Hn<Cn;Hn++){const sr=_n[Hn];qn(sr[0]+Tn*Xt,sr[1]+Tn*Xt,sr[2]+Tn*Xt)}}Vt.addGroup(ur,Gt.length/3-ur,0)}function Fn(){const ur=Gt.length/3;let Hn=0;Pn(En,Hn),Hn+=En.length;for(let sr=0,vr=mn.length;sr<vr;sr++){const fr=mn[sr];Pn(fr,Hn),Hn+=fr.length}Vt.addGroup(ur,Gt.length/3-ur,1)}function Pn(ur,Hn){let sr=ur.length;for(;--sr>=0;){const vr=sr;let fr=sr-1;fr<0&&(fr=ur.length-1);for(let Un=0,In=Xt+rn*2;Un<In;Un++){const jn=Tn*Un,or=Tn*(Un+1),cr=Hn+vr+jn,ar=Hn+fr+jn,gr=Hn+fr+or,mr=Hn+vr+or;tr(cr,ar,gr,mr)}}}function Bn(ur,Hn,sr){Wt.push(ur),Wt.push(Hn),Wt.push(sr)}function qn(ur,Hn,sr){lr(ur),lr(Hn),lr(sr);const vr=Gt.length/3,fr=en.generateTopUV(Vt,Gt,vr-3,vr-2,vr-1);zn(fr[0]),zn(fr[1]),zn(fr[2])}function tr(ur,Hn,sr,vr){lr(ur),lr(Hn),lr(vr),lr(Hn),lr(sr),lr(vr);const fr=Gt.length/3,Un=en.generateSideWallUV(Vt,Gt,fr-6,fr-3,fr-2,fr-1);zn(Un[0]),zn(Un[1]),zn(Un[3]),zn(Un[1]),zn(Un[2]),zn(Un[3])}function lr(ur){Gt.push(Wt[ur*3+0]),Gt.push(Wt[ur*3+1]),Gt.push(Wt[ur*3+2])}function zn(ur){zt.push(ur.x),zt.push(ur.y)}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes,Vt=this.parameters.options;return toJSON$1(Dt,Vt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let zt=0,jt=_e.shapes.length;zt<jt;zt++){const Ht=Dt[_e.shapes[zt]];Vt.push(Ht)}const Gt=_e.options.extrudePath;return Gt!==void 0&&(_e.options.extrudePath=new Curves[Gt.type]().fromJSON(Gt)),new ExtrudeGeometry(Vt,_e.options)}}const WorldUVGenerator={generateTopUV:function(kt,_e,Dt,Vt,Gt){const zt=_e[Dt*3],jt=_e[Dt*3+1],Ht=_e[Vt*3],Wt=_e[Vt*3+1],qt=_e[Gt*3],Xt=_e[Gt*3+1];return[new Vector2(zt,jt),new Vector2(Ht,Wt),new Vector2(qt,Xt)]},generateSideWallUV:function(kt,_e,Dt,Vt,Gt,zt){const jt=_e[Dt*3],Ht=_e[Dt*3+1],Wt=_e[Dt*3+2],qt=_e[Vt*3],Xt=_e[Vt*3+1],Kt=_e[Vt*3+2],Yt=_e[Gt*3],Zt=_e[Gt*3+1],Jt=_e[Gt*3+2],nn=_e[zt*3],rn=_e[zt*3+1],Qt=_e[zt*3+2];return Math.abs(Ht-Xt)<Math.abs(jt-qt)?[new Vector2(jt,1-Wt),new Vector2(qt,1-Kt),new Vector2(Yt,1-Jt),new Vector2(nn,1-Qt)]:[new Vector2(Ht,1-Wt),new Vector2(Xt,1-Kt),new Vector2(Zt,1-Jt),new Vector2(rn,1-Qt)]}};function toJSON$1(kt,_e,Dt){if(Dt.shapes=[],Array.isArray(kt))for(let Vt=0,Gt=kt.length;Vt<Gt;Vt++){const zt=kt[Vt];Dt.shapes.push(zt.uuid)}else Dt.shapes.push(kt.uuid);return Dt.options=Object.assign({},_e),_e.extrudePath!==void 0&&(Dt.options.extrudePath=_e.extrudePath.toJSON()),Dt}class IcosahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=[-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,0,0,-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,Vt,0,-1,Vt,0,1,-Vt,0,-1,-Vt,0,1],zt=[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(Gt,zt,_e,Dt),this.type="IcosahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new IcosahedronGeometry(_e.radius,_e.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Gt=[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(Vt,Gt,_e,Dt),this.type="OctahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new OctahedronGeometry(_e.radius,_e.detail)}}class RingGeometry extends BufferGeometry{constructor(_e=.5,Dt=1,Vt=32,Gt=1,zt=0,jt=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:_e,outerRadius:Dt,thetaSegments:Vt,phiSegments:Gt,thetaStart:zt,thetaLength:jt},Vt=Math.max(3,Vt),Gt=Math.max(1,Gt);const Ht=[],Wt=[],qt=[],Xt=[];let Kt=_e;const Yt=(Dt-_e)/Gt,Zt=new Vector3,Jt=new Vector2;for(let nn=0;nn<=Gt;nn++){for(let rn=0;rn<=Vt;rn++){const Qt=zt+rn/Vt*jt;Zt.x=Kt*Math.cos(Qt),Zt.y=Kt*Math.sin(Qt),Wt.push(Zt.x,Zt.y,Zt.z),qt.push(0,0,1),Jt.x=(Zt.x/Dt+1)/2,Jt.y=(Zt.y/Dt+1)/2,Xt.push(Jt.x,Jt.y)}Kt+=Yt}for(let nn=0;nn<Gt;nn++){const rn=nn*(Vt+1);for(let Qt=0;Qt<Vt;Qt++){const en=Qt+rn,tn=en,sn=en+Vt+1,cn=en+Vt+2,un=en+1;Ht.push(tn,sn,un),Ht.push(sn,cn,un)}}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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)]),Dt=12){super(),this.type="ShapeGeometry",this.parameters={shapes:_e,curveSegments:Dt};const Vt=[],Gt=[],zt=[],jt=[];let Ht=0,Wt=0;if(Array.isArray(_e)===!1)qt(_e);else for(let Xt=0;Xt<_e.length;Xt++)qt(_e[Xt]),this.addGroup(Ht,Wt,Xt),Ht+=Wt,Wt=0;this.setIndex(Vt),this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt,3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2));function qt(Xt){const Kt=Gt.length/3,Yt=Xt.extractPoints(Dt);let Zt=Yt.shape;const Jt=Yt.holes;ShapeUtils.isClockWise(Zt)===!1&&(Zt=Zt.reverse());for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];ShapeUtils.isClockWise(en)===!0&&(Jt[rn]=en.reverse())}const nn=ShapeUtils.triangulateShape(Zt,Jt);for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];Zt=Zt.concat(en)}for(let rn=0,Qt=Zt.length;rn<Qt;rn++){const en=Zt[rn];Gt.push(en.x,en.y,0),zt.push(0,0,1),jt.push(en.x,en.y)}for(let rn=0,Qt=nn.length;rn<Qt;rn++){const en=nn[rn],tn=en[0]+Kt,sn=en[1]+Kt,cn=en[2]+Kt;Vt.push(tn,sn,cn),Wt+=3}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes;return toJSON(Dt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let Gt=0,zt=_e.shapes.length;Gt<zt;Gt++){const jt=Dt[_e.shapes[Gt]];Vt.push(jt)}return new ShapeGeometry(Vt,_e.curveSegments)}}function toJSON(kt,_e){if(_e.shapes=[],Array.isArray(kt))for(let Dt=0,Vt=kt.length;Dt<Vt;Dt++){const Gt=kt[Dt];_e.shapes.push(Gt.uuid)}else _e.shapes.push(kt.uuid);return _e}class SphereGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=16,Gt=0,zt=Math.PI*2,jt=0,Ht=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:_e,widthSegments:Dt,heightSegments:Vt,phiStart:Gt,phiLength:zt,thetaStart:jt,thetaLength:Ht},Dt=Math.max(3,Math.floor(Dt)),Vt=Math.max(2,Math.floor(Vt));const Wt=Math.min(jt+Ht,Math.PI);let qt=0;const Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=[],Jt=[],nn=[],rn=[];for(let Qt=0;Qt<=Vt;Qt++){const en=[],tn=Qt/Vt;let sn=0;Qt===0&&jt===0?sn=.5/Dt:Qt===Vt&&Wt===Math.PI&&(sn=-.5/Dt);for(let cn=0;cn<=Dt;cn++){const un=cn/Dt;Kt.x=-_e*Math.cos(Gt+un*zt)*Math.sin(jt+tn*Ht),Kt.y=_e*Math.cos(jt+tn*Ht),Kt.z=_e*Math.sin(Gt+un*zt)*Math.sin(jt+tn*Ht),Jt.push(Kt.x,Kt.y,Kt.z),Yt.copy(Kt).normalize(),nn.push(Yt.x,Yt.y,Yt.z),rn.push(un+sn,1-tn),en.push(qt++)}Xt.push(en)}for(let Qt=0;Qt<Vt;Qt++)for(let en=0;en<Dt;en++){const tn=Xt[Qt][en+1],sn=Xt[Qt][en],cn=Xt[Qt+1][en],un=Xt[Qt+1][en+1];(Qt!==0||jt>0)&&Zt.push(tn,sn,un),(Qt!==Vt-1||Wt<Math.PI)&&Zt.push(sn,cn,un)}this.setIndex(Zt),this.setAttribute("position",new Float32BufferAttribute(Jt,3)),this.setAttribute("normal",new Float32BufferAttribute(nn,3)),this.setAttribute("uv",new Float32BufferAttribute(rn,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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,Dt=0){const Vt=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Gt=[2,1,0,0,3,2,1,3,0,2,3,1];super(Vt,Gt,_e,Dt),this.type="TetrahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new TetrahedronGeometry(_e.radius,_e.detail)}}class TorusGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=12,Gt=48,zt=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:_e,tube:Dt,radialSegments:Vt,tubularSegments:Gt,arc:zt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const jt=[],Ht=[],Wt=[],qt=[],Xt=new Vector3,Kt=new Vector3,Yt=new Vector3;for(let Zt=0;Zt<=Vt;Zt++)for(let Jt=0;Jt<=Gt;Jt++){const nn=Jt/Gt*zt,rn=Zt/Vt*Math.PI*2;Kt.x=(_e+Dt*Math.cos(rn))*Math.cos(nn),Kt.y=(_e+Dt*Math.cos(rn))*Math.sin(nn),Kt.z=Dt*Math.sin(rn),Ht.push(Kt.x,Kt.y,Kt.z),Xt.x=_e*Math.cos(nn),Xt.y=_e*Math.sin(nn),Yt.subVectors(Kt,Xt).normalize(),Wt.push(Yt.x,Yt.y,Yt.z),qt.push(Jt/Gt),qt.push(Zt/Vt)}for(let Zt=1;Zt<=Vt;Zt++)for(let Jt=1;Jt<=Gt;Jt++){const nn=(Gt+1)*Zt+Jt-1,rn=(Gt+1)*(Zt-1)+Jt-1,Qt=(Gt+1)*(Zt-1)+Jt,en=(Gt+1)*Zt+Jt;jt.push(nn,rn,en),jt.push(rn,Qt,en)}this.setIndex(jt),this.setAttribute("position",new Float32BufferAttribute(Ht,3)),this.setAttribute("normal",new Float32BufferAttribute(Wt,3)),this.setAttribute("uv",new Float32BufferAttribute(qt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusGeometry(_e.radius,_e.tube,_e.radialSegments,_e.tubularSegments,_e.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=64,Gt=8,zt=2,jt=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:_e,tube:Dt,tubularSegments:Vt,radialSegments:Gt,p:zt,q:jt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const Ht=[],Wt=[],qt=[],Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=new Vector3,Jt=new Vector3,nn=new Vector3,rn=new Vector3,Qt=new Vector3;for(let tn=0;tn<=Vt;++tn){const sn=tn/Vt*zt*Math.PI*2;en(sn,zt,jt,_e,Zt),en(sn+.01,zt,jt,_e,Jt),rn.subVectors(Jt,Zt),Qt.addVectors(Jt,Zt),nn.crossVectors(rn,Qt),Qt.crossVectors(nn,rn),nn.normalize(),Qt.normalize();for(let cn=0;cn<=Gt;++cn){const un=cn/Gt*Math.PI*2,hn=-Dt*Math.cos(un),dn=Dt*Math.sin(un);Kt.x=Zt.x+(hn*Qt.x+dn*nn.x),Kt.y=Zt.y+(hn*Qt.y+dn*nn.y),Kt.z=Zt.z+(hn*Qt.z+dn*nn.z),Wt.push(Kt.x,Kt.y,Kt.z),Yt.subVectors(Kt,Zt).normalize(),qt.push(Yt.x,Yt.y,Yt.z),Xt.push(tn/Vt),Xt.push(cn/Gt)}}for(let tn=1;tn<=Vt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,dn=(Gt+1)*(tn-1)+sn;Ht.push(cn,un,dn),Ht.push(un,hn,dn)}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2));function en(tn,sn,cn,un,hn){const dn=Math.cos(tn),pn=Math.sin(tn),fn=cn/sn*tn,mn=Math.cos(fn);hn.x=un*(2+mn)*.5*dn,hn.y=un*(2+mn)*pn*.5,hn.z=un*Math.sin(fn)*.5}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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)),Dt=64,Vt=1,Gt=8,zt=!1){super(),this.type="TubeGeometry",this.parameters={path:_e,tubularSegments:Dt,radius:Vt,radialSegments:Gt,closed:zt};const jt=_e.computeFrenetFrames(Dt,zt);this.tangents=jt.tangents,this.normals=jt.normals,this.binormals=jt.binormals;const Ht=new Vector3,Wt=new Vector3,qt=new Vector2;let Xt=new Vector3;const Kt=[],Yt=[],Zt=[],Jt=[];nn(),this.setIndex(Jt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function nn(){for(let tn=0;tn<Dt;tn++)rn(tn);rn(zt===!1?Dt:0),en(),Qt()}function rn(tn){Xt=_e.getPointAt(tn/Dt,Xt);const sn=jt.normals[tn],cn=jt.binormals[tn];for(let un=0;un<=Gt;un++){const hn=un/Gt*Math.PI*2,dn=Math.sin(hn),pn=-Math.cos(hn);Wt.x=pn*sn.x+dn*cn.x,Wt.y=pn*sn.y+dn*cn.y,Wt.z=pn*sn.z+dn*cn.z,Wt.normalize(),Yt.push(Wt.x,Wt.y,Wt.z),Ht.x=Xt.x+Vt*Wt.x,Ht.y=Xt.y+Vt*Wt.y,Ht.z=Xt.z+Vt*Wt.z,Kt.push(Ht.x,Ht.y,Ht.z)}}function Qt(){for(let tn=1;tn<=Dt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,dn=(Gt+1)*(tn-1)+sn;Jt.push(cn,un,dn),Jt.push(un,hn,dn)}}function en(){for(let tn=0;tn<=Dt;tn++)for(let sn=0;sn<=Gt;sn++)qt.x=tn/Dt,qt.y=sn/Gt,Zt.push(qt.x,qt.y)}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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 Dt=[],Vt=new Set,Gt=new Vector3,zt=new Vector3;if(_e.index!==null){const jt=_e.attributes.position,Ht=_e.index;let Wt=_e.groups;Wt.length===0&&(Wt=[{start:0,count:Ht.count,materialIndex:0}]);for(let qt=0,Xt=Wt.length;qt<Xt;++qt){const Kt=Wt[qt],Yt=Kt.start,Zt=Kt.count;for(let Jt=Yt,nn=Yt+Zt;Jt<nn;Jt+=3)for(let rn=0;rn<3;rn++){const Qt=Ht.getX(Jt+rn),en=Ht.getX(Jt+(rn+1)%3);Gt.fromBufferAttribute(jt,Qt),zt.fromBufferAttribute(jt,en),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}}else{const jt=_e.attributes.position;for(let Ht=0,Wt=jt.count/3;Ht<Wt;Ht++)for(let qt=0;qt<3;qt++){const Xt=3*Ht+qt,Kt=3*Ht+(qt+1)%3;Gt.fromBufferAttribute(jt,Xt),zt.fromBufferAttribute(jt,Kt),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}this.setAttribute("position",new Float32BufferAttribute(Dt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}function isUniqueEdge(kt,_e,Dt){const Vt=`${kt.x},${kt.y},${kt.z}-${_e.x},${_e.y},${_e.z}`,Gt=`${_e.x},${_e.y},${_e.z}-${kt.x},${kt.y},${kt.z}`;return Dt.has(Vt)===!0||Dt.has(Gt)===!0?!1:(Dt.add(Vt),Dt.add(Gt),!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$1(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$1(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$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),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.anisotropyRotation=0,this.anisotropyMap=null,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(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Dt){this.ior=(1+.4*Dt)/(1-.4*Dt)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color$1(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,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color$1(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(_e)}get anisotropy(){return this._anisotropy}set anisotropy(_e){this._anisotropy>0!=_e>0&&this.version++,this._anisotropy=_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 sheen(){return this._sheen}set sheen(_e){this._sheen>0!=_e>0&&this.version++,this._sheen=_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.anisotropy=_e.anisotropy,this.anisotropyRotation=_e.anisotropyRotation,this.anisotropyMap=_e.anisotropyMap,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$1(16777215),this.specular=new Color$1(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),this.combine=_e.combine,this.reflectivity=_e.reflectivity,this.refractionRatio=_e.refractionRatio,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.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$1(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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$1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),this.combine=_e.combine,this.reflectivity=_e.reflectivity,this.refractionRatio=_e.refractionRatio,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.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$1(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 convertArray(kt,_e,Dt){return!kt||!Dt&&kt.constructor===_e?kt:typeof _e.BYTES_PER_ELEMENT=="number"?new _e(kt):Array.prototype.slice.call(kt)}function isTypedArray(kt){return ArrayBuffer.isView(kt)&&!(kt instanceof DataView)}function getKeyframeOrder(kt){function _e(Gt,zt){return kt[Gt]-kt[zt]}const Dt=kt.length,Vt=new Array(Dt);for(let Gt=0;Gt!==Dt;++Gt)Vt[Gt]=Gt;return Vt.sort(_e),Vt}function sortedArray(kt,_e,Dt){const Vt=kt.length,Gt=new kt.constructor(Vt);for(let zt=0,jt=0;jt!==Vt;++zt){const Ht=Dt[zt]*_e;for(let Wt=0;Wt!==_e;++Wt)Gt[jt++]=kt[Ht+Wt]}return Gt}function flattenJSON(kt,_e,Dt,Vt){let Gt=1,zt=kt[0];for(;zt!==void 0&&zt[Vt]===void 0;)zt=kt[Gt++];if(zt===void 0)return;let jt=zt[Vt];if(jt!==void 0)if(Array.isArray(jt))do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push.apply(Dt,jt)),zt=kt[Gt++];while(zt!==void 0);else if(jt.toArray!==void 0)do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),jt.toArray(Dt,Dt.length)),zt=kt[Gt++];while(zt!==void 0);else do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push(jt)),zt=kt[Gt++];while(zt!==void 0)}function subclip(kt,_e,Dt,Vt,Gt=30){const zt=kt.clone();zt.name=_e;const jt=[];for(let Wt=0;Wt<zt.tracks.length;++Wt){const qt=zt.tracks[Wt],Xt=qt.getValueSize(),Kt=[],Yt=[];for(let Zt=0;Zt<qt.times.length;++Zt){const Jt=qt.times[Zt]*Gt;if(!(Jt<Dt||Jt>=Vt)){Kt.push(qt.times[Zt]);for(let nn=0;nn<Xt;++nn)Yt.push(qt.values[Zt*Xt+nn])}}Kt.length!==0&&(qt.times=convertArray(Kt,qt.times.constructor),qt.values=convertArray(Yt,qt.values.constructor),jt.push(qt))}zt.tracks=jt;let Ht=1/0;for(let Wt=0;Wt<zt.tracks.length;++Wt)Ht>zt.tracks[Wt].times[0]&&(Ht=zt.tracks[Wt].times[0]);for(let Wt=0;Wt<zt.tracks.length;++Wt)zt.tracks[Wt].shift(-1*Ht);return zt.resetDuration(),zt}function makeClipAdditive(kt,_e=0,Dt=kt,Vt=30){Vt<=0&&(Vt=30);const Gt=Dt.tracks.length,zt=_e/Vt;for(let jt=0;jt<Gt;++jt){const Ht=Dt.tracks[jt],Wt=Ht.ValueTypeName;if(Wt==="bool"||Wt==="string")continue;const qt=kt.tracks.find(function(Qt){return Qt.name===Ht.name&&Qt.ValueTypeName===Wt});if(qt===void 0)continue;let Xt=0;const Kt=Ht.getValueSize();Ht.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Xt=Kt/3);let Yt=0;const Zt=qt.getValueSize();qt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Yt=Zt/3);const Jt=Ht.times.length-1;let nn;if(zt<=Ht.times[0]){const Qt=Xt,en=Kt-Xt;nn=Ht.values.slice(Qt,en)}else if(zt>=Ht.times[Jt]){const Qt=Jt*Kt+Xt,en=Qt+Kt-Xt;nn=Ht.values.slice(Qt,en)}else{const Qt=Ht.createInterpolant(),en=Xt,tn=Kt-Xt;Qt.evaluate(zt),nn=Qt.resultBuffer.slice(en,tn)}Wt==="quaternion"&&new Quaternion().fromArray(nn).normalize().conjugate().toArray(nn);const rn=qt.times.length;for(let Qt=0;Qt<rn;++Qt){const en=Qt*Zt+Yt;if(Wt==="quaternion")Quaternion.multiplyQuaternionsFlat(qt.values,en,nn,0,qt.values,en);else{const tn=Zt-Yt*2;for(let sn=0;sn<tn;++sn)qt.values[en+sn]-=nn[sn]}}}return kt.blendMode=AdditiveAnimationBlendMode,kt}const AnimationUtils={convertArray,isTypedArray,getKeyframeOrder,sortedArray,flattenJSON,subclip,makeClipAdditive};class Interpolant{constructor(_e,Dt,Vt,Gt){this.parameterPositions=_e,this._cachedIndex=0,this.resultBuffer=Gt!==void 0?Gt:new Dt.constructor(Vt),this.sampleValues=Dt,this.valueSize=Vt,this.settings=null,this.DefaultSettings_={}}evaluate(_e){const Dt=this.parameterPositions;let Vt=this._cachedIndex,Gt=Dt[Vt],zt=Dt[Vt-1];e:{t:{let jt;n:{r:if(!(_e<Gt)){for(let Ht=Vt+2;;){if(Gt===void 0){if(_e<zt)break r;return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}if(Vt===Ht)break;if(zt=Gt,Gt=Dt[++Vt],_e<Gt)break t}jt=Dt.length;break n}if(!(_e>=zt)){const Ht=Dt[1];_e<Ht&&(Vt=2,zt=Ht);for(let Wt=Vt-2;;){if(zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Vt===Wt)break;if(Gt=zt,zt=Dt[--Vt-1],_e>=zt)break t}jt=Vt,Vt=0;break n}break e}for(;Vt<jt;){const Ht=Vt+jt>>>1;_e<Dt[Ht]?jt=Ht:Vt=Ht+1}if(Gt=Dt[Vt],zt=Dt[Vt-1],zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Gt===void 0)return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}this._cachedIndex=Vt,this.intervalChanged_(Vt,zt,Gt)}return this.interpolate_(Vt,zt,_e,Gt)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(_e){const Dt=this.resultBuffer,Vt=this.sampleValues,Gt=this.valueSize,zt=_e*Gt;for(let jt=0;jt!==Gt;++jt)Dt[jt]=Vt[zt+jt];return Dt}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding}}intervalChanged_(_e,Dt,Vt){const Gt=this.parameterPositions;let zt=_e-2,jt=_e+1,Ht=Gt[zt],Wt=Gt[jt];if(Ht===void 0)switch(this.getSettings_().endingStart){case ZeroSlopeEnding:zt=_e,Ht=2*Dt-Vt;break;case WrapAroundEnding:zt=Gt.length-2,Ht=Dt+Gt[zt]-Gt[zt+1];break;default:zt=_e,Ht=Vt}if(Wt===void 0)switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:jt=_e,Wt=2*Vt-Dt;break;case WrapAroundEnding:jt=1,Wt=Vt+Gt[1]-Gt[0];break;default:jt=_e-1,Wt=Dt}const qt=(Vt-Dt)*.5,Xt=this.valueSize;this._weightPrev=qt/(Dt-Ht),this._weightNext=qt/(Wt-Vt),this._offsetPrev=zt*Xt,this._offsetNext=jt*Xt}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=this._offsetPrev,Kt=this._offsetNext,Yt=this._weightPrev,Zt=this._weightNext,Jt=(Vt-Dt)/(Gt-Dt),nn=Jt*Jt,rn=nn*Jt,Qt=-Yt*rn+2*Yt*nn-Yt*Jt,en=(1+Yt)*rn+(-1.5-2*Yt)*nn+(-.5+Yt)*Jt+1,tn=(-1-Zt)*rn+(1.5+Zt)*nn+.5*Jt,sn=Zt*rn-Zt*nn;for(let cn=0;cn!==Ht;++cn)zt[cn]=Qt*jt[Xt+cn]+en*jt[qt+cn]+tn*jt[Wt+cn]+sn*jt[Kt+cn];return zt}}class LinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=(Vt-Dt)/(Gt-Dt),Kt=1-Xt;for(let Yt=0;Yt!==Ht;++Yt)zt[Yt]=jt[qt+Yt]*Kt+jt[Wt+Yt]*Xt;return zt}}class DiscreteInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e){return this.copySampleValue_(_e-1)}}class KeyframeTrack{constructor(_e,Dt,Vt,Gt){if(_e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(Dt===void 0||Dt.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+_e);this.name=_e,this.times=convertArray(Dt,this.TimeBufferType),this.values=convertArray(Vt,this.ValueBufferType),this.setInterpolation(Gt||this.DefaultInterpolation)}static toJSON(_e){const Dt=_e.constructor;let Vt;if(Dt.toJSON!==this.toJSON)Vt=Dt.toJSON(_e);else{Vt={name:_e.name,times:convertArray(_e.times,Array),values:convertArray(_e.values,Array)};const Gt=_e.getInterpolation();Gt!==_e.DefaultInterpolation&&(Vt.interpolation=Gt)}return Vt.type=_e.ValueTypeName,Vt}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 Dt;switch(_e){case InterpolateDiscrete:Dt=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:Dt=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:Dt=this.InterpolantFactoryMethodSmooth;break}if(Dt===void 0){const Vt="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(Vt);return console.warn("THREE.KeyframeTrack:",Vt),this}return this.createInterpolant=Dt,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 Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]+=_e}return this}scale(_e){if(_e!==1){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]*=_e}return this}trim(_e,Dt){const Vt=this.times,Gt=Vt.length;let zt=0,jt=Gt-1;for(;zt!==Gt&&Vt[zt]<_e;)++zt;for(;jt!==-1&&Vt[jt]>Dt;)--jt;if(++jt,zt!==0||jt!==Gt){zt>=jt&&(jt=Math.max(jt,1),zt=jt-1);const Ht=this.getValueSize();this.times=Vt.slice(zt,jt),this.values=this.values.slice(zt*Ht,jt*Ht)}return this}validate(){let _e=!0;const Dt=this.getValueSize();Dt-Math.floor(Dt)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),_e=!1);const Vt=this.times,Gt=this.values,zt=Vt.length;zt===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),_e=!1);let jt=null;for(let Ht=0;Ht!==zt;Ht++){const Wt=Vt[Ht];if(typeof Wt=="number"&&isNaN(Wt)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Ht,Wt),_e=!1;break}if(jt!==null&&jt>Wt){console.error("THREE.KeyframeTrack: Out of order keys.",this,Ht,Wt,jt),_e=!1;break}jt=Wt}if(Gt!==void 0&&isTypedArray(Gt))for(let Ht=0,Wt=Gt.length;Ht!==Wt;++Ht){const qt=Gt[Ht];if(isNaN(qt)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Ht,qt),_e=!1;break}}return _e}optimize(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.getValueSize(),Gt=this.getInterpolation()===InterpolateSmooth,zt=_e.length-1;let jt=1;for(let Ht=1;Ht<zt;++Ht){let Wt=!1;const qt=_e[Ht],Xt=_e[Ht+1];if(qt!==Xt&&(Ht!==1||qt!==_e[0]))if(Gt)Wt=!0;else{const Kt=Ht*Vt,Yt=Kt-Vt,Zt=Kt+Vt;for(let Jt=0;Jt!==Vt;++Jt){const nn=Dt[Kt+Jt];if(nn!==Dt[Yt+Jt]||nn!==Dt[Zt+Jt]){Wt=!0;break}}}if(Wt){if(Ht!==jt){_e[jt]=_e[Ht];const Kt=Ht*Vt,Yt=jt*Vt;for(let Zt=0;Zt!==Vt;++Zt)Dt[Yt+Zt]=Dt[Kt+Zt]}++jt}}if(zt>0){_e[jt]=_e[zt];for(let Ht=zt*Vt,Wt=jt*Vt,qt=0;qt!==Vt;++qt)Dt[Wt+qt]=Dt[Ht+qt];++jt}return jt!==_e.length?(this.times=_e.slice(0,jt),this.values=Dt.slice(0,jt*Vt)):(this.times=_e,this.values=Dt),this}clone(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.constructor,Gt=new Vt(this.name,_e,Dt);return Gt.createInterpolant=this.createInterpolant,Gt}}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,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=(Vt-Dt)/(Gt-Dt);let qt=_e*Ht;for(let Xt=qt+Ht;qt!==Xt;qt+=4)Quaternion.slerpFlat(zt,0,jt,qt-Ht,jt,qt,Wt);return zt}}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="",Dt=-1,Vt=[],Gt=NormalAnimationBlendMode){this.name=_e,this.tracks=Vt,this.duration=Dt,this.blendMode=Gt,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(_e){const Dt=[],Vt=_e.tracks,Gt=1/(_e.fps||1);for(let jt=0,Ht=Vt.length;jt!==Ht;++jt)Dt.push(parseKeyframeTrack(Vt[jt]).scale(Gt));const zt=new this(_e.name,_e.duration,Dt,_e.blendMode);return zt.uuid=_e.uuid,zt}static toJSON(_e){const Dt=[],Vt=_e.tracks,Gt={name:_e.name,duration:_e.duration,tracks:Dt,uuid:_e.uuid,blendMode:_e.blendMode};for(let zt=0,jt=Vt.length;zt!==jt;++zt)Dt.push(KeyframeTrack.toJSON(Vt[zt]));return Gt}static CreateFromMorphTargetSequence(_e,Dt,Vt,Gt){const zt=Dt.length,jt=[];for(let Ht=0;Ht<zt;Ht++){let Wt=[],qt=[];Wt.push((Ht+zt-1)%zt,Ht,(Ht+1)%zt),qt.push(0,1,0);const Xt=getKeyframeOrder(Wt);Wt=sortedArray(Wt,1,Xt),qt=sortedArray(qt,1,Xt),!Gt&&Wt[0]===0&&(Wt.push(zt),qt.push(qt[0])),jt.push(new NumberKeyframeTrack(".morphTargetInfluences["+Dt[Ht].name+"]",Wt,qt).scale(1/Vt))}return new this(_e,-1,jt)}static findByName(_e,Dt){let Vt=_e;if(!Array.isArray(_e)){const Gt=_e;Vt=Gt.geometry&&Gt.geometry.animations||Gt.animations}for(let Gt=0;Gt<Vt.length;Gt++)if(Vt[Gt].name===Dt)return Vt[Gt];return null}static CreateClipsFromMorphTargetSequences(_e,Dt,Vt){const Gt={},zt=/^([\w-]*?)([\d]+)$/;for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht],Xt=qt.name.match(zt);if(Xt&&Xt.length>1){const Kt=Xt[1];let Yt=Gt[Kt];Yt||(Gt[Kt]=Yt=[]),Yt.push(qt)}}const jt=[];for(const Ht in Gt)jt.push(this.CreateFromMorphTargetSequence(Ht,Gt[Ht],Dt,Vt));return jt}static parseAnimation(_e,Dt){if(!_e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const Vt=function(Kt,Yt,Zt,Jt,nn){if(Zt.length!==0){const rn=[],Qt=[];flattenJSON(Zt,rn,Qt,Jt),rn.length!==0&&nn.push(new Kt(Yt,rn,Qt))}},Gt=[],zt=_e.name||"default",jt=_e.fps||30,Ht=_e.blendMode;let Wt=_e.length||-1;const qt=_e.hierarchy||[];for(let Kt=0;Kt<qt.length;Kt++){const Yt=qt[Kt].keys;if(!(!Yt||Yt.length===0))if(Yt[0].morphTargets){const Zt={};let Jt;for(Jt=0;Jt<Yt.length;Jt++)if(Yt[Jt].morphTargets)for(let nn=0;nn<Yt[Jt].morphTargets.length;nn++)Zt[Yt[Jt].morphTargets[nn]]=-1;for(const nn in Zt){const rn=[],Qt=[];for(let en=0;en!==Yt[Jt].morphTargets.length;++en){const tn=Yt[Jt];rn.push(tn.time),Qt.push(tn.morphTarget===nn?1:0)}Gt.push(new NumberKeyframeTrack(".morphTargetInfluence["+nn+"]",rn,Qt))}Wt=Zt.length*jt}else{const Zt=".bones["+Dt[Kt].name+"]";Vt(VectorKeyframeTrack,Zt+".position",Yt,"pos",Gt),Vt(QuaternionKeyframeTrack,Zt+".quaternion",Yt,"rot",Gt),Vt(VectorKeyframeTrack,Zt+".scale",Yt,"scl",Gt)}}return Gt.length===0?null:new this(zt,Wt,Gt,Ht)}resetDuration(){const _e=this.tracks;let Dt=0;for(let Vt=0,Gt=_e.length;Vt!==Gt;++Vt){const zt=this.tracks[Vt];Dt=Math.max(Dt,zt.times[zt.times.length-1])}return this.duration=Dt,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 Dt=0;Dt<this.tracks.length;Dt++)_e=_e&&this.tracks[Dt].validate();return _e}optimize(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].optimize();return this}clone(){const _e=[];for(let Dt=0;Dt<this.tracks.length;Dt++)_e.push(this.tracks[Dt].clone());return new this.constructor(this.name,this.duration,_e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function getTrackTypeForValueTypeName(kt){switch(kt.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: "+kt)}function parseKeyframeTrack(kt){if(kt.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const _e=getTrackTypeForValueTypeName(kt.type);if(kt.times===void 0){const Dt=[],Vt=[];flattenJSON(kt.keys,Dt,Vt,"value"),kt.times=Dt,kt.values=Vt}return _e.parse!==void 0?_e.parse(kt):new _e(kt.name,kt.times,kt.values,kt.interpolation)}const Cache={enabled:!1,files:{},add:function(kt,_e){this.enabled!==!1&&(this.files[kt]=_e)},get:function(kt){if(this.enabled!==!1)return this.files[kt]},remove:function(kt){delete this.files[kt]},clear:function(){this.files={}}};class LoadingManager{constructor(_e,Dt,Vt){const Gt=this;let zt=!1,jt=0,Ht=0,Wt;const qt=[];this.onStart=void 0,this.onLoad=_e,this.onProgress=Dt,this.onError=Vt,this.itemStart=function(Xt){Ht++,zt===!1&&Gt.onStart!==void 0&&Gt.onStart(Xt,jt,Ht),zt=!0},this.itemEnd=function(Xt){jt++,Gt.onProgress!==void 0&&Gt.onProgress(Xt,jt,Ht),jt===Ht&&(zt=!1,Gt.onLoad!==void 0&&Gt.onLoad())},this.itemError=function(Xt){Gt.onError!==void 0&&Gt.onError(Xt)},this.resolveURL=function(Xt){return Wt?Wt(Xt):Xt},this.setURLModifier=function(Xt){return Wt=Xt,this},this.addHandler=function(Xt,Kt){return qt.push(Xt,Kt),this},this.removeHandler=function(Xt){const Kt=qt.indexOf(Xt);return Kt!==-1&&qt.splice(Kt,2),this},this.getHandler=function(Xt){for(let Kt=0,Yt=qt.length;Kt<Yt;Kt+=2){const Zt=qt[Kt],Jt=qt[Kt+1];if(Zt.global&&(Zt.lastIndex=0),Zt.test(Xt))return Jt}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,Dt){const Vt=this;return new Promise(function(Gt,zt){Vt.load(_e,Gt,Dt,zt)})}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}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";const loading={};class HttpError extends Error{constructor(_e,Dt){super(_e),this.response=Dt}}class FileLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=Cache.get(_e);if(zt!==void 0)return this.manager.itemStart(_e),setTimeout(()=>{Dt&&Dt(zt),this.manager.itemEnd(_e)},0),zt;if(loading[_e]!==void 0){loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});return}loading[_e]=[],loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});const jt=new Request(_e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),Ht=this.mimeType,Wt=this.responseType;fetch(jt).then(qt=>{if(qt.status===200||qt.status===0){if(qt.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||qt.body===void 0||qt.body.getReader===void 0)return qt;const Xt=loading[_e],Kt=qt.body.getReader(),Yt=qt.headers.get("Content-Length")||qt.headers.get("X-File-Size"),Zt=Yt?parseInt(Yt):0,Jt=Zt!==0;let nn=0;const rn=new ReadableStream({start(Qt){en();function en(){Kt.read().then(({done:tn,value:sn})=>{if(tn)Qt.close();else{nn+=sn.byteLength;const cn=new ProgressEvent("progress",{lengthComputable:Jt,loaded:nn,total:Zt});for(let un=0,hn=Xt.length;un<hn;un++){const dn=Xt[un];dn.onProgress&&dn.onProgress(cn)}Qt.enqueue(sn),en()}})}}});return new Response(rn)}else throw new HttpError(`fetch for "${qt.url}" responded with ${qt.status}: ${qt.statusText}`,qt)}).then(qt=>{switch(Wt){case"arraybuffer":return qt.arrayBuffer();case"blob":return qt.blob();case"document":return qt.text().then(Xt=>new DOMParser().parseFromString(Xt,Ht));case"json":return qt.json();default:if(Ht===void 0)return qt.text();{const Kt=/charset="?([^;"\s]*)"?/i.exec(Ht),Yt=Kt&&Kt[1]?Kt[1].toLowerCase():void 0,Zt=new TextDecoder(Yt);return qt.arrayBuffer().then(Jt=>Zt.decode(Jt))}}}).then(qt=>{Cache.add(_e,qt);const Xt=loading[_e];delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onLoad&&Zt.onLoad(qt)}}).catch(qt=>{const Xt=loading[_e];if(Xt===void 0)throw this.manager.itemError(_e),qt;delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onError&&Zt.onError(qt)}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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=[];for(let Vt=0;Vt<_e.length;Vt++){const Gt=AnimationClip.parse(_e[Vt]);Dt.push(Gt)}return Dt}}class CompressedTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=[],Ht=new CompressedTexture,Wt=new FileLoader(this.manager);Wt.setPath(this.path),Wt.setResponseType("arraybuffer"),Wt.setRequestHeader(this.requestHeader),Wt.setWithCredentials(zt.withCredentials);let qt=0;function Xt(Kt){Wt.load(_e[Kt],function(Yt){const Zt=zt.parse(Yt,!0);jt[Kt]={width:Zt.width,height:Zt.height,format:Zt.format,mipmaps:Zt.mipmaps},qt+=1,qt===6&&(Zt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.image=jt,Ht.format=Zt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht))},Vt,Gt)}if(Array.isArray(_e))for(let Kt=0,Yt=_e.length;Kt<Yt;++Kt)Xt(Kt);else Wt.load(_e,function(Kt){const Yt=zt.parse(Kt,!0);if(Yt.isCubemap){const Zt=Yt.mipmaps.length/Yt.mipmapCount;for(let Jt=0;Jt<Zt;Jt++){jt[Jt]={mipmaps:[]};for(let nn=0;nn<Yt.mipmapCount;nn++)jt[Jt].mipmaps.push(Yt.mipmaps[Jt*Yt.mipmapCount+nn]),jt[Jt].format=Yt.format,jt[Jt].width=Yt.width,jt[Jt].height=Yt.height}Ht.image=jt}else Ht.image.width=Yt.width,Ht.image.height=Yt.height,Ht.mipmaps=Yt.mipmaps;Yt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.format=Yt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht)},Vt,Gt);return Ht}}class ImageLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0)return zt.manager.itemStart(_e),setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt;const Ht=createElementNS("img");function Wt(){Xt(),Cache.add(_e,this),Dt&&Dt(this),zt.manager.itemEnd(_e)}function qt(Kt){Xt(),Gt&&Gt(Kt),zt.manager.itemError(_e),zt.manager.itemEnd(_e)}function Xt(){Ht.removeEventListener("load",Wt,!1),Ht.removeEventListener("error",qt,!1)}return Ht.addEventListener("load",Wt,!1),Ht.addEventListener("error",qt,!1),_e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(Ht.crossOrigin=this.crossOrigin),zt.manager.itemStart(_e),Ht.src=_e,Ht}}class CubeTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new CubeTexture;zt.colorSpace=SRGBColorSpace$1;const jt=new ImageLoader(this.manager);jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path);let Ht=0;function Wt(qt){jt.load(_e[qt],function(Xt){zt.images[qt]=Xt,Ht++,Ht===6&&(zt.needsUpdate=!0,Dt&&Dt(zt))},void 0,Gt)}for(let qt=0;qt<_e.length;++qt)Wt(qt);return zt}}class DataTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new DataTexture,Ht=new FileLoader(this.manager);return Ht.setResponseType("arraybuffer"),Ht.setRequestHeader(this.requestHeader),Ht.setPath(this.path),Ht.setWithCredentials(zt.withCredentials),Ht.load(_e,function(Wt){let qt;try{qt=zt.parse(Wt)}catch(Xt){if(Gt!==void 0)Gt(Xt);else{console.error(Xt);return}}qt.image!==void 0?jt.image=qt.image:qt.data!==void 0&&(jt.image.width=qt.width,jt.image.height=qt.height,jt.image.data=qt.data),jt.wrapS=qt.wrapS!==void 0?qt.wrapS:ClampToEdgeWrapping,jt.wrapT=qt.wrapT!==void 0?qt.wrapT:ClampToEdgeWrapping,jt.magFilter=qt.magFilter!==void 0?qt.magFilter:LinearFilter,jt.minFilter=qt.minFilter!==void 0?qt.minFilter:LinearFilter,jt.anisotropy=qt.anisotropy!==void 0?qt.anisotropy:1,qt.colorSpace!==void 0&&(jt.colorSpace=qt.colorSpace),qt.flipY!==void 0&&(jt.flipY=qt.flipY),qt.format!==void 0&&(jt.format=qt.format),qt.type!==void 0&&(jt.type=qt.type),qt.mipmaps!==void 0&&(jt.mipmaps=qt.mipmaps,jt.minFilter=LinearMipmapLinearFilter),qt.mipmapCount===1&&(jt.minFilter=LinearFilter),qt.generateMipmaps!==void 0&&(jt.generateMipmaps=qt.generateMipmaps),jt.needsUpdate=!0,Dt&&Dt(jt,qt)},Vt,Gt),jt}}class TextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new Texture,jt=new ImageLoader(this.manager);return jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path),jt.load(_e,function(Ht){zt.image=Ht,zt.needsUpdate=!0,Dt!==void 0&&Dt(zt)},Vt,Gt),zt}}class Light extends Object3D{constructor(_e,Dt=1){super(),this.isLight=!0,this.type="Light",this.color=new Color$1(_e),this.intensity=Dt}dispose(){}copy(_e,Dt){return super.copy(_e,Dt),this.color.copy(_e.color),this.intensity=_e.intensity,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.color=this.color.getHex(),Dt.object.intensity=this.intensity,this.groundColor!==void 0&&(Dt.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(Dt.object.distance=this.distance),this.angle!==void 0&&(Dt.object.angle=this.angle),this.decay!==void 0&&(Dt.object.decay=this.decay),this.penumbra!==void 0&&(Dt.object.penumbra=this.penumbra),this.shadow!==void 0&&(Dt.object.shadow=this.shadow.toJSON()),Dt}}class HemisphereLight extends Light{constructor(_e,Dt,Vt){super(_e,Vt),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color$1(Dt)}copy(_e,Dt){return super.copy(_e,Dt),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 Dt=this.camera,Vt=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(_e.matrixWorld),Dt.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(_e.target.matrixWorld),Dt.lookAt(_lookTarget$1),Dt.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(Dt.projectionMatrix,Dt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),Vt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Vt.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 Dt=this.camera,Vt=RAD2DEG*2*_e.angle*this.focus,Gt=this.mapSize.width/this.mapSize.height,zt=_e.distance||Dt.far;(Vt!==Dt.fov||Gt!==Dt.aspect||zt!==Dt.far)&&(Dt.fov=Vt,Dt.aspect=Gt,Dt.far=zt,Dt.updateProjectionMatrix()),super.updateMatrices(_e)}copy(_e){return super.copy(_e),this.focus=_e.focus,this}}class SpotLight extends Light{constructor(_e,Dt,Vt=0,Gt=Math.PI/3,zt=0,jt=2){super(_e,Dt),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=Vt,this.angle=Gt,this.penumbra=zt,this.decay=jt,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,Dt){return super.copy(_e,Dt),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,Dt=0){const Vt=this.camera,Gt=this.matrix,zt=_e.distance||Vt.far;zt!==Vt.far&&(Vt.far=zt,Vt.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(_e.matrixWorld),Vt.position.copy(_lightPositionWorld),_lookTarget.copy(Vt.position),_lookTarget.add(this._cubeDirections[Dt]),Vt.up.copy(this._cubeUps[Dt]),Vt.lookAt(_lookTarget),Vt.updateMatrixWorld(),Gt.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(_e,Dt,Vt=0,Gt=2){super(_e,Dt),this.isPointLight=!0,this.type="PointLight",this.distance=Vt,this.decay=Gt,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,Dt){return super.copy(_e,Dt),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,Dt){super(_e,Dt),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),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,Dt){super(_e,Dt),this.isAmbientLight=!0,this.type="AmbientLight"}}class RectAreaLight extends Light{constructor(_e,Dt,Vt=10,Gt=10){super(_e,Dt),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=Vt,this.height=Gt}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 Dt=super.toJSON(_e);return Dt.object.width=this.width,Dt.object.height=this.height,Dt}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let _e=0;_e<9;_e++)this.coefficients.push(new Vector3)}set(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].copy(_e[Dt]);return this}zero(){for(let _e=0;_e<9;_e++)this.coefficients[_e].set(0,0,0);return this}getAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.282095),Dt.addScaledVector(jt[1],.488603*Gt),Dt.addScaledVector(jt[2],.488603*zt),Dt.addScaledVector(jt[3],.488603*Vt),Dt.addScaledVector(jt[4],1.092548*(Vt*Gt)),Dt.addScaledVector(jt[5],1.092548*(Gt*zt)),Dt.addScaledVector(jt[6],.315392*(3*zt*zt-1)),Dt.addScaledVector(jt[7],1.092548*(Vt*zt)),Dt.addScaledVector(jt[8],.546274*(Vt*Vt-Gt*Gt)),Dt}getIrradianceAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.886227),Dt.addScaledVector(jt[1],2*.511664*Gt),Dt.addScaledVector(jt[2],2*.511664*zt),Dt.addScaledVector(jt[3],2*.511664*Vt),Dt.addScaledVector(jt[4],2*.429043*Vt*Gt),Dt.addScaledVector(jt[5],2*.429043*Gt*zt),Dt.addScaledVector(jt[6],.743125*zt*zt-.247708),Dt.addScaledVector(jt[7],2*.429043*Vt*zt),Dt.addScaledVector(jt[8],.429043*(Vt*Vt-Gt*Gt)),Dt}add(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].add(_e.coefficients[Dt]);return this}addScaledSH(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].addScaledVector(_e.coefficients[Vt],Dt);return this}scale(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].multiplyScalar(_e);return this}lerp(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].lerp(_e.coefficients[Vt],Dt);return this}equals(_e){for(let Dt=0;Dt<9;Dt++)if(!this.coefficients[Dt].equals(_e.coefficients[Dt]))return!1;return!0}copy(_e){return this.set(_e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(_e,Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].fromArray(_e,Dt+Gt*3);return this}toArray(_e=[],Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].toArray(_e,Dt+Gt*3);return _e}static getBasisAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z;Dt[0]=.282095,Dt[1]=.488603*Gt,Dt[2]=.488603*zt,Dt[3]=.488603*Vt,Dt[4]=1.092548*Vt*Gt,Dt[5]=1.092548*Gt*zt,Dt[6]=.315392*(3*zt*zt-1),Dt[7]=1.092548*Vt*zt,Dt[8]=.546274*(Vt*Vt-Gt*Gt)}}class LightProbe extends Light{constructor(_e=new SphericalHarmonics3,Dt=1){super(void 0,Dt),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 Dt=super.toJSON(_e);return Dt.object.sh=this.sh.toArray(),Dt}}class MaterialLoader extends Loader{constructor(_e){super(_e),this.textures={}}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=this.textures;function Vt(zt){return Dt[zt]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",zt),Dt[zt]}const Gt=MaterialLoader.createMaterialFromType(_e.type);if(_e.uuid!==void 0&&(Gt.uuid=_e.uuid),_e.name!==void 0&&(Gt.name=_e.name),_e.color!==void 0&&Gt.color!==void 0&&Gt.color.setHex(_e.color),_e.roughness!==void 0&&(Gt.roughness=_e.roughness),_e.metalness!==void 0&&(Gt.metalness=_e.metalness),_e.sheen!==void 0&&(Gt.sheen=_e.sheen),_e.sheenColor!==void 0&&(Gt.sheenColor=new Color$1().setHex(_e.sheenColor)),_e.sheenRoughness!==void 0&&(Gt.sheenRoughness=_e.sheenRoughness),_e.emissive!==void 0&&Gt.emissive!==void 0&&Gt.emissive.setHex(_e.emissive),_e.specular!==void 0&&Gt.specular!==void 0&&Gt.specular.setHex(_e.specular),_e.specularIntensity!==void 0&&(Gt.specularIntensity=_e.specularIntensity),_e.specularColor!==void 0&&Gt.specularColor!==void 0&&Gt.specularColor.setHex(_e.specularColor),_e.shininess!==void 0&&(Gt.shininess=_e.shininess),_e.clearcoat!==void 0&&(Gt.clearcoat=_e.clearcoat),_e.clearcoatRoughness!==void 0&&(Gt.clearcoatRoughness=_e.clearcoatRoughness),_e.iridescence!==void 0&&(Gt.iridescence=_e.iridescence),_e.iridescenceIOR!==void 0&&(Gt.iridescenceIOR=_e.iridescenceIOR),_e.iridescenceThicknessRange!==void 0&&(Gt.iridescenceThicknessRange=_e.iridescenceThicknessRange),_e.transmission!==void 0&&(Gt.transmission=_e.transmission),_e.thickness!==void 0&&(Gt.thickness=_e.thickness),_e.attenuationDistance!==void 0&&(Gt.attenuationDistance=_e.attenuationDistance),_e.attenuationColor!==void 0&&Gt.attenuationColor!==void 0&&Gt.attenuationColor.setHex(_e.attenuationColor),_e.anisotropy!==void 0&&(Gt.anisotropy=_e.anisotropy),_e.anisotropyRotation!==void 0&&(Gt.anisotropyRotation=_e.anisotropyRotation),_e.fog!==void 0&&(Gt.fog=_e.fog),_e.flatShading!==void 0&&(Gt.flatShading=_e.flatShading),_e.blending!==void 0&&(Gt.blending=_e.blending),_e.combine!==void 0&&(Gt.combine=_e.combine),_e.side!==void 0&&(Gt.side=_e.side),_e.shadowSide!==void 0&&(Gt.shadowSide=_e.shadowSide),_e.opacity!==void 0&&(Gt.opacity=_e.opacity),_e.transparent!==void 0&&(Gt.transparent=_e.transparent),_e.alphaTest!==void 0&&(Gt.alphaTest=_e.alphaTest),_e.alphaHash!==void 0&&(Gt.alphaHash=_e.alphaHash),_e.depthFunc!==void 0&&(Gt.depthFunc=_e.depthFunc),_e.depthTest!==void 0&&(Gt.depthTest=_e.depthTest),_e.depthWrite!==void 0&&(Gt.depthWrite=_e.depthWrite),_e.colorWrite!==void 0&&(Gt.colorWrite=_e.colorWrite),_e.blendSrc!==void 0&&(Gt.blendSrc=_e.blendSrc),_e.blendDst!==void 0&&(Gt.blendDst=_e.blendDst),_e.blendEquation!==void 0&&(Gt.blendEquation=_e.blendEquation),_e.blendSrcAlpha!==void 0&&(Gt.blendSrcAlpha=_e.blendSrcAlpha),_e.blendDstAlpha!==void 0&&(Gt.blendDstAlpha=_e.blendDstAlpha),_e.blendEquationAlpha!==void 0&&(Gt.blendEquationAlpha=_e.blendEquationAlpha),_e.blendColor!==void 0&&Gt.blendColor!==void 0&&Gt.blendColor.setHex(_e.blendColor),_e.blendAlpha!==void 0&&(Gt.blendAlpha=_e.blendAlpha),_e.stencilWriteMask!==void 0&&(Gt.stencilWriteMask=_e.stencilWriteMask),_e.stencilFunc!==void 0&&(Gt.stencilFunc=_e.stencilFunc),_e.stencilRef!==void 0&&(Gt.stencilRef=_e.stencilRef),_e.stencilFuncMask!==void 0&&(Gt.stencilFuncMask=_e.stencilFuncMask),_e.stencilFail!==void 0&&(Gt.stencilFail=_e.stencilFail),_e.stencilZFail!==void 0&&(Gt.stencilZFail=_e.stencilZFail),_e.stencilZPass!==void 0&&(Gt.stencilZPass=_e.stencilZPass),_e.stencilWrite!==void 0&&(Gt.stencilWrite=_e.stencilWrite),_e.wireframe!==void 0&&(Gt.wireframe=_e.wireframe),_e.wireframeLinewidth!==void 0&&(Gt.wireframeLinewidth=_e.wireframeLinewidth),_e.wireframeLinecap!==void 0&&(Gt.wireframeLinecap=_e.wireframeLinecap),_e.wireframeLinejoin!==void 0&&(Gt.wireframeLinejoin=_e.wireframeLinejoin),_e.rotation!==void 0&&(Gt.rotation=_e.rotation),_e.linewidth!==void 0&&(Gt.linewidth=_e.linewidth),_e.dashSize!==void 0&&(Gt.dashSize=_e.dashSize),_e.gapSize!==void 0&&(Gt.gapSize=_e.gapSize),_e.scale!==void 0&&(Gt.scale=_e.scale),_e.polygonOffset!==void 0&&(Gt.polygonOffset=_e.polygonOffset),_e.polygonOffsetFactor!==void 0&&(Gt.polygonOffsetFactor=_e.polygonOffsetFactor),_e.polygonOffsetUnits!==void 0&&(Gt.polygonOffsetUnits=_e.polygonOffsetUnits),_e.dithering!==void 0&&(Gt.dithering=_e.dithering),_e.alphaToCoverage!==void 0&&(Gt.alphaToCoverage=_e.alphaToCoverage),_e.premultipliedAlpha!==void 0&&(Gt.premultipliedAlpha=_e.premultipliedAlpha),_e.forceSinglePass!==void 0&&(Gt.forceSinglePass=_e.forceSinglePass),_e.visible!==void 0&&(Gt.visible=_e.visible),_e.toneMapped!==void 0&&(Gt.toneMapped=_e.toneMapped),_e.userData!==void 0&&(Gt.userData=_e.userData),_e.vertexColors!==void 0&&(typeof _e.vertexColors=="number"?Gt.vertexColors=_e.vertexColors>0:Gt.vertexColors=_e.vertexColors),_e.uniforms!==void 0)for(const zt in _e.uniforms){const jt=_e.uniforms[zt];switch(Gt.uniforms[zt]={},jt.type){case"t":Gt.uniforms[zt].value=Vt(jt.value);break;case"c":Gt.uniforms[zt].value=new Color$1().setHex(jt.value);break;case"v2":Gt.uniforms[zt].value=new Vector2().fromArray(jt.value);break;case"v3":Gt.uniforms[zt].value=new Vector3().fromArray(jt.value);break;case"v4":Gt.uniforms[zt].value=new Vector4().fromArray(jt.value);break;case"m3":Gt.uniforms[zt].value=new Matrix3().fromArray(jt.value);break;case"m4":Gt.uniforms[zt].value=new Matrix4().fromArray(jt.value);break;default:Gt.uniforms[zt].value=jt.value}}if(_e.defines!==void 0&&(Gt.defines=_e.defines),_e.vertexShader!==void 0&&(Gt.vertexShader=_e.vertexShader),_e.fragmentShader!==void 0&&(Gt.fragmentShader=_e.fragmentShader),_e.glslVersion!==void 0&&(Gt.glslVersion=_e.glslVersion),_e.extensions!==void 0)for(const zt in _e.extensions)Gt.extensions[zt]=_e.extensions[zt];if(_e.lights!==void 0&&(Gt.lights=_e.lights),_e.clipping!==void 0&&(Gt.clipping=_e.clipping),_e.size!==void 0&&(Gt.size=_e.size),_e.sizeAttenuation!==void 0&&(Gt.sizeAttenuation=_e.sizeAttenuation),_e.map!==void 0&&(Gt.map=Vt(_e.map)),_e.matcap!==void 0&&(Gt.matcap=Vt(_e.matcap)),_e.alphaMap!==void 0&&(Gt.alphaMap=Vt(_e.alphaMap)),_e.bumpMap!==void 0&&(Gt.bumpMap=Vt(_e.bumpMap)),_e.bumpScale!==void 0&&(Gt.bumpScale=_e.bumpScale),_e.normalMap!==void 0&&(Gt.normalMap=Vt(_e.normalMap)),_e.normalMapType!==void 0&&(Gt.normalMapType=_e.normalMapType),_e.normalScale!==void 0){let zt=_e.normalScale;Array.isArray(zt)===!1&&(zt=[zt,zt]),Gt.normalScale=new Vector2().fromArray(zt)}return _e.displacementMap!==void 0&&(Gt.displacementMap=Vt(_e.displacementMap)),_e.displacementScale!==void 0&&(Gt.displacementScale=_e.displacementScale),_e.displacementBias!==void 0&&(Gt.displacementBias=_e.displacementBias),_e.roughnessMap!==void 0&&(Gt.roughnessMap=Vt(_e.roughnessMap)),_e.metalnessMap!==void 0&&(Gt.metalnessMap=Vt(_e.metalnessMap)),_e.emissiveMap!==void 0&&(Gt.emissiveMap=Vt(_e.emissiveMap)),_e.emissiveIntensity!==void 0&&(Gt.emissiveIntensity=_e.emissiveIntensity),_e.specularMap!==void 0&&(Gt.specularMap=Vt(_e.specularMap)),_e.specularIntensityMap!==void 0&&(Gt.specularIntensityMap=Vt(_e.specularIntensityMap)),_e.specularColorMap!==void 0&&(Gt.specularColorMap=Vt(_e.specularColorMap)),_e.envMap!==void 0&&(Gt.envMap=Vt(_e.envMap)),_e.envMapRotation!==void 0&&Gt.envMapRotation.fromArray(_e.envMapRotation),_e.envMapIntensity!==void 0&&(Gt.envMapIntensity=_e.envMapIntensity),_e.reflectivity!==void 0&&(Gt.reflectivity=_e.reflectivity),_e.refractionRatio!==void 0&&(Gt.refractionRatio=_e.refractionRatio),_e.lightMap!==void 0&&(Gt.lightMap=Vt(_e.lightMap)),_e.lightMapIntensity!==void 0&&(Gt.lightMapIntensity=_e.lightMapIntensity),_e.aoMap!==void 0&&(Gt.aoMap=Vt(_e.aoMap)),_e.aoMapIntensity!==void 0&&(Gt.aoMapIntensity=_e.aoMapIntensity),_e.gradientMap!==void 0&&(Gt.gradientMap=Vt(_e.gradientMap)),_e.clearcoatMap!==void 0&&(Gt.clearcoatMap=Vt(_e.clearcoatMap)),_e.clearcoatRoughnessMap!==void 0&&(Gt.clearcoatRoughnessMap=Vt(_e.clearcoatRoughnessMap)),_e.clearcoatNormalMap!==void 0&&(Gt.clearcoatNormalMap=Vt(_e.clearcoatNormalMap)),_e.clearcoatNormalScale!==void 0&&(Gt.clearcoatNormalScale=new Vector2().fromArray(_e.clearcoatNormalScale)),_e.iridescenceMap!==void 0&&(Gt.iridescenceMap=Vt(_e.iridescenceMap)),_e.iridescenceThicknessMap!==void 0&&(Gt.iridescenceThicknessMap=Vt(_e.iridescenceThicknessMap)),_e.transmissionMap!==void 0&&(Gt.transmissionMap=Vt(_e.transmissionMap)),_e.thicknessMap!==void 0&&(Gt.thicknessMap=Vt(_e.thicknessMap)),_e.anisotropyMap!==void 0&&(Gt.anisotropyMap=Vt(_e.anisotropyMap)),_e.sheenColorMap!==void 0&&(Gt.sheenColorMap=Vt(_e.sheenColorMap)),_e.sheenRoughnessMap!==void 0&&(Gt.sheenRoughnessMap=Vt(_e.sheenRoughnessMap)),Gt}setTextures(_e){return this.textures=_e,this}static createMaterialFromType(_e){const Dt={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new Dt[_e]}}class LoaderUtils{static decodeText(_e){if(typeof TextDecoder<"u")return new TextDecoder().decode(_e);let Dt="";for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++)Dt+=String.fromCharCode(_e[Vt]);try{return decodeURIComponent(escape(Dt))}catch{return Dt}}static extractUrlBase(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.slice(0,Dt+1)}static resolveURL(_e,Dt){return typeof _e!="string"||_e===""?"":(/^https?:\/\//i.test(Dt)&&/^\//.test(_e)&&(Dt=Dt.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(_e)||/^data:.*,.*$/i.test(_e)||/^blob:.*$/i.test(_e)?_e:Dt+_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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt={},Vt={};function Gt(Zt,Jt){if(Dt[Jt]!==void 0)return Dt[Jt];const rn=Zt.interleavedBuffers[Jt],Qt=zt(Zt,rn.buffer),en=getTypedArray(rn.type,Qt),tn=new InterleavedBuffer(en,rn.stride);return tn.uuid=rn.uuid,Dt[Jt]=tn,tn}function zt(Zt,Jt){if(Vt[Jt]!==void 0)return Vt[Jt];const rn=Zt.arrayBuffers[Jt],Qt=new Uint32Array(rn).buffer;return Vt[Jt]=Qt,Qt}const jt=_e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,Ht=_e.data.index;if(Ht!==void 0){const Zt=getTypedArray(Ht.type,Ht.array);jt.setIndex(new BufferAttribute(Zt,1))}const Wt=_e.data.attributes;for(const Zt in Wt){const Jt=Wt[Zt];let nn;if(Jt.isInterleavedBufferAttribute){const rn=Gt(_e.data,Jt.data);nn=new InterleavedBufferAttribute(rn,Jt.itemSize,Jt.offset,Jt.normalized)}else{const rn=getTypedArray(Jt.type,Jt.array),Qt=Jt.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;nn=new Qt(rn,Jt.itemSize,Jt.normalized)}Jt.name!==void 0&&(nn.name=Jt.name),Jt.usage!==void 0&&nn.setUsage(Jt.usage),jt.setAttribute(Zt,nn)}const qt=_e.data.morphAttributes;if(qt)for(const Zt in qt){const Jt=qt[Zt],nn=[];for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];let tn;if(en.isInterleavedBufferAttribute){const sn=Gt(_e.data,en.data);tn=new InterleavedBufferAttribute(sn,en.itemSize,en.offset,en.normalized)}else{const sn=getTypedArray(en.type,en.array);tn=new BufferAttribute(sn,en.itemSize,en.normalized)}en.name!==void 0&&(tn.name=en.name),nn.push(tn)}jt.morphAttributes[Zt]=nn}_e.data.morphTargetsRelative&&(jt.morphTargetsRelative=!0);const Kt=_e.data.groups||_e.data.drawcalls||_e.data.offsets;if(Kt!==void 0)for(let Zt=0,Jt=Kt.length;Zt!==Jt;++Zt){const nn=Kt[Zt];jt.addGroup(nn.start,nn.count,nn.materialIndex)}const Yt=_e.data.boundingSphere;if(Yt!==void 0){const Zt=new Vector3;Yt.center!==void 0&&Zt.fromArray(Yt.center),jt.boundingSphere=new Sphere(Zt,Yt.radius)}return _e.name&&(jt.name=_e.name),_e.userData&&(jt.userData=_e.userData),jt}}class ObjectLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||jt;const Ht=new FileLoader(this.manager);Ht.setPath(this.path),Ht.setRequestHeader(this.requestHeader),Ht.setWithCredentials(this.withCredentials),Ht.load(_e,function(Wt){let qt=null;try{qt=JSON.parse(Wt)}catch(Kt){Gt!==void 0&&Gt(Kt),console.error("THREE:ObjectLoader: Can't parse "+_e+".",Kt.message);return}const Xt=qt.metadata;if(Xt===void 0||Xt.type===void 0||Xt.type.toLowerCase()==="geometry"){Gt!==void 0&&Gt(new Error("THREE.ObjectLoader: Can't load "+_e)),console.error("THREE.ObjectLoader: Can't load "+_e);return}zt.parse(qt,Dt)},Vt,Gt)}async loadAsync(_e,Dt){const Vt=this,Gt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||Gt;const zt=new FileLoader(this.manager);zt.setPath(this.path),zt.setRequestHeader(this.requestHeader),zt.setWithCredentials(this.withCredentials);const jt=await zt.loadAsync(_e,Dt),Ht=JSON.parse(jt),Wt=Ht.metadata;if(Wt===void 0||Wt.type===void 0||Wt.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+_e);return await Vt.parseAsync(Ht)}parse(_e,Dt){const Vt=this.parseAnimations(_e.animations),Gt=this.parseShapes(_e.shapes),zt=this.parseGeometries(_e.geometries,Gt),jt=this.parseImages(_e.images,function(){Dt!==void 0&&Dt(qt)}),Ht=this.parseTextures(_e.textures,jt),Wt=this.parseMaterials(_e.materials,Ht),qt=this.parseObject(_e.object,zt,Wt,Ht,Vt),Xt=this.parseSkeletons(_e.skeletons,qt);if(this.bindSkeletons(qt,Xt),Dt!==void 0){let Kt=!1;for(const Yt in jt)if(jt[Yt].data instanceof HTMLImageElement){Kt=!0;break}Kt===!1&&Dt(qt)}return qt}async parseAsync(_e){const Dt=this.parseAnimations(_e.animations),Vt=this.parseShapes(_e.shapes),Gt=this.parseGeometries(_e.geometries,Vt),zt=await this.parseImagesAsync(_e.images),jt=this.parseTextures(_e.textures,zt),Ht=this.parseMaterials(_e.materials,jt),Wt=this.parseObject(_e.object,Gt,Ht,jt,Dt),qt=this.parseSkeletons(_e.skeletons,Wt);return this.bindSkeletons(Wt,qt),Wt}parseShapes(_e){const Dt={};if(_e!==void 0)for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++){const zt=new Shape().fromJSON(_e[Vt]);Dt[zt.uuid]=zt}return Dt}parseSkeletons(_e,Dt){const Vt={},Gt={};if(Dt.traverse(function(zt){zt.isBone&&(Gt[zt.uuid]=zt)}),_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=new Skeleton().fromJSON(_e[zt],Gt);Vt[Ht.uuid]=Ht}return Vt}parseGeometries(_e,Dt){const Vt={};if(_e!==void 0){const Gt=new BufferGeometryLoader;for(let zt=0,jt=_e.length;zt<jt;zt++){let Ht;const Wt=_e[zt];switch(Wt.type){case"BufferGeometry":case"InstancedBufferGeometry":Ht=Gt.parse(Wt);break;default:Wt.type in Geometries?Ht=Geometries[Wt.type].fromJSON(Wt,Dt):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${Wt.type}"`)}Ht.uuid=Wt.uuid,Wt.name!==void 0&&(Ht.name=Wt.name),Wt.userData!==void 0&&(Ht.userData=Wt.userData),Vt[Wt.uuid]=Ht}}return Vt}parseMaterials(_e,Dt){const Vt={},Gt={};if(_e!==void 0){const zt=new MaterialLoader;zt.setTextures(Dt);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt];Vt[Wt.uuid]===void 0&&(Vt[Wt.uuid]=zt.parse(Wt)),Gt[Wt.uuid]=Vt[Wt.uuid]}}return Gt}parseAnimations(_e){const Dt={};if(_e!==void 0)for(let Vt=0;Vt<_e.length;Vt++){const Gt=_e[Vt],zt=AnimationClip.parse(Gt);Dt[zt.uuid]=zt}return Dt}parseImages(_e,Dt){const Vt=this,Gt={};let zt;function jt(Wt){return Vt.manager.itemStart(Wt),zt.load(Wt,function(){Vt.manager.itemEnd(Wt)},void 0,function(){Vt.manager.itemError(Wt),Vt.manager.itemEnd(Wt)})}function Ht(Wt){if(typeof Wt=="string"){const qt=Wt,Xt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(qt)?qt:Vt.resourcePath+qt;return jt(Xt)}else return Wt.data?{data:getTypedArray(Wt.type,Wt.data),width:Wt.width,height:Wt.height}:null}if(_e!==void 0&&_e.length>0){const Wt=new LoadingManager(Dt);zt=new ImageLoader(Wt),zt.setCrossOrigin(this.crossOrigin);for(let qt=0,Xt=_e.length;qt<Xt;qt++){const Kt=_e[qt],Yt=Kt.url;if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt],Qt=Ht(rn);Qt!==null&&(Qt instanceof HTMLImageElement?Zt.push(Qt):Zt.push(new DataTexture(Qt.data,Qt.width,Qt.height)))}Gt[Kt.uuid]=new Source(Zt)}else{const Zt=Ht(Kt.url);Gt[Kt.uuid]=new Source(Zt)}}}return Gt}async parseImagesAsync(_e){const Dt=this,Vt={};let Gt;async function zt(jt){if(typeof jt=="string"){const Ht=jt,Wt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(Ht)?Ht:Dt.resourcePath+Ht;return await Gt.loadAsync(Wt)}else return jt.data?{data:getTypedArray(jt.type,jt.data),width:jt.width,height:jt.height}:null}if(_e!==void 0&&_e.length>0){Gt=new ImageLoader(this.manager),Gt.setCrossOrigin(this.crossOrigin);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt],qt=Wt.url;if(Array.isArray(qt)){const Xt=[];for(let Kt=0,Yt=qt.length;Kt<Yt;Kt++){const Zt=qt[Kt],Jt=await zt(Zt);Jt!==null&&(Jt instanceof HTMLImageElement?Xt.push(Jt):Xt.push(new DataTexture(Jt.data,Jt.width,Jt.height)))}Vt[Wt.uuid]=new Source(Xt)}else{const Xt=await zt(Wt.url);Vt[Wt.uuid]=new Source(Xt)}}}return Vt}parseTextures(_e,Dt){function Vt(zt,jt){return typeof zt=="number"?zt:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",zt),jt[zt])}const Gt={};if(_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt];Ht.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',Ht.uuid),Dt[Ht.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",Ht.image);const Wt=Dt[Ht.image],qt=Wt.data;let Xt;Array.isArray(qt)?(Xt=new CubeTexture,qt.length===6&&(Xt.needsUpdate=!0)):(qt&&qt.data?Xt=new DataTexture:Xt=new Texture,qt&&(Xt.needsUpdate=!0)),Xt.source=Wt,Xt.uuid=Ht.uuid,Ht.name!==void 0&&(Xt.name=Ht.name),Ht.mapping!==void 0&&(Xt.mapping=Vt(Ht.mapping,TEXTURE_MAPPING)),Ht.channel!==void 0&&(Xt.channel=Ht.channel),Ht.offset!==void 0&&Xt.offset.fromArray(Ht.offset),Ht.repeat!==void 0&&Xt.repeat.fromArray(Ht.repeat),Ht.center!==void 0&&Xt.center.fromArray(Ht.center),Ht.rotation!==void 0&&(Xt.rotation=Ht.rotation),Ht.wrap!==void 0&&(Xt.wrapS=Vt(Ht.wrap[0],TEXTURE_WRAPPING),Xt.wrapT=Vt(Ht.wrap[1],TEXTURE_WRAPPING)),Ht.format!==void 0&&(Xt.format=Ht.format),Ht.internalFormat!==void 0&&(Xt.internalFormat=Ht.internalFormat),Ht.type!==void 0&&(Xt.type=Ht.type),Ht.colorSpace!==void 0&&(Xt.colorSpace=Ht.colorSpace),Ht.minFilter!==void 0&&(Xt.minFilter=Vt(Ht.minFilter,TEXTURE_FILTER)),Ht.magFilter!==void 0&&(Xt.magFilter=Vt(Ht.magFilter,TEXTURE_FILTER)),Ht.anisotropy!==void 0&&(Xt.anisotropy=Ht.anisotropy),Ht.flipY!==void 0&&(Xt.flipY=Ht.flipY),Ht.generateMipmaps!==void 0&&(Xt.generateMipmaps=Ht.generateMipmaps),Ht.premultiplyAlpha!==void 0&&(Xt.premultiplyAlpha=Ht.premultiplyAlpha),Ht.unpackAlignment!==void 0&&(Xt.unpackAlignment=Ht.unpackAlignment),Ht.compareFunction!==void 0&&(Xt.compareFunction=Ht.compareFunction),Ht.userData!==void 0&&(Xt.userData=Ht.userData),Gt[Ht.uuid]=Xt}return Gt}parseObject(_e,Dt,Vt,Gt,zt){let jt;function Ht(Yt){return Dt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",Yt),Dt[Yt]}function Wt(Yt){if(Yt!==void 0){if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt];Vt[rn]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",rn),Zt.push(Vt[rn])}return Zt}return Vt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",Yt),Vt[Yt]}}function qt(Yt){return Gt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",Yt),Gt[Yt]}let Xt,Kt;switch(_e.type){case"Scene":jt=new Scene,_e.background!==void 0&&(Number.isInteger(_e.background)?jt.background=new Color$1(_e.background):jt.background=qt(_e.background)),_e.environment!==void 0&&(jt.environment=qt(_e.environment)),_e.fog!==void 0&&(_e.fog.type==="Fog"?jt.fog=new Fog(_e.fog.color,_e.fog.near,_e.fog.far):_e.fog.type==="FogExp2"&&(jt.fog=new FogExp2(_e.fog.color,_e.fog.density)),_e.fog.name!==""&&(jt.fog.name=_e.fog.name)),_e.backgroundBlurriness!==void 0&&(jt.backgroundBlurriness=_e.backgroundBlurriness),_e.backgroundIntensity!==void 0&&(jt.backgroundIntensity=_e.backgroundIntensity),_e.backgroundRotation!==void 0&&jt.backgroundRotation.fromArray(_e.backgroundRotation),_e.environmentIntensity!==void 0&&(jt.environmentIntensity=_e.environmentIntensity),_e.environmentRotation!==void 0&&jt.environmentRotation.fromArray(_e.environmentRotation);break;case"PerspectiveCamera":jt=new PerspectiveCamera(_e.fov,_e.aspect,_e.near,_e.far),_e.focus!==void 0&&(jt.focus=_e.focus),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.filmGauge!==void 0&&(jt.filmGauge=_e.filmGauge),_e.filmOffset!==void 0&&(jt.filmOffset=_e.filmOffset),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"OrthographicCamera":jt=new OrthographicCamera(_e.left,_e.right,_e.top,_e.bottom,_e.near,_e.far),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"AmbientLight":jt=new AmbientLight(_e.color,_e.intensity);break;case"DirectionalLight":jt=new DirectionalLight(_e.color,_e.intensity);break;case"PointLight":jt=new PointLight(_e.color,_e.intensity,_e.distance,_e.decay);break;case"RectAreaLight":jt=new RectAreaLight(_e.color,_e.intensity,_e.width,_e.height);break;case"SpotLight":jt=new SpotLight(_e.color,_e.intensity,_e.distance,_e.angle,_e.penumbra,_e.decay);break;case"HemisphereLight":jt=new HemisphereLight(_e.color,_e.groundColor,_e.intensity);break;case"LightProbe":jt=new LightProbe().fromJSON(_e);break;case"SkinnedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new SkinnedMesh(Xt,Kt),_e.bindMode!==void 0&&(jt.bindMode=_e.bindMode),_e.bindMatrix!==void 0&&jt.bindMatrix.fromArray(_e.bindMatrix),_e.skeleton!==void 0&&(jt.skeleton=_e.skeleton);break;case"Mesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new Mesh(Xt,Kt);break;case"InstancedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material);const Yt=_e.count,Zt=_e.instanceMatrix,Jt=_e.instanceColor;jt=new InstancedMesh(Xt,Kt,Yt),jt.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Zt.array),16),Jt!==void 0&&(jt.instanceColor=new InstancedBufferAttribute(new Float32Array(Jt.array),Jt.itemSize));break;case"BatchedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new BatchedMesh(_e.maxGeometryCount,_e.maxVertexCount,_e.maxIndexCount,Kt),jt.geometry=Xt,jt.perObjectFrustumCulled=_e.perObjectFrustumCulled,jt.sortObjects=_e.sortObjects,jt._drawRanges=_e.drawRanges,jt._reservedRanges=_e.reservedRanges,jt._visibility=_e.visibility,jt._active=_e.active,jt._bounds=_e.bounds.map(nn=>{const rn=new Box3;rn.min.fromArray(nn.boxMin),rn.max.fromArray(nn.boxMax);const Qt=new Sphere;return Qt.radius=nn.sphereRadius,Qt.center.fromArray(nn.sphereCenter),{boxInitialized:nn.boxInitialized,box:rn,sphereInitialized:nn.sphereInitialized,sphere:Qt}}),jt._maxGeometryCount=_e.maxGeometryCount,jt._maxVertexCount=_e.maxVertexCount,jt._maxIndexCount=_e.maxIndexCount,jt._geometryInitialized=_e.geometryInitialized,jt._geometryCount=_e.geometryCount,jt._matricesTexture=qt(_e.matricesTexture.uuid);break;case"LOD":jt=new LOD;break;case"Line":jt=new Line(Ht(_e.geometry),Wt(_e.material));break;case"LineLoop":jt=new LineLoop(Ht(_e.geometry),Wt(_e.material));break;case"LineSegments":jt=new LineSegments(Ht(_e.geometry),Wt(_e.material));break;case"PointCloud":case"Points":jt=new Points(Ht(_e.geometry),Wt(_e.material));break;case"Sprite":jt=new Sprite(Wt(_e.material));break;case"Group":jt=new Group;break;case"Bone":jt=new Bone;break;default:jt=new Object3D}if(jt.uuid=_e.uuid,_e.name!==void 0&&(jt.name=_e.name),_e.matrix!==void 0?(jt.matrix.fromArray(_e.matrix),_e.matrixAutoUpdate!==void 0&&(jt.matrixAutoUpdate=_e.matrixAutoUpdate),jt.matrixAutoUpdate&&jt.matrix.decompose(jt.position,jt.quaternion,jt.scale)):(_e.position!==void 0&&jt.position.fromArray(_e.position),_e.rotation!==void 0&&jt.rotation.fromArray(_e.rotation),_e.quaternion!==void 0&&jt.quaternion.fromArray(_e.quaternion),_e.scale!==void 0&&jt.scale.fromArray(_e.scale)),_e.up!==void 0&&jt.up.fromArray(_e.up),_e.castShadow!==void 0&&(jt.castShadow=_e.castShadow),_e.receiveShadow!==void 0&&(jt.receiveShadow=_e.receiveShadow),_e.shadow&&(_e.shadow.bias!==void 0&&(jt.shadow.bias=_e.shadow.bias),_e.shadow.normalBias!==void 0&&(jt.shadow.normalBias=_e.shadow.normalBias),_e.shadow.radius!==void 0&&(jt.shadow.radius=_e.shadow.radius),_e.shadow.mapSize!==void 0&&jt.shadow.mapSize.fromArray(_e.shadow.mapSize),_e.shadow.camera!==void 0&&(jt.shadow.camera=this.parseObject(_e.shadow.camera))),_e.visible!==void 0&&(jt.visible=_e.visible),_e.frustumCulled!==void 0&&(jt.frustumCulled=_e.frustumCulled),_e.renderOrder!==void 0&&(jt.renderOrder=_e.renderOrder),_e.userData!==void 0&&(jt.userData=_e.userData),_e.layers!==void 0&&(jt.layers.mask=_e.layers),_e.children!==void 0){const Yt=_e.children;for(let Zt=0;Zt<Yt.length;Zt++)jt.add(this.parseObject(Yt[Zt],Dt,Vt,Gt,zt))}if(_e.animations!==void 0){const Yt=_e.animations;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt];jt.animations.push(zt[Jt])}}if(_e.type==="LOD"){_e.autoUpdate!==void 0&&(jt.autoUpdate=_e.autoUpdate);const Yt=_e.levels;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt],nn=jt.getObjectByProperty("uuid",Jt.object);nn!==void 0&&jt.addLevel(nn,Jt.distance,Jt.hysteresis)}}return jt}bindSkeletons(_e,Dt){Object.keys(Dt).length!==0&&_e.traverse(function(Vt){if(Vt.isSkinnedMesh===!0&&Vt.skeleton!==void 0){const Gt=Dt[Vt.skeleton];Gt===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",Vt.skeleton):Vt.bind(Gt,Vt.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,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0){if(zt.manager.itemStart(_e),jt.then){jt.then(qt=>{Dt&&Dt(qt),zt.manager.itemEnd(_e)}).catch(qt=>{Gt&&Gt(qt)});return}return setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt}const Ht={};Ht.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",Ht.headers=this.requestHeader;const Wt=fetch(_e,Ht).then(function(qt){return qt.blob()}).then(function(qt){return createImageBitmap(qt,Object.assign(zt.options,{colorSpaceConversion:"none"}))}).then(function(qt){return Cache.add(_e,qt),Dt&&Dt(qt),zt.manager.itemEnd(_e),qt}).catch(function(qt){Gt&&Gt(qt),Cache.remove(_e),zt.manager.itemError(_e),zt.manager.itemEnd(_e)});Cache.add(_e,Wt),zt.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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setResponseType("arraybuffer"),jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Wt){try{const qt=Wt.slice(0);AudioContext.getContext().decodeAudioData(qt,function(Kt){Dt(Kt)}).catch(Ht)}catch(qt){Ht(qt)}},Vt,Gt);function Ht(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}}}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 Dt=this._cache;if(Dt.focus!==_e.focus||Dt.fov!==_e.fov||Dt.aspect!==_e.aspect*this.aspect||Dt.near!==_e.near||Dt.far!==_e.far||Dt.zoom!==_e.zoom||Dt.eyeSep!==this.eyeSep){Dt.focus=_e.focus,Dt.fov=_e.fov,Dt.aspect=_e.aspect*this.aspect,Dt.near=_e.near,Dt.far=_e.far,Dt.zoom=_e.zoom,Dt.eyeSep=this.eyeSep,_projectionMatrix.copy(_e.projectionMatrix);const Gt=Dt.eyeSep/2,zt=Gt*Dt.near/Dt.focus,jt=Dt.near*Math.tan(DEG2RAD$1*Dt.fov*.5)/Dt.zoom;let Ht,Wt;_eyeLeft.elements[12]=-Gt,_eyeRight.elements[12]=Gt,Ht=-jt*Dt.aspect+zt,Wt=jt*Dt.aspect+zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraL.projectionMatrix.copy(_projectionMatrix),Ht=-jt*Dt.aspect-zt,Wt=jt*Dt.aspect-zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),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 Dt=now();_e=(Dt-this.oldTime)/1e3,this.oldTime=Dt,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 Dt=this.context.listener,Vt=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),Dt.positionX){const Gt=this.context.currentTime+this.timeDelta;Dt.positionX.linearRampToValueAtTime(_position$1.x,Gt),Dt.positionY.linearRampToValueAtTime(_position$1.y,Gt),Dt.positionZ.linearRampToValueAtTime(_position$1.z,Gt),Dt.forwardX.linearRampToValueAtTime(_orientation$1.x,Gt),Dt.forwardY.linearRampToValueAtTime(_orientation$1.y,Gt),Dt.forwardZ.linearRampToValueAtTime(_orientation$1.z,Gt),Dt.upX.linearRampToValueAtTime(Vt.x,Gt),Dt.upY.linearRampToValueAtTime(Vt.y,Gt),Dt.upZ.linearRampToValueAtTime(Vt.z,Gt)}else Dt.setPosition(_position$1.x,_position$1.y,_position$1.z),Dt.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,Vt.x,Vt.y,Vt.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 Dt=this.context.createBufferSource();return Dt.buffer=this.buffer,Dt.loop=this.loop,Dt.loopStart=this.loopStart,Dt.loopEnd=this.loopEnd,Dt.onended=this.onEnded.bind(this),Dt.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Dt,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!==null&&(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,Dt=this.filters.length;_e<Dt;_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._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_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){return this.detune=_e,this.isPlaying===!0&&this.source.detune!==void 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)}connect(){super.connect(),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,Dt,Vt){return this.panner.coneInnerAngle=_e,this.panner.coneOuterAngle=Dt,this.panner.coneOuterGain=Vt,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 Dt=this.panner;if(Dt.positionX){const Vt=this.context.currentTime+this.listener.timeDelta;Dt.positionX.linearRampToValueAtTime(_position.x,Vt),Dt.positionY.linearRampToValueAtTime(_position.y,Vt),Dt.positionZ.linearRampToValueAtTime(_position.z,Vt),Dt.orientationX.linearRampToValueAtTime(_orientation.x,Vt),Dt.orientationY.linearRampToValueAtTime(_orientation.y,Vt),Dt.orientationZ.linearRampToValueAtTime(_orientation.z,Vt)}else Dt.setPosition(_position.x,_position.y,_position.z),Dt.setOrientation(_orientation.x,_orientation.y,_orientation.z)}}class AudioAnalyser{constructor(_e,Dt=2048){this.analyser=_e.context.createAnalyser(),this.analyser.fftSize=Dt,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 Dt=this.getFrequencyData();for(let Vt=0;Vt<Dt.length;Vt++)_e+=Dt[Vt];return _e/Dt.length}}class PropertyMixer{constructor(_e,Dt,Vt){this.binding=_e,this.valueSize=Vt;let Gt,zt,jt;switch(Dt){case"quaternion":Gt=this._slerp,zt=this._slerpAdditive,jt=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(Vt*6),this._workIndex=5;break;case"string":case"bool":Gt=this._select,zt=this._select,jt=this._setAdditiveIdentityOther,this.buffer=new Array(Vt*5);break;default:Gt=this._lerp,zt=this._lerpAdditive,jt=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(Vt*5)}this._mixBufferRegion=Gt,this._mixBufferRegionAdditive=zt,this._setIdentity=jt,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(_e,Dt){const Vt=this.buffer,Gt=this.valueSize,zt=_e*Gt+Gt;let jt=this.cumulativeWeight;if(jt===0){for(let Ht=0;Ht!==Gt;++Ht)Vt[zt+Ht]=Vt[Ht];jt=Dt}else{jt+=Dt;const Ht=Dt/jt;this._mixBufferRegion(Vt,zt,0,Ht,Gt)}this.cumulativeWeight=jt}accumulateAdditive(_e){const Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(Dt,Gt,0,_e,Vt),this.cumulativeWeightAdditive+=_e}apply(_e){const Dt=this.valueSize,Vt=this.buffer,Gt=_e*Dt+Dt,zt=this.cumulativeWeight,jt=this.cumulativeWeightAdditive,Ht=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,zt<1){const Wt=Dt*this._origIndex;this._mixBufferRegion(Vt,Gt,Wt,1-zt,Dt)}jt>0&&this._mixBufferRegionAdditive(Vt,Gt,this._addIndex*Dt,1,Dt);for(let Wt=Dt,qt=Dt+Dt;Wt!==qt;++Wt)if(Vt[Wt]!==Vt[Wt+Dt]){Ht.setValue(Vt,Gt);break}}saveOriginalState(){const _e=this.binding,Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._origIndex;_e.getValue(Dt,Gt);for(let zt=Vt,jt=Gt;zt!==jt;++zt)Dt[zt]=Dt[Gt+zt%Vt];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,Dt=_e+this.valueSize;for(let Vt=_e;Vt<Dt;Vt++)this.buffer[Vt]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const _e=this._origIndex*this.valueSize,Dt=this._addIndex*this.valueSize;for(let Vt=0;Vt<this.valueSize;Vt++)this.buffer[Dt+Vt]=this.buffer[_e+Vt]}_select(_e,Dt,Vt,Gt,zt){if(Gt>=.5)for(let jt=0;jt!==zt;++jt)_e[Dt+jt]=_e[Vt+jt]}_slerp(_e,Dt,Vt,Gt){Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,Vt,Gt)}_slerpAdditive(_e,Dt,Vt,Gt,zt){const jt=this._workIndex*zt;Quaternion.multiplyQuaternionsFlat(_e,jt,_e,Dt,_e,Vt),Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,jt,Gt)}_lerp(_e,Dt,Vt,Gt,zt){const jt=1-Gt;for(let Ht=0;Ht!==zt;++Ht){const Wt=Dt+Ht;_e[Wt]=_e[Wt]*jt+_e[Vt+Ht]*Gt}}_lerpAdditive(_e,Dt,Vt,Gt,zt){for(let jt=0;jt!==zt;++jt){const Ht=Dt+jt;_e[Ht]=_e[Ht]+_e[Vt+jt]*Gt}}}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,Dt,Vt){const Gt=Vt||PropertyBinding.parseTrackName(Dt);this._targetGroup=_e,this._bindings=_e.subscribe_(Dt,Gt)}getValue(_e,Dt){this.bind();const Vt=this._targetGroup.nCachedObjects_,Gt=this._bindings[Vt];Gt!==void 0&&Gt.getValue(_e,Dt)}setValue(_e,Dt){const Vt=this._bindings;for(let Gt=this._targetGroup.nCachedObjects_,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt].setValue(_e,Dt)}bind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].bind()}unbind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].unbind()}}class PropertyBinding{constructor(_e,Dt,Vt){this.path=Dt,this.parsedPath=Vt||PropertyBinding.parseTrackName(Dt),this.node=PropertyBinding.findNode(_e,this.parsedPath.nodeName),this.rootNode=_e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(_e,Dt,Vt){return _e&&_e.isAnimationObjectGroup?new PropertyBinding.Composite(_e,Dt,Vt):new PropertyBinding(_e,Dt,Vt)}static sanitizeNodeName(_e){return _e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(_e){const Dt=_trackRe.exec(_e);if(Dt===null)throw new Error("PropertyBinding: Cannot parse trackName: "+_e);const Vt={nodeName:Dt[2],objectName:Dt[3],objectIndex:Dt[4],propertyName:Dt[5],propertyIndex:Dt[6]},Gt=Vt.nodeName&&Vt.nodeName.lastIndexOf(".");if(Gt!==void 0&&Gt!==-1){const zt=Vt.nodeName.substring(Gt+1);_supportedObjectNames.indexOf(zt)!==-1&&(Vt.nodeName=Vt.nodeName.substring(0,Gt),Vt.objectName=zt)}if(Vt.propertyName===null||Vt.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+_e);return Vt}static findNode(_e,Dt){if(Dt===void 0||Dt===""||Dt==="."||Dt===-1||Dt===_e.name||Dt===_e.uuid)return _e;if(_e.skeleton){const Vt=_e.skeleton.getBoneByName(Dt);if(Vt!==void 0)return Vt}if(_e.children){const Vt=function(zt){for(let jt=0;jt<zt.length;jt++){const Ht=zt[jt];if(Ht.name===Dt||Ht.uuid===Dt)return Ht;const Wt=Vt(Ht.children);if(Wt)return Wt}return null},Gt=Vt(_e.children);if(Gt)return Gt}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(_e,Dt){_e[Dt]=this.targetObject[this.propertyName]}_getValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)_e[Dt++]=Vt[Gt]}_getValue_arrayElement(_e,Dt){_e[Dt]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(_e,Dt){this.resolvedProperty.toArray(_e,Dt)}_setValue_direct(_e,Dt){this.targetObject[this.propertyName]=_e[Dt]}_setValue_direct_setNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++]}_setValue_array_setNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt]}_setValue_arrayElement_setNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(_e,Dt){this.resolvedProperty.fromArray(_e,Dt)}_setValue_fromArray_setNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(_e,Dt){this.bind(),this.getValue(_e,Dt)}_setValue_unbound(_e,Dt){this.bind(),this.setValue(_e,Dt)}bind(){let _e=this.node;const Dt=this.parsedPath,Vt=Dt.objectName,Gt=Dt.propertyName;let zt=Dt.propertyIndex;if(_e||(_e=PropertyBinding.findNode(this.rootNode,Dt.nodeName),this.node=_e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!_e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(Vt){let qt=Dt.objectIndex;switch(Vt){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 Xt=0;Xt<_e.length;Xt++)if(_e[Xt].name===qt){qt=Xt;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[Vt]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}_e=_e[Vt]}if(qt!==void 0){if(_e[qt]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,_e);return}_e=_e[qt]}}const jt=_e[Gt];if(jt===void 0){const qt=Dt.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+qt+"."+Gt+" but it wasn't found.",_e);return}let Ht=this.Versioning.None;this.targetObject=_e,_e.needsUpdate!==void 0?Ht=this.Versioning.NeedsUpdate:_e.matrixWorldNeedsUpdate!==void 0&&(Ht=this.Versioning.MatrixWorldNeedsUpdate);let Wt=this.BindingType.Direct;if(zt!==void 0){if(Gt==="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[zt]!==void 0&&(zt=_e.morphTargetDictionary[zt])}Wt=this.BindingType.ArrayElement,this.resolvedProperty=jt,this.propertyIndex=zt}else jt.fromArray!==void 0&&jt.toArray!==void 0?(Wt=this.BindingType.HasFromToArray,this.resolvedProperty=jt):Array.isArray(jt)?(Wt=this.BindingType.EntireArray,this.resolvedProperty=jt):this.propertyName=Gt;this.getValue=this.GetterByBindingType[Wt],this.setValue=this.SetterByBindingTypeAndVersioning[Wt][Ht]}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 Vt=0,Gt=arguments.length;Vt!==Gt;++Vt)_e[arguments[Vt].uuid]=Vt;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const Dt=this;this.stats={objects:{get total(){return Dt._objects.length},get inUse(){return this.total-Dt.nCachedObjects_}},get bindingsPerObject(){return Dt._bindings.length}}}add(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._paths,Gt=this._parsedPaths,zt=this._bindings,jt=zt.length;let Ht,Wt=_e.length,qt=this.nCachedObjects_;for(let Xt=0,Kt=arguments.length;Xt!==Kt;++Xt){const Yt=arguments[Xt],Zt=Yt.uuid;let Jt=Dt[Zt];if(Jt===void 0){Jt=Wt++,Dt[Zt]=Jt,_e.push(Yt);for(let nn=0,rn=jt;nn!==rn;++nn)zt[nn].push(new PropertyBinding(Yt,Vt[nn],Gt[nn]))}else if(Jt<qt){Ht=_e[Jt];const nn=--qt,rn=_e[nn];Dt[rn.uuid]=Jt,_e[Jt]=rn,Dt[Zt]=nn,_e[nn]=Yt;for(let Qt=0,en=jt;Qt!==en;++Qt){const tn=zt[Qt],sn=tn[nn];let cn=tn[Jt];tn[Jt]=sn,cn===void 0&&(cn=new PropertyBinding(Yt,Vt[Qt],Gt[Qt])),tn[nn]=cn}}else _e[Jt]!==Ht&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=qt}remove(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_;for(let jt=0,Ht=arguments.length;jt!==Ht;++jt){const Wt=arguments[jt],qt=Wt.uuid,Xt=Dt[qt];if(Xt!==void 0&&Xt>=zt){const Kt=zt++,Yt=_e[Kt];Dt[Yt.uuid]=Xt,_e[Xt]=Yt,Dt[qt]=Kt,_e[Kt]=Wt;for(let Zt=0,Jt=Gt;Zt!==Jt;++Zt){const nn=Vt[Zt],rn=nn[Kt],Qt=nn[Xt];nn[Xt]=rn,nn[Kt]=Qt}}}this.nCachedObjects_=zt}uncache(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_,jt=_e.length;for(let Ht=0,Wt=arguments.length;Ht!==Wt;++Ht){const qt=arguments[Ht],Xt=qt.uuid,Kt=Dt[Xt];if(Kt!==void 0)if(delete Dt[Xt],Kt<zt){const Yt=--zt,Zt=_e[Yt],Jt=--jt,nn=_e[Jt];Dt[Zt.uuid]=Kt,_e[Kt]=Zt,Dt[nn.uuid]=Yt,_e[Yt]=nn,_e.pop();for(let rn=0,Qt=Gt;rn!==Qt;++rn){const en=Vt[rn],tn=en[Yt],sn=en[Jt];en[Kt]=tn,en[Yt]=sn,en.pop()}}else{const Yt=--jt,Zt=_e[Yt];Yt>0&&(Dt[Zt.uuid]=Kt),_e[Kt]=Zt,_e.pop();for(let Jt=0,nn=Gt;Jt!==nn;++Jt){const rn=Vt[Jt];rn[Kt]=rn[Yt],rn.pop()}}}this.nCachedObjects_=zt}subscribe_(_e,Dt){const Vt=this._bindingsIndicesByPath;let Gt=Vt[_e];const zt=this._bindings;if(Gt!==void 0)return zt[Gt];const jt=this._paths,Ht=this._parsedPaths,Wt=this._objects,qt=Wt.length,Xt=this.nCachedObjects_,Kt=new Array(qt);Gt=zt.length,Vt[_e]=Gt,jt.push(_e),Ht.push(Dt),zt.push(Kt);for(let Yt=Xt,Zt=Wt.length;Yt!==Zt;++Yt){const Jt=Wt[Yt];Kt[Yt]=new PropertyBinding(Jt,_e,Dt)}return Kt}unsubscribe_(_e){const Dt=this._bindingsIndicesByPath,Vt=Dt[_e];if(Vt!==void 0){const Gt=this._paths,zt=this._parsedPaths,jt=this._bindings,Ht=jt.length-1,Wt=jt[Ht],qt=_e[Ht];Dt[qt]=Vt,jt[Vt]=Wt,jt.pop(),zt[Vt]=zt[Ht],zt.pop(),Gt[Vt]=Gt[Ht],Gt.pop()}}}class AnimationAction{constructor(_e,Dt,Vt=null,Gt=Dt.blendMode){this._mixer=_e,this._clip=Dt,this._localRoot=Vt,this.blendMode=Gt;const zt=Dt.tracks,jt=zt.length,Ht=new Array(jt),Wt={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let qt=0;qt!==jt;++qt){const Xt=zt[qt].createInterpolant(null);Ht[qt]=Xt,Xt.settings=Wt}this._interpolantSettings=Wt,this._interpolants=Ht,this._propertyBindings=new Array(jt),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat$1,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,Dt){return this.loop=_e,this.repetitions=Dt,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,Dt,Vt){if(_e.fadeOut(Dt),this.fadeIn(Dt),Vt){const Gt=this._clip.duration,zt=_e._clip.duration,jt=zt/Gt,Ht=Gt/zt;_e.warp(1,jt,Dt),this.warp(Ht,1,Dt)}return this}crossFadeTo(_e,Dt,Vt){return _e.crossFadeFrom(this,Dt,Vt)}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,Dt,Vt){const Gt=this._mixer,zt=Gt.time,jt=this.timeScale;let Ht=this._timeScaleInterpolant;Ht===null&&(Ht=Gt._lendControlInterpolant(),this._timeScaleInterpolant=Ht);const Wt=Ht.parameterPositions,qt=Ht.sampleValues;return Wt[0]=zt,Wt[1]=zt+Vt,qt[0]=_e/jt,qt[1]=Dt/jt,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,Dt,Vt,Gt){if(!this.enabled){this._updateWeight(_e);return}const zt=this._startTime;if(zt!==null){const Wt=(_e-zt)*Vt;Wt<0||Vt===0?Dt=0:(this._startTime=null,Dt=Vt*Wt)}Dt*=this._updateTimeScale(_e);const jt=this._updateTime(Dt),Ht=this._updateWeight(_e);if(Ht>0){const Wt=this._interpolants,qt=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulateAdditive(Ht);break;case NormalAnimationBlendMode:default:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulate(Gt,Ht)}}}_updateWeight(_e){let Dt=0;if(this.enabled){Dt=this.weight;const Vt=this._weightInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopFading(),Gt===0&&(this.enabled=!1))}}return this._effectiveWeight=Dt,Dt}_updateTimeScale(_e){let Dt=0;if(!this.paused){Dt=this.timeScale;const Vt=this._timeScaleInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopWarping(),Dt===0?this.paused=!0:this.timeScale=Dt)}}return this._effectiveTimeScale=Dt,Dt}_updateTime(_e){const Dt=this._clip.duration,Vt=this.loop;let Gt=this.time+_e,zt=this._loopCount;const jt=Vt===LoopPingPong;if(_e===0)return zt===-1?Gt:jt&&(zt&1)===1?Dt-Gt:Gt;if(Vt===LoopOnce$1){zt===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(Gt>=Dt)Gt=Dt;else if(Gt<0)Gt=0;else{this.time=Gt;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e<0?-1:1})}}else{if(zt===-1&&(_e>=0?(zt=0,this._setEndings(!0,this.repetitions===0,jt)):this._setEndings(this.repetitions===0,!0,jt)),Gt>=Dt||Gt<0){const Ht=Math.floor(Gt/Dt);Gt-=Dt*Ht,zt+=Math.abs(Ht);const Wt=this.repetitions-zt;if(Wt<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,Gt=_e>0?Dt:0,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e>0?1:-1});else{if(Wt===1){const qt=_e<0;this._setEndings(qt,!qt,jt)}else this._setEndings(!1,!1,jt);this._loopCount=zt,this.time=Gt,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:Ht})}}else this.time=Gt;if(jt&&(zt&1)===1)return Dt-Gt}return Gt}_setEndings(_e,Dt,Vt){const Gt=this._interpolantSettings;Vt?(Gt.endingStart=ZeroSlopeEnding,Gt.endingEnd=ZeroSlopeEnding):(_e?Gt.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingStart=WrapAroundEnding,Dt?Gt.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingEnd=WrapAroundEnding)}_scheduleFading(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time;let jt=this._weightInterpolant;jt===null&&(jt=Gt._lendControlInterpolant(),this._weightInterpolant=jt);const Ht=jt.parameterPositions,Wt=jt.sampleValues;return Ht[0]=zt,Wt[0]=Dt,Ht[1]=zt+_e,Wt[1]=Vt,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher$2{constructor(_e){super(),this._root=_e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(_e,Dt){const Vt=_e._localRoot||this._root,Gt=_e._clip.tracks,zt=Gt.length,jt=_e._propertyBindings,Ht=_e._interpolants,Wt=Vt.uuid,qt=this._bindingsByRootAndName;let Xt=qt[Wt];Xt===void 0&&(Xt={},qt[Wt]=Xt);for(let Kt=0;Kt!==zt;++Kt){const Yt=Gt[Kt],Zt=Yt.name;let Jt=Xt[Zt];if(Jt!==void 0)++Jt.referenceCount,jt[Kt]=Jt;else{if(Jt=jt[Kt],Jt!==void 0){Jt._cacheIndex===null&&(++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt));continue}const nn=Dt&&Dt._propertyBindings[Kt].binding.parsedPath;Jt=new PropertyMixer(PropertyBinding.create(Vt,Zt,nn),Yt.ValueTypeName,Yt.getValueSize()),++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt),jt[Kt]=Jt}Ht[Kt].resultBuffer=Jt.buffer}}_activateAction(_e){if(!this._isActiveAction(_e)){if(_e._cacheIndex===null){const Vt=(_e._localRoot||this._root).uuid,Gt=_e._clip.uuid,zt=this._actionsByClip[Gt];this._bindAction(_e,zt&&zt.knownActions[0]),this._addInactiveAction(_e,Gt,Vt)}const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];zt.useCount++===0&&(this._lendBinding(zt),zt.saveOriginalState())}this._lendAction(_e)}}_deactivateAction(_e){if(this._isActiveAction(_e)){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.useCount===0&&(zt.restoreOriginalState(),this._takeBackBinding(zt))}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 Dt=_e._cacheIndex;return Dt!==null&&Dt<this._nActiveActions}_addInactiveAction(_e,Dt,Vt){const Gt=this._actions,zt=this._actionsByClip;let jt=zt[Dt];if(jt===void 0)jt={knownActions:[_e],actionByRoot:{}},_e._byClipCacheIndex=0,zt[Dt]=jt;else{const Ht=jt.knownActions;_e._byClipCacheIndex=Ht.length,Ht.push(_e)}_e._cacheIndex=Gt.length,Gt.push(_e),jt.actionByRoot[Vt]=_e}_removeInactiveAction(_e){const Dt=this._actions,Vt=Dt[Dt.length-1],Gt=_e._cacheIndex;Vt._cacheIndex=Gt,Dt[Gt]=Vt,Dt.pop(),_e._cacheIndex=null;const zt=_e._clip.uuid,jt=this._actionsByClip,Ht=jt[zt],Wt=Ht.knownActions,qt=Wt[Wt.length-1],Xt=_e._byClipCacheIndex;qt._byClipCacheIndex=Xt,Wt[Xt]=qt,Wt.pop(),_e._byClipCacheIndex=null;const Kt=Ht.actionByRoot,Yt=(_e._localRoot||this._root).uuid;delete Kt[Yt],Wt.length===0&&delete jt[zt],this._removeInactiveBindingsForAction(_e)}_removeInactiveBindingsForAction(_e){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.referenceCount===0&&this._removeInactiveBinding(zt)}}_lendAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=this._nActiveActions++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=--this._nActiveActions,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_addInactiveBinding(_e,Dt,Vt){const Gt=this._bindingsByRootAndName,zt=this._bindings;let jt=Gt[Dt];jt===void 0&&(jt={},Gt[Dt]=jt),jt[Vt]=_e,_e._cacheIndex=zt.length,zt.push(_e)}_removeInactiveBinding(_e){const Dt=this._bindings,Vt=_e.binding,Gt=Vt.rootNode.uuid,zt=Vt.path,jt=this._bindingsByRootAndName,Ht=jt[Gt],Wt=Dt[Dt.length-1],qt=_e._cacheIndex;Wt._cacheIndex=qt,Dt[qt]=Wt,Dt.pop(),delete Ht[zt],Object.keys(Ht).length===0&&delete jt[Gt]}_lendBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=this._nActiveBindings++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=--this._nActiveBindings,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_lendControlInterpolant(){const _e=this._controlInterpolants,Dt=this._nActiveControlInterpolants++;let Vt=_e[Dt];return Vt===void 0&&(Vt=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer),Vt.__cacheIndex=Dt,_e[Dt]=Vt),Vt}_takeBackControlInterpolant(_e){const Dt=this._controlInterpolants,Vt=_e.__cacheIndex,Gt=--this._nActiveControlInterpolants,zt=Dt[Gt];_e.__cacheIndex=Gt,Dt[Gt]=_e,zt.__cacheIndex=Vt,Dt[Vt]=zt}clipAction(_e,Dt,Vt){const Gt=Dt||this._root,zt=Gt.uuid;let jt=typeof _e=="string"?AnimationClip.findByName(Gt,_e):_e;const Ht=jt!==null?jt.uuid:_e,Wt=this._actionsByClip[Ht];let qt=null;if(Vt===void 0&&(jt!==null?Vt=jt.blendMode:Vt=NormalAnimationBlendMode),Wt!==void 0){const Kt=Wt.actionByRoot[zt];if(Kt!==void 0&&Kt.blendMode===Vt)return Kt;qt=Wt.knownActions[0],jt===null&&(jt=qt._clip)}if(jt===null)return null;const Xt=new AnimationAction(this,jt,Dt,Vt);return this._bindAction(Xt,qt),this._addInactiveAction(Xt,Ht,zt),Xt}existingAction(_e,Dt){const Vt=Dt||this._root,Gt=Vt.uuid,zt=typeof _e=="string"?AnimationClip.findByName(Vt,_e):_e,jt=zt?zt.uuid:_e,Ht=this._actionsByClip[jt];return Ht!==void 0&&Ht.actionByRoot[Gt]||null}stopAllAction(){const _e=this._actions,Dt=this._nActiveActions;for(let Vt=Dt-1;Vt>=0;--Vt)_e[Vt].stop();return this}update(_e){_e*=this.timeScale;const Dt=this._actions,Vt=this._nActiveActions,Gt=this.time+=_e,zt=Math.sign(_e),jt=this._accuIndex^=1;for(let qt=0;qt!==Vt;++qt)Dt[qt]._update(Gt,_e,zt,jt);const Ht=this._bindings,Wt=this._nActiveBindings;for(let qt=0;qt!==Wt;++qt)Ht[qt].apply(jt);return this}setTime(_e){this.time=0;for(let Dt=0;Dt<this._actions.length;Dt++)this._actions[Dt].time=0;return this.update(_e)}getRoot(){return this._root}uncacheClip(_e){const Dt=this._actions,Vt=_e.uuid,Gt=this._actionsByClip,zt=Gt[Vt];if(zt!==void 0){const jt=zt.knownActions;for(let Ht=0,Wt=jt.length;Ht!==Wt;++Ht){const qt=jt[Ht];this._deactivateAction(qt);const Xt=qt._cacheIndex,Kt=Dt[Dt.length-1];qt._cacheIndex=null,qt._byClipCacheIndex=null,Kt._cacheIndex=Xt,Dt[Xt]=Kt,Dt.pop(),this._removeInactiveBindingsForAction(qt)}delete Gt[Vt]}}uncacheRoot(_e){const Dt=_e.uuid,Vt=this._actionsByClip;for(const jt in Vt){const Ht=Vt[jt].actionByRoot,Wt=Ht[Dt];Wt!==void 0&&(this._deactivateAction(Wt),this._removeInactiveAction(Wt))}const Gt=this._bindingsByRootAndName,zt=Gt[Dt];if(zt!==void 0)for(const jt in zt){const Ht=zt[jt];Ht.restoreOriginalState(),this._removeInactiveBinding(Ht)}}uncacheAction(_e,Dt){const Vt=this.existingAction(_e,Dt);Vt!==null&&(this._deactivateAction(Vt),this._removeInactiveAction(Vt))}}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$2{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 Dt=this.uniforms.indexOf(_e);return Dt!==-1&&this.uniforms.splice(Dt,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 Dt=_e.uniforms;this.uniforms.length=0;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Array.isArray(Dt[Vt])?Dt[Vt]:[Dt[Vt]];for(let jt=0;jt<zt.length;jt++)this.uniforms.push(zt[jt].clone())}return this}clone(){return new this.constructor().copy(this)}}class InstancedInterleavedBuffer extends InterleavedBuffer{constructor(_e,Dt,Vt=1){super(_e,Dt),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=Vt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}clone(_e){const Dt=super.clone(_e);return Dt.meshPerAttribute=this.meshPerAttribute,Dt}toJSON(_e){const Dt=super.toJSON(_e);return Dt.isInstancedInterleavedBuffer=!0,Dt.meshPerAttribute=this.meshPerAttribute,Dt}}class GLBufferAttribute{constructor(_e,Dt,Vt,Gt,zt){this.isGLBufferAttribute=!0,this.name="",this.buffer=_e,this.type=Dt,this.itemSize=Vt,this.elementSize=Gt,this.count=zt,this.version=0}set needsUpdate(_e){_e===!0&&this.version++}setBuffer(_e){return this.buffer=_e,this}setType(_e,Dt){return this.type=_e,this.elementSize=Dt,this}setItemSize(_e){return this.itemSize=_e,this}setCount(_e){return this.count=_e,this}}const _matrix=new Matrix4;class Raycaster{constructor(_e,Dt,Vt=0,Gt=1/0){this.ray=new Ray(_e,Dt),this.near=Vt,this.far=Gt,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(_e,Dt){this.ray.set(_e,Dt)}setFromCamera(_e,Dt){Dt.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Dt.matrixWorld),this.ray.direction.set(_e.x,_e.y,.5).unproject(Dt).sub(this.ray.origin).normalize(),this.camera=Dt):Dt.isOrthographicCamera?(this.ray.origin.set(_e.x,_e.y,(Dt.near+Dt.far)/(Dt.near-Dt.far)).unproject(Dt),this.ray.direction.set(0,0,-1).transformDirection(Dt.matrixWorld),this.camera=Dt):console.error("THREE.Raycaster: Unsupported camera type: "+Dt.type)}setFromXRController(_e){return _matrix.identity().extractRotation(_e.matrixWorld),this.ray.origin.setFromMatrixPosition(_e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_matrix),this}intersectObject(_e,Dt=!0,Vt=[]){return intersect(_e,this,Vt,Dt),Vt.sort(ascSort),Vt}intersectObjects(_e,Dt=!0,Vt=[]){for(let Gt=0,zt=_e.length;Gt<zt;Gt++)intersect(_e[Gt],this,Vt,Dt);return Vt.sort(ascSort),Vt}}function ascSort(kt,_e){return kt.distance-_e.distance}function intersect(kt,_e,Dt,Vt){if(kt.layers.test(_e.layers)&&kt.raycast(_e,Dt),Vt===!0){const Gt=kt.children;for(let zt=0,jt=Gt.length;zt<jt;zt++)intersect(Gt[zt],_e,Dt,!0)}}class Spherical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.phi=Dt,this.theta=Vt,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,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Dt*Dt+Vt*Vt),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(_e,Vt),this.phi=Math.acos(clamp$2(Dt/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Cylindrical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.theta=Dt,this.y=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.theta=Dt,this.y=Vt,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,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Vt*Vt),this.theta=Math.atan2(_e,Vt),this.y=Dt,this}clone(){return new this.constructor().copy(this)}}const _vector$4=new Vector2;class Box2{constructor(_e=new Vector2(1/0,1/0),Dt=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=_e,this.max=Dt}set(_e,Dt){return this.min.copy(_e),this.max.copy(Dt),this}setFromPoints(_e){this.makeEmpty();for(let Dt=0,Vt=_e.length;Dt<Vt;Dt++)this.expandByPoint(_e[Dt]);return this}setFromCenterAndSize(_e,Dt){const Vt=_vector$4.copy(Dt).multiplyScalar(.5);return this.min.copy(_e).sub(Vt),this.max.copy(_e).add(Vt),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,Dt){return Dt.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,Dt){return Dt.copy(_e).clamp(this.min,this.max)}distanceToPoint(_e){return this.clampPoint(_e,_vector$4).distanceTo(_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}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,Dt=new Vector3){this.start=_e,this.end=Dt}set(_e,Dt){return this.start.copy(_e),this.end.copy(Dt),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,Dt){return this.delta(Dt).multiplyScalar(_e).add(this.start)}closestPointToPointParameter(_e,Dt){_startP.subVectors(_e,this.start),_startEnd.subVectors(this.end,this.start);const Vt=_startEnd.dot(_startEnd);let zt=_startEnd.dot(_startP)/Vt;return Dt&&(zt=clamp$2(zt,0,1)),zt}closestPointToPoint(_e,Dt,Vt){const Gt=this.closestPointToPointParameter(_e,Dt);return this.delta(Vt).multiplyScalar(Gt).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,Dt){super(),this.light=_e,this.matrixAutoUpdate=!1,this.color=Dt,this.type="SpotLightHelper";const Vt=new BufferGeometry,Gt=[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 jt=0,Ht=1,Wt=32;jt<Wt;jt++,Ht++){const qt=jt/Wt*Math.PI*2,Xt=Ht/Wt*Math.PI*2;Gt.push(Math.cos(qt),Math.sin(qt),1,Math.cos(Xt),Math.sin(Xt),1)}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(Vt,zt),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),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const _e=this.light.distance?this.light.distance:1e3,Dt=_e*Math.tan(this.light.angle);this.cone.scale.set(Dt,Dt,_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 Dt=getBoneList(_e),Vt=new BufferGeometry,Gt=[],zt=[],jt=new Color$1(0,0,1),Ht=new Color$1(0,1,0);for(let qt=0;qt<Dt.length;qt++){const Xt=Dt[qt];Xt.parent&&Xt.parent.isBone&&(Gt.push(0,0,0),Gt.push(0,0,0),zt.push(jt.r,jt.g,jt.b),zt.push(Ht.r,Ht.g,Ht.b))}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Vt.setAttribute("color",new Float32BufferAttribute(zt,3));const Wt=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(Vt,Wt),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=_e,this.bones=Dt,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(_e){const Dt=this.bones,Vt=this.geometry,Gt=Vt.getAttribute("position");_matrixWorldInv.copy(this.root.matrixWorld).invert();for(let zt=0,jt=0;zt<Dt.length;zt++){const Ht=Dt[zt];Ht.parent&&Ht.parent.isBone&&(_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt,_vector$2.x,_vector$2.y,_vector$2.z),_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.parent.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt+1,_vector$2.x,_vector$2.y,_vector$2.z),jt+=2)}Vt.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function getBoneList(kt){const _e=[];kt.isBone===!0&&_e.push(kt);for(let Dt=0;Dt<kt.children.length;Dt++)_e.push.apply(_e,getBoneList(kt.children[Dt]));return _e}class PointLightHelper extends Mesh{constructor(_e,Dt,Vt){const Gt=new SphereGeometry(Dt,4,2),zt=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(Gt,zt),this.light=_e,this.color=Vt,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$1,_color2=new Color$1;class HemisphereLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="HemisphereLightHelper";const Gt=new OctahedronGeometry(Dt);Gt.rotateY(Math.PI*.5),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const zt=Gt.getAttribute("position"),jt=new Float32Array(zt.count*3);Gt.setAttribute("color",new BufferAttribute(jt,3)),this.add(new Mesh(Gt,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 Dt=_e.geometry.getAttribute("color");_color1.copy(this.light.color),_color2.copy(this.light.groundColor);for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){const zt=Vt<Gt/2?_color1:_color2;Dt.setXYZ(Vt,zt.r,zt.g,zt.b)}Dt.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),_e.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GridHelper extends LineSegments{constructor(_e=10,Dt=10,Vt=4473924,Gt=8947848){Vt=new Color$1(Vt),Gt=new Color$1(Gt);const zt=Dt/2,jt=_e/Dt,Ht=_e/2,Wt=[],qt=[];for(let Yt=0,Zt=0,Jt=-Ht;Yt<=Dt;Yt++,Jt+=jt){Wt.push(-Ht,0,Jt,Ht,0,Jt),Wt.push(Jt,0,-Ht,Jt,0,Ht);const nn=Yt===zt?Vt:Gt;nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3}const Xt=new BufferGeometry;Xt.setAttribute("position",new Float32BufferAttribute(Wt,3)),Xt.setAttribute("color",new Float32BufferAttribute(qt,3));const Kt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Xt,Kt),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class PolarGridHelper extends LineSegments{constructor(_e=10,Dt=16,Vt=8,Gt=64,zt=4473924,jt=8947848){zt=new Color$1(zt),jt=new Color$1(jt);const Ht=[],Wt=[];if(Dt>1)for(let Kt=0;Kt<Dt;Kt++){const Yt=Kt/Dt*(Math.PI*2),Zt=Math.sin(Yt)*_e,Jt=Math.cos(Yt)*_e;Ht.push(0,0,0),Ht.push(Zt,0,Jt);const nn=Kt&1?zt:jt;Wt.push(nn.r,nn.g,nn.b),Wt.push(nn.r,nn.g,nn.b)}for(let Kt=0;Kt<Vt;Kt++){const Yt=Kt&1?zt:jt,Zt=_e-_e/Vt*Kt;for(let Jt=0;Jt<Gt;Jt++){let nn=Jt/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt;Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b),nn=(Jt+1)/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt,Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b)}}const qt=new BufferGeometry;qt.setAttribute("position",new Float32BufferAttribute(Ht,3)),qt.setAttribute("color",new Float32BufferAttribute(Wt,3));const Xt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(qt,Xt),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const _v1=new Vector3,_v2$5=new Vector3,_v3=new Vector3;class DirectionalLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="DirectionalLightHelper",Dt===void 0&&(Dt=1);let Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute([-Dt,Dt,0,Dt,Dt,0,Dt,-Dt,0,-Dt,-Dt,0,-Dt,Dt,0],3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(Gt,zt),this.add(this.lightPlane),Gt=new BufferGeometry,Gt.setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(Gt,zt),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$5.setFromMatrixPosition(this.light.target.matrixWorld),_v3.subVectors(_v2$5,_v1),this.lightPlane.lookAt(_v2$5),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$5),this.targetLine.scale.z=_v3.length()}}const _vector=new Vector3,_camera=new Camera;class CameraHelper extends LineSegments{constructor(_e){const Dt=new BufferGeometry,Vt=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),Gt=[],zt=[],jt={};Ht("n1","n2"),Ht("n2","n4"),Ht("n4","n3"),Ht("n3","n1"),Ht("f1","f2"),Ht("f2","f4"),Ht("f4","f3"),Ht("f3","f1"),Ht("n1","f1"),Ht("n2","f2"),Ht("n3","f3"),Ht("n4","f4"),Ht("p","n1"),Ht("p","n2"),Ht("p","n3"),Ht("p","n4"),Ht("u1","u2"),Ht("u2","u3"),Ht("u3","u1"),Ht("c","t"),Ht("p","c"),Ht("cn1","cn2"),Ht("cn3","cn4"),Ht("cf1","cf2"),Ht("cf3","cf4");function Ht(Jt,nn){Wt(Jt),Wt(nn)}function Wt(Jt){Gt.push(0,0,0),zt.push(0,0,0),jt[Jt]===void 0&&(jt[Jt]=[]),jt[Jt].push(Gt.length/3-1)}Dt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Dt.setAttribute("color",new Float32BufferAttribute(zt,3)),super(Dt,Vt),this.type="CameraHelper",this.camera=_e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=jt,this.update();const qt=new Color$1(16755200),Xt=new Color$1(16711680),Kt=new Color$1(43775),Yt=new Color$1(16777215),Zt=new Color$1(3355443);this.setColors(qt,Xt,Kt,Yt,Zt)}setColors(_e,Dt,Vt,Gt,zt){const Ht=this.geometry.getAttribute("color");Ht.setXYZ(0,_e.r,_e.g,_e.b),Ht.setXYZ(1,_e.r,_e.g,_e.b),Ht.setXYZ(2,_e.r,_e.g,_e.b),Ht.setXYZ(3,_e.r,_e.g,_e.b),Ht.setXYZ(4,_e.r,_e.g,_e.b),Ht.setXYZ(5,_e.r,_e.g,_e.b),Ht.setXYZ(6,_e.r,_e.g,_e.b),Ht.setXYZ(7,_e.r,_e.g,_e.b),Ht.setXYZ(8,_e.r,_e.g,_e.b),Ht.setXYZ(9,_e.r,_e.g,_e.b),Ht.setXYZ(10,_e.r,_e.g,_e.b),Ht.setXYZ(11,_e.r,_e.g,_e.b),Ht.setXYZ(12,_e.r,_e.g,_e.b),Ht.setXYZ(13,_e.r,_e.g,_e.b),Ht.setXYZ(14,_e.r,_e.g,_e.b),Ht.setXYZ(15,_e.r,_e.g,_e.b),Ht.setXYZ(16,_e.r,_e.g,_e.b),Ht.setXYZ(17,_e.r,_e.g,_e.b),Ht.setXYZ(18,_e.r,_e.g,_e.b),Ht.setXYZ(19,_e.r,_e.g,_e.b),Ht.setXYZ(20,_e.r,_e.g,_e.b),Ht.setXYZ(21,_e.r,_e.g,_e.b),Ht.setXYZ(22,_e.r,_e.g,_e.b),Ht.setXYZ(23,_e.r,_e.g,_e.b),Ht.setXYZ(24,Dt.r,Dt.g,Dt.b),Ht.setXYZ(25,Dt.r,Dt.g,Dt.b),Ht.setXYZ(26,Dt.r,Dt.g,Dt.b),Ht.setXYZ(27,Dt.r,Dt.g,Dt.b),Ht.setXYZ(28,Dt.r,Dt.g,Dt.b),Ht.setXYZ(29,Dt.r,Dt.g,Dt.b),Ht.setXYZ(30,Dt.r,Dt.g,Dt.b),Ht.setXYZ(31,Dt.r,Dt.g,Dt.b),Ht.setXYZ(32,Vt.r,Vt.g,Vt.b),Ht.setXYZ(33,Vt.r,Vt.g,Vt.b),Ht.setXYZ(34,Vt.r,Vt.g,Vt.b),Ht.setXYZ(35,Vt.r,Vt.g,Vt.b),Ht.setXYZ(36,Vt.r,Vt.g,Vt.b),Ht.setXYZ(37,Vt.r,Vt.g,Vt.b),Ht.setXYZ(38,Gt.r,Gt.g,Gt.b),Ht.setXYZ(39,Gt.r,Gt.g,Gt.b),Ht.setXYZ(40,zt.r,zt.g,zt.b),Ht.setXYZ(41,zt.r,zt.g,zt.b),Ht.setXYZ(42,zt.r,zt.g,zt.b),Ht.setXYZ(43,zt.r,zt.g,zt.b),Ht.setXYZ(44,zt.r,zt.g,zt.b),Ht.setXYZ(45,zt.r,zt.g,zt.b),Ht.setXYZ(46,zt.r,zt.g,zt.b),Ht.setXYZ(47,zt.r,zt.g,zt.b),Ht.setXYZ(48,zt.r,zt.g,zt.b),Ht.setXYZ(49,zt.r,zt.g,zt.b),Ht.needsUpdate=!0}update(){const _e=this.geometry,Dt=this.pointMap,Vt=1,Gt=1;_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",Dt,_e,_camera,0,0,-1),setPoint("t",Dt,_e,_camera,0,0,1),setPoint("n1",Dt,_e,_camera,-Vt,-Gt,-1),setPoint("n2",Dt,_e,_camera,Vt,-Gt,-1),setPoint("n3",Dt,_e,_camera,-Vt,Gt,-1),setPoint("n4",Dt,_e,_camera,Vt,Gt,-1),setPoint("f1",Dt,_e,_camera,-Vt,-Gt,1),setPoint("f2",Dt,_e,_camera,Vt,-Gt,1),setPoint("f3",Dt,_e,_camera,-Vt,Gt,1),setPoint("f4",Dt,_e,_camera,Vt,Gt,1),setPoint("u1",Dt,_e,_camera,Vt*.7,Gt*1.1,-1),setPoint("u2",Dt,_e,_camera,-Vt*.7,Gt*1.1,-1),setPoint("u3",Dt,_e,_camera,0,Gt*2,-1),setPoint("cf1",Dt,_e,_camera,-Vt,0,1),setPoint("cf2",Dt,_e,_camera,Vt,0,1),setPoint("cf3",Dt,_e,_camera,0,-Gt,1),setPoint("cf4",Dt,_e,_camera,0,Gt,1),setPoint("cn1",Dt,_e,_camera,-Vt,0,-1),setPoint("cn2",Dt,_e,_camera,Vt,0,-1),setPoint("cn3",Dt,_e,_camera,0,-Gt,-1),setPoint("cn4",Dt,_e,_camera,0,Gt,-1),_e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function setPoint(kt,_e,Dt,Vt,Gt,zt,jt){_vector.set(Gt,zt,jt).unproject(Vt);const Ht=_e[kt];if(Ht!==void 0){const Wt=Dt.getAttribute("position");for(let qt=0,Xt=Ht.length;qt<Xt;qt++)Wt.setXYZ(Ht[qt],_vector.x,_vector.y,_vector.z)}}const _box=new Box3;class BoxHelper extends LineSegments{constructor(_e,Dt=16776960){const Vt=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]),Gt=new Float32Array(8*3),zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,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.setFromObject(this.object),_box.isEmpty())return;const Dt=_box.min,Vt=_box.max,Gt=this.geometry.attributes.position,zt=Gt.array;zt[0]=Vt.x,zt[1]=Vt.y,zt[2]=Vt.z,zt[3]=Dt.x,zt[4]=Vt.y,zt[5]=Vt.z,zt[6]=Dt.x,zt[7]=Dt.y,zt[8]=Vt.z,zt[9]=Vt.x,zt[10]=Dt.y,zt[11]=Vt.z,zt[12]=Vt.x,zt[13]=Vt.y,zt[14]=Dt.z,zt[15]=Dt.x,zt[16]=Vt.y,zt[17]=Dt.z,zt[18]=Dt.x,zt[19]=Dt.y,zt[20]=Dt.z,zt[21]=Vt.x,zt[22]=Dt.y,zt[23]=Dt.z,Gt.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(_e){return this.object=_e,this.update(),this}copy(_e,Dt){return super.copy(_e,Dt),this.object=_e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Box3Helper extends LineSegments{constructor(_e,Dt=16776960){const Vt=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]),Gt=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new Float32BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.box=_e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(_e){const Dt=this.box;Dt.isEmpty()||(Dt.getCenter(this.position),Dt.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(_e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class PlaneHelper extends Line{constructor(_e,Dt=1,Vt=16776960){const Gt=Vt,zt=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],jt=new BufferGeometry;jt.setAttribute("position",new Float32BufferAttribute(zt,3)),jt.computeBoundingSphere(),super(jt,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.type="PlaneHelper",this.plane=_e,this.size=Dt;const Ht=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],Wt=new BufferGeometry;Wt.setAttribute("position",new Float32BufferAttribute(Ht,3)),Wt.computeBoundingSphere(),this.add(new Mesh(Wt,new MeshBasicMaterial({color:Gt,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),Dt=new Vector3(0,0,0),Vt=1,Gt=16776960,zt=Vt*.2,jt=zt*.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(Dt),this.line=new Line(_lineGeometry,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(_coneGeometry,new MeshBasicMaterial({color:Gt,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(_e),this.setLength(Vt,zt,jt)}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 Dt=Math.acos(_e.y);this.quaternion.setFromAxisAngle(_axis,Dt)}}setLength(_e,Dt=_e*.2,Vt=Dt*.2){this.line.scale.set(1,Math.max(1e-4,_e-Dt),1),this.line.updateMatrix(),this.cone.scale.set(Vt,Dt,Vt),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 Dt=[0,0,0,_e,0,0,0,0,0,0,_e,0,0,0,0,0,0,_e],Vt=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute(Dt,3)),Gt.setAttribute("color",new Float32BufferAttribute(Vt,3));const zt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Gt,zt),this.type="AxesHelper"}setColors(_e,Dt,Vt){const Gt=new Color$1,zt=this.geometry.attributes.color.array;return Gt.set(_e),Gt.toArray(zt,0),Gt.toArray(zt,3),Gt.set(Dt),Gt.toArray(zt,6),Gt.toArray(zt,9),Gt.set(Vt),Gt.toArray(zt,12),Gt.toArray(zt,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$1,this.subPaths=[],this.currentPath=null}moveTo(_e,Dt){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(_e,Dt),this}lineTo(_e,Dt){return this.currentPath.lineTo(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){return this.currentPath.quadraticCurveTo(_e,Dt,Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){return this.currentPath.bezierCurveTo(_e,Dt,Vt,Gt,zt,jt),this}splineThru(_e){return this.currentPath.splineThru(_e),this}toShapes(_e){function Dt(Qt){const en=[];for(let tn=0,sn=Qt.length;tn<sn;tn++){const cn=Qt[tn],un=new Shape;un.curves=cn.curves,en.push(un)}return en}function Vt(Qt,en){const tn=en.length;let sn=!1;for(let cn=tn-1,un=0;un<tn;cn=un++){let hn=en[cn],dn=en[un],pn=dn.x-hn.x,fn=dn.y-hn.y;if(Math.abs(fn)>Number.EPSILON){if(fn<0&&(hn=en[un],pn=-pn,dn=en[cn],fn=-fn),Qt.y<hn.y||Qt.y>dn.y)continue;if(Qt.y===hn.y){if(Qt.x===hn.x)return!0}else{const mn=fn*(Qt.x-hn.x)-pn*(Qt.y-hn.y);if(mn===0)return!0;if(mn<0)continue;sn=!sn}}else{if(Qt.y!==hn.y)continue;if(dn.x<=Qt.x&&Qt.x<=hn.x||hn.x<=Qt.x&&Qt.x<=dn.x)return!0}}return sn}const Gt=ShapeUtils.isClockWise,zt=this.subPaths;if(zt.length===0)return[];let jt,Ht,Wt;const qt=[];if(zt.length===1)return Ht=zt[0],Wt=new Shape,Wt.curves=Ht.curves,qt.push(Wt),qt;let Xt=!Gt(zt[0].getPoints());Xt=_e?!Xt:Xt;const Kt=[],Yt=[];let Zt=[],Jt=0,nn;Yt[Jt]=void 0,Zt[Jt]=[];for(let Qt=0,en=zt.length;Qt<en;Qt++)Ht=zt[Qt],nn=Ht.getPoints(),jt=Gt(nn),jt=_e?!jt:jt,jt?(!Xt&&Yt[Jt]&&Jt++,Yt[Jt]={s:new Shape,p:nn},Yt[Jt].s.curves=Ht.curves,Xt&&Jt++,Zt[Jt]=[]):Zt[Jt].push({h:Ht,p:nn[0]});if(!Yt[0])return Dt(zt);if(Yt.length>1){let Qt=!1,en=0;for(let tn=0,sn=Yt.length;tn<sn;tn++)Kt[tn]=[];for(let tn=0,sn=Yt.length;tn<sn;tn++){const cn=Zt[tn];for(let un=0;un<cn.length;un++){const hn=cn[un];let dn=!0;for(let pn=0;pn<Yt.length;pn++)Vt(hn.p,Yt[pn].p)&&(tn!==pn&&en++,dn?(dn=!1,Kt[pn].push(hn)):Qt=!0);dn&&Kt[tn].push(hn)}}en>0&&Qt===!1&&(Zt=Kt)}let rn;for(let Qt=0,en=Yt.length;Qt<en;Qt++){Wt=Yt[Qt].s,qt.push(Wt),rn=Zt[Qt];for(let tn=0,sn=rn.length;tn<sn;tn++)Wt.holes.push(rn[tn].h)}return qt}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(_e=1,Dt=1,Vt=1,Gt={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(_e,Dt,{...Gt,count:Vt}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}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$1=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AgXToneMapping,AlphaFormat,AlwaysCompare,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,BatchedMesh,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleGeometry,ClampToEdgeWrapping,Clock,Color:Color$1,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DisplayP3ColorSpace,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualCompare,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher:EventDispatcher$2,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Float32BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterCompare,GreaterDepth,GreaterEqualCompare,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HalfFloatType,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,Layers,LessCompare,LessDepth,LessEqualCompare,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearDisplayP3ColorSpace,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace:LinearSRGBColorSpace$1,LinearToneMapping,LinearTransfer,Loader,LoaderUtils,LoadingManager,LoopOnce:LoopOnce$1,LoopPingPong,LoopRepeat:LoopRepeat$1,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,NeutralToneMapping,NeverCompare,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualCompare,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronGeometry,OneFactor,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,P3Primaries,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RED_GREEN_RGTC2_Format,RED_RGTC1_Format,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_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,Rec709Primaries,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RenderTarget,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingGeometry,SIGNED_RED_GREEN_RGTC2_Format,SIGNED_RED_RGTC1_Format,SRGBColorSpace:SRGBColorSpace$1,SRGBTransfer,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronGeometry,Texture,TextureLoader,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedInt5999Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCoordinateSystem,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,createCanvasElement},Symbol.toStringTag,{value:"Module"})),hotspotIdPrefix="rd",hotspotIdSeparator="_",EMISSIVE_COLOR_WITH_MAP=new Color$1(50,50,50).convertSRGBToLinear(),EMISSIVE_COLOR_WITHOUT_MAP=new Color$1(255,255,255);function generateHotspotAbsoluteID(kt,_e){return`${hotspotIdPrefix}${hotspotIdSeparator}${kt}${hotspotIdSeparator}${_e}`}async function wait(kt){return LOGGER.info({title:`Waiting for ${kt}ms`}),new Promise((_e,Dt)=>{setTimeout(()=>{_e(!0)},kt)})}function compareObjects(kt,_e){if(kt===null||_e===null)return!1;for(let Dt in kt)if(kt.hasOwnProperty(Dt)&&_e.hasOwnProperty(Dt)&&kt[Dt]!==_e[Dt])return!1;return Object.keys(kt).length===Object.keys(_e).length}const capitalize$1=kt=>kt&&kt[0].toUpperCase()+kt.slice(1)||"",mobileCheck=function(){let kt=!1;return function(_e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(_e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(_e.substr(0,4)))&&(kt=!0)}(navigator.userAgent||navigator.vendor||window.opera),kt};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const kt=navigator.userAgent.toLowerCase(),_e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(kt);return _e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(kt){let _e={data:null,report:"",success:!1};try{const Vt=await(await fetch(kt)).text();_e.data=JSON.parse(Vt),_e.success=!0,_e.report="Successfully fetched JSON data."}catch(Dt){_e.report=Dt,_e.success=!1}return _e}const addVector=(kt,_e)=>new Vector3(kt[0]+_e[0],kt[1]+_e[1],kt[2]+_e[2]),Vec3ToArr=kt=>[kt.x,kt.y,kt.z],ArrToVec3=kt=>new Vector3(kt[0],kt[1],kt[2]),numberWithCommas=kt=>kt.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),applyEmissiveColor=kt=>{kt.emissiveMap!==null?kt.emissive.set(EMISSIVE_COLOR_WITH_MAP):kt.emissive.set(EMISSIVE_COLOR_WITHOUT_MAP)},findMeshAndCloneMatFromScene=(kt,_e,Dt=!0,Vt=!1)=>{let Gt=[],zt=!1;const jt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,Ht=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return _e.traverse(Wt=>{Wt.isMesh&&(Wt.material.userData.cloned?Dt&&Vt&&Wt.material.userData.originalEmissive!=null?(Wt.material.emissive.copy(Wt.material.userData.originalEmissive),Wt.material.emissiveIntensity=Wt.material.userData.originalEmissiveIntensity??0,zt=!0):Wt.material.userData.inStock!==Dt?(Dt?(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material.emissive.set(new Color$1(jt.r,jt.g,jt.b)),Wt.material.emissiveIntensity=Ht),Wt.material.userData.inStock=Dt):Dt&&!Vt&&(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material=Wt.material.clone(),Wt.material.userData.inStock=Dt,Wt.material.userData.cloned=!0,Dt?(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material.emissive.set(new Color$1(jt.r,jt.g,jt.b)),Wt.material.emissiveIntensity=Ht)),Gt.push(Wt))}),{meshArr:Gt,restored:zt}},filterArrWithCondition=(kt,_e)=>{let Dt=0,Vt=[];for(let Gt=0;Gt<kt.length;Gt++){const zt=kt[Gt];_e(zt)?kt[Dt++]=zt:Vt.push(kt[Gt])}return kt.length=Dt,Vt},degToRad=kt=>kt*Math.PI/180,resolveAssetUrl=kt=>{if(!kt)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(kt))return kt;let Vt=kt;return Vt=Vt.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),Vt=Vt.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),Vt};function componentToHex(kt){let _e=kt.toString(16);return _e.length==1?"0"+_e:_e}function rgbToHex(kt,_e,Dt){return"#"+componentToHex(kt)+componentToHex(_e)+componentToHex(Dt)}function getUrlParameterByName(kt,_e=window.location.search){const Dt=new URLSearchParams(_e);return Object.fromEntries(Dt.entries())[kt]}function _dispose3(kt){kt.geometry&&kt.geometry.dispose(),kt.material&&(Array.isArray(kt.material)?kt.material.forEach(_e=>_e.dispose()):kt.material.dispose()),kt.texture&&kt.texture.dispose()}function dispose3(kt){kt.traverse(_e=>{_dispose3(_e)}),_dispose3(kt)}const findVariantForGUID=(kt,_e)=>{const Dt=kt.attachmentStore.getState().attachmentSystem,Gt=kt.itemStore.getState().itemsSpawned[_e];let zt=Dt.currentStructure.getNodeByGUID(_e);if(!zt)return;let jt="";if(zt.overrideVariant)jt=zt.overrideVariant,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ht=Dt.globalVariants;if(!Ht||Ht.Count<=0)return;let Wt=[];Object.keys(Ht).map((qt,Xt)=>{Wt.push(Ht[qt])}),Gt.itemData.looks?.map(qt=>{Wt.includes(qt)&&(jt=qt)}),jt||(jt=Gt.itemData.looks[0])}return jt};function hasCommonElement(kt,_e){for(let Dt of kt)if(_e.includes(Dt))return!0;return!1}const InfoDrawer=({stores:kt,open:_e,dismissDrawer:Dt})=>{const Vt=kt.uiSceneStore(Ht=>Ht.CORE_API),Gt=kt.uiSceneStore(Ht=>Ht.isScreenPortrait),zt=reactExports.useRef(null),jt=kt.infoStore(Ht=>Ht.infoObject);return reactExports.useEffect(()=>{Vt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:_e})},[_e]),reactExports.useEffect(()=>{const{current:Ht}=zt;if(!Ht)return;const Wt=()=>{Dt()};return Ht.addEventListener("drawerClosed",Wt),()=>{Ht.removeEventListener("drawerClosed",Wt)}},[zt]),jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,ref:zt,id:"bottomDrawer",open:`${_e}`,"initial-screen-coverage":"0%",children:jsxRuntimeExports.jsx("div",{tabIndex:_e&&Gt?0:-1,"aria-hidden":!_e||!Gt,className:"infoDrawer epigraphDrawer",slot:"bottom-drawer-content",children:jsxRuntimeExports.jsxs("div",{className:"drawerContent",children:[jsxRuntimeExports.jsxs("a",{href:jt?.productPageUrl,className:"categoryLink",role:"button","aria-label":"Link to Product",target:"_blank",style:jt?.productPageUrl?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"infoDrawerImageContainer",children:jsxRuntimeExports.jsx("img",{className:"itemImage",alt:jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal","aria-label":jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal",src:jt?.thumbnails?.high?Vt.getResolvedAssetUrl(jt.thumbnails.high):"https://placehold.co/150",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):"",jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})})},UtilityMenuButton=({stores:kt,buttonAction:_e,buttonLabel:Dt,hoverLabel:Vt,icon:Gt,activeCondition:zt})=>{const[jt,Ht]=reactExports.useState(zt),Wt=kt.uiSceneStore(Kt=>Kt.dialogPopupOpen),qt=kt.uiSceneStore(Kt=>Kt.isScreenPortrait),Xt=kt.cartStore(Kt=>Kt.previewCartModalOpen);return reactExports.useEffect(()=>(Ht(zt),()=>{}),[zt]),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:!Wt&&(qt&&!Xt||!qt)?0:-1,"aria-hidden":Wt||qt&&Xt,className:jt!==void 0&&jt?"shellButtonContainer active":"shellButtonContainer","aria-label":Dt,onClick:()=>{_e()},children:[jsxRuntimeExports.jsxs("div",{className:"buttonContent",children:[jsxRuntimeExports.jsx("img",{className:"button",src:Gt,alt:"An icon indicating "+Dt+" action.",onError:Kt=>{Kt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:Dt})]}),jsxRuntimeExports.jsx("div",{className:"hoverDescriptor",children:jsxRuntimeExports.jsx("span",{children:Vt})})]})},UtilityMenu=({stores:kt,handleShareButtonTrigger:_e,handleSaveButtonTrigger:Dt,handleRestartButtonClick:Vt,handleShowHotspots:Gt,handleDimensionClick:zt,handleInstructionButtonClick:jt,utilityMenuVisible:Ht,hotspotsVisibility:Wt,viewInYourSpaceMenuBtnVisible:qt,restartMenuBtnVisible:Xt,saveMenuBtnVisible:Kt,hotspotsMenuBtnVisible:Yt,instructionsMenuBtnVisible:Zt,dimensionsMenuBtnVisible:Jt,shareMenuBtnVisible:nn,dimensionsVisible:rn,position:Qt,CORE_API:en})=>{const[tn,sn]=reactExports.useState("bottom"),cn=kt.productDataStore(dn=>dn.assetsData),un=kt.coreSceneStore(dn=>dn.sceneSettings),hn={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(Qt){case"top":sn("top");break;case"bottom":sn("bottom");break;case"left":sn("left");break;case"right":sn("right");break}return()=>{}},[Qt]),jsxRuntimeExports.jsx("div",{className:"shellCanvasContainerParent",id:tn,children:jsxRuntimeExports.jsxs("div",{className:(Ht&&(nn||qt||Xt||Jt||Yt||Zt))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[qt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{en.viewInYourSpace()},buttonLabel:un.textSettings.arButtonLabel,hoverLabel:un.textSettings.arHoverLabel,icon:cn?.icons?.utilityMenu?.viewInYourSpace?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.viewInYourSpace):hn.ar}),Xt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Vt()},buttonLabel:un.textSettings.restartButtonLabel,hoverLabel:un.textSettings.restartHoverLabel,icon:cn?.icons?.utilityMenu?.restart?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.restart):hn.restart}),Kt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Dt()},buttonLabel:un.textSettings.saveButtonLabel,hoverLabel:un.textSettings.saveHoverLabel,icon:cn?.icons?.utilityMenu?.save?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.save):hn.save}),nn&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{_e()},buttonLabel:un.textSettings.shareButtonLabel,hoverLabel:un.textSettings.shareHoverLabel,icon:cn?.icons?.utilityMenu?.share?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.share):hn.share}),Jt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{zt()},buttonLabel:un.textSettings.sizeButtonLabel,hoverLabel:un.textSettings.sizeHoverLabel,icon:cn?.icons?.utilityMenu?.dimensions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.dimensions):hn.dimensions,activeCondition:rn}),Yt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Gt()},buttonLabel:un.textSettings.hotspotsButtonLabel,hoverLabel:un.textSettings.hotspotsHoverLabel,icon:cn?.icons?.utilityMenu?.hotspots?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.hotspots):hn.hotspots,activeCondition:Wt}),Zt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{jt()},buttonLabel:un.textSettings.instructionsButtonLabel,hoverLabel:un.textSettings.instructionsHoverLabel,icon:cn?.icons?.utilityMenu?.instructions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.instructions):hn.instructions})]})})};function makeTypeChecker(kt){return _e=>!!_e.type&&_e.type.tabsRole===kt}const isTab=makeTypeChecker("Tab"),isTabList=makeTypeChecker("TabList"),isTabPanel=makeTypeChecker("TabPanel");function isTabChild(kt){return isTab(kt)||isTabList(kt)||isTabPanel(kt)}function deepMap(kt,_e){return reactExports.Children.map(kt,Dt=>Dt===null?null:isTabChild(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"?reactExports.cloneElement(Dt,{...Dt.props,children:deepMap(Dt.props.children,_e)}):Dt)}function deepForEach(kt,_e){return reactExports.Children.forEach(kt,Dt=>{Dt!==null&&(isTab(Dt)||isTabPanel(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"&&(isTabList(Dt)&&_e(Dt),deepForEach(Dt.props.children,_e)))})}function r$2(kt){var _e,Dt,Vt="";if(typeof kt=="string"||typeof kt=="number")Vt+=kt;else if(typeof kt=="object")if(Array.isArray(kt)){var Gt=kt.length;for(_e=0;_e<Gt;_e++)kt[_e]&&(Dt=r$2(kt[_e]))&&(Vt&&(Vt+=" "),Vt+=Dt)}else for(Dt in kt)kt[Dt]&&(Vt&&(Vt+=" "),Vt+=Dt);return Vt}function clsx(){for(var kt,_e,Dt=0,Vt="",Gt=arguments.length;Dt<Gt;Dt++)(kt=arguments[Dt])&&(_e=r$2(kt))&&(Vt&&(Vt+=" "),Vt+=_e);return Vt}function getTabsCount(kt){let _e=0;return deepForEach(kt,Dt=>{isTab(Dt)&&_e++}),_e}function isNode(kt){return kt&&"getAttribute"in kt}function isTabNode(kt){return isNode(kt)&&kt.getAttribute("data-rttab")}function isTabDisabled(kt){return isNode(kt)&&kt.getAttribute("aria-disabled")==="true"}let canUseActiveElement;function determineCanUseActiveElement(kt){const _e=kt||(typeof window<"u"?window:void 0);try{canUseActiveElement=!!(typeof _e<"u"&&_e.document&&_e.document.activeElement)}catch{canUseActiveElement=!1}}const defaultProps$4={className:"react-tabs",focus:!1},UncontrolledTabs=kt=>{let _e=reactExports.useRef([]),Dt=reactExports.useRef([]);const Vt=reactExports.useRef();function Gt(_n,En){if(_n<0||_n>=qt())return;const{onSelect:An,selectedIndex:Tn}=kt;An(_n,Tn,En)}function zt(_n){const En=qt();for(let An=_n+1;An<En;An++)if(!isTabDisabled(Xt(An)))return An;for(let An=0;An<_n;An++)if(!isTabDisabled(Xt(An)))return An;return _n}function jt(_n){let En=_n;for(;En--;)if(!isTabDisabled(Xt(En)))return En;for(En=qt();En-- >_n;)if(!isTabDisabled(Xt(En)))return En;return _n}function Ht(){const _n=qt();for(let En=0;En<_n;En++)if(!isTabDisabled(Xt(En)))return En;return null}function Wt(){let _n=qt();for(;_n--;)if(!isTabDisabled(Xt(_n)))return _n;return null}function qt(){const{children:_n}=kt;return getTabsCount(_n)}function Xt(_n){return _e.current[`tabs-${_n}`]}function Kt(){let _n=0;const{children:En,disabledTabClassName:An,focus:Tn,forceRenderTabPanel:Cn,selectedIndex:yn,selectedTabClassName:Sn,selectedTabPanelClassName:wn,environment:xn}=kt;Dt.current=Dt.current||[];let Rn=Dt.current.length-qt();const Dn=reactExports.useId();for(;Rn++<0;)Dt.current.push(`${Dn}${Dt.current.length}`);return deepMap(En,kn=>{let Fn=kn;if(isTabList(kn)){let Pn=0,Bn=!1;canUseActiveElement==null&&determineCanUseActiveElement(xn);const qn=xn||(typeof window<"u"?window:void 0);canUseActiveElement&&qn&&(Bn=React.Children.toArray(kn.props.children).filter(isTab).some((tr,lr)=>qn.document.activeElement===Xt(lr))),Fn=reactExports.cloneElement(kn,{children:deepMap(kn.props.children,tr=>{const lr=`tabs-${Pn}`,zn=yn===Pn,ur={tabRef:Hn=>{_e.current[lr]=Hn},id:Dt.current[Pn],selected:zn,focus:zn&&(Tn||Bn)};return Sn&&(ur.selectedClassName=Sn),An&&(ur.disabledClassName=An),Pn++,reactExports.cloneElement(tr,ur)})})}else if(isTabPanel(kn)){const Pn={id:Dt.current[_n],selected:yn===_n};Cn&&(Pn.forceRender=Cn),wn&&(Pn.selectedClassName=wn),_n++,Fn=reactExports.cloneElement(kn,Pn)}return Fn})}function Yt(_n){const{direction:En,disableUpDownKeys:An,disableLeftRightKeys:Tn}=kt;if(Jt(_n.target)){let{selectedIndex:Cn}=kt,yn=!1,Sn=!1;(_n.code==="Space"||_n.keyCode===32||_n.code==="Enter"||_n.keyCode===13)&&(yn=!0,Sn=!1,Zt(_n)),!Tn&&(_n.keyCode===37||_n.code==="ArrowLeft")||!An&&(_n.keyCode===38||_n.code==="ArrowUp")?(En==="rtl"?Cn=zt(Cn):Cn=jt(Cn),yn=!0,Sn=!0):!Tn&&(_n.keyCode===39||_n.code==="ArrowRight")||!An&&(_n.keyCode===40||_n.code==="ArrowDown")?(En==="rtl"?Cn=jt(Cn):Cn=zt(Cn),yn=!0,Sn=!0):_n.keyCode===35||_n.code==="End"?(Cn=Wt(),yn=!0,Sn=!0):(_n.keyCode===36||_n.code==="Home")&&(Cn=Ht(),yn=!0,Sn=!0),yn&&_n.preventDefault(),Sn&&Gt(Cn,_n)}}function Zt(_n){let En=_n.target;do if(Jt(En)){if(isTabDisabled(En))return;const An=[].slice.call(En.parentNode.children).filter(isTabNode).indexOf(En);Gt(An,_n);return}while((En=En.parentNode)!=null)}function Jt(_n){if(!isTabNode(_n))return!1;let En=_n.parentElement;do{if(En===Vt.current)return!0;if(En.getAttribute("data-rttabs"))break;En=En.parentElement}while(En);return!1}const{children:nn,className:rn,disabledTabClassName:Qt,domRef:en,focus:tn,forceRenderTabPanel:sn,onSelect:cn,selectedIndex:un,selectedTabClassName:hn,selectedTabPanelClassName:dn,environment:pn,disableUpDownKeys:fn,disableLeftRightKeys:mn,...vn}={...defaultProps$4,...kt};return React.createElement("div",Object.assign({},vn,{className:clsx(rn),onClick:Zt,onKeyDown:Yt,ref:_n=>{Vt.current=_n,en&&en(_n)},"data-rttabs":!0}),Kt())};UncontrolledTabs.propTypes={};const MODE_CONTROLLED=0,MODE_UNCONTROLLED=1,defaultProps$3={defaultFocus:!1,focusTabOnClick:!0,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null,environment:null,disableUpDownKeys:!1,disableLeftRightKeys:!1},getModeFromProps=kt=>kt.selectedIndex===null?MODE_UNCONTROLLED:MODE_CONTROLLED,Tabs=kt=>{const{children:_e,defaultFocus:Dt,defaultIndex:Vt,focusTabOnClick:Gt,onSelect:zt,...jt}={...defaultProps$3,...kt},[Ht,Wt]=reactExports.useState(Dt),[qt]=reactExports.useState(getModeFromProps(jt)),[Xt,Kt]=reactExports.useState(qt===MODE_UNCONTROLLED?Vt||0:null);if(reactExports.useEffect(()=>{Wt(!1)},[]),qt===MODE_UNCONTROLLED){const Jt=getTabsCount(_e);reactExports.useEffect(()=>{if(Xt!=null){const nn=Math.max(0,Jt-1);Kt(Math.min(Xt,nn))}},[Jt])}const Yt=(Jt,nn,rn)=>{typeof zt=="function"&&zt(Jt,nn,rn)===!1||(Gt&&Wt(!0),qt===MODE_UNCONTROLLED&&Kt(Jt))};let Zt={...kt,...jt};return Zt.focus=Ht,Zt.onSelect=Yt,Xt!=null&&(Zt.selectedIndex=Xt),delete Zt.defaultFocus,delete Zt.defaultIndex,delete Zt.focusTabOnClick,React.createElement(UncontrolledTabs,Zt,_e)};Tabs.propTypes={};Tabs.tabsRole="Tabs";const defaultProps$2={className:"react-tabs__tab-list"},TabList=kt=>{const{children:_e,className:Dt,...Vt}={...defaultProps$2,...kt};return React.createElement("ul",Object.assign({},Vt,{className:clsx(Dt),role:"tablist"}),_e)};TabList.tabsRole="TabList";TabList.propTypes={};const DEFAULT_CLASS$1="react-tabs__tab",defaultProps$1={className:DEFAULT_CLASS$1,disabledClassName:`${DEFAULT_CLASS$1}--disabled`,focus:!1,id:null,selected:!1,selectedClassName:`${DEFAULT_CLASS$1}--selected`},Tab$1=kt=>{let _e=reactExports.useRef();const{children:Dt,className:Vt,disabled:Gt,disabledClassName:zt,focus:jt,id:Ht,selected:Wt,selectedClassName:qt,tabIndex:Xt,tabRef:Kt,...Yt}={...defaultProps$1,...kt};return reactExports.useEffect(()=>{Wt&&jt&&_e.current.focus()},[Wt,jt]),React.createElement("li",Object.assign({},Yt,{className:clsx(Vt,{[qt]:Wt,[zt]:Gt}),ref:Zt=>{_e.current=Zt,Kt&&Kt(Zt)},role:"tab",id:`tab${Ht}`,"aria-selected":Wt?"true":"false","aria-disabled":Gt?"true":"false","aria-controls":`panel${Ht}`,tabIndex:Xt||(Wt?"0":null),"data-rttab":!0}),Dt)};Tab$1.propTypes={};Tab$1.tabsRole="Tab";const DEFAULT_CLASS="react-tabs__tab-panel",defaultProps={className:DEFAULT_CLASS,forceRender:!1,selectedClassName:`${DEFAULT_CLASS}--selected`},TabPanel=kt=>{const{children:_e,className:Dt,forceRender:Vt,id:Gt,selected:zt,selectedClassName:jt,...Ht}={...defaultProps,...kt};return React.createElement("div",Object.assign({},Ht,{className:clsx(Dt,{[jt]:zt}),role:"tabpanel",id:`panel${Gt}`,"aria-labelledby":`tab${Gt}`}),Vt||zt?_e:null)};TabPanel.tabsRole="TabPanel";TabPanel.propTypes={};const ItemCard=({stores:kt,sideMenuOpen:_e,spawnGhosts:Dt,accordionActive:Vt=!0,spawnItem:Gt,removeAllGhosts:zt,isMouseUsed:jt,skuId:Ht,active:Wt})=>{const qt=kt.uiSceneStore(fr=>fr.CORE_API),Xt=kt.infoStore(fr=>fr.infoModalOpen),Kt=reactExports.useRef(null),Yt=kt.infoStore(fr=>fr.populateInfoObject),Zt=kt.uiSceneStore(fr=>fr.dialogPopupOpen),Jt=kt.cartStore(fr=>fr.previewCartModalOpen),nn=kt.infoStore(fr=>fr.updateInfoModalOpen),[rn,Qt]=reactExports.useState("default"),[en,tn]=reactExports.useState(!0),sn=kt.colorStore(fr=>fr.allActiveVariants),cn=kt.productDataStore(fr=>fr.productData),un=kt.itemStore(fr=>fr.fittingSkuIds),[hn,dn]=reactExports.useState(cn[Ht].incrementDecrementControl?cn[Ht].incrementDecrementControl:!1),[pn,fn]=reactExports.useState(cn[Ht]?cn[Ht]:{}),[mn,vn]=reactExports.useState(cn[Ht].name?cn[Ht].name:"Not Set"),[_n,En]=reactExports.useState(cn[Ht].subheading?cn[Ht].subheading:""),[An,Tn]=reactExports.useState(cn[Ht].lookDetails.default.thumbnails.low?cn[Ht].lookDetails.default.thumbnails.low:""),[Cn,yn]=reactExports.useState(cn[Ht].draggableUI!=null?cn[Ht].draggableUI:kt.uiSceneStore.getState().CORE_API.sceneSettings.draggableUI),[Sn,wn]=reactExports.useState(null),[xn,Rn]=reactExports.useState(!1),[Dn,kn]=reactExports.useState(!1),[Fn,Pn]=reactExports.useState(0),Bn=reactExports.useCallback(()=>{Fn<=0||qt.removeLastItemBySkuId(Ht)},[Fn]),qn=()=>{let fr=0;const Un=kt.itemStore.getState().itemsSpawned,In=Object.keys(Un);for(let jn=In.length-1;jn>=0;jn--){const or=In[jn];Un[or].itemData.skuID===Ht&&fr++}Pn(fr)};reactExports.useEffect(()=>{qn()},[]),addCoreEventListener(kt,qt.EVENTS.SCENE.Items_Updated,qn),reactExports.useEffect(()=>{un.includes(Ht)?Rn(!0):Rn(!1)},[un]),reactExports.useEffect(()=>{Object.keys(cn).length!=0},[cn]),reactExports.useEffect(()=>{pn.looks.length<=1&&tn(!1)},[pn]);const tr=reactExports.useCallback(()=>{const fr=pn.looks;let Un="default";for(const[In,jn]of Object.entries(sn))if(fr.includes(jn)){Un=jn;break}Qt(Un)},[pn,sn]);reactExports.useEffect(()=>{Tn(pn.lookDetails[rn].thumbnails.low)},[pn,rn]),reactExports.useEffect(()=>{en===!0&&tr()},[sn]);const lr=reactExports.useCallback(fr=>{if(fr.stopPropagation(),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)){if(xn===!1||Sn){qt.alert({alertMsg:"Unable to add item to the scene.",alertTime:4e3,alertType:"warn",alertLabel:"Action Unavailable"});return}Gt(Ht,!0)}},[xn,Sn]),zn=reactExports.useCallback(async()=>{const fr=qt.sceneSettings?.showDependencyOnHover;if(fr===void 0||fr===!1)return;let Un=qt.getSpawningRequirementForSkuID(Ht);if(Un.length<=0)return;let In="";const jn=await qt.getCartItemsAsync();let or=!1;if(jn.cartItems.map(cr=>{Un.includes(cr.skuID)&&(or=!0)}),Un.includes("Root")&&Un.length==1&&(or=!0,Un=[]),or)In="No space available to spawn the item.";else{In=`This item requires a dependency to be added to the scene first.
3936
+ }`;class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(_e,Dt,Vt){if(this.texture===null){const Gt=new Texture,zt=_e.properties.get(Gt);zt.__webglTexture=Dt.texture,(Dt.depthNear!=Vt.depthNear||Dt.depthFar!=Vt.depthFar)&&(this.depthNear=Dt.depthNear,this.depthFar=Dt.depthFar),this.texture=Gt}}render(_e,Dt){if(this.texture!==null){if(this.mesh===null){const Vt=Dt.cameras[0].viewport,Gt=new ShaderMaterial({vertexShader:_occlusion_vertex,fragmentShader:_occlusion_fragment,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Vt.z},depthHeight:{value:Vt.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),Gt)}_e.render(this.mesh,Dt)}}reset(){this.texture=null,this.mesh=null}}class WebXRManager extends EventDispatcher$2{constructor(_e,Dt){super();const Vt=this;let Gt=null,zt=1,jt=null,Ht="local-floor",Wt=1,qt=null,Xt=null,Kt=null,Yt=null,Zt=null,Jt=null;const nn=new WebXRDepthSensing,rn=Dt.getContextAttributes();let Qt=null,en=null;const tn=[],sn=[],cn=new Vector2;let un=null;const hn=new PerspectiveCamera;hn.layers.enable(1),hn.viewport=new Vector4;const dn=new PerspectiveCamera;dn.layers.enable(2),dn.viewport=new Vector4;const pn=[hn,dn],fn=new ArrayCamera;fn.layers.enable(1),fn.layers.enable(2);let mn=null,vn=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getTargetRaySpace()},this.getControllerGrip=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getGripSpace()},this.getHand=function(kn){let Fn=tn[kn];return Fn===void 0&&(Fn=new WebXRController,tn[kn]=Fn),Fn.getHandSpace()};function _n(kn){const Fn=sn.indexOf(kn.inputSource);if(Fn===-1)return;const Pn=tn[Fn];Pn!==void 0&&(Pn.update(kn.inputSource,kn.frame,qt||jt),Pn.dispatchEvent({type:kn.type,data:kn.inputSource}))}function En(){Gt.removeEventListener("select",_n),Gt.removeEventListener("selectstart",_n),Gt.removeEventListener("selectend",_n),Gt.removeEventListener("squeeze",_n),Gt.removeEventListener("squeezestart",_n),Gt.removeEventListener("squeezeend",_n),Gt.removeEventListener("end",En),Gt.removeEventListener("inputsourceschange",An);for(let kn=0;kn<tn.length;kn++){const Fn=sn[kn];Fn!==null&&(sn[kn]=null,tn[kn].disconnect(Fn))}mn=null,vn=null,nn.reset(),_e.setRenderTarget(Qt),Zt=null,Yt=null,Kt=null,Gt=null,en=null,Dn.stop(),Vt.isPresenting=!1,_e.setPixelRatio(un),_e.setSize(cn.width,cn.height,!1),Vt.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(kn){zt=kn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(kn){Ht=kn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return qt||jt},this.setReferenceSpace=function(kn){qt=kn},this.getBaseLayer=function(){return Yt!==null?Yt:Zt},this.getBinding=function(){return Kt},this.getFrame=function(){return Jt},this.getSession=function(){return Gt},this.setSession=async function(kn){if(Gt=kn,Gt!==null){if(Qt=_e.getRenderTarget(),Gt.addEventListener("select",_n),Gt.addEventListener("selectstart",_n),Gt.addEventListener("selectend",_n),Gt.addEventListener("squeeze",_n),Gt.addEventListener("squeezestart",_n),Gt.addEventListener("squeezeend",_n),Gt.addEventListener("end",En),Gt.addEventListener("inputsourceschange",An),rn.xrCompatible!==!0&&await Dt.makeXRCompatible(),un=_e.getPixelRatio(),_e.getSize(cn),Gt.renderState.layers===void 0){const Fn={antialias:rn.antialias,alpha:!0,depth:rn.depth,stencil:rn.stencil,framebufferScaleFactor:zt};Zt=new XRWebGLLayer(Gt,Dt,Fn),Gt.updateRenderState({baseLayer:Zt}),_e.setPixelRatio(1),_e.setSize(Zt.framebufferWidth,Zt.framebufferHeight,!1),en=new WebGLRenderTarget(Zt.framebufferWidth,Zt.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,colorSpace:_e.outputColorSpace,stencilBuffer:rn.stencil})}else{let Fn=null,Pn=null,Bn=null;rn.depth&&(Bn=rn.stencil?Dt.DEPTH24_STENCIL8:Dt.DEPTH_COMPONENT24,Fn=rn.stencil?DepthStencilFormat:DepthFormat,Pn=rn.stencil?UnsignedInt248Type:UnsignedIntType);const qn={colorFormat:Dt.RGBA8,depthFormat:Bn,scaleFactor:zt};Kt=new XRWebGLBinding(Gt,Dt),Yt=Kt.createProjectionLayer(qn),Gt.updateRenderState({layers:[Yt]}),_e.setPixelRatio(1),_e.setSize(Yt.textureWidth,Yt.textureHeight,!1),en=new WebGLRenderTarget(Yt.textureWidth,Yt.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(Yt.textureWidth,Yt.textureHeight,Pn,void 0,void 0,void 0,void 0,void 0,void 0,Fn),stencilBuffer:rn.stencil,colorSpace:_e.outputColorSpace,samples:rn.antialias?4:0});const tr=_e.properties.get(en);tr.__ignoreDepthValues=Yt.ignoreDepthValues}en.isXRRenderTarget=!0,this.setFoveation(Wt),qt=null,jt=await Gt.requestReferenceSpace(Ht),Dn.setContext(Gt),Dn.start(),Vt.isPresenting=!0,Vt.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Gt!==null)return Gt.environmentBlendMode};function An(kn){for(let Fn=0;Fn<kn.removed.length;Fn++){const Pn=kn.removed[Fn],Bn=sn.indexOf(Pn);Bn>=0&&(sn[Bn]=null,tn[Bn].disconnect(Pn))}for(let Fn=0;Fn<kn.added.length;Fn++){const Pn=kn.added[Fn];let Bn=sn.indexOf(Pn);if(Bn===-1){for(let tr=0;tr<tn.length;tr++)if(tr>=sn.length){sn.push(Pn),Bn=tr;break}else if(sn[tr]===null){sn[tr]=Pn,Bn=tr;break}if(Bn===-1)break}const qn=tn[Bn];qn&&qn.connect(Pn)}}const Tn=new Vector3,Cn=new Vector3;function yn(kn,Fn,Pn){Tn.setFromMatrixPosition(Fn.matrixWorld),Cn.setFromMatrixPosition(Pn.matrixWorld);const Bn=Tn.distanceTo(Cn),qn=Fn.projectionMatrix.elements,tr=Pn.projectionMatrix.elements,lr=qn[14]/(qn[10]-1),zn=qn[14]/(qn[10]+1),ur=(qn[9]+1)/qn[5],Hn=(qn[9]-1)/qn[5],sr=(qn[8]-1)/qn[0],vr=(tr[8]+1)/tr[0],fr=lr*sr,Un=lr*vr,In=Bn/(-sr+vr),jn=In*-sr;Fn.matrixWorld.decompose(kn.position,kn.quaternion,kn.scale),kn.translateX(jn),kn.translateZ(In),kn.matrixWorld.compose(kn.position,kn.quaternion,kn.scale),kn.matrixWorldInverse.copy(kn.matrixWorld).invert();const or=lr+In,cr=zn+In,ar=fr-jn,gr=Un+(Bn-jn),mr=ur*zn/cr*or,Ar=Hn*zn/cr*or;kn.projectionMatrix.makePerspective(ar,gr,mr,Ar,or,cr),kn.projectionMatrixInverse.copy(kn.projectionMatrix).invert()}function Sn(kn,Fn){Fn===null?kn.matrixWorld.copy(kn.matrix):kn.matrixWorld.multiplyMatrices(Fn.matrixWorld,kn.matrix),kn.matrixWorldInverse.copy(kn.matrixWorld).invert()}this.updateCamera=function(kn){if(Gt===null)return;nn.texture!==null&&(kn.near=nn.depthNear,kn.far=nn.depthFar),fn.near=dn.near=hn.near=kn.near,fn.far=dn.far=hn.far=kn.far,(mn!==fn.near||vn!==fn.far)&&(Gt.updateRenderState({depthNear:fn.near,depthFar:fn.far}),mn=fn.near,vn=fn.far,hn.near=mn,hn.far=vn,dn.near=mn,dn.far=vn,hn.updateProjectionMatrix(),dn.updateProjectionMatrix(),kn.updateProjectionMatrix());const Fn=kn.parent,Pn=fn.cameras;Sn(fn,Fn);for(let Bn=0;Bn<Pn.length;Bn++)Sn(Pn[Bn],Fn);Pn.length===2?yn(fn,hn,dn):fn.projectionMatrix.copy(hn.projectionMatrix),wn(kn,fn,Fn)};function wn(kn,Fn,Pn){Pn===null?kn.matrix.copy(Fn.matrixWorld):(kn.matrix.copy(Pn.matrixWorld),kn.matrix.invert(),kn.matrix.multiply(Fn.matrixWorld)),kn.matrix.decompose(kn.position,kn.quaternion,kn.scale),kn.updateMatrixWorld(!0),kn.projectionMatrix.copy(Fn.projectionMatrix),kn.projectionMatrixInverse.copy(Fn.projectionMatrixInverse),kn.isPerspectiveCamera&&(kn.fov=RAD2DEG*2*Math.atan(1/kn.projectionMatrix.elements[5]),kn.zoom=1)}this.getCamera=function(){return fn},this.getFoveation=function(){if(!(Yt===null&&Zt===null))return Wt},this.setFoveation=function(kn){Wt=kn,Yt!==null&&(Yt.fixedFoveation=kn),Zt!==null&&Zt.fixedFoveation!==void 0&&(Zt.fixedFoveation=kn)},this.hasDepthSensing=function(){return nn.texture!==null};let xn=null;function Rn(kn,Fn){if(Xt=Fn.getViewerPose(qt||jt),Jt=Fn,Xt!==null){const Pn=Xt.views;Zt!==null&&(_e.setRenderTargetFramebuffer(en,Zt.framebuffer),_e.setRenderTarget(en));let Bn=!1;Pn.length!==fn.cameras.length&&(fn.cameras.length=0,Bn=!0);for(let tr=0;tr<Pn.length;tr++){const lr=Pn[tr];let zn=null;if(Zt!==null)zn=Zt.getViewport(lr);else{const Hn=Kt.getViewSubImage(Yt,lr);zn=Hn.viewport,tr===0&&(_e.setRenderTargetTextures(en,Hn.colorTexture,Yt.ignoreDepthValues?void 0:Hn.depthStencilTexture),_e.setRenderTarget(en))}let ur=pn[tr];ur===void 0&&(ur=new PerspectiveCamera,ur.layers.enable(tr),ur.viewport=new Vector4,pn[tr]=ur),ur.matrix.fromArray(lr.transform.matrix),ur.matrix.decompose(ur.position,ur.quaternion,ur.scale),ur.projectionMatrix.fromArray(lr.projectionMatrix),ur.projectionMatrixInverse.copy(ur.projectionMatrix).invert(),ur.viewport.set(zn.x,zn.y,zn.width,zn.height),tr===0&&(fn.matrix.copy(ur.matrix),fn.matrix.decompose(fn.position,fn.quaternion,fn.scale)),Bn===!0&&fn.cameras.push(ur)}const qn=Gt.enabledFeatures;if(qn&&qn.includes("depth-sensing")){const tr=Kt.getDepthInformation(Pn[0]);tr&&tr.isValid&&tr.texture&&nn.init(_e,tr,Gt.renderState)}}for(let Pn=0;Pn<tn.length;Pn++){const Bn=sn[Pn],qn=tn[Pn];Bn!==null&&qn!==void 0&&qn.update(Bn,Fn,qt||jt)}nn.render(_e,fn),xn&&xn(kn,Fn),Fn.detectedPlanes&&Vt.dispatchEvent({type:"planesdetected",data:Fn}),Jt=null}const Dn=new WebGLAnimation;Dn.setAnimationLoop(Rn),this.setAnimationLoop=function(kn){xn=kn},this.dispose=function(){}}}const _e1=new Euler,_m1=new Matrix4;function WebGLMaterials(kt,_e){function Dt(rn,Qt){rn.matrixAutoUpdate===!0&&rn.updateMatrix(),Qt.value.copy(rn.matrix)}function Vt(rn,Qt){Qt.color.getRGB(rn.fogColor.value,getUnlitUniformColorSpace(kt)),Qt.isFog?(rn.fogNear.value=Qt.near,rn.fogFar.value=Qt.far):Qt.isFogExp2&&(rn.fogDensity.value=Qt.density)}function Gt(rn,Qt,en,tn,sn){Qt.isMeshBasicMaterial||Qt.isMeshLambertMaterial?zt(rn,Qt):Qt.isMeshToonMaterial?(zt(rn,Qt),Kt(rn,Qt)):Qt.isMeshPhongMaterial?(zt(rn,Qt),Xt(rn,Qt)):Qt.isMeshStandardMaterial?(zt(rn,Qt),Yt(rn,Qt),Qt.isMeshPhysicalMaterial&&Zt(rn,Qt,sn)):Qt.isMeshMatcapMaterial?(zt(rn,Qt),Jt(rn,Qt)):Qt.isMeshDepthMaterial?zt(rn,Qt):Qt.isMeshDistanceMaterial?(zt(rn,Qt),nn(rn,Qt)):Qt.isMeshNormalMaterial?zt(rn,Qt):Qt.isLineBasicMaterial?(jt(rn,Qt),Qt.isLineDashedMaterial&&Ht(rn,Qt)):Qt.isPointsMaterial?Wt(rn,Qt,en,tn):Qt.isSpriteMaterial?qt(rn,Qt):Qt.isShadowMaterial?(rn.color.value.copy(Qt.color),rn.opacity.value=Qt.opacity):Qt.isShaderMaterial&&(Qt.uniformsNeedUpdate=!1)}function zt(rn,Qt){rn.opacity.value=Qt.opacity,Qt.color&&rn.diffuse.value.copy(Qt.color),Qt.emissive&&rn.emissive.value.copy(Qt.emissive).multiplyScalar(Qt.emissiveIntensity),Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.bumpMap&&(rn.bumpMap.value=Qt.bumpMap,Dt(Qt.bumpMap,rn.bumpMapTransform),rn.bumpScale.value=Qt.bumpScale,Qt.side===BackSide&&(rn.bumpScale.value*=-1)),Qt.normalMap&&(rn.normalMap.value=Qt.normalMap,Dt(Qt.normalMap,rn.normalMapTransform),rn.normalScale.value.copy(Qt.normalScale),Qt.side===BackSide&&rn.normalScale.value.negate()),Qt.displacementMap&&(rn.displacementMap.value=Qt.displacementMap,Dt(Qt.displacementMap,rn.displacementMapTransform),rn.displacementScale.value=Qt.displacementScale,rn.displacementBias.value=Qt.displacementBias),Qt.emissiveMap&&(rn.emissiveMap.value=Qt.emissiveMap,Dt(Qt.emissiveMap,rn.emissiveMapTransform)),Qt.specularMap&&(rn.specularMap.value=Qt.specularMap,Dt(Qt.specularMap,rn.specularMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest);const en=_e.get(Qt),tn=en.envMap,sn=en.envMapRotation;if(tn&&(rn.envMap.value=tn,_e1.copy(sn),_e1.x*=-1,_e1.y*=-1,_e1.z*=-1,tn.isCubeTexture&&tn.isRenderTargetTexture===!1&&(_e1.y*=-1,_e1.z*=-1),rn.envMapRotation.value.setFromMatrix4(_m1.makeRotationFromEuler(_e1)),rn.flipEnvMap.value=tn.isCubeTexture&&tn.isRenderTargetTexture===!1?-1:1,rn.reflectivity.value=Qt.reflectivity,rn.ior.value=Qt.ior,rn.refractionRatio.value=Qt.refractionRatio),Qt.lightMap){rn.lightMap.value=Qt.lightMap;const cn=kt._useLegacyLights===!0?Math.PI:1;rn.lightMapIntensity.value=Qt.lightMapIntensity*cn,Dt(Qt.lightMap,rn.lightMapTransform)}Qt.aoMap&&(rn.aoMap.value=Qt.aoMap,rn.aoMapIntensity.value=Qt.aoMapIntensity,Dt(Qt.aoMap,rn.aoMapTransform))}function jt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform))}function Ht(rn,Qt){rn.dashSize.value=Qt.dashSize,rn.totalSize.value=Qt.dashSize+Qt.gapSize,rn.scale.value=Qt.scale}function Wt(rn,Qt,en,tn){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.size.value=Qt.size*en,rn.scale.value=tn*.5,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.uvTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function qt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.rotation.value=Qt.rotation,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function Xt(rn,Qt){rn.specular.value.copy(Qt.specular),rn.shininess.value=Math.max(Qt.shininess,1e-4)}function Kt(rn,Qt){Qt.gradientMap&&(rn.gradientMap.value=Qt.gradientMap)}function Yt(rn,Qt){rn.metalness.value=Qt.metalness,Qt.metalnessMap&&(rn.metalnessMap.value=Qt.metalnessMap,Dt(Qt.metalnessMap,rn.metalnessMapTransform)),rn.roughness.value=Qt.roughness,Qt.roughnessMap&&(rn.roughnessMap.value=Qt.roughnessMap,Dt(Qt.roughnessMap,rn.roughnessMapTransform)),Qt.envMap&&(rn.envMapIntensity.value=Qt.envMapIntensity)}function Zt(rn,Qt,en){rn.ior.value=Qt.ior,Qt.sheen>0&&(rn.sheenColor.value.copy(Qt.sheenColor).multiplyScalar(Qt.sheen),rn.sheenRoughness.value=Qt.sheenRoughness,Qt.sheenColorMap&&(rn.sheenColorMap.value=Qt.sheenColorMap,Dt(Qt.sheenColorMap,rn.sheenColorMapTransform)),Qt.sheenRoughnessMap&&(rn.sheenRoughnessMap.value=Qt.sheenRoughnessMap,Dt(Qt.sheenRoughnessMap,rn.sheenRoughnessMapTransform))),Qt.clearcoat>0&&(rn.clearcoat.value=Qt.clearcoat,rn.clearcoatRoughness.value=Qt.clearcoatRoughness,Qt.clearcoatMap&&(rn.clearcoatMap.value=Qt.clearcoatMap,Dt(Qt.clearcoatMap,rn.clearcoatMapTransform)),Qt.clearcoatRoughnessMap&&(rn.clearcoatRoughnessMap.value=Qt.clearcoatRoughnessMap,Dt(Qt.clearcoatRoughnessMap,rn.clearcoatRoughnessMapTransform)),Qt.clearcoatNormalMap&&(rn.clearcoatNormalMap.value=Qt.clearcoatNormalMap,Dt(Qt.clearcoatNormalMap,rn.clearcoatNormalMapTransform),rn.clearcoatNormalScale.value.copy(Qt.clearcoatNormalScale),Qt.side===BackSide&&rn.clearcoatNormalScale.value.negate())),Qt.iridescence>0&&(rn.iridescence.value=Qt.iridescence,rn.iridescenceIOR.value=Qt.iridescenceIOR,rn.iridescenceThicknessMinimum.value=Qt.iridescenceThicknessRange[0],rn.iridescenceThicknessMaximum.value=Qt.iridescenceThicknessRange[1],Qt.iridescenceMap&&(rn.iridescenceMap.value=Qt.iridescenceMap,Dt(Qt.iridescenceMap,rn.iridescenceMapTransform)),Qt.iridescenceThicknessMap&&(rn.iridescenceThicknessMap.value=Qt.iridescenceThicknessMap,Dt(Qt.iridescenceThicknessMap,rn.iridescenceThicknessMapTransform))),Qt.transmission>0&&(rn.transmission.value=Qt.transmission,rn.transmissionSamplerMap.value=en.texture,rn.transmissionSamplerSize.value.set(en.width,en.height),Qt.transmissionMap&&(rn.transmissionMap.value=Qt.transmissionMap,Dt(Qt.transmissionMap,rn.transmissionMapTransform)),rn.thickness.value=Qt.thickness,Qt.thicknessMap&&(rn.thicknessMap.value=Qt.thicknessMap,Dt(Qt.thicknessMap,rn.thicknessMapTransform)),rn.attenuationDistance.value=Qt.attenuationDistance,rn.attenuationColor.value.copy(Qt.attenuationColor)),Qt.anisotropy>0&&(rn.anisotropyVector.value.set(Qt.anisotropy*Math.cos(Qt.anisotropyRotation),Qt.anisotropy*Math.sin(Qt.anisotropyRotation)),Qt.anisotropyMap&&(rn.anisotropyMap.value=Qt.anisotropyMap,Dt(Qt.anisotropyMap,rn.anisotropyMapTransform))),rn.specularIntensity.value=Qt.specularIntensity,rn.specularColor.value.copy(Qt.specularColor),Qt.specularColorMap&&(rn.specularColorMap.value=Qt.specularColorMap,Dt(Qt.specularColorMap,rn.specularColorMapTransform)),Qt.specularIntensityMap&&(rn.specularIntensityMap.value=Qt.specularIntensityMap,Dt(Qt.specularIntensityMap,rn.specularIntensityMapTransform))}function Jt(rn,Qt){Qt.matcap&&(rn.matcap.value=Qt.matcap)}function nn(rn,Qt){const en=_e.get(Qt).light;rn.referencePosition.value.setFromMatrixPosition(en.matrixWorld),rn.nearDistance.value=en.shadow.camera.near,rn.farDistance.value=en.shadow.camera.far}return{refreshFogUniforms:Vt,refreshMaterialUniforms:Gt}}function WebGLUniformsGroups(kt,_e,Dt,Vt){let Gt={},zt={},jt=[];const Ht=kt.getParameter(kt.MAX_UNIFORM_BUFFER_BINDINGS);function Wt(en,tn){const sn=tn.program;Vt.uniformBlockBinding(en,sn)}function qt(en,tn){let sn=Gt[en.id];sn===void 0&&(Jt(en),sn=Xt(en),Gt[en.id]=sn,en.addEventListener("dispose",rn));const cn=tn.program;Vt.updateUBOMapping(en,cn);const un=_e.render.frame;zt[en.id]!==un&&(Yt(en),zt[en.id]=un)}function Xt(en){const tn=Kt();en.__bindingPointIndex=tn;const sn=kt.createBuffer(),cn=en.__size,un=en.usage;return kt.bindBuffer(kt.UNIFORM_BUFFER,sn),kt.bufferData(kt.UNIFORM_BUFFER,cn,un),kt.bindBuffer(kt.UNIFORM_BUFFER,null),kt.bindBufferBase(kt.UNIFORM_BUFFER,tn,sn),sn}function Kt(){for(let en=0;en<Ht;en++)if(jt.indexOf(en)===-1)return jt.push(en),en;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function Yt(en){const tn=Gt[en.id],sn=en.uniforms,cn=en.__cache;kt.bindBuffer(kt.UNIFORM_BUFFER,tn);for(let un=0,hn=sn.length;un<hn;un++){const dn=Array.isArray(sn[un])?sn[un]:[sn[un]];for(let pn=0,fn=dn.length;pn<fn;pn++){const mn=dn[pn];if(Zt(mn,un,pn,cn)===!0){const vn=mn.__offset,_n=Array.isArray(mn.value)?mn.value:[mn.value];let En=0;for(let An=0;An<_n.length;An++){const Tn=_n[An],Cn=nn(Tn);typeof Tn=="number"||typeof Tn=="boolean"?(mn.__data[0]=Tn,kt.bufferSubData(kt.UNIFORM_BUFFER,vn+En,mn.__data)):Tn.isMatrix3?(mn.__data[0]=Tn.elements[0],mn.__data[1]=Tn.elements[1],mn.__data[2]=Tn.elements[2],mn.__data[3]=0,mn.__data[4]=Tn.elements[3],mn.__data[5]=Tn.elements[4],mn.__data[6]=Tn.elements[5],mn.__data[7]=0,mn.__data[8]=Tn.elements[6],mn.__data[9]=Tn.elements[7],mn.__data[10]=Tn.elements[8],mn.__data[11]=0):(Tn.toArray(mn.__data,En),En+=Cn.storage/Float32Array.BYTES_PER_ELEMENT)}kt.bufferSubData(kt.UNIFORM_BUFFER,vn,mn.__data)}}}kt.bindBuffer(kt.UNIFORM_BUFFER,null)}function Zt(en,tn,sn,cn){const un=en.value,hn=tn+"_"+sn;if(cn[hn]===void 0)return typeof un=="number"||typeof un=="boolean"?cn[hn]=un:cn[hn]=un.clone(),!0;{const dn=cn[hn];if(typeof un=="number"||typeof un=="boolean"){if(dn!==un)return cn[hn]=un,!0}else if(dn.equals(un)===!1)return dn.copy(un),!0}return!1}function Jt(en){const tn=en.uniforms;let sn=0;const cn=16;for(let hn=0,dn=tn.length;hn<dn;hn++){const pn=Array.isArray(tn[hn])?tn[hn]:[tn[hn]];for(let fn=0,mn=pn.length;fn<mn;fn++){const vn=pn[fn],_n=Array.isArray(vn.value)?vn.value:[vn.value];for(let En=0,An=_n.length;En<An;En++){const Tn=_n[En],Cn=nn(Tn),yn=sn%cn;yn!==0&&cn-yn<Cn.boundary&&(sn+=cn-yn),vn.__data=new Float32Array(Cn.storage/Float32Array.BYTES_PER_ELEMENT),vn.__offset=sn,sn+=Cn.storage}}}const un=sn%cn;return un>0&&(sn+=cn-un),en.__size=sn,en.__cache={},this}function nn(en){const tn={boundary:0,storage:0};return typeof en=="number"||typeof en=="boolean"?(tn.boundary=4,tn.storage=4):en.isVector2?(tn.boundary=8,tn.storage=8):en.isVector3||en.isColor?(tn.boundary=16,tn.storage=12):en.isVector4?(tn.boundary=16,tn.storage=16):en.isMatrix3?(tn.boundary=48,tn.storage=48):en.isMatrix4?(tn.boundary=64,tn.storage=64):en.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",en),tn}function rn(en){const tn=en.target;tn.removeEventListener("dispose",rn);const sn=jt.indexOf(tn.__bindingPointIndex);jt.splice(sn,1),kt.deleteBuffer(Gt[tn.id]),delete Gt[tn.id],delete zt[tn.id]}function Qt(){for(const en in Gt)kt.deleteBuffer(Gt[en]);jt=[],Gt={},zt={}}return{bind:Wt,update:qt,dispose:Qt}}class WebGLRenderer{constructor(_e={}){const{canvas:Dt=createCanvasElement(),context:Vt=null,depth:Gt=!0,stencil:zt=!1,alpha:jt=!1,antialias:Ht=!1,premultipliedAlpha:Wt=!0,preserveDrawingBuffer:qt=!1,powerPreference:Xt="default",failIfMajorPerformanceCaveat:Kt=!1}=_e;this.isWebGLRenderer=!0;let Yt;if(Vt!==null){if(typeof WebGLRenderingContext<"u"&&Vt instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");Yt=Vt.getContextAttributes().alpha}else Yt=jt;const Zt=new Uint32Array(4),Jt=new Int32Array(4);let nn=null,rn=null;const Qt=[],en=[];this.domElement=Dt,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=SRGBColorSpace$1,this._useLegacyLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const tn=this;let sn=!1,cn=0,un=0,hn=null,dn=-1,pn=null;const fn=new Vector4,mn=new Vector4;let vn=null;const _n=new Color$1(0);let En=0,An=Dt.width,Tn=Dt.height,Cn=1,yn=null,Sn=null;const wn=new Vector4(0,0,An,Tn),xn=new Vector4(0,0,An,Tn);let Rn=!1;const Dn=new Frustum;let kn=!1,Fn=!1;const Pn=new Matrix4,Bn=new Vector2,qn=new Vector3,tr={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function lr(){return hn===null?Cn:1}let zn=Vt;function ur(On,Gn){const Wn=Dt.getContext(On,Gn);return Wn!==null?Wn:null}try{const On={alpha:!0,depth:Gt,stencil:zt,antialias:Ht,premultipliedAlpha:Wt,preserveDrawingBuffer:qt,powerPreference:Xt,failIfMajorPerformanceCaveat:Kt};if("setAttribute"in Dt&&Dt.setAttribute("data-engine",`three.js r${REVISION}`),Dt.addEventListener("webglcontextlost",Dr,!1),Dt.addEventListener("webglcontextrestored",_r,!1),Dt.addEventListener("webglcontextcreationerror",Gr,!1),zn===null){const Gn="webgl2";if(zn=ur(Gn,On),zn===null)throw ur(Gn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(On){throw console.error("THREE.WebGLRenderer: "+On.message),On}let Hn,sr,vr,fr,Un,In,jn,or,cr,ar,gr,mr,Ar,Lr,Cr,Rr,zr,Pr,Fr,os,rs,Qr,cs,fs;function Br(){Hn=new WebGLExtensions(zn),Hn.init(),sr=new WebGLCapabilities(zn,Hn,_e),Qr=new WebGLUtils(zn,Hn),vr=new WebGLState(zn),fr=new WebGLInfo(zn),Un=new WebGLProperties,In=new WebGLTextures(zn,Hn,vr,Un,sr,Qr,fr),jn=new WebGLCubeMaps(tn),or=new WebGLCubeUVMaps(tn),cr=new WebGLAttributes(zn),cs=new WebGLBindingStates(zn,cr),ar=new WebGLGeometries(zn,cr,fr,cs),gr=new WebGLObjects(zn,ar,cr,fr),Fr=new WebGLMorphtargets(zn,sr,In),Rr=new WebGLClipping(Un),mr=new WebGLPrograms(tn,jn,or,Hn,sr,cs,Rr),Ar=new WebGLMaterials(tn,Un),Lr=new WebGLRenderLists,Cr=new WebGLRenderStates(Hn),Pr=new WebGLBackground(tn,jn,or,vr,gr,Yt,Wt),zr=new WebGLShadowMap(tn,gr,sr),fs=new WebGLUniformsGroups(zn,fr,sr,vr),os=new WebGLBufferRenderer(zn,Hn,fr),rs=new WebGLIndexedBufferRenderer(zn,Hn,fr),fr.programs=mr.programs,tn.capabilities=sr,tn.extensions=Hn,tn.properties=Un,tn.renderLists=Lr,tn.shadowMap=zr,tn.state=vr,tn.info=fr}Br();const rr=new WebXRManager(tn,zn);this.xr=rr,this.getContext=function(){return zn},this.getContextAttributes=function(){return zn.getContextAttributes()},this.forceContextLoss=function(){const On=Hn.get("WEBGL_lose_context");On&&On.loseContext()},this.forceContextRestore=function(){const On=Hn.get("WEBGL_lose_context");On&&On.restoreContext()},this.getPixelRatio=function(){return Cn},this.setPixelRatio=function(On){On!==void 0&&(Cn=On,this.setSize(An,Tn,!1))},this.getSize=function(On){return On.set(An,Tn)},this.setSize=function(On,Gn,Wn=!0){if(rr.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}An=On,Tn=Gn,Dt.width=Math.floor(On*Cn),Dt.height=Math.floor(Gn*Cn),Wn===!0&&(Dt.style.width=On+"px",Dt.style.height=Gn+"px"),this.setViewport(0,0,On,Gn)},this.getDrawingBufferSize=function(On){return On.set(An*Cn,Tn*Cn).floor()},this.setDrawingBufferSize=function(On,Gn,Wn){An=On,Tn=Gn,Cn=Wn,Dt.width=Math.floor(On*Wn),Dt.height=Math.floor(Gn*Wn),this.setViewport(0,0,On,Gn)},this.getCurrentViewport=function(On){return On.copy(fn)},this.getViewport=function(On){return On.copy(wn)},this.setViewport=function(On,Gn,Wn,er){On.isVector4?wn.set(On.x,On.y,On.z,On.w):wn.set(On,Gn,Wn,er),vr.viewport(fn.copy(wn).multiplyScalar(Cn).round())},this.getScissor=function(On){return On.copy(xn)},this.setScissor=function(On,Gn,Wn,er){On.isVector4?xn.set(On.x,On.y,On.z,On.w):xn.set(On,Gn,Wn,er),vr.scissor(mn.copy(xn).multiplyScalar(Cn).round())},this.getScissorTest=function(){return Rn},this.setScissorTest=function(On){vr.setScissorTest(Rn=On)},this.setOpaqueSort=function(On){yn=On},this.setTransparentSort=function(On){Sn=On},this.getClearColor=function(On){return On.copy(Pr.getClearColor())},this.setClearColor=function(){Pr.setClearColor.apply(Pr,arguments)},this.getClearAlpha=function(){return Pr.getClearAlpha()},this.setClearAlpha=function(){Pr.setClearAlpha.apply(Pr,arguments)},this.clear=function(On=!0,Gn=!0,Wn=!0){let er=0;if(On){let ir=!1;if(hn!==null){const pr=hn.texture.format;ir=pr===RGBAIntegerFormat||pr===RGIntegerFormat||pr===RedIntegerFormat}if(ir){const pr=hn.texture.type,Sr=pr===UnsignedByteType||pr===UnsignedIntType||pr===UnsignedShortType||pr===UnsignedInt248Type||pr===UnsignedShort4444Type||pr===UnsignedShort5551Type,Er=Pr.getClearColor(),wr=Pr.getClearAlpha(),Tr=Er.r,Ur=Er.g,Mr=Er.b;Sr?(Zt[0]=Tr,Zt[1]=Ur,Zt[2]=Mr,Zt[3]=wr,zn.clearBufferuiv(zn.COLOR,0,Zt)):(Jt[0]=Tr,Jt[1]=Ur,Jt[2]=Mr,Jt[3]=wr,zn.clearBufferiv(zn.COLOR,0,Jt))}else er|=zn.COLOR_BUFFER_BIT}Gn&&(er|=zn.DEPTH_BUFFER_BIT),Wn&&(er|=zn.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),zn.clear(er)},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(){Dt.removeEventListener("webglcontextlost",Dr,!1),Dt.removeEventListener("webglcontextrestored",_r,!1),Dt.removeEventListener("webglcontextcreationerror",Gr,!1),Lr.dispose(),Cr.dispose(),Un.dispose(),jn.dispose(),or.dispose(),gr.dispose(),cs.dispose(),fs.dispose(),mr.dispose(),rr.dispose(),rr.removeEventListener("sessionstart",Vs),rr.removeEventListener("sessionend",Gs),to.stop()};function Dr(On){On.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),sn=!0}function _r(){console.log("THREE.WebGLRenderer: Context Restored."),sn=!1;const On=fr.autoReset,Gn=zr.enabled,Wn=zr.autoUpdate,er=zr.needsUpdate,ir=zr.type;Br(),fr.autoReset=On,zr.enabled=Gn,zr.autoUpdate=Wn,zr.needsUpdate=er,zr.type=ir}function Gr(On){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",On.statusMessage)}function Yr(On){const Gn=On.target;Gn.removeEventListener("dispose",Yr),Es(Gn)}function Es(On){gs(On),Un.remove(On)}function gs(On){const Gn=Un.get(On).programs;Gn!==void 0&&(Gn.forEach(function(Wn){mr.releaseProgram(Wn)}),On.isShaderMaterial&&mr.releaseShaderCache(On))}this.renderBufferDirect=function(On,Gn,Wn,er,ir,pr){Gn===null&&(Gn=tr);const Sr=ir.isMesh&&ir.matrixWorld.determinant()<0,Er=qo(On,Gn,Wn,er,ir);vr.setMaterial(er,Sr);let wr=Wn.index,Tr=1;if(er.wireframe===!0){if(wr=ar.getWireframeAttribute(Wn),wr===void 0)return;Tr=2}const Ur=Wn.drawRange,Mr=Wn.attributes.position;let Nr=Ur.start*Tr,qr=(Ur.start+Ur.count)*Tr;pr!==null&&(Nr=Math.max(Nr,pr.start*Tr),qr=Math.min(qr,(pr.start+pr.count)*Tr)),wr!==null?(Nr=Math.max(Nr,0),qr=Math.min(qr,wr.count)):Mr!=null&&(Nr=Math.max(Nr,0),qr=Math.min(qr,Mr.count));const jr=qr-Nr;if(jr<0||jr===1/0)return;cs.setup(ir,er,Er,Wn,wr);let _i,Wr=os;if(wr!==null&&(_i=cr.get(wr),Wr=rs,Wr.setIndex(_i)),ir.isMesh)er.wireframe===!0?(vr.setLineWidth(er.wireframeLinewidth*lr()),Wr.setMode(zn.LINES)):Wr.setMode(zn.TRIANGLES);else if(ir.isLine){let Or=er.linewidth;Or===void 0&&(Or=1),vr.setLineWidth(Or*lr()),ir.isLineSegments?Wr.setMode(zn.LINES):ir.isLineLoop?Wr.setMode(zn.LINE_LOOP):Wr.setMode(zn.LINE_STRIP)}else ir.isPoints?Wr.setMode(zn.POINTS):ir.isSprite&&Wr.setMode(zn.TRIANGLES);if(ir.isBatchedMesh)Wr.renderMultiDraw(ir._multiDrawStarts,ir._multiDrawCounts,ir._multiDrawCount);else if(ir.isInstancedMesh)Wr.renderInstances(Nr,jr,ir.count);else if(Wn.isInstancedBufferGeometry){const Or=Wn._maxInstanceCount!==void 0?Wn._maxInstanceCount:1/0,Jr=Math.min(Wn.instanceCount,Or);Wr.renderInstances(Nr,jr,Jr)}else Wr.render(Nr,jr)};function Ts(On,Gn,Wn){On.transparent===!0&&On.side===DoubleSide&&On.forceSinglePass===!1?(On.side=BackSide,On.needsUpdate=!0,ks(On,Gn,Wn),On.side=FrontSide,On.needsUpdate=!0,ks(On,Gn,Wn),On.side=DoubleSide):ks(On,Gn,Wn)}this.compile=function(On,Gn,Wn=null){Wn===null&&(Wn=On),rn=Cr.get(Wn),rn.init(),en.push(rn),Wn.traverseVisible(function(ir){ir.isLight&&ir.layers.test(Gn.layers)&&(rn.pushLight(ir),ir.castShadow&&rn.pushShadow(ir))}),On!==Wn&&On.traverseVisible(function(ir){ir.isLight&&ir.layers.test(Gn.layers)&&(rn.pushLight(ir),ir.castShadow&&rn.pushShadow(ir))}),rn.setupLights(tn._useLegacyLights);const er=new Set;return On.traverse(function(ir){const pr=ir.material;if(pr)if(Array.isArray(pr))for(let Sr=0;Sr<pr.length;Sr++){const Er=pr[Sr];Ts(Er,Wn,ir),er.add(Er)}else Ts(pr,Wn,ir),er.add(pr)}),en.pop(),rn=null,er},this.compileAsync=function(On,Gn,Wn=null){const er=this.compile(On,Gn,Wn);return new Promise(ir=>{function pr(){if(er.forEach(function(Sr){Un.get(Sr).currentProgram.isReady()&&er.delete(Sr)}),er.size===0){ir(On);return}setTimeout(pr,10)}Hn.get("KHR_parallel_shader_compile")!==null?pr():setTimeout(pr,10)})};let Ps=null;function bs(On){Ps&&Ps(On)}function Vs(){to.stop()}function Gs(){to.start()}const to=new WebGLAnimation;to.setAnimationLoop(bs),typeof self<"u"&&to.setContext(self),this.setAnimationLoop=function(On){Ps=On,rr.setAnimationLoop(On),On===null?to.stop():to.start()},rr.addEventListener("sessionstart",Vs),rr.addEventListener("sessionend",Gs),this.render=function(On,Gn){if(Gn!==void 0&&Gn.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(sn===!0)return;On.matrixWorldAutoUpdate===!0&&On.updateMatrixWorld(),Gn.parent===null&&Gn.matrixWorldAutoUpdate===!0&&Gn.updateMatrixWorld(),rr.enabled===!0&&rr.isPresenting===!0&&(rr.cameraAutoUpdate===!0&&rr.updateCamera(Gn),Gn=rr.getCamera()),On.isScene===!0&&On.onBeforeRender(tn,On,Gn,hn),rn=Cr.get(On,en.length),rn.init(),en.push(rn),Pn.multiplyMatrices(Gn.projectionMatrix,Gn.matrixWorldInverse),Dn.setFromProjectionMatrix(Pn),Fn=this.localClippingEnabled,kn=Rr.init(this.clippingPlanes,Fn),nn=Lr.get(On,Qt.length),nn.init(),Qt.push(nn),Fo(On,Gn,0,tn.sortObjects),nn.finish(),tn.sortObjects===!0&&nn.sort(yn,Sn),this.info.render.frame++,kn===!0&&Rr.beginShadows();const Wn=rn.state.shadowsArray;if(zr.render(Wn,On,Gn),kn===!0&&Rr.endShadows(),this.info.autoReset===!0&&this.info.reset(),(rr.enabled===!1||rr.isPresenting===!1||rr.hasDepthSensing()===!1)&&Pr.render(nn,On),rn.setupLights(tn._useLegacyLights),Gn.isArrayCamera){const er=Gn.cameras;for(let ir=0,pr=er.length;ir<pr;ir++){const Sr=er[ir];Bo(nn,On,Sr,Sr.viewport)}}else Bo(nn,On,Gn);hn!==null&&(In.updateMultisampleRenderTarget(hn),In.updateRenderTargetMipmap(hn)),On.isScene===!0&&On.onAfterRender(tn,On,Gn),cs.resetDefaultState(),dn=-1,pn=null,en.pop(),en.length>0?rn=en[en.length-1]:rn=null,Qt.pop(),Qt.length>0?nn=Qt[Qt.length-1]:nn=null};function Fo(On,Gn,Wn,er){if(On.visible===!1)return;if(On.layers.test(Gn.layers)){if(On.isGroup)Wn=On.renderOrder;else if(On.isLOD)On.autoUpdate===!0&&On.update(Gn);else if(On.isLight)rn.pushLight(On),On.castShadow&&rn.pushShadow(On);else if(On.isSprite){if(!On.frustumCulled||Dn.intersectsSprite(On)){er&&qn.setFromMatrixPosition(On.matrixWorld).applyMatrix4(Pn);const Sr=gr.update(On),Er=On.material;Er.visible&&nn.push(On,Sr,Er,Wn,qn.z,null)}}else if((On.isMesh||On.isLine||On.isPoints)&&(!On.frustumCulled||Dn.intersectsObject(On))){const Sr=gr.update(On),Er=On.material;if(er&&(On.boundingSphere!==void 0?(On.boundingSphere===null&&On.computeBoundingSphere(),qn.copy(On.boundingSphere.center)):(Sr.boundingSphere===null&&Sr.computeBoundingSphere(),qn.copy(Sr.boundingSphere.center)),qn.applyMatrix4(On.matrixWorld).applyMatrix4(Pn)),Array.isArray(Er)){const wr=Sr.groups;for(let Tr=0,Ur=wr.length;Tr<Ur;Tr++){const Mr=wr[Tr],Nr=Er[Mr.materialIndex];Nr&&Nr.visible&&nn.push(On,Sr,Nr,Wn,qn.z,Mr)}}else Er.visible&&nn.push(On,Sr,Er,Wn,qn.z,null)}}const pr=On.children;for(let Sr=0,Er=pr.length;Sr<Er;Sr++)Fo(pr[Sr],Gn,Wn,er)}function Bo(On,Gn,Wn,er){const ir=On.opaque,pr=On.transmissive,Sr=On.transparent;rn.setupLightsView(Wn),kn===!0&&Rr.setGlobalState(tn.clippingPlanes,Wn),pr.length>0&&vo(ir,pr,Gn,Wn),er&&vr.viewport(fn.copy(er)),ir.length>0&&oo(ir,Gn,Wn),pr.length>0&&oo(pr,Gn,Wn),Sr.length>0&&oo(Sr,Gn,Wn),vr.buffers.depth.setTest(!0),vr.buffers.depth.setMask(!0),vr.buffers.color.setMask(!0),vr.setPolygonOffset(!1)}function vo(On,Gn,Wn,er){if((Wn.isScene===!0?Wn.overrideMaterial:null)!==null)return;if(rn.state.transmissionRenderTarget===null){rn.state.transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Hn.has("EXT_color_buffer_half_float")||Hn.has("EXT_color_buffer_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:4,stencilBuffer:zt});const Tr=Un.get(rn.state.transmissionRenderTarget);Tr.__isTransmissionRenderTarget=!0}const pr=rn.state.transmissionRenderTarget;tn.getDrawingBufferSize(Bn),pr.setSize(Bn.x,Bn.y);const Sr=tn.getRenderTarget();tn.setRenderTarget(pr),tn.getClearColor(_n),En=tn.getClearAlpha(),En<1&&tn.setClearColor(16777215,.5),tn.clear();const Er=tn.toneMapping;tn.toneMapping=NoToneMapping,oo(On,Wn,er),In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr);let wr=!1;for(let Tr=0,Ur=Gn.length;Tr<Ur;Tr++){const Mr=Gn[Tr],Nr=Mr.object,qr=Mr.geometry,jr=Mr.material,_i=Mr.group;if(jr.side===DoubleSide&&Nr.layers.test(er.layers)){const Wr=jr.side;jr.side=BackSide,jr.needsUpdate=!0,ao(Nr,Wn,er,qr,jr,_i),jr.side=Wr,jr.needsUpdate=!0,wr=!0}}wr===!0&&(In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr)),tn.setRenderTarget(Sr),tn.setClearColor(_n,En),tn.toneMapping=Er}function oo(On,Gn,Wn){const er=Gn.isScene===!0?Gn.overrideMaterial:null;for(let ir=0,pr=On.length;ir<pr;ir++){const Sr=On[ir],Er=Sr.object,wr=Sr.geometry,Tr=er===null?Sr.material:er,Ur=Sr.group;Er.layers.test(Wn.layers)&&ao(Er,Gn,Wn,wr,Tr,Ur)}}function ao(On,Gn,Wn,er,ir,pr){On.onBeforeRender(tn,Gn,Wn,er,ir,pr),On.modelViewMatrix.multiplyMatrices(Wn.matrixWorldInverse,On.matrixWorld),On.normalMatrix.getNormalMatrix(On.modelViewMatrix),ir.onBeforeRender(tn,Gn,Wn,er,On,pr),ir.transparent===!0&&ir.side===DoubleSide&&ir.forceSinglePass===!1?(ir.side=BackSide,ir.needsUpdate=!0,tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),ir.side=FrontSide,ir.needsUpdate=!0,tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),ir.side=DoubleSide):tn.renderBufferDirect(Wn,Gn,er,ir,On,pr),On.onAfterRender(tn,Gn,Wn,er,ir,pr)}function ks(On,Gn,Wn){Gn.isScene!==!0&&(Gn=tr);const er=Un.get(On),ir=rn.state.lights,pr=rn.state.shadowsArray,Sr=ir.state.version,Er=mr.getParameters(On,ir.state,pr,Gn,Wn),wr=mr.getProgramCacheKey(Er);let Tr=er.programs;er.environment=On.isMeshStandardMaterial?Gn.environment:null,er.fog=Gn.fog,er.envMap=(On.isMeshStandardMaterial?or:jn).get(On.envMap||er.environment),er.envMapRotation=er.environment!==null&&On.envMap===null?Gn.environmentRotation:On.envMapRotation,Tr===void 0&&(On.addEventListener("dispose",Yr),Tr=new Map,er.programs=Tr);let Ur=Tr.get(wr);if(Ur!==void 0){if(er.currentProgram===Ur&&er.lightsStateVersion===Sr)return Ro(On,Er),Ur}else Er.uniforms=mr.getUniforms(On),On.onBuild(Wn,Er,tn),On.onBeforeCompile(Er,tn),Ur=mr.acquireProgram(Er,wr),Tr.set(wr,Ur),er.uniforms=Er.uniforms;const Mr=er.uniforms;return(!On.isShaderMaterial&&!On.isRawShaderMaterial||On.clipping===!0)&&(Mr.clippingPlanes=Rr.uniform),Ro(On,Er),er.needsLights=$n(On),er.lightsStateVersion=Sr,er.needsLights&&(Mr.ambientLightColor.value=ir.state.ambient,Mr.lightProbe.value=ir.state.probe,Mr.directionalLights.value=ir.state.directional,Mr.directionalLightShadows.value=ir.state.directionalShadow,Mr.spotLights.value=ir.state.spot,Mr.spotLightShadows.value=ir.state.spotShadow,Mr.rectAreaLights.value=ir.state.rectArea,Mr.ltc_1.value=ir.state.rectAreaLTC1,Mr.ltc_2.value=ir.state.rectAreaLTC2,Mr.pointLights.value=ir.state.point,Mr.pointLightShadows.value=ir.state.pointShadow,Mr.hemisphereLights.value=ir.state.hemi,Mr.directionalShadowMap.value=ir.state.directionalShadowMap,Mr.directionalShadowMatrix.value=ir.state.directionalShadowMatrix,Mr.spotShadowMap.value=ir.state.spotShadowMap,Mr.spotLightMatrix.value=ir.state.spotLightMatrix,Mr.spotLightMap.value=ir.state.spotLightMap,Mr.pointShadowMap.value=ir.state.pointShadowMap,Mr.pointShadowMatrix.value=ir.state.pointShadowMatrix),er.currentProgram=Ur,er.uniformsList=null,Ur}function ss(On){if(On.uniformsList===null){const Gn=On.currentProgram.getUniforms();On.uniformsList=WebGLUniforms.seqWithValue(Gn.seq,On.uniforms)}return On.uniformsList}function Ro(On,Gn){const Wn=Un.get(On);Wn.outputColorSpace=Gn.outputColorSpace,Wn.batching=Gn.batching,Wn.instancing=Gn.instancing,Wn.instancingColor=Gn.instancingColor,Wn.instancingMorph=Gn.instancingMorph,Wn.skinning=Gn.skinning,Wn.morphTargets=Gn.morphTargets,Wn.morphNormals=Gn.morphNormals,Wn.morphColors=Gn.morphColors,Wn.morphTargetsCount=Gn.morphTargetsCount,Wn.numClippingPlanes=Gn.numClippingPlanes,Wn.numIntersection=Gn.numClipIntersection,Wn.vertexAlphas=Gn.vertexAlphas,Wn.vertexTangents=Gn.vertexTangents,Wn.toneMapping=Gn.toneMapping}function qo(On,Gn,Wn,er,ir){Gn.isScene!==!0&&(Gn=tr),In.resetTextureUnits();const pr=Gn.fog,Sr=er.isMeshStandardMaterial?Gn.environment:null,Er=hn===null?tn.outputColorSpace:hn.isXRRenderTarget===!0?hn.texture.colorSpace:LinearSRGBColorSpace$1,wr=(er.isMeshStandardMaterial?or:jn).get(er.envMap||Sr),Tr=er.vertexColors===!0&&!!Wn.attributes.color&&Wn.attributes.color.itemSize===4,Ur=!!Wn.attributes.tangent&&(!!er.normalMap||er.anisotropy>0),Mr=!!Wn.morphAttributes.position,Nr=!!Wn.morphAttributes.normal,qr=!!Wn.morphAttributes.color;let jr=NoToneMapping;er.toneMapped&&(hn===null||hn.isXRRenderTarget===!0)&&(jr=tn.toneMapping);const _i=Wn.morphAttributes.position||Wn.morphAttributes.normal||Wn.morphAttributes.color,Wr=_i!==void 0?_i.length:0,Or=Un.get(er),Jr=rn.state.lights;if(kn===!0&&(Fn===!0||On!==pn)){const ys=On===pn&&er.id===dn;Rr.setState(er,On,ys)}let Hr=!1;er.version===Or.__version?(Or.needsLights&&Or.lightsStateVersion!==Jr.state.version||Or.outputColorSpace!==Er||ir.isBatchedMesh&&Or.batching===!1||!ir.isBatchedMesh&&Or.batching===!0||ir.isInstancedMesh&&Or.instancing===!1||!ir.isInstancedMesh&&Or.instancing===!0||ir.isSkinnedMesh&&Or.skinning===!1||!ir.isSkinnedMesh&&Or.skinning===!0||ir.isInstancedMesh&&Or.instancingColor===!0&&ir.instanceColor===null||ir.isInstancedMesh&&Or.instancingColor===!1&&ir.instanceColor!==null||ir.isInstancedMesh&&Or.instancingMorph===!0&&ir.morphTexture===null||ir.isInstancedMesh&&Or.instancingMorph===!1&&ir.morphTexture!==null||Or.envMap!==wr||er.fog===!0&&Or.fog!==pr||Or.numClippingPlanes!==void 0&&(Or.numClippingPlanes!==Rr.numPlanes||Or.numIntersection!==Rr.numIntersection)||Or.vertexAlphas!==Tr||Or.vertexTangents!==Ur||Or.morphTargets!==Mr||Or.morphNormals!==Nr||Or.morphColors!==qr||Or.toneMapping!==jr||Or.morphTargetsCount!==Wr)&&(Hr=!0):(Hr=!0,Or.__version=er.version);let hs=Or.currentProgram;Hr===!0&&(hs=ks(er,Gn,ir));let es=!1,vs=!1,Ls=!1;const us=hs.getUniforms(),Cs=Or.uniforms;if(vr.useProgram(hs.program)&&(es=!0,vs=!0,Ls=!0),er.id!==dn&&(dn=er.id,vs=!0),es||pn!==On){us.setValue(zn,"projectionMatrix",On.projectionMatrix),us.setValue(zn,"viewMatrix",On.matrixWorldInverse);const ys=us.map.cameraPosition;ys!==void 0&&ys.setValue(zn,qn.setFromMatrixPosition(On.matrixWorld)),sr.logarithmicDepthBuffer&&us.setValue(zn,"logDepthBufFC",2/(Math.log(On.far+1)/Math.LN2)),(er.isMeshPhongMaterial||er.isMeshToonMaterial||er.isMeshLambertMaterial||er.isMeshBasicMaterial||er.isMeshStandardMaterial||er.isShaderMaterial)&&us.setValue(zn,"isOrthographic",On.isOrthographicCamera===!0),pn!==On&&(pn=On,vs=!0,Ls=!0)}if(ir.isSkinnedMesh){us.setOptional(zn,ir,"bindMatrix"),us.setOptional(zn,ir,"bindMatrixInverse");const ys=ir.skeleton;ys&&(ys.boneTexture===null&&ys.computeBoneTexture(),us.setValue(zn,"boneTexture",ys.boneTexture,In))}ir.isBatchedMesh&&(us.setOptional(zn,ir,"batchingTexture"),us.setValue(zn,"batchingTexture",ir._matricesTexture,In));const ds=Wn.morphAttributes;if((ds.position!==void 0||ds.normal!==void 0||ds.color!==void 0)&&Fr.update(ir,Wn,hs),(vs||Or.receiveShadow!==ir.receiveShadow)&&(Or.receiveShadow=ir.receiveShadow,us.setValue(zn,"receiveShadow",ir.receiveShadow)),er.isMeshGouraudMaterial&&er.envMap!==null&&(Cs.envMap.value=wr,Cs.flipEnvMap.value=wr.isCubeTexture&&wr.isRenderTargetTexture===!1?-1:1),er.isMeshStandardMaterial&&er.envMap===null&&Gn.environment!==null&&(Cs.envMapIntensity.value=Gn.environmentIntensity),vs&&(us.setValue(zn,"toneMappingExposure",tn.toneMappingExposure),Or.needsLights&&Ln(Cs,Ls),pr&&er.fog===!0&&Ar.refreshFogUniforms(Cs,pr),Ar.refreshMaterialUniforms(Cs,er,Cn,Tn,rn.state.transmissionRenderTarget),WebGLUniforms.upload(zn,ss(Or),Cs,In)),er.isShaderMaterial&&er.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(zn,ss(Or),Cs,In),er.uniformsNeedUpdate=!1),er.isSpriteMaterial&&us.setValue(zn,"center",ir.center),us.setValue(zn,"modelViewMatrix",ir.modelViewMatrix),us.setValue(zn,"normalMatrix",ir.normalMatrix),us.setValue(zn,"modelMatrix",ir.matrixWorld),er.isShaderMaterial||er.isRawShaderMaterial){const ys=er.uniformsGroups;for(let ms=0,ps=ys.length;ms<ps;ms++){const ws=ys[ms];fs.update(ws,hs),fs.bind(ws,hs)}}return hs}function Ln(On,Gn){On.ambientLightColor.needsUpdate=Gn,On.lightProbe.needsUpdate=Gn,On.directionalLights.needsUpdate=Gn,On.directionalLightShadows.needsUpdate=Gn,On.pointLights.needsUpdate=Gn,On.pointLightShadows.needsUpdate=Gn,On.spotLights.needsUpdate=Gn,On.spotLightShadows.needsUpdate=Gn,On.rectAreaLights.needsUpdate=Gn,On.hemisphereLights.needsUpdate=Gn}function $n(On){return On.isMeshLambertMaterial||On.isMeshToonMaterial||On.isMeshPhongMaterial||On.isMeshStandardMaterial||On.isShadowMaterial||On.isShaderMaterial&&On.lights===!0}this.getActiveCubeFace=function(){return cn},this.getActiveMipmapLevel=function(){return un},this.getRenderTarget=function(){return hn},this.setRenderTargetTextures=function(On,Gn,Wn){Un.get(On.texture).__webglTexture=Gn,Un.get(On.depthTexture).__webglTexture=Wn;const er=Un.get(On);er.__hasExternalTextures=!0,er.__autoAllocateDepthBuffer=Wn===void 0,er.__autoAllocateDepthBuffer||Hn.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),er.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(On,Gn){const Wn=Un.get(On);Wn.__webglFramebuffer=Gn,Wn.__useDefaultFramebuffer=Gn===void 0},this.setRenderTarget=function(On,Gn=0,Wn=0){hn=On,cn=Gn,un=Wn;let er=!0,ir=null,pr=!1,Sr=!1;if(On){const wr=Un.get(On);wr.__useDefaultFramebuffer!==void 0?(vr.bindFramebuffer(zn.FRAMEBUFFER,null),er=!1):wr.__webglFramebuffer===void 0?In.setupRenderTarget(On):wr.__hasExternalTextures&&In.rebindTextures(On,Un.get(On.texture).__webglTexture,Un.get(On.depthTexture).__webglTexture);const Tr=On.texture;(Tr.isData3DTexture||Tr.isDataArrayTexture||Tr.isCompressedArrayTexture)&&(Sr=!0);const Ur=Un.get(On).__webglFramebuffer;On.isWebGLCubeRenderTarget?(Array.isArray(Ur[Gn])?ir=Ur[Gn][Wn]:ir=Ur[Gn],pr=!0):On.samples>0&&In.useMultisampledRTT(On)===!1?ir=Un.get(On).__webglMultisampledFramebuffer:Array.isArray(Ur)?ir=Ur[Wn]:ir=Ur,fn.copy(On.viewport),mn.copy(On.scissor),vn=On.scissorTest}else fn.copy(wn).multiplyScalar(Cn).floor(),mn.copy(xn).multiplyScalar(Cn).floor(),vn=Rn;if(vr.bindFramebuffer(zn.FRAMEBUFFER,ir)&&er&&vr.drawBuffers(On,ir),vr.viewport(fn),vr.scissor(mn),vr.setScissorTest(vn),pr){const wr=Un.get(On.texture);zn.framebufferTexture2D(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,zn.TEXTURE_CUBE_MAP_POSITIVE_X+Gn,wr.__webglTexture,Wn)}else if(Sr){const wr=Un.get(On.texture),Tr=Gn||0;zn.framebufferTextureLayer(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,wr.__webglTexture,Wn||0,Tr)}dn=-1},this.readRenderTargetPixels=function(On,Gn,Wn,er,ir,pr,Sr){if(!(On&&On.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Er=Un.get(On).__webglFramebuffer;if(On.isWebGLCubeRenderTarget&&Sr!==void 0&&(Er=Er[Sr]),Er){vr.bindFramebuffer(zn.FRAMEBUFFER,Er);try{const wr=On.texture,Tr=wr.format,Ur=wr.type;if(Tr!==RGBAFormat&&Qr.convert(Tr)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Mr=Ur===HalfFloatType&&(Hn.has("EXT_color_buffer_half_float")||Hn.has("EXT_color_buffer_float"));if(Ur!==UnsignedByteType&&Qr.convert(Ur)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_TYPE)&&Ur!==FloatType&&!Mr){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Gn>=0&&Gn<=On.width-er&&Wn>=0&&Wn<=On.height-ir&&zn.readPixels(Gn,Wn,er,ir,Qr.convert(Tr),Qr.convert(Ur),pr)}finally{const wr=hn!==null?Un.get(hn).__webglFramebuffer:null;vr.bindFramebuffer(zn.FRAMEBUFFER,wr)}}},this.copyFramebufferToTexture=function(On,Gn,Wn=0){const er=Math.pow(2,-Wn),ir=Math.floor(Gn.image.width*er),pr=Math.floor(Gn.image.height*er);In.setTexture2D(Gn,0),zn.copyTexSubImage2D(zn.TEXTURE_2D,Wn,0,0,On.x,On.y,ir,pr),vr.unbindTexture()},this.copyTextureToTexture=function(On,Gn,Wn,er=0){const ir=Gn.image.width,pr=Gn.image.height,Sr=Qr.convert(Wn.format),Er=Qr.convert(Wn.type);In.setTexture2D(Wn,0),zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,Wn.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wn.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,Wn.unpackAlignment),Gn.isDataTexture?zn.texSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,ir,pr,Sr,Er,Gn.image.data):Gn.isCompressedTexture?zn.compressedTexSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,Gn.mipmaps[0].width,Gn.mipmaps[0].height,Sr,Gn.mipmaps[0].data):zn.texSubImage2D(zn.TEXTURE_2D,er,On.x,On.y,Sr,Er,Gn.image),er===0&&Wn.generateMipmaps&&zn.generateMipmap(zn.TEXTURE_2D),vr.unbindTexture()},this.copyTextureToTexture3D=function(On,Gn,Wn,er,ir=0){const pr=Math.round(On.max.x-On.min.x),Sr=Math.round(On.max.y-On.min.y),Er=On.max.z-On.min.z+1,wr=Qr.convert(er.format),Tr=Qr.convert(er.type);let Ur;if(er.isData3DTexture)In.setTexture3D(er,0),Ur=zn.TEXTURE_3D;else if(er.isDataArrayTexture||er.isCompressedArrayTexture)In.setTexture2DArray(er,0),Ur=zn.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,er.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,er.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,er.unpackAlignment);const Mr=zn.getParameter(zn.UNPACK_ROW_LENGTH),Nr=zn.getParameter(zn.UNPACK_IMAGE_HEIGHT),qr=zn.getParameter(zn.UNPACK_SKIP_PIXELS),jr=zn.getParameter(zn.UNPACK_SKIP_ROWS),_i=zn.getParameter(zn.UNPACK_SKIP_IMAGES),Wr=Wn.isCompressedTexture?Wn.mipmaps[ir]:Wn.image;zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Wr.width),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,Wr.height),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,On.min.x),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,On.min.y),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,On.min.z),Wn.isDataTexture||Wn.isData3DTexture?zn.texSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Tr,Wr.data):er.isCompressedArrayTexture?zn.compressedTexSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Wr.data):zn.texSubImage3D(Ur,ir,Gn.x,Gn.y,Gn.z,pr,Sr,Er,wr,Tr,Wr),zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Mr),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,Nr),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,qr),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,jr),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,_i),ir===0&&er.generateMipmaps&&zn.generateMipmap(Ur),vr.unbindTexture()},this.initTexture=function(On){On.isCubeTexture?In.setTextureCube(On,0):On.isData3DTexture?In.setTexture3D(On,0):On.isDataArrayTexture||On.isCompressedArrayTexture?In.setTexture2DArray(On,0):In.setTexture2D(On,0),vr.unbindTexture()},this.resetState=function(){cn=0,un=0,hn=null,vr.reset(),cs.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(_e){this._outputColorSpace=_e;const Dt=this.getContext();Dt.drawingBufferColorSpace=_e===DisplayP3ColorSpace?"display-p3":"srgb",Dt.unpackColorSpace=ColorManagement.workingColorSpace===LinearDisplayP3ColorSpace?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(_e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=_e}}class FogExp2{constructor(_e,Dt=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(_e),this.density=Dt}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fog{constructor(_e,Dt=1,Vt=1e3){this.isFog=!0,this.name="",this.color=new Color$1(_e),this.near=Dt,this.far=Vt}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,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.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(_e,Dt){return super.copy(_e,Dt),_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,this.backgroundRotation.copy(_e.backgroundRotation),this.environmentIntensity=_e.environmentIntensity,this.environmentRotation.copy(_e.environmentRotation),_e.overrideMaterial!==null&&(this.overrideMaterial=_e.overrideMaterial.clone()),this.matrixAutoUpdate=_e.matrixAutoUpdate,this}toJSON(_e){const Dt=super.toJSON(_e);return this.fog!==null&&(Dt.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Dt.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(Dt.object.backgroundIntensity=this.backgroundIntensity),Dt.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(Dt.object.environmentIntensity=this.environmentIntensity),Dt.object.environmentRotation=this.environmentRotation.toArray(),Dt}}class InterleavedBuffer{constructor(_e,Dt){this.isInterleavedBuffer=!0,this.array=_e,this.stride=Dt,this.count=_e!==void 0?_e.length/Dt:0,this.usage=StaticDrawUsage,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(_e){_e===!0&&this.version++}get updateRange(){return warnOnce("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(_e){return this.usage=_e,this}addUpdateRange(_e,Dt){this.updateRanges.push({start:_e,count:Dt})}clearUpdateRanges(){this.updateRanges.length=0}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,Dt,Vt){_e*=this.stride,Vt*=Dt.stride;for(let Gt=0,zt=this.stride;Gt<zt;Gt++)this.array[_e+Gt]=Dt.array[Vt+Gt];return this}set(_e,Dt=0){return this.array.set(_e,Dt),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 Dt=new this.array.constructor(_e.arrayBuffers[this.array.buffer._uuid]),Vt=new this.constructor(Dt,this.stride);return Vt.setUsage(this.usage),Vt}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,Dt,Vt,Gt=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=_e,this.itemSize=Dt,this.offset=Vt,this.normalized=Gt}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(_e){this.data.needsUpdate=_e}applyMatrix4(_e){for(let Dt=0,Vt=this.data.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyMatrix4(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyNormalMatrix(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.transformDirection(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}getComponent(_e,Dt){let Vt=this.array[_e*this.data.stride+this.offset+Dt];return this.normalized&&(Vt=denormalize(Vt,this.array)),Vt}setComponent(_e,Dt,Vt){return this.normalized&&(Vt=normalize(Vt,this.array)),this.data.array[_e*this.data.stride+this.offset+Dt]=Vt,this}setX(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset]=Dt,this}setY(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+1]=Dt,this}setZ(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+2]=Dt,this}setW(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+3]=Dt,this}getX(_e){let Dt=this.data.array[_e*this.data.stride+this.offset];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getY(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+1];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getZ(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+2];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getW(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+3];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}setXY(_e,Dt,Vt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this}setXYZ(_e,Dt,Vt,Gt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this}setXYZW(_e,Dt,Vt,Gt,zt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array),zt=normalize(zt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this.data.array[_e+3]=zt,this}clone(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return new BufferAttribute(new this.array.constructor(Dt),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 Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Dt,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$1(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=new SpriteMaterial){if(super(),this.isSprite=!0,this.type="Sprite",_geometry===void 0){_geometry=new BufferGeometry;const Dt=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),Vt=new InterleavedBuffer(Dt,5);_geometry.setIndex([0,1,2,0,2,3]),_geometry.setAttribute("position",new InterleavedBufferAttribute(Vt,3,0,!1)),_geometry.setAttribute("uv",new InterleavedBufferAttribute(Vt,2,3,!1))}this.geometry=_geometry,this.material=_e,this.center=new Vector2(.5,.5)}raycast(_e,Dt){_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 Vt=this.material.rotation;let Gt,zt;Vt!==0&&(zt=Math.cos(Vt),Gt=Math.sin(Vt));const jt=this.center;transformVertex(_vA.set(-.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vB.set(.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vC.set(.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvA.set(0,0),_uvB.set(1,0),_uvC.set(1,1);let Ht=_e.ray.intersectTriangle(_vA,_vB,_vC,!1,_intersectPoint);if(Ht===null&&(transformVertex(_vB.set(-.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvB.set(0,1),Ht=_e.ray.intersectTriangle(_vA,_vC,_vB,!1,_intersectPoint),Ht===null))return;const Wt=_e.ray.origin.distanceTo(_intersectPoint);Wt<_e.near||Wt>_e.far||Dt.push({distance:Wt,point:_intersectPoint.clone(),uv:Triangle.getInterpolation(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(_e,Dt){return super.copy(_e,Dt),_e.center!==void 0&&this.center.copy(_e.center),this.material=_e.material,this}}function transformVertex(kt,_e,Dt,Vt,Gt,zt){_alignedPosition.subVectors(kt,Dt).addScalar(.5).multiply(Vt),Gt!==void 0?(_rotatedPosition.x=zt*_alignedPosition.x-Gt*_alignedPosition.y,_rotatedPosition.y=Gt*_alignedPosition.x+zt*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),kt.copy(_e),kt.x+=_rotatedPosition.x,kt.y+=_rotatedPosition.y,kt.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 Dt=_e.levels;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Dt[Vt];this.addLevel(zt.object.clone(),zt.distance,zt.hysteresis)}return this.autoUpdate=_e.autoUpdate,this}addLevel(_e,Dt=0,Vt=0){Dt=Math.abs(Dt);const Gt=this.levels;let zt;for(zt=0;zt<Gt.length&&!(Dt<Gt[zt].distance);zt++);return Gt.splice(zt,0,{distance:Dt,hysteresis:Vt,object:_e}),this.add(_e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(_e){const Dt=this.levels;if(Dt.length>0){let Vt,Gt;for(Vt=1,Gt=Dt.length;Vt<Gt;Vt++){let zt=Dt[Vt].distance;if(Dt[Vt].object.visible&&(zt-=zt*Dt[Vt].hysteresis),_e<zt)break}return Dt[Vt-1].object}return null}raycast(_e,Dt){if(this.levels.length>0){_v1$2.setFromMatrixPosition(this.matrixWorld);const Gt=_e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(Gt).raycast(_e,Dt)}}update(_e){const Dt=this.levels;if(Dt.length>1){_v1$2.setFromMatrixPosition(_e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const Vt=_v1$2.distanceTo(_v2$1)/_e.zoom;Dt[0].object.visible=!0;let Gt,zt;for(Gt=1,zt=Dt.length;Gt<zt;Gt++){let jt=Dt[Gt].distance;if(Dt[Gt].object.visible&&(jt-=jt*Dt[Gt].hysteresis),Vt>=jt)Dt[Gt-1].object.visible=!1,Dt[Gt].object.visible=!0;else break}for(this._currentLevel=Gt-1;Gt<zt;Gt++)Dt[Gt].object.visible=!1}}toJSON(_e){const Dt=super.toJSON(_e);this.autoUpdate===!1&&(Dt.object.autoUpdate=!1),Dt.object.levels=[];const Vt=this.levels;for(let Gt=0,zt=Vt.length;Gt<zt;Gt++){const jt=Vt[Gt];Dt.object.levels.push({object:jt.object.uuid,distance:jt.distance,hysteresis:jt.hysteresis})}return Dt}}const _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector3=new Vector3,_matrix4=new Matrix4,_vertex=new Vector3,_sphere$4=new Sphere,_inverseMatrix$2=new Matrix4,_ray$2=new Ray;class SkinnedMesh extends Mesh{constructor(_e,Dt){super(_e,Dt),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=AttachedBindMode,this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const _e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingBox.expandByPoint(_vertex)}computeBoundingSphere(){const _e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingSphere.expandByPoint(_vertex)}copy(_e,Dt){return super.copy(_e,Dt),this.bindMode=_e.bindMode,this.bindMatrix.copy(_e.bindMatrix),this.bindMatrixInverse.copy(_e.bindMatrixInverse),this.skeleton=_e.skeleton,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}raycast(_e,Dt){const Vt=this.material,Gt=this.matrixWorld;Vt!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$4.copy(this.boundingSphere),_sphere$4.applyMatrix4(Gt),_e.ray.intersectsSphere(_sphere$4)!==!1&&(_inverseMatrix$2.copy(Gt).invert(),_ray$2.copy(_e.ray).applyMatrix4(_inverseMatrix$2),!(this.boundingBox!==null&&_ray$2.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(_e,Dt,_ray$2)))}getVertexPosition(_e,Dt){return super.getVertexPosition(_e,Dt),this.applyBoneTransform(_e,Dt),Dt}bind(_e,Dt){this.skeleton=_e,Dt===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Dt=this.matrixWorld),this.bindMatrix.copy(Dt),this.bindMatrixInverse.copy(Dt).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const _e=new Vector4,Dt=this.geometry.attributes.skinWeight;for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){_e.fromBufferAttribute(Dt,Vt);const zt=1/_e.manhattanLength();zt!==1/0?_e.multiplyScalar(zt):_e.set(1,0,0,0),Dt.setXYZW(Vt,_e.x,_e.y,_e.z,_e.w)}}updateMatrixWorld(_e){super.updateMatrixWorld(_e),this.bindMode===AttachedBindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===DetachedBindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(_e,Dt){const Vt=this.skeleton,Gt=this.geometry;_skinIndex.fromBufferAttribute(Gt.attributes.skinIndex,_e),_skinWeight.fromBufferAttribute(Gt.attributes.skinWeight,_e),_basePosition.copy(Dt).applyMatrix4(this.bindMatrix),Dt.set(0,0,0);for(let zt=0;zt<4;zt++){const jt=_skinWeight.getComponent(zt);if(jt!==0){const Ht=_skinIndex.getComponent(zt);_matrix4.multiplyMatrices(Vt.bones[Ht].matrixWorld,Vt.boneInverses[Ht]),Dt.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4),jt)}}return Dt.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(_e=null,Dt=1,Vt=1,Gt,zt,jt,Ht,Wt,qt=NearestFilter,Xt=NearestFilter,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isDataTexture=!0,this.image={data:_e,width:Dt,height:Vt},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _offsetMatrix=new Matrix4,_identityMatrix$1=new Matrix4;class Skeleton{constructor(_e=[],Dt=[]){this.uuid=generateUUID(),this.bones=_e.slice(0),this.boneInverses=Dt,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const _e=this.bones,Dt=this.boneInverses;if(this.boneMatrices=new Float32Array(_e.length*16),Dt.length===0)this.calculateInverses();else if(_e.length!==Dt.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let Vt=0,Gt=this.bones.length;Vt<Gt;Vt++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=new Matrix4;this.bones[_e]&&Vt.copy(this.bones[_e].matrixWorld).invert(),this.boneInverses.push(Vt)}}pose(){for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&Vt.matrixWorld.copy(this.boneInverses[_e]).invert()}for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&(Vt.parent&&Vt.parent.isBone?(Vt.matrix.copy(Vt.parent.matrixWorld).invert(),Vt.matrix.multiply(Vt.matrixWorld)):Vt.matrix.copy(Vt.matrixWorld),Vt.matrix.decompose(Vt.position,Vt.quaternion,Vt.scale))}}update(){const _e=this.bones,Dt=this.boneInverses,Vt=this.boneMatrices,Gt=this.boneTexture;for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt]?_e[zt].matrixWorld:_identityMatrix$1;_offsetMatrix.multiplyMatrices(Ht,Dt[zt]),_offsetMatrix.toArray(Vt,zt*16)}Gt!==null&&(Gt.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let _e=Math.sqrt(this.bones.length*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4);Dt.set(this.boneMatrices);const Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);return Vt.needsUpdate=!0,this.boneMatrices=Dt,this.boneTexture=Vt,this}getBoneByName(_e){for(let Dt=0,Vt=this.bones.length;Dt<Vt;Dt++){const Gt=this.bones[Dt];if(Gt.name===_e)return Gt}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(_e,Dt){this.uuid=_e.uuid;for(let Vt=0,Gt=_e.bones.length;Vt<Gt;Vt++){const zt=_e.bones[Vt];let jt=Dt[zt];jt===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",zt),jt=new Bone),this.bones.push(jt),this.boneInverses.push(new Matrix4().fromArray(_e.boneInverses[Vt]))}return this.init(),this}toJSON(){const _e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};_e.uuid=this.uuid;const Dt=this.bones,Vt=this.boneInverses;for(let Gt=0,zt=Dt.length;Gt<zt;Gt++){const jt=Dt[Gt];_e.bones.push(jt.uuid);const Ht=Vt[Gt];_e.boneInverses.push(Ht.toArray())}return _e}}class InstancedBufferAttribute extends BufferAttribute{constructor(_e,Dt,Vt,Gt=1){super(_e,Dt,Vt),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Gt}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=[],_box3=new Box3,_identity=new Matrix4,_mesh$1=new Mesh,_sphere$3=new Sphere;class InstancedMesh extends Mesh{constructor(_e,Dt,Vt){super(_e,Dt),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Vt*16),16),this.instanceColor=null,this.morphTexture=null,this.count=Vt,this.boundingBox=null,this.boundingSphere=null;for(let Gt=0;Gt<Vt;Gt++)this.setMatrixAt(Gt,_identity)}computeBoundingBox(){const _e=this.geometry,Dt=this.count;this.boundingBox===null&&(this.boundingBox=new Box3),_e.boundingBox===null&&_e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_box3.copy(_e.boundingBox).applyMatrix4(_instanceLocalMatrix),this.boundingBox.union(_box3)}computeBoundingSphere(){const _e=this.geometry,Dt=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sphere),_e.boundingSphere===null&&_e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_sphere$3.copy(_e.boundingSphere).applyMatrix4(_instanceLocalMatrix),this.boundingSphere.union(_sphere$3)}copy(_e,Dt){return super.copy(_e,Dt),this.instanceMatrix.copy(_e.instanceMatrix),_e.morphTexture!==null&&(this.morphTexture=_e.morphTexture.clone()),_e.instanceColor!==null&&(this.instanceColor=_e.instanceColor.clone()),this.count=_e.count,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}getColorAt(_e,Dt){Dt.fromArray(this.instanceColor.array,_e*3)}getMatrixAt(_e,Dt){Dt.fromArray(this.instanceMatrix.array,_e*16)}getMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=this.morphTexture.source.data.data,zt=Vt.length+1,jt=_e*zt+1;for(let Ht=0;Ht<Vt.length;Ht++)Vt[Ht]=Gt[jt+Ht]}raycast(_e,Dt){const Vt=this.matrixWorld,Gt=this.count;if(_mesh$1.geometry=this.geometry,_mesh$1.material=this.material,_mesh$1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$3.copy(this.boundingSphere),_sphere$3.applyMatrix4(Vt),_e.ray.intersectsSphere(_sphere$3)!==!1))for(let zt=0;zt<Gt;zt++){this.getMatrixAt(zt,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(Vt,_instanceLocalMatrix),_mesh$1.matrixWorld=_instanceWorldMatrix,_mesh$1.raycast(_e,_instanceIntersects);for(let jt=0,Ht=_instanceIntersects.length;jt<Ht;jt++){const Wt=_instanceIntersects[jt];Wt.instanceId=zt,Wt.object=this,Dt.push(Wt)}_instanceIntersects.length=0}}setColorAt(_e,Dt){this.instanceColor===null&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count*3),3)),Dt.toArray(this.instanceColor.array,_e*3)}setMatrixAt(_e,Dt){Dt.toArray(this.instanceMatrix.array,_e*16)}setMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=Vt.length+1;this.morphTexture===null&&(this.morphTexture=new DataTexture(new Float32Array(Gt*this.count),Gt,this.count,RedFormat,FloatType));const zt=this.morphTexture.source.data.data;let jt=0;for(let qt=0;qt<Vt.length;qt++)jt+=Vt[qt];const Ht=this.geometry.morphTargetsRelative?1:1-jt,Wt=Gt*_e;zt[Wt]=Ht,zt.set(Vt,Wt+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function sortOpaque(kt,_e){return kt.z-_e.z}function sortTransparent(kt,_e){return _e.z-kt.z}class MultiDrawRenderList{constructor(){this.index=0,this.pool=[],this.list=[]}push(_e,Dt){const Vt=this.pool,Gt=this.list;this.index>=Vt.length&&Vt.push({start:-1,count:-1,z:-1});const zt=Vt[this.index];Gt.push(zt),this.index++,zt.start=_e.start,zt.count=_e.count,zt.z=Dt}reset(){this.list.length=0,this.index=0}}const ID_ATTR_NAME="batchId",_matrix$1=new Matrix4,_invMatrixWorld=new Matrix4,_identityMatrix$2=new Matrix4,_projScreenMatrix$2=new Matrix4,_frustum=new Frustum,_box$1=new Box3,_sphere$2=new Sphere,_vector$5=new Vector3,_renderList=new MultiDrawRenderList,_mesh=new Mesh,_batchIntersects=[];function copyAttributeData(kt,_e,Dt=0){const Vt=_e.itemSize;if(kt.isInterleavedBufferAttribute||kt.array.constructor!==_e.array.constructor){const Gt=kt.count;for(let zt=0;zt<Gt;zt++)for(let jt=0;jt<Vt;jt++)_e.setComponent(zt+Dt,jt,kt.getComponent(zt,jt))}else _e.array.set(kt.array,Dt*Vt);_e.needsUpdate=!0}class BatchedMesh extends Mesh{get maxGeometryCount(){return this._maxGeometryCount}constructor(_e,Dt,Vt=Dt*2,Gt){super(new BufferGeometry,Gt),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=_e,this._maxVertexCount=Dt,this._maxIndexCount=Vt,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(_e),this._multiDrawStarts=new Int32Array(_e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let _e=Math.sqrt(this._maxGeometryCount*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4),Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);this._matricesTexture=Vt}_initializeGeometry(_e){const Dt=this.geometry,Vt=this._maxVertexCount,Gt=this._maxGeometryCount,zt=this._maxIndexCount;if(this._geometryInitialized===!1){for(const Ht in _e.attributes){const Wt=_e.getAttribute(Ht),{array:qt,itemSize:Xt,normalized:Kt}=Wt,Yt=new qt.constructor(Vt*Xt),Zt=new BufferAttribute(Yt,Xt,Kt);Dt.setAttribute(Ht,Zt)}if(_e.getIndex()!==null){const Ht=Vt>65536?new Uint32Array(zt):new Uint16Array(zt);Dt.setIndex(new BufferAttribute(Ht,1))}const jt=Gt>65536?new Uint32Array(Vt):new Uint16Array(Vt);Dt.setAttribute(ID_ATTR_NAME,new BufferAttribute(jt,1)),this._geometryInitialized=!0}}_validateGeometry(_e){if(_e.getAttribute(ID_ATTR_NAME))throw new Error(`BatchedMesh: Geometry cannot use attribute "${ID_ATTR_NAME}"`);const Dt=this.geometry;if(!!_e.getIndex()!=!!Dt.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const Vt in Dt.attributes){if(Vt===ID_ATTR_NAME)continue;if(!_e.hasAttribute(Vt))throw new Error(`BatchedMesh: Added geometry missing "${Vt}". All geometries must have consistent attributes.`);const Gt=_e.getAttribute(Vt),zt=Dt.getAttribute(Vt);if(Gt.itemSize!==zt.itemSize||Gt.normalized!==zt.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(_e){return this.customSort=_e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const _e=this._geometryCount,Dt=this.boundingBox,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingBoxAt(Gt,_box$1).applyMatrix4(_matrix$1),Dt.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere);const _e=this._geometryCount,Dt=this.boundingSphere,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingSphereAt(Gt,_sphere$2).applyMatrix4(_matrix$1),Dt.union(_sphere$2))}addGeometry(_e,Dt=-1,Vt=-1){if(this._initializeGeometry(_e),this._validateGeometry(_e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const Gt={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let zt=null;const jt=this._reservedRanges,Ht=this._drawRanges,Wt=this._bounds;this._geometryCount!==0&&(zt=jt[jt.length-1]),Dt===-1?Gt.vertexCount=_e.getAttribute("position").count:Gt.vertexCount=Dt,zt===null?Gt.vertexStart=0:Gt.vertexStart=zt.vertexStart+zt.vertexCount;const qt=_e.getIndex(),Xt=qt!==null;if(Xt&&(Vt===-1?Gt.indexCount=qt.count:Gt.indexCount=Vt,zt===null?Gt.indexStart=0:Gt.indexStart=zt.indexStart+zt.indexCount),Gt.indexStart!==-1&&Gt.indexStart+Gt.indexCount>this._maxIndexCount||Gt.vertexStart+Gt.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const Kt=this._visibility,Yt=this._active,Zt=this._matricesTexture,Jt=this._matricesTexture.image.data;Kt.push(!0),Yt.push(!0);const nn=this._geometryCount;this._geometryCount++,_identityMatrix$2.toArray(Jt,nn*16),Zt.needsUpdate=!0,jt.push(Gt),Ht.push({start:Xt?Gt.indexStart:Gt.vertexStart,count:-1}),Wt.push({boxInitialized:!1,box:new Box3,sphereInitialized:!1,sphere:new Sphere});const rn=this.geometry.getAttribute(ID_ATTR_NAME);for(let Qt=0;Qt<Gt.vertexCount;Qt++)rn.setX(Gt.vertexStart+Qt,nn);return rn.needsUpdate=!0,this.setGeometryAt(nn,_e),nn}setGeometryAt(_e,Dt){if(_e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Dt);const Vt=this.geometry,Gt=Vt.getIndex()!==null,zt=Vt.getIndex(),jt=Dt.getIndex(),Ht=this._reservedRanges[_e];if(Gt&&jt.count>Ht.indexCount||Dt.attributes.position.count>Ht.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const Wt=Ht.vertexStart,qt=Ht.vertexCount;for(const Zt in Vt.attributes){if(Zt===ID_ATTR_NAME)continue;const Jt=Dt.getAttribute(Zt),nn=Vt.getAttribute(Zt);copyAttributeData(Jt,nn,Wt);const rn=Jt.itemSize;for(let Qt=Jt.count,en=qt;Qt<en;Qt++){const tn=Wt+Qt;for(let sn=0;sn<rn;sn++)nn.setComponent(tn,sn,0)}nn.needsUpdate=!0,nn.addUpdateRange(Wt*rn,qt*rn)}if(Gt){const Zt=Ht.indexStart;for(let Jt=0;Jt<jt.count;Jt++)zt.setX(Zt+Jt,Wt+jt.getX(Jt));for(let Jt=jt.count,nn=Ht.indexCount;Jt<nn;Jt++)zt.setX(Zt+Jt,Wt);zt.needsUpdate=!0,zt.addUpdateRange(Zt,Ht.indexCount)}const Xt=this._bounds[_e];Dt.boundingBox!==null?(Xt.box.copy(Dt.boundingBox),Xt.boxInitialized=!0):Xt.boxInitialized=!1,Dt.boundingSphere!==null?(Xt.sphere.copy(Dt.boundingSphere),Xt.sphereInitialized=!0):Xt.sphereInitialized=!1;const Kt=this._drawRanges[_e],Yt=Dt.getAttribute("position");return Kt.count=Gt?jt.count:Yt.count,this._visibilityChanged=!0,_e}deleteGeometry(_e){const Dt=this._active;return _e>=Dt.length||Dt[_e]===!1?this:(Dt[_e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.box,jt=this.geometry;if(Gt.boxInitialized===!1){zt.makeEmpty();const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];for(let Xt=qt.start,Kt=qt.start+qt.count;Xt<Kt;Xt++){let Yt=Xt;Ht&&(Yt=Ht.getX(Yt)),zt.expandByPoint(_vector$5.fromBufferAttribute(Wt,Yt))}Gt.boxInitialized=!0}return Dt.copy(zt),Dt}getBoundingSphereAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.sphere,jt=this.geometry;if(Gt.sphereInitialized===!1){zt.makeEmpty(),this.getBoundingBoxAt(_e,_box$1),_box$1.getCenter(zt.center);const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];let Xt=0;for(let Kt=qt.start,Yt=qt.start+qt.count;Kt<Yt;Kt++){let Zt=Kt;Ht&&(Zt=Ht.getX(Zt)),_vector$5.fromBufferAttribute(Wt,Zt),Xt=Math.max(Xt,zt.center.distanceToSquared(_vector$5))}zt.radius=Math.sqrt(Xt),Gt.sphereInitialized=!0}return Dt.copy(zt),Dt}setMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture,zt=this._matricesTexture.image.data,jt=this._geometryCount;return _e>=jt||Vt[_e]===!1?this:(Dt.toArray(zt,_e*16),Gt.needsUpdate=!0,this)}getMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture.image.data,zt=this._geometryCount;return _e>=zt||Vt[_e]===!1?null:Dt.fromArray(Gt,_e*16)}setVisibleAt(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._geometryCount;return _e>=zt||Gt[_e]===!1||Vt[_e]===Dt?this:(Vt[_e]=Dt,this._visibilityChanged=!0,this)}getVisibleAt(_e){const Dt=this._visibility,Vt=this._active,Gt=this._geometryCount;return _e>=Gt||Vt[_e]===!1?!1:Dt[_e]}raycast(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._drawRanges,jt=this._geometryCount,Ht=this.matrixWorld,Wt=this.geometry;_mesh.material=this.material,_mesh.geometry.index=Wt.index,_mesh.geometry.attributes=Wt.attributes,_mesh.geometry.boundingBox===null&&(_mesh.geometry.boundingBox=new Box3),_mesh.geometry.boundingSphere===null&&(_mesh.geometry.boundingSphere=new Sphere);for(let qt=0;qt<jt;qt++){if(!Vt[qt]||!Gt[qt])continue;const Xt=zt[qt];_mesh.geometry.setDrawRange(Xt.start,Xt.count),this.getMatrixAt(qt,_mesh.matrixWorld).premultiply(Ht),this.getBoundingBoxAt(qt,_mesh.geometry.boundingBox),this.getBoundingSphereAt(qt,_mesh.geometry.boundingSphere),_mesh.raycast(_e,_batchIntersects);for(let Kt=0,Yt=_batchIntersects.length;Kt<Yt;Kt++){const Zt=_batchIntersects[Kt];Zt.object=this,Zt.batchId=qt,Dt.push(Zt)}_batchIntersects.length=0}_mesh.material=null,_mesh.geometry.index=null,_mesh.geometry.attributes={},_mesh.geometry.setDrawRange(0,1/0)}copy(_e){return super.copy(_e),this.geometry=_e.geometry.clone(),this.perObjectFrustumCulled=_e.perObjectFrustumCulled,this.sortObjects=_e.sortObjects,this.boundingBox=_e.boundingBox!==null?_e.boundingBox.clone():null,this.boundingSphere=_e.boundingSphere!==null?_e.boundingSphere.clone():null,this._drawRanges=_e._drawRanges.map(Dt=>({...Dt})),this._reservedRanges=_e._reservedRanges.map(Dt=>({...Dt})),this._visibility=_e._visibility.slice(),this._active=_e._active.slice(),this._bounds=_e._bounds.map(Dt=>({boxInitialized:Dt.boxInitialized,box:Dt.box.clone(),sphereInitialized:Dt.sphereInitialized,sphere:Dt.sphere.clone()})),this._maxGeometryCount=_e._maxGeometryCount,this._maxVertexCount=_e._maxVertexCount,this._maxIndexCount=_e._maxIndexCount,this._geometryInitialized=_e._geometryInitialized,this._geometryCount=_e._geometryCount,this._multiDrawCounts=_e._multiDrawCounts.slice(),this._multiDrawStarts=_e._multiDrawStarts.slice(),this._matricesTexture=_e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(_e,Dt,Vt,Gt,zt){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const jt=Gt.getIndex(),Ht=jt===null?1:jt.array.BYTES_PER_ELEMENT,Wt=this._active,qt=this._visibility,Xt=this._multiDrawStarts,Kt=this._multiDrawCounts,Yt=this._drawRanges,Zt=this.perObjectFrustumCulled;Zt&&(_projScreenMatrix$2.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse).multiply(this.matrixWorld),_frustum.setFromProjectionMatrix(_projScreenMatrix$2,_e.coordinateSystem));let Jt=0;if(this.sortObjects){_invMatrixWorld.copy(this.matrixWorld).invert(),_vector$5.setFromMatrixPosition(Vt.matrixWorld).applyMatrix4(_invMatrixWorld);for(let Qt=0,en=qt.length;Qt<en;Qt++)if(qt[Qt]&&Wt[Qt]){this.getMatrixAt(Qt,_matrix$1),this.getBoundingSphereAt(Qt,_sphere$2).applyMatrix4(_matrix$1);let tn=!1;if(Zt&&(tn=!_frustum.intersectsSphere(_sphere$2)),!tn){const sn=_vector$5.distanceTo(_sphere$2.center);_renderList.push(Yt[Qt],sn)}}const nn=_renderList.list,rn=this.customSort;rn===null?nn.sort(zt.transparent?sortTransparent:sortOpaque):rn.call(this,nn,Vt);for(let Qt=0,en=nn.length;Qt<en;Qt++){const tn=nn[Qt];Xt[Jt]=tn.start*Ht,Kt[Jt]=tn.count,Jt++}_renderList.reset()}else for(let nn=0,rn=qt.length;nn<rn;nn++)if(qt[nn]&&Wt[nn]){let Qt=!1;if(Zt&&(this.getMatrixAt(nn,_matrix$1),this.getBoundingSphereAt(nn,_sphere$2).applyMatrix4(_matrix$1),Qt=!_frustum.intersectsSphere(_sphere$2)),!Qt){const en=Yt[nn];Xt[Jt]=en.start*Ht,Kt[Jt]=en.count,Jt++}}this._multiDrawCount=Jt,this._visibilityChanged=!1}onBeforeShadow(_e,Dt,Vt,Gt,zt,jt){this.onBeforeRender(_e,null,Gt,zt,jt)}}class LineBasicMaterial extends Material{constructor(_e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color$1(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.linewidth=_e.linewidth,this.linecap=_e.linecap,this.linejoin=_e.linejoin,this.fog=_e.fog,this}}const _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,Dt=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[0];for(let Gt=1,zt=Dt.count;Gt<zt;Gt++)_start$1.fromBufferAttribute(Dt,Gt-1),_end$1.fromBufferAttribute(Dt,Gt),Vt[Gt]=Vt[Gt-1],Vt[Gt]+=_start$1.distanceTo(_end$1);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Line.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$1.copy(Vt.boundingSphere),_sphere$1.applyMatrix4(Gt),_sphere$1.radius+=zt,_e.ray.intersectsSphere(_sphere$1)===!1)return;_inverseMatrix$1.copy(Gt).invert(),_ray$1.copy(_e.ray).applyMatrix4(_inverseMatrix$1);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=new Vector3,Xt=new Vector3,Kt=new Vector3,Yt=new Vector3,Zt=this.isLineSegments?2:1,Jt=Vt.index,rn=Vt.attributes.position;if(Jt!==null){const Qt=Math.max(0,jt.start),en=Math.min(Jt.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){const cn=Jt.getX(tn),un=Jt.getX(tn+1);if(qt.fromBufferAttribute(rn,cn),Xt.fromBufferAttribute(rn,un),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const dn=_e.ray.origin.distanceTo(Yt);dn<_e.near||dn>_e.far||Dt.push({distance:dn,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}else{const Qt=Math.max(0,jt.start),en=Math.min(rn.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){if(qt.fromBufferAttribute(rn,tn),Xt.fromBufferAttribute(rn,tn+1),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const un=_e.ray.origin.distanceTo(Yt);un<_e.near||un>_e.far||Dt.push({distance:un,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}const _start=new Vector3,_end=new Vector3;class LineSegments extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[];for(let Gt=0,zt=Dt.count;Gt<zt;Gt+=2)_start.fromBufferAttribute(Dt,Gt),_end.fromBufferAttribute(Dt,Gt+1),Vt[Gt]=Gt===0?0:Vt[Gt-1],Vt[Gt+1]=Vt[Gt]+_start.distanceTo(_end);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(_e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color$1(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=new Ray,_sphere$7=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(_e=new BufferGeometry,Dt=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Points.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$7.copy(Vt.boundingSphere),_sphere$7.applyMatrix4(Gt),_sphere$7.radius+=zt,_e.ray.intersectsSphere(_sphere$7)===!1)return;_inverseMatrix.copy(Gt).invert(),_ray.copy(_e.ray).applyMatrix4(_inverseMatrix);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=Vt.index,Kt=Vt.attributes.position;if(qt!==null){const Yt=Math.max(0,jt.start),Zt=Math.min(qt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++){const rn=qt.getX(Jt);_position$2.fromBufferAttribute(Kt,rn),testPoint(_position$2,rn,Wt,Gt,_e,Dt,this)}}else{const Yt=Math.max(0,jt.start),Zt=Math.min(Kt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++)_position$2.fromBufferAttribute(Kt,Jt),testPoint(_position$2,Jt,Wt,Gt,_e,Dt,this)}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}function testPoint(kt,_e,Dt,Vt,Gt,zt,jt){const Ht=_ray.distanceSqToPoint(kt);if(Ht<Dt){const Wt=new Vector3;_ray.closestPointToPoint(kt,Wt),Wt.applyMatrix4(Vt);const qt=Gt.ray.origin.distanceTo(Wt);if(qt<Gt.near||qt>Gt.far)return;zt.push({distance:qt,distanceToRay:Math.sqrt(Ht),point:Wt,index:_e,face:null,object:jt})}}class VideoTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isVideoTexture=!0,this.minFilter=jt!==void 0?jt:LinearFilter,this.magFilter=zt!==void 0?zt:LinearFilter,this.generateMipmaps=!1;const Xt=this;function Kt(){Xt.needsUpdate=!0,_e.requestVideoFrameCallback(Kt)}"requestVideoFrameCallback"in _e&&_e.requestVideoFrameCallback(Kt)}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,Dt){super({width:_e,height:Dt}),this.isFramebufferTexture=!0,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isCompressedTexture=!0,this.image={width:Dt,height:Vt},this.mipmaps=_e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,zt,jt),this.isCompressedArrayTexture=!0,this.image.depth=Gt,this.wrapR=ClampToEdgeWrapping}}class CompressedCubeTexture extends CompressedTexture{constructor(_e,Dt,Vt){super(void 0,_e[0].width,_e[0].height,Dt,Vt,CubeReflectionMapping),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=_e}}class CanvasTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),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,Dt){const Vt=this.getUtoTmapping(_e);return this.getPoint(Vt,Dt)}getPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return Dt}getSpacedPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPointAt(Vt/_e));return Dt}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 Dt=[];let Vt,Gt=this.getPoint(0),zt=0;Dt.push(0);for(let jt=1;jt<=_e;jt++)Vt=this.getPoint(jt/_e),zt+=Vt.distanceTo(Gt),Dt.push(zt),Gt=Vt;return this.cacheArcLengths=Dt,Dt}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(_e,Dt){const Vt=this.getLengths();let Gt=0;const zt=Vt.length;let jt;Dt?jt=Dt:jt=_e*Vt[zt-1];let Ht=0,Wt=zt-1,qt;for(;Ht<=Wt;)if(Gt=Math.floor(Ht+(Wt-Ht)/2),qt=Vt[Gt]-jt,qt<0)Ht=Gt+1;else if(qt>0)Wt=Gt-1;else{Wt=Gt;break}if(Gt=Wt,Vt[Gt]===jt)return Gt/(zt-1);const Xt=Vt[Gt],Yt=Vt[Gt+1]-Xt,Zt=(jt-Xt)/Yt;return(Gt+Zt)/(zt-1)}getTangent(_e,Dt){let Gt=_e-1e-4,zt=_e+1e-4;Gt<0&&(Gt=0),zt>1&&(zt=1);const jt=this.getPoint(Gt),Ht=this.getPoint(zt),Wt=Dt||(jt.isVector2?new Vector2:new Vector3);return Wt.copy(Ht).sub(jt).normalize(),Wt}getTangentAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getTangent(Vt,Dt)}computeFrenetFrames(_e,Dt){const Vt=new Vector3,Gt=[],zt=[],jt=[],Ht=new Vector3,Wt=new Matrix4;for(let Zt=0;Zt<=_e;Zt++){const Jt=Zt/_e;Gt[Zt]=this.getTangentAt(Jt,new Vector3)}zt[0]=new Vector3,jt[0]=new Vector3;let qt=Number.MAX_VALUE;const Xt=Math.abs(Gt[0].x),Kt=Math.abs(Gt[0].y),Yt=Math.abs(Gt[0].z);Xt<=qt&&(qt=Xt,Vt.set(1,0,0)),Kt<=qt&&(qt=Kt,Vt.set(0,1,0)),Yt<=qt&&Vt.set(0,0,1),Ht.crossVectors(Gt[0],Vt).normalize(),zt[0].crossVectors(Gt[0],Ht),jt[0].crossVectors(Gt[0],zt[0]);for(let Zt=1;Zt<=_e;Zt++){if(zt[Zt]=zt[Zt-1].clone(),jt[Zt]=jt[Zt-1].clone(),Ht.crossVectors(Gt[Zt-1],Gt[Zt]),Ht.length()>Number.EPSILON){Ht.normalize();const Jt=Math.acos(clamp$2(Gt[Zt-1].dot(Gt[Zt]),-1,1));zt[Zt].applyMatrix4(Wt.makeRotationAxis(Ht,Jt))}jt[Zt].crossVectors(Gt[Zt],zt[Zt])}if(Dt===!0){let Zt=Math.acos(clamp$2(zt[0].dot(zt[_e]),-1,1));Zt/=_e,Gt[0].dot(Ht.crossVectors(zt[0],zt[_e]))>0&&(Zt=-Zt);for(let Jt=1;Jt<=_e;Jt++)zt[Jt].applyMatrix4(Wt.makeRotationAxis(Gt[Jt],Zt*Jt)),jt[Jt].crossVectors(Gt[Jt],zt[Jt])}return{tangents:Gt,normals:zt,binormals:jt}}clone(){return new this.constructor().copy(this)}copy(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}toJSON(){const _e={metadata:{version:4.6,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,Dt=0,Vt=1,Gt=1,zt=0,jt=Math.PI*2,Ht=!1,Wt=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=_e,this.aY=Dt,this.xRadius=Vt,this.yRadius=Gt,this.aStartAngle=zt,this.aEndAngle=jt,this.aClockwise=Ht,this.aRotation=Wt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=Math.PI*2;let zt=this.aEndAngle-this.aStartAngle;const jt=Math.abs(zt)<Number.EPSILON;for(;zt<0;)zt+=Gt;for(;zt>Gt;)zt-=Gt;zt<Number.EPSILON&&(jt?zt=0:zt=Gt),this.aClockwise===!0&&!jt&&(zt===Gt?zt=-Gt:zt=zt-Gt);const Ht=this.aStartAngle+_e*zt;let Wt=this.aX+this.xRadius*Math.cos(Ht),qt=this.aY+this.yRadius*Math.sin(Ht);if(this.aRotation!==0){const Xt=Math.cos(this.aRotation),Kt=Math.sin(this.aRotation),Yt=Wt-this.aX,Zt=qt-this.aY;Wt=Yt*Xt-Zt*Kt+this.aX,qt=Yt*Kt+Zt*Xt+this.aY}return Vt.set(Wt,qt)}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,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,Vt,Gt,zt,jt),this.isArcCurve=!0,this.type="ArcCurve"}}function CubicPoly(){let kt=0,_e=0,Dt=0,Vt=0;function Gt(zt,jt,Ht,Wt){kt=zt,_e=Ht,Dt=-3*zt+3*jt-2*Ht-Wt,Vt=2*zt-2*jt+Ht+Wt}return{initCatmullRom:function(zt,jt,Ht,Wt,qt){Gt(jt,Ht,qt*(Ht-zt),qt*(Wt-jt))},initNonuniformCatmullRom:function(zt,jt,Ht,Wt,qt,Xt,Kt){let Yt=(jt-zt)/qt-(Ht-zt)/(qt+Xt)+(Ht-jt)/Xt,Zt=(Ht-jt)/Xt-(Wt-jt)/(Xt+Kt)+(Wt-Ht)/Kt;Yt*=Xt,Zt*=Xt,Gt(jt,Ht,Yt,Zt)},calc:function(zt){const jt=zt*zt,Ht=jt*zt;return kt+_e*zt+Dt*jt+Vt*Ht}}}const tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;class CatmullRomCurve3 extends Curve{constructor(_e=[],Dt=!1,Vt="centripetal",Gt=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=_e,this.closed=Dt,this.curveType=Vt,this.tension=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.points,zt=Gt.length,jt=(zt-(this.closed?0:1))*_e;let Ht=Math.floor(jt),Wt=jt-Ht;this.closed?Ht+=Ht>0?0:(Math.floor(Math.abs(Ht)/zt)+1)*zt:Wt===0&&Ht===zt-1&&(Ht=zt-2,Wt=1);let qt,Xt;this.closed||Ht>0?qt=Gt[(Ht-1)%zt]:(tmp.subVectors(Gt[0],Gt[1]).add(Gt[0]),qt=tmp);const Kt=Gt[Ht%zt],Yt=Gt[(Ht+1)%zt];if(this.closed||Ht+2<zt?Xt=Gt[(Ht+2)%zt]:(tmp.subVectors(Gt[zt-1],Gt[zt-2]).add(Gt[zt-1]),Xt=tmp),this.curveType==="centripetal"||this.curveType==="chordal"){const Zt=this.curveType==="chordal"?.5:.25;let Jt=Math.pow(qt.distanceToSquared(Kt),Zt),nn=Math.pow(Kt.distanceToSquared(Yt),Zt),rn=Math.pow(Yt.distanceToSquared(Xt),Zt);nn<1e-4&&(nn=1),Jt<1e-4&&(Jt=nn),rn<1e-4&&(rn=nn),px.initNonuniformCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,Jt,nn,rn),py.initNonuniformCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,Jt,nn,rn),pz.initNonuniformCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,Jt,nn,rn)}else this.curveType==="catmullrom"&&(px.initCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,this.tension),py.initCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,this.tension),pz.initCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,this.tension));return Vt.set(px.calc(Wt),py.calc(Wt),pz.calc(Wt)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e.closed=this.closed,_e.curveType=this.curveType,_e.tension=this.tension,_e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector3().fromArray(Gt))}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}}function CatmullRom(kt,_e,Dt,Vt,Gt){const zt=(Vt-_e)*.5,jt=(Gt-Dt)*.5,Ht=kt*kt,Wt=kt*Ht;return(2*Dt-2*Vt+zt+jt)*Wt+(-3*Dt+3*Vt-2*zt-jt)*Ht+zt*kt+Dt}function QuadraticBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*_e}function QuadraticBezierP1(kt,_e){return 2*(1-kt)*kt*_e}function QuadraticBezierP2(kt,_e){return kt*kt*_e}function QuadraticBezier(kt,_e,Dt,Vt){return QuadraticBezierP0(kt,_e)+QuadraticBezierP1(kt,Dt)+QuadraticBezierP2(kt,Vt)}function CubicBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*Dt*_e}function CubicBezierP1(kt,_e){const Dt=1-kt;return 3*Dt*Dt*kt*_e}function CubicBezierP2(kt,_e){return 3*(1-kt)*kt*kt*_e}function CubicBezierP3(kt,_e){return kt*kt*kt*_e}function CubicBezier(kt,_e,Dt,Vt,Gt){return CubicBezierP0(kt,_e)+CubicBezierP1(kt,Dt)+CubicBezierP2(kt,Vt)+CubicBezierP3(kt,Gt)}class CubicBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2,Gt=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y)),Vt}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,Dt=new Vector3,Vt=new Vector3,Gt=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y),CubicBezier(_e,Gt.z,zt.z,jt.z,Ht.z)),Vt}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,Dt=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector2){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector2){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}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,Dt=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector3){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector3){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}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,Dt=new Vector2,Vt=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y)),Vt}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,Dt=new Vector3,Vt=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y),QuadraticBezier(_e,Gt.z,zt.z,jt.z)),Vt}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,Dt=new Vector2){const Vt=Dt,Gt=this.points,zt=(Gt.length-1)*_e,jt=Math.floor(zt),Ht=zt-jt,Wt=Gt[jt===0?jt:jt-1],qt=Gt[jt],Xt=Gt[jt>Gt.length-2?Gt.length-1:jt+1],Kt=Gt[jt>Gt.length-3?Gt.length-1:jt+2];return Vt.set(CatmullRom(Ht,Wt.x,qt.x,Xt.x,Kt.x),CatmullRom(Ht,Wt.y,qt.y,Xt.y,Kt.y)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector2().fromArray(Gt))}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),Dt=this.curves[this.curves.length-1].getPoint(1);if(!_e.equals(Dt)){const Vt=_e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Curves[Vt](Dt,_e))}return this}getPoint(_e,Dt){const Vt=_e*this.getLength(),Gt=this.getCurveLengths();let zt=0;for(;zt<Gt.length;){if(Gt[zt]>=Vt){const jt=Gt[zt]-Vt,Ht=this.curves[zt],Wt=Ht.getLength(),qt=Wt===0?0:1-jt/Wt;return Ht.getPointAt(qt,Dt)}zt++}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 Dt=0;for(let Vt=0,Gt=this.curves.length;Vt<Gt;Vt++)Dt+=this.curves[Vt].getLength(),_e.push(Dt);return this.cacheLengths=_e,_e}getSpacedPoints(_e=40){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return this.autoClose&&Dt.push(Dt[0]),Dt}getPoints(_e=12){const Dt=[];let Vt;for(let Gt=0,zt=this.curves;Gt<zt.length;Gt++){const jt=zt[Gt],Ht=jt.isEllipseCurve?_e*2:jt.isLineCurve||jt.isLineCurve3?1:jt.isSplineCurve?_e*jt.points.length:_e,Wt=jt.getPoints(Ht);for(let qt=0;qt<Wt.length;qt++){const Xt=Wt[qt];Vt&&Vt.equals(Xt)||(Dt.push(Xt),Vt=Xt)}}return this.autoClose&&Dt.length>1&&!Dt[Dt.length-1].equals(Dt[0])&&Dt.push(Dt[0]),Dt}copy(_e){super.copy(_e),this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(Gt.clone())}return this.autoClose=_e.autoClose,this}toJSON(){const _e=super.toJSON();_e.autoClose=this.autoClose,_e.curves=[];for(let Dt=0,Vt=this.curves.length;Dt<Vt;Dt++){const Gt=this.curves[Dt];_e.curves.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.autoClose=_e.autoClose,this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(new Curves[Gt.type]().fromJSON(Gt))}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 Dt=1,Vt=_e.length;Dt<Vt;Dt++)this.lineTo(_e[Dt].x,_e[Dt].y);return this}moveTo(_e,Dt){return this.currentPoint.set(_e,Dt),this}lineTo(_e,Dt){const Vt=new LineCurve(this.currentPoint.clone(),new Vector2(_e,Dt));return this.curves.push(Vt),this.currentPoint.set(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){const zt=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt));return this.curves.push(zt),this.currentPoint.set(Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){const Ht=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt),new Vector2(zt,jt));return this.curves.push(Ht),this.currentPoint.set(zt,jt),this}splineThru(_e){const Dt=[this.currentPoint.clone()].concat(_e),Vt=new SplineCurve(Dt);return this.curves.push(Vt),this.currentPoint.copy(_e[_e.length-1]),this}arc(_e,Dt,Vt,Gt,zt,jt){const Ht=this.currentPoint.x,Wt=this.currentPoint.y;return this.absarc(_e+Ht,Dt+Wt,Vt,Gt,zt,jt),this}absarc(_e,Dt,Vt,Gt,zt,jt){return this.absellipse(_e,Dt,Vt,Vt,Gt,zt,jt),this}ellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=this.currentPoint.x,Xt=this.currentPoint.y;return this.absellipse(_e+qt,Dt+Xt,Vt,Gt,zt,jt,Ht,Wt),this}absellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=new EllipseCurve(_e,Dt,Vt,Gt,zt,jt,Ht,Wt);if(this.curves.length>0){const Kt=qt.getPoint(0);Kt.equals(this.currentPoint)||this.lineTo(Kt.x,Kt.y)}this.curves.push(qt);const Xt=qt.getPoint(1);return this.currentPoint.copy(Xt),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)],Dt=12,Vt=0,Gt=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:_e,segments:Dt,phiStart:Vt,phiLength:Gt},Dt=Math.floor(Dt),Gt=clamp$2(Gt,0,Math.PI*2);const zt=[],jt=[],Ht=[],Wt=[],qt=[],Xt=1/Dt,Kt=new Vector3,Yt=new Vector2,Zt=new Vector3,Jt=new Vector3,nn=new Vector3;let rn=0,Qt=0;for(let en=0;en<=_e.length-1;en++)switch(en){case 0:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,nn.copy(Zt),Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z);break;case _e.length-1:Wt.push(nn.x,nn.y,nn.z);break;default:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,Jt.copy(Zt),Zt.x+=nn.x,Zt.y+=nn.y,Zt.z+=nn.z,Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z),nn.copy(Jt)}for(let en=0;en<=Dt;en++){const tn=Vt+en*Xt*Gt,sn=Math.sin(tn),cn=Math.cos(tn);for(let un=0;un<=_e.length-1;un++){Kt.x=_e[un].x*sn,Kt.y=_e[un].y,Kt.z=_e[un].x*cn,jt.push(Kt.x,Kt.y,Kt.z),Yt.x=en/Dt,Yt.y=un/(_e.length-1),Ht.push(Yt.x,Yt.y);const hn=Wt[3*un+0]*sn,dn=Wt[3*un+1],pn=Wt[3*un+0]*cn;qt.push(hn,dn,pn)}}for(let en=0;en<Dt;en++)for(let tn=0;tn<_e.length-1;tn++){const sn=tn+en*_e.length,cn=sn,un=sn+_e.length,hn=sn+_e.length+1,dn=sn+1;zt.push(cn,un,dn),zt.push(hn,dn,un)}this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("uv",new Float32BufferAttribute(Ht,2)),this.setAttribute("normal",new Float32BufferAttribute(qt,3))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new LatheGeometry(_e.points,_e.segments,_e.phiStart,_e.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(_e=1,Dt=1,Vt=4,Gt=8){const zt=new Path;zt.absarc(0,-Dt/2,_e,Math.PI*1.5,0),zt.absarc(0,Dt/2,_e,0,Math.PI*.5),super(zt.getPoints(Vt),Gt),this.type="CapsuleGeometry",this.parameters={radius:_e,length:Dt,capSegments:Vt,radialSegments:Gt}}static fromJSON(_e){return new CapsuleGeometry(_e.radius,_e.length,_e.capSegments,_e.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=0,Gt=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:_e,segments:Dt,thetaStart:Vt,thetaLength:Gt},Dt=Math.max(3,Dt);const zt=[],jt=[],Ht=[],Wt=[],qt=new Vector3,Xt=new Vector2;jt.push(0,0,0),Ht.push(0,0,1),Wt.push(.5,.5);for(let Kt=0,Yt=3;Kt<=Dt;Kt++,Yt+=3){const Zt=Vt+Kt/Dt*Gt;qt.x=_e*Math.cos(Zt),qt.y=_e*Math.sin(Zt),jt.push(qt.x,qt.y,qt.z),Ht.push(0,0,1),Xt.x=(jt[Yt]/_e+1)/2,Xt.y=(jt[Yt+1]/_e+1)/2,Wt.push(Xt.x,Xt.y)}for(let Kt=1;Kt<=Dt;Kt++)zt.push(Kt,Kt+1,0);this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("normal",new Float32BufferAttribute(Ht,3)),this.setAttribute("uv",new Float32BufferAttribute(Wt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CircleGeometry(_e.radius,_e.segments,_e.thetaStart,_e.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(_e=1,Dt=1,Vt=1,Gt=32,zt=1,jt=!1,Ht=0,Wt=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:_e,radiusBottom:Dt,height:Vt,radialSegments:Gt,heightSegments:zt,openEnded:jt,thetaStart:Ht,thetaLength:Wt};const qt=this;Gt=Math.floor(Gt),zt=Math.floor(zt);const Xt=[],Kt=[],Yt=[],Zt=[];let Jt=0;const nn=[],rn=Vt/2;let Qt=0;en(),jt===!1&&(_e>0&&tn(!0),Dt>0&&tn(!1)),this.setIndex(Xt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function en(){const sn=new Vector3,cn=new Vector3;let un=0;const hn=(Dt-_e)/Vt;for(let dn=0;dn<=zt;dn++){const pn=[],fn=dn/zt,mn=fn*(Dt-_e)+_e;for(let vn=0;vn<=Gt;vn++){const _n=vn/Gt,En=_n*Wt+Ht,An=Math.sin(En),Tn=Math.cos(En);cn.x=mn*An,cn.y=-fn*Vt+rn,cn.z=mn*Tn,Kt.push(cn.x,cn.y,cn.z),sn.set(An,hn,Tn).normalize(),Yt.push(sn.x,sn.y,sn.z),Zt.push(_n,1-fn),pn.push(Jt++)}nn.push(pn)}for(let dn=0;dn<Gt;dn++)for(let pn=0;pn<zt;pn++){const fn=nn[pn][dn],mn=nn[pn+1][dn],vn=nn[pn+1][dn+1],_n=nn[pn][dn+1];Xt.push(fn,mn,_n),Xt.push(mn,vn,_n),un+=6}qt.addGroup(Qt,un,0),Qt+=un}function tn(sn){const cn=Jt,un=new Vector2,hn=new Vector3;let dn=0;const pn=sn===!0?_e:Dt,fn=sn===!0?1:-1;for(let vn=1;vn<=Gt;vn++)Kt.push(0,rn*fn,0),Yt.push(0,fn,0),Zt.push(.5,.5),Jt++;const mn=Jt;for(let vn=0;vn<=Gt;vn++){const En=vn/Gt*Wt+Ht,An=Math.cos(En),Tn=Math.sin(En);hn.x=pn*Tn,hn.y=rn*fn,hn.z=pn*An,Kt.push(hn.x,hn.y,hn.z),Yt.push(0,fn,0),un.x=An*.5+.5,un.y=Tn*.5*fn+.5,Zt.push(un.x,un.y),Jt++}for(let vn=0;vn<Gt;vn++){const _n=cn+vn,En=mn+vn;sn===!0?Xt.push(En,En+1,_n):Xt.push(En+1,En,_n),dn+=3}qt.addGroup(Qt,dn,sn===!0?1:2),Qt+=dn}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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,Dt=1,Vt=32,Gt=1,zt=!1,jt=0,Ht=Math.PI*2){super(0,_e,Dt,Vt,Gt,zt,jt,Ht),this.type="ConeGeometry",this.parameters={radius:_e,height:Dt,radialSegments:Vt,heightSegments:Gt,openEnded:zt,thetaStart:jt,thetaLength:Ht}}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=[],Dt=[],Vt=1,Gt=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:_e,indices:Dt,radius:Vt,detail:Gt};const zt=[],jt=[];Ht(Gt),qt(Vt),Xt(),this.setAttribute("position",new Float32BufferAttribute(zt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2)),Gt===0?this.computeVertexNormals():this.normalizeNormals();function Ht(en){const tn=new Vector3,sn=new Vector3,cn=new Vector3;for(let un=0;un<Dt.length;un+=3)Zt(Dt[un+0],tn),Zt(Dt[un+1],sn),Zt(Dt[un+2],cn),Wt(tn,sn,cn,en)}function Wt(en,tn,sn,cn){const un=cn+1,hn=[];for(let dn=0;dn<=un;dn++){hn[dn]=[];const pn=en.clone().lerp(sn,dn/un),fn=tn.clone().lerp(sn,dn/un),mn=un-dn;for(let vn=0;vn<=mn;vn++)vn===0&&dn===un?hn[dn][vn]=pn:hn[dn][vn]=pn.clone().lerp(fn,vn/mn)}for(let dn=0;dn<un;dn++)for(let pn=0;pn<2*(un-dn)-1;pn++){const fn=Math.floor(pn/2);pn%2===0?(Yt(hn[dn][fn+1]),Yt(hn[dn+1][fn]),Yt(hn[dn][fn])):(Yt(hn[dn][fn+1]),Yt(hn[dn+1][fn+1]),Yt(hn[dn+1][fn]))}}function qt(en){const tn=new Vector3;for(let sn=0;sn<zt.length;sn+=3)tn.x=zt[sn+0],tn.y=zt[sn+1],tn.z=zt[sn+2],tn.normalize().multiplyScalar(en),zt[sn+0]=tn.x,zt[sn+1]=tn.y,zt[sn+2]=tn.z}function Xt(){const en=new Vector3;for(let tn=0;tn<zt.length;tn+=3){en.x=zt[tn+0],en.y=zt[tn+1],en.z=zt[tn+2];const sn=rn(en)/2/Math.PI+.5,cn=Qt(en)/Math.PI+.5;jt.push(sn,1-cn)}Jt(),Kt()}function Kt(){for(let en=0;en<jt.length;en+=6){const tn=jt[en+0],sn=jt[en+2],cn=jt[en+4],un=Math.max(tn,sn,cn),hn=Math.min(tn,sn,cn);un>.9&&hn<.1&&(tn<.2&&(jt[en+0]+=1),sn<.2&&(jt[en+2]+=1),cn<.2&&(jt[en+4]+=1))}}function Yt(en){zt.push(en.x,en.y,en.z)}function Zt(en,tn){const sn=en*3;tn.x=_e[sn+0],tn.y=_e[sn+1],tn.z=_e[sn+2]}function Jt(){const en=new Vector3,tn=new Vector3,sn=new Vector3,cn=new Vector3,un=new Vector2,hn=new Vector2,dn=new Vector2;for(let pn=0,fn=0;pn<zt.length;pn+=9,fn+=6){en.set(zt[pn+0],zt[pn+1],zt[pn+2]),tn.set(zt[pn+3],zt[pn+4],zt[pn+5]),sn.set(zt[pn+6],zt[pn+7],zt[pn+8]),un.set(jt[fn+0],jt[fn+1]),hn.set(jt[fn+2],jt[fn+3]),dn.set(jt[fn+4],jt[fn+5]),cn.copy(en).add(tn).add(sn).divideScalar(3);const mn=rn(cn);nn(un,fn+0,en,mn),nn(hn,fn+2,tn,mn),nn(dn,fn+4,sn,mn)}}function nn(en,tn,sn,cn){cn<0&&en.x===1&&(jt[tn]=en.x-1),sn.x===0&&sn.z===0&&(jt[tn]=cn/2/Math.PI+.5)}function rn(en){return Math.atan2(en.z,-en.x)}function Qt(en){return Math.atan2(-en.y,Math.sqrt(en.x*en.x+en.z*en.z))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new PolyhedronGeometry(_e.vertices,_e.indices,_e.radius,_e.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=1/Vt,zt=[-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,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,0,-Vt,0,-Gt,Vt,0,-Gt,-Vt,0,Gt,Vt,0,Gt],jt=[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,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(zt,jt,_e,Dt),this.type="DodecahedronGeometry",this.parameters={radius:_e,detail:Dt}}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,Dt=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:_e,thresholdAngle:Dt},_e!==null){const Gt=Math.pow(10,4),zt=Math.cos(DEG2RAD$1*Dt),jt=_e.getIndex(),Ht=_e.getAttribute("position"),Wt=jt?jt.count:Ht.count,qt=[0,0,0],Xt=["a","b","c"],Kt=new Array(3),Yt={},Zt=[];for(let Jt=0;Jt<Wt;Jt+=3){jt?(qt[0]=jt.getX(Jt),qt[1]=jt.getX(Jt+1),qt[2]=jt.getX(Jt+2)):(qt[0]=Jt,qt[1]=Jt+1,qt[2]=Jt+2);const{a:nn,b:rn,c:Qt}=_triangle;if(nn.fromBufferAttribute(Ht,qt[0]),rn.fromBufferAttribute(Ht,qt[1]),Qt.fromBufferAttribute(Ht,qt[2]),_triangle.getNormal(_normal),Kt[0]=`${Math.round(nn.x*Gt)},${Math.round(nn.y*Gt)},${Math.round(nn.z*Gt)}`,Kt[1]=`${Math.round(rn.x*Gt)},${Math.round(rn.y*Gt)},${Math.round(rn.z*Gt)}`,Kt[2]=`${Math.round(Qt.x*Gt)},${Math.round(Qt.y*Gt)},${Math.round(Qt.z*Gt)}`,!(Kt[0]===Kt[1]||Kt[1]===Kt[2]||Kt[2]===Kt[0]))for(let en=0;en<3;en++){const tn=(en+1)%3,sn=Kt[en],cn=Kt[tn],un=_triangle[Xt[en]],hn=_triangle[Xt[tn]],dn=`${sn}_${cn}`,pn=`${cn}_${sn}`;pn in Yt&&Yt[pn]?(_normal.dot(Yt[pn].normal)<=zt&&(Zt.push(un.x,un.y,un.z),Zt.push(hn.x,hn.y,hn.z)),Yt[pn]=null):dn in Yt||(Yt[dn]={index0:qt[en],index1:qt[tn],normal:_normal.clone()})}}for(const Jt in Yt)if(Yt[Jt]){const{index0:nn,index1:rn}=Yt[Jt];_v0.fromBufferAttribute(Ht,nn),_v1$1.fromBufferAttribute(Ht,rn),Zt.push(_v0.x,_v0.y,_v0.z),Zt.push(_v1$1.x,_v1$1.y,_v1$1.z)}this.setAttribute("position",new Float32BufferAttribute(Zt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}class Shape extends Path{constructor(_e){super(_e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(_e){const Dt=[];for(let Vt=0,Gt=this.holes.length;Vt<Gt;Vt++)Dt[Vt]=this.holes[Vt].getPoints(_e);return Dt}extractPoints(_e){return{shape:this.getPoints(_e),holes:this.getPointsHoles(_e)}}copy(_e){super.copy(_e),this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.uuid=this.uuid,_e.holes=[];for(let Dt=0,Vt=this.holes.length;Dt<Vt;Dt++){const Gt=this.holes[Dt];_e.holes.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.uuid=_e.uuid,this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(new Path().fromJSON(Gt))}return this}}const Earcut={triangulate:function(kt,_e,Dt=2){const Vt=_e&&_e.length,Gt=Vt?_e[0]*Dt:kt.length;let zt=linkedList(kt,0,Gt,Dt,!0);const jt=[];if(!zt||zt.next===zt.prev)return jt;let Ht,Wt,qt,Xt,Kt,Yt,Zt;if(Vt&&(zt=eliminateHoles(kt,_e,zt,Dt)),kt.length>80*Dt){Ht=qt=kt[0],Wt=Xt=kt[1];for(let Jt=Dt;Jt<Gt;Jt+=Dt)Kt=kt[Jt],Yt=kt[Jt+1],Kt<Ht&&(Ht=Kt),Yt<Wt&&(Wt=Yt),Kt>qt&&(qt=Kt),Yt>Xt&&(Xt=Yt);Zt=Math.max(qt-Ht,Xt-Wt),Zt=Zt!==0?32767/Zt:0}return earcutLinked(zt,jt,Dt,Ht,Wt,Zt,0),jt}};function linkedList(kt,_e,Dt,Vt,Gt){let zt,jt;if(Gt===signedArea(kt,_e,Dt,Vt)>0)for(zt=_e;zt<Dt;zt+=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);else for(zt=Dt-Vt;zt>=_e;zt-=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);return jt&&equals(jt,jt.next)&&(removeNode(jt),jt=jt.next),jt}function filterPoints(kt,_e){if(!kt)return kt;_e||(_e=kt);let Dt=kt,Vt;do if(Vt=!1,!Dt.steiner&&(equals(Dt,Dt.next)||area$1(Dt.prev,Dt,Dt.next)===0)){if(removeNode(Dt),Dt=_e=Dt.prev,Dt===Dt.next)break;Vt=!0}else Dt=Dt.next;while(Vt||Dt!==_e);return _e}function earcutLinked(kt,_e,Dt,Vt,Gt,zt,jt){if(!kt)return;!jt&&zt&&indexCurve(kt,Vt,Gt,zt);let Ht=kt,Wt,qt;for(;kt.prev!==kt.next;){if(Wt=kt.prev,qt=kt.next,zt?isEarHashed(kt,Vt,Gt,zt):isEar(kt)){_e.push(Wt.i/Dt|0),_e.push(kt.i/Dt|0),_e.push(qt.i/Dt|0),removeNode(kt),kt=qt.next,Ht=qt.next;continue}if(kt=qt,kt===Ht){jt?jt===1?(kt=cureLocalIntersections(filterPoints(kt),_e,Dt),earcutLinked(kt,_e,Dt,Vt,Gt,zt,2)):jt===2&&splitEarcut(kt,_e,Dt,Vt,Gt,zt):earcutLinked(filterPoints(kt),_e,Dt,Vt,Gt,zt,1);break}}}function isEar(kt){const _e=kt.prev,Dt=kt,Vt=kt.next;if(area$1(_e,Dt,Vt)>=0)return!1;const Gt=_e.x,zt=Dt.x,jt=Vt.x,Ht=_e.y,Wt=Dt.y,qt=Vt.y,Xt=Gt<zt?Gt<jt?Gt:jt:zt<jt?zt:jt,Kt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Yt=Gt>zt?Gt>jt?Gt:jt:zt>jt?zt:jt,Zt=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt;let Jt=Vt.next;for(;Jt!==_e;){if(Jt.x>=Xt&&Jt.x<=Yt&&Jt.y>=Kt&&Jt.y<=Zt&&pointInTriangle(Gt,Ht,zt,Wt,jt,qt,Jt.x,Jt.y)&&area$1(Jt.prev,Jt,Jt.next)>=0)return!1;Jt=Jt.next}return!0}function isEarHashed(kt,_e,Dt,Vt){const Gt=kt.prev,zt=kt,jt=kt.next;if(area$1(Gt,zt,jt)>=0)return!1;const Ht=Gt.x,Wt=zt.x,qt=jt.x,Xt=Gt.y,Kt=zt.y,Yt=jt.y,Zt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Jt=Xt<Kt?Xt<Yt?Xt:Yt:Kt<Yt?Kt:Yt,nn=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt,rn=Xt>Kt?Xt>Yt?Xt:Yt:Kt>Yt?Kt:Yt,Qt=zOrder(Zt,Jt,_e,Dt,Vt),en=zOrder(nn,rn,_e,Dt,Vt);let tn=kt.prevZ,sn=kt.nextZ;for(;tn&&tn.z>=Qt&&sn&&sn.z<=en;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0||(tn=tn.prevZ,sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0))return!1;sn=sn.nextZ}for(;tn&&tn.z>=Qt;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0)return!1;tn=tn.prevZ}for(;sn&&sn.z<=en;){if(sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0)return!1;sn=sn.nextZ}return!0}function cureLocalIntersections(kt,_e,Dt){let Vt=kt;do{const Gt=Vt.prev,zt=Vt.next.next;!equals(Gt,zt)&&intersects(Gt,Vt,Vt.next,zt)&&locallyInside(Gt,zt)&&locallyInside(zt,Gt)&&(_e.push(Gt.i/Dt|0),_e.push(Vt.i/Dt|0),_e.push(zt.i/Dt|0),removeNode(Vt),removeNode(Vt.next),Vt=kt=zt),Vt=Vt.next}while(Vt!==kt);return filterPoints(Vt)}function splitEarcut(kt,_e,Dt,Vt,Gt,zt){let jt=kt;do{let Ht=jt.next.next;for(;Ht!==jt.prev;){if(jt.i!==Ht.i&&isValidDiagonal(jt,Ht)){let Wt=splitPolygon(jt,Ht);jt=filterPoints(jt,jt.next),Wt=filterPoints(Wt,Wt.next),earcutLinked(jt,_e,Dt,Vt,Gt,zt,0),earcutLinked(Wt,_e,Dt,Vt,Gt,zt,0);return}Ht=Ht.next}jt=jt.next}while(jt!==kt)}function eliminateHoles(kt,_e,Dt,Vt){const Gt=[];let zt,jt,Ht,Wt,qt;for(zt=0,jt=_e.length;zt<jt;zt++)Ht=_e[zt]*Vt,Wt=zt<jt-1?_e[zt+1]*Vt:kt.length,qt=linkedList(kt,Ht,Wt,Vt,!1),qt===qt.next&&(qt.steiner=!0),Gt.push(getLeftmost(qt));for(Gt.sort(compareX),zt=0;zt<Gt.length;zt++)Dt=eliminateHole(Gt[zt],Dt);return Dt}function compareX(kt,_e){return kt.x-_e.x}function eliminateHole(kt,_e){const Dt=findHoleBridge(kt,_e);if(!Dt)return _e;const Vt=splitPolygon(Dt,kt);return filterPoints(Vt,Vt.next),filterPoints(Dt,Dt.next)}function findHoleBridge(kt,_e){let Dt=_e,Vt=-1/0,Gt;const zt=kt.x,jt=kt.y;do{if(jt<=Dt.y&&jt>=Dt.next.y&&Dt.next.y!==Dt.y){const Yt=Dt.x+(jt-Dt.y)*(Dt.next.x-Dt.x)/(Dt.next.y-Dt.y);if(Yt<=zt&&Yt>Vt&&(Vt=Yt,Gt=Dt.x<Dt.next.x?Dt:Dt.next,Yt===zt))return Gt}Dt=Dt.next}while(Dt!==_e);if(!Gt)return null;const Ht=Gt,Wt=Gt.x,qt=Gt.y;let Xt=1/0,Kt;Dt=Gt;do zt>=Dt.x&&Dt.x>=Wt&&zt!==Dt.x&&pointInTriangle(jt<qt?zt:Vt,jt,Wt,qt,jt<qt?Vt:zt,jt,Dt.x,Dt.y)&&(Kt=Math.abs(jt-Dt.y)/(zt-Dt.x),locallyInside(Dt,kt)&&(Kt<Xt||Kt===Xt&&(Dt.x>Gt.x||Dt.x===Gt.x&&sectorContainsSector(Gt,Dt)))&&(Gt=Dt,Xt=Kt)),Dt=Dt.next;while(Dt!==Ht);return Gt}function sectorContainsSector(kt,_e){return area$1(kt.prev,kt,_e.prev)<0&&area$1(_e.next,kt,kt.next)<0}function indexCurve(kt,_e,Dt,Vt){let Gt=kt;do Gt.z===0&&(Gt.z=zOrder(Gt.x,Gt.y,_e,Dt,Vt)),Gt.prevZ=Gt.prev,Gt.nextZ=Gt.next,Gt=Gt.next;while(Gt!==kt);Gt.prevZ.nextZ=null,Gt.prevZ=null,sortLinked(Gt)}function sortLinked(kt){let _e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt=1;do{for(Dt=kt,kt=null,zt=null,jt=0;Dt;){for(jt++,Vt=Dt,Ht=0,_e=0;_e<qt&&(Ht++,Vt=Vt.nextZ,!!Vt);_e++);for(Wt=qt;Ht>0||Wt>0&&Vt;)Ht!==0&&(Wt===0||!Vt||Dt.z<=Vt.z)?(Gt=Dt,Dt=Dt.nextZ,Ht--):(Gt=Vt,Vt=Vt.nextZ,Wt--),zt?zt.nextZ=Gt:kt=Gt,Gt.prevZ=zt,zt=Gt;Dt=Vt}zt.nextZ=null,qt*=2}while(jt>1);return kt}function zOrder(kt,_e,Dt,Vt,Gt){return kt=(kt-Dt)*Gt|0,_e=(_e-Vt)*Gt|0,kt=(kt|kt<<8)&16711935,kt=(kt|kt<<4)&252645135,kt=(kt|kt<<2)&858993459,kt=(kt|kt<<1)&1431655765,_e=(_e|_e<<8)&16711935,_e=(_e|_e<<4)&252645135,_e=(_e|_e<<2)&858993459,_e=(_e|_e<<1)&1431655765,kt|_e<<1}function getLeftmost(kt){let _e=kt,Dt=kt;do(_e.x<Dt.x||_e.x===Dt.x&&_e.y<Dt.y)&&(Dt=_e),_e=_e.next;while(_e!==kt);return Dt}function pointInTriangle(kt,_e,Dt,Vt,Gt,zt,jt,Ht){return(Gt-jt)*(_e-Ht)>=(kt-jt)*(zt-Ht)&&(kt-jt)*(Vt-Ht)>=(Dt-jt)*(_e-Ht)&&(Dt-jt)*(zt-Ht)>=(Gt-jt)*(Vt-Ht)}function isValidDiagonal(kt,_e){return kt.next.i!==_e.i&&kt.prev.i!==_e.i&&!intersectsPolygon(kt,_e)&&(locallyInside(kt,_e)&&locallyInside(_e,kt)&&middleInside(kt,_e)&&(area$1(kt.prev,kt,_e.prev)||area$1(kt,_e.prev,_e))||equals(kt,_e)&&area$1(kt.prev,kt,kt.next)>0&&area$1(_e.prev,_e,_e.next)>0)}function area$1(kt,_e,Dt){return(_e.y-kt.y)*(Dt.x-_e.x)-(_e.x-kt.x)*(Dt.y-_e.y)}function equals(kt,_e){return kt.x===_e.x&&kt.y===_e.y}function intersects(kt,_e,Dt,Vt){const Gt=sign(area$1(kt,_e,Dt)),zt=sign(area$1(kt,_e,Vt)),jt=sign(area$1(Dt,Vt,kt)),Ht=sign(area$1(Dt,Vt,_e));return!!(Gt!==zt&&jt!==Ht||Gt===0&&onSegment(kt,Dt,_e)||zt===0&&onSegment(kt,Vt,_e)||jt===0&&onSegment(Dt,kt,Vt)||Ht===0&&onSegment(Dt,_e,Vt))}function onSegment(kt,_e,Dt){return _e.x<=Math.max(kt.x,Dt.x)&&_e.x>=Math.min(kt.x,Dt.x)&&_e.y<=Math.max(kt.y,Dt.y)&&_e.y>=Math.min(kt.y,Dt.y)}function sign(kt){return kt>0?1:kt<0?-1:0}function intersectsPolygon(kt,_e){let Dt=kt;do{if(Dt.i!==kt.i&&Dt.next.i!==kt.i&&Dt.i!==_e.i&&Dt.next.i!==_e.i&&intersects(Dt,Dt.next,kt,_e))return!0;Dt=Dt.next}while(Dt!==kt);return!1}function locallyInside(kt,_e){return area$1(kt.prev,kt,kt.next)<0?area$1(kt,_e,kt.next)>=0&&area$1(kt,kt.prev,_e)>=0:area$1(kt,_e,kt.prev)<0||area$1(kt,kt.next,_e)<0}function middleInside(kt,_e){let Dt=kt,Vt=!1;const Gt=(kt.x+_e.x)/2,zt=(kt.y+_e.y)/2;do Dt.y>zt!=Dt.next.y>zt&&Dt.next.y!==Dt.y&&Gt<(Dt.next.x-Dt.x)*(zt-Dt.y)/(Dt.next.y-Dt.y)+Dt.x&&(Vt=!Vt),Dt=Dt.next;while(Dt!==kt);return Vt}function splitPolygon(kt,_e){const Dt=new Node$2(kt.i,kt.x,kt.y),Vt=new Node$2(_e.i,_e.x,_e.y),Gt=kt.next,zt=_e.prev;return kt.next=_e,_e.prev=kt,Dt.next=Gt,Gt.prev=Dt,Vt.next=Dt,Dt.prev=Vt,zt.next=Vt,Vt.prev=zt,Vt}function insertNode(kt,_e,Dt,Vt){const Gt=new Node$2(kt,_e,Dt);return Vt?(Gt.next=Vt.next,Gt.prev=Vt,Vt.next.prev=Gt,Vt.next=Gt):(Gt.prev=Gt,Gt.next=Gt),Gt}function removeNode(kt){kt.next.prev=kt.prev,kt.prev.next=kt.next,kt.prevZ&&(kt.prevZ.nextZ=kt.nextZ),kt.nextZ&&(kt.nextZ.prevZ=kt.prevZ)}function Node$2(kt,_e,Dt){this.i=kt,this.x=_e,this.y=Dt,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(kt,_e,Dt,Vt){let Gt=0;for(let zt=_e,jt=Dt-Vt;zt<Dt;zt+=Vt)Gt+=(kt[jt]-kt[zt])*(kt[zt+1]+kt[jt+1]),jt=zt;return Gt}class ShapeUtils{static area(_e){const Dt=_e.length;let Vt=0;for(let Gt=Dt-1,zt=0;zt<Dt;Gt=zt++)Vt+=_e[Gt].x*_e[zt].y-_e[zt].x*_e[Gt].y;return Vt*.5}static isClockWise(_e){return ShapeUtils.area(_e)<0}static triangulateShape(_e,Dt){const Vt=[],Gt=[],zt=[];removeDupEndPts(_e),addContour(Vt,_e);let jt=_e.length;Dt.forEach(removeDupEndPts);for(let Wt=0;Wt<Dt.length;Wt++)Gt.push(jt),jt+=Dt[Wt].length,addContour(Vt,Dt[Wt]);const Ht=Earcut.triangulate(Vt,Gt);for(let Wt=0;Wt<Ht.length;Wt+=3)zt.push(Ht.slice(Wt,Wt+3));return zt}}function removeDupEndPts(kt){const _e=kt.length;_e>2&&kt[_e-1].equals(kt[0])&&kt.pop()}function addContour(kt,_e){for(let Dt=0;Dt<_e.length;Dt++)kt.push(_e[Dt].x),kt.push(_e[Dt].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)]),Dt={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:_e,options:Dt},_e=Array.isArray(_e)?_e:[_e];const Vt=this,Gt=[],zt=[];for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht];jt(qt)}this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("uv",new Float32BufferAttribute(zt,2)),this.computeVertexNormals();function jt(Ht){const Wt=[],qt=Dt.curveSegments!==void 0?Dt.curveSegments:12,Xt=Dt.steps!==void 0?Dt.steps:1,Kt=Dt.depth!==void 0?Dt.depth:1;let Yt=Dt.bevelEnabled!==void 0?Dt.bevelEnabled:!0,Zt=Dt.bevelThickness!==void 0?Dt.bevelThickness:.2,Jt=Dt.bevelSize!==void 0?Dt.bevelSize:Zt-.1,nn=Dt.bevelOffset!==void 0?Dt.bevelOffset:0,rn=Dt.bevelSegments!==void 0?Dt.bevelSegments:3;const Qt=Dt.extrudePath,en=Dt.UVGenerator!==void 0?Dt.UVGenerator:WorldUVGenerator;let tn,sn=!1,cn,un,hn,dn;Qt&&(tn=Qt.getSpacedPoints(Xt),sn=!0,Yt=!1,cn=Qt.computeFrenetFrames(Xt,!1),un=new Vector3,hn=new Vector3,dn=new Vector3),Yt||(rn=0,Zt=0,Jt=0,nn=0);const pn=Ht.extractPoints(qt);let fn=pn.shape;const mn=pn.holes;if(!ShapeUtils.isClockWise(fn)){fn=fn.reverse();for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];ShapeUtils.isClockWise(sr)&&(mn[ur]=sr.reverse())}}const _n=ShapeUtils.triangulateShape(fn,mn),En=fn;for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];fn=fn.concat(sr)}function An(ur,Hn,sr){return Hn||console.error("THREE.ExtrudeGeometry: vec does not exist"),ur.clone().addScaledVector(Hn,sr)}const Tn=fn.length,Cn=_n.length;function yn(ur,Hn,sr){let vr,fr,Un;const In=ur.x-Hn.x,jn=ur.y-Hn.y,or=sr.x-ur.x,cr=sr.y-ur.y,ar=In*In+jn*jn,gr=In*cr-jn*or;if(Math.abs(gr)>Number.EPSILON){const mr=Math.sqrt(ar),Ar=Math.sqrt(or*or+cr*cr),Lr=Hn.x-jn/mr,Cr=Hn.y+In/mr,Rr=sr.x-cr/Ar,zr=sr.y+or/Ar,Pr=((Rr-Lr)*cr-(zr-Cr)*or)/(In*cr-jn*or);vr=Lr+In*Pr-ur.x,fr=Cr+jn*Pr-ur.y;const Fr=vr*vr+fr*fr;if(Fr<=2)return new Vector2(vr,fr);Un=Math.sqrt(Fr/2)}else{let mr=!1;In>Number.EPSILON?or>Number.EPSILON&&(mr=!0):In<-Number.EPSILON?or<-Number.EPSILON&&(mr=!0):Math.sign(jn)===Math.sign(cr)&&(mr=!0),mr?(vr=-jn,fr=In,Un=Math.sqrt(ar)):(vr=In,fr=jn,Un=Math.sqrt(ar/2))}return new Vector2(vr/Un,fr/Un)}const Sn=[];for(let ur=0,Hn=En.length,sr=Hn-1,vr=ur+1;ur<Hn;ur++,sr++,vr++)sr===Hn&&(sr=0),vr===Hn&&(vr=0),Sn[ur]=yn(En[ur],En[sr],En[vr]);const wn=[];let xn,Rn=Sn.concat();for(let ur=0,Hn=mn.length;ur<Hn;ur++){const sr=mn[ur];xn=[];for(let vr=0,fr=sr.length,Un=fr-1,In=vr+1;vr<fr;vr++,Un++,In++)Un===fr&&(Un=0),In===fr&&(In=0),xn[vr]=yn(sr[vr],sr[Un],sr[In]);wn.push(xn),Rn=Rn.concat(xn)}for(let ur=0;ur<rn;ur++){const Hn=ur/rn,sr=Zt*Math.cos(Hn*Math.PI/2),vr=Jt*Math.sin(Hn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],vr);Bn(In.x,In.y,-sr)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,or=In.length;jn<or;jn++){const cr=An(In[jn],xn[jn],vr);Bn(cr.x,cr.y,-sr)}}}const Dn=Jt+nn;for(let ur=0;ur<Tn;ur++){const Hn=Yt?An(fn[ur],Rn[ur],Dn):fn[ur];sn?(hn.copy(cn.normals[0]).multiplyScalar(Hn.x),un.copy(cn.binormals[0]).multiplyScalar(Hn.y),dn.copy(tn[0]).add(hn).add(un),Bn(dn.x,dn.y,dn.z)):Bn(Hn.x,Hn.y,0)}for(let ur=1;ur<=Xt;ur++)for(let Hn=0;Hn<Tn;Hn++){const sr=Yt?An(fn[Hn],Rn[Hn],Dn):fn[Hn];sn?(hn.copy(cn.normals[ur]).multiplyScalar(sr.x),un.copy(cn.binormals[ur]).multiplyScalar(sr.y),dn.copy(tn[ur]).add(hn).add(un),Bn(dn.x,dn.y,dn.z)):Bn(sr.x,sr.y,Kt/Xt*ur)}for(let ur=rn-1;ur>=0;ur--){const Hn=ur/rn,sr=Zt*Math.cos(Hn*Math.PI/2),vr=Jt*Math.sin(Hn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],vr);Bn(In.x,In.y,Kt+sr)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,or=In.length;jn<or;jn++){const cr=An(In[jn],xn[jn],vr);sn?Bn(cr.x,cr.y+tn[Xt-1].y,tn[Xt-1].x+sr):Bn(cr.x,cr.y,Kt+sr)}}}kn(),Fn();function kn(){const ur=Gt.length/3;if(Yt){let Hn=0,sr=Tn*Hn;for(let vr=0;vr<Cn;vr++){const fr=_n[vr];qn(fr[2]+sr,fr[1]+sr,fr[0]+sr)}Hn=Xt+rn*2,sr=Tn*Hn;for(let vr=0;vr<Cn;vr++){const fr=_n[vr];qn(fr[0]+sr,fr[1]+sr,fr[2]+sr)}}else{for(let Hn=0;Hn<Cn;Hn++){const sr=_n[Hn];qn(sr[2],sr[1],sr[0])}for(let Hn=0;Hn<Cn;Hn++){const sr=_n[Hn];qn(sr[0]+Tn*Xt,sr[1]+Tn*Xt,sr[2]+Tn*Xt)}}Vt.addGroup(ur,Gt.length/3-ur,0)}function Fn(){const ur=Gt.length/3;let Hn=0;Pn(En,Hn),Hn+=En.length;for(let sr=0,vr=mn.length;sr<vr;sr++){const fr=mn[sr];Pn(fr,Hn),Hn+=fr.length}Vt.addGroup(ur,Gt.length/3-ur,1)}function Pn(ur,Hn){let sr=ur.length;for(;--sr>=0;){const vr=sr;let fr=sr-1;fr<0&&(fr=ur.length-1);for(let Un=0,In=Xt+rn*2;Un<In;Un++){const jn=Tn*Un,or=Tn*(Un+1),cr=Hn+vr+jn,ar=Hn+fr+jn,gr=Hn+fr+or,mr=Hn+vr+or;tr(cr,ar,gr,mr)}}}function Bn(ur,Hn,sr){Wt.push(ur),Wt.push(Hn),Wt.push(sr)}function qn(ur,Hn,sr){lr(ur),lr(Hn),lr(sr);const vr=Gt.length/3,fr=en.generateTopUV(Vt,Gt,vr-3,vr-2,vr-1);zn(fr[0]),zn(fr[1]),zn(fr[2])}function tr(ur,Hn,sr,vr){lr(ur),lr(Hn),lr(vr),lr(Hn),lr(sr),lr(vr);const fr=Gt.length/3,Un=en.generateSideWallUV(Vt,Gt,fr-6,fr-3,fr-2,fr-1);zn(Un[0]),zn(Un[1]),zn(Un[3]),zn(Un[1]),zn(Un[2]),zn(Un[3])}function lr(ur){Gt.push(Wt[ur*3+0]),Gt.push(Wt[ur*3+1]),Gt.push(Wt[ur*3+2])}function zn(ur){zt.push(ur.x),zt.push(ur.y)}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes,Vt=this.parameters.options;return toJSON$1(Dt,Vt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let zt=0,jt=_e.shapes.length;zt<jt;zt++){const Ht=Dt[_e.shapes[zt]];Vt.push(Ht)}const Gt=_e.options.extrudePath;return Gt!==void 0&&(_e.options.extrudePath=new Curves[Gt.type]().fromJSON(Gt)),new ExtrudeGeometry(Vt,_e.options)}}const WorldUVGenerator={generateTopUV:function(kt,_e,Dt,Vt,Gt){const zt=_e[Dt*3],jt=_e[Dt*3+1],Ht=_e[Vt*3],Wt=_e[Vt*3+1],qt=_e[Gt*3],Xt=_e[Gt*3+1];return[new Vector2(zt,jt),new Vector2(Ht,Wt),new Vector2(qt,Xt)]},generateSideWallUV:function(kt,_e,Dt,Vt,Gt,zt){const jt=_e[Dt*3],Ht=_e[Dt*3+1],Wt=_e[Dt*3+2],qt=_e[Vt*3],Xt=_e[Vt*3+1],Kt=_e[Vt*3+2],Yt=_e[Gt*3],Zt=_e[Gt*3+1],Jt=_e[Gt*3+2],nn=_e[zt*3],rn=_e[zt*3+1],Qt=_e[zt*3+2];return Math.abs(Ht-Xt)<Math.abs(jt-qt)?[new Vector2(jt,1-Wt),new Vector2(qt,1-Kt),new Vector2(Yt,1-Jt),new Vector2(nn,1-Qt)]:[new Vector2(Ht,1-Wt),new Vector2(Xt,1-Kt),new Vector2(Zt,1-Jt),new Vector2(rn,1-Qt)]}};function toJSON$1(kt,_e,Dt){if(Dt.shapes=[],Array.isArray(kt))for(let Vt=0,Gt=kt.length;Vt<Gt;Vt++){const zt=kt[Vt];Dt.shapes.push(zt.uuid)}else Dt.shapes.push(kt.uuid);return Dt.options=Object.assign({},_e),_e.extrudePath!==void 0&&(Dt.options.extrudePath=_e.extrudePath.toJSON()),Dt}class IcosahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=[-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,0,0,-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,Vt,0,-1,Vt,0,1,-Vt,0,-1,-Vt,0,1],zt=[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(Gt,zt,_e,Dt),this.type="IcosahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new IcosahedronGeometry(_e.radius,_e.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Gt=[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(Vt,Gt,_e,Dt),this.type="OctahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new OctahedronGeometry(_e.radius,_e.detail)}}class RingGeometry extends BufferGeometry{constructor(_e=.5,Dt=1,Vt=32,Gt=1,zt=0,jt=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:_e,outerRadius:Dt,thetaSegments:Vt,phiSegments:Gt,thetaStart:zt,thetaLength:jt},Vt=Math.max(3,Vt),Gt=Math.max(1,Gt);const Ht=[],Wt=[],qt=[],Xt=[];let Kt=_e;const Yt=(Dt-_e)/Gt,Zt=new Vector3,Jt=new Vector2;for(let nn=0;nn<=Gt;nn++){for(let rn=0;rn<=Vt;rn++){const Qt=zt+rn/Vt*jt;Zt.x=Kt*Math.cos(Qt),Zt.y=Kt*Math.sin(Qt),Wt.push(Zt.x,Zt.y,Zt.z),qt.push(0,0,1),Jt.x=(Zt.x/Dt+1)/2,Jt.y=(Zt.y/Dt+1)/2,Xt.push(Jt.x,Jt.y)}Kt+=Yt}for(let nn=0;nn<Gt;nn++){const rn=nn*(Vt+1);for(let Qt=0;Qt<Vt;Qt++){const en=Qt+rn,tn=en,sn=en+Vt+1,cn=en+Vt+2,un=en+1;Ht.push(tn,sn,un),Ht.push(sn,cn,un)}}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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)]),Dt=12){super(),this.type="ShapeGeometry",this.parameters={shapes:_e,curveSegments:Dt};const Vt=[],Gt=[],zt=[],jt=[];let Ht=0,Wt=0;if(Array.isArray(_e)===!1)qt(_e);else for(let Xt=0;Xt<_e.length;Xt++)qt(_e[Xt]),this.addGroup(Ht,Wt,Xt),Ht+=Wt,Wt=0;this.setIndex(Vt),this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt,3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2));function qt(Xt){const Kt=Gt.length/3,Yt=Xt.extractPoints(Dt);let Zt=Yt.shape;const Jt=Yt.holes;ShapeUtils.isClockWise(Zt)===!1&&(Zt=Zt.reverse());for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];ShapeUtils.isClockWise(en)===!0&&(Jt[rn]=en.reverse())}const nn=ShapeUtils.triangulateShape(Zt,Jt);for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];Zt=Zt.concat(en)}for(let rn=0,Qt=Zt.length;rn<Qt;rn++){const en=Zt[rn];Gt.push(en.x,en.y,0),zt.push(0,0,1),jt.push(en.x,en.y)}for(let rn=0,Qt=nn.length;rn<Qt;rn++){const en=nn[rn],tn=en[0]+Kt,sn=en[1]+Kt,cn=en[2]+Kt;Vt.push(tn,sn,cn),Wt+=3}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes;return toJSON(Dt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let Gt=0,zt=_e.shapes.length;Gt<zt;Gt++){const jt=Dt[_e.shapes[Gt]];Vt.push(jt)}return new ShapeGeometry(Vt,_e.curveSegments)}}function toJSON(kt,_e){if(_e.shapes=[],Array.isArray(kt))for(let Dt=0,Vt=kt.length;Dt<Vt;Dt++){const Gt=kt[Dt];_e.shapes.push(Gt.uuid)}else _e.shapes.push(kt.uuid);return _e}class SphereGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=16,Gt=0,zt=Math.PI*2,jt=0,Ht=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:_e,widthSegments:Dt,heightSegments:Vt,phiStart:Gt,phiLength:zt,thetaStart:jt,thetaLength:Ht},Dt=Math.max(3,Math.floor(Dt)),Vt=Math.max(2,Math.floor(Vt));const Wt=Math.min(jt+Ht,Math.PI);let qt=0;const Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=[],Jt=[],nn=[],rn=[];for(let Qt=0;Qt<=Vt;Qt++){const en=[],tn=Qt/Vt;let sn=0;Qt===0&&jt===0?sn=.5/Dt:Qt===Vt&&Wt===Math.PI&&(sn=-.5/Dt);for(let cn=0;cn<=Dt;cn++){const un=cn/Dt;Kt.x=-_e*Math.cos(Gt+un*zt)*Math.sin(jt+tn*Ht),Kt.y=_e*Math.cos(jt+tn*Ht),Kt.z=_e*Math.sin(Gt+un*zt)*Math.sin(jt+tn*Ht),Jt.push(Kt.x,Kt.y,Kt.z),Yt.copy(Kt).normalize(),nn.push(Yt.x,Yt.y,Yt.z),rn.push(un+sn,1-tn),en.push(qt++)}Xt.push(en)}for(let Qt=0;Qt<Vt;Qt++)for(let en=0;en<Dt;en++){const tn=Xt[Qt][en+1],sn=Xt[Qt][en],cn=Xt[Qt+1][en],un=Xt[Qt+1][en+1];(Qt!==0||jt>0)&&Zt.push(tn,sn,un),(Qt!==Vt-1||Wt<Math.PI)&&Zt.push(sn,cn,un)}this.setIndex(Zt),this.setAttribute("position",new Float32BufferAttribute(Jt,3)),this.setAttribute("normal",new Float32BufferAttribute(nn,3)),this.setAttribute("uv",new Float32BufferAttribute(rn,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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,Dt=0){const Vt=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Gt=[2,1,0,0,3,2,1,3,0,2,3,1];super(Vt,Gt,_e,Dt),this.type="TetrahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new TetrahedronGeometry(_e.radius,_e.detail)}}class TorusGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=12,Gt=48,zt=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:_e,tube:Dt,radialSegments:Vt,tubularSegments:Gt,arc:zt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const jt=[],Ht=[],Wt=[],qt=[],Xt=new Vector3,Kt=new Vector3,Yt=new Vector3;for(let Zt=0;Zt<=Vt;Zt++)for(let Jt=0;Jt<=Gt;Jt++){const nn=Jt/Gt*zt,rn=Zt/Vt*Math.PI*2;Kt.x=(_e+Dt*Math.cos(rn))*Math.cos(nn),Kt.y=(_e+Dt*Math.cos(rn))*Math.sin(nn),Kt.z=Dt*Math.sin(rn),Ht.push(Kt.x,Kt.y,Kt.z),Xt.x=_e*Math.cos(nn),Xt.y=_e*Math.sin(nn),Yt.subVectors(Kt,Xt).normalize(),Wt.push(Yt.x,Yt.y,Yt.z),qt.push(Jt/Gt),qt.push(Zt/Vt)}for(let Zt=1;Zt<=Vt;Zt++)for(let Jt=1;Jt<=Gt;Jt++){const nn=(Gt+1)*Zt+Jt-1,rn=(Gt+1)*(Zt-1)+Jt-1,Qt=(Gt+1)*(Zt-1)+Jt,en=(Gt+1)*Zt+Jt;jt.push(nn,rn,en),jt.push(rn,Qt,en)}this.setIndex(jt),this.setAttribute("position",new Float32BufferAttribute(Ht,3)),this.setAttribute("normal",new Float32BufferAttribute(Wt,3)),this.setAttribute("uv",new Float32BufferAttribute(qt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusGeometry(_e.radius,_e.tube,_e.radialSegments,_e.tubularSegments,_e.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=64,Gt=8,zt=2,jt=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:_e,tube:Dt,tubularSegments:Vt,radialSegments:Gt,p:zt,q:jt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const Ht=[],Wt=[],qt=[],Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=new Vector3,Jt=new Vector3,nn=new Vector3,rn=new Vector3,Qt=new Vector3;for(let tn=0;tn<=Vt;++tn){const sn=tn/Vt*zt*Math.PI*2;en(sn,zt,jt,_e,Zt),en(sn+.01,zt,jt,_e,Jt),rn.subVectors(Jt,Zt),Qt.addVectors(Jt,Zt),nn.crossVectors(rn,Qt),Qt.crossVectors(nn,rn),nn.normalize(),Qt.normalize();for(let cn=0;cn<=Gt;++cn){const un=cn/Gt*Math.PI*2,hn=-Dt*Math.cos(un),dn=Dt*Math.sin(un);Kt.x=Zt.x+(hn*Qt.x+dn*nn.x),Kt.y=Zt.y+(hn*Qt.y+dn*nn.y),Kt.z=Zt.z+(hn*Qt.z+dn*nn.z),Wt.push(Kt.x,Kt.y,Kt.z),Yt.subVectors(Kt,Zt).normalize(),qt.push(Yt.x,Yt.y,Yt.z),Xt.push(tn/Vt),Xt.push(cn/Gt)}}for(let tn=1;tn<=Vt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,dn=(Gt+1)*(tn-1)+sn;Ht.push(cn,un,dn),Ht.push(un,hn,dn)}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2));function en(tn,sn,cn,un,hn){const dn=Math.cos(tn),pn=Math.sin(tn),fn=cn/sn*tn,mn=Math.cos(fn);hn.x=un*(2+mn)*.5*dn,hn.y=un*(2+mn)*pn*.5,hn.z=un*Math.sin(fn)*.5}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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)),Dt=64,Vt=1,Gt=8,zt=!1){super(),this.type="TubeGeometry",this.parameters={path:_e,tubularSegments:Dt,radius:Vt,radialSegments:Gt,closed:zt};const jt=_e.computeFrenetFrames(Dt,zt);this.tangents=jt.tangents,this.normals=jt.normals,this.binormals=jt.binormals;const Ht=new Vector3,Wt=new Vector3,qt=new Vector2;let Xt=new Vector3;const Kt=[],Yt=[],Zt=[],Jt=[];nn(),this.setIndex(Jt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function nn(){for(let tn=0;tn<Dt;tn++)rn(tn);rn(zt===!1?Dt:0),en(),Qt()}function rn(tn){Xt=_e.getPointAt(tn/Dt,Xt);const sn=jt.normals[tn],cn=jt.binormals[tn];for(let un=0;un<=Gt;un++){const hn=un/Gt*Math.PI*2,dn=Math.sin(hn),pn=-Math.cos(hn);Wt.x=pn*sn.x+dn*cn.x,Wt.y=pn*sn.y+dn*cn.y,Wt.z=pn*sn.z+dn*cn.z,Wt.normalize(),Yt.push(Wt.x,Wt.y,Wt.z),Ht.x=Xt.x+Vt*Wt.x,Ht.y=Xt.y+Vt*Wt.y,Ht.z=Xt.z+Vt*Wt.z,Kt.push(Ht.x,Ht.y,Ht.z)}}function Qt(){for(let tn=1;tn<=Dt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,dn=(Gt+1)*(tn-1)+sn;Jt.push(cn,un,dn),Jt.push(un,hn,dn)}}function en(){for(let tn=0;tn<=Dt;tn++)for(let sn=0;sn<=Gt;sn++)qt.x=tn/Dt,qt.y=sn/Gt,Zt.push(qt.x,qt.y)}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}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 Dt=[],Vt=new Set,Gt=new Vector3,zt=new Vector3;if(_e.index!==null){const jt=_e.attributes.position,Ht=_e.index;let Wt=_e.groups;Wt.length===0&&(Wt=[{start:0,count:Ht.count,materialIndex:0}]);for(let qt=0,Xt=Wt.length;qt<Xt;++qt){const Kt=Wt[qt],Yt=Kt.start,Zt=Kt.count;for(let Jt=Yt,nn=Yt+Zt;Jt<nn;Jt+=3)for(let rn=0;rn<3;rn++){const Qt=Ht.getX(Jt+rn),en=Ht.getX(Jt+(rn+1)%3);Gt.fromBufferAttribute(jt,Qt),zt.fromBufferAttribute(jt,en),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}}else{const jt=_e.attributes.position;for(let Ht=0,Wt=jt.count/3;Ht<Wt;Ht++)for(let qt=0;qt<3;qt++){const Xt=3*Ht+qt,Kt=3*Ht+(qt+1)%3;Gt.fromBufferAttribute(jt,Xt),zt.fromBufferAttribute(jt,Kt),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}this.setAttribute("position",new Float32BufferAttribute(Dt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}function isUniqueEdge(kt,_e,Dt){const Vt=`${kt.x},${kt.y},${kt.z}-${_e.x},${_e.y},${_e.z}`,Gt=`${_e.x},${_e.y},${_e.z}-${kt.x},${kt.y},${kt.z}`;return Dt.has(Vt)===!0||Dt.has(Gt)===!0?!1:(Dt.add(Vt),Dt.add(Gt),!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$1(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$1(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$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),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.anisotropyRotation=0,this.anisotropyMap=null,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(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Dt){this.ior=(1+.4*Dt)/(1-.4*Dt)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color$1(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,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color$1(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(_e)}get anisotropy(){return this._anisotropy}set anisotropy(_e){this._anisotropy>0!=_e>0&&this.version++,this._anisotropy=_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 sheen(){return this._sheen}set sheen(_e){this._sheen>0!=_e>0&&this.version++,this._sheen=_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.anisotropy=_e.anisotropy,this.anisotropyRotation=_e.anisotropyRotation,this.anisotropyMap=_e.anisotropyMap,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$1(16777215),this.specular=new Color$1(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),this.combine=_e.combine,this.reflectivity=_e.reflectivity,this.refractionRatio=_e.refractionRatio,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.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$1(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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$1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(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.envMapRotation=new Euler,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.envMapRotation.copy(_e.envMapRotation),this.combine=_e.combine,this.reflectivity=_e.reflectivity,this.refractionRatio=_e.refractionRatio,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.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$1(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 convertArray(kt,_e,Dt){return!kt||!Dt&&kt.constructor===_e?kt:typeof _e.BYTES_PER_ELEMENT=="number"?new _e(kt):Array.prototype.slice.call(kt)}function isTypedArray(kt){return ArrayBuffer.isView(kt)&&!(kt instanceof DataView)}function getKeyframeOrder(kt){function _e(Gt,zt){return kt[Gt]-kt[zt]}const Dt=kt.length,Vt=new Array(Dt);for(let Gt=0;Gt!==Dt;++Gt)Vt[Gt]=Gt;return Vt.sort(_e),Vt}function sortedArray(kt,_e,Dt){const Vt=kt.length,Gt=new kt.constructor(Vt);for(let zt=0,jt=0;jt!==Vt;++zt){const Ht=Dt[zt]*_e;for(let Wt=0;Wt!==_e;++Wt)Gt[jt++]=kt[Ht+Wt]}return Gt}function flattenJSON(kt,_e,Dt,Vt){let Gt=1,zt=kt[0];for(;zt!==void 0&&zt[Vt]===void 0;)zt=kt[Gt++];if(zt===void 0)return;let jt=zt[Vt];if(jt!==void 0)if(Array.isArray(jt))do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push.apply(Dt,jt)),zt=kt[Gt++];while(zt!==void 0);else if(jt.toArray!==void 0)do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),jt.toArray(Dt,Dt.length)),zt=kt[Gt++];while(zt!==void 0);else do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push(jt)),zt=kt[Gt++];while(zt!==void 0)}function subclip(kt,_e,Dt,Vt,Gt=30){const zt=kt.clone();zt.name=_e;const jt=[];for(let Wt=0;Wt<zt.tracks.length;++Wt){const qt=zt.tracks[Wt],Xt=qt.getValueSize(),Kt=[],Yt=[];for(let Zt=0;Zt<qt.times.length;++Zt){const Jt=qt.times[Zt]*Gt;if(!(Jt<Dt||Jt>=Vt)){Kt.push(qt.times[Zt]);for(let nn=0;nn<Xt;++nn)Yt.push(qt.values[Zt*Xt+nn])}}Kt.length!==0&&(qt.times=convertArray(Kt,qt.times.constructor),qt.values=convertArray(Yt,qt.values.constructor),jt.push(qt))}zt.tracks=jt;let Ht=1/0;for(let Wt=0;Wt<zt.tracks.length;++Wt)Ht>zt.tracks[Wt].times[0]&&(Ht=zt.tracks[Wt].times[0]);for(let Wt=0;Wt<zt.tracks.length;++Wt)zt.tracks[Wt].shift(-1*Ht);return zt.resetDuration(),zt}function makeClipAdditive(kt,_e=0,Dt=kt,Vt=30){Vt<=0&&(Vt=30);const Gt=Dt.tracks.length,zt=_e/Vt;for(let jt=0;jt<Gt;++jt){const Ht=Dt.tracks[jt],Wt=Ht.ValueTypeName;if(Wt==="bool"||Wt==="string")continue;const qt=kt.tracks.find(function(Qt){return Qt.name===Ht.name&&Qt.ValueTypeName===Wt});if(qt===void 0)continue;let Xt=0;const Kt=Ht.getValueSize();Ht.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Xt=Kt/3);let Yt=0;const Zt=qt.getValueSize();qt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Yt=Zt/3);const Jt=Ht.times.length-1;let nn;if(zt<=Ht.times[0]){const Qt=Xt,en=Kt-Xt;nn=Ht.values.slice(Qt,en)}else if(zt>=Ht.times[Jt]){const Qt=Jt*Kt+Xt,en=Qt+Kt-Xt;nn=Ht.values.slice(Qt,en)}else{const Qt=Ht.createInterpolant(),en=Xt,tn=Kt-Xt;Qt.evaluate(zt),nn=Qt.resultBuffer.slice(en,tn)}Wt==="quaternion"&&new Quaternion().fromArray(nn).normalize().conjugate().toArray(nn);const rn=qt.times.length;for(let Qt=0;Qt<rn;++Qt){const en=Qt*Zt+Yt;if(Wt==="quaternion")Quaternion.multiplyQuaternionsFlat(qt.values,en,nn,0,qt.values,en);else{const tn=Zt-Yt*2;for(let sn=0;sn<tn;++sn)qt.values[en+sn]-=nn[sn]}}}return kt.blendMode=AdditiveAnimationBlendMode,kt}const AnimationUtils={convertArray,isTypedArray,getKeyframeOrder,sortedArray,flattenJSON,subclip,makeClipAdditive};class Interpolant{constructor(_e,Dt,Vt,Gt){this.parameterPositions=_e,this._cachedIndex=0,this.resultBuffer=Gt!==void 0?Gt:new Dt.constructor(Vt),this.sampleValues=Dt,this.valueSize=Vt,this.settings=null,this.DefaultSettings_={}}evaluate(_e){const Dt=this.parameterPositions;let Vt=this._cachedIndex,Gt=Dt[Vt],zt=Dt[Vt-1];e:{t:{let jt;n:{r:if(!(_e<Gt)){for(let Ht=Vt+2;;){if(Gt===void 0){if(_e<zt)break r;return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}if(Vt===Ht)break;if(zt=Gt,Gt=Dt[++Vt],_e<Gt)break t}jt=Dt.length;break n}if(!(_e>=zt)){const Ht=Dt[1];_e<Ht&&(Vt=2,zt=Ht);for(let Wt=Vt-2;;){if(zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Vt===Wt)break;if(Gt=zt,zt=Dt[--Vt-1],_e>=zt)break t}jt=Vt,Vt=0;break n}break e}for(;Vt<jt;){const Ht=Vt+jt>>>1;_e<Dt[Ht]?jt=Ht:Vt=Ht+1}if(Gt=Dt[Vt],zt=Dt[Vt-1],zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Gt===void 0)return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}this._cachedIndex=Vt,this.intervalChanged_(Vt,zt,Gt)}return this.interpolate_(Vt,zt,_e,Gt)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(_e){const Dt=this.resultBuffer,Vt=this.sampleValues,Gt=this.valueSize,zt=_e*Gt;for(let jt=0;jt!==Gt;++jt)Dt[jt]=Vt[zt+jt];return Dt}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding}}intervalChanged_(_e,Dt,Vt){const Gt=this.parameterPositions;let zt=_e-2,jt=_e+1,Ht=Gt[zt],Wt=Gt[jt];if(Ht===void 0)switch(this.getSettings_().endingStart){case ZeroSlopeEnding:zt=_e,Ht=2*Dt-Vt;break;case WrapAroundEnding:zt=Gt.length-2,Ht=Dt+Gt[zt]-Gt[zt+1];break;default:zt=_e,Ht=Vt}if(Wt===void 0)switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:jt=_e,Wt=2*Vt-Dt;break;case WrapAroundEnding:jt=1,Wt=Vt+Gt[1]-Gt[0];break;default:jt=_e-1,Wt=Dt}const qt=(Vt-Dt)*.5,Xt=this.valueSize;this._weightPrev=qt/(Dt-Ht),this._weightNext=qt/(Wt-Vt),this._offsetPrev=zt*Xt,this._offsetNext=jt*Xt}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=this._offsetPrev,Kt=this._offsetNext,Yt=this._weightPrev,Zt=this._weightNext,Jt=(Vt-Dt)/(Gt-Dt),nn=Jt*Jt,rn=nn*Jt,Qt=-Yt*rn+2*Yt*nn-Yt*Jt,en=(1+Yt)*rn+(-1.5-2*Yt)*nn+(-.5+Yt)*Jt+1,tn=(-1-Zt)*rn+(1.5+Zt)*nn+.5*Jt,sn=Zt*rn-Zt*nn;for(let cn=0;cn!==Ht;++cn)zt[cn]=Qt*jt[Xt+cn]+en*jt[qt+cn]+tn*jt[Wt+cn]+sn*jt[Kt+cn];return zt}}class LinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=(Vt-Dt)/(Gt-Dt),Kt=1-Xt;for(let Yt=0;Yt!==Ht;++Yt)zt[Yt]=jt[qt+Yt]*Kt+jt[Wt+Yt]*Xt;return zt}}class DiscreteInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e){return this.copySampleValue_(_e-1)}}class KeyframeTrack{constructor(_e,Dt,Vt,Gt){if(_e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(Dt===void 0||Dt.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+_e);this.name=_e,this.times=convertArray(Dt,this.TimeBufferType),this.values=convertArray(Vt,this.ValueBufferType),this.setInterpolation(Gt||this.DefaultInterpolation)}static toJSON(_e){const Dt=_e.constructor;let Vt;if(Dt.toJSON!==this.toJSON)Vt=Dt.toJSON(_e);else{Vt={name:_e.name,times:convertArray(_e.times,Array),values:convertArray(_e.values,Array)};const Gt=_e.getInterpolation();Gt!==_e.DefaultInterpolation&&(Vt.interpolation=Gt)}return Vt.type=_e.ValueTypeName,Vt}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 Dt;switch(_e){case InterpolateDiscrete:Dt=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:Dt=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:Dt=this.InterpolantFactoryMethodSmooth;break}if(Dt===void 0){const Vt="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(Vt);return console.warn("THREE.KeyframeTrack:",Vt),this}return this.createInterpolant=Dt,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 Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]+=_e}return this}scale(_e){if(_e!==1){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]*=_e}return this}trim(_e,Dt){const Vt=this.times,Gt=Vt.length;let zt=0,jt=Gt-1;for(;zt!==Gt&&Vt[zt]<_e;)++zt;for(;jt!==-1&&Vt[jt]>Dt;)--jt;if(++jt,zt!==0||jt!==Gt){zt>=jt&&(jt=Math.max(jt,1),zt=jt-1);const Ht=this.getValueSize();this.times=Vt.slice(zt,jt),this.values=this.values.slice(zt*Ht,jt*Ht)}return this}validate(){let _e=!0;const Dt=this.getValueSize();Dt-Math.floor(Dt)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),_e=!1);const Vt=this.times,Gt=this.values,zt=Vt.length;zt===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),_e=!1);let jt=null;for(let Ht=0;Ht!==zt;Ht++){const Wt=Vt[Ht];if(typeof Wt=="number"&&isNaN(Wt)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Ht,Wt),_e=!1;break}if(jt!==null&&jt>Wt){console.error("THREE.KeyframeTrack: Out of order keys.",this,Ht,Wt,jt),_e=!1;break}jt=Wt}if(Gt!==void 0&&isTypedArray(Gt))for(let Ht=0,Wt=Gt.length;Ht!==Wt;++Ht){const qt=Gt[Ht];if(isNaN(qt)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Ht,qt),_e=!1;break}}return _e}optimize(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.getValueSize(),Gt=this.getInterpolation()===InterpolateSmooth,zt=_e.length-1;let jt=1;for(let Ht=1;Ht<zt;++Ht){let Wt=!1;const qt=_e[Ht],Xt=_e[Ht+1];if(qt!==Xt&&(Ht!==1||qt!==_e[0]))if(Gt)Wt=!0;else{const Kt=Ht*Vt,Yt=Kt-Vt,Zt=Kt+Vt;for(let Jt=0;Jt!==Vt;++Jt){const nn=Dt[Kt+Jt];if(nn!==Dt[Yt+Jt]||nn!==Dt[Zt+Jt]){Wt=!0;break}}}if(Wt){if(Ht!==jt){_e[jt]=_e[Ht];const Kt=Ht*Vt,Yt=jt*Vt;for(let Zt=0;Zt!==Vt;++Zt)Dt[Yt+Zt]=Dt[Kt+Zt]}++jt}}if(zt>0){_e[jt]=_e[zt];for(let Ht=zt*Vt,Wt=jt*Vt,qt=0;qt!==Vt;++qt)Dt[Wt+qt]=Dt[Ht+qt];++jt}return jt!==_e.length?(this.times=_e.slice(0,jt),this.values=Dt.slice(0,jt*Vt)):(this.times=_e,this.values=Dt),this}clone(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.constructor,Gt=new Vt(this.name,_e,Dt);return Gt.createInterpolant=this.createInterpolant,Gt}}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,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=(Vt-Dt)/(Gt-Dt);let qt=_e*Ht;for(let Xt=qt+Ht;qt!==Xt;qt+=4)Quaternion.slerpFlat(zt,0,jt,qt-Ht,jt,qt,Wt);return zt}}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="",Dt=-1,Vt=[],Gt=NormalAnimationBlendMode){this.name=_e,this.tracks=Vt,this.duration=Dt,this.blendMode=Gt,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(_e){const Dt=[],Vt=_e.tracks,Gt=1/(_e.fps||1);for(let jt=0,Ht=Vt.length;jt!==Ht;++jt)Dt.push(parseKeyframeTrack(Vt[jt]).scale(Gt));const zt=new this(_e.name,_e.duration,Dt,_e.blendMode);return zt.uuid=_e.uuid,zt}static toJSON(_e){const Dt=[],Vt=_e.tracks,Gt={name:_e.name,duration:_e.duration,tracks:Dt,uuid:_e.uuid,blendMode:_e.blendMode};for(let zt=0,jt=Vt.length;zt!==jt;++zt)Dt.push(KeyframeTrack.toJSON(Vt[zt]));return Gt}static CreateFromMorphTargetSequence(_e,Dt,Vt,Gt){const zt=Dt.length,jt=[];for(let Ht=0;Ht<zt;Ht++){let Wt=[],qt=[];Wt.push((Ht+zt-1)%zt,Ht,(Ht+1)%zt),qt.push(0,1,0);const Xt=getKeyframeOrder(Wt);Wt=sortedArray(Wt,1,Xt),qt=sortedArray(qt,1,Xt),!Gt&&Wt[0]===0&&(Wt.push(zt),qt.push(qt[0])),jt.push(new NumberKeyframeTrack(".morphTargetInfluences["+Dt[Ht].name+"]",Wt,qt).scale(1/Vt))}return new this(_e,-1,jt)}static findByName(_e,Dt){let Vt=_e;if(!Array.isArray(_e)){const Gt=_e;Vt=Gt.geometry&&Gt.geometry.animations||Gt.animations}for(let Gt=0;Gt<Vt.length;Gt++)if(Vt[Gt].name===Dt)return Vt[Gt];return null}static CreateClipsFromMorphTargetSequences(_e,Dt,Vt){const Gt={},zt=/^([\w-]*?)([\d]+)$/;for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht],Xt=qt.name.match(zt);if(Xt&&Xt.length>1){const Kt=Xt[1];let Yt=Gt[Kt];Yt||(Gt[Kt]=Yt=[]),Yt.push(qt)}}const jt=[];for(const Ht in Gt)jt.push(this.CreateFromMorphTargetSequence(Ht,Gt[Ht],Dt,Vt));return jt}static parseAnimation(_e,Dt){if(!_e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const Vt=function(Kt,Yt,Zt,Jt,nn){if(Zt.length!==0){const rn=[],Qt=[];flattenJSON(Zt,rn,Qt,Jt),rn.length!==0&&nn.push(new Kt(Yt,rn,Qt))}},Gt=[],zt=_e.name||"default",jt=_e.fps||30,Ht=_e.blendMode;let Wt=_e.length||-1;const qt=_e.hierarchy||[];for(let Kt=0;Kt<qt.length;Kt++){const Yt=qt[Kt].keys;if(!(!Yt||Yt.length===0))if(Yt[0].morphTargets){const Zt={};let Jt;for(Jt=0;Jt<Yt.length;Jt++)if(Yt[Jt].morphTargets)for(let nn=0;nn<Yt[Jt].morphTargets.length;nn++)Zt[Yt[Jt].morphTargets[nn]]=-1;for(const nn in Zt){const rn=[],Qt=[];for(let en=0;en!==Yt[Jt].morphTargets.length;++en){const tn=Yt[Jt];rn.push(tn.time),Qt.push(tn.morphTarget===nn?1:0)}Gt.push(new NumberKeyframeTrack(".morphTargetInfluence["+nn+"]",rn,Qt))}Wt=Zt.length*jt}else{const Zt=".bones["+Dt[Kt].name+"]";Vt(VectorKeyframeTrack,Zt+".position",Yt,"pos",Gt),Vt(QuaternionKeyframeTrack,Zt+".quaternion",Yt,"rot",Gt),Vt(VectorKeyframeTrack,Zt+".scale",Yt,"scl",Gt)}}return Gt.length===0?null:new this(zt,Wt,Gt,Ht)}resetDuration(){const _e=this.tracks;let Dt=0;for(let Vt=0,Gt=_e.length;Vt!==Gt;++Vt){const zt=this.tracks[Vt];Dt=Math.max(Dt,zt.times[zt.times.length-1])}return this.duration=Dt,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 Dt=0;Dt<this.tracks.length;Dt++)_e=_e&&this.tracks[Dt].validate();return _e}optimize(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].optimize();return this}clone(){const _e=[];for(let Dt=0;Dt<this.tracks.length;Dt++)_e.push(this.tracks[Dt].clone());return new this.constructor(this.name,this.duration,_e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function getTrackTypeForValueTypeName(kt){switch(kt.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: "+kt)}function parseKeyframeTrack(kt){if(kt.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const _e=getTrackTypeForValueTypeName(kt.type);if(kt.times===void 0){const Dt=[],Vt=[];flattenJSON(kt.keys,Dt,Vt,"value"),kt.times=Dt,kt.values=Vt}return _e.parse!==void 0?_e.parse(kt):new _e(kt.name,kt.times,kt.values,kt.interpolation)}const Cache={enabled:!1,files:{},add:function(kt,_e){this.enabled!==!1&&(this.files[kt]=_e)},get:function(kt){if(this.enabled!==!1)return this.files[kt]},remove:function(kt){delete this.files[kt]},clear:function(){this.files={}}};class LoadingManager{constructor(_e,Dt,Vt){const Gt=this;let zt=!1,jt=0,Ht=0,Wt;const qt=[];this.onStart=void 0,this.onLoad=_e,this.onProgress=Dt,this.onError=Vt,this.itemStart=function(Xt){Ht++,zt===!1&&Gt.onStart!==void 0&&Gt.onStart(Xt,jt,Ht),zt=!0},this.itemEnd=function(Xt){jt++,Gt.onProgress!==void 0&&Gt.onProgress(Xt,jt,Ht),jt===Ht&&(zt=!1,Gt.onLoad!==void 0&&Gt.onLoad())},this.itemError=function(Xt){Gt.onError!==void 0&&Gt.onError(Xt)},this.resolveURL=function(Xt){return Wt?Wt(Xt):Xt},this.setURLModifier=function(Xt){return Wt=Xt,this},this.addHandler=function(Xt,Kt){return qt.push(Xt,Kt),this},this.removeHandler=function(Xt){const Kt=qt.indexOf(Xt);return Kt!==-1&&qt.splice(Kt,2),this},this.getHandler=function(Xt){for(let Kt=0,Yt=qt.length;Kt<Yt;Kt+=2){const Zt=qt[Kt],Jt=qt[Kt+1];if(Zt.global&&(Zt.lastIndex=0),Zt.test(Xt))return Jt}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,Dt){const Vt=this;return new Promise(function(Gt,zt){Vt.load(_e,Gt,Dt,zt)})}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}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";const loading={};class HttpError extends Error{constructor(_e,Dt){super(_e),this.response=Dt}}class FileLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=Cache.get(_e);if(zt!==void 0)return this.manager.itemStart(_e),setTimeout(()=>{Dt&&Dt(zt),this.manager.itemEnd(_e)},0),zt;if(loading[_e]!==void 0){loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});return}loading[_e]=[],loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});const jt=new Request(_e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),Ht=this.mimeType,Wt=this.responseType;fetch(jt).then(qt=>{if(qt.status===200||qt.status===0){if(qt.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||qt.body===void 0||qt.body.getReader===void 0)return qt;const Xt=loading[_e],Kt=qt.body.getReader(),Yt=qt.headers.get("Content-Length")||qt.headers.get("X-File-Size"),Zt=Yt?parseInt(Yt):0,Jt=Zt!==0;let nn=0;const rn=new ReadableStream({start(Qt){en();function en(){Kt.read().then(({done:tn,value:sn})=>{if(tn)Qt.close();else{nn+=sn.byteLength;const cn=new ProgressEvent("progress",{lengthComputable:Jt,loaded:nn,total:Zt});for(let un=0,hn=Xt.length;un<hn;un++){const dn=Xt[un];dn.onProgress&&dn.onProgress(cn)}Qt.enqueue(sn),en()}})}}});return new Response(rn)}else throw new HttpError(`fetch for "${qt.url}" responded with ${qt.status}: ${qt.statusText}`,qt)}).then(qt=>{switch(Wt){case"arraybuffer":return qt.arrayBuffer();case"blob":return qt.blob();case"document":return qt.text().then(Xt=>new DOMParser().parseFromString(Xt,Ht));case"json":return qt.json();default:if(Ht===void 0)return qt.text();{const Kt=/charset="?([^;"\s]*)"?/i.exec(Ht),Yt=Kt&&Kt[1]?Kt[1].toLowerCase():void 0,Zt=new TextDecoder(Yt);return qt.arrayBuffer().then(Jt=>Zt.decode(Jt))}}}).then(qt=>{Cache.add(_e,qt);const Xt=loading[_e];delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onLoad&&Zt.onLoad(qt)}}).catch(qt=>{const Xt=loading[_e];if(Xt===void 0)throw this.manager.itemError(_e),qt;delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onError&&Zt.onError(qt)}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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=[];for(let Vt=0;Vt<_e.length;Vt++){const Gt=AnimationClip.parse(_e[Vt]);Dt.push(Gt)}return Dt}}class CompressedTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=[],Ht=new CompressedTexture,Wt=new FileLoader(this.manager);Wt.setPath(this.path),Wt.setResponseType("arraybuffer"),Wt.setRequestHeader(this.requestHeader),Wt.setWithCredentials(zt.withCredentials);let qt=0;function Xt(Kt){Wt.load(_e[Kt],function(Yt){const Zt=zt.parse(Yt,!0);jt[Kt]={width:Zt.width,height:Zt.height,format:Zt.format,mipmaps:Zt.mipmaps},qt+=1,qt===6&&(Zt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.image=jt,Ht.format=Zt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht))},Vt,Gt)}if(Array.isArray(_e))for(let Kt=0,Yt=_e.length;Kt<Yt;++Kt)Xt(Kt);else Wt.load(_e,function(Kt){const Yt=zt.parse(Kt,!0);if(Yt.isCubemap){const Zt=Yt.mipmaps.length/Yt.mipmapCount;for(let Jt=0;Jt<Zt;Jt++){jt[Jt]={mipmaps:[]};for(let nn=0;nn<Yt.mipmapCount;nn++)jt[Jt].mipmaps.push(Yt.mipmaps[Jt*Yt.mipmapCount+nn]),jt[Jt].format=Yt.format,jt[Jt].width=Yt.width,jt[Jt].height=Yt.height}Ht.image=jt}else Ht.image.width=Yt.width,Ht.image.height=Yt.height,Ht.mipmaps=Yt.mipmaps;Yt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.format=Yt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht)},Vt,Gt);return Ht}}class ImageLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0)return zt.manager.itemStart(_e),setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt;const Ht=createElementNS("img");function Wt(){Xt(),Cache.add(_e,this),Dt&&Dt(this),zt.manager.itemEnd(_e)}function qt(Kt){Xt(),Gt&&Gt(Kt),zt.manager.itemError(_e),zt.manager.itemEnd(_e)}function Xt(){Ht.removeEventListener("load",Wt,!1),Ht.removeEventListener("error",qt,!1)}return Ht.addEventListener("load",Wt,!1),Ht.addEventListener("error",qt,!1),_e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(Ht.crossOrigin=this.crossOrigin),zt.manager.itemStart(_e),Ht.src=_e,Ht}}class CubeTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new CubeTexture;zt.colorSpace=SRGBColorSpace$1;const jt=new ImageLoader(this.manager);jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path);let Ht=0;function Wt(qt){jt.load(_e[qt],function(Xt){zt.images[qt]=Xt,Ht++,Ht===6&&(zt.needsUpdate=!0,Dt&&Dt(zt))},void 0,Gt)}for(let qt=0;qt<_e.length;++qt)Wt(qt);return zt}}class DataTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new DataTexture,Ht=new FileLoader(this.manager);return Ht.setResponseType("arraybuffer"),Ht.setRequestHeader(this.requestHeader),Ht.setPath(this.path),Ht.setWithCredentials(zt.withCredentials),Ht.load(_e,function(Wt){let qt;try{qt=zt.parse(Wt)}catch(Xt){if(Gt!==void 0)Gt(Xt);else{console.error(Xt);return}}qt.image!==void 0?jt.image=qt.image:qt.data!==void 0&&(jt.image.width=qt.width,jt.image.height=qt.height,jt.image.data=qt.data),jt.wrapS=qt.wrapS!==void 0?qt.wrapS:ClampToEdgeWrapping,jt.wrapT=qt.wrapT!==void 0?qt.wrapT:ClampToEdgeWrapping,jt.magFilter=qt.magFilter!==void 0?qt.magFilter:LinearFilter,jt.minFilter=qt.minFilter!==void 0?qt.minFilter:LinearFilter,jt.anisotropy=qt.anisotropy!==void 0?qt.anisotropy:1,qt.colorSpace!==void 0&&(jt.colorSpace=qt.colorSpace),qt.flipY!==void 0&&(jt.flipY=qt.flipY),qt.format!==void 0&&(jt.format=qt.format),qt.type!==void 0&&(jt.type=qt.type),qt.mipmaps!==void 0&&(jt.mipmaps=qt.mipmaps,jt.minFilter=LinearMipmapLinearFilter),qt.mipmapCount===1&&(jt.minFilter=LinearFilter),qt.generateMipmaps!==void 0&&(jt.generateMipmaps=qt.generateMipmaps),jt.needsUpdate=!0,Dt&&Dt(jt,qt)},Vt,Gt),jt}}class TextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new Texture,jt=new ImageLoader(this.manager);return jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path),jt.load(_e,function(Ht){zt.image=Ht,zt.needsUpdate=!0,Dt!==void 0&&Dt(zt)},Vt,Gt),zt}}class Light extends Object3D{constructor(_e,Dt=1){super(),this.isLight=!0,this.type="Light",this.color=new Color$1(_e),this.intensity=Dt}dispose(){}copy(_e,Dt){return super.copy(_e,Dt),this.color.copy(_e.color),this.intensity=_e.intensity,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.color=this.color.getHex(),Dt.object.intensity=this.intensity,this.groundColor!==void 0&&(Dt.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(Dt.object.distance=this.distance),this.angle!==void 0&&(Dt.object.angle=this.angle),this.decay!==void 0&&(Dt.object.decay=this.decay),this.penumbra!==void 0&&(Dt.object.penumbra=this.penumbra),this.shadow!==void 0&&(Dt.object.shadow=this.shadow.toJSON()),Dt}}class HemisphereLight extends Light{constructor(_e,Dt,Vt){super(_e,Vt),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color$1(Dt)}copy(_e,Dt){return super.copy(_e,Dt),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 Dt=this.camera,Vt=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(_e.matrixWorld),Dt.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(_e.target.matrixWorld),Dt.lookAt(_lookTarget$1),Dt.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(Dt.projectionMatrix,Dt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),Vt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Vt.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 Dt=this.camera,Vt=RAD2DEG*2*_e.angle*this.focus,Gt=this.mapSize.width/this.mapSize.height,zt=_e.distance||Dt.far;(Vt!==Dt.fov||Gt!==Dt.aspect||zt!==Dt.far)&&(Dt.fov=Vt,Dt.aspect=Gt,Dt.far=zt,Dt.updateProjectionMatrix()),super.updateMatrices(_e)}copy(_e){return super.copy(_e),this.focus=_e.focus,this}}class SpotLight extends Light{constructor(_e,Dt,Vt=0,Gt=Math.PI/3,zt=0,jt=2){super(_e,Dt),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=Vt,this.angle=Gt,this.penumbra=zt,this.decay=jt,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,Dt){return super.copy(_e,Dt),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,Dt=0){const Vt=this.camera,Gt=this.matrix,zt=_e.distance||Vt.far;zt!==Vt.far&&(Vt.far=zt,Vt.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(_e.matrixWorld),Vt.position.copy(_lightPositionWorld),_lookTarget.copy(Vt.position),_lookTarget.add(this._cubeDirections[Dt]),Vt.up.copy(this._cubeUps[Dt]),Vt.lookAt(_lookTarget),Vt.updateMatrixWorld(),Gt.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(_e,Dt,Vt=0,Gt=2){super(_e,Dt),this.isPointLight=!0,this.type="PointLight",this.distance=Vt,this.decay=Gt,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,Dt){return super.copy(_e,Dt),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,Dt){super(_e,Dt),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),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,Dt){super(_e,Dt),this.isAmbientLight=!0,this.type="AmbientLight"}}class RectAreaLight extends Light{constructor(_e,Dt,Vt=10,Gt=10){super(_e,Dt),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=Vt,this.height=Gt}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 Dt=super.toJSON(_e);return Dt.object.width=this.width,Dt.object.height=this.height,Dt}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let _e=0;_e<9;_e++)this.coefficients.push(new Vector3)}set(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].copy(_e[Dt]);return this}zero(){for(let _e=0;_e<9;_e++)this.coefficients[_e].set(0,0,0);return this}getAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.282095),Dt.addScaledVector(jt[1],.488603*Gt),Dt.addScaledVector(jt[2],.488603*zt),Dt.addScaledVector(jt[3],.488603*Vt),Dt.addScaledVector(jt[4],1.092548*(Vt*Gt)),Dt.addScaledVector(jt[5],1.092548*(Gt*zt)),Dt.addScaledVector(jt[6],.315392*(3*zt*zt-1)),Dt.addScaledVector(jt[7],1.092548*(Vt*zt)),Dt.addScaledVector(jt[8],.546274*(Vt*Vt-Gt*Gt)),Dt}getIrradianceAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.886227),Dt.addScaledVector(jt[1],2*.511664*Gt),Dt.addScaledVector(jt[2],2*.511664*zt),Dt.addScaledVector(jt[3],2*.511664*Vt),Dt.addScaledVector(jt[4],2*.429043*Vt*Gt),Dt.addScaledVector(jt[5],2*.429043*Gt*zt),Dt.addScaledVector(jt[6],.743125*zt*zt-.247708),Dt.addScaledVector(jt[7],2*.429043*Vt*zt),Dt.addScaledVector(jt[8],.429043*(Vt*Vt-Gt*Gt)),Dt}add(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].add(_e.coefficients[Dt]);return this}addScaledSH(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].addScaledVector(_e.coefficients[Vt],Dt);return this}scale(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].multiplyScalar(_e);return this}lerp(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].lerp(_e.coefficients[Vt],Dt);return this}equals(_e){for(let Dt=0;Dt<9;Dt++)if(!this.coefficients[Dt].equals(_e.coefficients[Dt]))return!1;return!0}copy(_e){return this.set(_e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(_e,Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].fromArray(_e,Dt+Gt*3);return this}toArray(_e=[],Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].toArray(_e,Dt+Gt*3);return _e}static getBasisAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z;Dt[0]=.282095,Dt[1]=.488603*Gt,Dt[2]=.488603*zt,Dt[3]=.488603*Vt,Dt[4]=1.092548*Vt*Gt,Dt[5]=1.092548*Gt*zt,Dt[6]=.315392*(3*zt*zt-1),Dt[7]=1.092548*Vt*zt,Dt[8]=.546274*(Vt*Vt-Gt*Gt)}}class LightProbe extends Light{constructor(_e=new SphericalHarmonics3,Dt=1){super(void 0,Dt),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 Dt=super.toJSON(_e);return Dt.object.sh=this.sh.toArray(),Dt}}class MaterialLoader extends Loader{constructor(_e){super(_e),this.textures={}}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=this.textures;function Vt(zt){return Dt[zt]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",zt),Dt[zt]}const Gt=MaterialLoader.createMaterialFromType(_e.type);if(_e.uuid!==void 0&&(Gt.uuid=_e.uuid),_e.name!==void 0&&(Gt.name=_e.name),_e.color!==void 0&&Gt.color!==void 0&&Gt.color.setHex(_e.color),_e.roughness!==void 0&&(Gt.roughness=_e.roughness),_e.metalness!==void 0&&(Gt.metalness=_e.metalness),_e.sheen!==void 0&&(Gt.sheen=_e.sheen),_e.sheenColor!==void 0&&(Gt.sheenColor=new Color$1().setHex(_e.sheenColor)),_e.sheenRoughness!==void 0&&(Gt.sheenRoughness=_e.sheenRoughness),_e.emissive!==void 0&&Gt.emissive!==void 0&&Gt.emissive.setHex(_e.emissive),_e.specular!==void 0&&Gt.specular!==void 0&&Gt.specular.setHex(_e.specular),_e.specularIntensity!==void 0&&(Gt.specularIntensity=_e.specularIntensity),_e.specularColor!==void 0&&Gt.specularColor!==void 0&&Gt.specularColor.setHex(_e.specularColor),_e.shininess!==void 0&&(Gt.shininess=_e.shininess),_e.clearcoat!==void 0&&(Gt.clearcoat=_e.clearcoat),_e.clearcoatRoughness!==void 0&&(Gt.clearcoatRoughness=_e.clearcoatRoughness),_e.iridescence!==void 0&&(Gt.iridescence=_e.iridescence),_e.iridescenceIOR!==void 0&&(Gt.iridescenceIOR=_e.iridescenceIOR),_e.iridescenceThicknessRange!==void 0&&(Gt.iridescenceThicknessRange=_e.iridescenceThicknessRange),_e.transmission!==void 0&&(Gt.transmission=_e.transmission),_e.thickness!==void 0&&(Gt.thickness=_e.thickness),_e.attenuationDistance!==void 0&&(Gt.attenuationDistance=_e.attenuationDistance),_e.attenuationColor!==void 0&&Gt.attenuationColor!==void 0&&Gt.attenuationColor.setHex(_e.attenuationColor),_e.anisotropy!==void 0&&(Gt.anisotropy=_e.anisotropy),_e.anisotropyRotation!==void 0&&(Gt.anisotropyRotation=_e.anisotropyRotation),_e.fog!==void 0&&(Gt.fog=_e.fog),_e.flatShading!==void 0&&(Gt.flatShading=_e.flatShading),_e.blending!==void 0&&(Gt.blending=_e.blending),_e.combine!==void 0&&(Gt.combine=_e.combine),_e.side!==void 0&&(Gt.side=_e.side),_e.shadowSide!==void 0&&(Gt.shadowSide=_e.shadowSide),_e.opacity!==void 0&&(Gt.opacity=_e.opacity),_e.transparent!==void 0&&(Gt.transparent=_e.transparent),_e.alphaTest!==void 0&&(Gt.alphaTest=_e.alphaTest),_e.alphaHash!==void 0&&(Gt.alphaHash=_e.alphaHash),_e.depthFunc!==void 0&&(Gt.depthFunc=_e.depthFunc),_e.depthTest!==void 0&&(Gt.depthTest=_e.depthTest),_e.depthWrite!==void 0&&(Gt.depthWrite=_e.depthWrite),_e.colorWrite!==void 0&&(Gt.colorWrite=_e.colorWrite),_e.blendSrc!==void 0&&(Gt.blendSrc=_e.blendSrc),_e.blendDst!==void 0&&(Gt.blendDst=_e.blendDst),_e.blendEquation!==void 0&&(Gt.blendEquation=_e.blendEquation),_e.blendSrcAlpha!==void 0&&(Gt.blendSrcAlpha=_e.blendSrcAlpha),_e.blendDstAlpha!==void 0&&(Gt.blendDstAlpha=_e.blendDstAlpha),_e.blendEquationAlpha!==void 0&&(Gt.blendEquationAlpha=_e.blendEquationAlpha),_e.blendColor!==void 0&&Gt.blendColor!==void 0&&Gt.blendColor.setHex(_e.blendColor),_e.blendAlpha!==void 0&&(Gt.blendAlpha=_e.blendAlpha),_e.stencilWriteMask!==void 0&&(Gt.stencilWriteMask=_e.stencilWriteMask),_e.stencilFunc!==void 0&&(Gt.stencilFunc=_e.stencilFunc),_e.stencilRef!==void 0&&(Gt.stencilRef=_e.stencilRef),_e.stencilFuncMask!==void 0&&(Gt.stencilFuncMask=_e.stencilFuncMask),_e.stencilFail!==void 0&&(Gt.stencilFail=_e.stencilFail),_e.stencilZFail!==void 0&&(Gt.stencilZFail=_e.stencilZFail),_e.stencilZPass!==void 0&&(Gt.stencilZPass=_e.stencilZPass),_e.stencilWrite!==void 0&&(Gt.stencilWrite=_e.stencilWrite),_e.wireframe!==void 0&&(Gt.wireframe=_e.wireframe),_e.wireframeLinewidth!==void 0&&(Gt.wireframeLinewidth=_e.wireframeLinewidth),_e.wireframeLinecap!==void 0&&(Gt.wireframeLinecap=_e.wireframeLinecap),_e.wireframeLinejoin!==void 0&&(Gt.wireframeLinejoin=_e.wireframeLinejoin),_e.rotation!==void 0&&(Gt.rotation=_e.rotation),_e.linewidth!==void 0&&(Gt.linewidth=_e.linewidth),_e.dashSize!==void 0&&(Gt.dashSize=_e.dashSize),_e.gapSize!==void 0&&(Gt.gapSize=_e.gapSize),_e.scale!==void 0&&(Gt.scale=_e.scale),_e.polygonOffset!==void 0&&(Gt.polygonOffset=_e.polygonOffset),_e.polygonOffsetFactor!==void 0&&(Gt.polygonOffsetFactor=_e.polygonOffsetFactor),_e.polygonOffsetUnits!==void 0&&(Gt.polygonOffsetUnits=_e.polygonOffsetUnits),_e.dithering!==void 0&&(Gt.dithering=_e.dithering),_e.alphaToCoverage!==void 0&&(Gt.alphaToCoverage=_e.alphaToCoverage),_e.premultipliedAlpha!==void 0&&(Gt.premultipliedAlpha=_e.premultipliedAlpha),_e.forceSinglePass!==void 0&&(Gt.forceSinglePass=_e.forceSinglePass),_e.visible!==void 0&&(Gt.visible=_e.visible),_e.toneMapped!==void 0&&(Gt.toneMapped=_e.toneMapped),_e.userData!==void 0&&(Gt.userData=_e.userData),_e.vertexColors!==void 0&&(typeof _e.vertexColors=="number"?Gt.vertexColors=_e.vertexColors>0:Gt.vertexColors=_e.vertexColors),_e.uniforms!==void 0)for(const zt in _e.uniforms){const jt=_e.uniforms[zt];switch(Gt.uniforms[zt]={},jt.type){case"t":Gt.uniforms[zt].value=Vt(jt.value);break;case"c":Gt.uniforms[zt].value=new Color$1().setHex(jt.value);break;case"v2":Gt.uniforms[zt].value=new Vector2().fromArray(jt.value);break;case"v3":Gt.uniforms[zt].value=new Vector3().fromArray(jt.value);break;case"v4":Gt.uniforms[zt].value=new Vector4().fromArray(jt.value);break;case"m3":Gt.uniforms[zt].value=new Matrix3().fromArray(jt.value);break;case"m4":Gt.uniforms[zt].value=new Matrix4().fromArray(jt.value);break;default:Gt.uniforms[zt].value=jt.value}}if(_e.defines!==void 0&&(Gt.defines=_e.defines),_e.vertexShader!==void 0&&(Gt.vertexShader=_e.vertexShader),_e.fragmentShader!==void 0&&(Gt.fragmentShader=_e.fragmentShader),_e.glslVersion!==void 0&&(Gt.glslVersion=_e.glslVersion),_e.extensions!==void 0)for(const zt in _e.extensions)Gt.extensions[zt]=_e.extensions[zt];if(_e.lights!==void 0&&(Gt.lights=_e.lights),_e.clipping!==void 0&&(Gt.clipping=_e.clipping),_e.size!==void 0&&(Gt.size=_e.size),_e.sizeAttenuation!==void 0&&(Gt.sizeAttenuation=_e.sizeAttenuation),_e.map!==void 0&&(Gt.map=Vt(_e.map)),_e.matcap!==void 0&&(Gt.matcap=Vt(_e.matcap)),_e.alphaMap!==void 0&&(Gt.alphaMap=Vt(_e.alphaMap)),_e.bumpMap!==void 0&&(Gt.bumpMap=Vt(_e.bumpMap)),_e.bumpScale!==void 0&&(Gt.bumpScale=_e.bumpScale),_e.normalMap!==void 0&&(Gt.normalMap=Vt(_e.normalMap)),_e.normalMapType!==void 0&&(Gt.normalMapType=_e.normalMapType),_e.normalScale!==void 0){let zt=_e.normalScale;Array.isArray(zt)===!1&&(zt=[zt,zt]),Gt.normalScale=new Vector2().fromArray(zt)}return _e.displacementMap!==void 0&&(Gt.displacementMap=Vt(_e.displacementMap)),_e.displacementScale!==void 0&&(Gt.displacementScale=_e.displacementScale),_e.displacementBias!==void 0&&(Gt.displacementBias=_e.displacementBias),_e.roughnessMap!==void 0&&(Gt.roughnessMap=Vt(_e.roughnessMap)),_e.metalnessMap!==void 0&&(Gt.metalnessMap=Vt(_e.metalnessMap)),_e.emissiveMap!==void 0&&(Gt.emissiveMap=Vt(_e.emissiveMap)),_e.emissiveIntensity!==void 0&&(Gt.emissiveIntensity=_e.emissiveIntensity),_e.specularMap!==void 0&&(Gt.specularMap=Vt(_e.specularMap)),_e.specularIntensityMap!==void 0&&(Gt.specularIntensityMap=Vt(_e.specularIntensityMap)),_e.specularColorMap!==void 0&&(Gt.specularColorMap=Vt(_e.specularColorMap)),_e.envMap!==void 0&&(Gt.envMap=Vt(_e.envMap)),_e.envMapRotation!==void 0&&Gt.envMapRotation.fromArray(_e.envMapRotation),_e.envMapIntensity!==void 0&&(Gt.envMapIntensity=_e.envMapIntensity),_e.reflectivity!==void 0&&(Gt.reflectivity=_e.reflectivity),_e.refractionRatio!==void 0&&(Gt.refractionRatio=_e.refractionRatio),_e.lightMap!==void 0&&(Gt.lightMap=Vt(_e.lightMap)),_e.lightMapIntensity!==void 0&&(Gt.lightMapIntensity=_e.lightMapIntensity),_e.aoMap!==void 0&&(Gt.aoMap=Vt(_e.aoMap)),_e.aoMapIntensity!==void 0&&(Gt.aoMapIntensity=_e.aoMapIntensity),_e.gradientMap!==void 0&&(Gt.gradientMap=Vt(_e.gradientMap)),_e.clearcoatMap!==void 0&&(Gt.clearcoatMap=Vt(_e.clearcoatMap)),_e.clearcoatRoughnessMap!==void 0&&(Gt.clearcoatRoughnessMap=Vt(_e.clearcoatRoughnessMap)),_e.clearcoatNormalMap!==void 0&&(Gt.clearcoatNormalMap=Vt(_e.clearcoatNormalMap)),_e.clearcoatNormalScale!==void 0&&(Gt.clearcoatNormalScale=new Vector2().fromArray(_e.clearcoatNormalScale)),_e.iridescenceMap!==void 0&&(Gt.iridescenceMap=Vt(_e.iridescenceMap)),_e.iridescenceThicknessMap!==void 0&&(Gt.iridescenceThicknessMap=Vt(_e.iridescenceThicknessMap)),_e.transmissionMap!==void 0&&(Gt.transmissionMap=Vt(_e.transmissionMap)),_e.thicknessMap!==void 0&&(Gt.thicknessMap=Vt(_e.thicknessMap)),_e.anisotropyMap!==void 0&&(Gt.anisotropyMap=Vt(_e.anisotropyMap)),_e.sheenColorMap!==void 0&&(Gt.sheenColorMap=Vt(_e.sheenColorMap)),_e.sheenRoughnessMap!==void 0&&(Gt.sheenRoughnessMap=Vt(_e.sheenRoughnessMap)),Gt}setTextures(_e){return this.textures=_e,this}static createMaterialFromType(_e){const Dt={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new Dt[_e]}}class LoaderUtils{static decodeText(_e){if(typeof TextDecoder<"u")return new TextDecoder().decode(_e);let Dt="";for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++)Dt+=String.fromCharCode(_e[Vt]);try{return decodeURIComponent(escape(Dt))}catch{return Dt}}static extractUrlBase(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.slice(0,Dt+1)}static resolveURL(_e,Dt){return typeof _e!="string"||_e===""?"":(/^https?:\/\//i.test(Dt)&&/^\//.test(_e)&&(Dt=Dt.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(_e)||/^data:.*,.*$/i.test(_e)||/^blob:.*$/i.test(_e)?_e:Dt+_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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt={},Vt={};function Gt(Zt,Jt){if(Dt[Jt]!==void 0)return Dt[Jt];const rn=Zt.interleavedBuffers[Jt],Qt=zt(Zt,rn.buffer),en=getTypedArray(rn.type,Qt),tn=new InterleavedBuffer(en,rn.stride);return tn.uuid=rn.uuid,Dt[Jt]=tn,tn}function zt(Zt,Jt){if(Vt[Jt]!==void 0)return Vt[Jt];const rn=Zt.arrayBuffers[Jt],Qt=new Uint32Array(rn).buffer;return Vt[Jt]=Qt,Qt}const jt=_e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,Ht=_e.data.index;if(Ht!==void 0){const Zt=getTypedArray(Ht.type,Ht.array);jt.setIndex(new BufferAttribute(Zt,1))}const Wt=_e.data.attributes;for(const Zt in Wt){const Jt=Wt[Zt];let nn;if(Jt.isInterleavedBufferAttribute){const rn=Gt(_e.data,Jt.data);nn=new InterleavedBufferAttribute(rn,Jt.itemSize,Jt.offset,Jt.normalized)}else{const rn=getTypedArray(Jt.type,Jt.array),Qt=Jt.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;nn=new Qt(rn,Jt.itemSize,Jt.normalized)}Jt.name!==void 0&&(nn.name=Jt.name),Jt.usage!==void 0&&nn.setUsage(Jt.usage),jt.setAttribute(Zt,nn)}const qt=_e.data.morphAttributes;if(qt)for(const Zt in qt){const Jt=qt[Zt],nn=[];for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];let tn;if(en.isInterleavedBufferAttribute){const sn=Gt(_e.data,en.data);tn=new InterleavedBufferAttribute(sn,en.itemSize,en.offset,en.normalized)}else{const sn=getTypedArray(en.type,en.array);tn=new BufferAttribute(sn,en.itemSize,en.normalized)}en.name!==void 0&&(tn.name=en.name),nn.push(tn)}jt.morphAttributes[Zt]=nn}_e.data.morphTargetsRelative&&(jt.morphTargetsRelative=!0);const Kt=_e.data.groups||_e.data.drawcalls||_e.data.offsets;if(Kt!==void 0)for(let Zt=0,Jt=Kt.length;Zt!==Jt;++Zt){const nn=Kt[Zt];jt.addGroup(nn.start,nn.count,nn.materialIndex)}const Yt=_e.data.boundingSphere;if(Yt!==void 0){const Zt=new Vector3;Yt.center!==void 0&&Zt.fromArray(Yt.center),jt.boundingSphere=new Sphere(Zt,Yt.radius)}return _e.name&&(jt.name=_e.name),_e.userData&&(jt.userData=_e.userData),jt}}class ObjectLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||jt;const Ht=new FileLoader(this.manager);Ht.setPath(this.path),Ht.setRequestHeader(this.requestHeader),Ht.setWithCredentials(this.withCredentials),Ht.load(_e,function(Wt){let qt=null;try{qt=JSON.parse(Wt)}catch(Kt){Gt!==void 0&&Gt(Kt),console.error("THREE:ObjectLoader: Can't parse "+_e+".",Kt.message);return}const Xt=qt.metadata;if(Xt===void 0||Xt.type===void 0||Xt.type.toLowerCase()==="geometry"){Gt!==void 0&&Gt(new Error("THREE.ObjectLoader: Can't load "+_e)),console.error("THREE.ObjectLoader: Can't load "+_e);return}zt.parse(qt,Dt)},Vt,Gt)}async loadAsync(_e,Dt){const Vt=this,Gt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||Gt;const zt=new FileLoader(this.manager);zt.setPath(this.path),zt.setRequestHeader(this.requestHeader),zt.setWithCredentials(this.withCredentials);const jt=await zt.loadAsync(_e,Dt),Ht=JSON.parse(jt),Wt=Ht.metadata;if(Wt===void 0||Wt.type===void 0||Wt.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+_e);return await Vt.parseAsync(Ht)}parse(_e,Dt){const Vt=this.parseAnimations(_e.animations),Gt=this.parseShapes(_e.shapes),zt=this.parseGeometries(_e.geometries,Gt),jt=this.parseImages(_e.images,function(){Dt!==void 0&&Dt(qt)}),Ht=this.parseTextures(_e.textures,jt),Wt=this.parseMaterials(_e.materials,Ht),qt=this.parseObject(_e.object,zt,Wt,Ht,Vt),Xt=this.parseSkeletons(_e.skeletons,qt);if(this.bindSkeletons(qt,Xt),Dt!==void 0){let Kt=!1;for(const Yt in jt)if(jt[Yt].data instanceof HTMLImageElement){Kt=!0;break}Kt===!1&&Dt(qt)}return qt}async parseAsync(_e){const Dt=this.parseAnimations(_e.animations),Vt=this.parseShapes(_e.shapes),Gt=this.parseGeometries(_e.geometries,Vt),zt=await this.parseImagesAsync(_e.images),jt=this.parseTextures(_e.textures,zt),Ht=this.parseMaterials(_e.materials,jt),Wt=this.parseObject(_e.object,Gt,Ht,jt,Dt),qt=this.parseSkeletons(_e.skeletons,Wt);return this.bindSkeletons(Wt,qt),Wt}parseShapes(_e){const Dt={};if(_e!==void 0)for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++){const zt=new Shape().fromJSON(_e[Vt]);Dt[zt.uuid]=zt}return Dt}parseSkeletons(_e,Dt){const Vt={},Gt={};if(Dt.traverse(function(zt){zt.isBone&&(Gt[zt.uuid]=zt)}),_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=new Skeleton().fromJSON(_e[zt],Gt);Vt[Ht.uuid]=Ht}return Vt}parseGeometries(_e,Dt){const Vt={};if(_e!==void 0){const Gt=new BufferGeometryLoader;for(let zt=0,jt=_e.length;zt<jt;zt++){let Ht;const Wt=_e[zt];switch(Wt.type){case"BufferGeometry":case"InstancedBufferGeometry":Ht=Gt.parse(Wt);break;default:Wt.type in Geometries?Ht=Geometries[Wt.type].fromJSON(Wt,Dt):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${Wt.type}"`)}Ht.uuid=Wt.uuid,Wt.name!==void 0&&(Ht.name=Wt.name),Wt.userData!==void 0&&(Ht.userData=Wt.userData),Vt[Wt.uuid]=Ht}}return Vt}parseMaterials(_e,Dt){const Vt={},Gt={};if(_e!==void 0){const zt=new MaterialLoader;zt.setTextures(Dt);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt];Vt[Wt.uuid]===void 0&&(Vt[Wt.uuid]=zt.parse(Wt)),Gt[Wt.uuid]=Vt[Wt.uuid]}}return Gt}parseAnimations(_e){const Dt={};if(_e!==void 0)for(let Vt=0;Vt<_e.length;Vt++){const Gt=_e[Vt],zt=AnimationClip.parse(Gt);Dt[zt.uuid]=zt}return Dt}parseImages(_e,Dt){const Vt=this,Gt={};let zt;function jt(Wt){return Vt.manager.itemStart(Wt),zt.load(Wt,function(){Vt.manager.itemEnd(Wt)},void 0,function(){Vt.manager.itemError(Wt),Vt.manager.itemEnd(Wt)})}function Ht(Wt){if(typeof Wt=="string"){const qt=Wt,Xt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(qt)?qt:Vt.resourcePath+qt;return jt(Xt)}else return Wt.data?{data:getTypedArray(Wt.type,Wt.data),width:Wt.width,height:Wt.height}:null}if(_e!==void 0&&_e.length>0){const Wt=new LoadingManager(Dt);zt=new ImageLoader(Wt),zt.setCrossOrigin(this.crossOrigin);for(let qt=0,Xt=_e.length;qt<Xt;qt++){const Kt=_e[qt],Yt=Kt.url;if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt],Qt=Ht(rn);Qt!==null&&(Qt instanceof HTMLImageElement?Zt.push(Qt):Zt.push(new DataTexture(Qt.data,Qt.width,Qt.height)))}Gt[Kt.uuid]=new Source(Zt)}else{const Zt=Ht(Kt.url);Gt[Kt.uuid]=new Source(Zt)}}}return Gt}async parseImagesAsync(_e){const Dt=this,Vt={};let Gt;async function zt(jt){if(typeof jt=="string"){const Ht=jt,Wt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(Ht)?Ht:Dt.resourcePath+Ht;return await Gt.loadAsync(Wt)}else return jt.data?{data:getTypedArray(jt.type,jt.data),width:jt.width,height:jt.height}:null}if(_e!==void 0&&_e.length>0){Gt=new ImageLoader(this.manager),Gt.setCrossOrigin(this.crossOrigin);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt],qt=Wt.url;if(Array.isArray(qt)){const Xt=[];for(let Kt=0,Yt=qt.length;Kt<Yt;Kt++){const Zt=qt[Kt],Jt=await zt(Zt);Jt!==null&&(Jt instanceof HTMLImageElement?Xt.push(Jt):Xt.push(new DataTexture(Jt.data,Jt.width,Jt.height)))}Vt[Wt.uuid]=new Source(Xt)}else{const Xt=await zt(Wt.url);Vt[Wt.uuid]=new Source(Xt)}}}return Vt}parseTextures(_e,Dt){function Vt(zt,jt){return typeof zt=="number"?zt:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",zt),jt[zt])}const Gt={};if(_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt];Ht.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',Ht.uuid),Dt[Ht.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",Ht.image);const Wt=Dt[Ht.image],qt=Wt.data;let Xt;Array.isArray(qt)?(Xt=new CubeTexture,qt.length===6&&(Xt.needsUpdate=!0)):(qt&&qt.data?Xt=new DataTexture:Xt=new Texture,qt&&(Xt.needsUpdate=!0)),Xt.source=Wt,Xt.uuid=Ht.uuid,Ht.name!==void 0&&(Xt.name=Ht.name),Ht.mapping!==void 0&&(Xt.mapping=Vt(Ht.mapping,TEXTURE_MAPPING)),Ht.channel!==void 0&&(Xt.channel=Ht.channel),Ht.offset!==void 0&&Xt.offset.fromArray(Ht.offset),Ht.repeat!==void 0&&Xt.repeat.fromArray(Ht.repeat),Ht.center!==void 0&&Xt.center.fromArray(Ht.center),Ht.rotation!==void 0&&(Xt.rotation=Ht.rotation),Ht.wrap!==void 0&&(Xt.wrapS=Vt(Ht.wrap[0],TEXTURE_WRAPPING),Xt.wrapT=Vt(Ht.wrap[1],TEXTURE_WRAPPING)),Ht.format!==void 0&&(Xt.format=Ht.format),Ht.internalFormat!==void 0&&(Xt.internalFormat=Ht.internalFormat),Ht.type!==void 0&&(Xt.type=Ht.type),Ht.colorSpace!==void 0&&(Xt.colorSpace=Ht.colorSpace),Ht.minFilter!==void 0&&(Xt.minFilter=Vt(Ht.minFilter,TEXTURE_FILTER)),Ht.magFilter!==void 0&&(Xt.magFilter=Vt(Ht.magFilter,TEXTURE_FILTER)),Ht.anisotropy!==void 0&&(Xt.anisotropy=Ht.anisotropy),Ht.flipY!==void 0&&(Xt.flipY=Ht.flipY),Ht.generateMipmaps!==void 0&&(Xt.generateMipmaps=Ht.generateMipmaps),Ht.premultiplyAlpha!==void 0&&(Xt.premultiplyAlpha=Ht.premultiplyAlpha),Ht.unpackAlignment!==void 0&&(Xt.unpackAlignment=Ht.unpackAlignment),Ht.compareFunction!==void 0&&(Xt.compareFunction=Ht.compareFunction),Ht.userData!==void 0&&(Xt.userData=Ht.userData),Gt[Ht.uuid]=Xt}return Gt}parseObject(_e,Dt,Vt,Gt,zt){let jt;function Ht(Yt){return Dt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",Yt),Dt[Yt]}function Wt(Yt){if(Yt!==void 0){if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt];Vt[rn]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",rn),Zt.push(Vt[rn])}return Zt}return Vt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",Yt),Vt[Yt]}}function qt(Yt){return Gt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",Yt),Gt[Yt]}let Xt,Kt;switch(_e.type){case"Scene":jt=new Scene,_e.background!==void 0&&(Number.isInteger(_e.background)?jt.background=new Color$1(_e.background):jt.background=qt(_e.background)),_e.environment!==void 0&&(jt.environment=qt(_e.environment)),_e.fog!==void 0&&(_e.fog.type==="Fog"?jt.fog=new Fog(_e.fog.color,_e.fog.near,_e.fog.far):_e.fog.type==="FogExp2"&&(jt.fog=new FogExp2(_e.fog.color,_e.fog.density)),_e.fog.name!==""&&(jt.fog.name=_e.fog.name)),_e.backgroundBlurriness!==void 0&&(jt.backgroundBlurriness=_e.backgroundBlurriness),_e.backgroundIntensity!==void 0&&(jt.backgroundIntensity=_e.backgroundIntensity),_e.backgroundRotation!==void 0&&jt.backgroundRotation.fromArray(_e.backgroundRotation),_e.environmentIntensity!==void 0&&(jt.environmentIntensity=_e.environmentIntensity),_e.environmentRotation!==void 0&&jt.environmentRotation.fromArray(_e.environmentRotation);break;case"PerspectiveCamera":jt=new PerspectiveCamera(_e.fov,_e.aspect,_e.near,_e.far),_e.focus!==void 0&&(jt.focus=_e.focus),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.filmGauge!==void 0&&(jt.filmGauge=_e.filmGauge),_e.filmOffset!==void 0&&(jt.filmOffset=_e.filmOffset),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"OrthographicCamera":jt=new OrthographicCamera(_e.left,_e.right,_e.top,_e.bottom,_e.near,_e.far),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"AmbientLight":jt=new AmbientLight(_e.color,_e.intensity);break;case"DirectionalLight":jt=new DirectionalLight(_e.color,_e.intensity);break;case"PointLight":jt=new PointLight(_e.color,_e.intensity,_e.distance,_e.decay);break;case"RectAreaLight":jt=new RectAreaLight(_e.color,_e.intensity,_e.width,_e.height);break;case"SpotLight":jt=new SpotLight(_e.color,_e.intensity,_e.distance,_e.angle,_e.penumbra,_e.decay);break;case"HemisphereLight":jt=new HemisphereLight(_e.color,_e.groundColor,_e.intensity);break;case"LightProbe":jt=new LightProbe().fromJSON(_e);break;case"SkinnedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new SkinnedMesh(Xt,Kt),_e.bindMode!==void 0&&(jt.bindMode=_e.bindMode),_e.bindMatrix!==void 0&&jt.bindMatrix.fromArray(_e.bindMatrix),_e.skeleton!==void 0&&(jt.skeleton=_e.skeleton);break;case"Mesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new Mesh(Xt,Kt);break;case"InstancedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material);const Yt=_e.count,Zt=_e.instanceMatrix,Jt=_e.instanceColor;jt=new InstancedMesh(Xt,Kt,Yt),jt.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Zt.array),16),Jt!==void 0&&(jt.instanceColor=new InstancedBufferAttribute(new Float32Array(Jt.array),Jt.itemSize));break;case"BatchedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new BatchedMesh(_e.maxGeometryCount,_e.maxVertexCount,_e.maxIndexCount,Kt),jt.geometry=Xt,jt.perObjectFrustumCulled=_e.perObjectFrustumCulled,jt.sortObjects=_e.sortObjects,jt._drawRanges=_e.drawRanges,jt._reservedRanges=_e.reservedRanges,jt._visibility=_e.visibility,jt._active=_e.active,jt._bounds=_e.bounds.map(nn=>{const rn=new Box3;rn.min.fromArray(nn.boxMin),rn.max.fromArray(nn.boxMax);const Qt=new Sphere;return Qt.radius=nn.sphereRadius,Qt.center.fromArray(nn.sphereCenter),{boxInitialized:nn.boxInitialized,box:rn,sphereInitialized:nn.sphereInitialized,sphere:Qt}}),jt._maxGeometryCount=_e.maxGeometryCount,jt._maxVertexCount=_e.maxVertexCount,jt._maxIndexCount=_e.maxIndexCount,jt._geometryInitialized=_e.geometryInitialized,jt._geometryCount=_e.geometryCount,jt._matricesTexture=qt(_e.matricesTexture.uuid);break;case"LOD":jt=new LOD;break;case"Line":jt=new Line(Ht(_e.geometry),Wt(_e.material));break;case"LineLoop":jt=new LineLoop(Ht(_e.geometry),Wt(_e.material));break;case"LineSegments":jt=new LineSegments(Ht(_e.geometry),Wt(_e.material));break;case"PointCloud":case"Points":jt=new Points(Ht(_e.geometry),Wt(_e.material));break;case"Sprite":jt=new Sprite(Wt(_e.material));break;case"Group":jt=new Group;break;case"Bone":jt=new Bone;break;default:jt=new Object3D}if(jt.uuid=_e.uuid,_e.name!==void 0&&(jt.name=_e.name),_e.matrix!==void 0?(jt.matrix.fromArray(_e.matrix),_e.matrixAutoUpdate!==void 0&&(jt.matrixAutoUpdate=_e.matrixAutoUpdate),jt.matrixAutoUpdate&&jt.matrix.decompose(jt.position,jt.quaternion,jt.scale)):(_e.position!==void 0&&jt.position.fromArray(_e.position),_e.rotation!==void 0&&jt.rotation.fromArray(_e.rotation),_e.quaternion!==void 0&&jt.quaternion.fromArray(_e.quaternion),_e.scale!==void 0&&jt.scale.fromArray(_e.scale)),_e.up!==void 0&&jt.up.fromArray(_e.up),_e.castShadow!==void 0&&(jt.castShadow=_e.castShadow),_e.receiveShadow!==void 0&&(jt.receiveShadow=_e.receiveShadow),_e.shadow&&(_e.shadow.bias!==void 0&&(jt.shadow.bias=_e.shadow.bias),_e.shadow.normalBias!==void 0&&(jt.shadow.normalBias=_e.shadow.normalBias),_e.shadow.radius!==void 0&&(jt.shadow.radius=_e.shadow.radius),_e.shadow.mapSize!==void 0&&jt.shadow.mapSize.fromArray(_e.shadow.mapSize),_e.shadow.camera!==void 0&&(jt.shadow.camera=this.parseObject(_e.shadow.camera))),_e.visible!==void 0&&(jt.visible=_e.visible),_e.frustumCulled!==void 0&&(jt.frustumCulled=_e.frustumCulled),_e.renderOrder!==void 0&&(jt.renderOrder=_e.renderOrder),_e.userData!==void 0&&(jt.userData=_e.userData),_e.layers!==void 0&&(jt.layers.mask=_e.layers),_e.children!==void 0){const Yt=_e.children;for(let Zt=0;Zt<Yt.length;Zt++)jt.add(this.parseObject(Yt[Zt],Dt,Vt,Gt,zt))}if(_e.animations!==void 0){const Yt=_e.animations;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt];jt.animations.push(zt[Jt])}}if(_e.type==="LOD"){_e.autoUpdate!==void 0&&(jt.autoUpdate=_e.autoUpdate);const Yt=_e.levels;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt],nn=jt.getObjectByProperty("uuid",Jt.object);nn!==void 0&&jt.addLevel(nn,Jt.distance,Jt.hysteresis)}}return jt}bindSkeletons(_e,Dt){Object.keys(Dt).length!==0&&_e.traverse(function(Vt){if(Vt.isSkinnedMesh===!0&&Vt.skeleton!==void 0){const Gt=Dt[Vt.skeleton];Gt===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",Vt.skeleton):Vt.bind(Gt,Vt.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,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0){if(zt.manager.itemStart(_e),jt.then){jt.then(qt=>{Dt&&Dt(qt),zt.manager.itemEnd(_e)}).catch(qt=>{Gt&&Gt(qt)});return}return setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt}const Ht={};Ht.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",Ht.headers=this.requestHeader;const Wt=fetch(_e,Ht).then(function(qt){return qt.blob()}).then(function(qt){return createImageBitmap(qt,Object.assign(zt.options,{colorSpaceConversion:"none"}))}).then(function(qt){return Cache.add(_e,qt),Dt&&Dt(qt),zt.manager.itemEnd(_e),qt}).catch(function(qt){Gt&&Gt(qt),Cache.remove(_e),zt.manager.itemError(_e),zt.manager.itemEnd(_e)});Cache.add(_e,Wt),zt.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,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setResponseType("arraybuffer"),jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Wt){try{const qt=Wt.slice(0);AudioContext.getContext().decodeAudioData(qt,function(Kt){Dt(Kt)}).catch(Ht)}catch(qt){Ht(qt)}},Vt,Gt);function Ht(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}}}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 Dt=this._cache;if(Dt.focus!==_e.focus||Dt.fov!==_e.fov||Dt.aspect!==_e.aspect*this.aspect||Dt.near!==_e.near||Dt.far!==_e.far||Dt.zoom!==_e.zoom||Dt.eyeSep!==this.eyeSep){Dt.focus=_e.focus,Dt.fov=_e.fov,Dt.aspect=_e.aspect*this.aspect,Dt.near=_e.near,Dt.far=_e.far,Dt.zoom=_e.zoom,Dt.eyeSep=this.eyeSep,_projectionMatrix.copy(_e.projectionMatrix);const Gt=Dt.eyeSep/2,zt=Gt*Dt.near/Dt.focus,jt=Dt.near*Math.tan(DEG2RAD$1*Dt.fov*.5)/Dt.zoom;let Ht,Wt;_eyeLeft.elements[12]=-Gt,_eyeRight.elements[12]=Gt,Ht=-jt*Dt.aspect+zt,Wt=jt*Dt.aspect+zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraL.projectionMatrix.copy(_projectionMatrix),Ht=-jt*Dt.aspect-zt,Wt=jt*Dt.aspect-zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),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 Dt=now();_e=(Dt-this.oldTime)/1e3,this.oldTime=Dt,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 Dt=this.context.listener,Vt=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),Dt.positionX){const Gt=this.context.currentTime+this.timeDelta;Dt.positionX.linearRampToValueAtTime(_position$1.x,Gt),Dt.positionY.linearRampToValueAtTime(_position$1.y,Gt),Dt.positionZ.linearRampToValueAtTime(_position$1.z,Gt),Dt.forwardX.linearRampToValueAtTime(_orientation$1.x,Gt),Dt.forwardY.linearRampToValueAtTime(_orientation$1.y,Gt),Dt.forwardZ.linearRampToValueAtTime(_orientation$1.z,Gt),Dt.upX.linearRampToValueAtTime(Vt.x,Gt),Dt.upY.linearRampToValueAtTime(Vt.y,Gt),Dt.upZ.linearRampToValueAtTime(Vt.z,Gt)}else Dt.setPosition(_position$1.x,_position$1.y,_position$1.z),Dt.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,Vt.x,Vt.y,Vt.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 Dt=this.context.createBufferSource();return Dt.buffer=this.buffer,Dt.loop=this.loop,Dt.loopStart=this.loopStart,Dt.loopEnd=this.loopEnd,Dt.onended=this.onEnded.bind(this),Dt.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Dt,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!==null&&(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,Dt=this.filters.length;_e<Dt;_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._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_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){return this.detune=_e,this.isPlaying===!0&&this.source.detune!==void 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)}connect(){super.connect(),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,Dt,Vt){return this.panner.coneInnerAngle=_e,this.panner.coneOuterAngle=Dt,this.panner.coneOuterGain=Vt,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 Dt=this.panner;if(Dt.positionX){const Vt=this.context.currentTime+this.listener.timeDelta;Dt.positionX.linearRampToValueAtTime(_position.x,Vt),Dt.positionY.linearRampToValueAtTime(_position.y,Vt),Dt.positionZ.linearRampToValueAtTime(_position.z,Vt),Dt.orientationX.linearRampToValueAtTime(_orientation.x,Vt),Dt.orientationY.linearRampToValueAtTime(_orientation.y,Vt),Dt.orientationZ.linearRampToValueAtTime(_orientation.z,Vt)}else Dt.setPosition(_position.x,_position.y,_position.z),Dt.setOrientation(_orientation.x,_orientation.y,_orientation.z)}}class AudioAnalyser{constructor(_e,Dt=2048){this.analyser=_e.context.createAnalyser(),this.analyser.fftSize=Dt,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 Dt=this.getFrequencyData();for(let Vt=0;Vt<Dt.length;Vt++)_e+=Dt[Vt];return _e/Dt.length}}class PropertyMixer{constructor(_e,Dt,Vt){this.binding=_e,this.valueSize=Vt;let Gt,zt,jt;switch(Dt){case"quaternion":Gt=this._slerp,zt=this._slerpAdditive,jt=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(Vt*6),this._workIndex=5;break;case"string":case"bool":Gt=this._select,zt=this._select,jt=this._setAdditiveIdentityOther,this.buffer=new Array(Vt*5);break;default:Gt=this._lerp,zt=this._lerpAdditive,jt=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(Vt*5)}this._mixBufferRegion=Gt,this._mixBufferRegionAdditive=zt,this._setIdentity=jt,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(_e,Dt){const Vt=this.buffer,Gt=this.valueSize,zt=_e*Gt+Gt;let jt=this.cumulativeWeight;if(jt===0){for(let Ht=0;Ht!==Gt;++Ht)Vt[zt+Ht]=Vt[Ht];jt=Dt}else{jt+=Dt;const Ht=Dt/jt;this._mixBufferRegion(Vt,zt,0,Ht,Gt)}this.cumulativeWeight=jt}accumulateAdditive(_e){const Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(Dt,Gt,0,_e,Vt),this.cumulativeWeightAdditive+=_e}apply(_e){const Dt=this.valueSize,Vt=this.buffer,Gt=_e*Dt+Dt,zt=this.cumulativeWeight,jt=this.cumulativeWeightAdditive,Ht=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,zt<1){const Wt=Dt*this._origIndex;this._mixBufferRegion(Vt,Gt,Wt,1-zt,Dt)}jt>0&&this._mixBufferRegionAdditive(Vt,Gt,this._addIndex*Dt,1,Dt);for(let Wt=Dt,qt=Dt+Dt;Wt!==qt;++Wt)if(Vt[Wt]!==Vt[Wt+Dt]){Ht.setValue(Vt,Gt);break}}saveOriginalState(){const _e=this.binding,Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._origIndex;_e.getValue(Dt,Gt);for(let zt=Vt,jt=Gt;zt!==jt;++zt)Dt[zt]=Dt[Gt+zt%Vt];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,Dt=_e+this.valueSize;for(let Vt=_e;Vt<Dt;Vt++)this.buffer[Vt]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const _e=this._origIndex*this.valueSize,Dt=this._addIndex*this.valueSize;for(let Vt=0;Vt<this.valueSize;Vt++)this.buffer[Dt+Vt]=this.buffer[_e+Vt]}_select(_e,Dt,Vt,Gt,zt){if(Gt>=.5)for(let jt=0;jt!==zt;++jt)_e[Dt+jt]=_e[Vt+jt]}_slerp(_e,Dt,Vt,Gt){Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,Vt,Gt)}_slerpAdditive(_e,Dt,Vt,Gt,zt){const jt=this._workIndex*zt;Quaternion.multiplyQuaternionsFlat(_e,jt,_e,Dt,_e,Vt),Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,jt,Gt)}_lerp(_e,Dt,Vt,Gt,zt){const jt=1-Gt;for(let Ht=0;Ht!==zt;++Ht){const Wt=Dt+Ht;_e[Wt]=_e[Wt]*jt+_e[Vt+Ht]*Gt}}_lerpAdditive(_e,Dt,Vt,Gt,zt){for(let jt=0;jt!==zt;++jt){const Ht=Dt+jt;_e[Ht]=_e[Ht]+_e[Vt+jt]*Gt}}}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,Dt,Vt){const Gt=Vt||PropertyBinding.parseTrackName(Dt);this._targetGroup=_e,this._bindings=_e.subscribe_(Dt,Gt)}getValue(_e,Dt){this.bind();const Vt=this._targetGroup.nCachedObjects_,Gt=this._bindings[Vt];Gt!==void 0&&Gt.getValue(_e,Dt)}setValue(_e,Dt){const Vt=this._bindings;for(let Gt=this._targetGroup.nCachedObjects_,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt].setValue(_e,Dt)}bind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].bind()}unbind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].unbind()}}class PropertyBinding{constructor(_e,Dt,Vt){this.path=Dt,this.parsedPath=Vt||PropertyBinding.parseTrackName(Dt),this.node=PropertyBinding.findNode(_e,this.parsedPath.nodeName),this.rootNode=_e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(_e,Dt,Vt){return _e&&_e.isAnimationObjectGroup?new PropertyBinding.Composite(_e,Dt,Vt):new PropertyBinding(_e,Dt,Vt)}static sanitizeNodeName(_e){return _e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(_e){const Dt=_trackRe.exec(_e);if(Dt===null)throw new Error("PropertyBinding: Cannot parse trackName: "+_e);const Vt={nodeName:Dt[2],objectName:Dt[3],objectIndex:Dt[4],propertyName:Dt[5],propertyIndex:Dt[6]},Gt=Vt.nodeName&&Vt.nodeName.lastIndexOf(".");if(Gt!==void 0&&Gt!==-1){const zt=Vt.nodeName.substring(Gt+1);_supportedObjectNames.indexOf(zt)!==-1&&(Vt.nodeName=Vt.nodeName.substring(0,Gt),Vt.objectName=zt)}if(Vt.propertyName===null||Vt.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+_e);return Vt}static findNode(_e,Dt){if(Dt===void 0||Dt===""||Dt==="."||Dt===-1||Dt===_e.name||Dt===_e.uuid)return _e;if(_e.skeleton){const Vt=_e.skeleton.getBoneByName(Dt);if(Vt!==void 0)return Vt}if(_e.children){const Vt=function(zt){for(let jt=0;jt<zt.length;jt++){const Ht=zt[jt];if(Ht.name===Dt||Ht.uuid===Dt)return Ht;const Wt=Vt(Ht.children);if(Wt)return Wt}return null},Gt=Vt(_e.children);if(Gt)return Gt}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(_e,Dt){_e[Dt]=this.targetObject[this.propertyName]}_getValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)_e[Dt++]=Vt[Gt]}_getValue_arrayElement(_e,Dt){_e[Dt]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(_e,Dt){this.resolvedProperty.toArray(_e,Dt)}_setValue_direct(_e,Dt){this.targetObject[this.propertyName]=_e[Dt]}_setValue_direct_setNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++]}_setValue_array_setNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt]}_setValue_arrayElement_setNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(_e,Dt){this.resolvedProperty.fromArray(_e,Dt)}_setValue_fromArray_setNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(_e,Dt){this.bind(),this.getValue(_e,Dt)}_setValue_unbound(_e,Dt){this.bind(),this.setValue(_e,Dt)}bind(){let _e=this.node;const Dt=this.parsedPath,Vt=Dt.objectName,Gt=Dt.propertyName;let zt=Dt.propertyIndex;if(_e||(_e=PropertyBinding.findNode(this.rootNode,Dt.nodeName),this.node=_e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!_e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(Vt){let qt=Dt.objectIndex;switch(Vt){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 Xt=0;Xt<_e.length;Xt++)if(_e[Xt].name===qt){qt=Xt;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[Vt]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}_e=_e[Vt]}if(qt!==void 0){if(_e[qt]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,_e);return}_e=_e[qt]}}const jt=_e[Gt];if(jt===void 0){const qt=Dt.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+qt+"."+Gt+" but it wasn't found.",_e);return}let Ht=this.Versioning.None;this.targetObject=_e,_e.needsUpdate!==void 0?Ht=this.Versioning.NeedsUpdate:_e.matrixWorldNeedsUpdate!==void 0&&(Ht=this.Versioning.MatrixWorldNeedsUpdate);let Wt=this.BindingType.Direct;if(zt!==void 0){if(Gt==="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[zt]!==void 0&&(zt=_e.morphTargetDictionary[zt])}Wt=this.BindingType.ArrayElement,this.resolvedProperty=jt,this.propertyIndex=zt}else jt.fromArray!==void 0&&jt.toArray!==void 0?(Wt=this.BindingType.HasFromToArray,this.resolvedProperty=jt):Array.isArray(jt)?(Wt=this.BindingType.EntireArray,this.resolvedProperty=jt):this.propertyName=Gt;this.getValue=this.GetterByBindingType[Wt],this.setValue=this.SetterByBindingTypeAndVersioning[Wt][Ht]}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 Vt=0,Gt=arguments.length;Vt!==Gt;++Vt)_e[arguments[Vt].uuid]=Vt;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const Dt=this;this.stats={objects:{get total(){return Dt._objects.length},get inUse(){return this.total-Dt.nCachedObjects_}},get bindingsPerObject(){return Dt._bindings.length}}}add(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._paths,Gt=this._parsedPaths,zt=this._bindings,jt=zt.length;let Ht,Wt=_e.length,qt=this.nCachedObjects_;for(let Xt=0,Kt=arguments.length;Xt!==Kt;++Xt){const Yt=arguments[Xt],Zt=Yt.uuid;let Jt=Dt[Zt];if(Jt===void 0){Jt=Wt++,Dt[Zt]=Jt,_e.push(Yt);for(let nn=0,rn=jt;nn!==rn;++nn)zt[nn].push(new PropertyBinding(Yt,Vt[nn],Gt[nn]))}else if(Jt<qt){Ht=_e[Jt];const nn=--qt,rn=_e[nn];Dt[rn.uuid]=Jt,_e[Jt]=rn,Dt[Zt]=nn,_e[nn]=Yt;for(let Qt=0,en=jt;Qt!==en;++Qt){const tn=zt[Qt],sn=tn[nn];let cn=tn[Jt];tn[Jt]=sn,cn===void 0&&(cn=new PropertyBinding(Yt,Vt[Qt],Gt[Qt])),tn[nn]=cn}}else _e[Jt]!==Ht&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=qt}remove(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_;for(let jt=0,Ht=arguments.length;jt!==Ht;++jt){const Wt=arguments[jt],qt=Wt.uuid,Xt=Dt[qt];if(Xt!==void 0&&Xt>=zt){const Kt=zt++,Yt=_e[Kt];Dt[Yt.uuid]=Xt,_e[Xt]=Yt,Dt[qt]=Kt,_e[Kt]=Wt;for(let Zt=0,Jt=Gt;Zt!==Jt;++Zt){const nn=Vt[Zt],rn=nn[Kt],Qt=nn[Xt];nn[Xt]=rn,nn[Kt]=Qt}}}this.nCachedObjects_=zt}uncache(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_,jt=_e.length;for(let Ht=0,Wt=arguments.length;Ht!==Wt;++Ht){const qt=arguments[Ht],Xt=qt.uuid,Kt=Dt[Xt];if(Kt!==void 0)if(delete Dt[Xt],Kt<zt){const Yt=--zt,Zt=_e[Yt],Jt=--jt,nn=_e[Jt];Dt[Zt.uuid]=Kt,_e[Kt]=Zt,Dt[nn.uuid]=Yt,_e[Yt]=nn,_e.pop();for(let rn=0,Qt=Gt;rn!==Qt;++rn){const en=Vt[rn],tn=en[Yt],sn=en[Jt];en[Kt]=tn,en[Yt]=sn,en.pop()}}else{const Yt=--jt,Zt=_e[Yt];Yt>0&&(Dt[Zt.uuid]=Kt),_e[Kt]=Zt,_e.pop();for(let Jt=0,nn=Gt;Jt!==nn;++Jt){const rn=Vt[Jt];rn[Kt]=rn[Yt],rn.pop()}}}this.nCachedObjects_=zt}subscribe_(_e,Dt){const Vt=this._bindingsIndicesByPath;let Gt=Vt[_e];const zt=this._bindings;if(Gt!==void 0)return zt[Gt];const jt=this._paths,Ht=this._parsedPaths,Wt=this._objects,qt=Wt.length,Xt=this.nCachedObjects_,Kt=new Array(qt);Gt=zt.length,Vt[_e]=Gt,jt.push(_e),Ht.push(Dt),zt.push(Kt);for(let Yt=Xt,Zt=Wt.length;Yt!==Zt;++Yt){const Jt=Wt[Yt];Kt[Yt]=new PropertyBinding(Jt,_e,Dt)}return Kt}unsubscribe_(_e){const Dt=this._bindingsIndicesByPath,Vt=Dt[_e];if(Vt!==void 0){const Gt=this._paths,zt=this._parsedPaths,jt=this._bindings,Ht=jt.length-1,Wt=jt[Ht],qt=_e[Ht];Dt[qt]=Vt,jt[Vt]=Wt,jt.pop(),zt[Vt]=zt[Ht],zt.pop(),Gt[Vt]=Gt[Ht],Gt.pop()}}}class AnimationAction{constructor(_e,Dt,Vt=null,Gt=Dt.blendMode){this._mixer=_e,this._clip=Dt,this._localRoot=Vt,this.blendMode=Gt;const zt=Dt.tracks,jt=zt.length,Ht=new Array(jt),Wt={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let qt=0;qt!==jt;++qt){const Xt=zt[qt].createInterpolant(null);Ht[qt]=Xt,Xt.settings=Wt}this._interpolantSettings=Wt,this._interpolants=Ht,this._propertyBindings=new Array(jt),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat$1,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,Dt){return this.loop=_e,this.repetitions=Dt,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,Dt,Vt){if(_e.fadeOut(Dt),this.fadeIn(Dt),Vt){const Gt=this._clip.duration,zt=_e._clip.duration,jt=zt/Gt,Ht=Gt/zt;_e.warp(1,jt,Dt),this.warp(Ht,1,Dt)}return this}crossFadeTo(_e,Dt,Vt){return _e.crossFadeFrom(this,Dt,Vt)}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,Dt,Vt){const Gt=this._mixer,zt=Gt.time,jt=this.timeScale;let Ht=this._timeScaleInterpolant;Ht===null&&(Ht=Gt._lendControlInterpolant(),this._timeScaleInterpolant=Ht);const Wt=Ht.parameterPositions,qt=Ht.sampleValues;return Wt[0]=zt,Wt[1]=zt+Vt,qt[0]=_e/jt,qt[1]=Dt/jt,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,Dt,Vt,Gt){if(!this.enabled){this._updateWeight(_e);return}const zt=this._startTime;if(zt!==null){const Wt=(_e-zt)*Vt;Wt<0||Vt===0?Dt=0:(this._startTime=null,Dt=Vt*Wt)}Dt*=this._updateTimeScale(_e);const jt=this._updateTime(Dt),Ht=this._updateWeight(_e);if(Ht>0){const Wt=this._interpolants,qt=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulateAdditive(Ht);break;case NormalAnimationBlendMode:default:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulate(Gt,Ht)}}}_updateWeight(_e){let Dt=0;if(this.enabled){Dt=this.weight;const Vt=this._weightInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopFading(),Gt===0&&(this.enabled=!1))}}return this._effectiveWeight=Dt,Dt}_updateTimeScale(_e){let Dt=0;if(!this.paused){Dt=this.timeScale;const Vt=this._timeScaleInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopWarping(),Dt===0?this.paused=!0:this.timeScale=Dt)}}return this._effectiveTimeScale=Dt,Dt}_updateTime(_e){const Dt=this._clip.duration,Vt=this.loop;let Gt=this.time+_e,zt=this._loopCount;const jt=Vt===LoopPingPong;if(_e===0)return zt===-1?Gt:jt&&(zt&1)===1?Dt-Gt:Gt;if(Vt===LoopOnce$1){zt===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(Gt>=Dt)Gt=Dt;else if(Gt<0)Gt=0;else{this.time=Gt;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e<0?-1:1})}}else{if(zt===-1&&(_e>=0?(zt=0,this._setEndings(!0,this.repetitions===0,jt)):this._setEndings(this.repetitions===0,!0,jt)),Gt>=Dt||Gt<0){const Ht=Math.floor(Gt/Dt);Gt-=Dt*Ht,zt+=Math.abs(Ht);const Wt=this.repetitions-zt;if(Wt<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,Gt=_e>0?Dt:0,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e>0?1:-1});else{if(Wt===1){const qt=_e<0;this._setEndings(qt,!qt,jt)}else this._setEndings(!1,!1,jt);this._loopCount=zt,this.time=Gt,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:Ht})}}else this.time=Gt;if(jt&&(zt&1)===1)return Dt-Gt}return Gt}_setEndings(_e,Dt,Vt){const Gt=this._interpolantSettings;Vt?(Gt.endingStart=ZeroSlopeEnding,Gt.endingEnd=ZeroSlopeEnding):(_e?Gt.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingStart=WrapAroundEnding,Dt?Gt.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingEnd=WrapAroundEnding)}_scheduleFading(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time;let jt=this._weightInterpolant;jt===null&&(jt=Gt._lendControlInterpolant(),this._weightInterpolant=jt);const Ht=jt.parameterPositions,Wt=jt.sampleValues;return Ht[0]=zt,Wt[0]=Dt,Ht[1]=zt+_e,Wt[1]=Vt,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher$2{constructor(_e){super(),this._root=_e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(_e,Dt){const Vt=_e._localRoot||this._root,Gt=_e._clip.tracks,zt=Gt.length,jt=_e._propertyBindings,Ht=_e._interpolants,Wt=Vt.uuid,qt=this._bindingsByRootAndName;let Xt=qt[Wt];Xt===void 0&&(Xt={},qt[Wt]=Xt);for(let Kt=0;Kt!==zt;++Kt){const Yt=Gt[Kt],Zt=Yt.name;let Jt=Xt[Zt];if(Jt!==void 0)++Jt.referenceCount,jt[Kt]=Jt;else{if(Jt=jt[Kt],Jt!==void 0){Jt._cacheIndex===null&&(++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt));continue}const nn=Dt&&Dt._propertyBindings[Kt].binding.parsedPath;Jt=new PropertyMixer(PropertyBinding.create(Vt,Zt,nn),Yt.ValueTypeName,Yt.getValueSize()),++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt),jt[Kt]=Jt}Ht[Kt].resultBuffer=Jt.buffer}}_activateAction(_e){if(!this._isActiveAction(_e)){if(_e._cacheIndex===null){const Vt=(_e._localRoot||this._root).uuid,Gt=_e._clip.uuid,zt=this._actionsByClip[Gt];this._bindAction(_e,zt&&zt.knownActions[0]),this._addInactiveAction(_e,Gt,Vt)}const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];zt.useCount++===0&&(this._lendBinding(zt),zt.saveOriginalState())}this._lendAction(_e)}}_deactivateAction(_e){if(this._isActiveAction(_e)){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.useCount===0&&(zt.restoreOriginalState(),this._takeBackBinding(zt))}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 Dt=_e._cacheIndex;return Dt!==null&&Dt<this._nActiveActions}_addInactiveAction(_e,Dt,Vt){const Gt=this._actions,zt=this._actionsByClip;let jt=zt[Dt];if(jt===void 0)jt={knownActions:[_e],actionByRoot:{}},_e._byClipCacheIndex=0,zt[Dt]=jt;else{const Ht=jt.knownActions;_e._byClipCacheIndex=Ht.length,Ht.push(_e)}_e._cacheIndex=Gt.length,Gt.push(_e),jt.actionByRoot[Vt]=_e}_removeInactiveAction(_e){const Dt=this._actions,Vt=Dt[Dt.length-1],Gt=_e._cacheIndex;Vt._cacheIndex=Gt,Dt[Gt]=Vt,Dt.pop(),_e._cacheIndex=null;const zt=_e._clip.uuid,jt=this._actionsByClip,Ht=jt[zt],Wt=Ht.knownActions,qt=Wt[Wt.length-1],Xt=_e._byClipCacheIndex;qt._byClipCacheIndex=Xt,Wt[Xt]=qt,Wt.pop(),_e._byClipCacheIndex=null;const Kt=Ht.actionByRoot,Yt=(_e._localRoot||this._root).uuid;delete Kt[Yt],Wt.length===0&&delete jt[zt],this._removeInactiveBindingsForAction(_e)}_removeInactiveBindingsForAction(_e){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.referenceCount===0&&this._removeInactiveBinding(zt)}}_lendAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=this._nActiveActions++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=--this._nActiveActions,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_addInactiveBinding(_e,Dt,Vt){const Gt=this._bindingsByRootAndName,zt=this._bindings;let jt=Gt[Dt];jt===void 0&&(jt={},Gt[Dt]=jt),jt[Vt]=_e,_e._cacheIndex=zt.length,zt.push(_e)}_removeInactiveBinding(_e){const Dt=this._bindings,Vt=_e.binding,Gt=Vt.rootNode.uuid,zt=Vt.path,jt=this._bindingsByRootAndName,Ht=jt[Gt],Wt=Dt[Dt.length-1],qt=_e._cacheIndex;Wt._cacheIndex=qt,Dt[qt]=Wt,Dt.pop(),delete Ht[zt],Object.keys(Ht).length===0&&delete jt[Gt]}_lendBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=this._nActiveBindings++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=--this._nActiveBindings,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_lendControlInterpolant(){const _e=this._controlInterpolants,Dt=this._nActiveControlInterpolants++;let Vt=_e[Dt];return Vt===void 0&&(Vt=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer),Vt.__cacheIndex=Dt,_e[Dt]=Vt),Vt}_takeBackControlInterpolant(_e){const Dt=this._controlInterpolants,Vt=_e.__cacheIndex,Gt=--this._nActiveControlInterpolants,zt=Dt[Gt];_e.__cacheIndex=Gt,Dt[Gt]=_e,zt.__cacheIndex=Vt,Dt[Vt]=zt}clipAction(_e,Dt,Vt){const Gt=Dt||this._root,zt=Gt.uuid;let jt=typeof _e=="string"?AnimationClip.findByName(Gt,_e):_e;const Ht=jt!==null?jt.uuid:_e,Wt=this._actionsByClip[Ht];let qt=null;if(Vt===void 0&&(jt!==null?Vt=jt.blendMode:Vt=NormalAnimationBlendMode),Wt!==void 0){const Kt=Wt.actionByRoot[zt];if(Kt!==void 0&&Kt.blendMode===Vt)return Kt;qt=Wt.knownActions[0],jt===null&&(jt=qt._clip)}if(jt===null)return null;const Xt=new AnimationAction(this,jt,Dt,Vt);return this._bindAction(Xt,qt),this._addInactiveAction(Xt,Ht,zt),Xt}existingAction(_e,Dt){const Vt=Dt||this._root,Gt=Vt.uuid,zt=typeof _e=="string"?AnimationClip.findByName(Vt,_e):_e,jt=zt?zt.uuid:_e,Ht=this._actionsByClip[jt];return Ht!==void 0&&Ht.actionByRoot[Gt]||null}stopAllAction(){const _e=this._actions,Dt=this._nActiveActions;for(let Vt=Dt-1;Vt>=0;--Vt)_e[Vt].stop();return this}update(_e){_e*=this.timeScale;const Dt=this._actions,Vt=this._nActiveActions,Gt=this.time+=_e,zt=Math.sign(_e),jt=this._accuIndex^=1;for(let qt=0;qt!==Vt;++qt)Dt[qt]._update(Gt,_e,zt,jt);const Ht=this._bindings,Wt=this._nActiveBindings;for(let qt=0;qt!==Wt;++qt)Ht[qt].apply(jt);return this}setTime(_e){this.time=0;for(let Dt=0;Dt<this._actions.length;Dt++)this._actions[Dt].time=0;return this.update(_e)}getRoot(){return this._root}uncacheClip(_e){const Dt=this._actions,Vt=_e.uuid,Gt=this._actionsByClip,zt=Gt[Vt];if(zt!==void 0){const jt=zt.knownActions;for(let Ht=0,Wt=jt.length;Ht!==Wt;++Ht){const qt=jt[Ht];this._deactivateAction(qt);const Xt=qt._cacheIndex,Kt=Dt[Dt.length-1];qt._cacheIndex=null,qt._byClipCacheIndex=null,Kt._cacheIndex=Xt,Dt[Xt]=Kt,Dt.pop(),this._removeInactiveBindingsForAction(qt)}delete Gt[Vt]}}uncacheRoot(_e){const Dt=_e.uuid,Vt=this._actionsByClip;for(const jt in Vt){const Ht=Vt[jt].actionByRoot,Wt=Ht[Dt];Wt!==void 0&&(this._deactivateAction(Wt),this._removeInactiveAction(Wt))}const Gt=this._bindingsByRootAndName,zt=Gt[Dt];if(zt!==void 0)for(const jt in zt){const Ht=zt[jt];Ht.restoreOriginalState(),this._removeInactiveBinding(Ht)}}uncacheAction(_e,Dt){const Vt=this.existingAction(_e,Dt);Vt!==null&&(this._deactivateAction(Vt),this._removeInactiveAction(Vt))}}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$2{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 Dt=this.uniforms.indexOf(_e);return Dt!==-1&&this.uniforms.splice(Dt,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 Dt=_e.uniforms;this.uniforms.length=0;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Array.isArray(Dt[Vt])?Dt[Vt]:[Dt[Vt]];for(let jt=0;jt<zt.length;jt++)this.uniforms.push(zt[jt].clone())}return this}clone(){return new this.constructor().copy(this)}}class InstancedInterleavedBuffer extends InterleavedBuffer{constructor(_e,Dt,Vt=1){super(_e,Dt),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=Vt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}clone(_e){const Dt=super.clone(_e);return Dt.meshPerAttribute=this.meshPerAttribute,Dt}toJSON(_e){const Dt=super.toJSON(_e);return Dt.isInstancedInterleavedBuffer=!0,Dt.meshPerAttribute=this.meshPerAttribute,Dt}}class GLBufferAttribute{constructor(_e,Dt,Vt,Gt,zt){this.isGLBufferAttribute=!0,this.name="",this.buffer=_e,this.type=Dt,this.itemSize=Vt,this.elementSize=Gt,this.count=zt,this.version=0}set needsUpdate(_e){_e===!0&&this.version++}setBuffer(_e){return this.buffer=_e,this}setType(_e,Dt){return this.type=_e,this.elementSize=Dt,this}setItemSize(_e){return this.itemSize=_e,this}setCount(_e){return this.count=_e,this}}const _matrix=new Matrix4;class Raycaster{constructor(_e,Dt,Vt=0,Gt=1/0){this.ray=new Ray(_e,Dt),this.near=Vt,this.far=Gt,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(_e,Dt){this.ray.set(_e,Dt)}setFromCamera(_e,Dt){Dt.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Dt.matrixWorld),this.ray.direction.set(_e.x,_e.y,.5).unproject(Dt).sub(this.ray.origin).normalize(),this.camera=Dt):Dt.isOrthographicCamera?(this.ray.origin.set(_e.x,_e.y,(Dt.near+Dt.far)/(Dt.near-Dt.far)).unproject(Dt),this.ray.direction.set(0,0,-1).transformDirection(Dt.matrixWorld),this.camera=Dt):console.error("THREE.Raycaster: Unsupported camera type: "+Dt.type)}setFromXRController(_e){return _matrix.identity().extractRotation(_e.matrixWorld),this.ray.origin.setFromMatrixPosition(_e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_matrix),this}intersectObject(_e,Dt=!0,Vt=[]){return intersect(_e,this,Vt,Dt),Vt.sort(ascSort),Vt}intersectObjects(_e,Dt=!0,Vt=[]){for(let Gt=0,zt=_e.length;Gt<zt;Gt++)intersect(_e[Gt],this,Vt,Dt);return Vt.sort(ascSort),Vt}}function ascSort(kt,_e){return kt.distance-_e.distance}function intersect(kt,_e,Dt,Vt){if(kt.layers.test(_e.layers)&&kt.raycast(_e,Dt),Vt===!0){const Gt=kt.children;for(let zt=0,jt=Gt.length;zt<jt;zt++)intersect(Gt[zt],_e,Dt,!0)}}class Spherical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.phi=Dt,this.theta=Vt,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,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Dt*Dt+Vt*Vt),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(_e,Vt),this.phi=Math.acos(clamp$2(Dt/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Cylindrical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.theta=Dt,this.y=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.theta=Dt,this.y=Vt,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,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Vt*Vt),this.theta=Math.atan2(_e,Vt),this.y=Dt,this}clone(){return new this.constructor().copy(this)}}const _vector$4=new Vector2;class Box2{constructor(_e=new Vector2(1/0,1/0),Dt=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=_e,this.max=Dt}set(_e,Dt){return this.min.copy(_e),this.max.copy(Dt),this}setFromPoints(_e){this.makeEmpty();for(let Dt=0,Vt=_e.length;Dt<Vt;Dt++)this.expandByPoint(_e[Dt]);return this}setFromCenterAndSize(_e,Dt){const Vt=_vector$4.copy(Dt).multiplyScalar(.5);return this.min.copy(_e).sub(Vt),this.max.copy(_e).add(Vt),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,Dt){return Dt.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,Dt){return Dt.copy(_e).clamp(this.min,this.max)}distanceToPoint(_e){return this.clampPoint(_e,_vector$4).distanceTo(_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}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,Dt=new Vector3){this.start=_e,this.end=Dt}set(_e,Dt){return this.start.copy(_e),this.end.copy(Dt),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,Dt){return this.delta(Dt).multiplyScalar(_e).add(this.start)}closestPointToPointParameter(_e,Dt){_startP.subVectors(_e,this.start),_startEnd.subVectors(this.end,this.start);const Vt=_startEnd.dot(_startEnd);let zt=_startEnd.dot(_startP)/Vt;return Dt&&(zt=clamp$2(zt,0,1)),zt}closestPointToPoint(_e,Dt,Vt){const Gt=this.closestPointToPointParameter(_e,Dt);return this.delta(Vt).multiplyScalar(Gt).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,Dt){super(),this.light=_e,this.matrixAutoUpdate=!1,this.color=Dt,this.type="SpotLightHelper";const Vt=new BufferGeometry,Gt=[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 jt=0,Ht=1,Wt=32;jt<Wt;jt++,Ht++){const qt=jt/Wt*Math.PI*2,Xt=Ht/Wt*Math.PI*2;Gt.push(Math.cos(qt),Math.sin(qt),1,Math.cos(Xt),Math.sin(Xt),1)}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(Vt,zt),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),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const _e=this.light.distance?this.light.distance:1e3,Dt=_e*Math.tan(this.light.angle);this.cone.scale.set(Dt,Dt,_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 Dt=getBoneList(_e),Vt=new BufferGeometry,Gt=[],zt=[],jt=new Color$1(0,0,1),Ht=new Color$1(0,1,0);for(let qt=0;qt<Dt.length;qt++){const Xt=Dt[qt];Xt.parent&&Xt.parent.isBone&&(Gt.push(0,0,0),Gt.push(0,0,0),zt.push(jt.r,jt.g,jt.b),zt.push(Ht.r,Ht.g,Ht.b))}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Vt.setAttribute("color",new Float32BufferAttribute(zt,3));const Wt=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(Vt,Wt),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=_e,this.bones=Dt,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(_e){const Dt=this.bones,Vt=this.geometry,Gt=Vt.getAttribute("position");_matrixWorldInv.copy(this.root.matrixWorld).invert();for(let zt=0,jt=0;zt<Dt.length;zt++){const Ht=Dt[zt];Ht.parent&&Ht.parent.isBone&&(_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt,_vector$2.x,_vector$2.y,_vector$2.z),_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.parent.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt+1,_vector$2.x,_vector$2.y,_vector$2.z),jt+=2)}Vt.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function getBoneList(kt){const _e=[];kt.isBone===!0&&_e.push(kt);for(let Dt=0;Dt<kt.children.length;Dt++)_e.push.apply(_e,getBoneList(kt.children[Dt]));return _e}class PointLightHelper extends Mesh{constructor(_e,Dt,Vt){const Gt=new SphereGeometry(Dt,4,2),zt=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(Gt,zt),this.light=_e,this.color=Vt,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$1,_color2=new Color$1;class HemisphereLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="HemisphereLightHelper";const Gt=new OctahedronGeometry(Dt);Gt.rotateY(Math.PI*.5),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const zt=Gt.getAttribute("position"),jt=new Float32Array(zt.count*3);Gt.setAttribute("color",new BufferAttribute(jt,3)),this.add(new Mesh(Gt,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 Dt=_e.geometry.getAttribute("color");_color1.copy(this.light.color),_color2.copy(this.light.groundColor);for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){const zt=Vt<Gt/2?_color1:_color2;Dt.setXYZ(Vt,zt.r,zt.g,zt.b)}Dt.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),_e.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GridHelper extends LineSegments{constructor(_e=10,Dt=10,Vt=4473924,Gt=8947848){Vt=new Color$1(Vt),Gt=new Color$1(Gt);const zt=Dt/2,jt=_e/Dt,Ht=_e/2,Wt=[],qt=[];for(let Yt=0,Zt=0,Jt=-Ht;Yt<=Dt;Yt++,Jt+=jt){Wt.push(-Ht,0,Jt,Ht,0,Jt),Wt.push(Jt,0,-Ht,Jt,0,Ht);const nn=Yt===zt?Vt:Gt;nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3}const Xt=new BufferGeometry;Xt.setAttribute("position",new Float32BufferAttribute(Wt,3)),Xt.setAttribute("color",new Float32BufferAttribute(qt,3));const Kt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Xt,Kt),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class PolarGridHelper extends LineSegments{constructor(_e=10,Dt=16,Vt=8,Gt=64,zt=4473924,jt=8947848){zt=new Color$1(zt),jt=new Color$1(jt);const Ht=[],Wt=[];if(Dt>1)for(let Kt=0;Kt<Dt;Kt++){const Yt=Kt/Dt*(Math.PI*2),Zt=Math.sin(Yt)*_e,Jt=Math.cos(Yt)*_e;Ht.push(0,0,0),Ht.push(Zt,0,Jt);const nn=Kt&1?zt:jt;Wt.push(nn.r,nn.g,nn.b),Wt.push(nn.r,nn.g,nn.b)}for(let Kt=0;Kt<Vt;Kt++){const Yt=Kt&1?zt:jt,Zt=_e-_e/Vt*Kt;for(let Jt=0;Jt<Gt;Jt++){let nn=Jt/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt;Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b),nn=(Jt+1)/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt,Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b)}}const qt=new BufferGeometry;qt.setAttribute("position",new Float32BufferAttribute(Ht,3)),qt.setAttribute("color",new Float32BufferAttribute(Wt,3));const Xt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(qt,Xt),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const _v1=new Vector3,_v2$5=new Vector3,_v3=new Vector3;class DirectionalLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="DirectionalLightHelper",Dt===void 0&&(Dt=1);let Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute([-Dt,Dt,0,Dt,Dt,0,Dt,-Dt,0,-Dt,-Dt,0,-Dt,Dt,0],3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(Gt,zt),this.add(this.lightPlane),Gt=new BufferGeometry,Gt.setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(Gt,zt),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$5.setFromMatrixPosition(this.light.target.matrixWorld),_v3.subVectors(_v2$5,_v1),this.lightPlane.lookAt(_v2$5),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$5),this.targetLine.scale.z=_v3.length()}}const _vector=new Vector3,_camera=new Camera;class CameraHelper extends LineSegments{constructor(_e){const Dt=new BufferGeometry,Vt=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),Gt=[],zt=[],jt={};Ht("n1","n2"),Ht("n2","n4"),Ht("n4","n3"),Ht("n3","n1"),Ht("f1","f2"),Ht("f2","f4"),Ht("f4","f3"),Ht("f3","f1"),Ht("n1","f1"),Ht("n2","f2"),Ht("n3","f3"),Ht("n4","f4"),Ht("p","n1"),Ht("p","n2"),Ht("p","n3"),Ht("p","n4"),Ht("u1","u2"),Ht("u2","u3"),Ht("u3","u1"),Ht("c","t"),Ht("p","c"),Ht("cn1","cn2"),Ht("cn3","cn4"),Ht("cf1","cf2"),Ht("cf3","cf4");function Ht(Jt,nn){Wt(Jt),Wt(nn)}function Wt(Jt){Gt.push(0,0,0),zt.push(0,0,0),jt[Jt]===void 0&&(jt[Jt]=[]),jt[Jt].push(Gt.length/3-1)}Dt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Dt.setAttribute("color",new Float32BufferAttribute(zt,3)),super(Dt,Vt),this.type="CameraHelper",this.camera=_e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=jt,this.update();const qt=new Color$1(16755200),Xt=new Color$1(16711680),Kt=new Color$1(43775),Yt=new Color$1(16777215),Zt=new Color$1(3355443);this.setColors(qt,Xt,Kt,Yt,Zt)}setColors(_e,Dt,Vt,Gt,zt){const Ht=this.geometry.getAttribute("color");Ht.setXYZ(0,_e.r,_e.g,_e.b),Ht.setXYZ(1,_e.r,_e.g,_e.b),Ht.setXYZ(2,_e.r,_e.g,_e.b),Ht.setXYZ(3,_e.r,_e.g,_e.b),Ht.setXYZ(4,_e.r,_e.g,_e.b),Ht.setXYZ(5,_e.r,_e.g,_e.b),Ht.setXYZ(6,_e.r,_e.g,_e.b),Ht.setXYZ(7,_e.r,_e.g,_e.b),Ht.setXYZ(8,_e.r,_e.g,_e.b),Ht.setXYZ(9,_e.r,_e.g,_e.b),Ht.setXYZ(10,_e.r,_e.g,_e.b),Ht.setXYZ(11,_e.r,_e.g,_e.b),Ht.setXYZ(12,_e.r,_e.g,_e.b),Ht.setXYZ(13,_e.r,_e.g,_e.b),Ht.setXYZ(14,_e.r,_e.g,_e.b),Ht.setXYZ(15,_e.r,_e.g,_e.b),Ht.setXYZ(16,_e.r,_e.g,_e.b),Ht.setXYZ(17,_e.r,_e.g,_e.b),Ht.setXYZ(18,_e.r,_e.g,_e.b),Ht.setXYZ(19,_e.r,_e.g,_e.b),Ht.setXYZ(20,_e.r,_e.g,_e.b),Ht.setXYZ(21,_e.r,_e.g,_e.b),Ht.setXYZ(22,_e.r,_e.g,_e.b),Ht.setXYZ(23,_e.r,_e.g,_e.b),Ht.setXYZ(24,Dt.r,Dt.g,Dt.b),Ht.setXYZ(25,Dt.r,Dt.g,Dt.b),Ht.setXYZ(26,Dt.r,Dt.g,Dt.b),Ht.setXYZ(27,Dt.r,Dt.g,Dt.b),Ht.setXYZ(28,Dt.r,Dt.g,Dt.b),Ht.setXYZ(29,Dt.r,Dt.g,Dt.b),Ht.setXYZ(30,Dt.r,Dt.g,Dt.b),Ht.setXYZ(31,Dt.r,Dt.g,Dt.b),Ht.setXYZ(32,Vt.r,Vt.g,Vt.b),Ht.setXYZ(33,Vt.r,Vt.g,Vt.b),Ht.setXYZ(34,Vt.r,Vt.g,Vt.b),Ht.setXYZ(35,Vt.r,Vt.g,Vt.b),Ht.setXYZ(36,Vt.r,Vt.g,Vt.b),Ht.setXYZ(37,Vt.r,Vt.g,Vt.b),Ht.setXYZ(38,Gt.r,Gt.g,Gt.b),Ht.setXYZ(39,Gt.r,Gt.g,Gt.b),Ht.setXYZ(40,zt.r,zt.g,zt.b),Ht.setXYZ(41,zt.r,zt.g,zt.b),Ht.setXYZ(42,zt.r,zt.g,zt.b),Ht.setXYZ(43,zt.r,zt.g,zt.b),Ht.setXYZ(44,zt.r,zt.g,zt.b),Ht.setXYZ(45,zt.r,zt.g,zt.b),Ht.setXYZ(46,zt.r,zt.g,zt.b),Ht.setXYZ(47,zt.r,zt.g,zt.b),Ht.setXYZ(48,zt.r,zt.g,zt.b),Ht.setXYZ(49,zt.r,zt.g,zt.b),Ht.needsUpdate=!0}update(){const _e=this.geometry,Dt=this.pointMap,Vt=1,Gt=1;_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",Dt,_e,_camera,0,0,-1),setPoint("t",Dt,_e,_camera,0,0,1),setPoint("n1",Dt,_e,_camera,-Vt,-Gt,-1),setPoint("n2",Dt,_e,_camera,Vt,-Gt,-1),setPoint("n3",Dt,_e,_camera,-Vt,Gt,-1),setPoint("n4",Dt,_e,_camera,Vt,Gt,-1),setPoint("f1",Dt,_e,_camera,-Vt,-Gt,1),setPoint("f2",Dt,_e,_camera,Vt,-Gt,1),setPoint("f3",Dt,_e,_camera,-Vt,Gt,1),setPoint("f4",Dt,_e,_camera,Vt,Gt,1),setPoint("u1",Dt,_e,_camera,Vt*.7,Gt*1.1,-1),setPoint("u2",Dt,_e,_camera,-Vt*.7,Gt*1.1,-1),setPoint("u3",Dt,_e,_camera,0,Gt*2,-1),setPoint("cf1",Dt,_e,_camera,-Vt,0,1),setPoint("cf2",Dt,_e,_camera,Vt,0,1),setPoint("cf3",Dt,_e,_camera,0,-Gt,1),setPoint("cf4",Dt,_e,_camera,0,Gt,1),setPoint("cn1",Dt,_e,_camera,-Vt,0,-1),setPoint("cn2",Dt,_e,_camera,Vt,0,-1),setPoint("cn3",Dt,_e,_camera,0,-Gt,-1),setPoint("cn4",Dt,_e,_camera,0,Gt,-1),_e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function setPoint(kt,_e,Dt,Vt,Gt,zt,jt){_vector.set(Gt,zt,jt).unproject(Vt);const Ht=_e[kt];if(Ht!==void 0){const Wt=Dt.getAttribute("position");for(let qt=0,Xt=Ht.length;qt<Xt;qt++)Wt.setXYZ(Ht[qt],_vector.x,_vector.y,_vector.z)}}const _box=new Box3;class BoxHelper extends LineSegments{constructor(_e,Dt=16776960){const Vt=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]),Gt=new Float32Array(8*3),zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,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.setFromObject(this.object),_box.isEmpty())return;const Dt=_box.min,Vt=_box.max,Gt=this.geometry.attributes.position,zt=Gt.array;zt[0]=Vt.x,zt[1]=Vt.y,zt[2]=Vt.z,zt[3]=Dt.x,zt[4]=Vt.y,zt[5]=Vt.z,zt[6]=Dt.x,zt[7]=Dt.y,zt[8]=Vt.z,zt[9]=Vt.x,zt[10]=Dt.y,zt[11]=Vt.z,zt[12]=Vt.x,zt[13]=Vt.y,zt[14]=Dt.z,zt[15]=Dt.x,zt[16]=Vt.y,zt[17]=Dt.z,zt[18]=Dt.x,zt[19]=Dt.y,zt[20]=Dt.z,zt[21]=Vt.x,zt[22]=Dt.y,zt[23]=Dt.z,Gt.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(_e){return this.object=_e,this.update(),this}copy(_e,Dt){return super.copy(_e,Dt),this.object=_e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Box3Helper extends LineSegments{constructor(_e,Dt=16776960){const Vt=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]),Gt=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new Float32BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.box=_e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(_e){const Dt=this.box;Dt.isEmpty()||(Dt.getCenter(this.position),Dt.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(_e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class PlaneHelper extends Line{constructor(_e,Dt=1,Vt=16776960){const Gt=Vt,zt=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],jt=new BufferGeometry;jt.setAttribute("position",new Float32BufferAttribute(zt,3)),jt.computeBoundingSphere(),super(jt,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.type="PlaneHelper",this.plane=_e,this.size=Dt;const Ht=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],Wt=new BufferGeometry;Wt.setAttribute("position",new Float32BufferAttribute(Ht,3)),Wt.computeBoundingSphere(),this.add(new Mesh(Wt,new MeshBasicMaterial({color:Gt,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),Dt=new Vector3(0,0,0),Vt=1,Gt=16776960,zt=Vt*.2,jt=zt*.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(Dt),this.line=new Line(_lineGeometry,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(_coneGeometry,new MeshBasicMaterial({color:Gt,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(_e),this.setLength(Vt,zt,jt)}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 Dt=Math.acos(_e.y);this.quaternion.setFromAxisAngle(_axis,Dt)}}setLength(_e,Dt=_e*.2,Vt=Dt*.2){this.line.scale.set(1,Math.max(1e-4,_e-Dt),1),this.line.updateMatrix(),this.cone.scale.set(Vt,Dt,Vt),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 Dt=[0,0,0,_e,0,0,0,0,0,0,_e,0,0,0,0,0,0,_e],Vt=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute(Dt,3)),Gt.setAttribute("color",new Float32BufferAttribute(Vt,3));const zt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Gt,zt),this.type="AxesHelper"}setColors(_e,Dt,Vt){const Gt=new Color$1,zt=this.geometry.attributes.color.array;return Gt.set(_e),Gt.toArray(zt,0),Gt.toArray(zt,3),Gt.set(Dt),Gt.toArray(zt,6),Gt.toArray(zt,9),Gt.set(Vt),Gt.toArray(zt,12),Gt.toArray(zt,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$1,this.subPaths=[],this.currentPath=null}moveTo(_e,Dt){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(_e,Dt),this}lineTo(_e,Dt){return this.currentPath.lineTo(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){return this.currentPath.quadraticCurveTo(_e,Dt,Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){return this.currentPath.bezierCurveTo(_e,Dt,Vt,Gt,zt,jt),this}splineThru(_e){return this.currentPath.splineThru(_e),this}toShapes(_e){function Dt(Qt){const en=[];for(let tn=0,sn=Qt.length;tn<sn;tn++){const cn=Qt[tn],un=new Shape;un.curves=cn.curves,en.push(un)}return en}function Vt(Qt,en){const tn=en.length;let sn=!1;for(let cn=tn-1,un=0;un<tn;cn=un++){let hn=en[cn],dn=en[un],pn=dn.x-hn.x,fn=dn.y-hn.y;if(Math.abs(fn)>Number.EPSILON){if(fn<0&&(hn=en[un],pn=-pn,dn=en[cn],fn=-fn),Qt.y<hn.y||Qt.y>dn.y)continue;if(Qt.y===hn.y){if(Qt.x===hn.x)return!0}else{const mn=fn*(Qt.x-hn.x)-pn*(Qt.y-hn.y);if(mn===0)return!0;if(mn<0)continue;sn=!sn}}else{if(Qt.y!==hn.y)continue;if(dn.x<=Qt.x&&Qt.x<=hn.x||hn.x<=Qt.x&&Qt.x<=dn.x)return!0}}return sn}const Gt=ShapeUtils.isClockWise,zt=this.subPaths;if(zt.length===0)return[];let jt,Ht,Wt;const qt=[];if(zt.length===1)return Ht=zt[0],Wt=new Shape,Wt.curves=Ht.curves,qt.push(Wt),qt;let Xt=!Gt(zt[0].getPoints());Xt=_e?!Xt:Xt;const Kt=[],Yt=[];let Zt=[],Jt=0,nn;Yt[Jt]=void 0,Zt[Jt]=[];for(let Qt=0,en=zt.length;Qt<en;Qt++)Ht=zt[Qt],nn=Ht.getPoints(),jt=Gt(nn),jt=_e?!jt:jt,jt?(!Xt&&Yt[Jt]&&Jt++,Yt[Jt]={s:new Shape,p:nn},Yt[Jt].s.curves=Ht.curves,Xt&&Jt++,Zt[Jt]=[]):Zt[Jt].push({h:Ht,p:nn[0]});if(!Yt[0])return Dt(zt);if(Yt.length>1){let Qt=!1,en=0;for(let tn=0,sn=Yt.length;tn<sn;tn++)Kt[tn]=[];for(let tn=0,sn=Yt.length;tn<sn;tn++){const cn=Zt[tn];for(let un=0;un<cn.length;un++){const hn=cn[un];let dn=!0;for(let pn=0;pn<Yt.length;pn++)Vt(hn.p,Yt[pn].p)&&(tn!==pn&&en++,dn?(dn=!1,Kt[pn].push(hn)):Qt=!0);dn&&Kt[tn].push(hn)}}en>0&&Qt===!1&&(Zt=Kt)}let rn;for(let Qt=0,en=Yt.length;Qt<en;Qt++){Wt=Yt[Qt].s,qt.push(Wt),rn=Zt[Qt];for(let tn=0,sn=rn.length;tn<sn;tn++)Wt.holes.push(rn[tn].h)}return qt}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(_e=1,Dt=1,Vt=1,Gt={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(_e,Dt,{...Gt,count:Vt}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}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$1=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AgXToneMapping,AlphaFormat,AlwaysCompare,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,BatchedMesh,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleGeometry,ClampToEdgeWrapping,Clock,Color:Color$1,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DisplayP3ColorSpace,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualCompare,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher:EventDispatcher$2,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Float32BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterCompare,GreaterDepth,GreaterEqualCompare,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HalfFloatType,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,Layers,LessCompare,LessDepth,LessEqualCompare,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearDisplayP3ColorSpace,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace:LinearSRGBColorSpace$1,LinearToneMapping,LinearTransfer,Loader,LoaderUtils,LoadingManager,LoopOnce:LoopOnce$1,LoopPingPong,LoopRepeat:LoopRepeat$1,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,NeutralToneMapping,NeverCompare,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualCompare,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronGeometry,OneFactor,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,P3Primaries,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RED_GREEN_RGTC2_Format,RED_RGTC1_Format,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_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,Rec709Primaries,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RenderTarget,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingGeometry,SIGNED_RED_GREEN_RGTC2_Format,SIGNED_RED_RGTC1_Format,SRGBColorSpace:SRGBColorSpace$1,SRGBTransfer,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronGeometry,Texture,TextureLoader,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedInt5999Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCoordinateSystem,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,createCanvasElement},Symbol.toStringTag,{value:"Module"})),hotspotIdPrefix="rd",hotspotIdSeparator="_",EMISSIVE_COLOR_WITH_MAP=new Color$1(50,50,50).convertSRGBToLinear(),EMISSIVE_COLOR_WITHOUT_MAP=new Color$1(255,255,255);function generateHotspotAbsoluteID(kt,_e){return`${hotspotIdPrefix}${hotspotIdSeparator}${kt}${hotspotIdSeparator}${_e}`}async function wait(kt){return LOGGER$1.info({title:`Waiting for ${kt}ms`}),new Promise((_e,Dt)=>{setTimeout(()=>{_e(!0)},kt)})}function compareObjects(kt,_e){if(kt===null||_e===null)return!1;for(let Dt in kt)if(kt.hasOwnProperty(Dt)&&_e.hasOwnProperty(Dt)&&kt[Dt]!==_e[Dt])return!1;return Object.keys(kt).length===Object.keys(_e).length}const capitalize$1=kt=>kt&&kt[0].toUpperCase()+kt.slice(1)||"",mobileCheck=function(){let kt=!1;return function(_e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(_e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(_e.substr(0,4)))&&(kt=!0)}(navigator.userAgent||navigator.vendor||window.opera),kt};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const kt=navigator.userAgent.toLowerCase(),_e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(kt);return _e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(kt){let _e={data:null,report:"",success:!1};try{const Vt=await(await fetch(kt)).text();_e.data=JSON.parse(Vt),_e.success=!0,_e.report="Successfully fetched JSON data."}catch(Dt){_e.report=Dt,_e.success=!1}return _e}const addVector=(kt,_e)=>new Vector3(kt[0]+_e[0],kt[1]+_e[1],kt[2]+_e[2]),Vec3ToArr=kt=>[kt.x,kt.y,kt.z],ArrToVec3=kt=>new Vector3(kt[0],kt[1],kt[2]),numberWithCommas=kt=>kt.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),applyEmissiveColor=kt=>{kt.emissiveMap!==null?kt.emissive.set(EMISSIVE_COLOR_WITH_MAP):kt.emissive.set(EMISSIVE_COLOR_WITHOUT_MAP)},findMeshAndCloneMatFromScene=(kt,_e,Dt=!0,Vt=!1)=>{let Gt=[],zt=!1;const jt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,Ht=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return _e.traverse(Wt=>{Wt.isMesh&&(Wt.material.userData.cloned?Dt&&Vt&&Wt.material.userData.originalEmissive!=null?(Wt.material.emissive.copy(Wt.material.userData.originalEmissive),Wt.material.emissiveIntensity=Wt.material.userData.originalEmissiveIntensity??0,zt=!0):Wt.material.userData.inStock!==Dt?(Dt?(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material.emissive.set(new Color$1(jt.r,jt.g,jt.b)),Wt.material.emissiveIntensity=Ht),Wt.material.userData.inStock=Dt):Dt&&!Vt&&(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material=Wt.material.clone(),Wt.material.userData.inStock=Dt,Wt.material.userData.cloned=!0,Dt?(Wt.material.userData.originalEmissive==null&&(Wt.material.userData.originalEmissive=Wt.material.emissive?.clone(),Wt.material.userData.originalEmissiveIntensity=Wt.material.emissiveIntensity),applyEmissiveColor(Wt.material),Wt.material.emissiveIntensity=0):(Wt.material.emissive.set(new Color$1(jt.r,jt.g,jt.b)),Wt.material.emissiveIntensity=Ht)),Gt.push(Wt))}),{meshArr:Gt,restored:zt}},filterArrWithCondition=(kt,_e)=>{let Dt=0,Vt=[];for(let Gt=0;Gt<kt.length;Gt++){const zt=kt[Gt];_e(zt)?kt[Dt++]=zt:Vt.push(kt[Gt])}return kt.length=Dt,Vt},degToRad=kt=>kt*Math.PI/180,resolveAssetUrl=kt=>{if(!kt)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(kt))return kt;let Vt=kt;return Vt=Vt.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),Vt=Vt.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),Vt};function componentToHex(kt){let _e=kt.toString(16);return _e.length==1?"0"+_e:_e}function rgbToHex(kt,_e,Dt){return"#"+componentToHex(kt)+componentToHex(_e)+componentToHex(Dt)}function getUrlParameterByName(kt,_e=window.location.search){const Dt=new URLSearchParams(_e);return Object.fromEntries(Dt.entries())[kt]}function _dispose3(kt){kt.geometry&&kt.geometry.dispose(),kt.material&&(Array.isArray(kt.material)?kt.material.forEach(_e=>_e.dispose()):kt.material.dispose()),kt.texture&&kt.texture.dispose()}function dispose3(kt){kt.traverse(_e=>{_dispose3(_e)}),_dispose3(kt)}const findVariantForGUID=(kt,_e)=>{const Dt=kt.attachmentStore.getState().attachmentSystem,Gt=kt.itemStore.getState().itemsSpawned[_e];let zt=Dt.currentStructure.getNodeByGUID(_e);if(!zt)return;let jt="";if(zt.overrideVariant)jt=zt.overrideVariant,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ht=Dt.globalVariants;if(!Ht||Ht.Count<=0)return;let Wt=[];Object.keys(Ht).map((qt,Xt)=>{Wt.push(Ht[qt])}),Gt.itemData.looks?.map(qt=>{Wt.includes(qt)&&(jt=qt)}),jt||(jt=Gt.itemData.looks[0])}return jt};function hasCommonElement(kt,_e){for(let Dt of kt)if(_e.includes(Dt))return!0;return!1}const InfoDrawer=({stores:kt,open:_e,dismissDrawer:Dt})=>{const Vt=kt.uiSceneStore(Ht=>Ht.CORE_API),Gt=kt.uiSceneStore(Ht=>Ht.isScreenPortrait),zt=reactExports.useRef(null),jt=kt.infoStore(Ht=>Ht.infoObject);return reactExports.useEffect(()=>{Vt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:_e})},[_e]),reactExports.useEffect(()=>{const{current:Ht}=zt;if(!Ht)return;const Wt=()=>{Dt()};return Ht.addEventListener("drawerClosed",Wt),()=>{Ht.removeEventListener("drawerClosed",Wt)}},[zt]),jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,ref:zt,id:"bottomDrawer",open:`${_e}`,"initial-screen-coverage":"0%",children:jsxRuntimeExports.jsx("div",{tabIndex:_e&&Gt?0:-1,"aria-hidden":!_e||!Gt,className:"infoDrawer epigraphDrawer",slot:"bottom-drawer-content",children:jsxRuntimeExports.jsxs("div",{className:"drawerContent",children:[jsxRuntimeExports.jsxs("a",{href:jt?.productPageUrl,className:"categoryLink",role:"button","aria-label":"Link to Product",target:"_blank",style:jt?.productPageUrl?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"infoDrawerImageContainer",children:jsxRuntimeExports.jsx("img",{className:"itemImage",alt:jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal","aria-label":jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal",src:jt?.thumbnails?.high?Vt.getResolvedAssetUrl(jt.thumbnails.high):"https://placehold.co/150",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):"",jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})})},UtilityMenuButton=({stores:kt,buttonAction:_e,buttonLabel:Dt,hoverLabel:Vt,icon:Gt,activeCondition:zt})=>{const[jt,Ht]=reactExports.useState(zt),Wt=kt.uiSceneStore(Kt=>Kt.dialogPopupOpen),qt=kt.uiSceneStore(Kt=>Kt.isScreenPortrait),Xt=kt.cartStore(Kt=>Kt.previewCartModalOpen);return reactExports.useEffect(()=>(Ht(zt),()=>{}),[zt]),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:!Wt&&(qt&&!Xt||!qt)?0:-1,"aria-hidden":Wt||qt&&Xt,className:jt!==void 0&&jt?"shellButtonContainer active":"shellButtonContainer","aria-label":Dt,onClick:()=>{_e()},children:[jsxRuntimeExports.jsxs("div",{className:"buttonContent",children:[jsxRuntimeExports.jsx("img",{className:"button",src:Gt,alt:"An icon indicating "+Dt+" action.",onError:Kt=>{Kt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:Dt})]}),jsxRuntimeExports.jsx("div",{className:"hoverDescriptor",children:jsxRuntimeExports.jsx("span",{children:Vt})})]})},UtilityMenu=({stores:kt,handleShareButtonTrigger:_e,handleSaveButtonTrigger:Dt,handleRestartButtonClick:Vt,handleShowHotspots:Gt,handleDimensionClick:zt,handleInstructionButtonClick:jt,utilityMenuVisible:Ht,hotspotsVisibility:Wt,viewInYourSpaceMenuBtnVisible:qt,restartMenuBtnVisible:Xt,saveMenuBtnVisible:Kt,hotspotsMenuBtnVisible:Yt,instructionsMenuBtnVisible:Zt,dimensionsMenuBtnVisible:Jt,shareMenuBtnVisible:nn,dimensionsVisible:rn,position:Qt,CORE_API:en})=>{const[tn,sn]=reactExports.useState("bottom"),cn=kt.productDataStore(dn=>dn.assetsData),un=kt.coreSceneStore(dn=>dn.sceneSettings),hn={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(Qt){case"top":sn("top");break;case"bottom":sn("bottom");break;case"left":sn("left");break;case"right":sn("right");break}return()=>{}},[Qt]),jsxRuntimeExports.jsx("div",{className:"shellCanvasContainerParent",id:tn,children:jsxRuntimeExports.jsxs("div",{className:(Ht&&(nn||qt||Xt||Jt||Yt||Zt))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[qt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{en.viewInYourSpace()},buttonLabel:un.textSettings.arButtonLabel,hoverLabel:un.textSettings.arHoverLabel,icon:cn?.icons?.utilityMenu?.viewInYourSpace?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.viewInYourSpace):hn.ar}),Xt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Vt()},buttonLabel:un.textSettings.restartButtonLabel,hoverLabel:un.textSettings.restartHoverLabel,icon:cn?.icons?.utilityMenu?.restart?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.restart):hn.restart}),Kt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Dt()},buttonLabel:un.textSettings.saveButtonLabel,hoverLabel:un.textSettings.saveHoverLabel,icon:cn?.icons?.utilityMenu?.save?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.save):hn.save}),nn&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{_e()},buttonLabel:un.textSettings.shareButtonLabel,hoverLabel:un.textSettings.shareHoverLabel,icon:cn?.icons?.utilityMenu?.share?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.share):hn.share}),Jt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{zt()},buttonLabel:un.textSettings.sizeButtonLabel,hoverLabel:un.textSettings.sizeHoverLabel,icon:cn?.icons?.utilityMenu?.dimensions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.dimensions):hn.dimensions,activeCondition:rn}),Yt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Gt()},buttonLabel:un.textSettings.hotspotsButtonLabel,hoverLabel:un.textSettings.hotspotsHoverLabel,icon:cn?.icons?.utilityMenu?.hotspots?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.hotspots):hn.hotspots,activeCondition:Wt}),Zt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{jt()},buttonLabel:un.textSettings.instructionsButtonLabel,hoverLabel:un.textSettings.instructionsHoverLabel,icon:cn?.icons?.utilityMenu?.instructions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.instructions):hn.instructions})]})})};function makeTypeChecker(kt){return _e=>!!_e.type&&_e.type.tabsRole===kt}const isTab=makeTypeChecker("Tab"),isTabList=makeTypeChecker("TabList"),isTabPanel=makeTypeChecker("TabPanel");function isTabChild(kt){return isTab(kt)||isTabList(kt)||isTabPanel(kt)}function deepMap(kt,_e){return reactExports.Children.map(kt,Dt=>Dt===null?null:isTabChild(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"?reactExports.cloneElement(Dt,{...Dt.props,children:deepMap(Dt.props.children,_e)}):Dt)}function deepForEach(kt,_e){return reactExports.Children.forEach(kt,Dt=>{Dt!==null&&(isTab(Dt)||isTabPanel(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"&&(isTabList(Dt)&&_e(Dt),deepForEach(Dt.props.children,_e)))})}function r$2(kt){var _e,Dt,Vt="";if(typeof kt=="string"||typeof kt=="number")Vt+=kt;else if(typeof kt=="object")if(Array.isArray(kt)){var Gt=kt.length;for(_e=0;_e<Gt;_e++)kt[_e]&&(Dt=r$2(kt[_e]))&&(Vt&&(Vt+=" "),Vt+=Dt)}else for(Dt in kt)kt[Dt]&&(Vt&&(Vt+=" "),Vt+=Dt);return Vt}function clsx(){for(var kt,_e,Dt=0,Vt="",Gt=arguments.length;Dt<Gt;Dt++)(kt=arguments[Dt])&&(_e=r$2(kt))&&(Vt&&(Vt+=" "),Vt+=_e);return Vt}function getTabsCount(kt){let _e=0;return deepForEach(kt,Dt=>{isTab(Dt)&&_e++}),_e}function isNode(kt){return kt&&"getAttribute"in kt}function isTabNode(kt){return isNode(kt)&&kt.getAttribute("data-rttab")}function isTabDisabled(kt){return isNode(kt)&&kt.getAttribute("aria-disabled")==="true"}let canUseActiveElement;function determineCanUseActiveElement(kt){const _e=kt||(typeof window<"u"?window:void 0);try{canUseActiveElement=!!(typeof _e<"u"&&_e.document&&_e.document.activeElement)}catch{canUseActiveElement=!1}}const defaultProps$4={className:"react-tabs",focus:!1},UncontrolledTabs=kt=>{let _e=reactExports.useRef([]),Dt=reactExports.useRef([]);const Vt=reactExports.useRef();function Gt(_n,En){if(_n<0||_n>=qt())return;const{onSelect:An,selectedIndex:Tn}=kt;An(_n,Tn,En)}function zt(_n){const En=qt();for(let An=_n+1;An<En;An++)if(!isTabDisabled(Xt(An)))return An;for(let An=0;An<_n;An++)if(!isTabDisabled(Xt(An)))return An;return _n}function jt(_n){let En=_n;for(;En--;)if(!isTabDisabled(Xt(En)))return En;for(En=qt();En-- >_n;)if(!isTabDisabled(Xt(En)))return En;return _n}function Ht(){const _n=qt();for(let En=0;En<_n;En++)if(!isTabDisabled(Xt(En)))return En;return null}function Wt(){let _n=qt();for(;_n--;)if(!isTabDisabled(Xt(_n)))return _n;return null}function qt(){const{children:_n}=kt;return getTabsCount(_n)}function Xt(_n){return _e.current[`tabs-${_n}`]}function Kt(){let _n=0;const{children:En,disabledTabClassName:An,focus:Tn,forceRenderTabPanel:Cn,selectedIndex:yn,selectedTabClassName:Sn,selectedTabPanelClassName:wn,environment:xn}=kt;Dt.current=Dt.current||[];let Rn=Dt.current.length-qt();const Dn=reactExports.useId();for(;Rn++<0;)Dt.current.push(`${Dn}${Dt.current.length}`);return deepMap(En,kn=>{let Fn=kn;if(isTabList(kn)){let Pn=0,Bn=!1;canUseActiveElement==null&&determineCanUseActiveElement(xn);const qn=xn||(typeof window<"u"?window:void 0);canUseActiveElement&&qn&&(Bn=React.Children.toArray(kn.props.children).filter(isTab).some((tr,lr)=>qn.document.activeElement===Xt(lr))),Fn=reactExports.cloneElement(kn,{children:deepMap(kn.props.children,tr=>{const lr=`tabs-${Pn}`,zn=yn===Pn,ur={tabRef:Hn=>{_e.current[lr]=Hn},id:Dt.current[Pn],selected:zn,focus:zn&&(Tn||Bn)};return Sn&&(ur.selectedClassName=Sn),An&&(ur.disabledClassName=An),Pn++,reactExports.cloneElement(tr,ur)})})}else if(isTabPanel(kn)){const Pn={id:Dt.current[_n],selected:yn===_n};Cn&&(Pn.forceRender=Cn),wn&&(Pn.selectedClassName=wn),_n++,Fn=reactExports.cloneElement(kn,Pn)}return Fn})}function Yt(_n){const{direction:En,disableUpDownKeys:An,disableLeftRightKeys:Tn}=kt;if(Jt(_n.target)){let{selectedIndex:Cn}=kt,yn=!1,Sn=!1;(_n.code==="Space"||_n.keyCode===32||_n.code==="Enter"||_n.keyCode===13)&&(yn=!0,Sn=!1,Zt(_n)),!Tn&&(_n.keyCode===37||_n.code==="ArrowLeft")||!An&&(_n.keyCode===38||_n.code==="ArrowUp")?(En==="rtl"?Cn=zt(Cn):Cn=jt(Cn),yn=!0,Sn=!0):!Tn&&(_n.keyCode===39||_n.code==="ArrowRight")||!An&&(_n.keyCode===40||_n.code==="ArrowDown")?(En==="rtl"?Cn=jt(Cn):Cn=zt(Cn),yn=!0,Sn=!0):_n.keyCode===35||_n.code==="End"?(Cn=Wt(),yn=!0,Sn=!0):(_n.keyCode===36||_n.code==="Home")&&(Cn=Ht(),yn=!0,Sn=!0),yn&&_n.preventDefault(),Sn&&Gt(Cn,_n)}}function Zt(_n){let En=_n.target;do if(Jt(En)){if(isTabDisabled(En))return;const An=[].slice.call(En.parentNode.children).filter(isTabNode).indexOf(En);Gt(An,_n);return}while((En=En.parentNode)!=null)}function Jt(_n){if(!isTabNode(_n))return!1;let En=_n.parentElement;do{if(En===Vt.current)return!0;if(En.getAttribute("data-rttabs"))break;En=En.parentElement}while(En);return!1}const{children:nn,className:rn,disabledTabClassName:Qt,domRef:en,focus:tn,forceRenderTabPanel:sn,onSelect:cn,selectedIndex:un,selectedTabClassName:hn,selectedTabPanelClassName:dn,environment:pn,disableUpDownKeys:fn,disableLeftRightKeys:mn,...vn}={...defaultProps$4,...kt};return React.createElement("div",Object.assign({},vn,{className:clsx(rn),onClick:Zt,onKeyDown:Yt,ref:_n=>{Vt.current=_n,en&&en(_n)},"data-rttabs":!0}),Kt())};UncontrolledTabs.propTypes={};const MODE_CONTROLLED=0,MODE_UNCONTROLLED=1,defaultProps$3={defaultFocus:!1,focusTabOnClick:!0,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null,environment:null,disableUpDownKeys:!1,disableLeftRightKeys:!1},getModeFromProps=kt=>kt.selectedIndex===null?MODE_UNCONTROLLED:MODE_CONTROLLED,Tabs=kt=>{const{children:_e,defaultFocus:Dt,defaultIndex:Vt,focusTabOnClick:Gt,onSelect:zt,...jt}={...defaultProps$3,...kt},[Ht,Wt]=reactExports.useState(Dt),[qt]=reactExports.useState(getModeFromProps(jt)),[Xt,Kt]=reactExports.useState(qt===MODE_UNCONTROLLED?Vt||0:null);if(reactExports.useEffect(()=>{Wt(!1)},[]),qt===MODE_UNCONTROLLED){const Jt=getTabsCount(_e);reactExports.useEffect(()=>{if(Xt!=null){const nn=Math.max(0,Jt-1);Kt(Math.min(Xt,nn))}},[Jt])}const Yt=(Jt,nn,rn)=>{typeof zt=="function"&&zt(Jt,nn,rn)===!1||(Gt&&Wt(!0),qt===MODE_UNCONTROLLED&&Kt(Jt))};let Zt={...kt,...jt};return Zt.focus=Ht,Zt.onSelect=Yt,Xt!=null&&(Zt.selectedIndex=Xt),delete Zt.defaultFocus,delete Zt.defaultIndex,delete Zt.focusTabOnClick,React.createElement(UncontrolledTabs,Zt,_e)};Tabs.propTypes={};Tabs.tabsRole="Tabs";const defaultProps$2={className:"react-tabs__tab-list"},TabList=kt=>{const{children:_e,className:Dt,...Vt}={...defaultProps$2,...kt};return React.createElement("ul",Object.assign({},Vt,{className:clsx(Dt),role:"tablist"}),_e)};TabList.tabsRole="TabList";TabList.propTypes={};const DEFAULT_CLASS$1="react-tabs__tab",defaultProps$1={className:DEFAULT_CLASS$1,disabledClassName:`${DEFAULT_CLASS$1}--disabled`,focus:!1,id:null,selected:!1,selectedClassName:`${DEFAULT_CLASS$1}--selected`},Tab$1=kt=>{let _e=reactExports.useRef();const{children:Dt,className:Vt,disabled:Gt,disabledClassName:zt,focus:jt,id:Ht,selected:Wt,selectedClassName:qt,tabIndex:Xt,tabRef:Kt,...Yt}={...defaultProps$1,...kt};return reactExports.useEffect(()=>{Wt&&jt&&_e.current.focus()},[Wt,jt]),React.createElement("li",Object.assign({},Yt,{className:clsx(Vt,{[qt]:Wt,[zt]:Gt}),ref:Zt=>{_e.current=Zt,Kt&&Kt(Zt)},role:"tab",id:`tab${Ht}`,"aria-selected":Wt?"true":"false","aria-disabled":Gt?"true":"false","aria-controls":`panel${Ht}`,tabIndex:Xt||(Wt?"0":null),"data-rttab":!0}),Dt)};Tab$1.propTypes={};Tab$1.tabsRole="Tab";const DEFAULT_CLASS="react-tabs__tab-panel",defaultProps={className:DEFAULT_CLASS,forceRender:!1,selectedClassName:`${DEFAULT_CLASS}--selected`},TabPanel=kt=>{const{children:_e,className:Dt,forceRender:Vt,id:Gt,selected:zt,selectedClassName:jt,...Ht}={...defaultProps,...kt};return React.createElement("div",Object.assign({},Ht,{className:clsx(Dt,{[jt]:zt}),role:"tabpanel",id:`panel${Gt}`,"aria-labelledby":`tab${Gt}`}),Vt||zt?_e:null)};TabPanel.tabsRole="TabPanel";TabPanel.propTypes={};const ItemCard=({stores:kt,sideMenuOpen:_e,spawnGhosts:Dt,accordionActive:Vt=!0,spawnItem:Gt,removeAllGhosts:zt,isMouseUsed:jt,skuId:Ht,active:Wt})=>{const qt=kt.uiSceneStore(fr=>fr.CORE_API),Xt=kt.infoStore(fr=>fr.infoModalOpen),Kt=reactExports.useRef(null),Yt=kt.infoStore(fr=>fr.populateInfoObject),Zt=kt.uiSceneStore(fr=>fr.dialogPopupOpen),Jt=kt.cartStore(fr=>fr.previewCartModalOpen),nn=kt.infoStore(fr=>fr.updateInfoModalOpen),[rn,Qt]=reactExports.useState("default"),[en,tn]=reactExports.useState(!0),sn=kt.colorStore(fr=>fr.allActiveVariants),cn=kt.productDataStore(fr=>fr.productData),un=kt.itemStore(fr=>fr.fittingSkuIds),[hn,dn]=reactExports.useState(cn[Ht].incrementDecrementControl?cn[Ht].incrementDecrementControl:!1),[pn,fn]=reactExports.useState(cn[Ht]?cn[Ht]:{}),[mn,vn]=reactExports.useState(cn[Ht].name?cn[Ht].name:"Not Set"),[_n,En]=reactExports.useState(cn[Ht].subheading?cn[Ht].subheading:""),[An,Tn]=reactExports.useState(cn[Ht].lookDetails.default.thumbnails.low?cn[Ht].lookDetails.default.thumbnails.low:""),[Cn,yn]=reactExports.useState(cn[Ht].draggableUI!=null?cn[Ht].draggableUI:kt.uiSceneStore.getState().CORE_API.sceneSettings.draggableUI),[Sn,wn]=reactExports.useState(null),[xn,Rn]=reactExports.useState(!1),[Dn,kn]=reactExports.useState(!1),[Fn,Pn]=reactExports.useState(0),Bn=reactExports.useCallback(()=>{Fn<=0||qt.removeLastItemBySkuId(Ht)},[Fn]),qn=()=>{let fr=0;const Un=kt.itemStore.getState().itemsSpawned,In=Object.keys(Un);for(let jn=In.length-1;jn>=0;jn--){const or=In[jn];Un[or].itemData.skuID===Ht&&fr++}Pn(fr)};reactExports.useEffect(()=>{qn()},[]),addCoreEventListener(kt,qt.EVENTS.SCENE.Items_Updated,qn),reactExports.useEffect(()=>{un.includes(Ht)?Rn(!0):Rn(!1)},[un]),reactExports.useEffect(()=>{Object.keys(cn).length!=0},[cn]),reactExports.useEffect(()=>{pn.looks.length<=1&&tn(!1)},[pn]);const tr=reactExports.useCallback(()=>{const fr=pn.looks;let Un="default";for(const[In,jn]of Object.entries(sn))if(fr.includes(jn)){Un=jn;break}Qt(Un)},[pn,sn]);reactExports.useEffect(()=>{Tn(pn.lookDetails[rn].thumbnails.low)},[pn,rn]),reactExports.useEffect(()=>{en===!0&&tr()},[sn]);const lr=reactExports.useCallback(fr=>{if(fr.stopPropagation(),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)){if(xn===!1||Sn){qt.alert({alertMsg:"Unable to add item to the scene.",alertTime:4e3,alertType:"warn",alertLabel:"Action Unavailable"});return}Gt(Ht,!0)}},[xn,Sn]),zn=reactExports.useCallback(async()=>{const fr=qt.sceneSettings?.showDependencyOnHover;if(fr===void 0||fr===!1)return;let Un=qt.getSpawningRequirementForSkuID(Ht);if(Un.length<=0)return;let In="";const jn=await qt.getCartItemsAsync();let or=!1;if(jn.cartItems.map(cr=>{Un.includes(cr.skuID)&&(or=!0)}),Un.includes("Root")&&Un.length==1&&(or=!0,Un=[]),or)In="No space available to spawn the item.";else{In=`This item requires a dependency to be added to the scene first.
3937
3937
 
3938
3938
  Dependency:
3939
3939
  `;for(const cr of Un)In+=`- ${cr}
@@ -3948,7 +3948,7 @@ void main() {
3948
3948
  License: MIT, header required.
3949
3949
  */var Matrix=function(){var kt=Math.cos,_e=Math.sin,Dt=Math.tan,Vt=Math.round;function Gt(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function zt(yn){if(yn===0)return this;var Sn=kt(yn),wn=_e(yn);return this._t(Sn,-wn,0,0,wn,Sn,0,0,0,0,1,0,0,0,0,1)}function jt(yn){if(yn===0)return this;var Sn=kt(yn),wn=_e(yn);return this._t(1,0,0,0,0,Sn,-wn,0,0,wn,Sn,0,0,0,0,1)}function Ht(yn){if(yn===0)return this;var Sn=kt(yn),wn=_e(yn);return this._t(Sn,0,wn,0,0,1,0,0,-wn,0,Sn,0,0,0,0,1)}function Wt(yn){if(yn===0)return this;var Sn=kt(yn),wn=_e(yn);return this._t(Sn,-wn,0,0,wn,Sn,0,0,0,0,1,0,0,0,0,1)}function qt(yn,Sn){return this._t(1,Sn,yn,1,0,0)}function Xt(yn,Sn){return this.shear(Dt(yn),Dt(Sn))}function Kt(yn,Sn){var wn=kt(Sn),xn=_e(Sn);return this._t(wn,xn,0,0,-xn,wn,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,Dt(yn),1,0,0,0,0,1,0,0,0,0,1)._t(wn,-xn,0,0,xn,wn,0,0,0,0,1,0,0,0,0,1)}function Yt(yn,Sn,wn){return!wn&&wn!==0&&(wn=1),yn===1&&Sn===1&&wn===1?this:this._t(yn,0,0,0,0,Sn,0,0,0,0,wn,0,0,0,0,1)}function Zt(yn,Sn,wn,xn,Rn,Dn,kn,Fn,Pn,Bn,qn,tr,lr,zn,ur,Hn){return this.props[0]=yn,this.props[1]=Sn,this.props[2]=wn,this.props[3]=xn,this.props[4]=Rn,this.props[5]=Dn,this.props[6]=kn,this.props[7]=Fn,this.props[8]=Pn,this.props[9]=Bn,this.props[10]=qn,this.props[11]=tr,this.props[12]=lr,this.props[13]=zn,this.props[14]=ur,this.props[15]=Hn,this}function Jt(yn,Sn,wn){return wn=wn||0,yn!==0||Sn!==0||wn!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,yn,Sn,wn,1):this}function nn(yn,Sn,wn,xn,Rn,Dn,kn,Fn,Pn,Bn,qn,tr,lr,zn,ur,Hn){var sr=this.props;if(yn===1&&Sn===0&&wn===0&&xn===0&&Rn===0&&Dn===1&&kn===0&&Fn===0&&Pn===0&&Bn===0&&qn===1&&tr===0)return sr[12]=sr[12]*yn+sr[15]*lr,sr[13]=sr[13]*Dn+sr[15]*zn,sr[14]=sr[14]*qn+sr[15]*ur,sr[15]*=Hn,this._identityCalculated=!1,this;var vr=sr[0],fr=sr[1],Un=sr[2],In=sr[3],jn=sr[4],or=sr[5],cr=sr[6],ar=sr[7],gr=sr[8],mr=sr[9],Ar=sr[10],Lr=sr[11],Cr=sr[12],Rr=sr[13],zr=sr[14],Pr=sr[15];return sr[0]=vr*yn+fr*Rn+Un*Pn+In*lr,sr[1]=vr*Sn+fr*Dn+Un*Bn+In*zn,sr[2]=vr*wn+fr*kn+Un*qn+In*ur,sr[3]=vr*xn+fr*Fn+Un*tr+In*Hn,sr[4]=jn*yn+or*Rn+cr*Pn+ar*lr,sr[5]=jn*Sn+or*Dn+cr*Bn+ar*zn,sr[6]=jn*wn+or*kn+cr*qn+ar*ur,sr[7]=jn*xn+or*Fn+cr*tr+ar*Hn,sr[8]=gr*yn+mr*Rn+Ar*Pn+Lr*lr,sr[9]=gr*Sn+mr*Dn+Ar*Bn+Lr*zn,sr[10]=gr*wn+mr*kn+Ar*qn+Lr*ur,sr[11]=gr*xn+mr*Fn+Ar*tr+Lr*Hn,sr[12]=Cr*yn+Rr*Rn+zr*Pn+Pr*lr,sr[13]=Cr*Sn+Rr*Dn+zr*Bn+Pr*zn,sr[14]=Cr*wn+Rr*kn+zr*qn+Pr*ur,sr[15]=Cr*xn+Rr*Fn+zr*tr+Pr*Hn,this._identityCalculated=!1,this}function rn(yn){var Sn=yn.props;return this.transform(Sn[0],Sn[1],Sn[2],Sn[3],Sn[4],Sn[5],Sn[6],Sn[7],Sn[8],Sn[9],Sn[10],Sn[11],Sn[12],Sn[13],Sn[14],Sn[15])}function Qt(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function en(yn){for(var Sn=0;Sn<16;){if(yn.props[Sn]!==this.props[Sn])return!1;Sn+=1}return!0}function tn(yn){var Sn;for(Sn=0;Sn<16;Sn+=1)yn.props[Sn]=this.props[Sn];return yn}function sn(yn){var Sn;for(Sn=0;Sn<16;Sn+=1)this.props[Sn]=yn[Sn]}function cn(yn,Sn,wn){return{x:yn*this.props[0]+Sn*this.props[4]+wn*this.props[8]+this.props[12],y:yn*this.props[1]+Sn*this.props[5]+wn*this.props[9]+this.props[13],z:yn*this.props[2]+Sn*this.props[6]+wn*this.props[10]+this.props[14]}}function un(yn,Sn,wn){return yn*this.props[0]+Sn*this.props[4]+wn*this.props[8]+this.props[12]}function hn(yn,Sn,wn){return yn*this.props[1]+Sn*this.props[5]+wn*this.props[9]+this.props[13]}function dn(yn,Sn,wn){return yn*this.props[2]+Sn*this.props[6]+wn*this.props[10]+this.props[14]}function pn(){var yn=this.props[0]*this.props[5]-this.props[1]*this.props[4],Sn=this.props[5]/yn,wn=-this.props[1]/yn,xn=-this.props[4]/yn,Rn=this.props[0]/yn,Dn=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/yn,kn=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/yn,Fn=new Matrix;return Fn.props[0]=Sn,Fn.props[1]=wn,Fn.props[4]=xn,Fn.props[5]=Rn,Fn.props[12]=Dn,Fn.props[13]=kn,Fn}function fn(yn){var Sn=this.getInverseMatrix();return Sn.applyToPointArray(yn[0],yn[1],yn[2]||0)}function mn(yn){var Sn,wn=yn.length,xn=[];for(Sn=0;Sn<wn;Sn+=1)xn[Sn]=fn(yn[Sn]);return xn}function vn(yn,Sn,wn){var xn=createTypedArray("float32",6);if(this.isIdentity())xn[0]=yn[0],xn[1]=yn[1],xn[2]=Sn[0],xn[3]=Sn[1],xn[4]=wn[0],xn[5]=wn[1];else{var Rn=this.props[0],Dn=this.props[1],kn=this.props[4],Fn=this.props[5],Pn=this.props[12],Bn=this.props[13];xn[0]=yn[0]*Rn+yn[1]*kn+Pn,xn[1]=yn[0]*Dn+yn[1]*Fn+Bn,xn[2]=Sn[0]*Rn+Sn[1]*kn+Pn,xn[3]=Sn[0]*Dn+Sn[1]*Fn+Bn,xn[4]=wn[0]*Rn+wn[1]*kn+Pn,xn[5]=wn[0]*Dn+wn[1]*Fn+Bn}return xn}function _n(yn,Sn,wn){var xn;return this.isIdentity()?xn=[yn,Sn,wn]:xn=[yn*this.props[0]+Sn*this.props[4]+wn*this.props[8]+this.props[12],yn*this.props[1]+Sn*this.props[5]+wn*this.props[9]+this.props[13],yn*this.props[2]+Sn*this.props[6]+wn*this.props[10]+this.props[14]],xn}function En(yn,Sn){if(this.isIdentity())return yn+","+Sn;var wn=this.props;return Math.round((yn*wn[0]+Sn*wn[4]+wn[12])*100)/100+","+Math.round((yn*wn[1]+Sn*wn[5]+wn[13])*100)/100}function An(){for(var yn=0,Sn=this.props,wn="matrix3d(",xn=1e4;yn<16;)wn+=Vt(Sn[yn]*xn)/xn,wn+=yn===15?")":",",yn+=1;return wn}function Tn(yn){var Sn=1e4;return yn<1e-6&&yn>0||yn>-1e-6&&yn<0?Vt(yn*Sn)/Sn:yn}function Cn(){var yn=this.props,Sn=Tn(yn[0]),wn=Tn(yn[1]),xn=Tn(yn[4]),Rn=Tn(yn[5]),Dn=Tn(yn[12]),kn=Tn(yn[13]);return"matrix("+Sn+","+wn+","+xn+","+Rn+","+Dn+","+kn+")"}return function(){this.reset=Gt,this.rotate=zt,this.rotateX=jt,this.rotateY=Ht,this.rotateZ=Wt,this.skew=Xt,this.skewFromAxis=Kt,this.shear=qt,this.scale=Yt,this.setTransform=Zt,this.translate=Jt,this.transform=nn,this.multiply=rn,this.applyToPoint=cn,this.applyToX=un,this.applyToY=hn,this.applyToZ=dn,this.applyToPointArray=_n,this.applyToTriplePoints=vn,this.applyToPointStringified=En,this.toCSS=An,this.to2dCSS=Cn,this.clone=tn,this.cloneFromProps=sn,this.equals=en,this.inversePoints=mn,this.inversePoint=fn,this.getInverseMatrix=pn,this._t=this.transform,this.isIdentity=Qt,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(Dt){return typeof Dt}:_typeof$3=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$3(kt)}var lottie={};function setLocation(kt){setLocationHref(kt)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(kt){setSubframeEnabled(kt)}function setPrefix(kt){setIdPrefix(kt)}function loadAnimation(kt){return animationManager.loadAnimation(kt)}function setQuality(kt){if(typeof kt=="string")switch(kt){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(kt)&&kt>1&&setDefaultCurveSegments(kt)}function inBrowser(){return typeof navigator<"u"}function installPlugin(kt,_e){kt==="expressions"&&setExpressionsPlugin(_e)}function getFactory(kt){switch(kt){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(kt){for(var _e=queryString.split("&"),Dt=0;Dt<_e.length;Dt+=1){var Vt=_e[Dt].split("=");if(decodeURIComponent(Vt[0])==kt)return decodeURIComponent(Vt[1])}return null}var queryString="";{var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);try{_typeof$3(exports)!=="object"&&(window.bodymovin=lottie)}catch(kt){}var ShapeModifiers=function(){var kt={},_e={};kt.registerModifier=Dt,kt.getModifier=Vt;function Dt(Gt,zt){_e[Gt]||(_e[Gt]=zt)}function Vt(Gt,zt,jt){return new _e[Gt](zt,jt)}return kt}();function ShapeModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(kt){if(!this.closed){kt.sh.container.addDynamicProperty(kt.sh);var _e={shape:kt.sh,data:kt,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(_e),this.addShapeToModifier(_e),this._isAnimated&&kt.setAsAnimated()}},ShapeModifier.prototype.init=function(kt,_e){this.shapes=[],this.elem=kt,this.initDynamicPropertyContainer(kt),this.initModifierProperties(kt,_e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier);function TrimModifier(){}extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(kt,_e){this.s=PropertyFactory.getProp(kt,_e.s,0,.01,this),this.e=PropertyFactory.getProp(kt,_e.e,0,.01,this),this.o=PropertyFactory.getProp(kt,_e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=_e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(kt){kt.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(kt,_e,Dt,Vt,Gt){var zt=[];_e<=1?zt.push({s:kt,e:_e}):kt>=1?zt.push({s:kt-1,e:_e-1}):(zt.push({s:kt,e:1}),zt.push({s:0,e:_e-1}));var jt=[],Ht,Wt=zt.length,qt;for(Ht=0;Ht<Wt;Ht+=1)if(qt=zt[Ht],!(qt.e*Gt<Vt||qt.s*Gt>Vt+Dt)){var Xt,Kt;qt.s*Gt<=Vt?Xt=0:Xt=(qt.s*Gt-Vt)/Dt,qt.e*Gt>=Vt+Dt?Kt=1:Kt=(qt.e*Gt-Vt)/Dt,jt.push([Xt,Kt])}return jt.length||jt.push([0,0]),jt},TrimModifier.prototype.releasePathsData=function(kt){var _e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)segmentsLengthPool.release(kt[_e]);return kt.length=0,kt},TrimModifier.prototype.processShapes=function(kt){var _e,Dt;if(this._mdf||kt){var Vt=this.o.v%360/360;if(Vt<0&&(Vt+=1),this.s.v>1?_e=1+Vt:this.s.v<0?_e=0+Vt:_e=this.s.v+Vt,this.e.v>1?Dt=1+Vt:this.e.v<0?Dt=0+Vt:Dt=this.e.v+Vt,_e>Dt){var Gt=_e;_e=Dt,Dt=Gt}_e=Math.round(_e*1e4)*1e-4,Dt=Math.round(Dt*1e4)*1e-4,this.sValue=_e,this.eValue=Dt}else _e=this.sValue,Dt=this.eValue;var zt,jt,Ht=this.shapes.length,Wt,qt,Xt,Kt,Yt,Zt=0;if(Dt===_e)for(jt=0;jt<Ht;jt+=1)this.shapes[jt].localShapeCollection.releaseShapes(),this.shapes[jt].shape._mdf=!0,this.shapes[jt].shape.paths=this.shapes[jt].localShapeCollection,this._mdf&&(this.shapes[jt].pathsData.length=0);else if(Dt===1&&_e===0||Dt===0&&_e===1){if(this._mdf)for(jt=0;jt<Ht;jt+=1)this.shapes[jt].pathsData.length=0,this.shapes[jt].shape._mdf=!0}else{var Jt=[],nn,rn;for(jt=0;jt<Ht;jt+=1)if(nn=this.shapes[jt],!nn.shape._mdf&&!this._mdf&&!kt&&this.m!==2)nn.shape.paths=nn.localShapeCollection;else{if(zt=nn.shape.paths,qt=zt._length,Yt=0,!nn.shape._mdf&&nn.pathsData.length)Yt=nn.totalShapeLength;else{for(Xt=this.releasePathsData(nn.pathsData),Wt=0;Wt<qt;Wt+=1)Kt=bez.getSegmentsLength(zt.shapes[Wt]),Xt.push(Kt),Yt+=Kt.totalLength;nn.totalShapeLength=Yt,nn.pathsData=Xt}Zt+=Yt,nn.shape._mdf=!0}var Qt=_e,en=Dt,tn=0,sn;for(jt=Ht-1;jt>=0;jt-=1)if(nn=this.shapes[jt],nn.shape._mdf){for(rn=nn.localShapeCollection,rn.releaseShapes(),this.m===2&&Ht>1?(sn=this.calculateShapeEdges(_e,Dt,nn.totalShapeLength,tn,Zt),tn+=nn.totalShapeLength):sn=[[Qt,en]],qt=sn.length,Wt=0;Wt<qt;Wt+=1){Qt=sn[Wt][0],en=sn[Wt][1],Jt.length=0,en<=1?Jt.push({s:nn.totalShapeLength*Qt,e:nn.totalShapeLength*en}):Qt>=1?Jt.push({s:nn.totalShapeLength*(Qt-1),e:nn.totalShapeLength*(en-1)}):(Jt.push({s:nn.totalShapeLength*Qt,e:nn.totalShapeLength}),Jt.push({s:0,e:nn.totalShapeLength*(en-1)}));var cn=this.addShapes(nn,Jt[0]);if(Jt[0].s!==Jt[0].e){if(Jt.length>1){var un=nn.shape.paths.shapes[nn.shape.paths._length-1];if(un.c){var hn=cn.pop();this.addPaths(cn,rn),cn=this.addShapes(nn,Jt[1],hn)}else this.addPaths(cn,rn),cn=this.addShapes(nn,Jt[1])}this.addPaths(cn,rn)}}nn.shape.paths=rn}}},TrimModifier.prototype.addPaths=function(kt,_e){var Dt,Vt=kt.length;for(Dt=0;Dt<Vt;Dt+=1)_e.addShape(kt[Dt])},TrimModifier.prototype.addSegment=function(kt,_e,Dt,Vt,Gt,zt,jt){Gt.setXYAt(_e[0],_e[1],"o",zt),Gt.setXYAt(Dt[0],Dt[1],"i",zt+1),jt&&Gt.setXYAt(kt[0],kt[1],"v",zt),Gt.setXYAt(Vt[0],Vt[1],"v",zt+1)},TrimModifier.prototype.addSegmentFromArray=function(kt,_e,Dt,Vt){_e.setXYAt(kt[1],kt[5],"o",Dt),_e.setXYAt(kt[2],kt[6],"i",Dt+1),Vt&&_e.setXYAt(kt[0],kt[4],"v",Dt),_e.setXYAt(kt[3],kt[7],"v",Dt+1)},TrimModifier.prototype.addShapes=function(kt,_e,Dt){var Vt=kt.pathsData,Gt=kt.shape.paths.shapes,zt,jt=kt.shape.paths._length,Ht,Wt,qt=0,Xt,Kt,Yt,Zt,Jt=[],nn,rn=!0;for(Dt?(Kt=Dt._length,nn=Dt._length):(Dt=shapePool.newElement(),Kt=0,nn=0),Jt.push(Dt),zt=0;zt<jt;zt+=1){for(Yt=Vt[zt].lengths,Dt.c=Gt[zt].c,Wt=Gt[zt].c?Yt.length:Yt.length+1,Ht=1;Ht<Wt;Ht+=1)if(Xt=Yt[Ht-1],qt+Xt.addedLength<_e.s)qt+=Xt.addedLength,Dt.c=!1;else if(qt>_e.e){Dt.c=!1;break}else _e.s<=qt&&_e.e>=qt+Xt.addedLength?(this.addSegment(Gt[zt].v[Ht-1],Gt[zt].o[Ht-1],Gt[zt].i[Ht],Gt[zt].v[Ht],Dt,Kt,rn),rn=!1):(Zt=bez.getNewSegment(Gt[zt].v[Ht-1],Gt[zt].v[Ht],Gt[zt].o[Ht-1],Gt[zt].i[Ht],(_e.s-qt)/Xt.addedLength,(_e.e-qt)/Xt.addedLength,Yt[Ht-1]),this.addSegmentFromArray(Zt,Dt,Kt,rn),rn=!1,Dt.c=!1),qt+=Xt.addedLength,Kt+=1;if(Gt[zt].c&&Yt.length){if(Xt=Yt[Ht-1],qt<=_e.e){var Qt=Yt[Ht-1].addedLength;_e.s<=qt&&_e.e>=qt+Qt?(this.addSegment(Gt[zt].v[Ht-1],Gt[zt].o[Ht-1],Gt[zt].i[0],Gt[zt].v[0],Dt,Kt,rn),rn=!1):(Zt=bez.getNewSegment(Gt[zt].v[Ht-1],Gt[zt].v[0],Gt[zt].o[Ht-1],Gt[zt].i[0],(_e.s-qt)/Qt,(_e.e-qt)/Qt,Yt[Ht-1]),this.addSegmentFromArray(Zt,Dt,Kt,rn),rn=!1,Dt.c=!1)}else Dt.c=!1;qt+=Xt.addedLength,Kt+=1}if(Dt._length&&(Dt.setXYAt(Dt.v[nn][0],Dt.v[nn][1],"i",nn),Dt.setXYAt(Dt.v[Dt._length-1][0],Dt.v[Dt._length-1][1],"o",Dt._length-1)),qt>_e.e)break;zt<jt-1&&(Dt=shapePool.newElement(),rn=!0,Jt.push(Dt),Kt=0)}return Jt};function PuckerAndBloatModifier(){}extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(kt,_e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(kt,_e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(kt,_e){var Dt=_e/100,Vt=[0,0],Gt=kt._length,zt=0;for(zt=0;zt<Gt;zt+=1)Vt[0]+=kt.v[zt][0],Vt[1]+=kt.v[zt][1];Vt[0]/=Gt,Vt[1]/=Gt;var jt=shapePool.newElement();jt.c=kt.c;var Ht,Wt,qt,Xt,Kt,Yt;for(zt=0;zt<Gt;zt+=1)Ht=kt.v[zt][0]+(Vt[0]-kt.v[zt][0])*Dt,Wt=kt.v[zt][1]+(Vt[1]-kt.v[zt][1])*Dt,qt=kt.o[zt][0]+(Vt[0]-kt.o[zt][0])*-Dt,Xt=kt.o[zt][1]+(Vt[1]-kt.o[zt][1])*-Dt,Kt=kt.i[zt][0]+(Vt[0]-kt.i[zt][0])*-Dt,Yt=kt.i[zt][1]+(Vt[1]-kt.i[zt][1])*-Dt,jt.setTripleAt(Ht,Wt,qt,Xt,Kt,Yt,zt);return jt},PuckerAndBloatModifier.prototype.processShapes=function(kt){var _e,Dt,Vt=this.shapes.length,Gt,zt,jt=this.amount.v;if(jt!==0){var Ht,Wt;for(Dt=0;Dt<Vt;Dt+=1){if(Ht=this.shapes[Dt],Wt=Ht.localShapeCollection,!(!Ht.shape._mdf&&!this._mdf&&!kt))for(Wt.releaseShapes(),Ht.shape._mdf=!0,_e=Ht.shape.paths.shapes,zt=Ht.shape.paths._length,Gt=0;Gt<zt;Gt+=1)Wt.addShape(this.processPath(_e[Gt],jt));Ht.shape.paths=Ht.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=function(){var kt=[0,0];function _e(Wt){var qt=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||qt,this.a&&Wt.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&Wt.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&Wt.skewFromAxis(-this.sk.v,this.sa.v),this.r?Wt.rotate(-this.r.v):Wt.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?Wt.translate(this.px.v,this.py.v,-this.pz.v):Wt.translate(this.px.v,this.py.v,0):Wt.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function Dt(Wt){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||Wt){var qt;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var Xt,Kt;if(qt=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(Xt=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/qt,0),Kt=this.p.getValueAtTime(this.p.keyframes[0].t/qt,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(Xt=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/qt,0),Kt=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/qt,0)):(Xt=this.p.pv,Kt=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/qt,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){Xt=[],Kt=[];var Yt=this.px,Zt=this.py;Yt._caching.lastFrame+Yt.offsetTime<=Yt.keyframes[0].t?(Xt[0]=Yt.getValueAtTime((Yt.keyframes[0].t+.01)/qt,0),Xt[1]=Zt.getValueAtTime((Zt.keyframes[0].t+.01)/qt,0),Kt[0]=Yt.getValueAtTime(Yt.keyframes[0].t/qt,0),Kt[1]=Zt.getValueAtTime(Zt.keyframes[0].t/qt,0)):Yt._caching.lastFrame+Yt.offsetTime>=Yt.keyframes[Yt.keyframes.length-1].t?(Xt[0]=Yt.getValueAtTime(Yt.keyframes[Yt.keyframes.length-1].t/qt,0),Xt[1]=Zt.getValueAtTime(Zt.keyframes[Zt.keyframes.length-1].t/qt,0),Kt[0]=Yt.getValueAtTime((Yt.keyframes[Yt.keyframes.length-1].t-.01)/qt,0),Kt[1]=Zt.getValueAtTime((Zt.keyframes[Zt.keyframes.length-1].t-.01)/qt,0)):(Xt=[Yt.pv,Zt.pv],Kt[0]=Yt.getValueAtTime((Yt._caching.lastFrame+Yt.offsetTime-.01)/qt,Yt.offsetTime),Kt[1]=Zt.getValueAtTime((Zt._caching.lastFrame+Zt.offsetTime-.01)/qt,Zt.offsetTime))}else Kt=kt,Xt=Kt;this.v.rotate(-Math.atan2(Xt[1]-Kt[1],Xt[0]-Kt[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function Vt(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function Gt(){}function zt(Wt){this._addDynamicProperty(Wt),this.elem.addDynamicProperty(Wt),this._isDirty=!0}function jt(Wt,qt,Xt){if(this.elem=Wt,this.frameId=-1,this.propType="transform",this.data=qt,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(Xt||Wt),qt.p&&qt.p.s?(this.px=PropertyFactory.getProp(Wt,qt.p.x,0,0,this),this.py=PropertyFactory.getProp(Wt,qt.p.y,0,0,this),qt.p.z&&(this.pz=PropertyFactory.getProp(Wt,qt.p.z,0,0,this))):this.p=PropertyFactory.getProp(Wt,qt.p||{k:[0,0,0]},1,0,this),qt.rx){if(this.rx=PropertyFactory.getProp(Wt,qt.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(Wt,qt.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(Wt,qt.rz,0,degToRads,this),qt.or.k[0].ti){var Kt,Yt=qt.or.k.length;for(Kt=0;Kt<Yt;Kt+=1)qt.or.k[Kt].to=null,qt.or.k[Kt].ti=null}this.or=PropertyFactory.getProp(Wt,qt.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(Wt,qt.r||{k:0},0,degToRads,this);qt.sk&&(this.sk=PropertyFactory.getProp(Wt,qt.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(Wt,qt.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(Wt,qt.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(Wt,qt.s||{k:[100,100,100]},1,.01,this),qt.o?this.o=PropertyFactory.getProp(Wt,qt.o,0,.01,Wt):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}jt.prototype={applyToMatrix:_e,getValue:Dt,precalculateMatrix:Vt,autoOrient:Gt},extendPrototype([DynamicPropertyContainer],jt),jt.prototype.addDynamicProperty=zt,jt.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty;function Ht(Wt,qt,Xt){return new jt(Wt,qt,Xt)}return{getTransformProperty:Ht}}();function RepeaterModifier(){}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(kt,_e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(kt,_e.c,0,null,this),this.o=PropertyFactory.getProp(kt,_e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(kt,_e.tr,this),this.so=PropertyFactory.getProp(kt,_e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(kt,_e.tr.eo,0,.01,this),this.data=_e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(kt,_e,Dt,Vt,Gt,zt){var jt=zt?-1:1,Ht=Vt.s.v[0]+(1-Vt.s.v[0])*(1-Gt),Wt=Vt.s.v[1]+(1-Vt.s.v[1])*(1-Gt);kt.translate(Vt.p.v[0]*jt*Gt,Vt.p.v[1]*jt*Gt,Vt.p.v[2]),_e.translate(-Vt.a.v[0],-Vt.a.v[1],Vt.a.v[2]),_e.rotate(-Vt.r.v*jt*Gt),_e.translate(Vt.a.v[0],Vt.a.v[1],Vt.a.v[2]),Dt.translate(-Vt.a.v[0],-Vt.a.v[1],Vt.a.v[2]),Dt.scale(zt?1/Ht:Ht,zt?1/Wt:Wt),Dt.translate(Vt.a.v[0],Vt.a.v[1],Vt.a.v[2])},RepeaterModifier.prototype.init=function(kt,_e,Dt,Vt){for(this.elem=kt,this.arr=_e,this.pos=Dt,this.elemsData=Vt,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(kt),this.initModifierProperties(kt,_e[Dt]);Dt>0;)Dt-=1,this._elements.unshift(_e[Dt]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(kt){var _e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)kt[_e]._processed=!1,kt[_e].ty==="gr"&&this.resetElements(kt[_e].it)},RepeaterModifier.prototype.cloneElements=function(kt){var _e=JSON.parse(JSON.stringify(kt));return this.resetElements(_e),_e},RepeaterModifier.prototype.changeGroupRender=function(kt,_e){var Dt,Vt=kt.length;for(Dt=0;Dt<Vt;Dt+=1)kt[Dt]._render=_e,kt[Dt].ty==="gr"&&this.changeGroupRender(kt[Dt].it,_e)},RepeaterModifier.prototype.processShapes=function(kt){var _e,Dt,Vt,Gt,zt,jt=!1;if(this._mdf||kt){var Ht=Math.ceil(this.c.v);if(this._groups.length<Ht){for(;this._groups.length<Ht;){var Wt={it:this.cloneElements(this._elements),ty:"gr"};Wt.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,Wt),this._groups.splice(0,0,Wt),this._currentCopies+=1}this.elem.reloadShapes(),jt=!0}zt=0;var qt;for(Vt=0;Vt<=this._groups.length-1;Vt+=1){if(qt=zt<Ht,this._groups[Vt]._render=qt,this.changeGroupRender(this._groups[Vt].it,qt),!qt){var Xt=this.elemsData[Vt].it,Kt=Xt[Xt.length-1];Kt.transform.op.v!==0?(Kt.transform.op._mdf=!0,Kt.transform.op.v=0):Kt.transform.op._mdf=!1}zt+=1}this._currentCopies=Ht;var Yt=this.o.v,Zt=Yt%1,Jt=Yt>0?Math.floor(Yt):Math.ceil(Yt),nn=this.pMatrix.props,rn=this.rMatrix.props,Qt=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var en=0;if(Yt>0){for(;en<Jt;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),en+=1;Zt&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,Zt,!1),en+=Zt)}else if(Yt<0){for(;en>Jt;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),en-=1;Zt&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-Zt,!0),en-=Zt)}Vt=this.data.m===1?0:this._currentCopies-1,Gt=this.data.m===1?1:-1,zt=this._currentCopies;for(var tn,sn;zt;){if(_e=this.elemsData[Vt].it,Dt=_e[_e.length-1].transform.mProps.v.props,sn=Dt.length,_e[_e.length-1].transform.mProps._mdf=!0,_e[_e.length-1].transform.op._mdf=!0,_e[_e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(Vt/(this._currentCopies-1)),en!==0){for((Vt!==0&&Gt===1||Vt!==this._currentCopies-1&&Gt===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(rn[0],rn[1],rn[2],rn[3],rn[4],rn[5],rn[6],rn[7],rn[8],rn[9],rn[10],rn[11],rn[12],rn[13],rn[14],rn[15]),this.matrix.transform(Qt[0],Qt[1],Qt[2],Qt[3],Qt[4],Qt[5],Qt[6],Qt[7],Qt[8],Qt[9],Qt[10],Qt[11],Qt[12],Qt[13],Qt[14],Qt[15]),this.matrix.transform(nn[0],nn[1],nn[2],nn[3],nn[4],nn[5],nn[6],nn[7],nn[8],nn[9],nn[10],nn[11],nn[12],nn[13],nn[14],nn[15]),tn=0;tn<sn;tn+=1)Dt[tn]=this.matrix.props[tn];this.matrix.reset()}else for(this.matrix.reset(),tn=0;tn<sn;tn+=1)Dt[tn]=this.matrix.props[tn];en+=1,zt-=1,Vt+=Gt}}else for(zt=this._currentCopies,Vt=0,Gt=1;zt;)_e=this.elemsData[Vt].it,Dt=_e[_e.length-1].transform.mProps.v.props,_e[_e.length-1].transform.mProps._mdf=!1,_e[_e.length-1].transform.op._mdf=!1,zt-=1,Vt+=Gt;return jt},RepeaterModifier.prototype.addShape=function(){};function RoundCornersModifier(){}extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(kt,_e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(kt,_e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(kt,_e){var Dt=shapePool.newElement();Dt.c=kt.c;var Vt,Gt=kt._length,zt,jt,Ht,Wt,qt,Xt,Kt=0,Yt,Zt,Jt,nn,rn,Qt;for(Vt=0;Vt<Gt;Vt+=1)zt=kt.v[Vt],Ht=kt.o[Vt],jt=kt.i[Vt],zt[0]===Ht[0]&&zt[1]===Ht[1]&&zt[0]===jt[0]&&zt[1]===jt[1]?(Vt===0||Vt===Gt-1)&&!kt.c?(Dt.setTripleAt(zt[0],zt[1],Ht[0],Ht[1],jt[0],jt[1],Kt),Kt+=1):(Vt===0?Wt=kt.v[Gt-1]:Wt=kt.v[Vt-1],qt=Math.sqrt(Math.pow(zt[0]-Wt[0],2)+Math.pow(zt[1]-Wt[1],2)),Xt=qt?Math.min(qt/2,_e)/qt:0,rn=zt[0]+(Wt[0]-zt[0])*Xt,Yt=rn,Qt=zt[1]-(zt[1]-Wt[1])*Xt,Zt=Qt,Jt=Yt-(Yt-zt[0])*roundCorner,nn=Zt-(Zt-zt[1])*roundCorner,Dt.setTripleAt(Yt,Zt,Jt,nn,rn,Qt,Kt),Kt+=1,Vt===Gt-1?Wt=kt.v[0]:Wt=kt.v[Vt+1],qt=Math.sqrt(Math.pow(zt[0]-Wt[0],2)+Math.pow(zt[1]-Wt[1],2)),Xt=qt?Math.min(qt/2,_e)/qt:0,Jt=zt[0]+(Wt[0]-zt[0])*Xt,Yt=Jt,nn=zt[1]+(Wt[1]-zt[1])*Xt,Zt=nn,rn=Yt-(Yt-zt[0])*roundCorner,Qt=Zt-(Zt-zt[1])*roundCorner,Dt.setTripleAt(Yt,Zt,Jt,nn,rn,Qt,Kt),Kt+=1):(Dt.setTripleAt(kt.v[Vt][0],kt.v[Vt][1],kt.o[Vt][0],kt.o[Vt][1],kt.i[Vt][0],kt.i[Vt][1],Kt),Kt+=1);return Dt},RoundCornersModifier.prototype.processShapes=function(kt){var _e,Dt,Vt=this.shapes.length,Gt,zt,jt=this.rd.v;if(jt!==0){var Ht,Wt;for(Dt=0;Dt<Vt;Dt+=1){if(Ht=this.shapes[Dt],Wt=Ht.localShapeCollection,!(!Ht.shape._mdf&&!this._mdf&&!kt))for(Wt.releaseShapes(),Ht.shape._mdf=!0,_e=Ht.shape.paths.shapes,zt=Ht.shape.paths._length,Gt=0;Gt<zt;Gt+=1)Wt.addShape(this.processPath(_e[Gt],jt));Ht.shape.paths=Ht.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function floatEqual(kt,_e){return Math.abs(kt-_e)*1e5<=Math.min(Math.abs(kt),Math.abs(_e))}function floatZero(kt){return Math.abs(kt)<=1e-5}function lerp(kt,_e,Dt){return kt*(1-Dt)+_e*Dt}function lerpPoint(kt,_e,Dt){return[lerp(kt[0],_e[0],Dt),lerp(kt[1],_e[1],Dt)]}function quadRoots(kt,_e,Dt){if(kt===0)return[];var Vt=_e*_e-4*kt*Dt;if(Vt<0)return[];var Gt=-_e/(2*kt);if(Vt===0)return[Gt];var zt=Math.sqrt(Vt)/(2*kt);return[Gt-zt,Gt+zt]}function polynomialCoefficients(kt,_e,Dt,Vt){return[-kt+3*_e-3*Dt+Vt,3*kt-6*_e+3*Dt,-3*kt+3*_e,kt]}function singlePoint(kt){return new PolynomialBezier(kt,kt,kt,kt,!1)}function PolynomialBezier(kt,_e,Dt,Vt,Gt){Gt&&pointEqual(kt,_e)&&(_e=lerpPoint(kt,Vt,1/3)),Gt&&pointEqual(Dt,Vt)&&(Dt=lerpPoint(kt,Vt,2/3));var zt=polynomialCoefficients(kt[0],_e[0],Dt[0],Vt[0]),jt=polynomialCoefficients(kt[1],_e[1],Dt[1],Vt[1]);this.a=[zt[0],jt[0]],this.b=[zt[1],jt[1]],this.c=[zt[2],jt[2]],this.d=[zt[3],jt[3]],this.points=[kt,_e,Dt,Vt]}PolynomialBezier.prototype.point=function(kt){return[((this.a[0]*kt+this.b[0])*kt+this.c[0])*kt+this.d[0],((this.a[1]*kt+this.b[1])*kt+this.c[1])*kt+this.d[1]]},PolynomialBezier.prototype.derivative=function(kt){return[(3*kt*this.a[0]+2*this.b[0])*kt+this.c[0],(3*kt*this.a[1]+2*this.b[1])*kt+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(kt){var _e=this.derivative(kt);return Math.atan2(_e[1],_e[0])},PolynomialBezier.prototype.normalAngle=function(kt){var _e=this.derivative(kt);return Math.atan2(_e[0],_e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var kt=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(kt))return[];var _e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/kt,Dt=_e*_e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/kt;if(Dt<0)return[];var Vt=Math.sqrt(Dt);return floatZero(Vt)?Vt>0&&Vt<1?[_e]:[]:[_e-Vt,_e+Vt].filter(function(Gt){return Gt>0&&Gt<1})},PolynomialBezier.prototype.split=function(kt){if(kt<=0)return[singlePoint(this.points[0]),this];if(kt>=1)return[this,singlePoint(this.points[this.points.length-1])];var _e=lerpPoint(this.points[0],this.points[1],kt),Dt=lerpPoint(this.points[1],this.points[2],kt),Vt=lerpPoint(this.points[2],this.points[3],kt),Gt=lerpPoint(_e,Dt,kt),zt=lerpPoint(Dt,Vt,kt),jt=lerpPoint(Gt,zt,kt);return[new PolynomialBezier(this.points[0],_e,Gt,jt,!0),new PolynomialBezier(jt,zt,Vt,this.points[3],!0)]};function extrema(kt,_e){var Dt=kt.points[0][_e],Vt=kt.points[kt.points.length-1][_e];if(Dt>Vt){var Gt=Vt;Vt=Dt,Dt=Gt}for(var zt=quadRoots(3*kt.a[_e],2*kt.b[_e],kt.c[_e]),jt=0;jt<zt.length;jt+=1)if(zt[jt]>0&&zt[jt]<1){var Ht=kt.point(zt[jt])[_e];Ht<Dt?Dt=Ht:Ht>Vt&&(Vt=Ht)}return{min:Dt,max:Vt}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var kt=this.bounds();return{left:kt.x.min,right:kt.x.max,top:kt.y.min,bottom:kt.y.max,width:kt.x.max-kt.x.min,height:kt.y.max-kt.y.min,cx:(kt.x.max+kt.x.min)/2,cy:(kt.y.max+kt.y.min)/2}};function intersectData(kt,_e,Dt){var Vt=kt.boundingBox();return{cx:Vt.cx,cy:Vt.cy,width:Vt.width,height:Vt.height,bez:kt,t:(_e+Dt)/2,t1:_e,t2:Dt}}function splitData(kt){var _e=kt.bez.split(.5);return[intersectData(_e[0],kt.t1,kt.t),intersectData(_e[1],kt.t,kt.t2)]}function boxIntersect(kt,_e){return Math.abs(kt.cx-_e.cx)*2<kt.width+_e.width&&Math.abs(kt.cy-_e.cy)*2<kt.height+_e.height}function intersectsImpl(kt,_e,Dt,Vt,Gt,zt){if(boxIntersect(kt,_e)){if(Dt>=zt||kt.width<=Vt&&kt.height<=Vt&&_e.width<=Vt&&_e.height<=Vt){Gt.push([kt.t,_e.t]);return}var jt=splitData(kt),Ht=splitData(_e);intersectsImpl(jt[0],Ht[0],Dt+1,Vt,Gt,zt),intersectsImpl(jt[0],Ht[1],Dt+1,Vt,Gt,zt),intersectsImpl(jt[1],Ht[0],Dt+1,Vt,Gt,zt),intersectsImpl(jt[1],Ht[1],Dt+1,Vt,Gt,zt)}}PolynomialBezier.prototype.intersections=function(kt,_e,Dt){_e===void 0&&(_e=2),Dt===void 0&&(Dt=7);var Vt=[];return intersectsImpl(intersectData(this,0,1),intersectData(kt,0,1),0,_e,Vt,Dt),Vt},PolynomialBezier.shapeSegment=function(kt,_e){var Dt=(_e+1)%kt.length();return new PolynomialBezier(kt.v[_e],kt.o[_e],kt.i[Dt],kt.v[Dt],!0)},PolynomialBezier.shapeSegmentInverted=function(kt,_e){var Dt=(_e+1)%kt.length();return new PolynomialBezier(kt.v[Dt],kt.i[Dt],kt.o[_e],kt.v[_e],!0)};function crossProduct(kt,_e){return[kt[1]*_e[2]-kt[2]*_e[1],kt[2]*_e[0]-kt[0]*_e[2],kt[0]*_e[1]-kt[1]*_e[0]]}function lineIntersection(kt,_e,Dt,Vt){var Gt=[kt[0],kt[1],1],zt=[_e[0],_e[1],1],jt=[Dt[0],Dt[1],1],Ht=[Vt[0],Vt[1],1],Wt=crossProduct(crossProduct(Gt,zt),crossProduct(jt,Ht));return floatZero(Wt[2])?null:[Wt[0]/Wt[2],Wt[1]/Wt[2]]}function polarOffset(kt,_e,Dt){return[kt[0]+Math.cos(_e)*Dt,kt[1]-Math.sin(_e)*Dt]}function pointDistance(kt,_e){return Math.hypot(kt[0]-_e[0],kt[1]-_e[1])}function pointEqual(kt,_e){return floatEqual(kt[0],_e[0])&&floatEqual(kt[1],_e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(kt,_e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(kt,_e.s,0,null,this),this.frequency=PropertyFactory.getProp(kt,_e.r,0,null,this),this.pointsType=PropertyFactory.getProp(kt,_e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(kt,_e,Dt,Vt,Gt,zt,jt){var Ht=Dt-Math.PI/2,Wt=Dt+Math.PI/2,qt=_e[0]+Math.cos(Dt)*Vt*Gt,Xt=_e[1]-Math.sin(Dt)*Vt*Gt;kt.setTripleAt(qt,Xt,qt+Math.cos(Ht)*zt,Xt-Math.sin(Ht)*zt,qt+Math.cos(Wt)*jt,Xt-Math.sin(Wt)*jt,kt.length())}function getPerpendicularVector(kt,_e){var Dt=[_e[0]-kt[0],_e[1]-kt[1]],Vt=-Math.PI*.5,Gt=[Math.cos(Vt)*Dt[0]-Math.sin(Vt)*Dt[1],Math.sin(Vt)*Dt[0]+Math.cos(Vt)*Dt[1]];return Gt}function getProjectingAngle(kt,_e){var Dt=_e===0?kt.length()-1:_e-1,Vt=(_e+1)%kt.length(),Gt=kt.v[Dt],zt=kt.v[Vt],jt=getPerpendicularVector(Gt,zt);return Math.atan2(0,1)-Math.atan2(jt[1],jt[0])}function zigZagCorner(kt,_e,Dt,Vt,Gt,zt,jt){var Ht=getProjectingAngle(_e,Dt),Wt=_e.v[Dt%_e._length],qt=_e.v[Dt===0?_e._length-1:Dt-1],Xt=_e.v[(Dt+1)%_e._length],Kt=zt===2?Math.sqrt(Math.pow(Wt[0]-qt[0],2)+Math.pow(Wt[1]-qt[1],2)):0,Yt=zt===2?Math.sqrt(Math.pow(Wt[0]-Xt[0],2)+Math.pow(Wt[1]-Xt[1],2)):0;setPoint(kt,_e.v[Dt%_e._length],Ht,jt,Vt,Yt/((Gt+1)*2),Kt/((Gt+1)*2))}function zigZagSegment(kt,_e,Dt,Vt,Gt,zt){for(var jt=0;jt<Vt;jt+=1){var Ht=(jt+1)/(Vt+1),Wt=Gt===2?Math.sqrt(Math.pow(_e.points[3][0]-_e.points[0][0],2)+Math.pow(_e.points[3][1]-_e.points[0][1],2)):0,qt=_e.normalAngle(Ht),Xt=_e.point(Ht);setPoint(kt,Xt,qt,zt,Dt,Wt/((Vt+1)*2),Wt/((Vt+1)*2)),zt=-zt}return zt}ZigZagModifier.prototype.processPath=function(kt,_e,Dt,Vt){var Gt=kt._length,zt=shapePool.newElement();if(zt.c=kt.c,kt.c||(Gt-=1),Gt===0)return zt;var jt=-1,Ht=PolynomialBezier.shapeSegment(kt,0);zigZagCorner(zt,kt,0,_e,Dt,Vt,jt);for(var Wt=0;Wt<Gt;Wt+=1)jt=zigZagSegment(zt,Ht,_e,Dt,Vt,-jt),Wt===Gt-1&&!kt.c?Ht=null:Ht=PolynomialBezier.shapeSegment(kt,(Wt+1)%Gt),zigZagCorner(zt,kt,Wt+1,_e,Dt,Vt,jt);return zt},ZigZagModifier.prototype.processShapes=function(kt){var _e,Dt,Vt=this.shapes.length,Gt,zt,jt=this.amplitude.v,Ht=Math.max(0,Math.round(this.frequency.v)),Wt=this.pointsType.v;if(jt!==0){var qt,Xt;for(Dt=0;Dt<Vt;Dt+=1){if(qt=this.shapes[Dt],Xt=qt.localShapeCollection,!(!qt.shape._mdf&&!this._mdf&&!kt))for(Xt.releaseShapes(),qt.shape._mdf=!0,_e=qt.shape.paths.shapes,zt=qt.shape.paths._length,Gt=0;Gt<zt;Gt+=1)Xt.addShape(this.processPath(_e[Gt],jt,Ht,Wt));qt.shape.paths=qt.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function linearOffset(kt,_e,Dt){var Vt=Math.atan2(_e[0]-kt[0],_e[1]-kt[1]);return[polarOffset(kt,Vt,Dt),polarOffset(_e,Vt,Dt)]}function offsetSegment(kt,_e){var Dt,Vt,Gt,zt,jt,Ht,Wt;Wt=linearOffset(kt.points[0],kt.points[1],_e),Dt=Wt[0],Vt=Wt[1],Wt=linearOffset(kt.points[1],kt.points[2],_e),Gt=Wt[0],zt=Wt[1],Wt=linearOffset(kt.points[2],kt.points[3],_e),jt=Wt[0],Ht=Wt[1];var qt=lineIntersection(Dt,Vt,Gt,zt);qt===null&&(qt=Vt);var Xt=lineIntersection(jt,Ht,Gt,zt);return Xt===null&&(Xt=jt),new PolynomialBezier(Dt,qt,Xt,Ht)}function joinLines(kt,_e,Dt,Vt,Gt){var zt=_e.points[3],jt=Dt.points[0];if(Vt===3||pointEqual(zt,jt))return zt;if(Vt===2){var Ht=-_e.tangentAngle(1),Wt=-Dt.tangentAngle(0)+Math.PI,qt=lineIntersection(zt,polarOffset(zt,Ht+Math.PI/2,100),jt,polarOffset(jt,Ht+Math.PI/2,100)),Xt=qt?pointDistance(qt,zt):pointDistance(zt,jt)/2,Kt=polarOffset(zt,Ht,2*Xt*roundCorner);return kt.setXYAt(Kt[0],Kt[1],"o",kt.length()-1),Kt=polarOffset(jt,Wt,2*Xt*roundCorner),kt.setTripleAt(jt[0],jt[1],jt[0],jt[1],Kt[0],Kt[1],kt.length()),jt}var Yt=pointEqual(zt,_e.points[2])?_e.points[0]:_e.points[2],Zt=pointEqual(jt,Dt.points[1])?Dt.points[3]:Dt.points[1],Jt=lineIntersection(Yt,zt,jt,Zt);return Jt&&pointDistance(Jt,zt)<Gt?(kt.setTripleAt(Jt[0],Jt[1],Jt[0],Jt[1],Jt[0],Jt[1],kt.length()),Jt):zt}function getIntersection(kt,_e){var Dt=kt.intersections(_e);return Dt.length&&floatEqual(Dt[0][0],1)&&Dt.shift(),Dt.length?Dt[0]:null}function pruneSegmentIntersection(kt,_e){var Dt=kt.slice(),Vt=_e.slice(),Gt=getIntersection(kt[kt.length-1],_e[0]);return Gt&&(Dt[kt.length-1]=kt[kt.length-1].split(Gt[0])[0],Vt[0]=_e[0].split(Gt[1])[1]),kt.length>1&&_e.length>1&&(Gt=getIntersection(kt[0],_e[_e.length-1]),Gt)?[[kt[0].split(Gt[0])[0]],[_e[_e.length-1].split(Gt[1])[1]]]:[Dt,Vt]}function pruneIntersections(kt){for(var _e,Dt=1;Dt<kt.length;Dt+=1)_e=pruneSegmentIntersection(kt[Dt-1],kt[Dt]),kt[Dt-1]=_e[0],kt[Dt]=_e[1];return kt.length>1&&(_e=pruneSegmentIntersection(kt[kt.length-1],kt[0]),kt[kt.length-1]=_e[0],kt[0]=_e[1]),kt}function offsetSegmentSplit(kt,_e){var Dt=kt.inflectionPoints(),Vt,Gt,zt,jt;if(Dt.length===0)return[offsetSegment(kt,_e)];if(Dt.length===1||floatEqual(Dt[1],1))return zt=kt.split(Dt[0]),Vt=zt[0],Gt=zt[1],[offsetSegment(Vt,_e),offsetSegment(Gt,_e)];zt=kt.split(Dt[0]),Vt=zt[0];var Ht=(Dt[1]-Dt[0])/(1-Dt[0]);return zt=zt[1].split(Ht),jt=zt[0],Gt=zt[1],[offsetSegment(Vt,_e),offsetSegment(jt,_e),offsetSegment(Gt,_e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(kt,_e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(kt,_e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(kt,_e.ml,0,null,this),this.lineJoin=_e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(kt,_e,Dt,Vt){var Gt=shapePool.newElement();Gt.c=kt.c;var zt=kt.length();kt.c||(zt-=1);var jt,Ht,Wt,qt=[];for(jt=0;jt<zt;jt+=1)Wt=PolynomialBezier.shapeSegment(kt,jt),qt.push(offsetSegmentSplit(Wt,_e));if(!kt.c)for(jt=zt-1;jt>=0;jt-=1)Wt=PolynomialBezier.shapeSegmentInverted(kt,jt),qt.push(offsetSegmentSplit(Wt,_e));qt=pruneIntersections(qt);var Xt=null,Kt=null;for(jt=0;jt<qt.length;jt+=1){var Yt=qt[jt];for(Kt&&(Xt=joinLines(Gt,Kt,Yt[0],Dt,Vt)),Kt=Yt[Yt.length-1],Ht=0;Ht<Yt.length;Ht+=1)Wt=Yt[Ht],Xt&&pointEqual(Wt.points[0],Xt)?Gt.setXYAt(Wt.points[1][0],Wt.points[1][1],"o",Gt.length()-1):Gt.setTripleAt(Wt.points[0][0],Wt.points[0][1],Wt.points[1][0],Wt.points[1][1],Wt.points[0][0],Wt.points[0][1],Gt.length()),Gt.setTripleAt(Wt.points[3][0],Wt.points[3][1],Wt.points[3][0],Wt.points[3][1],Wt.points[2][0],Wt.points[2][1],Gt.length()),Xt=Wt.points[3]}return qt.length&&joinLines(Gt,Kt,qt[0][0],Dt,Vt),Gt},OffsetPathModifier.prototype.processShapes=function(kt){var _e,Dt,Vt=this.shapes.length,Gt,zt,jt=this.amount.v,Ht=this.miterLimit.v,Wt=this.lineJoin;if(jt!==0){var qt,Xt;for(Dt=0;Dt<Vt;Dt+=1){if(qt=this.shapes[Dt],Xt=qt.localShapeCollection,!(!qt.shape._mdf&&!this._mdf&&!kt))for(Xt.releaseShapes(),qt.shape._mdf=!0,_e=qt.shape.paths.shapes,zt=qt.shape.paths._length,Gt=0;Gt<zt;Gt+=1)Xt.addShape(this.processPath(_e[Gt],jt,Wt,Ht));qt.shape.paths=qt.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function getFontProperties(kt){for(var _e=kt.fStyle?kt.fStyle.split(" "):[],Dt="normal",Vt="normal",Gt=_e.length,zt,jt=0;jt<Gt;jt+=1)switch(zt=_e[jt].toLowerCase(),zt){case"italic":Vt="italic";break;case"bold":Dt="700";break;case"black":Dt="900";break;case"medium":Dt="500";break;case"regular":case"normal":Dt="400";break;case"light":case"thin":Dt="200";break}return{style:Vt,weight:kt.fWeight||Dt}}var FontManager=function(){var kt=5e3,_e={w:0,size:0,shapes:[],data:{shapes:[]}},Dt=[];Dt=Dt.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var Vt=127988,Gt=917631,zt=917601,jt=917626,Ht=65039,Wt=8205,qt=127462,Xt=127487,Kt=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function Yt(Tn){var Cn=Tn.split(","),yn,Sn=Cn.length,wn=[];for(yn=0;yn<Sn;yn+=1)Cn[yn]!=="sans-serif"&&Cn[yn]!=="monospace"&&wn.push(Cn[yn]);return wn.join(",")}function Zt(Tn,Cn){var yn=createTag("span");yn.setAttribute("aria-hidden",!0),yn.style.fontFamily=Cn;var Sn=createTag("span");Sn.innerText="giItT1WQy@!-/#",yn.style.position="absolute",yn.style.left="-10000px",yn.style.top="-10000px",yn.style.fontSize="300px",yn.style.fontVariant="normal",yn.style.fontStyle="normal",yn.style.fontWeight="normal",yn.style.letterSpacing="0",yn.appendChild(Sn),document.body.appendChild(yn);var wn=Sn.offsetWidth;return Sn.style.fontFamily=Yt(Tn)+", "+Cn,{node:Sn,w:wn,parent:yn}}function Jt(){var Tn,Cn=this.fonts.length,yn,Sn,wn=Cn;for(Tn=0;Tn<Cn;Tn+=1)this.fonts[Tn].loaded?wn-=1:this.fonts[Tn].fOrigin==="n"||this.fonts[Tn].origin===0?this.fonts[Tn].loaded=!0:(yn=this.fonts[Tn].monoCase.node,Sn=this.fonts[Tn].monoCase.w,yn.offsetWidth!==Sn?(wn-=1,this.fonts[Tn].loaded=!0):(yn=this.fonts[Tn].sansCase.node,Sn=this.fonts[Tn].sansCase.w,yn.offsetWidth!==Sn&&(wn-=1,this.fonts[Tn].loaded=!0)),this.fonts[Tn].loaded&&(this.fonts[Tn].sansCase.parent.parentNode.removeChild(this.fonts[Tn].sansCase.parent),this.fonts[Tn].monoCase.parent.parentNode.removeChild(this.fonts[Tn].monoCase.parent)));wn!==0&&Date.now()-this.initTime<kt?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function nn(Tn,Cn){var yn=document.body&&Cn?"svg":"canvas",Sn,wn=getFontProperties(Tn);if(yn==="svg"){var xn=createNS("text");xn.style.fontSize="100px",xn.setAttribute("font-family",Tn.fFamily),xn.setAttribute("font-style",wn.style),xn.setAttribute("font-weight",wn.weight),xn.textContent="1",Tn.fClass?(xn.style.fontFamily="inherit",xn.setAttribute("class",Tn.fClass)):xn.style.fontFamily=Tn.fFamily,Cn.appendChild(xn),Sn=xn}else{var Rn=new OffscreenCanvas(500,500).getContext("2d");Rn.font=wn.style+" "+wn.weight+" 100px "+Tn.fFamily,Sn=Rn}function Dn(kn){return yn==="svg"?(Sn.textContent=kn,Sn.getComputedTextLength()):Sn.measureText(kn).width}return{measureText:Dn}}function rn(Tn,Cn){if(!Tn){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=Tn.list;return}if(!document.body){this.isLoaded=!0,Tn.list.forEach(function(qn){qn.helper=nn(qn),qn.cache={}}),this.fonts=Tn.list;return}var yn=Tn.list,Sn,wn=yn.length,xn=wn;for(Sn=0;Sn<wn;Sn+=1){var Rn=!0,Dn,kn;if(yn[Sn].loaded=!1,yn[Sn].monoCase=Zt(yn[Sn].fFamily,"monospace"),yn[Sn].sansCase=Zt(yn[Sn].fFamily,"sans-serif"),!yn[Sn].fPath)yn[Sn].loaded=!0,xn-=1;else if(yn[Sn].fOrigin==="p"||yn[Sn].origin===3){if(Dn=document.querySelectorAll('style[f-forigin="p"][f-family="'+yn[Sn].fFamily+'"], style[f-origin="3"][f-family="'+yn[Sn].fFamily+'"]'),Dn.length>0&&(Rn=!1),Rn){var Fn=createTag("style");Fn.setAttribute("f-forigin",yn[Sn].fOrigin),Fn.setAttribute("f-origin",yn[Sn].origin),Fn.setAttribute("f-family",yn[Sn].fFamily),Fn.type="text/css",Fn.innerText="@font-face {font-family: "+yn[Sn].fFamily+"; font-style: normal; src: url('"+yn[Sn].fPath+"');}",Cn.appendChild(Fn)}}else if(yn[Sn].fOrigin==="g"||yn[Sn].origin===1){for(Dn=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),kn=0;kn<Dn.length;kn+=1)Dn[kn].href.indexOf(yn[Sn].fPath)!==-1&&(Rn=!1);if(Rn){var Pn=createTag("link");Pn.setAttribute("f-forigin",yn[Sn].fOrigin),Pn.setAttribute("f-origin",yn[Sn].origin),Pn.type="text/css",Pn.rel="stylesheet",Pn.href=yn[Sn].fPath,document.body.appendChild(Pn)}}else if(yn[Sn].fOrigin==="t"||yn[Sn].origin===2){for(Dn=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),kn=0;kn<Dn.length;kn+=1)yn[Sn].fPath===Dn[kn].src&&(Rn=!1);if(Rn){var Bn=createTag("link");Bn.setAttribute("f-forigin",yn[Sn].fOrigin),Bn.setAttribute("f-origin",yn[Sn].origin),Bn.setAttribute("rel","stylesheet"),Bn.setAttribute("href",yn[Sn].fPath),Cn.appendChild(Bn)}}yn[Sn].helper=nn(yn[Sn],Cn),yn[Sn].cache={},this.fonts.push(yn[Sn])}xn===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function Qt(Tn){if(Tn){this.chars||(this.chars=[]);var Cn,yn=Tn.length,Sn,wn=this.chars.length,xn;for(Cn=0;Cn<yn;Cn+=1){for(Sn=0,xn=!1;Sn<wn;)this.chars[Sn].style===Tn[Cn].style&&this.chars[Sn].fFamily===Tn[Cn].fFamily&&this.chars[Sn].ch===Tn[Cn].ch&&(xn=!0),Sn+=1;xn||(this.chars.push(Tn[Cn]),wn+=1)}}}function en(Tn,Cn,yn){for(var Sn=0,wn=this.chars.length;Sn<wn;){if(this.chars[Sn].ch===Tn&&this.chars[Sn].style===Cn&&this.chars[Sn].fFamily===yn)return this.chars[Sn];Sn+=1}return(typeof Tn=="string"&&Tn.charCodeAt(0)!==13||!Tn)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",Tn,Cn,yn)),_e}function tn(Tn,Cn,yn){var Sn=this.getFontByName(Cn),wn=Tn;if(!Sn.cache[wn]){var xn=Sn.helper;if(Tn===" "){var Rn=xn.measureText("|"+Tn+"|"),Dn=xn.measureText("||");Sn.cache[wn]=(Rn-Dn)/100}else Sn.cache[wn]=xn.measureText(Tn)/100}return Sn.cache[wn]*yn}function sn(Tn){for(var Cn=0,yn=this.fonts.length;Cn<yn;){if(this.fonts[Cn].fName===Tn)return this.fonts[Cn];Cn+=1}return this.fonts[0]}function cn(Tn){var Cn=0,yn=Tn.charCodeAt(0);if(yn>=55296&&yn<=56319){var Sn=Tn.charCodeAt(1);Sn>=56320&&Sn<=57343&&(Cn=(yn-55296)*1024+Sn-56320+65536)}return Cn}function un(Tn,Cn){var yn=Tn.toString(16)+Cn.toString(16);return Kt.indexOf(yn)!==-1}function hn(Tn){return Tn===Wt}function dn(Tn){return Tn===Ht}function pn(Tn){var Cn=cn(Tn);return Cn>=qt&&Cn<=Xt}function fn(Tn){return pn(Tn.substr(0,2))&&pn(Tn.substr(2,2))}function mn(Tn){return Dt.indexOf(Tn)!==-1}function vn(Tn,Cn){var yn=cn(Tn.substr(Cn,2));if(yn!==Vt)return!1;var Sn=0;for(Cn+=2;Sn<5;){if(yn=cn(Tn.substr(Cn,2)),yn<zt||yn>jt)return!1;Sn+=1,Cn+=2}return cn(Tn.substr(Cn,2))===Gt}function _n(){this.isLoaded=!0}var En=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};En.isModifier=un,En.isZeroWidthJoiner=hn,En.isFlagEmoji=fn,En.isRegionalCode=pn,En.isCombinedCharacter=mn,En.isRegionalFlag=vn,En.isVariationSelector=dn,En.BLACK_FLAG_CODE_POINT=Vt;var An={addChars:Qt,addFonts:rn,getCharData:en,getFontByName:sn,measureText:tn,checkLoadedFonts:Jt,setIsLoaded:_n};return En.prototype=An,En}();function SlotManager(kt){this.animationData=kt}SlotManager.prototype.getProp=function(kt){return this.animationData.slots&&this.animationData.slots[kt.sid]?Object.assign(kt,this.animationData.slots[kt.sid].p):kt};function slotFactory(kt){return new SlotManager(kt)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(_e){this.renderableComponents.indexOf(_e)===-1&&this.renderableComponents.push(_e)},removeRenderableComponent:function(_e){this.renderableComponents.indexOf(_e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(_e),1)},prepareRenderableFrame:function(_e){this.checkLayerLimits(_e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(_e){this.data.ip-this.data.st<=_e&&this.data.op-this.data.st>_e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var _e,Dt=this.renderableComponents.length;for(_e=0;_e<Dt;_e+=1)this.renderableComponents[_e].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=function(){var kt={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(_e){return kt[_e]||""}}();function SliderEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,0,0,Dt)}function AngleEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,0,0,Dt)}function ColorEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,1,0,Dt)}function PointEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,1,0,Dt)}function LayerIndexEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,0,0,Dt)}function MaskIndexEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,0,0,Dt)}function CheckboxEffect(kt,_e,Dt){this.p=PropertyFactory.getProp(_e,kt.v,0,0,Dt)}function NoValueEffect(){this.p={}}function EffectsManager(kt,_e){var Dt=kt.ef||[];this.effectElements=[];var Vt,Gt=Dt.length,zt;for(Vt=0;Vt<Gt;Vt+=1)zt=new GroupEffect(Dt[Vt],_e),this.effectElements.push(zt)}function GroupEffect(kt,_e){this.init(kt,_e)}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(kt,_e){this.data=kt,this.effectElements=[],this.initDynamicPropertyContainer(_e);var Dt,Vt=this.data.ef.length,Gt,zt=this.data.ef;for(Dt=0;Dt<Vt;Dt+=1){switch(Gt=null,zt[Dt].ty){case 0:Gt=new SliderEffect(zt[Dt],_e,this);break;case 1:Gt=new AngleEffect(zt[Dt],_e,this);break;case 2:Gt=new ColorEffect(zt[Dt],_e,this);break;case 3:Gt=new PointEffect(zt[Dt],_e,this);break;case 4:case 7:Gt=new CheckboxEffect(zt[Dt],_e,this);break;case 10:Gt=new LayerIndexEffect(zt[Dt],_e,this);break;case 11:Gt=new MaskIndexEffect(zt[Dt],_e,this);break;case 5:Gt=new EffectsManager(zt[Dt],_e);break;default:Gt=new NoValueEffect(zt[Dt]);break}Gt&&this.effectElements.push(Gt)}};function BaseElement(){}BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var _e=0,Dt=this.data.masksProperties.length;_e<Dt;){if(this.data.masksProperties[_e].mode!=="n"&&this.data.masksProperties[_e].cl!==!1)return!0;_e+=1}return!1},initExpressions:function(){var _e=getExpressionInterfaces();if(_e){var Dt=_e("layer"),Vt=_e("effects"),Gt=_e("shape"),zt=_e("text"),jt=_e("comp");this.layerInterface=Dt(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var Ht=Vt.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(Ht),this.data.ty===0||this.data.xt?this.compInterface=jt(this):this.data.ty===4?(this.layerInterface.shapeInterface=Gt(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):this.data.ty===5&&(this.layerInterface.textInterface=zt(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var _e=getBlendMode(this.data.bm),Dt=this.baseElement||this.layerElement;Dt.style["mix-blend-mode"]=_e},initBaseData:function(_e,Dt,Vt){this.globalData=Dt,this.comp=Vt,this.data=_e,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function FrameElement(){}FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(_e,Dt){var Vt,Gt=this.dynamicProperties.length;for(Vt=0;Vt<Gt;Vt+=1)(Dt||this._isParent&&this.dynamicProperties[Vt].propType==="transform")&&(this.dynamicProperties[Vt].getValue(),this.dynamicProperties[Vt]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(_e){this.dynamicProperties.indexOf(_e)===-1&&this.dynamicProperties.push(_e)}};function FootageElement(kt,_e,Dt){this.initFrame(),this.initRenderable(),this.assetData=_e.getAssetData(kt.refId),this.footageData=_e.imageLoader.getAsset(this.assetData),this.initBaseData(kt,_e,Dt)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var kt=getExpressionInterfaces();if(kt){var _e=kt("footage");this.layerInterface=_e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData};function AudioElement(kt,_e,Dt){this.initFrame(),this.initRenderable(),this.assetData=_e.getAssetData(kt.refId),this.initBaseData(kt,_e,Dt),this._isPlaying=!1,this._canPlay=!1;var Vt=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(Vt),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=kt.tm?PropertyFactory.getProp(this,kt.tm,0,_e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,kt.au&&kt.au.lv?kt.au.lv:{k:[100]},1,.01,this)}AudioElement.prototype.prepareFrame=function(kt){if(this.prepareRenderableFrame(kt,!0),this.prepareProperties(kt,!0),this.tm._placeholder)this._currentTime=kt/this.data.sr;else{var _e=this.tm.v;this._currentTime=_e}this._volume=this.lv.v[0];var Dt=this._volume*this._volumeMultiplier;this._previousVolume!==Dt&&(this._previousVolume=Dt,this.audio.volume(Dt))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(kt){this.audio.rate(kt)},AudioElement.prototype.volume=function(kt){this._volumeMultiplier=kt,this._previousVolume=kt*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(kt){var _e,Dt=this.layers.length,Vt;for(this.completeLayers=!0,_e=Dt-1;_e>=0;_e-=1)this.elements[_e]||(Vt=this.layers[_e],Vt.ip-Vt.st<=kt-this.layers[_e].st&&Vt.op-Vt.st>kt-this.layers[_e].st&&this.buildItem(_e)),this.completeLayers=this.elements[_e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(kt){switch(kt.ty){case 2:return this.createImage(kt);case 0:return this.createComp(kt);case 1:return this.createSolid(kt);case 3:return this.createNull(kt);case 4:return this.createShape(kt);case 5:return this.createText(kt);case 6:return this.createAudio(kt);case 13:return this.createCamera(kt);case 15:return this.createFootage(kt);default:return this.createNull(kt)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(kt){return new AudioElement(kt,this.globalData,this)},BaseRenderer.prototype.createFootage=function(kt){return new FootageElement(kt,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var kt,_e=this.layers.length;for(kt=0;kt<_e;kt+=1)this.buildItem(kt);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(kt){this.completeLayers=!1;var _e,Dt=kt.length,Vt,Gt=this.layers.length;for(_e=0;_e<Dt;_e+=1)for(Vt=0;Vt<Gt;){if(this.layers[Vt].id===kt[_e].id){this.layers[Vt]=kt[_e];break}Vt+=1}},BaseRenderer.prototype.setProjectInterface=function(kt){this.globalData.projectInterface=kt},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(kt,_e,Dt){for(var Vt=this.elements,Gt=this.layers,zt=0,jt=Gt.length;zt<jt;)Gt[zt].ind==_e&&(!Vt[zt]||Vt[zt]===!0?(this.buildItem(zt),this.addPendingElement(kt)):(Dt.push(Vt[zt]),Vt[zt].setAsParent(),Gt[zt].parent!==void 0?this.buildElementParenting(kt,Gt[zt].parent,Dt):kt.setHierarchy(Dt))),zt+=1},BaseRenderer.prototype.addPendingElement=function(kt){this.pendingElements.push(kt)},BaseRenderer.prototype.searchExtraCompositions=function(kt){var _e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)if(kt[_e].xt){var Vt=this.createComp(kt[_e]);Vt.initExpressions(),this.globalData.projectInterface.registerComposition(Vt)}},BaseRenderer.prototype.getElementById=function(kt){var _e,Dt=this.elements.length;for(_e=0;_e<Dt;_e+=1)if(this.elements[_e].data.ind===kt)return this.elements[_e];return null},BaseRenderer.prototype.getElementByPath=function(kt){var _e=kt.shift(),Dt;if(typeof _e=="number")Dt=this.elements[_e];else{var Vt,Gt=this.elements.length;for(Vt=0;Vt<Gt;Vt+=1)if(this.elements[Vt].data.nm===_e){Dt=this.elements[Vt];break}}return kt.length===0?Dt:Dt.getElementByPath(kt)},BaseRenderer.prototype.setupGlobalData=function(kt,_e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(kt),this.globalData.fontManager.addChars(kt.chars),this.globalData.fontManager.addFonts(kt.fonts,_e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=kt.fr,this.globalData.nm=kt.nm,this.globalData.compSize={w:kt.w,h:kt.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}TransformElement.prototype={initTransform:function(){var _e=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:_e,localMat:_e,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var _e,Dt=this.finalTransform.mat,Vt=0,Gt=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;Vt<Gt;){if(this.hierarchy[Vt].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}Vt+=1}if(this.finalTransform._matMdf)for(_e=this.finalTransform.mProp.v.props,Dt.cloneFromProps(_e),Vt=0;Vt<Gt;Vt+=1)Dt.multiply(this.hierarchy[Vt].finalTransform.mProp.v)}this.finalTransform._matMdf&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var _e=0,Dt=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;_e<Dt;)this.localTransforms[_e]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[_e]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),_e+=1;if(this.finalTransform._localMatMdf){var Vt=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(Vt),_e=1;_e<Dt;_e+=1){var Gt=this.localTransforms[_e].matrix;Vt.multiply(Gt)}Vt.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var zt=this.finalTransform.localOpacity;for(_e=0;_e<Dt;_e+=1)zt*=this.localTransforms[_e].opacity*.01;this.finalTransform.localOpacity=zt}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var _e=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(_e.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var Dt=0,Vt=_e.length;for(Dt=0;Dt<Vt;Dt+=1)this.localTransforms.push(_e[Dt])}}},globalToLocal:function(_e){var Dt=[];Dt.push(this.finalTransform);for(var Vt=!0,Gt=this.comp;Vt;)Gt.finalTransform?(Gt.data.hasMask&&Dt.splice(0,0,Gt.finalTransform),Gt=Gt.comp):Vt=!1;var zt,jt=Dt.length,Ht;for(zt=0;zt<jt;zt+=1)Ht=Dt[zt].mat.applyToPointArray(0,0,0),_e=[_e[0]-Ht[0],_e[1]-Ht[1],0];return _e},mHelper:new Matrix};function MaskElement(kt,_e,Dt){this.data=kt,this.element=_e,this.globalData=Dt,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var Vt=this.globalData.defs,Gt,zt=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(zt),this.solidPath="";var jt,Ht=this.masksProperties,Wt=0,qt=[],Xt,Kt,Yt=createElementID(),Zt,Jt,nn,rn,Qt="clipPath",en="clip-path";for(Gt=0;Gt<zt;Gt+=1)if((Ht[Gt].mode!=="a"&&Ht[Gt].mode!=="n"||Ht[Gt].inv||Ht[Gt].o.k!==100||Ht[Gt].o.x)&&(Qt="mask",en="mask"),(Ht[Gt].mode==="s"||Ht[Gt].mode==="i")&&Wt===0?(Zt=createNS("rect"),Zt.setAttribute("fill","#ffffff"),Zt.setAttribute("width",this.element.comp.data.w||0),Zt.setAttribute("height",this.element.comp.data.h||0),qt.push(Zt)):Zt=null,jt=createNS("path"),Ht[Gt].mode==="n")this.viewData[Gt]={op:PropertyFactory.getProp(this.element,Ht[Gt].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,Ht[Gt],3),elem:jt,lastPath:""},Vt.appendChild(jt);else{Wt+=1,jt.setAttribute("fill",Ht[Gt].mode==="s"?"#000000":"#ffffff"),jt.setAttribute("clip-rule","nonzero");var tn;if(Ht[Gt].x.k!==0?(Qt="mask",en="mask",rn=PropertyFactory.getProp(this.element,Ht[Gt].x,0,null,this.element),tn=createElementID(),Jt=createNS("filter"),Jt.setAttribute("id",tn),nn=createNS("feMorphology"),nn.setAttribute("operator","erode"),nn.setAttribute("in","SourceGraphic"),nn.setAttribute("radius","0"),Jt.appendChild(nn),Vt.appendChild(Jt),jt.setAttribute("stroke",Ht[Gt].mode==="s"?"#000000":"#ffffff")):(nn=null,rn=null),this.storedData[Gt]={elem:jt,x:rn,expan:nn,lastPath:"",lastOperator:"",filterId:tn,lastRadius:0},Ht[Gt].mode==="i"){Kt=qt.length;var sn=createNS("g");for(Xt=0;Xt<Kt;Xt+=1)sn.appendChild(qt[Xt]);var cn=createNS("mask");cn.setAttribute("mask-type","alpha"),cn.setAttribute("id",Yt+"_"+Wt),cn.appendChild(jt),Vt.appendChild(cn),sn.setAttribute("mask","url("+getLocationHref()+"#"+Yt+"_"+Wt+")"),qt.length=0,qt.push(sn)}else qt.push(jt);Ht[Gt].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[Gt]={elem:jt,lastPath:"",op:PropertyFactory.getProp(this.element,Ht[Gt].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,Ht[Gt],3),invRect:Zt},this.viewData[Gt].prop.k||this.drawPath(Ht[Gt],this.viewData[Gt].prop.v,this.viewData[Gt])}for(this.maskElement=createNS(Qt),zt=qt.length,Gt=0;Gt<zt;Gt+=1)this.maskElement.appendChild(qt[Gt]);Wt>0&&(this.maskElement.setAttribute("id",Yt),this.element.maskedElement.setAttribute(en,"url("+getLocationHref()+"#"+Yt+")"),Vt.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(kt){return this.viewData[kt].prop},MaskElement.prototype.renderFrame=function(kt){var _e=this.element.finalTransform.mat,Dt,Vt=this.masksProperties.length;for(Dt=0;Dt<Vt;Dt+=1)if((this.viewData[Dt].prop._mdf||kt)&&this.drawPath(this.masksProperties[Dt],this.viewData[Dt].prop.v,this.viewData[Dt]),(this.viewData[Dt].op._mdf||kt)&&this.viewData[Dt].elem.setAttribute("fill-opacity",this.viewData[Dt].op.v),this.masksProperties[Dt].mode!=="n"&&(this.viewData[Dt].invRect&&(this.element.finalTransform.mProp._mdf||kt)&&this.viewData[Dt].invRect.setAttribute("transform",_e.getInverseMatrix().to2dCSS()),this.storedData[Dt].x&&(this.storedData[Dt].x._mdf||kt))){var Gt=this.storedData[Dt].expan;this.storedData[Dt].x.v<0?(this.storedData[Dt].lastOperator!=="erode"&&(this.storedData[Dt].lastOperator="erode",this.storedData[Dt].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[Dt].filterId+")")),Gt.setAttribute("radius",-this.storedData[Dt].x.v)):(this.storedData[Dt].lastOperator!=="dilate"&&(this.storedData[Dt].lastOperator="dilate",this.storedData[Dt].elem.setAttribute("filter",null)),this.storedData[Dt].elem.setAttribute("stroke-width",this.storedData[Dt].x.v*2))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var kt="M0,0 ";return kt+=" h"+this.globalData.compSize.w,kt+=" v"+this.globalData.compSize.h,kt+=" h-"+this.globalData.compSize.w,kt+=" v-"+this.globalData.compSize.h+" ",kt},MaskElement.prototype.drawPath=function(kt,_e,Dt){var Vt=" M"+_e.v[0][0]+","+_e.v[0][1],Gt,zt;for(zt=_e._length,Gt=1;Gt<zt;Gt+=1)Vt+=" C"+_e.o[Gt-1][0]+","+_e.o[Gt-1][1]+" "+_e.i[Gt][0]+","+_e.i[Gt][1]+" "+_e.v[Gt][0]+","+_e.v[Gt][1];if(_e.c&&zt>1&&(Vt+=" C"+_e.o[Gt-1][0]+","+_e.o[Gt-1][1]+" "+_e.i[0][0]+","+_e.i[0][1]+" "+_e.v[0][0]+","+_e.v[0][1]),Dt.lastPath!==Vt){var jt="";Dt.elem&&(_e.c&&(jt=kt.inv?this.solidPath+Vt:Vt),Dt.elem.setAttribute("d",jt)),Dt.lastPath=Vt}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var kt={};kt.createFilter=_e,kt.createAlphaToLuminanceFilter=Dt;function _e(Vt,Gt){var zt=createNS("filter");return zt.setAttribute("id",Vt),Gt!==!0&&(zt.setAttribute("filterUnits","objectBoundingBox"),zt.setAttribute("x","0%"),zt.setAttribute("y","0%"),zt.setAttribute("width","100%"),zt.setAttribute("height","100%")),zt}function Dt(){var Vt=createNS("feColorMatrix");return Vt.setAttribute("type","matrix"),Vt.setAttribute("color-interpolation-filters","sRGB"),Vt.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),Vt}return kt}(),featureSupport=function(){var kt={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(kt.maskType=!1),/firefox/i.test(navigator.userAgent)&&(kt.svgLumaHidden=!1),kt}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(kt){var _e,Dt="SourceGraphic",Vt=kt.data.ef?kt.data.ef.length:0,Gt=createElementID(),zt=filtersFactory.createFilter(Gt,!0),jt=0;this.filters=[];var Ht;for(_e=0;_e<Vt;_e+=1){Ht=null;var Wt=kt.data.ef[_e].ty;if(registeredEffects$1[Wt]){var qt=registeredEffects$1[Wt].effect;Ht=new qt(zt,kt.effectsManager.effectElements[_e],kt,idPrefix+jt,Dt),Dt=idPrefix+jt,registeredEffects$1[Wt].countsAsEffect&&(jt+=1)}Ht&&this.filters.push(Ht)}jt&&(kt.globalData.defs.appendChild(zt),kt.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+Gt+")")),this.filters.length&&kt.addRenderableComponent(this)}SVGEffects.prototype.renderFrame=function(kt){var _e,Dt=this.filters.length;for(_e=0;_e<Dt;_e+=1)this.filters[_e].renderFrame(kt)},SVGEffects.prototype.getEffects=function(kt){var _e,Dt=this.filters.length,Vt=[];for(_e=0;_e<Dt;_e+=1)this.filters[_e].type===kt&&Vt.push(this.filters[_e]);return Vt};function registerEffect$1(kt,_e,Dt){registeredEffects$1[kt]={effect:_e,countsAsEffect:Dt}}function SVGBaseElement(){}SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var _e=null;if(this.data.td){this.matteMasks={};var Dt=createNS("g");Dt.setAttribute("id",this.layerId),Dt.appendChild(this.layerElement),_e=Dt,this.globalData.defs.appendChild(Dt)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),_e=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var Vt=createNS("clipPath"),Gt=createNS("path");Gt.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var zt=createElementID();if(Vt.setAttribute("id",zt),Vt.appendChild(Gt),this.globalData.defs.appendChild(Vt),this.checkMasks()){var jt=createNS("g");jt.setAttribute("clip-path","url("+getLocationHref()+"#"+zt+")"),jt.appendChild(this.layerElement),this.transformedElement=jt,_e?_e.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+zt+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(_e){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[_e]){var Dt=this.layerId+"_"+_e,Vt,Gt,zt,jt;if(_e===1||_e===3){var Ht=createNS("mask");Ht.setAttribute("id",Dt),Ht.setAttribute("mask-type",_e===3?"luminance":"alpha"),zt=createNS("use"),zt.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),Ht.appendChild(zt),this.globalData.defs.appendChild(Ht),!featureSupport.maskType&&_e===1&&(Ht.setAttribute("mask-type","luminance"),Vt=createElementID(),Gt=filtersFactory.createFilter(Vt),this.globalData.defs.appendChild(Gt),Gt.appendChild(filtersFactory.createAlphaToLuminanceFilter()),jt=createNS("g"),jt.appendChild(zt),Ht.appendChild(jt),jt.setAttribute("filter","url("+getLocationHref()+"#"+Vt+")"))}else if(_e===2){var Wt=createNS("mask");Wt.setAttribute("id",Dt),Wt.setAttribute("mask-type","alpha");var qt=createNS("g");Wt.appendChild(qt),Vt=createElementID(),Gt=filtersFactory.createFilter(Vt);var Xt=createNS("feComponentTransfer");Xt.setAttribute("in","SourceGraphic"),Gt.appendChild(Xt);var Kt=createNS("feFuncA");Kt.setAttribute("type","table"),Kt.setAttribute("tableValues","1.0 0.0"),Xt.appendChild(Kt),this.globalData.defs.appendChild(Gt);var Yt=createNS("rect");Yt.setAttribute("width",this.comp.data.w),Yt.setAttribute("height",this.comp.data.h),Yt.setAttribute("x","0"),Yt.setAttribute("y","0"),Yt.setAttribute("fill","#ffffff"),Yt.setAttribute("opacity","0"),qt.setAttribute("filter","url("+getLocationHref()+"#"+Vt+")"),qt.appendChild(Yt),zt=createNS("use"),zt.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),qt.appendChild(zt),featureSupport.maskType||(Wt.setAttribute("mask-type","luminance"),Gt.appendChild(filtersFactory.createAlphaToLuminanceFilter()),jt=createNS("g"),qt.appendChild(Yt),jt.appendChild(this.layerElement),qt.appendChild(jt)),this.globalData.defs.appendChild(Wt)}this.matteMasks[_e]=Dt}return this.matteMasks[_e]},setMatte:function(_e){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+_e+")")}};function HierarchyElement(){}HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(_e){this.hierarchy=_e},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function RenderableDOMElement(){}(function(){var kt={initElement:function(Dt,Vt,Gt){this.initFrame(),this.initBaseData(Dt,Vt,Gt),this.initTransform(Dt,Vt,Gt),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var Dt=this.baseElement||this.layerElement;Dt.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var Dt=this.baseElement||this.layerElement;Dt.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(Dt){this._mdf=!1,this.prepareRenderableFrame(Dt),this.prepareProperties(Dt,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};extendPrototype([RenderableElement,createProxyFunction(kt)],RenderableDOMElement)})();function IImageElement(kt,_e,Dt){this.assetData=_e.getAssetData(kt.refId),this.assetData&&this.assetData.sid&&(this.assetData=_e.slotManager.getProp(this.assetData)),this.initElement(kt,_e,Dt),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var kt=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",kt),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect};function ProcessedElement(kt,_e){this.elem=kt,this.pos=_e}function IShapeElement(){}IShapeElement.prototype={addShapeToModifiers:function(_e){var Dt,Vt=this.shapeModifiers.length;for(Dt=0;Dt<Vt;Dt+=1)this.shapeModifiers[Dt].addShape(_e)},isShapeInAnimatedModifiers:function(_e){for(var Dt=0,Vt=this.shapeModifiers.length;Dt<Vt;)if(this.shapeModifiers[Dt].isAnimatedWithShape(_e))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var _e,Dt=this.shapes.length;for(_e=0;_e<Dt;_e+=1)this.shapes[_e].sh.reset();Dt=this.shapeModifiers.length;var Vt;for(_e=Dt-1;_e>=0&&(Vt=this.shapeModifiers[_e].processShapes(this._isFirstFrame),!Vt);_e-=1);}},searchProcessedElement:function(_e){for(var Dt=this.processedElements,Vt=0,Gt=Dt.length;Vt<Gt;){if(Dt[Vt].elem===_e)return Dt[Vt].pos;Vt+=1}return 0},addProcessedElement:function(_e,Dt){for(var Vt=this.processedElements,Gt=Vt.length;Gt;)if(Gt-=1,Vt[Gt].elem===_e){Vt[Gt].pos=Dt;return}Vt.push(new ProcessedElement(_e,Dt))},prepareFrame:function(_e){this.prepareRenderableFrame(_e),this.prepareProperties(_e,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(kt,_e,Dt){this.caches=[],this.styles=[],this.transformers=kt,this.lStr="",this.sh=Dt,this.lvl=_e,this._isAnimated=!!Dt.k;for(var Vt=0,Gt=kt.length;Vt<Gt;){if(kt[Vt].mProps.dynamicProperties.length){this._isAnimated=!0;break}Vt+=1}}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0};function SVGStyleData(kt,_e){this.data=kt,this.type=kt.ty,this.d="",this.lvl=_e,this._mdf=!1,this.closed=kt.hd===!0,this.pElem=createNS("path"),this.msElem=null}SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1};function DashProperty(kt,_e,Dt,Vt){this.elem=kt,this.frameId=-1,this.dataProps=createSizedArray(_e.length),this.renderer=Dt,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",_e.length?_e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(Vt);var Gt,zt=_e.length||0,jt;for(Gt=0;Gt<zt;Gt+=1)jt=PropertyFactory.getProp(kt,_e[Gt].v,0,0,this),this.k=jt.k||this.k,this.dataProps[Gt]={n:_e[Gt].n,p:jt};this.k||this.getValue(!0),this._isAnimated=this.k}DashProperty.prototype.getValue=function(kt){if(!(this.elem.globalData.frameId===this.frameId&&!kt)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||kt,this._mdf)){var _e=0,Dt=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),_e=0;_e<Dt;_e+=1)this.dataProps[_e].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[_e].p.v:this.dashArray[_e]=this.dataProps[_e].p.v:this.dashoffset[0]=this.dataProps[_e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty);function SVGStrokeStyleData(kt,_e,Dt){this.initDynamicPropertyContainer(kt),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(kt,_e.o,0,.01,this),this.w=PropertyFactory.getProp(kt,_e.w,0,null,this),this.d=new DashProperty(kt,_e.d||{},"svg",this),this.c=PropertyFactory.getProp(kt,_e.c,1,255,this),this.style=Dt,this._isAnimated=!!this._isAnimated}extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData);function SVGFillStyleData(kt,_e,Dt){this.initDynamicPropertyContainer(kt),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(kt,_e.o,0,.01,this),this.c=PropertyFactory.getProp(kt,_e.c,1,255,this),this.style=Dt}extendPrototype([DynamicPropertyContainer],SVGFillStyleData);function SVGNoStyleData(kt,_e,Dt){this.initDynamicPropertyContainer(kt),this.getValue=this.iterateDynamicProperties,this.style=Dt}extendPrototype([DynamicPropertyContainer],SVGNoStyleData);function GradientProperty(kt,_e,Dt){this.data=_e,this.c=createTypedArray("uint8c",_e.p*4);var Vt=_e.k.k[0].s?_e.k.k[0].s.length-_e.p*4:_e.k.k.length-_e.p*4;this.o=createTypedArray("float32",Vt),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=Vt,this.initDynamicPropertyContainer(Dt),this.prop=PropertyFactory.getProp(kt,_e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}GradientProperty.prototype.comparePoints=function(kt,_e){for(var Dt=0,Vt=this.o.length/2,Gt;Dt<Vt;){if(Gt=Math.abs(kt[Dt*4]-kt[_e*4+Dt*2]),Gt>.01)return!1;Dt+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var kt=0,_e=this.data.k.k.length;kt<_e;){if(!this.comparePoints(this.data.k.k[kt].s,this.data.p))return!1;kt+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(kt){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||kt){var _e,Dt=this.data.p*4,Vt,Gt;for(_e=0;_e<Dt;_e+=1)Vt=_e%4===0?100:255,Gt=Math.round(this.prop.v[_e]*Vt),this.c[_e]!==Gt&&(this.c[_e]=Gt,this._cmdf=!kt);if(this.o.length)for(Dt=this.prop.v.length,_e=this.data.p*4;_e<Dt;_e+=1)Vt=_e%2===0?100:1,Gt=_e%2===0?Math.round(this.prop.v[_e]*100):this.prop.v[_e],this.o[_e-this.data.p*4]!==Gt&&(this.o[_e-this.data.p*4]=Gt,this._omdf=!kt);this._mdf=!kt}},extendPrototype([DynamicPropertyContainer],GradientProperty);function SVGGradientFillStyleData(kt,_e,Dt){this.initDynamicPropertyContainer(kt),this.getValue=this.iterateDynamicProperties,this.initGradientData(kt,_e,Dt)}SVGGradientFillStyleData.prototype.initGradientData=function(kt,_e,Dt){this.o=PropertyFactory.getProp(kt,_e.o,0,.01,this),this.s=PropertyFactory.getProp(kt,_e.s,1,null,this),this.e=PropertyFactory.getProp(kt,_e.e,1,null,this),this.h=PropertyFactory.getProp(kt,_e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(kt,_e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(kt,_e.g,this),this.style=Dt,this.stops=[],this.setGradientData(Dt.pElem,_e),this.setGradientOpacity(_e,Dt),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(kt,_e){var Dt=createElementID(),Vt=createNS(_e.t===1?"linearGradient":"radialGradient");Vt.setAttribute("id",Dt),Vt.setAttribute("spreadMethod","pad"),Vt.setAttribute("gradientUnits","userSpaceOnUse");var Gt=[],zt,jt,Ht;for(Ht=_e.g.p*4,jt=0;jt<Ht;jt+=4)zt=createNS("stop"),Vt.appendChild(zt),Gt.push(zt);kt.setAttribute(_e.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+Dt+")"),this.gf=Vt,this.cst=Gt},SVGGradientFillStyleData.prototype.setGradientOpacity=function(kt,_e){if(this.g._hasOpacity&&!this.g._collapsable){var Dt,Vt,Gt,zt=createNS("mask"),jt=createNS("path");zt.appendChild(jt);var Ht=createElementID(),Wt=createElementID();zt.setAttribute("id",Wt);var qt=createNS(kt.t===1?"linearGradient":"radialGradient");qt.setAttribute("id",Ht),qt.setAttribute("spreadMethod","pad"),qt.setAttribute("gradientUnits","userSpaceOnUse"),Gt=kt.g.k.k[0].s?kt.g.k.k[0].s.length:kt.g.k.k.length;var Xt=this.stops;for(Vt=kt.g.p*4;Vt<Gt;Vt+=2)Dt=createNS("stop"),Dt.setAttribute("stop-color","rgb(255,255,255)"),qt.appendChild(Dt),Xt.push(Dt);jt.setAttribute(kt.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+Ht+")"),kt.ty==="gs"&&(jt.setAttribute("stroke-linecap",lineCapEnum[kt.lc||2]),jt.setAttribute("stroke-linejoin",lineJoinEnum[kt.lj||2]),kt.lj===1&&jt.setAttribute("stroke-miterlimit",kt.ml)),this.of=qt,this.ms=zt,this.ost=Xt,this.maskId=Wt,_e.msElem=jt}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData);function SVGGradientStrokeStyleData(kt,_e,Dt){this.initDynamicPropertyContainer(kt),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(kt,_e.w,0,null,this),this.d=new DashProperty(kt,_e.d||{},"svg",this),this.initGradientData(kt,_e,Dt),this._isAnimated=!!this._isAnimated}extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(kt,_e,Dt){this.transform={mProps:kt,op:_e,container:Dt},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var buildShapeString=function(_e,Dt,Vt,Gt){if(Dt===0)return"";var zt=_e.o,jt=_e.i,Ht=_e.v,Wt,qt=" M"+Gt.applyToPointStringified(Ht[0][0],Ht[0][1]);for(Wt=1;Wt<Dt;Wt+=1)qt+=" C"+Gt.applyToPointStringified(zt[Wt-1][0],zt[Wt-1][1])+" "+Gt.applyToPointStringified(jt[Wt][0],jt[Wt][1])+" "+Gt.applyToPointStringified(Ht[Wt][0],Ht[Wt][1]);return Vt&&Dt&&(qt+=" C"+Gt.applyToPointStringified(zt[Wt-1][0],zt[Wt-1][1])+" "+Gt.applyToPointStringified(jt[0][0],jt[0][1])+" "+Gt.applyToPointStringified(Ht[0][0],Ht[0][1]),qt+="z"),qt},SVGElementsRenderer=function(){var kt=new Matrix,_e=new Matrix,Dt={createRenderFunction:Vt};function Vt(Kt){switch(Kt.ty){case"fl":return Ht;case"gf":return qt;case"gs":return Wt;case"st":return Xt;case"sh":case"el":case"rc":case"sr":return jt;case"tr":return Gt;case"no":return zt;default:return null}}function Gt(Kt,Yt,Zt){(Zt||Yt.transform.op._mdf)&&Yt.transform.container.setAttribute("opacity",Yt.transform.op.v),(Zt||Yt.transform.mProps._mdf)&&Yt.transform.container.setAttribute("transform",Yt.transform.mProps.v.to2dCSS())}function zt(){}function jt(Kt,Yt,Zt){var Jt,nn,rn,Qt,en,tn,sn=Yt.styles.length,cn=Yt.lvl,un,hn,dn,pn;for(tn=0;tn<sn;tn+=1){if(Qt=Yt.sh._mdf||Zt,Yt.styles[tn].lvl<cn){for(hn=_e.reset(),dn=cn-Yt.styles[tn].lvl,pn=Yt.transformers.length-1;!Qt&&dn>0;)Qt=Yt.transformers[pn].mProps._mdf||Qt,dn-=1,pn-=1;if(Qt)for(dn=cn-Yt.styles[tn].lvl,pn=Yt.transformers.length-1;dn>0;)hn.multiply(Yt.transformers[pn].mProps.v),dn-=1,pn-=1}else hn=kt;if(un=Yt.sh.paths,nn=un._length,Qt){for(rn="",Jt=0;Jt<nn;Jt+=1)en=un.shapes[Jt],en&&en._length&&(rn+=buildShapeString(en,en._length,en.c,hn));Yt.caches[tn]=rn}else rn=Yt.caches[tn];Yt.styles[tn].d+=Kt.hd===!0?"":rn,Yt.styles[tn]._mdf=Qt||Yt.styles[tn]._mdf}}function Ht(Kt,Yt,Zt){var Jt=Yt.style;(Yt.c._mdf||Zt)&&Jt.pElem.setAttribute("fill","rgb("+bmFloor(Yt.c.v[0])+","+bmFloor(Yt.c.v[1])+","+bmFloor(Yt.c.v[2])+")"),(Yt.o._mdf||Zt)&&Jt.pElem.setAttribute("fill-opacity",Yt.o.v)}function Wt(Kt,Yt,Zt){qt(Kt,Yt,Zt),Xt(Kt,Yt,Zt)}function qt(Kt,Yt,Zt){var Jt=Yt.gf,nn=Yt.g._hasOpacity,rn=Yt.s.v,Qt=Yt.e.v;if(Yt.o._mdf||Zt){var en=Kt.ty==="gf"?"fill-opacity":"stroke-opacity";Yt.style.pElem.setAttribute(en,Yt.o.v)}if(Yt.s._mdf||Zt){var tn=Kt.t===1?"x1":"cx",sn=tn==="x1"?"y1":"cy";Jt.setAttribute(tn,rn[0]),Jt.setAttribute(sn,rn[1]),nn&&!Yt.g._collapsable&&(Yt.of.setAttribute(tn,rn[0]),Yt.of.setAttribute(sn,rn[1]))}var cn,un,hn,dn;if(Yt.g._cmdf||Zt){cn=Yt.cst;var pn=Yt.g.c;for(hn=cn.length,un=0;un<hn;un+=1)dn=cn[un],dn.setAttribute("offset",pn[un*4]+"%"),dn.setAttribute("stop-color","rgb("+pn[un*4+1]+","+pn[un*4+2]+","+pn[un*4+3]+")")}if(nn&&(Yt.g._omdf||Zt)){var fn=Yt.g.o;for(Yt.g._collapsable?cn=Yt.cst:cn=Yt.ost,hn=cn.length,un=0;un<hn;un+=1)dn=cn[un],Yt.g._collapsable||dn.setAttribute("offset",fn[un*2]+"%"),dn.setAttribute("stop-opacity",fn[un*2+1])}if(Kt.t===1)(Yt.e._mdf||Zt)&&(Jt.setAttribute("x2",Qt[0]),Jt.setAttribute("y2",Qt[1]),nn&&!Yt.g._collapsable&&(Yt.of.setAttribute("x2",Qt[0]),Yt.of.setAttribute("y2",Qt[1])));else{var mn;if((Yt.s._mdf||Yt.e._mdf||Zt)&&(mn=Math.sqrt(Math.pow(rn[0]-Qt[0],2)+Math.pow(rn[1]-Qt[1],2)),Jt.setAttribute("r",mn),nn&&!Yt.g._collapsable&&Yt.of.setAttribute("r",mn)),Yt.e._mdf||Yt.h._mdf||Yt.a._mdf||Zt){mn||(mn=Math.sqrt(Math.pow(rn[0]-Qt[0],2)+Math.pow(rn[1]-Qt[1],2)));var vn=Math.atan2(Qt[1]-rn[1],Qt[0]-rn[0]),_n=Yt.h.v;_n>=1?_n=.99:_n<=-1&&(_n=-.99);var En=mn*_n,An=Math.cos(vn+Yt.a.v)*En+rn[0],Tn=Math.sin(vn+Yt.a.v)*En+rn[1];Jt.setAttribute("fx",An),Jt.setAttribute("fy",Tn),nn&&!Yt.g._collapsable&&(Yt.of.setAttribute("fx",An),Yt.of.setAttribute("fy",Tn))}}}function Xt(Kt,Yt,Zt){var Jt=Yt.style,nn=Yt.d;nn&&(nn._mdf||Zt)&&nn.dashStr&&(Jt.pElem.setAttribute("stroke-dasharray",nn.dashStr),Jt.pElem.setAttribute("stroke-dashoffset",nn.dashoffset[0])),Yt.c&&(Yt.c._mdf||Zt)&&Jt.pElem.setAttribute("stroke","rgb("+bmFloor(Yt.c.v[0])+","+bmFloor(Yt.c.v[1])+","+bmFloor(Yt.c.v[2])+")"),(Yt.o._mdf||Zt)&&Jt.pElem.setAttribute("stroke-opacity",Yt.o.v),(Yt.w._mdf||Zt)&&(Jt.pElem.setAttribute("stroke-width",Yt.w.v),Jt.msElem&&Jt.msElem.setAttribute("stroke-width",Yt.w.v))}return Dt}();function SVGShapeElement(kt,_e,Dt){this.shapes=[],this.shapesData=kt.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(kt,_e,Dt),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var kt,_e=this.shapes.length,Dt,Vt,Gt=this.stylesList.length,zt,jt=[],Ht=!1;for(Vt=0;Vt<Gt;Vt+=1){for(zt=this.stylesList[Vt],Ht=!1,jt.length=0,kt=0;kt<_e;kt+=1)Dt=this.shapes[kt],Dt.styles.indexOf(zt)!==-1&&(jt.push(Dt),Ht=Dt._isAnimated||Ht);jt.length>1&&Ht&&this.setShapesAsAnimated(jt)}},SVGShapeElement.prototype.setShapesAsAnimated=function(kt){var _e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)kt[_e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(kt,_e){var Dt,Vt=new SVGStyleData(kt,_e),Gt=Vt.pElem;if(kt.ty==="st")Dt=new SVGStrokeStyleData(this,kt,Vt);else if(kt.ty==="fl")Dt=new SVGFillStyleData(this,kt,Vt);else if(kt.ty==="gf"||kt.ty==="gs"){var zt=kt.ty==="gf"?SVGGradientFillStyleData:SVGGradientStrokeStyleData;Dt=new zt(this,kt,Vt),this.globalData.defs.appendChild(Dt.gf),Dt.maskId&&(this.globalData.defs.appendChild(Dt.ms),this.globalData.defs.appendChild(Dt.of),Gt.setAttribute("mask","url("+getLocationHref()+"#"+Dt.maskId+")"))}else kt.ty==="no"&&(Dt=new SVGNoStyleData(this,kt,Vt));return(kt.ty==="st"||kt.ty==="gs")&&(Gt.setAttribute("stroke-linecap",lineCapEnum[kt.lc||2]),Gt.setAttribute("stroke-linejoin",lineJoinEnum[kt.lj||2]),Gt.setAttribute("fill-opacity","0"),kt.lj===1&&Gt.setAttribute("stroke-miterlimit",kt.ml)),kt.r===2&&Gt.setAttribute("fill-rule","evenodd"),kt.ln&&Gt.setAttribute("id",kt.ln),kt.cl&&Gt.setAttribute("class",kt.cl),kt.bm&&(Gt.style["mix-blend-mode"]=getBlendMode(kt.bm)),this.stylesList.push(Vt),this.addToAnimatedContents(kt,Dt),Dt},SVGShapeElement.prototype.createGroupElement=function(kt){var _e=new ShapeGroupData;return kt.ln&&_e.gr.setAttribute("id",kt.ln),kt.cl&&_e.gr.setAttribute("class",kt.cl),kt.bm&&(_e.gr.style["mix-blend-mode"]=getBlendMode(kt.bm)),_e},SVGShapeElement.prototype.createTransformElement=function(kt,_e){var Dt=TransformPropertyFactory.getTransformProperty(this,kt,this),Vt=new SVGTransformData(Dt,Dt.o,_e);return this.addToAnimatedContents(kt,Vt),Vt},SVGShapeElement.prototype.createShapeElement=function(kt,_e,Dt){var Vt=4;kt.ty==="rc"?Vt=5:kt.ty==="el"?Vt=6:kt.ty==="sr"&&(Vt=7);var Gt=ShapePropertyFactory.getShapeProp(this,kt,Vt,this),zt=new SVGShapeData(_e,Dt,Gt);return this.shapes.push(zt),this.addShapeToModifiers(zt),this.addToAnimatedContents(kt,zt),zt},SVGShapeElement.prototype.addToAnimatedContents=function(kt,_e){for(var Dt=0,Vt=this.animatedContents.length;Dt<Vt;){if(this.animatedContents[Dt].element===_e)return;Dt+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(kt),element:_e,data:kt})},SVGShapeElement.prototype.setElementStyles=function(kt){var _e=kt.styles,Dt,Vt=this.stylesList.length;for(Dt=0;Dt<Vt;Dt+=1)this.stylesList[Dt].closed||_e.push(this.stylesList[Dt])},SVGShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var kt,_e=this.itemsData.length;for(kt=0;kt<_e;kt+=1)this.prevViewData[kt]=this.itemsData[kt];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),_e=this.dynamicProperties.length,kt=0;kt<_e;kt+=1)this.dynamicProperties[kt].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(kt,_e,Dt,Vt,Gt,zt,jt){var Ht=[].concat(zt),Wt,qt=kt.length-1,Xt,Kt,Yt=[],Zt=[],Jt,nn,rn;for(Wt=qt;Wt>=0;Wt-=1){if(rn=this.searchProcessedElement(kt[Wt]),rn?_e[Wt]=Dt[rn-1]:kt[Wt]._render=jt,kt[Wt].ty==="fl"||kt[Wt].ty==="st"||kt[Wt].ty==="gf"||kt[Wt].ty==="gs"||kt[Wt].ty==="no")rn?_e[Wt].style.closed=!1:_e[Wt]=this.createStyleElement(kt[Wt],Gt),kt[Wt]._render&&_e[Wt].style.pElem.parentNode!==Vt&&Vt.appendChild(_e[Wt].style.pElem),Yt.push(_e[Wt].style);else if(kt[Wt].ty==="gr"){if(!rn)_e[Wt]=this.createGroupElement(kt[Wt]);else for(Kt=_e[Wt].it.length,Xt=0;Xt<Kt;Xt+=1)_e[Wt].prevViewData[Xt]=_e[Wt].it[Xt];this.searchShapes(kt[Wt].it,_e[Wt].it,_e[Wt].prevViewData,_e[Wt].gr,Gt+1,Ht,jt),kt[Wt]._render&&_e[Wt].gr.parentNode!==Vt&&Vt.appendChild(_e[Wt].gr)}else kt[Wt].ty==="tr"?(rn||(_e[Wt]=this.createTransformElement(kt[Wt],Vt)),Jt=_e[Wt].transform,Ht.push(Jt)):kt[Wt].ty==="sh"||kt[Wt].ty==="rc"||kt[Wt].ty==="el"||kt[Wt].ty==="sr"?(rn||(_e[Wt]=this.createShapeElement(kt[Wt],Ht,Gt)),this.setElementStyles(_e[Wt])):kt[Wt].ty==="tm"||kt[Wt].ty==="rd"||kt[Wt].ty==="ms"||kt[Wt].ty==="pb"||kt[Wt].ty==="zz"||kt[Wt].ty==="op"?(rn?(nn=_e[Wt],nn.closed=!1):(nn=ShapeModifiers.getModifier(kt[Wt].ty),nn.init(this,kt[Wt]),_e[Wt]=nn,this.shapeModifiers.push(nn)),Zt.push(nn)):kt[Wt].ty==="rp"&&(rn?(nn=_e[Wt],nn.closed=!0):(nn=ShapeModifiers.getModifier(kt[Wt].ty),_e[Wt]=nn,nn.init(this,kt,Wt,_e),this.shapeModifiers.push(nn),jt=!1),Zt.push(nn));this.addProcessedElement(kt[Wt],Wt+1)}for(qt=Yt.length,Wt=0;Wt<qt;Wt+=1)Yt[Wt].closed=!0;for(qt=Zt.length,Wt=0;Wt<qt;Wt+=1)Zt[Wt].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){this.renderModifiers();var kt,_e=this.stylesList.length;for(kt=0;kt<_e;kt+=1)this.stylesList[kt].reset();for(this.renderShape(),kt=0;kt<_e;kt+=1)(this.stylesList[kt]._mdf||this._isFirstFrame)&&(this.stylesList[kt].msElem&&(this.stylesList[kt].msElem.setAttribute("d",this.stylesList[kt].d),this.stylesList[kt].d="M0 0"+this.stylesList[kt].d),this.stylesList[kt].pElem.setAttribute("d",this.stylesList[kt].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var kt,_e=this.animatedContents.length,Dt;for(kt=0;kt<_e;kt+=1)Dt=this.animatedContents[kt],(this._isFirstFrame||Dt.element._isAnimated)&&Dt.data!==!0&&Dt.fn(Dt.data,Dt.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function LetterProps(kt,_e,Dt,Vt,Gt,zt){this.o=kt,this.sw=_e,this.sc=Dt,this.fc=Vt,this.m=Gt,this.p=zt,this._mdf={o:!0,sw:!!_e,sc:!!Dt,fc:!!Vt,m:!0,p:!0}}LetterProps.prototype.update=function(kt,_e,Dt,Vt,Gt,zt){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var jt=!1;return this.o!==kt&&(this.o=kt,this._mdf.o=!0,jt=!0),this.sw!==_e&&(this.sw=_e,this._mdf.sw=!0,jt=!0),this.sc!==Dt&&(this.sc=Dt,this._mdf.sc=!0,jt=!0),this.fc!==Vt&&(this.fc=Vt,this._mdf.fc=!0,jt=!0),this.m!==Gt&&(this.m=Gt,this._mdf.m=!0,jt=!0),zt.length&&(this.p[0]!==zt[0]||this.p[1]!==zt[1]||this.p[4]!==zt[4]||this.p[5]!==zt[5]||this.p[12]!==zt[12]||this.p[13]!==zt[13])&&(this.p=zt,this._mdf.p=!0,jt=!0),jt};function TextProperty(kt,_e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,_e.d&&_e.d.sid&&(_e.d=kt.globalData.slotManager.getProp(_e.d)),this.data=_e,this.elem=kt,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(kt,_e){for(var Dt in _e)Object.prototype.hasOwnProperty.call(_e,Dt)&&(kt[Dt]=_e[Dt]);return kt},TextProperty.prototype.setCurrentData=function(kt){kt.__complete||this.completeTextData(kt),this.currentData=kt,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(kt){this.effectsSequence.push(kt),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(kt){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!kt)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var _e=this.currentData,Dt=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var Vt,Gt=this.effectsSequence.length,zt=kt||this.data.d.k[this.keysIndex].s;for(Vt=0;Vt<Gt;Vt+=1)Dt!==this.keysIndex?zt=this.effectsSequence[Vt](zt,zt.t):zt=this.effectsSequence[Vt](this.currentData,zt.t);_e!==zt&&this.setCurrentData(zt),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},TextProperty.prototype.getKeyframeValue=function(){for(var kt=this.data.d.k,_e=this.elem.comp.renderedFrame,Dt=0,Vt=kt.length;Dt<=Vt-1&&!(Dt===Vt-1||kt[Dt+1].t>_e);)Dt+=1;return this.keysIndex!==Dt&&(this.keysIndex=Dt),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(kt){for(var _e=[],Dt=0,Vt=kt.length,Gt,zt,jt=!1,Ht=!1,Wt="";Dt<Vt;)jt=Ht,Ht=!1,Gt=kt.charCodeAt(Dt),Wt=kt.charAt(Dt),FontManager.isCombinedCharacter(Gt)?jt=!0:Gt>=55296&&Gt<=56319?FontManager.isRegionalFlag(kt,Dt)?Wt=kt.substr(Dt,14):(zt=kt.charCodeAt(Dt+1),zt>=56320&&zt<=57343&&(FontManager.isModifier(Gt,zt)?(Wt=kt.substr(Dt,2),jt=!0):FontManager.isFlagEmoji(kt.substr(Dt,4))?Wt=kt.substr(Dt,4):Wt=kt.substr(Dt,2))):Gt>56319?(zt=kt.charCodeAt(Dt+1),FontManager.isVariationSelector(Gt)&&(jt=!0)):FontManager.isZeroWidthJoiner(Gt)&&(jt=!0,Ht=!0),jt?(_e[_e.length-1]+=Wt,jt=!1):_e.push(Wt),Dt+=Wt.length;return _e},TextProperty.prototype.completeTextData=function(kt){kt.__complete=!0;var _e=this.elem.globalData.fontManager,Dt=this.data,Vt=[],Gt,zt,jt,Ht=0,Wt,qt=Dt.m.g,Xt=0,Kt=0,Yt=0,Zt=[],Jt=0,nn=0,rn,Qt,en=_e.getFontByName(kt.f),tn,sn=0,cn=getFontProperties(en);kt.fWeight=cn.weight,kt.fStyle=cn.style,kt.finalSize=kt.s,kt.finalText=this.buildFinalText(kt.t),zt=kt.finalText.length,kt.finalLineHeight=kt.lh;var un=kt.tr/1e3*kt.finalSize,hn;if(kt.sz)for(var dn=!0,pn=kt.sz[0],fn=kt.sz[1],mn,vn;dn;){vn=this.buildFinalText(kt.t),mn=0,Jt=0,zt=vn.length,un=kt.tr/1e3*kt.finalSize;var _n=-1;for(Gt=0;Gt<zt;Gt+=1)hn=vn[Gt].charCodeAt(0),jt=!1,vn[Gt]===" "?_n=Gt:(hn===13||hn===3)&&(Jt=0,jt=!0,mn+=kt.finalLineHeight||kt.finalSize*1.2),_e.chars?(tn=_e.getCharData(vn[Gt],en.fStyle,en.fFamily),sn=jt?0:tn.w*kt.finalSize/100):sn=_e.measureText(vn[Gt],kt.f,kt.finalSize),Jt+sn>pn&&vn[Gt]!==" "?(_n===-1?zt+=1:Gt=_n,mn+=kt.finalLineHeight||kt.finalSize*1.2,vn.splice(Gt,_n===Gt?1:0,"\r"),_n=-1,Jt=0):(Jt+=sn,Jt+=un);mn+=en.ascent*kt.finalSize/100,this.canResize&&kt.finalSize>this.minimumFontSize&&fn<mn?(kt.finalSize-=1,kt.finalLineHeight=kt.finalSize*kt.lh/kt.s):(kt.finalText=vn,zt=kt.finalText.length,dn=!1)}Jt=-un,sn=0;var En=0,An;for(Gt=0;Gt<zt;Gt+=1)if(jt=!1,An=kt.finalText[Gt],hn=An.charCodeAt(0),hn===13||hn===3?(En=0,Zt.push(Jt),nn=Jt>nn?Jt:nn,Jt=-2*un,Wt="",jt=!0,Yt+=1):Wt=An,_e.chars?(tn=_e.getCharData(An,en.fStyle,_e.getFontByName(kt.f).fFamily),sn=jt?0:tn.w*kt.finalSize/100):sn=_e.measureText(Wt,kt.f,kt.finalSize),An===" "?En+=sn+un:(Jt+=sn+un+En,En=0),Vt.push({l:sn,an:sn,add:Xt,n:jt,anIndexes:[],val:Wt,line:Yt,animatorJustifyOffset:0}),qt==2){if(Xt+=sn,Wt===""||Wt===" "||Gt===zt-1){for((Wt===""||Wt===" ")&&(Xt-=sn);Kt<=Gt;)Vt[Kt].an=Xt,Vt[Kt].ind=Ht,Vt[Kt].extra=sn,Kt+=1;Ht+=1,Xt=0}}else if(qt==3){if(Xt+=sn,Wt===""||Gt===zt-1){for(Wt===""&&(Xt-=sn);Kt<=Gt;)Vt[Kt].an=Xt,Vt[Kt].ind=Ht,Vt[Kt].extra=sn,Kt+=1;Xt=0,Ht+=1}}else Vt[Ht].ind=Ht,Vt[Ht].extra=0,Ht+=1;if(kt.l=Vt,nn=Jt>nn?Jt:nn,Zt.push(Jt),kt.sz)kt.boxWidth=kt.sz[0],kt.justifyOffset=0;else switch(kt.boxWidth=nn,kt.j){case 1:kt.justifyOffset=-kt.boxWidth;break;case 2:kt.justifyOffset=-kt.boxWidth/2;break;default:kt.justifyOffset=0}kt.lineWidths=Zt;var Tn=Dt.a,Cn,yn;Qt=Tn.length;var Sn,wn,xn=[];for(rn=0;rn<Qt;rn+=1){for(Cn=Tn[rn],Cn.a.sc&&(kt.strokeColorAnim=!0),Cn.a.sw&&(kt.strokeWidthAnim=!0),(Cn.a.fc||Cn.a.fh||Cn.a.fs||Cn.a.fb)&&(kt.fillColorAnim=!0),wn=0,Sn=Cn.s.b,Gt=0;Gt<zt;Gt+=1)yn=Vt[Gt],yn.anIndexes[rn]=wn,(Sn==1&&yn.val!==""||Sn==2&&yn.val!==""&&yn.val!==" "||Sn==3&&(yn.n||yn.val==" "||Gt==zt-1)||Sn==4&&(yn.n||Gt==zt-1))&&(Cn.s.rn===1&&xn.push(wn),wn+=1);Dt.a[rn].s.totalChars=wn;var Rn=-1,Dn;if(Cn.s.rn===1)for(Gt=0;Gt<zt;Gt+=1)yn=Vt[Gt],Rn!=yn.anIndexes[rn]&&(Rn=yn.anIndexes[rn],Dn=xn.splice(Math.floor(Math.random()*xn.length),1)[0]),yn.anIndexes[rn]=Dn}kt.yOffset=kt.finalLineHeight||kt.finalSize*1.2,kt.ls=kt.ls||0,kt.ascent=en.ascent*kt.finalSize/100},TextProperty.prototype.updateDocumentData=function(kt,_e){_e=_e===void 0?this.keysIndex:_e;var Dt=this.copyData({},this.data.d.k[_e].s);Dt=this.copyData(Dt,kt),this.data.d.k[_e].s=Dt,this.recalculate(_e),this.setCurrentData(Dt),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(kt){var _e=this.data.d.k[kt].s;_e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(_e)},TextProperty.prototype.canResizeFont=function(kt){this.canResize=kt,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(kt){this.minimumFontSize=Math.floor(kt)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var kt=Math.max,_e=Math.min,Dt=Math.floor;function Vt(zt,jt){this._currentTextLength=-1,this.k=!1,this.data=jt,this.elem=zt,this.comp=zt.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(zt),this.s=PropertyFactory.getProp(zt,jt.s||{k:0},0,0,this),"e"in jt?this.e=PropertyFactory.getProp(zt,jt.e,0,0,this):this.e={v:100},this.o=PropertyFactory.getProp(zt,jt.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(zt,jt.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(zt,jt.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(zt,jt.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(zt,jt.a,0,.01,this),this.dynamicProperties.length||this.getValue()}Vt.prototype={getMult:function(jt){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var Ht=0,Wt=0,qt=1,Xt=1;this.ne.v>0?Ht=this.ne.v/100:Wt=-this.ne.v/100,this.xe.v>0?qt=1-this.xe.v/100:Xt=1+this.xe.v/100;var Kt=BezierFactory.getBezierEasing(Ht,Wt,qt,Xt).get,Yt=0,Zt=this.finalS,Jt=this.finalE,nn=this.data.sh;if(nn===2)Jt===Zt?Yt=jt>=Jt?1:0:Yt=kt(0,_e(.5/(Jt-Zt)+(jt-Zt)/(Jt-Zt),1)),Yt=Kt(Yt);else if(nn===3)Jt===Zt?Yt=jt>=Jt?0:1:Yt=1-kt(0,_e(.5/(Jt-Zt)+(jt-Zt)/(Jt-Zt),1)),Yt=Kt(Yt);else if(nn===4)Jt===Zt?Yt=0:(Yt=kt(0,_e(.5/(Jt-Zt)+(jt-Zt)/(Jt-Zt),1)),Yt<.5?Yt*=2:Yt=1-2*(Yt-.5)),Yt=Kt(Yt);else if(nn===5){if(Jt===Zt)Yt=0;else{var rn=Jt-Zt;jt=_e(kt(0,jt+.5-Zt),Jt-Zt);var Qt=-rn/2+jt,en=rn/2;Yt=Math.sqrt(1-Qt*Qt/(en*en))}Yt=Kt(Yt)}else nn===6?(Jt===Zt?Yt=0:(jt=_e(kt(0,jt+.5-Zt),Jt-Zt),Yt=(1+Math.cos(Math.PI+Math.PI*2*jt/(Jt-Zt)))/2),Yt=Kt(Yt)):(jt>=Dt(Zt)&&(jt-Zt<0?Yt=kt(0,_e(_e(Jt,1)-(Zt-jt),1)):Yt=kt(0,_e(Jt-jt,1))),Yt=Kt(Yt));if(this.sm.v!==100){var tn=this.sm.v*.01;tn===0&&(tn=1e-8);var sn=.5-tn*.5;Yt<sn?Yt=0:(Yt=(Yt-sn)/tn,Yt>1&&(Yt=1))}return Yt*this.a.v},getValue:function(jt){this.iterateDynamicProperties(),this._mdf=jt||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,jt&&this.data.r===2&&(this.e.v=this._currentTextLength);var Ht=this.data.r===2?1:100/this.data.totalChars,Wt=this.o.v/Ht,qt=this.s.v/Ht+Wt,Xt=this.e.v/Ht+Wt;if(qt>Xt){var Kt=qt;qt=Xt,Xt=Kt}this.finalS=qt,this.finalE=Xt}},extendPrototype([DynamicPropertyContainer],Vt);function Gt(zt,jt,Ht){return new Vt(zt,jt)}return{getTextSelectorProp:Gt}}();function TextAnimatorDataProperty(kt,_e,Dt){var Vt={propType:!1},Gt=PropertyFactory.getProp,zt=_e.a;this.a={r:zt.r?Gt(kt,zt.r,0,degToRads,Dt):Vt,rx:zt.rx?Gt(kt,zt.rx,0,degToRads,Dt):Vt,ry:zt.ry?Gt(kt,zt.ry,0,degToRads,Dt):Vt,sk:zt.sk?Gt(kt,zt.sk,0,degToRads,Dt):Vt,sa:zt.sa?Gt(kt,zt.sa,0,degToRads,Dt):Vt,s:zt.s?Gt(kt,zt.s,1,.01,Dt):Vt,a:zt.a?Gt(kt,zt.a,1,0,Dt):Vt,o:zt.o?Gt(kt,zt.o,0,.01,Dt):Vt,p:zt.p?Gt(kt,zt.p,1,0,Dt):Vt,sw:zt.sw?Gt(kt,zt.sw,0,0,Dt):Vt,sc:zt.sc?Gt(kt,zt.sc,1,0,Dt):Vt,fc:zt.fc?Gt(kt,zt.fc,1,0,Dt):Vt,fh:zt.fh?Gt(kt,zt.fh,0,0,Dt):Vt,fs:zt.fs?Gt(kt,zt.fs,0,.01,Dt):Vt,fb:zt.fb?Gt(kt,zt.fb,0,.01,Dt):Vt,t:zt.t?Gt(kt,zt.t,0,0,Dt):Vt},this.s=TextSelectorProp.getTextSelectorProp(kt,_e.s,Dt),this.s.t=_e.s.t}function TextAnimatorProperty(kt,_e,Dt){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=kt,this._renderType=_e,this._elem=Dt,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(Dt)}TextAnimatorProperty.prototype.searchProperties=function(){var kt,_e=this._textData.a.length,Dt,Vt=PropertyFactory.getProp;for(kt=0;kt<_e;kt+=1)Dt=this._textData.a[kt],this._animatorsData[kt]=new TextAnimatorDataProperty(this._elem,Dt,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:Vt(this._elem,this._textData.p.a,0,0,this),f:Vt(this._elem,this._textData.p.f,0,0,this),l:Vt(this._elem,this._textData.p.l,0,0,this),r:Vt(this._elem,this._textData.p.r,0,0,this),p:Vt(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=Vt(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(kt,_e){if(this.lettersChangedFlag=_e,!(!this._mdf&&!this._isFirstFrame&&!_e&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var Dt=this._moreOptions.alignment.v,Vt=this._animatorsData,Gt=this._textData,zt=this.mHelper,jt=this._renderType,Ht=this.renderedLetters.length,Wt,qt,Xt,Kt,Yt=kt.l,Zt,Jt,nn,rn,Qt,en,tn,sn,cn,un,hn,dn,pn,fn,mn;if(this._hasMaskedPath){if(mn=this._pathData.m,!this._pathData.n||this._pathData._mdf){var vn=mn.v;this._pathData.r.v&&(vn=vn.reverse()),Zt={tLength:0,segments:[]},Kt=vn._length-1;var _n;for(dn=0,Xt=0;Xt<Kt;Xt+=1)_n=bez.buildBezierData(vn.v[Xt],vn.v[Xt+1],[vn.o[Xt][0]-vn.v[Xt][0],vn.o[Xt][1]-vn.v[Xt][1]],[vn.i[Xt+1][0]-vn.v[Xt+1][0],vn.i[Xt+1][1]-vn.v[Xt+1][1]]),Zt.tLength+=_n.segmentLength,Zt.segments.push(_n),dn+=_n.segmentLength;Xt=Kt,mn.v.c&&(_n=bez.buildBezierData(vn.v[Xt],vn.v[0],[vn.o[Xt][0]-vn.v[Xt][0],vn.o[Xt][1]-vn.v[Xt][1]],[vn.i[0][0]-vn.v[0][0],vn.i[0][1]-vn.v[0][1]]),Zt.tLength+=_n.segmentLength,Zt.segments.push(_n),dn+=_n.segmentLength),this._pathData.pi=Zt}if(Zt=this._pathData.pi,Jt=this._pathData.f.v,tn=0,en=1,rn=0,Qt=!0,un=Zt.segments,Jt<0&&mn.v.c)for(Zt.tLength<Math.abs(Jt)&&(Jt=-Math.abs(Jt)%Zt.tLength),tn=un.length-1,cn=un[tn].points,en=cn.length-1;Jt<0;)Jt+=cn[en].partialLength,en-=1,en<0&&(tn-=1,cn=un[tn].points,en=cn.length-1);cn=un[tn].points,sn=cn[en-1],nn=cn[en],hn=nn.partialLength}Kt=Yt.length,Wt=0,qt=0;var En=kt.finalSize*1.2*.714,An=!0,Tn,Cn,yn,Sn,wn;Sn=Vt.length;var xn,Rn=-1,Dn,kn,Fn,Pn=Jt,Bn=tn,qn=en,tr=-1,lr,zn,ur,Hn,sr,vr,fr,Un,In="",jn=this.defaultPropsArray,or;if(kt.j===2||kt.j===1){var cr=0,ar=0,gr=kt.j===2?-.5:-1,mr=0,Ar=!0;for(Xt=0;Xt<Kt;Xt+=1)if(Yt[Xt].n){for(cr&&(cr+=ar);mr<Xt;)Yt[mr].animatorJustifyOffset=cr,mr+=1;cr=0,Ar=!0}else{for(yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.t.propType&&(Ar&&kt.j===2&&(ar+=Tn.t.v*gr),Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),xn.length?cr+=Tn.t.v*xn[0]*gr:cr+=Tn.t.v*xn*gr);Ar=!1}for(cr&&(cr+=ar);mr<Xt;)Yt[mr].animatorJustifyOffset=cr,mr+=1}for(Xt=0;Xt<Kt;Xt+=1){if(zt.reset(),lr=1,Yt[Xt].n)Wt=0,qt+=kt.yOffset,qt+=An?1:0,Jt=Pn,An=!1,this._hasMaskedPath&&(tn=Bn,en=qn,cn=un[tn].points,sn=cn[en-1],nn=cn[en],hn=nn.partialLength,rn=0),In="",Un="",vr="",or="",jn=this.defaultPropsArray;else{if(this._hasMaskedPath){if(tr!==Yt[Xt].line){switch(kt.j){case 1:Jt+=dn-kt.lineWidths[Yt[Xt].line];break;case 2:Jt+=(dn-kt.lineWidths[Yt[Xt].line])/2;break}tr=Yt[Xt].line}Rn!==Yt[Xt].ind&&(Yt[Rn]&&(Jt+=Yt[Rn].extra),Jt+=Yt[Xt].an/2,Rn=Yt[Xt].ind),Jt+=Dt[0]*Yt[Xt].an*.005;var Lr=0;for(yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.p.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),xn.length?Lr+=Tn.p.v[0]*xn[0]:Lr+=Tn.p.v[0]*xn),Tn.a.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),xn.length?Lr+=Tn.a.v[0]*xn[0]:Lr+=Tn.a.v[0]*xn);for(Qt=!0,this._pathData.a.v&&(Jt=Yt[0].an*.5+(dn-this._pathData.f.v-Yt[0].an*.5-Yt[Yt.length-1].an*.5)*Rn/(Kt-1),Jt+=this._pathData.f.v);Qt;)rn+hn>=Jt+Lr||!cn?(pn=(Jt+Lr-rn)/nn.partialLength,kn=sn.point[0]+(nn.point[0]-sn.point[0])*pn,Fn=sn.point[1]+(nn.point[1]-sn.point[1])*pn,zt.translate(-Dt[0]*Yt[Xt].an*.005,-(Dt[1]*En)*.01),Qt=!1):cn&&(rn+=nn.partialLength,en+=1,en>=cn.length&&(en=0,tn+=1,un[tn]?cn=un[tn].points:mn.v.c?(en=0,tn=0,cn=un[tn].points):(rn-=nn.partialLength,cn=null)),cn&&(sn=nn,nn=cn[en],hn=nn.partialLength));Dn=Yt[Xt].an/2-Yt[Xt].add,zt.translate(-Dn,0,0)}else Dn=Yt[Xt].an/2-Yt[Xt].add,zt.translate(-Dn,0,0),zt.translate(-Dt[0]*Yt[Xt].an*.005,-Dt[1]*En*.01,0);for(yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.t.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),(Wt!==0||kt.j!==0)&&(this._hasMaskedPath?xn.length?Jt+=Tn.t.v*xn[0]:Jt+=Tn.t.v*xn:xn.length?Wt+=Tn.t.v*xn[0]:Wt+=Tn.t.v*xn));for(kt.strokeWidthAnim&&(ur=kt.sw||0),kt.strokeColorAnim&&(kt.sc?zn=[kt.sc[0],kt.sc[1],kt.sc[2]]:zn=[0,0,0]),kt.fillColorAnim&&kt.fc&&(Hn=[kt.fc[0],kt.fc[1],kt.fc[2]]),yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.a.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),xn.length?zt.translate(-Tn.a.v[0]*xn[0],-Tn.a.v[1]*xn[1],Tn.a.v[2]*xn[2]):zt.translate(-Tn.a.v[0]*xn,-Tn.a.v[1]*xn,Tn.a.v[2]*xn));for(yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.s.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),xn.length?zt.scale(1+(Tn.s.v[0]-1)*xn[0],1+(Tn.s.v[1]-1)*xn[1],1):zt.scale(1+(Tn.s.v[0]-1)*xn,1+(Tn.s.v[1]-1)*xn,1));for(yn=0;yn<Sn;yn+=1){if(Tn=Vt[yn].a,Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),Tn.sk.propType&&(xn.length?zt.skewFromAxis(-Tn.sk.v*xn[0],Tn.sa.v*xn[1]):zt.skewFromAxis(-Tn.sk.v*xn,Tn.sa.v*xn)),Tn.r.propType&&(xn.length?zt.rotateZ(-Tn.r.v*xn[2]):zt.rotateZ(-Tn.r.v*xn)),Tn.ry.propType&&(xn.length?zt.rotateY(Tn.ry.v*xn[1]):zt.rotateY(Tn.ry.v*xn)),Tn.rx.propType&&(xn.length?zt.rotateX(Tn.rx.v*xn[0]):zt.rotateX(Tn.rx.v*xn)),Tn.o.propType&&(xn.length?lr+=(Tn.o.v*xn[0]-lr)*xn[0]:lr+=(Tn.o.v*xn-lr)*xn),kt.strokeWidthAnim&&Tn.sw.propType&&(xn.length?ur+=Tn.sw.v*xn[0]:ur+=Tn.sw.v*xn),kt.strokeColorAnim&&Tn.sc.propType)for(sr=0;sr<3;sr+=1)xn.length?zn[sr]+=(Tn.sc.v[sr]-zn[sr])*xn[0]:zn[sr]+=(Tn.sc.v[sr]-zn[sr])*xn;if(kt.fillColorAnim&&kt.fc){if(Tn.fc.propType)for(sr=0;sr<3;sr+=1)xn.length?Hn[sr]+=(Tn.fc.v[sr]-Hn[sr])*xn[0]:Hn[sr]+=(Tn.fc.v[sr]-Hn[sr])*xn;Tn.fh.propType&&(xn.length?Hn=addHueToRGB(Hn,Tn.fh.v*xn[0]):Hn=addHueToRGB(Hn,Tn.fh.v*xn)),Tn.fs.propType&&(xn.length?Hn=addSaturationToRGB(Hn,Tn.fs.v*xn[0]):Hn=addSaturationToRGB(Hn,Tn.fs.v*xn)),Tn.fb.propType&&(xn.length?Hn=addBrightnessToRGB(Hn,Tn.fb.v*xn[0]):Hn=addBrightnessToRGB(Hn,Tn.fb.v*xn))}}for(yn=0;yn<Sn;yn+=1)Tn=Vt[yn].a,Tn.p.propType&&(Cn=Vt[yn].s,xn=Cn.getMult(Yt[Xt].anIndexes[yn],Gt.a[yn].s.totalChars),this._hasMaskedPath?xn.length?zt.translate(0,Tn.p.v[1]*xn[0],-Tn.p.v[2]*xn[1]):zt.translate(0,Tn.p.v[1]*xn,-Tn.p.v[2]*xn):xn.length?zt.translate(Tn.p.v[0]*xn[0],Tn.p.v[1]*xn[1],-Tn.p.v[2]*xn[2]):zt.translate(Tn.p.v[0]*xn,Tn.p.v[1]*xn,-Tn.p.v[2]*xn));if(kt.strokeWidthAnim&&(vr=ur<0?0:ur),kt.strokeColorAnim&&(fr="rgb("+Math.round(zn[0]*255)+","+Math.round(zn[1]*255)+","+Math.round(zn[2]*255)+")"),kt.fillColorAnim&&kt.fc&&(Un="rgb("+Math.round(Hn[0]*255)+","+Math.round(Hn[1]*255)+","+Math.round(Hn[2]*255)+")"),this._hasMaskedPath){if(zt.translate(0,-kt.ls),zt.translate(0,Dt[1]*En*.01+qt,0),this._pathData.p.v){fn=(nn.point[1]-sn.point[1])/(nn.point[0]-sn.point[0]);var Cr=Math.atan(fn)*180/Math.PI;nn.point[0]<sn.point[0]&&(Cr+=180),zt.rotate(-Cr*Math.PI/180)}zt.translate(kn,Fn,0),Jt-=Dt[0]*Yt[Xt].an*.005,Yt[Xt+1]&&Rn!==Yt[Xt+1].ind&&(Jt+=Yt[Xt].an/2,Jt+=kt.tr*.001*kt.finalSize)}else{switch(zt.translate(Wt,qt,0),kt.ps&&zt.translate(kt.ps[0],kt.ps[1]+kt.ascent,0),kt.j){case 1:zt.translate(Yt[Xt].animatorJustifyOffset+kt.justifyOffset+(kt.boxWidth-kt.lineWidths[Yt[Xt].line]),0,0);break;case 2:zt.translate(Yt[Xt].animatorJustifyOffset+kt.justifyOffset+(kt.boxWidth-kt.lineWidths[Yt[Xt].line])/2,0,0);break}zt.translate(0,-kt.ls),zt.translate(Dn,0,0),zt.translate(Dt[0]*Yt[Xt].an*.005,Dt[1]*En*.01,0),Wt+=Yt[Xt].l+kt.tr*.001*kt.finalSize}jt==="html"?In=zt.toCSS():jt==="svg"?In=zt.to2dCSS():jn=[zt.props[0],zt.props[1],zt.props[2],zt.props[3],zt.props[4],zt.props[5],zt.props[6],zt.props[7],zt.props[8],zt.props[9],zt.props[10],zt.props[11],zt.props[12],zt.props[13],zt.props[14],zt.props[15]],or=lr}Ht<=Xt?(wn=new LetterProps(or,vr,fr,Un,In,jn),this.renderedLetters.push(wn),Ht+=1,this.lettersChangedFlag=!0):(wn=this.renderedLetters[Xt],this.lettersChangedFlag=wn.update(or,vr,fr,Un,In,jn)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty);function ITextElement(){}ITextElement.prototype.initElement=function(kt,_e,Dt){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(kt,_e,Dt),this.textProperty=new TextProperty(this,kt.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(kt.t,this.renderType,this),this.initTransform(kt,_e,Dt),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(kt){this._mdf=!1,this.prepareRenderableFrame(kt),this.prepareProperties(kt,this.isInRange)},ITextElement.prototype.createPathShape=function(kt,_e){var Dt,Vt=_e.length,Gt,zt="";for(Dt=0;Dt<Vt;Dt+=1)_e[Dt].ty==="sh"&&(Gt=_e[Dt].ks.k,zt+=buildShapeString(Gt,Gt.i.length,!0,kt));return zt},ITextElement.prototype.updateDocumentData=function(kt,_e){this.textProperty.updateDocumentData(kt,_e)},ITextElement.prototype.canResizeFont=function(kt){this.textProperty.canResizeFont(kt)},ITextElement.prototype.setMinimumFontSize=function(kt){this.textProperty.setMinimumFontSize(kt)},ITextElement.prototype.applyTextPropertiesToMatrix=function(kt,_e,Dt,Vt,Gt){switch(kt.ps&&_e.translate(kt.ps[0],kt.ps[1]+kt.ascent,0),_e.translate(0,-kt.ls,0),kt.j){case 1:_e.translate(kt.justifyOffset+(kt.boxWidth-kt.lineWidths[Dt]),0,0);break;case 2:_e.translate(kt.justifyOffset+(kt.boxWidth-kt.lineWidths[Dt])/2,0,0);break}_e.translate(Vt,Gt,0)},ITextElement.prototype.buildColor=function(kt){return"rgb("+Math.round(kt[0]*255)+","+Math.round(kt[1]*255)+","+Math.round(kt[2]*255)+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(kt,_e,Dt){this.textSpans=[],this.renderType="svg",this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(kt){for(var _e=0,Dt=kt.length,Vt=[],Gt="";_e<Dt;)kt[_e]===String.fromCharCode(13)||kt[_e]===String.fromCharCode(3)?(Vt.push(Gt),Gt=""):Gt+=kt[_e],_e+=1;return Vt.push(Gt),Vt},SVGTextLottieElement.prototype.buildShapeData=function(kt,_e){if(kt.shapes&&kt.shapes.length){var Dt=kt.shapes[0];if(Dt.it){var Vt=Dt.it[Dt.it.length-1];Vt.s&&(Vt.s.k[0]=_e,Vt.s.k[1]=_e)}}return kt},SVGTextLottieElement.prototype.buildNewText=function(){this.addDynamicProperty(this);var kt,_e,Dt=this.textProperty.currentData;this.renderedLetters=createSizedArray(Dt?Dt.l.length:0),Dt.fc?this.layerElement.setAttribute("fill",this.buildColor(Dt.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),Dt.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(Dt.sc)),this.layerElement.setAttribute("stroke-width",Dt.sw)),this.layerElement.setAttribute("font-size",Dt.finalSize);var Vt=this.globalData.fontManager.getFontByName(Dt.f);if(Vt.fClass)this.layerElement.setAttribute("class",Vt.fClass);else{this.layerElement.setAttribute("font-family",Vt.fFamily);var Gt=Dt.fWeight,zt=Dt.fStyle;this.layerElement.setAttribute("font-style",zt),this.layerElement.setAttribute("font-weight",Gt)}this.layerElement.setAttribute("aria-label",Dt.t);var jt=Dt.l||[],Ht=!!this.globalData.fontManager.chars;_e=jt.length;var Wt,qt=this.mHelper,Xt="",Kt=this.data.singleShape,Yt=0,Zt=0,Jt=!0,nn=Dt.tr*.001*Dt.finalSize;if(Kt&&!Ht&&!Dt.sz){var rn=this.textContainer,Qt="start";switch(Dt.j){case 1:Qt="end";break;case 2:Qt="middle";break;default:Qt="start";break}rn.setAttribute("text-anchor",Qt),rn.setAttribute("letter-spacing",nn);var en=this.buildTextContents(Dt.finalText);for(_e=en.length,Zt=Dt.ps?Dt.ps[1]+Dt.ascent:0,kt=0;kt<_e;kt+=1)Wt=this.textSpans[kt].span||createNS("tspan"),Wt.textContent=en[kt],Wt.setAttribute("x",0),Wt.setAttribute("y",Zt),Wt.style.display="inherit",rn.appendChild(Wt),this.textSpans[kt]||(this.textSpans[kt]={span:null,glyph:null}),this.textSpans[kt].span=Wt,Zt+=Dt.finalLineHeight;this.layerElement.appendChild(rn)}else{var tn=this.textSpans.length,sn;for(kt=0;kt<_e;kt+=1){if(this.textSpans[kt]||(this.textSpans[kt]={span:null,childSpan:null,glyph:null}),!Ht||!Kt||kt===0){if(Wt=tn>kt?this.textSpans[kt].span:createNS(Ht?"g":"text"),tn<=kt){if(Wt.setAttribute("stroke-linecap","butt"),Wt.setAttribute("stroke-linejoin","round"),Wt.setAttribute("stroke-miterlimit","4"),this.textSpans[kt].span=Wt,Ht){var cn=createNS("g");Wt.appendChild(cn),this.textSpans[kt].childSpan=cn}this.textSpans[kt].span=Wt,this.layerElement.appendChild(Wt)}Wt.style.display="inherit"}if(qt.reset(),Kt&&(jt[kt].n&&(Yt=-nn,Zt+=Dt.yOffset,Zt+=Jt?1:0,Jt=!1),this.applyTextPropertiesToMatrix(Dt,qt,jt[kt].line,Yt,Zt),Yt+=jt[kt].l||0,Yt+=nn),Ht){sn=this.globalData.fontManager.getCharData(Dt.finalText[kt],Vt.fStyle,this.globalData.fontManager.getFontByName(Dt.f).fFamily);var un;if(sn.t===1)un=new SVGCompElement(sn.data,this.globalData,this);else{var hn=emptyShapeData;sn.data&&sn.data.shapes&&(hn=this.buildShapeData(sn.data,Dt.finalSize)),un=new SVGShapeElement(hn,this.globalData,this)}if(this.textSpans[kt].glyph){var dn=this.textSpans[kt].glyph;this.textSpans[kt].childSpan.removeChild(dn.layerElement),dn.destroy()}this.textSpans[kt].glyph=un,un._debug=!0,un.prepareFrame(0),un.renderFrame(),this.textSpans[kt].childSpan.appendChild(un.layerElement),sn.t===1&&this.textSpans[kt].childSpan.setAttribute("transform","scale("+Dt.finalSize/100+","+Dt.finalSize/100+")")}else Kt&&Wt.setAttribute("transform","translate("+qt.props[12]+","+qt.props[13]+")"),Wt.textContent=jt[kt].val,Wt.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}Kt&&Wt&&Wt.setAttribute("d",Xt)}for(;kt<this.textSpans.length;)this.textSpans[kt].span.style.display="none",kt+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var kt=this.layerElement.getBBox();this.bbox={top:kt.y,left:kt.x,width:kt.width,height:kt.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var kt,_e=this.textSpans.length,Dt;for(this.renderedFrame=this.comp.renderedFrame,kt=0;kt<_e;kt+=1)Dt=this.textSpans[kt].glyph,Dt&&(Dt.prepareFrame(this.comp.renderedFrame-this.data.st),Dt._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var kt,_e,Dt=this.textAnimator.renderedLetters,Vt=this.textProperty.currentData.l;_e=Vt.length;var Gt,zt,jt;for(kt=0;kt<_e;kt+=1)Vt[kt].n||(Gt=Dt[kt],zt=this.textSpans[kt].span,jt=this.textSpans[kt].glyph,jt&&jt.renderFrame(),Gt._mdf.m&&zt.setAttribute("transform",Gt.m),Gt._mdf.o&&zt.setAttribute("opacity",Gt.o),Gt._mdf.sw&&zt.setAttribute("stroke-width",Gt.sw),Gt._mdf.sc&&zt.setAttribute("stroke",Gt.sc),Gt._mdf.fc&&zt.setAttribute("fill",Gt.fc))}};function ISolidElement(kt,_e,Dt){this.initElement(kt,_e,Dt)}extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var kt=createNS("rect");kt.setAttribute("width",this.data.sw),kt.setAttribute("height",this.data.sh),kt.setAttribute("fill",this.data.sc),this.layerElement.appendChild(kt)};function NullElement(kt,_e,Dt){this.initFrame(),this.initBaseData(kt,_e,Dt),this.initFrame(),this.initTransform(kt,_e,Dt),this.initHierarchy()}NullElement.prototype.prepareFrame=function(kt){this.prepareProperties(kt,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement);function SVGRendererBase(){}extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(kt){return new NullElement(kt,this.globalData,this)},SVGRendererBase.prototype.createShape=function(kt){return new SVGShapeElement(kt,this.globalData,this)},SVGRendererBase.prototype.createText=function(kt){return new SVGTextLottieElement(kt,this.globalData,this)},SVGRendererBase.prototype.createImage=function(kt){return new IImageElement(kt,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(kt){return new ISolidElement(kt,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(kt){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+kt.w+" "+kt.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",kt.w),this.svgElement.setAttribute("height",kt.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var _e=this.globalData.defs;this.setupGlobalData(kt,_e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=kt;var Dt=createNS("clipPath"),Vt=createNS("rect");Vt.setAttribute("width",kt.w),Vt.setAttribute("height",kt.h),Vt.setAttribute("x",0),Vt.setAttribute("y",0);var Gt=createElementID();Dt.setAttribute("id",Gt),Dt.appendChild(Vt),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+Gt+")"),_e.appendChild(Dt),this.layers=kt.layers,this.elements=createSizedArray(kt.layers.length)},SVGRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var kt,_e=this.layers?this.layers.length:0;for(kt=0;kt<_e;kt+=1)this.elements[kt]&&this.elements[kt].destroy&&this.elements[kt].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(kt){var _e=0,Dt=this.layers.length;for(_e=0;_e<Dt;_e+=1)if(this.layers[_e].ind===kt)return _e;return-1},SVGRendererBase.prototype.buildItem=function(kt){var _e=this.elements;if(!(_e[kt]||this.layers[kt].ty===99)){_e[kt]=!0;var Dt=this.createItem(this.layers[kt]);if(_e[kt]=Dt,getExpressionsPlugin()&&(this.layers[kt].ty===0&&this.globalData.projectInterface.registerComposition(Dt),Dt.initExpressions()),this.appendElementInPos(Dt,kt),this.layers[kt].tt){var Vt="tp"in this.layers[kt]?this.findIndexByInd(this.layers[kt].tp):kt-1;if(Vt===-1)return;if(!this.elements[Vt]||this.elements[Vt]===!0)this.buildItem(Vt),this.addPendingElement(Dt);else{var Gt=_e[Vt],zt=Gt.getMatte(this.layers[kt].tt);Dt.setMatte(zt)}}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var kt=this.pendingElements.pop();if(kt.checkParenting(),kt.data.tt)for(var _e=0,Dt=this.elements.length;_e<Dt;){if(this.elements[_e]===kt){var Vt="tp"in kt.data?this.findIndexByInd(kt.data.tp):_e-1,Gt=this.elements[Vt],zt=Gt.getMatte(this.layers[_e].tt);kt.setMatte(zt);break}_e+=1}}},SVGRendererBase.prototype.renderFrame=function(kt){if(!(this.renderedFrame===kt||this.destroyed)){kt===null?kt=this.renderedFrame:this.renderedFrame=kt,this.globalData.frameNum=kt,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=kt,this.globalData._mdf=!1;var _e,Dt=this.layers.length;for(this.completeLayers||this.checkLayers(kt),_e=Dt-1;_e>=0;_e-=1)(this.completeLayers||this.elements[_e])&&this.elements[_e].prepareFrame(kt-this.layers[_e].st);if(this.globalData._mdf)for(_e=0;_e<Dt;_e+=1)(this.completeLayers||this.elements[_e])&&this.elements[_e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(kt,_e){var Dt=kt.getBaseElement();if(Dt){for(var Vt=0,Gt;Vt<_e;)this.elements[Vt]&&this.elements[Vt]!==!0&&this.elements[Vt].getBaseElement()&&(Gt=this.elements[Vt].getBaseElement()),Vt+=1;Gt?this.layerElement.insertBefore(Dt,Gt):this.layerElement.appendChild(Dt)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"};function ICompElement(){}extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(kt,_e,Dt){this.initFrame(),this.initBaseData(kt,_e,Dt),this.initTransform(kt,_e,Dt),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!_e.progressiveLoad)&&this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(kt){if(this._mdf=!1,this.prepareRenderableFrame(kt),this.prepareProperties(kt,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=kt/this.data.sr;else{var _e=this.tm.v;_e===this.data.op&&(_e=this.data.op-1),this.renderedFrame=_e}var Dt,Vt=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),Dt=Vt-1;Dt>=0;Dt-=1)(this.completeLayers||this.elements[Dt])&&(this.elements[Dt].prepareFrame(this.renderedFrame-this.layers[Dt].st),this.elements[Dt]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var kt,_e=this.layers.length;for(kt=0;kt<_e;kt+=1)(this.completeLayers||this.elements[kt])&&this.elements[kt].renderFrame()},ICompElement.prototype.setElements=function(kt){this.elements=kt},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var kt,_e=this.layers.length;for(kt=0;kt<_e;kt+=1)this.elements[kt]&&this.elements[kt].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function SVGCompElement(kt,_e,Dt){this.layers=kt.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(kt,_e,Dt),this.tm=kt.tm?PropertyFactory.getProp(this,kt.tm,0,_e.frameRate,this):{_placeholder:!0}}extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(kt){return new SVGCompElement(kt,this.globalData,this)};function SVGRenderer(kt,_e){this.animationItem=kt,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var Dt="";if(_e&&_e.title){var Vt=createNS("title"),Gt=createElementID();Vt.setAttribute("id",Gt),Vt.textContent=_e.title,this.svgElement.appendChild(Vt),Dt+=Gt}if(_e&&_e.description){var zt=createNS("desc"),jt=createElementID();zt.setAttribute("id",jt),zt.textContent=_e.description,this.svgElement.appendChild(zt),Dt+=" "+jt}Dt&&this.svgElement.setAttribute("aria-labelledby",Dt);var Ht=createNS("defs");this.svgElement.appendChild(Ht);var Wt=createNS("g");this.svgElement.appendChild(Wt),this.layerElement=Wt,this.renderConfig={preserveAspectRatio:_e&&_e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:_e&&_e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:_e&&_e.contentVisibility||"visible",progressiveLoad:_e&&_e.progressiveLoad||!1,hideOnTransparent:!(_e&&_e.hideOnTransparent===!1),viewBoxOnly:_e&&_e.viewBoxOnly||!1,viewBoxSize:_e&&_e.viewBoxSize||!1,className:_e&&_e.className||"",id:_e&&_e.id||"",focusable:_e&&_e.focusable,filterSize:{width:_e&&_e.filterSize&&_e.filterSize.width||"100%",height:_e&&_e.filterSize&&_e.filterSize.height||"100%",x:_e&&_e.filterSize&&_e.filterSize.x||"0%",y:_e&&_e.filterSize&&_e.filterSize.y||"0%"},width:_e&&_e.width,height:_e&&_e.height,runExpressions:!_e||_e.runExpressions===void 0||_e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:Ht,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(kt){return new SVGCompElement(kt,this.globalData,this)};function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}ShapeTransformManager.prototype={addTransformSequence:function(_e){var Dt,Vt=_e.length,Gt="_";for(Dt=0;Dt<Vt;Dt+=1)Gt+=_e[Dt].transform.key+"_";var zt=this.sequences[Gt];return zt||(zt={transforms:[].concat(_e),finalTransform:new Matrix,_mdf:!1},this.sequences[Gt]=zt,this.sequenceList.push(zt)),zt},processSequence:function(_e,Dt){for(var Vt=0,Gt=_e.transforms.length,zt=Dt;Vt<Gt&&!Dt;){if(_e.transforms[Vt].transform.mProps._mdf){zt=!0;break}Vt+=1}if(zt)for(_e.finalTransform.reset(),Vt=Gt-1;Vt>=0;Vt-=1)_e.finalTransform.multiply(_e.transforms[Vt].transform.mProps.v);_e._mdf=zt},processSequences:function(_e){var Dt,Vt=this.sequenceList.length;for(Dt=0;Dt<Vt;Dt+=1)this.processSequence(this.sequenceList[Dt],_e)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var _e="__lottie_element_luma_buffer",Dt=null,Vt=null,Gt=null;function zt(){var Wt=createNS("svg"),qt=createNS("filter"),Xt=createNS("feColorMatrix");return qt.setAttribute("id",_e),Xt.setAttribute("type","matrix"),Xt.setAttribute("color-interpolation-filters","sRGB"),Xt.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),qt.appendChild(Xt),Wt.appendChild(qt),Wt.setAttribute("id",_e+"_svg"),featureSupport.svgLumaHidden&&(Wt.style.display="none"),Wt}function jt(){Dt||(Gt=zt(),document.body.appendChild(Gt),Dt=createTag("canvas"),Vt=Dt.getContext("2d"),Vt.filter="url(#"+_e+")",Vt.fillStyle="rgba(0,0,0,0)",Vt.fillRect(0,0,1,1))}function Ht(Wt){return Dt||jt(),Dt.width=Wt.width,Dt.height=Wt.height,Vt.filter="url(#"+_e+")",Dt}return{load:jt,get:Ht}};function createCanvas(kt,_e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(kt,_e);var Dt=createTag("canvas");return Dt.width=kt,Dt.height=_e,Dt}var assetLoader=function(){return{loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas}}(),registeredEffects={};function CVEffects(kt){var _e,Dt=kt.data.ef?kt.data.ef.length:0;this.filters=[];var Vt;for(_e=0;_e<Dt;_e+=1){Vt=null;var Gt=kt.data.ef[_e].ty;if(registeredEffects[Gt]){var zt=registeredEffects[Gt].effect;Vt=new zt(kt.effectsManager.effectElements[_e],kt)}Vt&&this.filters.push(Vt)}this.filters.length&&kt.addRenderableComponent(this)}CVEffects.prototype.renderFrame=function(kt){var _e,Dt=this.filters.length;for(_e=0;_e<Dt;_e+=1)this.filters[_e].renderFrame(kt)},CVEffects.prototype.getEffects=function(kt){var _e,Dt=this.filters.length,Vt=[];for(_e=0;_e<Dt;_e+=1)this.filters[_e].type===kt&&Vt.push(this.filters[_e]);return Vt};function registerEffect(kt,_e){registeredEffects[kt]={effect:_e}}function CVMaskElement(kt,_e){this.data=kt,this.element=_e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var Dt,Vt=this.masksProperties.length,Gt=!1;for(Dt=0;Dt<Vt;Dt+=1)this.masksProperties[Dt].mode!=="n"&&(Gt=!0),this.viewData[Dt]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[Dt],3);this.hasMasks=Gt,Gt&&this.element.addRenderableComponent(this)}CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var kt=this.element.finalTransform.mat,_e=this.element.canvasContext,Dt,Vt=this.masksProperties.length,Gt,zt,jt;for(_e.beginPath(),Dt=0;Dt<Vt;Dt+=1)if(this.masksProperties[Dt].mode!=="n"){this.masksProperties[Dt].inv&&(_e.moveTo(0,0),_e.lineTo(this.element.globalData.compSize.w,0),_e.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),_e.lineTo(0,this.element.globalData.compSize.h),_e.lineTo(0,0)),jt=this.viewData[Dt].v,Gt=kt.applyToPointArray(jt.v[0][0],jt.v[0][1],0),_e.moveTo(Gt[0],Gt[1]);var Ht,Wt=jt._length;for(Ht=1;Ht<Wt;Ht+=1)zt=kt.applyToTriplePoints(jt.o[Ht-1],jt.i[Ht],jt.v[Ht]),_e.bezierCurveTo(zt[0],zt[1],zt[2],zt[3],zt[4],zt[5]);zt=kt.applyToTriplePoints(jt.o[Ht-1],jt.i[0],jt.v[0]),_e.bezierCurveTo(zt[0],zt[1],zt[2],zt[3],zt[4],zt[5])}this.element.globalData.renderer.save(!0),_e.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};function CVBaseElement(){}var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var _e=this.globalData.canvasContext,Dt=assetLoader.createCanvas(_e.canvas.width,_e.canvas.height);this.buffers.push(Dt);var Vt=assetLoader.createCanvas(_e.canvas.width,_e.canvas.height);this.buffers.push(Vt),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var _e=this.globalData;if(_e.blendMode!==this.data.bm){_e.blendMode=this.data.bm;var Dt=getBlendMode(this.data.bm);_e.canvasContext.globalCompositeOperation=Dt}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(_e){_e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var _e=this.buffers[0],Dt=_e.getContext("2d");this.clearCanvas(Dt),Dt.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var _e=this.buffers[1],Dt=_e.getContext("2d");this.clearCanvas(Dt),Dt.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var Vt=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(Vt.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var Gt=assetLoader.getLumaCanvas(this.canvasContext.canvas),zt=Gt.getContext("2d");zt.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(Gt,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(_e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(_e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!_e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var Dt=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(Dt),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(Dt),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(kt,_e,Dt,Vt){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var Gt=4;_e.ty==="rc"?Gt=5:_e.ty==="el"?Gt=6:_e.ty==="sr"&&(Gt=7),this.sh=ShapePropertyFactory.getShapeProp(kt,_e,Gt,kt);var zt,jt=Dt.length,Ht;for(zt=0;zt<jt;zt+=1)Dt[zt].closed||(Ht={transforms:Vt.addTransformSequence(Dt[zt].transforms),trNodes:[]},this.styledShapes.push(Ht),Dt[zt].elements.push(Ht))}CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated;function CVShapeElement(kt,_e,Dt){this.shapes=[],this.shapesData=kt.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(kt,_e){var Dt={data:kt,type:kt.ty,preTransforms:this.transformsManager.addTransformSequence(_e),transforms:[],elements:[],closed:kt.hd===!0},Vt={};if(kt.ty==="fl"||kt.ty==="st"?(Vt.c=PropertyFactory.getProp(this,kt.c,1,255,this),Vt.c.k||(Dt.co="rgb("+bmFloor(Vt.c.v[0])+","+bmFloor(Vt.c.v[1])+","+bmFloor(Vt.c.v[2])+")")):(kt.ty==="gf"||kt.ty==="gs")&&(Vt.s=PropertyFactory.getProp(this,kt.s,1,null,this),Vt.e=PropertyFactory.getProp(this,kt.e,1,null,this),Vt.h=PropertyFactory.getProp(this,kt.h||{k:0},0,.01,this),Vt.a=PropertyFactory.getProp(this,kt.a||{k:0},0,degToRads,this),Vt.g=new GradientProperty(this,kt.g,this)),Vt.o=PropertyFactory.getProp(this,kt.o,0,.01,this),kt.ty==="st"||kt.ty==="gs"){if(Dt.lc=lineCapEnum[kt.lc||2],Dt.lj=lineJoinEnum[kt.lj||2],kt.lj==1&&(Dt.ml=kt.ml),Vt.w=PropertyFactory.getProp(this,kt.w,0,null,this),Vt.w.k||(Dt.wi=Vt.w.v),kt.d){var Gt=new DashProperty(this,kt.d,"canvas",this);Vt.d=Gt,Vt.d.k||(Dt.da=Vt.d.dashArray,Dt.do=Vt.d.dashoffset[0])}}else Dt.r=kt.r===2?"evenodd":"nonzero";return this.stylesList.push(Dt),Vt.style=Dt,Vt},CVShapeElement.prototype.createGroupElement=function(){var kt={it:[],prevViewData:[]};return kt},CVShapeElement.prototype.createTransformElement=function(kt){var _e={transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,kt.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,kt,this)}};return _e},CVShapeElement.prototype.createShapeElement=function(kt){var _e=new CVShapeData(this,kt,this.stylesList,this.transformsManager);return this.shapes.push(_e),this.addShapeToModifiers(_e),_e},CVShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var kt,_e=this.itemsData.length;for(kt=0;kt<_e;kt+=1)this.prevViewData[kt]=this.itemsData[kt];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),_e=this.dynamicProperties.length,kt=0;kt<_e;kt+=1)this.dynamicProperties[kt].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(kt){var _e,Dt=this.stylesList.length;for(_e=0;_e<Dt;_e+=1)this.stylesList[_e].closed||this.stylesList[_e].transforms.push(kt)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var kt,_e=this.stylesList.length;for(kt=0;kt<_e;kt+=1)this.stylesList[kt].closed||this.stylesList[kt].transforms.pop()},CVShapeElement.prototype.closeStyles=function(kt){var _e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)kt[_e].closed=!0},CVShapeElement.prototype.searchShapes=function(kt,_e,Dt,Vt,Gt){var zt,jt=kt.length-1,Ht,Wt,qt=[],Xt=[],Kt,Yt,Zt,Jt=[].concat(Gt);for(zt=jt;zt>=0;zt-=1){if(Kt=this.searchProcessedElement(kt[zt]),Kt?_e[zt]=Dt[Kt-1]:kt[zt]._shouldRender=Vt,kt[zt].ty==="fl"||kt[zt].ty==="st"||kt[zt].ty==="gf"||kt[zt].ty==="gs")Kt?_e[zt].style.closed=!1:_e[zt]=this.createStyleElement(kt[zt],Jt),qt.push(_e[zt].style);else if(kt[zt].ty==="gr"){if(!Kt)_e[zt]=this.createGroupElement(kt[zt]);else for(Wt=_e[zt].it.length,Ht=0;Ht<Wt;Ht+=1)_e[zt].prevViewData[Ht]=_e[zt].it[Ht];this.searchShapes(kt[zt].it,_e[zt].it,_e[zt].prevViewData,Vt,Jt)}else kt[zt].ty==="tr"?(Kt||(Zt=this.createTransformElement(kt[zt]),_e[zt]=Zt),Jt.push(_e[zt]),this.addTransformToStyleList(_e[zt])):kt[zt].ty==="sh"||kt[zt].ty==="rc"||kt[zt].ty==="el"||kt[zt].ty==="sr"?Kt||(_e[zt]=this.createShapeElement(kt[zt])):kt[zt].ty==="tm"||kt[zt].ty==="rd"||kt[zt].ty==="pb"||kt[zt].ty==="zz"||kt[zt].ty==="op"?(Kt?(Yt=_e[zt],Yt.closed=!1):(Yt=ShapeModifiers.getModifier(kt[zt].ty),Yt.init(this,kt[zt]),_e[zt]=Yt,this.shapeModifiers.push(Yt)),Xt.push(Yt)):kt[zt].ty==="rp"&&(Kt?(Yt=_e[zt],Yt.closed=!0):(Yt=ShapeModifiers.getModifier(kt[zt].ty),_e[zt]=Yt,Yt.init(this,kt,zt,_e),this.shapeModifiers.push(Yt),Vt=!1),Xt.push(Yt));this.addProcessedElement(kt[zt],zt+1)}for(this.removeTransformFromStyleList(),this.closeStyles(qt),jt=Xt.length,zt=0;zt<jt;zt+=1)Xt[zt].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(kt,_e){(kt._opMdf||_e.op._mdf||this._isFirstFrame)&&(_e.opacity=kt.opacity,_e.opacity*=_e.op.v,_e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var kt,_e=this.stylesList.length,Dt,Vt,Gt,zt,jt,Ht,Wt=this.globalData.renderer,qt=this.globalData.canvasContext,Xt,Kt;for(kt=0;kt<_e;kt+=1)if(Kt=this.stylesList[kt],Xt=Kt.type,!((Xt==="st"||Xt==="gs")&&Kt.wi===0||!Kt.data._shouldRender||Kt.coOp===0||this.globalData.currentGlobalAlpha===0)){for(Wt.save(),jt=Kt.elements,Xt==="st"||Xt==="gs"?(Wt.ctxStrokeStyle(Xt==="st"?Kt.co:Kt.grd),Wt.ctxLineWidth(Kt.wi),Wt.ctxLineCap(Kt.lc),Wt.ctxLineJoin(Kt.lj),Wt.ctxMiterLimit(Kt.ml||0)):Wt.ctxFillStyle(Xt==="fl"?Kt.co:Kt.grd),Wt.ctxOpacity(Kt.coOp),Xt!=="st"&&Xt!=="gs"&&qt.beginPath(),Wt.ctxTransform(Kt.preTransforms.finalTransform.props),Vt=jt.length,Dt=0;Dt<Vt;Dt+=1){for((Xt==="st"||Xt==="gs")&&(qt.beginPath(),Kt.da&&(qt.setLineDash(Kt.da),qt.lineDashOffset=Kt.do)),Ht=jt[Dt].trNodes,zt=Ht.length,Gt=0;Gt<zt;Gt+=1)Ht[Gt].t==="m"?qt.moveTo(Ht[Gt].p[0],Ht[Gt].p[1]):Ht[Gt].t==="c"?qt.bezierCurveTo(Ht[Gt].pts[0],Ht[Gt].pts[1],Ht[Gt].pts[2],Ht[Gt].pts[3],Ht[Gt].pts[4],Ht[Gt].pts[5]):qt.closePath();(Xt==="st"||Xt==="gs")&&(Wt.ctxStroke(),Kt.da&&qt.setLineDash(this.dashResetter))}Xt!=="st"&&Xt!=="gs"&&this.globalData.renderer.ctxFill(Kt.r),Wt.restore()}},CVShapeElement.prototype.renderShape=function(kt,_e,Dt,Vt){var Gt,zt=_e.length-1,jt;for(jt=kt,Gt=zt;Gt>=0;Gt-=1)_e[Gt].ty==="tr"?(jt=Dt[Gt].transform,this.renderShapeTransform(kt,jt)):_e[Gt].ty==="sh"||_e[Gt].ty==="el"||_e[Gt].ty==="rc"||_e[Gt].ty==="sr"?this.renderPath(_e[Gt],Dt[Gt]):_e[Gt].ty==="fl"?this.renderFill(_e[Gt],Dt[Gt],jt):_e[Gt].ty==="st"?this.renderStroke(_e[Gt],Dt[Gt],jt):_e[Gt].ty==="gf"||_e[Gt].ty==="gs"?this.renderGradientFill(_e[Gt],Dt[Gt],jt):_e[Gt].ty==="gr"?this.renderShape(jt,_e[Gt].it,Dt[Gt].it):_e[Gt].ty;Vt&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(kt,_e){if(this._isFirstFrame||_e._mdf||kt.transforms._mdf){var Dt=kt.trNodes,Vt=_e.paths,Gt,zt,jt,Ht=Vt._length;Dt.length=0;var Wt=kt.transforms.finalTransform;for(jt=0;jt<Ht;jt+=1){var qt=Vt.shapes[jt];if(qt&&qt.v){for(zt=qt._length,Gt=1;Gt<zt;Gt+=1)Gt===1&&Dt.push({t:"m",p:Wt.applyToPointArray(qt.v[0][0],qt.v[0][1],0)}),Dt.push({t:"c",pts:Wt.applyToTriplePoints(qt.o[Gt-1],qt.i[Gt],qt.v[Gt])});zt===1&&Dt.push({t:"m",p:Wt.applyToPointArray(qt.v[0][0],qt.v[0][1],0)}),qt.c&&zt&&(Dt.push({t:"c",pts:Wt.applyToTriplePoints(qt.o[Gt-1],qt.i[0],qt.v[0])}),Dt.push({t:"z"}))}}kt.trNodes=Dt}},CVShapeElement.prototype.renderPath=function(kt,_e){if(kt.hd!==!0&&kt._shouldRender){var Dt,Vt=_e.styledShapes.length;for(Dt=0;Dt<Vt;Dt+=1)this.renderStyledShape(_e.styledShapes[Dt],_e.sh)}},CVShapeElement.prototype.renderFill=function(kt,_e,Dt){var Vt=_e.style;(_e.c._mdf||this._isFirstFrame)&&(Vt.co="rgb("+bmFloor(_e.c.v[0])+","+bmFloor(_e.c.v[1])+","+bmFloor(_e.c.v[2])+")"),(_e.o._mdf||Dt._opMdf||this._isFirstFrame)&&(Vt.coOp=_e.o.v*Dt.opacity)},CVShapeElement.prototype.renderGradientFill=function(kt,_e,Dt){var Vt=_e.style,Gt;if(!Vt.grd||_e.g._mdf||_e.s._mdf||_e.e._mdf||kt.t!==1&&(_e.h._mdf||_e.a._mdf)){var zt=this.globalData.canvasContext,jt=_e.s.v,Ht=_e.e.v;if(kt.t===1)Gt=zt.createLinearGradient(jt[0],jt[1],Ht[0],Ht[1]);else{var Wt=Math.sqrt(Math.pow(jt[0]-Ht[0],2)+Math.pow(jt[1]-Ht[1],2)),qt=Math.atan2(Ht[1]-jt[1],Ht[0]-jt[0]),Xt=_e.h.v;Xt>=1?Xt=.99:Xt<=-1&&(Xt=-.99);var Kt=Wt*Xt,Yt=Math.cos(qt+_e.a.v)*Kt+jt[0],Zt=Math.sin(qt+_e.a.v)*Kt+jt[1];Gt=zt.createRadialGradient(Yt,Zt,0,jt[0],jt[1],Wt)}var Jt,nn=kt.g.p,rn=_e.g.c,Qt=1;for(Jt=0;Jt<nn;Jt+=1)_e.g._hasOpacity&&_e.g._collapsable&&(Qt=_e.g.o[Jt*2+1]),Gt.addColorStop(rn[Jt*4]/100,"rgba("+rn[Jt*4+1]+","+rn[Jt*4+2]+","+rn[Jt*4+3]+","+Qt+")");Vt.grd=Gt}Vt.coOp=_e.o.v*Dt.opacity},CVShapeElement.prototype.renderStroke=function(kt,_e,Dt){var Vt=_e.style,Gt=_e.d;Gt&&(Gt._mdf||this._isFirstFrame)&&(Vt.da=Gt.dashArray,Vt.do=Gt.dashoffset[0]),(_e.c._mdf||this._isFirstFrame)&&(Vt.co="rgb("+bmFloor(_e.c.v[0])+","+bmFloor(_e.c.v[1])+","+bmFloor(_e.c.v[2])+")"),(_e.o._mdf||Dt._opMdf||this._isFirstFrame)&&(Vt.coOp=_e.o.v*Dt.opacity),(_e.w._mdf||this._isFirstFrame)&&(Vt.wi=_e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0};function CVTextElement(kt,_e,Dt){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var kt=this.textProperty.currentData;this.renderedLetters=createSizedArray(kt.l?kt.l.length:0);var _e=!1;kt.fc?(_e=!0,this.values.fill=this.buildColor(kt.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=_e;var Dt=!1;kt.sc&&(Dt=!0,this.values.stroke=this.buildColor(kt.sc),this.values.sWidth=kt.sw);var Vt=this.globalData.fontManager.getFontByName(kt.f),Gt,zt,jt=kt.l,Ht=this.mHelper;this.stroke=Dt,this.values.fValue=kt.finalSize+"px "+this.globalData.fontManager.getFontByName(kt.f).fFamily,zt=kt.finalText.length;var Wt,qt,Xt,Kt,Yt,Zt,Jt,nn,rn,Qt,en=this.data.singleShape,tn=kt.tr*.001*kt.finalSize,sn=0,cn=0,un=!0,hn=0;for(Gt=0;Gt<zt;Gt+=1){Wt=this.globalData.fontManager.getCharData(kt.finalText[Gt],Vt.fStyle,this.globalData.fontManager.getFontByName(kt.f).fFamily),qt=Wt&&Wt.data||{},Ht.reset(),en&&jt[Gt].n&&(sn=-tn,cn+=kt.yOffset,cn+=un?1:0,un=!1),Yt=qt.shapes?qt.shapes[0].it:[],Jt=Yt.length,Ht.scale(kt.finalSize/100,kt.finalSize/100),en&&this.applyTextPropertiesToMatrix(kt,Ht,jt[Gt].line,sn,cn),rn=createSizedArray(Jt-1);var dn=0;for(Zt=0;Zt<Jt;Zt+=1)if(Yt[Zt].ty==="sh"){for(Kt=Yt[Zt].ks.k.i.length,nn=Yt[Zt].ks.k,Qt=[],Xt=1;Xt<Kt;Xt+=1)Xt===1&&Qt.push(Ht.applyToX(nn.v[0][0],nn.v[0][1],0),Ht.applyToY(nn.v[0][0],nn.v[0][1],0)),Qt.push(Ht.applyToX(nn.o[Xt-1][0],nn.o[Xt-1][1],0),Ht.applyToY(nn.o[Xt-1][0],nn.o[Xt-1][1],0),Ht.applyToX(nn.i[Xt][0],nn.i[Xt][1],0),Ht.applyToY(nn.i[Xt][0],nn.i[Xt][1],0),Ht.applyToX(nn.v[Xt][0],nn.v[Xt][1],0),Ht.applyToY(nn.v[Xt][0],nn.v[Xt][1],0));Qt.push(Ht.applyToX(nn.o[Xt-1][0],nn.o[Xt-1][1],0),Ht.applyToY(nn.o[Xt-1][0],nn.o[Xt-1][1],0),Ht.applyToX(nn.i[0][0],nn.i[0][1],0),Ht.applyToY(nn.i[0][0],nn.i[0][1],0),Ht.applyToX(nn.v[0][0],nn.v[0][1],0),Ht.applyToY(nn.v[0][0],nn.v[0][1],0)),rn[dn]=Qt,dn+=1}en&&(sn+=jt[Gt].l,sn+=tn),this.textSpans[hn]?this.textSpans[hn].elem=rn:this.textSpans[hn]={elem:rn},hn+=1}},CVTextElement.prototype.renderInnerContent=function(){this.validateText();var kt=this.canvasContext;kt.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var _e,Dt,Vt,Gt,zt,jt,Ht=this.textAnimator.renderedLetters,Wt=this.textProperty.currentData.l;Dt=Wt.length;var qt,Xt=null,Kt=null,Yt=null,Zt,Jt,nn=this.globalData.renderer;for(_e=0;_e<Dt;_e+=1)if(!Wt[_e].n){if(qt=Ht[_e],qt&&(nn.save(),nn.ctxTransform(qt.p),nn.ctxOpacity(qt.o)),this.fill){for(qt&&qt.fc?Xt!==qt.fc&&(nn.ctxFillStyle(qt.fc),Xt=qt.fc):Xt!==this.values.fill&&(Xt=this.values.fill,nn.ctxFillStyle(this.values.fill)),Zt=this.textSpans[_e].elem,Gt=Zt.length,this.globalData.canvasContext.beginPath(),Vt=0;Vt<Gt;Vt+=1)for(Jt=Zt[Vt],jt=Jt.length,this.globalData.canvasContext.moveTo(Jt[0],Jt[1]),zt=2;zt<jt;zt+=6)this.globalData.canvasContext.bezierCurveTo(Jt[zt],Jt[zt+1],Jt[zt+2],Jt[zt+3],Jt[zt+4],Jt[zt+5]);this.globalData.canvasContext.closePath(),nn.ctxFill()}if(this.stroke){for(qt&&qt.sw?Yt!==qt.sw&&(Yt=qt.sw,nn.ctxLineWidth(qt.sw)):Yt!==this.values.sWidth&&(Yt=this.values.sWidth,nn.ctxLineWidth(this.values.sWidth)),qt&&qt.sc?Kt!==qt.sc&&(Kt=qt.sc,nn.ctxStrokeStyle(qt.sc)):Kt!==this.values.stroke&&(Kt=this.values.stroke,nn.ctxStrokeStyle(this.values.stroke)),Zt=this.textSpans[_e].elem,Gt=Zt.length,this.globalData.canvasContext.beginPath(),Vt=0;Vt<Gt;Vt+=1)for(Jt=Zt[Vt],jt=Jt.length,this.globalData.canvasContext.moveTo(Jt[0],Jt[1]),zt=2;zt<jt;zt+=6)this.globalData.canvasContext.bezierCurveTo(Jt[zt],Jt[zt+1],Jt[zt+2],Jt[zt+3],Jt[zt+4],Jt[zt+5]);this.globalData.canvasContext.closePath(),nn.ctxStroke()}qt&&this.globalData.renderer.restore()}};function CVImageElement(kt,_e,Dt){this.assetData=_e.getAssetData(kt.refId),this.img=_e.imageLoader.getAsset(this.assetData),this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var kt=createTag("canvas");kt.width=this.assetData.w,kt.height=this.assetData.h;var _e=kt.getContext("2d"),Dt=this.img.width,Vt=this.img.height,Gt=Dt/Vt,zt=this.assetData.w/this.assetData.h,jt,Ht,Wt=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;Gt>zt&&Wt==="xMidYMid slice"||Gt<zt&&Wt!=="xMidYMid slice"?(Ht=Vt,jt=Ht*zt):(jt=Dt,Ht=jt/zt),_e.drawImage(this.img,(Dt-jt)/2,(Vt-Ht)/2,jt,Ht,0,0,this.assetData.w,this.assetData.h),this.img=kt}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null};function CVSolidElement(kt,_e,Dt){this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)};function CanvasRendererBase(){}extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(kt){return new CVShapeElement(kt,this.globalData,this)},CanvasRendererBase.prototype.createText=function(kt){return new CVTextElement(kt,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(kt){return new CVImageElement(kt,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(kt){return new CVSolidElement(kt,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(kt){kt[0]===1&&kt[1]===0&&kt[4]===0&&kt[5]===1&&kt[12]===0&&kt[13]===0||this.canvasContext.transform(kt[0],kt[1],kt[4],kt[5],kt[12],kt[13])},CanvasRendererBase.prototype.ctxOpacity=function(kt){this.canvasContext.globalAlpha*=kt<0?0:kt},CanvasRendererBase.prototype.ctxFillStyle=function(kt){this.canvasContext.fillStyle=kt},CanvasRendererBase.prototype.ctxStrokeStyle=function(kt){this.canvasContext.strokeStyle=kt},CanvasRendererBase.prototype.ctxLineWidth=function(kt){this.canvasContext.lineWidth=kt},CanvasRendererBase.prototype.ctxLineCap=function(kt){this.canvasContext.lineCap=kt},CanvasRendererBase.prototype.ctxLineJoin=function(kt){this.canvasContext.lineJoin=kt},CanvasRendererBase.prototype.ctxMiterLimit=function(kt){this.canvasContext.miterLimit=kt},CanvasRendererBase.prototype.ctxFill=function(kt){this.canvasContext.fill(kt)},CanvasRendererBase.prototype.ctxFillRect=function(kt,_e,Dt,Vt){this.canvasContext.fillRect(kt,_e,Dt,Vt)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}this.contextData.reset()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(kt){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}kt&&(this.globalData.blendMode="source-over"),this.contextData.restore(kt)},CanvasRendererBase.prototype.configAnimation=function(kt){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var _e=this.animationItem.container.style;_e.width="100%",_e.height="100%";var Dt="0px 0px 0px";_e.transformOrigin=Dt,_e.mozTransformOrigin=Dt,_e.webkitTransformOrigin=Dt,_e["-webkit-transform"]=Dt,_e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=kt,this.layers=kt.layers,this.transformCanvas={w:kt.w,h:kt.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(kt,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(kt.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(kt,_e){this.reset();var Dt,Vt;kt?(Dt=kt,Vt=_e,this.canvasContext.canvas.width=Dt,this.canvasContext.canvas.height=Vt):(this.animationItem.wrapper&&this.animationItem.container?(Dt=this.animationItem.wrapper.offsetWidth,Vt=this.animationItem.wrapper.offsetHeight):(Dt=this.canvasContext.canvas.width,Vt=this.canvasContext.canvas.height),this.canvasContext.canvas.width=Dt*this.renderConfig.dpr,this.canvasContext.canvas.height=Vt*this.renderConfig.dpr);var Gt,zt;if(this.renderConfig.preserveAspectRatio.indexOf("meet")!==-1||this.renderConfig.preserveAspectRatio.indexOf("slice")!==-1){var jt=this.renderConfig.preserveAspectRatio.split(" "),Ht=jt[1]||"meet",Wt=jt[0]||"xMidYMid",qt=Wt.substr(0,4),Xt=Wt.substr(4);Gt=Dt/Vt,zt=this.transformCanvas.w/this.transformCanvas.h,zt>Gt&&Ht==="meet"||zt<Gt&&Ht==="slice"?(this.transformCanvas.sx=Dt/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=Dt/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=Vt/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=Vt/(this.transformCanvas.h/this.renderConfig.dpr)),qt==="xMid"&&(zt<Gt&&Ht==="meet"||zt>Gt&&Ht==="slice")?this.transformCanvas.tx=(Dt-this.transformCanvas.w*(Vt/this.transformCanvas.h))/2*this.renderConfig.dpr:qt==="xMax"&&(zt<Gt&&Ht==="meet"||zt>Gt&&Ht==="slice")?this.transformCanvas.tx=(Dt-this.transformCanvas.w*(Vt/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,Xt==="YMid"&&(zt>Gt&&Ht==="meet"||zt<Gt&&Ht==="slice")?this.transformCanvas.ty=(Vt-this.transformCanvas.h*(Dt/this.transformCanvas.w))/2*this.renderConfig.dpr:Xt==="YMax"&&(zt>Gt&&Ht==="meet"||zt<Gt&&Ht==="slice")?this.transformCanvas.ty=(Vt-this.transformCanvas.h*(Dt/this.transformCanvas.w))*this.renderConfig.dpr:this.transformCanvas.ty=0}else this.renderConfig.preserveAspectRatio==="none"?(this.transformCanvas.sx=Dt/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=Vt/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText="");var kt,_e=this.layers?this.layers.length:0;for(kt=_e-1;kt>=0;kt-=1)this.elements[kt]&&this.elements[kt].destroy&&this.elements[kt].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(kt,_e){if(!(this.renderedFrame===kt&&this.renderConfig.clearCanvas===!0&&!_e||this.destroyed||kt===-1)){this.renderedFrame=kt,this.globalData.frameNum=kt-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||_e,this.globalData.projectInterface.currentFrame=kt;var Dt,Vt=this.layers.length;for(this.completeLayers||this.checkLayers(kt),Dt=Vt-1;Dt>=0;Dt-=1)(this.completeLayers||this.elements[Dt])&&this.elements[Dt].prepareFrame(kt-this.layers[Dt].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),Dt=Vt-1;Dt>=0;Dt-=1)(this.completeLayers||this.elements[Dt])&&this.elements[Dt].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(kt){var _e=this.elements;if(!(_e[kt]||this.layers[kt].ty===99)){var Dt=this.createItem(this.layers[kt],this,this.globalData);_e[kt]=Dt,Dt.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var kt=this.pendingElements.pop();kt.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var kt,_e=15;for(kt=0;kt<_e;kt+=1){var Dt=new CanvasContext;this.stack[kt]=Dt}this._length=_e,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}CVContextData.prototype.duplicate=function(){var kt=this._length*2,_e=0;for(_e=this._length;_e<kt;_e+=1)this.stack[_e]=new CanvasContext;this._length=kt},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(kt){this.cArrPos-=1;var _e=this.stack[this.cArrPos],Dt=_e.transform,Vt,Gt=this.cTr.props;for(Vt=0;Vt<16;Vt+=1)Gt[Vt]=Dt[Vt];if(kt){this.nativeContext.restore();var zt=this.stack[this.cArrPos+1];this.appliedFillStyle=zt.fillStyle,this.appliedStrokeStyle=zt.strokeStyle,this.appliedLineWidth=zt.lineWidth,this.appliedLineCap=zt.lineCap,this.appliedLineJoin=zt.lineJoin,this.appliedMiterLimit=zt.miterLimit}this.nativeContext.setTransform(Dt[0],Dt[1],Dt[4],Dt[5],Dt[12],Dt[13]),(kt||_e.opacity!==-1&&this.currentOpacity!==_e.opacity)&&(this.nativeContext.globalAlpha=_e.opacity,this.currentOpacity=_e.opacity),this.currentFillStyle=_e.fillStyle,this.currentStrokeStyle=_e.strokeStyle,this.currentLineWidth=_e.lineWidth,this.currentLineCap=_e.lineCap,this.currentLineJoin=_e.lineJoin,this.currentMiterLimit=_e.miterLimit},CVContextData.prototype.save=function(kt){kt&&this.nativeContext.save();var _e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var Dt=this.stack[this.cArrPos],Vt;for(Vt=0;Vt<16;Vt+=1)Dt.transform[Vt]=_e[Vt];this.cArrPos+=1;var Gt=this.stack[this.cArrPos];Gt.opacity=Dt.opacity,Gt.fillStyle=Dt.fillStyle,Gt.strokeStyle=Dt.strokeStyle,Gt.lineWidth=Dt.lineWidth,Gt.lineCap=Dt.lineCap,Gt.lineJoin=Dt.lineJoin,Gt.miterLimit=Dt.miterLimit},CVContextData.prototype.setOpacity=function(kt){this.stack[this.cArrPos].opacity=kt},CVContextData.prototype.setContext=function(kt){this.nativeContext=kt},CVContextData.prototype.fillStyle=function(kt){this.stack[this.cArrPos].fillStyle!==kt&&(this.currentFillStyle=kt,this.stack[this.cArrPos].fillStyle=kt)},CVContextData.prototype.strokeStyle=function(kt){this.stack[this.cArrPos].strokeStyle!==kt&&(this.currentStrokeStyle=kt,this.stack[this.cArrPos].strokeStyle=kt)},CVContextData.prototype.lineWidth=function(kt){this.stack[this.cArrPos].lineWidth!==kt&&(this.currentLineWidth=kt,this.stack[this.cArrPos].lineWidth=kt)},CVContextData.prototype.lineCap=function(kt){this.stack[this.cArrPos].lineCap!==kt&&(this.currentLineCap=kt,this.stack[this.cArrPos].lineCap=kt)},CVContextData.prototype.lineJoin=function(kt){this.stack[this.cArrPos].lineJoin!==kt&&(this.currentLineJoin=kt,this.stack[this.cArrPos].lineJoin=kt)},CVContextData.prototype.miterLimit=function(kt){this.stack[this.cArrPos].miterLimit!==kt&&(this.currentMiterLimit=kt,this.stack[this.cArrPos].miterLimit=kt)},CVContextData.prototype.transform=function(kt){this.transformMat.cloneFromProps(kt);var _e=this.cTr;this.transformMat.multiply(_e),_e.cloneFromProps(this.transformMat.props);var Dt=_e.props;this.nativeContext.setTransform(Dt[0],Dt[1],Dt[4],Dt[5],Dt[12],Dt[13])},CVContextData.prototype.opacity=function(kt){var _e=this.stack[this.cArrPos].opacity;_e*=kt<0?0:kt,this.stack[this.cArrPos].opacity!==_e&&(this.currentOpacity!==kt&&(this.nativeContext.globalAlpha=kt,this.currentOpacity=kt),this.stack[this.cArrPos].opacity=_e)},CVContextData.prototype.fill=function(kt){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(kt)},CVContextData.prototype.fillRect=function(kt,_e,Dt,Vt){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(kt,_e,Dt,Vt)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()};function CVCompElement(kt,_e,Dt){this.completeLayers=!1,this.layers=kt.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(kt,_e,Dt),this.tm=kt.tm?PropertyFactory.getProp(this,kt.tm,0,_e.frameRate,this):{_placeholder:!0}}extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var kt=this.canvasContext;kt.beginPath(),kt.moveTo(0,0),kt.lineTo(this.data.w,0),kt.lineTo(this.data.w,this.data.h),kt.lineTo(0,this.data.h),kt.lineTo(0,0),kt.clip();var _e,Dt=this.layers.length;for(_e=Dt-1;_e>=0;_e-=1)(this.completeLayers||this.elements[_e])&&this.elements[_e].renderFrame()},CVCompElement.prototype.destroy=function(){var kt,_e=this.layers.length;for(kt=_e-1;kt>=0;kt-=1)this.elements[kt]&&this.elements[kt].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(kt){return new CVCompElement(kt,this.globalData,this)};function CanvasRenderer(kt,_e){this.animationItem=kt,this.renderConfig={clearCanvas:_e&&_e.clearCanvas!==void 0?_e.clearCanvas:!0,context:_e&&_e.context||null,progressiveLoad:_e&&_e.progressiveLoad||!1,preserveAspectRatio:_e&&_e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:_e&&_e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:_e&&_e.contentVisibility||"visible",className:_e&&_e.className||"",id:_e&&_e.id||"",runExpressions:!_e||_e.runExpressions===void 0||_e.runExpressions},this.renderConfig.dpr=_e&&_e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=_e&&_e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(kt){return new CVCompElement(kt,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var _e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var Dt=this.finalTransform.mat.toCSS();_e.transform=Dt,_e.webkitTransform=Dt}this.finalTransform._opMdf&&(_e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(kt,_e,Dt){this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var kt;this.data.hasMask?(kt=createNS("rect"),kt.setAttribute("width",this.data.sw),kt.setAttribute("height",this.data.sh),kt.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(kt=createTag("div"),kt.style.width=this.data.sw+"px",kt.style.height=this.data.sh+"px",kt.style.backgroundColor=this.data.sc),this.layerElement.appendChild(kt)};function HShapeElement(kt,_e,Dt){this.shapes=[],this.shapesData=kt.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(kt,_e,Dt),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var kt;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),kt=this.svgElement;else{kt=createNS("svg");var _e=this.comp.data?this.comp.data:this.globalData.compSize;kt.setAttribute("width",_e.w),kt.setAttribute("height",_e.h),kt.appendChild(this.shapesContainer),this.layerElement.appendChild(kt)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=kt},HShapeElement.prototype.getTransformedPoint=function(kt,_e){var Dt,Vt=kt.length;for(Dt=0;Dt<Vt;Dt+=1)_e=kt[Dt].mProps.v.applyToPointArray(_e[0],_e[1],0);return _e},HShapeElement.prototype.calculateShapeBoundingBox=function(kt,_e){var Dt=kt.sh.v,Vt=kt.transformers,Gt,zt=Dt._length,jt,Ht,Wt,qt;if(!(zt<=1)){for(Gt=0;Gt<zt-1;Gt+=1)jt=this.getTransformedPoint(Vt,Dt.v[Gt]),Ht=this.getTransformedPoint(Vt,Dt.o[Gt]),Wt=this.getTransformedPoint(Vt,Dt.i[Gt+1]),qt=this.getTransformedPoint(Vt,Dt.v[Gt+1]),this.checkBounds(jt,Ht,Wt,qt,_e);Dt.c&&(jt=this.getTransformedPoint(Vt,Dt.v[Gt]),Ht=this.getTransformedPoint(Vt,Dt.o[Gt]),Wt=this.getTransformedPoint(Vt,Dt.i[0]),qt=this.getTransformedPoint(Vt,Dt.v[0]),this.checkBounds(jt,Ht,Wt,qt,_e))}},HShapeElement.prototype.checkBounds=function(kt,_e,Dt,Vt,Gt){this.getBoundsOfCurve(kt,_e,Dt,Vt);var zt=this.shapeBoundingBox;Gt.x=bmMin(zt.left,Gt.x),Gt.xMax=bmMax(zt.right,Gt.xMax),Gt.y=bmMin(zt.top,Gt.y),Gt.yMax=bmMax(zt.bottom,Gt.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(kt,_e,Dt,Vt){for(var Gt=[[kt[0],Vt[0]],[kt[1],Vt[1]]],zt,jt,Ht,Wt,qt,Xt,Kt,Yt=0;Yt<2;++Yt)jt=6*kt[Yt]-12*_e[Yt]+6*Dt[Yt],zt=-3*kt[Yt]+9*_e[Yt]-9*Dt[Yt]+3*Vt[Yt],Ht=3*_e[Yt]-3*kt[Yt],jt|=0,zt|=0,Ht|=0,zt===0&&jt===0||(zt===0?(Wt=-Ht/jt,Wt>0&&Wt<1&&Gt[Yt].push(this.calculateF(Wt,kt,_e,Dt,Vt,Yt))):(qt=jt*jt-4*Ht*zt,qt>=0&&(Xt=(-jt+bmSqrt(qt))/(2*zt),Xt>0&&Xt<1&&Gt[Yt].push(this.calculateF(Xt,kt,_e,Dt,Vt,Yt)),Kt=(-jt-bmSqrt(qt))/(2*zt),Kt>0&&Kt<1&&Gt[Yt].push(this.calculateF(Kt,kt,_e,Dt,Vt,Yt)))));this.shapeBoundingBox.left=bmMin.apply(null,Gt[0]),this.shapeBoundingBox.top=bmMin.apply(null,Gt[1]),this.shapeBoundingBox.right=bmMax.apply(null,Gt[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,Gt[1])},HShapeElement.prototype.calculateF=function(kt,_e,Dt,Vt,Gt,zt){return bmPow(1-kt,3)*_e[zt]+3*bmPow(1-kt,2)*kt*Dt[zt]+3*(1-kt)*bmPow(kt,2)*Vt[zt]+bmPow(kt,3)*Gt[zt]},HShapeElement.prototype.calculateBoundingBox=function(kt,_e){var Dt,Vt=kt.length;for(Dt=0;Dt<Vt;Dt+=1)kt[Dt]&&kt[Dt].sh?this.calculateShapeBoundingBox(kt[Dt],_e):kt[Dt]&&kt[Dt].it?this.calculateBoundingBox(kt[Dt].it,_e):kt[Dt]&&kt[Dt].style&&kt[Dt].w&&this.expandStrokeBoundingBox(kt[Dt].w,_e)},HShapeElement.prototype.expandStrokeBoundingBox=function(kt,_e){var Dt=0;if(kt.keyframes){for(var Vt=0;Vt<kt.keyframes.length;Vt+=1){var Gt=kt.keyframes[Vt].s;Gt>Dt&&(Dt=Gt)}Dt*=kt.mult}else Dt=kt.v*kt.mult;_e.x-=Dt,_e.xMax+=Dt,_e.y-=Dt,_e.yMax+=Dt},HShapeElement.prototype.currentBoxContains=function(kt){return this.currentBBox.x<=kt.x&&this.currentBBox.y<=kt.y&&this.currentBBox.width+this.currentBBox.x>=kt.x+kt.width&&this.currentBBox.height+this.currentBBox.y>=kt.y+kt.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var kt=this.tempBoundingBox,_e=999999;if(kt.x=_e,kt.xMax=-_e,kt.y=_e,kt.yMax=-_e,this.calculateBoundingBox(this.itemsData,kt),kt.width=kt.xMax<kt.x?0:kt.xMax-kt.x,kt.height=kt.yMax<kt.y?0:kt.yMax-kt.y,this.currentBoxContains(kt))return;var Dt=!1;if(this.currentBBox.w!==kt.width&&(this.currentBBox.w=kt.width,this.shapeCont.setAttribute("width",kt.width),Dt=!0),this.currentBBox.h!==kt.height&&(this.currentBBox.h=kt.height,this.shapeCont.setAttribute("height",kt.height),Dt=!0),Dt||this.currentBBox.x!==kt.x||this.currentBBox.y!==kt.y){this.currentBBox.w=kt.width,this.currentBBox.h=kt.height,this.currentBBox.x=kt.x,this.currentBBox.y=kt.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var Vt=this.shapeCont.style,Gt="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";Vt.transform=Gt,Vt.webkitTransform=Gt}}};function HTextElement(kt,_e,Dt){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var kt=createNS("g");this.maskedElement.appendChild(kt),this.innerElem=kt}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var kt=this.textProperty.currentData;this.renderedLetters=createSizedArray(kt.l?kt.l.length:0);var _e=this.innerElem.style,Dt=kt.fc?this.buildColor(kt.fc):"rgba(0,0,0,0)";_e.fill=Dt,_e.color=Dt,kt.sc&&(_e.stroke=this.buildColor(kt.sc),_e.strokeWidth=kt.sw+"px");var Vt=this.globalData.fontManager.getFontByName(kt.f);if(!this.globalData.fontManager.chars)if(_e.fontSize=kt.finalSize+"px",_e.lineHeight=kt.finalSize+"px",Vt.fClass)this.innerElem.className=Vt.fClass;else{_e.fontFamily=Vt.fFamily;var Gt=kt.fWeight,zt=kt.fStyle;_e.fontStyle=zt,_e.fontWeight=Gt}var jt,Ht,Wt=kt.l;Ht=Wt.length;var qt,Xt,Kt,Yt=this.mHelper,Zt,Jt="",nn=0;for(jt=0;jt<Ht;jt+=1){if(this.globalData.fontManager.chars?(this.textPaths[nn]?qt=this.textPaths[nn]:(qt=createNS("path"),qt.setAttribute("stroke-linecap",lineCapEnum[1]),qt.setAttribute("stroke-linejoin",lineJoinEnum[2]),qt.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[nn]?(Xt=this.textSpans[nn],Kt=Xt.children[0]):(Xt=createTag("div"),Xt.style.lineHeight=0,Kt=createNS("svg"),Kt.appendChild(qt),styleDiv(Xt)))):this.isMasked?qt=this.textPaths[nn]?this.textPaths[nn]:createNS("text"):this.textSpans[nn]?(Xt=this.textSpans[nn],qt=this.textPaths[nn]):(Xt=createTag("span"),styleDiv(Xt),qt=createTag("span"),styleDiv(qt),Xt.appendChild(qt)),this.globalData.fontManager.chars){var rn=this.globalData.fontManager.getCharData(kt.finalText[jt],Vt.fStyle,this.globalData.fontManager.getFontByName(kt.f).fFamily),Qt;if(rn?Qt=rn.data:Qt=null,Yt.reset(),Qt&&Qt.shapes&&Qt.shapes.length&&(Zt=Qt.shapes[0].it,Yt.scale(kt.finalSize/100,kt.finalSize/100),Jt=this.createPathShape(Yt,Zt),qt.setAttribute("d",Jt)),this.isMasked)this.innerElem.appendChild(qt);else{if(this.innerElem.appendChild(Xt),Qt&&Qt.shapes){document.body.appendChild(Kt);var en=Kt.getBBox();Kt.setAttribute("width",en.width+2),Kt.setAttribute("height",en.height+2),Kt.setAttribute("viewBox",en.x-1+" "+(en.y-1)+" "+(en.width+2)+" "+(en.height+2));var tn=Kt.style,sn="translate("+(en.x-1)+"px,"+(en.y-1)+"px)";tn.transform=sn,tn.webkitTransform=sn,Wt[jt].yOffset=en.y-1}else Kt.setAttribute("width",1),Kt.setAttribute("height",1);Xt.appendChild(Kt)}}else if(qt.textContent=Wt[jt].val,qt.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(qt);else{this.innerElem.appendChild(Xt);var cn=qt.style,un="translate3d(0,"+-kt.finalSize/1.2+"px,0)";cn.transform=un,cn.webkitTransform=un}this.isMasked?this.textSpans[nn]=qt:this.textSpans[nn]=Xt,this.textSpans[nn].style.display="block",this.textPaths[nn]=qt,nn+=1}for(;nn<this.textSpans.length;)this.textSpans[nn].style.display="none",nn+=1},HTextElement.prototype.renderInnerContent=function(){this.validateText();var kt;if(this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),kt=this.svgElement.style;var _e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";kt.transform=_e,kt.webkitTransform=_e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),!(!this.lettersChangedFlag&&!this.textAnimator.lettersChangedFlag)){var Dt,Vt,Gt=0,zt=this.textAnimator.renderedLetters,jt=this.textProperty.currentData.l;Vt=jt.length;var Ht,Wt,qt;for(Dt=0;Dt<Vt;Dt+=1)jt[Dt].n?Gt+=1:(Wt=this.textSpans[Dt],qt=this.textPaths[Dt],Ht=zt[Gt],Gt+=1,Ht._mdf.m&&(this.isMasked?Wt.setAttribute("transform",Ht.m):(Wt.style.webkitTransform=Ht.m,Wt.style.transform=Ht.m)),Wt.style.opacity=Ht.o,Ht.sw&&Ht._mdf.sw&&qt.setAttribute("stroke-width",Ht.sw),Ht.sc&&Ht._mdf.sc&&qt.setAttribute("stroke",Ht.sc),Ht.fc&&Ht._mdf.fc&&(qt.setAttribute("fill",Ht.fc),qt.style.color=Ht.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var Xt=this.innerElem.getBBox();this.currentBBox.w!==Xt.width&&(this.currentBBox.w=Xt.width,this.svgElement.setAttribute("width",Xt.width)),this.currentBBox.h!==Xt.height&&(this.currentBBox.h=Xt.height,this.svgElement.setAttribute("height",Xt.height));var Kt=1;if(this.currentBBox.w!==Xt.width+Kt*2||this.currentBBox.h!==Xt.height+Kt*2||this.currentBBox.x!==Xt.x-Kt||this.currentBBox.y!==Xt.y-Kt){this.currentBBox.w=Xt.width+Kt*2,this.currentBBox.h=Xt.height+Kt*2,this.currentBBox.x=Xt.x-Kt,this.currentBBox.y=Xt.y-Kt,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),kt=this.svgElement.style;var Yt="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";kt.transform=Yt,kt.webkitTransform=Yt}}}};function HCameraElement(kt,_e,Dt){this.initFrame(),this.initBaseData(kt,_e,Dt),this.initHierarchy();var Vt=PropertyFactory.getProp;if(this.pe=Vt(this,kt.pe,0,0,this),kt.ks.p.s?(this.px=Vt(this,kt.ks.p.x,1,0,this),this.py=Vt(this,kt.ks.p.y,1,0,this),this.pz=Vt(this,kt.ks.p.z,1,0,this)):this.p=Vt(this,kt.ks.p,1,0,this),kt.ks.a&&(this.a=Vt(this,kt.ks.a,1,0,this)),kt.ks.or.k.length&&kt.ks.or.k[0].to){var Gt,zt=kt.ks.or.k.length;for(Gt=0;Gt<zt;Gt+=1)kt.ks.or.k[Gt].to=null,kt.ks.or.k[Gt].ti=null}this.or=Vt(this,kt.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=Vt(this,kt.ks.rx,0,degToRads,this),this.ry=Vt(this,kt.ks.ry,0,degToRads,this),this.rz=Vt(this,kt.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var kt,_e=this.comp.threeDElements.length,Dt,Vt,Gt;for(kt=0;kt<_e;kt+=1)if(Dt=this.comp.threeDElements[kt],Dt.type==="3d"){Vt=Dt.perspectiveElem.style,Gt=Dt.container.style;var zt=this.pe.v+"px",jt="0px 0px 0px",Ht="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";Vt.perspective=zt,Vt.webkitPerspective=zt,Gt.transformOrigin=jt,Gt.mozTransformOrigin=jt,Gt.webkitTransformOrigin=jt,Vt.transform=Ht,Vt.webkitTransform=Ht}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var kt=this._isFirstFrame,_e,Dt;if(this.hierarchy)for(Dt=this.hierarchy.length,_e=0;_e<Dt;_e+=1)kt=this.hierarchy[_e].finalTransform.mProp._mdf||kt;if(kt||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(Dt=this.hierarchy.length-1,_e=Dt;_e>=0;_e-=1){var Vt=this.hierarchy[_e].finalTransform.mProp;this.mat.translate(-Vt.p.v[0],-Vt.p.v[1],Vt.p.v[2]),this.mat.rotateX(-Vt.or.v[0]).rotateY(-Vt.or.v[1]).rotateZ(Vt.or.v[2]),this.mat.rotateX(-Vt.rx.v).rotateY(-Vt.ry.v).rotateZ(Vt.rz.v),this.mat.scale(1/Vt.s.v[0],1/Vt.s.v[1],1/Vt.s.v[2]),this.mat.translate(Vt.a.v[0],Vt.a.v[1],Vt.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var Gt;this.p?Gt=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:Gt=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var zt=Math.sqrt(Math.pow(Gt[0],2)+Math.pow(Gt[1],2)+Math.pow(Gt[2],2)),jt=[Gt[0]/zt,Gt[1]/zt,Gt[2]/zt],Ht=Math.sqrt(jt[2]*jt[2]+jt[0]*jt[0]),Wt=Math.atan2(jt[1],Ht),qt=Math.atan2(jt[0],-jt[2]);this.mat.rotateY(qt).rotateX(-Wt)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var Xt=!this._prevMat.equals(this.mat);if((Xt||this.pe._mdf)&&this.comp.threeDElements){Dt=this.comp.threeDElements.length;var Kt,Yt,Zt;for(_e=0;_e<Dt;_e+=1)if(Kt=this.comp.threeDElements[_e],Kt.type==="3d"){if(Xt){var Jt=this.mat.toCSS();Zt=Kt.container.style,Zt.transform=Jt,Zt.webkitTransform=Jt}this.pe._mdf&&(Yt=Kt.perspectiveElem.style,Yt.perspective=this.pe.v+"px",Yt.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(kt){this.prepareProperties(kt,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null};function HImageElement(kt,_e,Dt){this.assetData=_e.getAssetData(kt.refId),this.initElement(kt,_e,Dt)}extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var kt=this.globalData.getAssetsPath(this.assetData),_e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",kt),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(_e),_e.crossOrigin="anonymous",_e.src=kt,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)};function HybridRendererBase(kt,_e){this.animationItem=kt,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:_e&&_e.className||"",imagePreserveAspectRatio:_e&&_e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(_e&&_e.hideOnTransparent===!1),filterSize:{width:_e&&_e.filterSize&&_e.filterSize.width||"400%",height:_e&&_e.filterSize&&_e.filterSize.height||"400%",x:_e&&_e.filterSize&&_e.filterSize.x||"-100%",y:_e&&_e.filterSize&&_e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var kt=this.pendingElements.pop();kt.checkParenting()}},HybridRendererBase.prototype.appendElementInPos=function(kt,_e){var Dt=kt.getBaseElement();if(Dt){var Vt=this.layers[_e];if(!Vt.ddd||!this.supports3d)if(this.threeDElements)this.addTo3dContainer(Dt,_e);else{for(var Gt=0,zt,jt,Ht;Gt<_e;)this.elements[Gt]&&this.elements[Gt]!==!0&&this.elements[Gt].getBaseElement&&(jt=this.elements[Gt],Ht=this.layers[Gt].ddd?this.getThreeDContainerByPos(Gt):jt.getBaseElement(),zt=Ht||zt),Gt+=1;zt?(!Vt.ddd||!this.supports3d)&&this.layerElement.insertBefore(Dt,zt):(!Vt.ddd||!this.supports3d)&&this.layerElement.appendChild(Dt)}else this.addTo3dContainer(Dt,_e)}},HybridRendererBase.prototype.createShape=function(kt){return this.supports3d?new HShapeElement(kt,this.globalData,this):new SVGShapeElement(kt,this.globalData,this)},HybridRendererBase.prototype.createText=function(kt){return this.supports3d?new HTextElement(kt,this.globalData,this):new SVGTextLottieElement(kt,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(kt){return this.camera=new HCameraElement(kt,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(kt){return this.supports3d?new HImageElement(kt,this.globalData,this):new IImageElement(kt,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(kt){return this.supports3d?new HSolidElement(kt,this.globalData,this):new ISolidElement(kt,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(kt){for(var _e=0,Dt=this.threeDElements.length;_e<Dt;){if(this.threeDElements[_e].startPos<=kt&&this.threeDElements[_e].endPos>=kt)return this.threeDElements[_e].perspectiveElem;_e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(kt,_e){var Dt=createTag("div"),Vt,Gt;styleDiv(Dt);var zt=createTag("div");if(styleDiv(zt),_e==="3d"){Vt=Dt.style,Vt.width=this.globalData.compSize.w+"px",Vt.height=this.globalData.compSize.h+"px";var jt="50% 50%";Vt.webkitTransformOrigin=jt,Vt.mozTransformOrigin=jt,Vt.transformOrigin=jt,Gt=zt.style;var Ht="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";Gt.transform=Ht,Gt.webkitTransform=Ht}Dt.appendChild(zt);var Wt={container:zt,perspectiveElem:Dt,startPos:kt,endPos:kt,type:_e};return this.threeDElements.push(Wt),Wt},HybridRendererBase.prototype.build3dContainers=function(){var kt,_e=this.layers.length,Dt,Vt="";for(kt=0;kt<_e;kt+=1)this.layers[kt].ddd&&this.layers[kt].ty!==3?(Vt!=="3d"&&(Vt="3d",Dt=this.createThreeDContainer(kt,"3d")),Dt.endPos=Math.max(Dt.endPos,kt)):(Vt!=="2d"&&(Vt="2d",Dt=this.createThreeDContainer(kt,"2d")),Dt.endPos=Math.max(Dt.endPos,kt));for(_e=this.threeDElements.length,kt=_e-1;kt>=0;kt-=1)this.resizerElem.appendChild(this.threeDElements[kt].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(kt,_e){for(var Dt=0,Vt=this.threeDElements.length;Dt<Vt;){if(_e<=this.threeDElements[Dt].endPos){for(var Gt=this.threeDElements[Dt].startPos,zt;Gt<_e;)this.elements[Gt]&&this.elements[Gt].getBaseElement&&(zt=this.elements[Gt].getBaseElement()),Gt+=1;zt?this.threeDElements[Dt].container.insertBefore(kt,zt):this.threeDElements[Dt].container.appendChild(kt);break}Dt+=1}},HybridRendererBase.prototype.configAnimation=function(kt){var _e=createTag("div"),Dt=this.animationItem.wrapper,Vt=_e.style;Vt.width=kt.w+"px",Vt.height=kt.h+"px",this.resizerElem=_e,styleDiv(_e),Vt.transformStyle="flat",Vt.mozTransformStyle="flat",Vt.webkitTransformStyle="flat",this.renderConfig.className&&_e.setAttribute("class",this.renderConfig.className),Dt.appendChild(_e),Vt.overflow="hidden";var Gt=createNS("svg");Gt.setAttribute("width","1"),Gt.setAttribute("height","1"),styleDiv(Gt),this.resizerElem.appendChild(Gt);var zt=createNS("defs");Gt.appendChild(zt),this.data=kt,this.setupGlobalData(kt,Gt),this.globalData.defs=zt,this.layers=kt.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var kt,_e=this.layers?this.layers.length:0;for(kt=0;kt<_e;kt+=1)this.elements[kt]&&this.elements[kt].destroy&&this.elements[kt].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var kt=this.animationItem.wrapper.offsetWidth,_e=this.animationItem.wrapper.offsetHeight,Dt=kt/_e,Vt=this.globalData.compSize.w/this.globalData.compSize.h,Gt,zt,jt,Ht;Vt>Dt?(Gt=kt/this.globalData.compSize.w,zt=kt/this.globalData.compSize.w,jt=0,Ht=(_e-this.globalData.compSize.h*(kt/this.globalData.compSize.w))/2):(Gt=_e/this.globalData.compSize.h,zt=_e/this.globalData.compSize.h,jt=(kt-this.globalData.compSize.w*(_e/this.globalData.compSize.h))/2,Ht=0);var Wt=this.resizerElem.style;Wt.webkitTransform="matrix3d("+Gt+",0,0,0,0,"+zt+",0,0,0,0,1,0,"+jt+","+Ht+",0,1)",Wt.transform=Wt.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var kt=this.globalData.compSize.w,_e=this.globalData.compSize.h,Dt,Vt=this.threeDElements.length;for(Dt=0;Dt<Vt;Dt+=1){var Gt=this.threeDElements[Dt].perspectiveElem.style;Gt.webkitPerspective=Math.sqrt(Math.pow(kt,2)+Math.pow(_e,2))+"px",Gt.perspective=Gt.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(kt){var _e,Dt=kt.length,Vt=createTag("div");for(_e=0;_e<Dt;_e+=1)if(kt[_e].xt){var Gt=this.createComp(kt[_e],Vt,this.globalData.comp,null);Gt.initExpressions(),this.globalData.projectInterface.registerComposition(Gt)}};function HCompElement(kt,_e,Dt){this.layers=kt.layers,this.supports3d=!kt.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(kt,_e,Dt),this.tm=kt.tm?PropertyFactory.getProp(this,kt.tm,0,_e.frameRate,this):{_placeholder:!0}}extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(kt,_e){for(var Dt=0,Vt;Dt<_e;)this.elements[Dt]&&this.elements[Dt].getBaseElement&&(Vt=this.elements[Dt].getBaseElement()),Dt+=1;Vt?this.layerElement.insertBefore(kt,Vt):this.layerElement.appendChild(kt)},HCompElement.prototype.createComp=function(kt){return this.supports3d?new HCompElement(kt,this.globalData,this):new SVGCompElement(kt,this.globalData,this)};function HybridRenderer(kt,_e){this.animationItem=kt,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:_e&&_e.className||"",imagePreserveAspectRatio:_e&&_e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(_e&&_e.hideOnTransparent===!1),filterSize:{width:_e&&_e.filterSize&&_e.filterSize.width||"400%",height:_e&&_e.filterSize&&_e.filterSize.height||"400%",x:_e&&_e.filterSize&&_e.filterSize.x||"-100%",y:_e&&_e.filterSize&&_e.filterSize.y||"-100%"},runExpressions:!_e||_e.runExpressions===void 0||_e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(kt){return this.supports3d?new HCompElement(kt,this.globalData,this):new SVGCompElement(kt,this.globalData,this)};var CompExpressionInterface=function(){return function(kt){function _e(Dt){for(var Vt=0,Gt=kt.layers.length;Vt<Gt;){if(kt.layers[Vt].nm===Dt||kt.layers[Vt].ind===Dt)return kt.elements[Vt].layerInterface;Vt+=1}return null}return Object.defineProperty(_e,"_name",{value:kt.data.nm}),_e.layer=_e,_e.pixelAspect=1,_e.height=kt.data.h||kt.globalData.compSize.h,_e.width=kt.data.w||kt.globalData.compSize.w,_e.pixelAspect=1,_e.frameDuration=1/kt.globalData.frameRate,_e.displayStartTime=0,_e.numLayers=kt.layers.length,_e}}();function _typeof$2(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$2=function(Dt){return typeof Dt}:_typeof$2=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$2(kt)}function seedRandom(kt,_e){var Dt=this,Vt=256,Gt=6,zt=52,jt="random",Ht=_e.pow(Vt,Gt),Wt=_e.pow(2,zt),qt=Wt*2,Xt=Vt-1,Kt;function Yt(tn,sn,cn){var un=[];sn=sn===!0?{entropy:!0}:sn||{};var hn=rn(nn(sn.entropy?[tn,en(kt)]:tn===null?Qt():tn,3),un),dn=new Zt(un),pn=function(){for(var mn=dn.g(Gt),vn=Ht,_n=0;mn<Wt;)mn=(mn+_n)*Vt,vn*=Vt,_n=dn.g(1);for(;mn>=qt;)mn/=2,vn/=2,_n>>>=1;return(mn+_n)/vn};return pn.int32=function(){return dn.g(4)|0},pn.quick=function(){return dn.g(4)/4294967296},pn.double=pn,rn(en(dn.S),kt),(sn.pass||cn||function(fn,mn,vn,_n){return _n&&(_n.S&&Jt(_n,dn),fn.state=function(){return Jt(dn,{})}),vn?(_e[jt]=fn,mn):fn})(pn,hn,"global"in sn?sn.global:this==_e,sn.state)}_e["seed"+jt]=Yt;function Zt(tn){var sn,cn=tn.length,un=this,hn=0,dn=un.i=un.j=0,pn=un.S=[];for(cn||(tn=[cn++]);hn<Vt;)pn[hn]=hn++;for(hn=0;hn<Vt;hn++)pn[hn]=pn[dn=Xt&dn+tn[hn%cn]+(sn=pn[hn])],pn[dn]=sn;un.g=function(fn){for(var mn,vn=0,_n=un.i,En=un.j,An=un.S;fn--;)mn=An[_n=Xt&_n+1],vn=vn*Vt+An[Xt&(An[_n]=An[En=Xt&En+mn])+(An[En]=mn)];return un.i=_n,un.j=En,vn}}function Jt(tn,sn){return sn.i=tn.i,sn.j=tn.j,sn.S=tn.S.slice(),sn}function nn(tn,sn){var cn=[],un=_typeof$2(tn),hn;if(sn&&un=="object")for(hn in tn)try{cn.push(nn(tn[hn],sn-1))}catch{}return cn.length?cn:un=="string"?tn:tn+"\0"}function rn(tn,sn){for(var cn=tn+"",un,hn=0;hn<cn.length;)sn[Xt&hn]=Xt&(un^=sn[Xt&hn]*19)+cn.charCodeAt(hn++);return en(sn)}function Qt(){try{var tn=new Uint8Array(Vt);return(Dt.crypto||Dt.msCrypto).getRandomValues(tn),en(tn)}catch{var sn=Dt.navigator,cn=sn&&sn.plugins;return[+new Date,Dt,cn,Dt.screen,en(kt)]}}function en(tn){return String.fromCharCode.apply(0,tn)}rn(_e.random(),kt)}function initialize$2(kt){seedRandom([],kt)}var propTypes={SHAPE:"shape"};function _typeof$1(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$1=function(Dt){return typeof Dt}:_typeof$1=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$1(kt)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};initialize$2(BMMath);function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(kt){return kt.constructor===Array||kt.constructor===Float32Array}function isNumerable(kt,_e){return kt==="number"||_e instanceof Number||kt==="boolean"||kt==="string"}function $bm_neg(kt){var _e=_typeof$1(kt);if(_e==="number"||kt instanceof Number||_e==="boolean")return-kt;if($bm_isInstanceOfArray(kt)){var Dt,Vt=kt.length,Gt=[];for(Dt=0;Dt<Vt;Dt+=1)Gt[Dt]=-kt[Dt];return Gt}return kt.propType?kt.v:-kt}var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(kt,_e){var Dt=_typeof$1(kt),Vt=_typeof$1(_e);if(isNumerable(Dt,kt)&&isNumerable(Vt,_e)||Dt==="string"||Vt==="string")return kt+_e;if($bm_isInstanceOfArray(kt)&&isNumerable(Vt,_e))return kt=kt.slice(0),kt[0]+=_e,kt;if(isNumerable(Dt,kt)&&$bm_isInstanceOfArray(_e))return _e=_e.slice(0),_e[0]=kt+_e[0],_e;if($bm_isInstanceOfArray(kt)&&$bm_isInstanceOfArray(_e)){for(var Gt=0,zt=kt.length,jt=_e.length,Ht=[];Gt<zt||Gt<jt;)(typeof kt[Gt]=="number"||kt[Gt]instanceof Number)&&(typeof _e[Gt]=="number"||_e[Gt]instanceof Number)?Ht[Gt]=kt[Gt]+_e[Gt]:Ht[Gt]=_e[Gt]===void 0?kt[Gt]:kt[Gt]||_e[Gt],Gt+=1;return Ht}return 0}var add=sum;function sub(kt,_e){var Dt=_typeof$1(kt),Vt=_typeof$1(_e);if(isNumerable(Dt,kt)&&isNumerable(Vt,_e))return Dt==="string"&&(kt=parseInt(kt,10)),Vt==="string"&&(_e=parseInt(_e,10)),kt-_e;if($bm_isInstanceOfArray(kt)&&isNumerable(Vt,_e))return kt=kt.slice(0),kt[0]-=_e,kt;if(isNumerable(Dt,kt)&&$bm_isInstanceOfArray(_e))return _e=_e.slice(0),_e[0]=kt-_e[0],_e;if($bm_isInstanceOfArray(kt)&&$bm_isInstanceOfArray(_e)){for(var Gt=0,zt=kt.length,jt=_e.length,Ht=[];Gt<zt||Gt<jt;)(typeof kt[Gt]=="number"||kt[Gt]instanceof Number)&&(typeof _e[Gt]=="number"||_e[Gt]instanceof Number)?Ht[Gt]=kt[Gt]-_e[Gt]:Ht[Gt]=_e[Gt]===void 0?kt[Gt]:kt[Gt]||_e[Gt],Gt+=1;return Ht}return 0}function mul(kt,_e){var Dt=_typeof$1(kt),Vt=_typeof$1(_e),Gt;if(isNumerable(Dt,kt)&&isNumerable(Vt,_e))return kt*_e;var zt,jt;if($bm_isInstanceOfArray(kt)&&isNumerable(Vt,_e)){for(jt=kt.length,Gt=createTypedArray("float32",jt),zt=0;zt<jt;zt+=1)Gt[zt]=kt[zt]*_e;return Gt}if(isNumerable(Dt,kt)&&$bm_isInstanceOfArray(_e)){for(jt=_e.length,Gt=createTypedArray("float32",jt),zt=0;zt<jt;zt+=1)Gt[zt]=kt*_e[zt];return Gt}return 0}function div(kt,_e){var Dt=_typeof$1(kt),Vt=_typeof$1(_e),Gt;if(isNumerable(Dt,kt)&&isNumerable(Vt,_e))return kt/_e;var zt,jt;if($bm_isInstanceOfArray(kt)&&isNumerable(Vt,_e)){for(jt=kt.length,Gt=createTypedArray("float32",jt),zt=0;zt<jt;zt+=1)Gt[zt]=kt[zt]/_e;return Gt}if(isNumerable(Dt,kt)&&$bm_isInstanceOfArray(_e)){for(jt=_e.length,Gt=createTypedArray("float32",jt),zt=0;zt<jt;zt+=1)Gt[zt]=kt/_e[zt];return Gt}return 0}function mod(kt,_e){return typeof kt=="string"&&(kt=parseInt(kt,10)),typeof _e=="string"&&(_e=parseInt(_e,10)),kt%_e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(kt,_e,Dt){if(_e>Dt){var Vt=Dt;Dt=_e,_e=Vt}return Math.min(Math.max(kt,_e),Dt)}function radiansToDegrees(kt){return kt/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(kt){return kt*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(kt,_e){if(typeof kt=="number"||kt instanceof Number)return _e=_e||0,Math.abs(kt-_e);_e||(_e=helperLengthArray);var Dt,Vt=Math.min(kt.length,_e.length),Gt=0;for(Dt=0;Dt<Vt;Dt+=1)Gt+=Math.pow(_e[Dt]-kt[Dt],2);return Math.sqrt(Gt)}function normalize(kt){return div(kt,length(kt))}function rgbToHsl(kt){var _e=kt[0],Dt=kt[1],Vt=kt[2],Gt=Math.max(_e,Dt,Vt),zt=Math.min(_e,Dt,Vt),jt,Ht,Wt=(Gt+zt)/2;if(Gt===zt)jt=0,Ht=0;else{var qt=Gt-zt;switch(Ht=Wt>.5?qt/(2-Gt-zt):qt/(Gt+zt),Gt){case _e:jt=(Dt-Vt)/qt+(Dt<Vt?6:0);break;case Dt:jt=(Vt-_e)/qt+2;break;case Vt:jt=(_e-Dt)/qt+4;break}jt/=6}return[jt,Ht,Wt,kt[3]]}function hue2rgb(kt,_e,Dt){return Dt<0&&(Dt+=1),Dt>1&&(Dt-=1),Dt<1/6?kt+(_e-kt)*6*Dt:Dt<1/2?_e:Dt<2/3?kt+(_e-kt)*(2/3-Dt)*6:kt}function hslToRgb(kt){var _e=kt[0],Dt=kt[1],Vt=kt[2],Gt,zt,jt;if(Dt===0)Gt=Vt,jt=Vt,zt=Vt;else{var Ht=Vt<.5?Vt*(1+Dt):Vt+Dt-Vt*Dt,Wt=2*Vt-Ht;Gt=hue2rgb(Wt,Ht,_e+1/3),zt=hue2rgb(Wt,Ht,_e),jt=hue2rgb(Wt,Ht,_e-1/3)}return[Gt,zt,jt,kt[3]]}function linear(kt,_e,Dt,Vt,Gt){if((Vt===void 0||Gt===void 0)&&(Vt=_e,Gt=Dt,_e=0,Dt=1),Dt<_e){var zt=Dt;Dt=_e,_e=zt}if(kt<=_e)return Vt;if(kt>=Dt)return Gt;var jt=Dt===_e?0:(kt-_e)/(Dt-_e);if(!Vt.length)return Vt+(Gt-Vt)*jt;var Ht,Wt=Vt.length,qt=createTypedArray("float32",Wt);for(Ht=0;Ht<Wt;Ht+=1)qt[Ht]=Vt[Ht]+(Gt[Ht]-Vt[Ht])*jt;return qt}function random(kt,_e){if(_e===void 0&&(kt===void 0?(kt=0,_e=1):(_e=kt,kt=void 0)),_e.length){var Dt,Vt=_e.length;kt||(kt=createTypedArray("float32",Vt));var Gt=createTypedArray("float32",Vt),zt=BMMath.random();for(Dt=0;Dt<Vt;Dt+=1)Gt[Dt]=kt[Dt]+zt*(_e[Dt]-kt[Dt]);return Gt}kt===void 0&&(kt=0);var jt=BMMath.random();return kt+jt*(_e-kt)}function createPath(kt,_e,Dt,Vt){var Gt,zt=kt.length,jt=shapePool.newElement();jt.setPathData(!!Vt,zt);var Ht=[0,0],Wt,qt;for(Gt=0;Gt<zt;Gt+=1)Wt=_e&&_e[Gt]?_e[Gt]:Ht,qt=Dt&&Dt[Gt]?Dt[Gt]:Ht,jt.setTripleAt(kt[Gt][0],kt[Gt][1],qt[0]+kt[Gt][0],qt[1]+kt[Gt][1],Wt[0]+kt[Gt][0],Wt[1]+kt[Gt][1],Gt,!0);return jt}function initiateExpression(elem,data,property){function noOp(kt){return kt}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=val.indexOf("random")!==-1,elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||this.data.hd!==!0,wiggle=function kt(_e,Dt){var Vt,Gt,zt=this.pv.length?this.pv.length:1,jt=createTypedArray("float32",zt);_e=5;var Ht=Math.floor(time*_e);for(Vt=0,Gt=0;Vt<Ht;){for(Gt=0;Gt<zt;Gt+=1)jt[Gt]+=-Dt+Dt*2*BMMath.random();Vt+=1}var Wt=time*_e,qt=Wt-Math.floor(Wt),Xt=createTypedArray("float32",zt);if(zt>1){for(Gt=0;Gt<zt;Gt+=1)Xt[Gt]=this.pv[Gt]+jt[Gt]+(-Dt+Dt*2*BMMath.random())*qt;return Xt}return this.pv+jt[0]+(-Dt+Dt*2*BMMath.random())*qt}.bind(this);thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty));function loopInDuration(kt,_e){return loopIn(kt,_e,!0)}function loopOutDuration(kt,_e){return loopOut(kt,_e,!0)}this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);function lookAt(kt,_e){var Dt=[_e[0]-kt[0],_e[1]-kt[1],_e[2]-kt[2]],Vt=Math.atan2(Dt[0],Math.sqrt(Dt[1]*Dt[1]+Dt[2]*Dt[2]))/degToRads,Gt=-Math.atan2(Dt[1],Dt[2])/degToRads;return[Gt,Vt,0]}function easeOut(kt,_e,Dt,Vt,Gt){return applyEase(easeOutBez,kt,_e,Dt,Vt,Gt)}function easeIn(kt,_e,Dt,Vt,Gt){return applyEase(easeInBez,kt,_e,Dt,Vt,Gt)}function ease(kt,_e,Dt,Vt,Gt){return applyEase(easeInOutBez,kt,_e,Dt,Vt,Gt)}function applyEase(kt,_e,Dt,Vt,Gt,zt){Gt===void 0?(Gt=Dt,zt=Vt):_e=(_e-Dt)/(Vt-Dt),_e>1?_e=1:_e<0&&(_e=0);var jt=kt(_e);if($bm_isInstanceOfArray(Gt)){var Ht,Wt=Gt.length,qt=createTypedArray("float32",Wt);for(Ht=0;Ht<Wt;Ht+=1)qt[Ht]=(zt[Ht]-Gt[Ht])*jt+Gt[Ht];return qt}return(zt-Gt)*jt+Gt}function nearestKey(kt){var _e,Dt=data.k.length,Vt,Gt;if(!data.k.length||typeof data.k[0]=="number")Vt=0,Gt=0;else if(Vt=-1,kt*=elem.comp.globalData.frameRate,kt<data.k[0].t)Vt=1,Gt=data.k[0].t;else{for(_e=0;_e<Dt-1;_e+=1)if(kt===data.k[_e].t){Vt=_e+1,Gt=data.k[_e].t;break}else if(kt>data.k[_e].t&&kt<data.k[_e+1].t){kt-data.k[_e].t>data.k[_e+1].t-kt?(Vt=_e+2,Gt=data.k[_e+1].t):(Vt=_e+1,Gt=data.k[_e].t);break}Vt===-1&&(Vt=_e+1,Gt=data.k[_e].t)}var zt={};return zt.index=Vt,zt.time=Gt/elem.comp.globalData.frameRate,zt}function key(kt){var _e,Dt,Vt;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+kt);kt-=1,_e={time:data.k[kt].t/elem.comp.globalData.frameRate,value:[]};var Gt=Object.prototype.hasOwnProperty.call(data.k[kt],"s")?data.k[kt].s:data.k[kt-1].e;for(Vt=Gt.length,Dt=0;Dt<Vt;Dt+=1)_e[Dt]=Gt[Dt],_e.value[Dt]=Gt[Dt];return _e}function framesToTime(kt,_e){return _e||(_e=elem.comp.globalData.frameRate),kt/_e}function timeToFrames(kt,_e){return!kt&&kt!==0&&(kt=time),_e||(_e=elem.comp.globalData.frameRate),kt*_e}function seedRandom(kt){BMMath.seedrandom(randSeed+kt)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(kt,_e){return typeof value=="string"?_e===void 0?value.substring(kt):value.substring(kt,_e):""}function substr(kt,_e){return typeof value=="string"?_e===void 0?value.substr(kt):value.substr(kt,_e):""}function posterizeTime(kt){time=kt===0?0:Math.floor(time*kt)/kt,value=valueAtTime(time)}var time,velocity,value,text,textIndex,textTotal,selectorValue,index=elem.data.ind,hasParent=!!(elem.hierarchy&&elem.hierarchy.length),parent,randSeed=Math.floor(Math.random()*1e6),globalData=elem.globalData;function executeExpression(kt){return value=kt,this.frameExpressionId===elem.globalData.frameId&&this.propType!=="textSelector"?value:(this.propType==="textSelector"&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),elemType===4&&!content&&(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),hasParent=!!(elem.hierarchy&&elem.hierarchy.length),hasParent&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt,scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob}(),Expressions=function(){var kt={};kt.initExpressions=_e,kt.resetFrame=ExpressionManager.resetFrame;function _e(Dt){var Vt=0,Gt=[];function zt(){Vt+=1}function jt(){Vt-=1,Vt===0&&Wt()}function Ht(qt){Gt.indexOf(qt)===-1&&Gt.push(qt)}function Wt(){var qt,Xt=Gt.length;for(qt=0;qt<Xt;qt+=1)Gt[qt].release();Gt.length=0}Dt.renderer.compInterface=CompExpressionInterface(Dt.renderer),Dt.renderer.globalData.projectInterface.registerComposition(Dt.renderer),Dt.renderer.globalData.pushExpression=zt,Dt.renderer.globalData.popExpression=jt,Dt.renderer.globalData.registerExpressionProperty=Ht}return kt}(),MaskManagerInterface=function(){function kt(Dt,Vt){this._mask=Dt,this._data=Vt}Object.defineProperty(kt.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(kt.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),this._mask.op.v*100}});var _e=function(Vt){var Gt=createSizedArray(Vt.viewData.length),zt,jt=Vt.viewData.length;for(zt=0;zt<jt;zt+=1)Gt[zt]=new kt(Vt.viewData[zt],Vt.masksProperties[zt]);var Ht=function(qt){for(zt=0;zt<jt;){if(Vt.masksProperties[zt].nm===qt)return Gt[zt];zt+=1}return null};return Ht};return _e}(),ExpressionPropertyInterface=function(){var kt={pv:0,v:0,mult:1},_e={pv:[0,0,0],v:[0,0,0],mult:1};function Dt(jt,Ht,Wt){Object.defineProperty(jt,"velocity",{get:function(){return Ht.getVelocityAtTime(Ht.comp.currentFrame)}}),jt.numKeys=Ht.keyframes?Ht.keyframes.length:0,jt.key=function(qt){if(!jt.numKeys)return 0;var Xt="";"s"in Ht.keyframes[qt-1]?Xt=Ht.keyframes[qt-1].s:"e"in Ht.keyframes[qt-2]?Xt=Ht.keyframes[qt-2].e:Xt=Ht.keyframes[qt-2].s;var Kt=Wt==="unidimensional"?new Number(Xt):Object.assign({},Xt);return Kt.time=Ht.keyframes[qt-1].t/Ht.elem.comp.globalData.frameRate,Kt.value=Wt==="unidimensional"?Xt[0]:Xt,Kt},jt.valueAtTime=Ht.getValueAtTime,jt.speedAtTime=Ht.getSpeedAtTime,jt.velocityAtTime=Ht.getVelocityAtTime,jt.propertyGroup=Ht.propertyGroup}function Vt(jt){(!jt||!("pv"in jt))&&(jt=kt);var Ht=1/jt.mult,Wt=jt.pv*Ht,qt=new Number(Wt);return qt.value=Wt,Dt(qt,jt,"unidimensional"),function(){return jt.k&&jt.getValue(),Wt=jt.v*Ht,qt.value!==Wt&&(qt=new Number(Wt),qt.value=Wt,Dt(qt,jt,"unidimensional")),qt}}function Gt(jt){(!jt||!("pv"in jt))&&(jt=_e);var Ht=1/jt.mult,Wt=jt.data&&jt.data.l||jt.pv.length,qt=createTypedArray("float32",Wt),Xt=createTypedArray("float32",Wt);return qt.value=Xt,Dt(qt,jt,"multidimensional"),function(){jt.k&&jt.getValue();for(var Kt=0;Kt<Wt;Kt+=1)Xt[Kt]=jt.v[Kt]*Ht,qt[Kt]=Xt[Kt];return qt}}function zt(){return kt}return function(jt){return jt?jt.propType==="unidimensional"?Vt(jt):Gt(jt):zt}}(),TransformExpressionInterface=function(){return function(kt){function _e(jt){switch(jt){case"scale":case"Scale":case"ADBE Scale":case 6:return _e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return _e.rotation;case"ADBE Rotate X":return _e.xRotation;case"ADBE Rotate Y":return _e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return _e.position;case"ADBE Position_0":return _e.xPosition;case"ADBE Position_1":return _e.yPosition;case"ADBE Position_2":return _e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return _e.anchorPoint;case"opacity":case"Opacity":case 11:return _e.opacity;default:return null}}Object.defineProperty(_e,"rotation",{get:ExpressionPropertyInterface(kt.r||kt.rz)}),Object.defineProperty(_e,"zRotation",{get:ExpressionPropertyInterface(kt.rz||kt.r)}),Object.defineProperty(_e,"xRotation",{get:ExpressionPropertyInterface(kt.rx)}),Object.defineProperty(_e,"yRotation",{get:ExpressionPropertyInterface(kt.ry)}),Object.defineProperty(_e,"scale",{get:ExpressionPropertyInterface(kt.s)});var Dt,Vt,Gt,zt;return kt.p?zt=ExpressionPropertyInterface(kt.p):(Dt=ExpressionPropertyInterface(kt.px),Vt=ExpressionPropertyInterface(kt.py),kt.pz&&(Gt=ExpressionPropertyInterface(kt.pz))),Object.defineProperty(_e,"position",{get:function(){return kt.p?zt():[Dt(),Vt(),Gt?Gt():0]}}),Object.defineProperty(_e,"xPosition",{get:ExpressionPropertyInterface(kt.px)}),Object.defineProperty(_e,"yPosition",{get:ExpressionPropertyInterface(kt.py)}),Object.defineProperty(_e,"zPosition",{get:ExpressionPropertyInterface(kt.pz)}),Object.defineProperty(_e,"anchorPoint",{get:ExpressionPropertyInterface(kt.a)}),Object.defineProperty(_e,"opacity",{get:ExpressionPropertyInterface(kt.o)}),Object.defineProperty(_e,"skew",{get:ExpressionPropertyInterface(kt.sk)}),Object.defineProperty(_e,"skewAxis",{get:ExpressionPropertyInterface(kt.sa)}),Object.defineProperty(_e,"orientation",{get:ExpressionPropertyInterface(kt.or)}),_e}}(),LayerExpressionInterface=function(){function kt(qt){var Xt=new Matrix;if(qt!==void 0){var Kt=this._elem.finalTransform.mProp.getValueAtTime(qt);Kt.clone(Xt)}else{var Yt=this._elem.finalTransform.mProp;Yt.applyToMatrix(Xt)}return Xt}function _e(qt,Xt){var Kt=this.getMatrix(Xt);return Kt.props[12]=0,Kt.props[13]=0,Kt.props[14]=0,this.applyPoint(Kt,qt)}function Dt(qt,Xt){var Kt=this.getMatrix(Xt);return this.applyPoint(Kt,qt)}function Vt(qt,Xt){var Kt=this.getMatrix(Xt);return Kt.props[12]=0,Kt.props[13]=0,Kt.props[14]=0,this.invertPoint(Kt,qt)}function Gt(qt,Xt){var Kt=this.getMatrix(Xt);return this.invertPoint(Kt,qt)}function zt(qt,Xt){if(this._elem.hierarchy&&this._elem.hierarchy.length){var Kt,Yt=this._elem.hierarchy.length;for(Kt=0;Kt<Yt;Kt+=1)this._elem.hierarchy[Kt].finalTransform.mProp.applyToMatrix(qt)}return qt.applyToPointArray(Xt[0],Xt[1],Xt[2]||0)}function jt(qt,Xt){if(this._elem.hierarchy&&this._elem.hierarchy.length){var Kt,Yt=this._elem.hierarchy.length;for(Kt=0;Kt<Yt;Kt+=1)this._elem.hierarchy[Kt].finalTransform.mProp.applyToMatrix(qt)}return qt.inversePoint(Xt)}function Ht(qt){var Xt=new Matrix;if(Xt.reset(),this._elem.finalTransform.mProp.applyToMatrix(Xt),this._elem.hierarchy&&this._elem.hierarchy.length){var Kt,Yt=this._elem.hierarchy.length;for(Kt=0;Kt<Yt;Kt+=1)this._elem.hierarchy[Kt].finalTransform.mProp.applyToMatrix(Xt);return Xt.inversePoint(qt)}return Xt.inversePoint(qt)}function Wt(){return[1,1,1,1]}return function(qt){var Xt;function Kt(nn){Zt.mask=new MaskManagerInterface(nn,qt)}function Yt(nn){Zt.effect=nn}function Zt(nn){switch(nn){case"ADBE Root Vectors Group":case"Contents":case 2:return Zt.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return Xt;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return Zt.effect;case"ADBE Text Properties":return Zt.textInterface;default:return null}}Zt.getMatrix=kt,Zt.invertPoint=jt,Zt.applyPoint=zt,Zt.toWorld=Dt,Zt.toWorldVec=_e,Zt.fromWorld=Gt,Zt.fromWorldVec=Vt,Zt.toComp=Dt,Zt.fromComp=Ht,Zt.sampleImage=Wt,Zt.sourceRectAtTime=qt.sourceRectAtTime.bind(qt),Zt._elem=qt,Xt=TransformExpressionInterface(qt.finalTransform.mProp);var Jt=getDescriptor(Xt,"anchorPoint");return Object.defineProperties(Zt,{hasParent:{get:function(){return qt.hierarchy.length}},parent:{get:function(){return qt.hierarchy[0].layerInterface}},rotation:getDescriptor(Xt,"rotation"),scale:getDescriptor(Xt,"scale"),position:getDescriptor(Xt,"position"),opacity:getDescriptor(Xt,"opacity"),anchorPoint:Jt,anchor_point:Jt,transform:{get:function(){return Xt}},active:{get:function(){return qt.isInRange}}}),Zt.startTime=qt.data.st,Zt.index=qt.data.ind,Zt.source=qt.data.refId,Zt.height=qt.data.ty===0?qt.data.h:100,Zt.width=qt.data.ty===0?qt.data.w:100,Zt.inPoint=qt.data.ip/qt.comp.globalData.frameRate,Zt.outPoint=qt.data.op/qt.comp.globalData.frameRate,Zt._name=qt.data.nm,Zt.registerMaskInterface=Kt,Zt.registerEffectsInterface=Yt,Zt}}(),propertyGroupFactory=function(){return function(kt,_e){return function(Dt){return Dt=Dt===void 0?1:Dt,Dt<=0?kt:_e(Dt-1)}}}(),PropertyInterface=function(){return function(kt,_e){var Dt={_name:kt};function Vt(Gt){return Gt=Gt===void 0?1:Gt,Gt<=0?Dt:_e(Gt-1)}return Vt}}(),EffectsExpressionInterface=function(){var kt={createEffectsInterface:_e};function _e(Gt,zt){if(Gt.effectsManager){var jt=[],Ht=Gt.data.ef,Wt,qt=Gt.effectsManager.effectElements.length;for(Wt=0;Wt<qt;Wt+=1)jt.push(Dt(Ht[Wt],Gt.effectsManager.effectElements[Wt],zt,Gt));var Xt=Gt.data.ef||[],Kt=function(Zt){for(Wt=0,qt=Xt.length;Wt<qt;){if(Zt===Xt[Wt].nm||Zt===Xt[Wt].mn||Zt===Xt[Wt].ix)return jt[Wt];Wt+=1}return null};return Object.defineProperty(Kt,"numProperties",{get:function(){return Xt.length}}),Kt}return null}function Dt(Gt,zt,jt,Ht){function Wt(Zt){for(var Jt=Gt.ef,nn=0,rn=Jt.length;nn<rn;){if(Zt===Jt[nn].nm||Zt===Jt[nn].mn||Zt===Jt[nn].ix)return Jt[nn].ty===5?Xt[nn]:Xt[nn]();nn+=1}throw new Error}var qt=propertyGroupFactory(Wt,jt),Xt=[],Kt,Yt=Gt.ef.length;for(Kt=0;Kt<Yt;Kt+=1)Gt.ef[Kt].ty===5?Xt.push(Dt(Gt.ef[Kt],zt.effectElements[Kt],zt.effectElements[Kt].propertyGroup,Ht)):Xt.push(Vt(zt.effectElements[Kt],Gt.ef[Kt].ty,Ht,qt));return Gt.mn==="ADBE Color Control"&&Object.defineProperty(Wt,"color",{get:function(){return Xt[0]()}}),Object.defineProperties(Wt,{numProperties:{get:function(){return Gt.np}},_name:{value:Gt.nm},propertyGroup:{value:qt}}),Wt.enabled=Gt.en!==0,Wt.active=Wt.enabled,Wt}function Vt(Gt,zt,jt,Ht){var Wt=ExpressionPropertyInterface(Gt.p);function qt(){return zt===10?jt.comp.compInterface(Gt.p.v):Wt()}return Gt.p.setGroupProperty&&Gt.p.setGroupProperty(PropertyInterface("",Ht)),qt}return kt}(),ShapePathInterface=function(){return function(_e,Dt,Vt){var Gt=Dt.sh;function zt(Ht){return Ht==="Shape"||Ht==="shape"||Ht==="Path"||Ht==="path"||Ht==="ADBE Vector Shape"||Ht===2?zt.path:null}var jt=propertyGroupFactory(zt,Vt);return Gt.setGroupProperty(PropertyInterface("Path",jt)),Object.defineProperties(zt,{path:{get:function(){return Gt.k&&Gt.getValue(),Gt}},shape:{get:function(){return Gt.k&&Gt.getValue(),Gt}},_name:{value:_e.nm},ix:{value:_e.ix},propertyIndex:{value:_e.ix},mn:{value:_e.mn},propertyGroup:{value:Vt}}),zt}}(),ShapeExpressionInterface=function(){function kt(Jt,nn,rn){var Qt=[],en,tn=Jt?Jt.length:0;for(en=0;en<tn;en+=1)Jt[en].ty==="gr"?Qt.push(Dt(Jt[en],nn[en],rn)):Jt[en].ty==="fl"?Qt.push(Vt(Jt[en],nn[en],rn)):Jt[en].ty==="st"?Qt.push(jt(Jt[en],nn[en],rn)):Jt[en].ty==="tm"?Qt.push(Ht(Jt[en],nn[en],rn)):Jt[en].ty==="tr"||(Jt[en].ty==="el"?Qt.push(qt(Jt[en],nn[en],rn)):Jt[en].ty==="sr"?Qt.push(Xt(Jt[en],nn[en],rn)):Jt[en].ty==="sh"?Qt.push(ShapePathInterface(Jt[en],nn[en],rn)):Jt[en].ty==="rc"?Qt.push(Kt(Jt[en],nn[en],rn)):Jt[en].ty==="rd"?Qt.push(Yt(Jt[en],nn[en],rn)):Jt[en].ty==="rp"?Qt.push(Zt(Jt[en],nn[en],rn)):Jt[en].ty==="gf"?Qt.push(Gt(Jt[en],nn[en],rn)):Qt.push(zt(Jt[en],nn[en])));return Qt}function _e(Jt,nn,rn){var Qt,en=function(cn){for(var un=0,hn=Qt.length;un<hn;){if(Qt[un]._name===cn||Qt[un].mn===cn||Qt[un].propertyIndex===cn||Qt[un].ix===cn||Qt[un].ind===cn)return Qt[un];un+=1}return typeof cn=="number"?Qt[cn-1]:null};en.propertyGroup=propertyGroupFactory(en,rn),Qt=kt(Jt.it,nn.it,en.propertyGroup),en.numProperties=Qt.length;var tn=Wt(Jt.it[Jt.it.length-1],nn.it[nn.it.length-1],en.propertyGroup);return en.transform=tn,en.propertyIndex=Jt.cix,en._name=Jt.nm,en}function Dt(Jt,nn,rn){var Qt=function(cn){switch(cn){case"ADBE Vectors Group":case"Contents":case 2:return Qt.content;default:return Qt.transform}};Qt.propertyGroup=propertyGroupFactory(Qt,rn);var en=_e(Jt,nn,Qt.propertyGroup),tn=Wt(Jt.it[Jt.it.length-1],nn.it[nn.it.length-1],Qt.propertyGroup);return Qt.content=en,Qt.transform=tn,Object.defineProperty(Qt,"_name",{get:function(){return Jt.nm}}),Qt.numProperties=Jt.np,Qt.propertyIndex=Jt.ix,Qt.nm=Jt.nm,Qt.mn=Jt.mn,Qt}function Vt(Jt,nn,rn){function Qt(en){return en==="Color"||en==="color"?Qt.color:en==="Opacity"||en==="opacity"?Qt.opacity:null}return Object.defineProperties(Qt,{color:{get:ExpressionPropertyInterface(nn.c)},opacity:{get:ExpressionPropertyInterface(nn.o)},_name:{value:Jt.nm},mn:{value:Jt.mn}}),nn.c.setGroupProperty(PropertyInterface("Color",rn)),nn.o.setGroupProperty(PropertyInterface("Opacity",rn)),Qt}function Gt(Jt,nn,rn){function Qt(en){return en==="Start Point"||en==="start point"?Qt.startPoint:en==="End Point"||en==="end point"?Qt.endPoint:en==="Opacity"||en==="opacity"?Qt.opacity:null}return Object.defineProperties(Qt,{startPoint:{get:ExpressionPropertyInterface(nn.s)},endPoint:{get:ExpressionPropertyInterface(nn.e)},opacity:{get:ExpressionPropertyInterface(nn.o)},type:{get:function(){return"a"}},_name:{value:Jt.nm},mn:{value:Jt.mn}}),nn.s.setGroupProperty(PropertyInterface("Start Point",rn)),nn.e.setGroupProperty(PropertyInterface("End Point",rn)),nn.o.setGroupProperty(PropertyInterface("Opacity",rn)),Qt}function zt(){function Jt(){return null}return Jt}function jt(Jt,nn,rn){var Qt=propertyGroupFactory(hn,rn),en=propertyGroupFactory(un,Qt);function tn(dn){Object.defineProperty(un,Jt.d[dn].nm,{get:ExpressionPropertyInterface(nn.d.dataProps[dn].p)})}var sn,cn=Jt.d?Jt.d.length:0,un={};for(sn=0;sn<cn;sn+=1)tn(sn),nn.d.dataProps[sn].p.setGroupProperty(en);function hn(dn){return dn==="Color"||dn==="color"?hn.color:dn==="Opacity"||dn==="opacity"?hn.opacity:dn==="Stroke Width"||dn==="stroke width"?hn.strokeWidth:null}return Object.defineProperties(hn,{color:{get:ExpressionPropertyInterface(nn.c)},opacity:{get:ExpressionPropertyInterface(nn.o)},strokeWidth:{get:ExpressionPropertyInterface(nn.w)},dash:{get:function(){return un}},_name:{value:Jt.nm},mn:{value:Jt.mn}}),nn.c.setGroupProperty(PropertyInterface("Color",Qt)),nn.o.setGroupProperty(PropertyInterface("Opacity",Qt)),nn.w.setGroupProperty(PropertyInterface("Stroke Width",Qt)),hn}function Ht(Jt,nn,rn){function Qt(tn){return tn===Jt.e.ix||tn==="End"||tn==="end"?Qt.end:tn===Jt.s.ix?Qt.start:tn===Jt.o.ix?Qt.offset:null}var en=propertyGroupFactory(Qt,rn);return Qt.propertyIndex=Jt.ix,nn.s.setGroupProperty(PropertyInterface("Start",en)),nn.e.setGroupProperty(PropertyInterface("End",en)),nn.o.setGroupProperty(PropertyInterface("Offset",en)),Qt.propertyIndex=Jt.ix,Qt.propertyGroup=rn,Object.defineProperties(Qt,{start:{get:ExpressionPropertyInterface(nn.s)},end:{get:ExpressionPropertyInterface(nn.e)},offset:{get:ExpressionPropertyInterface(nn.o)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}function Wt(Jt,nn,rn){function Qt(tn){return Jt.a.ix===tn||tn==="Anchor Point"?Qt.anchorPoint:Jt.o.ix===tn||tn==="Opacity"?Qt.opacity:Jt.p.ix===tn||tn==="Position"?Qt.position:Jt.r.ix===tn||tn==="Rotation"||tn==="ADBE Vector Rotation"?Qt.rotation:Jt.s.ix===tn||tn==="Scale"?Qt.scale:Jt.sk&&Jt.sk.ix===tn||tn==="Skew"?Qt.skew:Jt.sa&&Jt.sa.ix===tn||tn==="Skew Axis"?Qt.skewAxis:null}var en=propertyGroupFactory(Qt,rn);return nn.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",en)),nn.transform.mProps.p.setGroupProperty(PropertyInterface("Position",en)),nn.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",en)),nn.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",en)),nn.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",en)),nn.transform.mProps.sk&&(nn.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",en)),nn.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",en))),nn.transform.op.setGroupProperty(PropertyInterface("Opacity",en)),Object.defineProperties(Qt,{opacity:{get:ExpressionPropertyInterface(nn.transform.mProps.o)},position:{get:ExpressionPropertyInterface(nn.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(nn.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(nn.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(nn.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(nn.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(nn.transform.mProps.sa)},_name:{value:Jt.nm}}),Qt.ty="tr",Qt.mn=Jt.mn,Qt.propertyGroup=rn,Qt}function qt(Jt,nn,rn){function Qt(sn){return Jt.p.ix===sn?Qt.position:Jt.s.ix===sn?Qt.size:null}var en=propertyGroupFactory(Qt,rn);Qt.propertyIndex=Jt.ix;var tn=nn.sh.ty==="tm"?nn.sh.prop:nn.sh;return tn.s.setGroupProperty(PropertyInterface("Size",en)),tn.p.setGroupProperty(PropertyInterface("Position",en)),Object.defineProperties(Qt,{size:{get:ExpressionPropertyInterface(tn.s)},position:{get:ExpressionPropertyInterface(tn.p)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}function Xt(Jt,nn,rn){function Qt(sn){return Jt.p.ix===sn?Qt.position:Jt.r.ix===sn?Qt.rotation:Jt.pt.ix===sn?Qt.points:Jt.or.ix===sn||sn==="ADBE Vector Star Outer Radius"?Qt.outerRadius:Jt.os.ix===sn?Qt.outerRoundness:Jt.ir&&(Jt.ir.ix===sn||sn==="ADBE Vector Star Inner Radius")?Qt.innerRadius:Jt.is&&Jt.is.ix===sn?Qt.innerRoundness:null}var en=propertyGroupFactory(Qt,rn),tn=nn.sh.ty==="tm"?nn.sh.prop:nn.sh;return Qt.propertyIndex=Jt.ix,tn.or.setGroupProperty(PropertyInterface("Outer Radius",en)),tn.os.setGroupProperty(PropertyInterface("Outer Roundness",en)),tn.pt.setGroupProperty(PropertyInterface("Points",en)),tn.p.setGroupProperty(PropertyInterface("Position",en)),tn.r.setGroupProperty(PropertyInterface("Rotation",en)),Jt.ir&&(tn.ir.setGroupProperty(PropertyInterface("Inner Radius",en)),tn.is.setGroupProperty(PropertyInterface("Inner Roundness",en))),Object.defineProperties(Qt,{position:{get:ExpressionPropertyInterface(tn.p)},rotation:{get:ExpressionPropertyInterface(tn.r)},points:{get:ExpressionPropertyInterface(tn.pt)},outerRadius:{get:ExpressionPropertyInterface(tn.or)},outerRoundness:{get:ExpressionPropertyInterface(tn.os)},innerRadius:{get:ExpressionPropertyInterface(tn.ir)},innerRoundness:{get:ExpressionPropertyInterface(tn.is)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}function Kt(Jt,nn,rn){function Qt(sn){return Jt.p.ix===sn?Qt.position:Jt.r.ix===sn?Qt.roundness:Jt.s.ix===sn||sn==="Size"||sn==="ADBE Vector Rect Size"?Qt.size:null}var en=propertyGroupFactory(Qt,rn),tn=nn.sh.ty==="tm"?nn.sh.prop:nn.sh;return Qt.propertyIndex=Jt.ix,tn.p.setGroupProperty(PropertyInterface("Position",en)),tn.s.setGroupProperty(PropertyInterface("Size",en)),tn.r.setGroupProperty(PropertyInterface("Rotation",en)),Object.defineProperties(Qt,{position:{get:ExpressionPropertyInterface(tn.p)},roundness:{get:ExpressionPropertyInterface(tn.r)},size:{get:ExpressionPropertyInterface(tn.s)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}function Yt(Jt,nn,rn){function Qt(sn){return Jt.r.ix===sn||sn==="Round Corners 1"?Qt.radius:null}var en=propertyGroupFactory(Qt,rn),tn=nn;return Qt.propertyIndex=Jt.ix,tn.rd.setGroupProperty(PropertyInterface("Radius",en)),Object.defineProperties(Qt,{radius:{get:ExpressionPropertyInterface(tn.rd)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}function Zt(Jt,nn,rn){function Qt(sn){return Jt.c.ix===sn||sn==="Copies"?Qt.copies:Jt.o.ix===sn||sn==="Offset"?Qt.offset:null}var en=propertyGroupFactory(Qt,rn),tn=nn;return Qt.propertyIndex=Jt.ix,tn.c.setGroupProperty(PropertyInterface("Copies",en)),tn.o.setGroupProperty(PropertyInterface("Offset",en)),Object.defineProperties(Qt,{copies:{get:ExpressionPropertyInterface(tn.c)},offset:{get:ExpressionPropertyInterface(tn.o)},_name:{value:Jt.nm}}),Qt.mn=Jt.mn,Qt}return function(Jt,nn,rn){var Qt;function en(sn){if(typeof sn=="number")return sn=sn===void 0?1:sn,sn===0?rn:Qt[sn-1];for(var cn=0,un=Qt.length;cn<un;){if(Qt[cn]._name===sn)return Qt[cn];cn+=1}return null}function tn(){return rn}return en.propertyGroup=propertyGroupFactory(en,tn),Qt=kt(Jt,nn,en.propertyGroup),en.numProperties=Qt.length,en._name="Contents",en}}(),TextExpressionInterface=function(){return function(kt){var _e;function Dt(Vt){switch(Vt){case"ADBE Text Document":return Dt.sourceText;default:return null}}return Object.defineProperty(Dt,"sourceText",{get:function(){kt.textProperty.getValue();var Gt=kt.textProperty.currentData.t;return(!_e||Gt!==_e.value)&&(_e=new String(Gt),_e.value=Gt||new String(Gt),Object.defineProperty(_e,"style",{get:function(){return{fillColor:kt.textProperty.currentData.fc}}})),_e}}),Dt}}();function _typeof(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(Dt){return typeof Dt}:_typeof=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof(kt)}var FootageInterface=function(){var kt=function(Vt){var Gt="",zt=Vt.getFootageData();function jt(){return Gt="",zt=Vt.getFootageData(),Ht}function Ht(Wt){if(zt[Wt])return Gt=Wt,zt=zt[Wt],_typeof(zt)==="object"?Ht:zt;var qt=Wt.indexOf(Gt);if(qt!==-1){var Xt=parseInt(Wt.substr(qt+Gt.length),10);return zt=zt[Xt],_typeof(zt)==="object"?Ht:zt}return""}return jt},_e=function(Vt){function Gt(zt){return zt==="Outline"?Gt.outlineInterface():null}return Gt._name="Outline",Gt.outlineInterface=kt(Vt),Gt};return function(Dt){function Vt(Gt){return Gt==="Data"?Vt.dataInterface:null}return Vt._name="Data",Vt.dataInterface=_e(Dt),Vt}}(),interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(kt){return interfaces[kt]||null}var expressionHelpers=function(){function kt(jt,Ht,Wt){Ht.x&&(Wt.k=!0,Wt.x=!0,Wt.initiateExpression=ExpressionManager.initiateExpression,Wt.effectsSequence.push(Wt.initiateExpression(jt,Ht,Wt).bind(Wt)))}function _e(jt){return jt*=this.elem.globalData.frameRate,jt-=this.offsetTime,jt!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<jt?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(jt,this._cachingAtTime),this._cachingAtTime.lastFrame=jt),this._cachingAtTime.value}function Dt(jt){var Ht=-.01,Wt=this.getValueAtTime(jt),qt=this.getValueAtTime(jt+Ht),Xt=0;if(Wt.length){var Kt;for(Kt=0;Kt<Wt.length;Kt+=1)Xt+=Math.pow(qt[Kt]-Wt[Kt],2);Xt=Math.sqrt(Xt)*100}else Xt=0;return Xt}function Vt(jt){if(this.vel!==void 0)return this.vel;var Ht=-.001,Wt=this.getValueAtTime(jt),qt=this.getValueAtTime(jt+Ht),Xt;if(Wt.length){Xt=createTypedArray("float32",Wt.length);var Kt;for(Kt=0;Kt<Wt.length;Kt+=1)Xt[Kt]=(qt[Kt]-Wt[Kt])/Ht}else Xt=(qt-Wt)/Ht;return Xt}function Gt(){return this.pv}function zt(jt){this.propertyGroup=jt}return{searchExpressions:kt,getSpeedAtTime:Dt,getVelocityAtTime:Vt,getValueAtTime:_e,getStaticValueAtTime:Gt,setGroupProperty:zt}}();function addPropertyDecorator(){function kt(Yt,Zt,Jt){if(!this.k||!this.keyframes)return this.pv;Yt=Yt?Yt.toLowerCase():"";var nn=this.comp.renderedFrame,rn=this.keyframes,Qt=rn[rn.length-1].t;if(nn<=Qt)return this.pv;var en,tn;Jt?(Zt?en=Math.abs(Qt-this.elem.comp.globalData.frameRate*Zt):en=Math.max(0,Qt-this.elem.data.ip),tn=Qt-en):((!Zt||Zt>rn.length-1)&&(Zt=rn.length-1),tn=rn[rn.length-1-Zt].t,en=Qt-tn);var sn,cn,un;if(Yt==="pingpong"){var hn=Math.floor((nn-tn)/en);if(hn%2!==0)return this.getValueAtTime((en-(nn-tn)%en+tn)/this.comp.globalData.frameRate,0)}else if(Yt==="offset"){var dn=this.getValueAtTime(tn/this.comp.globalData.frameRate,0),pn=this.getValueAtTime(Qt/this.comp.globalData.frameRate,0),fn=this.getValueAtTime(((nn-tn)%en+tn)/this.comp.globalData.frameRate,0),mn=Math.floor((nn-tn)/en);if(this.pv.length){for(un=new Array(dn.length),cn=un.length,sn=0;sn<cn;sn+=1)un[sn]=(pn[sn]-dn[sn])*mn+fn[sn];return un}return(pn-dn)*mn+fn}else if(Yt==="continue"){var vn=this.getValueAtTime(Qt/this.comp.globalData.frameRate,0),_n=this.getValueAtTime((Qt-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(un=new Array(vn.length),cn=un.length,sn=0;sn<cn;sn+=1)un[sn]=vn[sn]+(vn[sn]-_n[sn])*((nn-Qt)/this.comp.globalData.frameRate)/5e-4;return un}return vn+(vn-_n)*((nn-Qt)/.001)}return this.getValueAtTime(((nn-tn)%en+tn)/this.comp.globalData.frameRate,0)}function _e(Yt,Zt,Jt){if(!this.k)return this.pv;Yt=Yt?Yt.toLowerCase():"";var nn=this.comp.renderedFrame,rn=this.keyframes,Qt=rn[0].t;if(nn>=Qt)return this.pv;var en,tn;Jt?(Zt?en=Math.abs(this.elem.comp.globalData.frameRate*Zt):en=Math.max(0,this.elem.data.op-Qt),tn=Qt+en):((!Zt||Zt>rn.length-1)&&(Zt=rn.length-1),tn=rn[Zt].t,en=tn-Qt);var sn,cn,un;if(Yt==="pingpong"){var hn=Math.floor((Qt-nn)/en);if(hn%2===0)return this.getValueAtTime(((Qt-nn)%en+Qt)/this.comp.globalData.frameRate,0)}else if(Yt==="offset"){var dn=this.getValueAtTime(Qt/this.comp.globalData.frameRate,0),pn=this.getValueAtTime(tn/this.comp.globalData.frameRate,0),fn=this.getValueAtTime((en-(Qt-nn)%en+Qt)/this.comp.globalData.frameRate,0),mn=Math.floor((Qt-nn)/en)+1;if(this.pv.length){for(un=new Array(dn.length),cn=un.length,sn=0;sn<cn;sn+=1)un[sn]=fn[sn]-(pn[sn]-dn[sn])*mn;return un}return fn-(pn-dn)*mn}else if(Yt==="continue"){var vn=this.getValueAtTime(Qt/this.comp.globalData.frameRate,0),_n=this.getValueAtTime((Qt+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(un=new Array(vn.length),cn=un.length,sn=0;sn<cn;sn+=1)un[sn]=vn[sn]+(vn[sn]-_n[sn])*(Qt-nn)/.001;return un}return vn+(vn-_n)*(Qt-nn)/.001}return this.getValueAtTime((en-((Qt-nn)%en+Qt))/this.comp.globalData.frameRate,0)}function Dt(Yt,Zt){if(!this.k)return this.pv;if(Yt=(Yt||.4)*.5,Zt=Math.floor(Zt||5),Zt<=1)return this.pv;var Jt=this.comp.renderedFrame/this.comp.globalData.frameRate,nn=Jt-Yt,rn=Jt+Yt,Qt=Zt>1?(rn-nn)/(Zt-1):1,en=0,tn=0,sn;this.pv.length?sn=createTypedArray("float32",this.pv.length):sn=0;for(var cn;en<Zt;){if(cn=this.getValueAtTime(nn+en*Qt),this.pv.length)for(tn=0;tn<this.pv.length;tn+=1)sn[tn]+=cn[tn];else sn+=cn;en+=1}if(this.pv.length)for(tn=0;tn<this.pv.length;tn+=1)sn[tn]/=Zt;else sn/=Zt;return sn}function Vt(Yt){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var Zt=this._transformCachingAtTime.v;if(Zt.cloneFromProps(this.pre.props),this.appliedTransformations<1){var Jt=this.a.getValueAtTime(Yt);Zt.translate(-Jt[0]*this.a.mult,-Jt[1]*this.a.mult,Jt[2]*this.a.mult)}if(this.appliedTransformations<2){var nn=this.s.getValueAtTime(Yt);Zt.scale(nn[0]*this.s.mult,nn[1]*this.s.mult,nn[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var rn=this.sk.getValueAtTime(Yt),Qt=this.sa.getValueAtTime(Yt);Zt.skewFromAxis(-rn*this.sk.mult,Qt*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var en=this.r.getValueAtTime(Yt);Zt.rotate(-en*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var tn=this.rz.getValueAtTime(Yt),sn=this.ry.getValueAtTime(Yt),cn=this.rx.getValueAtTime(Yt),un=this.or.getValueAtTime(Yt);Zt.rotateZ(-tn*this.rz.mult).rotateY(sn*this.ry.mult).rotateX(cn*this.rx.mult).rotateZ(-un[2]*this.or.mult).rotateY(un[1]*this.or.mult).rotateX(un[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var hn=this.px.getValueAtTime(Yt),dn=this.py.getValueAtTime(Yt);if(this.data.p.z){var pn=this.pz.getValueAtTime(Yt);Zt.translate(hn*this.px.mult,dn*this.py.mult,-pn*this.pz.mult)}else Zt.translate(hn*this.px.mult,dn*this.py.mult,0)}else{var fn=this.p.getValueAtTime(Yt);Zt.translate(fn[0]*this.p.mult,fn[1]*this.p.mult,-fn[2]*this.p.mult)}return Zt}function Gt(){return this.v.clone(new Matrix)}var zt=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(Yt,Zt,Jt){var nn=zt(Yt,Zt,Jt);return nn.dynamicProperties.length?nn.getValueAtTime=Vt.bind(nn):nn.getValueAtTime=Gt.bind(nn),nn.setGroupProperty=expressionHelpers.setGroupProperty,nn};var jt=PropertyFactory.getProp;PropertyFactory.getProp=function(Yt,Zt,Jt,nn,rn){var Qt=jt(Yt,Zt,Jt,nn,rn);Qt.kf?Qt.getValueAtTime=expressionHelpers.getValueAtTime.bind(Qt):Qt.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(Qt),Qt.setGroupProperty=expressionHelpers.setGroupProperty,Qt.loopOut=kt,Qt.loopIn=_e,Qt.smooth=Dt,Qt.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(Qt),Qt.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(Qt),Qt.numKeys=Zt.a===1?Zt.k.length:0,Qt.propertyIndex=Zt.ix;var en=0;return Jt!==0&&(en=createTypedArray("float32",Zt.a===1?Zt.k[0].s.length:Zt.k.length)),Qt._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:en},expressionHelpers.searchExpressions(Yt,Zt,Qt),Qt.k&&rn.addDynamicProperty(Qt),Qt};function Ht(Yt){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),Yt*=this.elem.globalData.frameRate,Yt-=this.offsetTime,Yt!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<Yt?this._caching.lastIndex:0,this._cachingAtTime.lastTime=Yt,this.interpolateShape(Yt,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue}var Wt=ShapePropertyFactory.getConstructorFunction(),qt=ShapePropertyFactory.getKeyframedConstructorFunction();function Xt(){}Xt.prototype={vertices:function(Zt,Jt){this.k&&this.getValue();var nn=this.v;Jt!==void 0&&(nn=this.getValueAtTime(Jt,0));var rn,Qt=nn._length,en=nn[Zt],tn=nn.v,sn=createSizedArray(Qt);for(rn=0;rn<Qt;rn+=1)Zt==="i"||Zt==="o"?sn[rn]=[en[rn][0]-tn[rn][0],en[rn][1]-tn[rn][1]]:sn[rn]=[en[rn][0],en[rn][1]];return sn},points:function(Zt){return this.vertices("v",Zt)},inTangents:function(Zt){return this.vertices("i",Zt)},outTangents:function(Zt){return this.vertices("o",Zt)},isClosed:function(){return this.v.c},pointOnPath:function(Zt,Jt){var nn=this.v;Jt!==void 0&&(nn=this.getValueAtTime(Jt,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(nn));for(var rn=this._segmentsLength,Qt=rn.lengths,en=rn.totalLength*Zt,tn=0,sn=Qt.length,cn=0,un;tn<sn;){if(cn+Qt[tn].addedLength>en){var hn=tn,dn=nn.c&&tn===sn-1?0:tn+1,pn=(en-cn)/Qt[tn].addedLength;un=bez.getPointInSegment(nn.v[hn],nn.v[dn],nn.o[hn],nn.i[dn],pn,Qt[tn]);break}else cn+=Qt[tn].addedLength;tn+=1}return un||(un=nn.c?[nn.v[0][0],nn.v[0][1]]:[nn.v[nn._length-1][0],nn.v[nn._length-1][1]]),un},vectorOnPath:function(Zt,Jt,nn){Zt==1?Zt=this.v.c:Zt==0&&(Zt=.999);var rn=this.pointOnPath(Zt,Jt),Qt=this.pointOnPath(Zt+.001,Jt),en=Qt[0]-rn[0],tn=Qt[1]-rn[1],sn=Math.sqrt(Math.pow(en,2)+Math.pow(tn,2));if(sn===0)return[0,0];var cn=nn==="tangent"?[en/sn,tn/sn]:[-tn/sn,en/sn];return cn},tangentOnPath:function(Zt,Jt){return this.vectorOnPath(Zt,Jt,"tangent")},normalOnPath:function(Zt,Jt){return this.vectorOnPath(Zt,Jt,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([Xt],Wt),extendPrototype([Xt],qt),qt.prototype.getValueAtTime=Ht,qt.prototype.initiateExpression=ExpressionManager.initiateExpression;var Kt=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(Yt,Zt,Jt,nn,rn){var Qt=Kt(Yt,Zt,Jt,nn,rn);return Qt.propertyIndex=Zt.ix,Qt.lock=!1,Jt===3?expressionHelpers.searchExpressions(Yt,Zt.pt,Qt):Jt===4&&expressionHelpers.searchExpressions(Yt,Zt.ks,Qt),Qt.k&&Yt.addDynamicProperty(Qt),Qt}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function kt(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(_e,Dt){var Vt=this.calculateExpression(Dt);if(_e.t!==Vt){var Gt={};return this.copyData(Gt,_e),Gt.t=Vt.toString(),Gt.__complete=!1,Gt}return _e},TextProperty.prototype.searchProperty=function(){var _e=this.searchKeyframes(),Dt=this.searchExpressions();return this.kf=_e||Dt,this.kf},TextProperty.prototype.searchExpressions=kt}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function kt(_e,Dt){var Vt=createNS("feMerge");Vt.setAttribute("result",_e);var Gt,zt;for(zt=0;zt<Dt.length;zt+=1)Gt=createNS("feMergeNode"),Gt.setAttribute("in",Dt[zt]),Vt.appendChild(Gt),Vt.appendChild(Gt);return Vt}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(kt,_e,Dt,Vt,Gt){this.filterManager=_e;var zt=createNS("feColorMatrix");zt.setAttribute("type","matrix"),zt.setAttribute("color-interpolation-filters","linearRGB"),zt.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=zt,zt.setAttribute("result",Vt+"_tint_1"),kt.appendChild(zt),zt=createNS("feColorMatrix"),zt.setAttribute("type","matrix"),zt.setAttribute("color-interpolation-filters","sRGB"),zt.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),zt.setAttribute("result",Vt+"_tint_2"),kt.appendChild(zt),this.matrixFilter=zt;var jt=this.createMergeNode(Vt,[Gt,Vt+"_tint_1",Vt+"_tint_2"]);kt.appendChild(jt)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){var _e=this.filterManager.effectElements[0].p.v,Dt=this.filterManager.effectElements[1].p.v,Vt=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+Vt+" 0"),this.matrixFilter.setAttribute("values",Dt[0]-_e[0]+" 0 0 0 "+_e[0]+" "+(Dt[1]-_e[1])+" 0 0 0 "+_e[1]+" "+(Dt[2]-_e[2])+" 0 0 0 "+_e[2]+" 0 0 0 1 0")}};function SVGFillFilter(kt,_e,Dt,Vt){this.filterManager=_e;var Gt=createNS("feColorMatrix");Gt.setAttribute("type","matrix"),Gt.setAttribute("color-interpolation-filters","sRGB"),Gt.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),Gt.setAttribute("result",Vt),kt.appendChild(Gt),this.matrixFilter=Gt}SVGFillFilter.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){var _e=this.filterManager.effectElements[2].p.v,Dt=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+_e[0]+" 0 0 0 0 "+_e[1]+" 0 0 0 0 "+_e[2]+" 0 0 0 "+Dt+" 0")}};function SVGStrokeEffect(kt,_e,Dt){this.initialized=!1,this.filterManager=_e,this.elem=Dt,this.paths=[]}SVGStrokeEffect.prototype.initialize=function(){var kt=this.elem.layerElement.children||this.elem.layerElement.childNodes,_e,Dt,Vt,Gt;for(this.filterManager.effectElements[1].p.v===1?(Gt=this.elem.maskManager.masksProperties.length,Vt=0):(Vt=this.filterManager.effectElements[0].p.v-1,Gt=Vt+1),Dt=createNS("g"),Dt.setAttribute("fill","none"),Dt.setAttribute("stroke-linecap","round"),Dt.setAttribute("stroke-dashoffset",1),Vt;Vt<Gt;Vt+=1)_e=createNS("path"),Dt.appendChild(_e),this.paths.push({p:_e,m:Vt});if(this.filterManager.effectElements[10].p.v===3){var zt=createNS("mask"),jt=createElementID();zt.setAttribute("id",jt),zt.setAttribute("mask-type","alpha"),zt.appendChild(Dt),this.elem.globalData.defs.appendChild(zt);var Ht=createNS("g");for(Ht.setAttribute("mask","url("+getLocationHref()+"#"+jt+")");kt[0];)Ht.appendChild(kt[0]);this.elem.layerElement.appendChild(Ht),this.masker=zt,Dt.setAttribute("stroke","#fff")}else if(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2){if(this.filterManager.effectElements[10].p.v===2)for(kt=this.elem.layerElement.children||this.elem.layerElement.childNodes;kt.length;)this.elem.layerElement.removeChild(kt[0]);this.elem.layerElement.appendChild(Dt),this.elem.layerElement.removeAttribute("mask"),Dt.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=Dt},SVGStrokeEffect.prototype.renderFrame=function(kt){this.initialized||this.initialize();var _e,Dt=this.paths.length,Vt,Gt;for(_e=0;_e<Dt;_e+=1)if(this.paths[_e].m!==-1&&(Vt=this.elem.maskManager.viewData[this.paths[_e].m],Gt=this.paths[_e].p,(kt||this.filterManager._mdf||Vt.prop._mdf)&&Gt.setAttribute("d",Vt.lastPath),kt||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||Vt.prop._mdf)){var zt;if(this.filterManager.effectElements[7].p.v!==0||this.filterManager.effectElements[8].p.v!==100){var jt=Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,Ht=Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,Wt=Gt.getTotalLength();zt="0 0 0 "+Wt*jt+" ";var qt=Wt*(Ht-jt),Xt=1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01,Kt=Math.floor(qt/Xt),Yt;for(Yt=0;Yt<Kt;Yt+=1)zt+="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01+" ";zt+="0 "+Wt*10+" 0 0"}else zt="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01;Gt.setAttribute("stroke-dasharray",zt)}if((kt||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",this.filterManager.effectElements[4].p.v*2),(kt||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2)&&(kt||this.filterManager.effectElements[3].p._mdf)){var Zt=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(Zt[0]*255)+","+bmFloor(Zt[1]*255)+","+bmFloor(Zt[2]*255)+")")}};function SVGTritoneFilter(kt,_e,Dt,Vt){this.filterManager=_e;var Gt=createNS("feColorMatrix");Gt.setAttribute("type","matrix"),Gt.setAttribute("color-interpolation-filters","linearRGB"),Gt.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),kt.appendChild(Gt);var zt=createNS("feComponentTransfer");zt.setAttribute("color-interpolation-filters","sRGB"),zt.setAttribute("result",Vt),this.matrixFilter=zt;var jt=createNS("feFuncR");jt.setAttribute("type","table"),zt.appendChild(jt),this.feFuncR=jt;var Ht=createNS("feFuncG");Ht.setAttribute("type","table"),zt.appendChild(Ht),this.feFuncG=Ht;var Wt=createNS("feFuncB");Wt.setAttribute("type","table"),zt.appendChild(Wt),this.feFuncB=Wt,kt.appendChild(zt)}SVGTritoneFilter.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){var _e=this.filterManager.effectElements[0].p.v,Dt=this.filterManager.effectElements[1].p.v,Vt=this.filterManager.effectElements[2].p.v,Gt=Vt[0]+" "+Dt[0]+" "+_e[0],zt=Vt[1]+" "+Dt[1]+" "+_e[1],jt=Vt[2]+" "+Dt[2]+" "+_e[2];this.feFuncR.setAttribute("tableValues",Gt),this.feFuncG.setAttribute("tableValues",zt),this.feFuncB.setAttribute("tableValues",jt)}};function SVGProLevelsFilter(kt,_e,Dt,Vt){this.filterManager=_e;var Gt=this.filterManager.effectElements,zt=createNS("feComponentTransfer");(Gt[10].p.k||Gt[10].p.v!==0||Gt[11].p.k||Gt[11].p.v!==1||Gt[12].p.k||Gt[12].p.v!==1||Gt[13].p.k||Gt[13].p.v!==0||Gt[14].p.k||Gt[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",zt)),(Gt[17].p.k||Gt[17].p.v!==0||Gt[18].p.k||Gt[18].p.v!==1||Gt[19].p.k||Gt[19].p.v!==1||Gt[20].p.k||Gt[20].p.v!==0||Gt[21].p.k||Gt[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",zt)),(Gt[24].p.k||Gt[24].p.v!==0||Gt[25].p.k||Gt[25].p.v!==1||Gt[26].p.k||Gt[26].p.v!==1||Gt[27].p.k||Gt[27].p.v!==0||Gt[28].p.k||Gt[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",zt)),(Gt[31].p.k||Gt[31].p.v!==0||Gt[32].p.k||Gt[32].p.v!==1||Gt[33].p.k||Gt[33].p.v!==1||Gt[34].p.k||Gt[34].p.v!==0||Gt[35].p.k||Gt[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",zt)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(zt.setAttribute("color-interpolation-filters","sRGB"),kt.appendChild(zt)),(Gt[3].p.k||Gt[3].p.v!==0||Gt[4].p.k||Gt[4].p.v!==1||Gt[5].p.k||Gt[5].p.v!==1||Gt[6].p.k||Gt[6].p.v!==0||Gt[7].p.k||Gt[7].p.v!==1)&&(zt=createNS("feComponentTransfer"),zt.setAttribute("color-interpolation-filters","sRGB"),zt.setAttribute("result",Vt),kt.appendChild(zt),this.feFuncRComposed=this.createFeFunc("feFuncR",zt),this.feFuncGComposed=this.createFeFunc("feFuncG",zt),this.feFuncBComposed=this.createFeFunc("feFuncB",zt))}SVGProLevelsFilter.prototype.createFeFunc=function(kt,_e){var Dt=createNS(kt);return Dt.setAttribute("type","table"),_e.appendChild(Dt),Dt},SVGProLevelsFilter.prototype.getTableValue=function(kt,_e,Dt,Vt,Gt){for(var zt=0,jt=256,Ht,Wt=Math.min(kt,_e),qt=Math.max(kt,_e),Xt=Array.call(null,{length:jt}),Kt,Yt=0,Zt=Gt-Vt,Jt=_e-kt;zt<=256;)Ht=zt/256,Ht<=Wt?Kt=Jt<0?Gt:Vt:Ht>=qt?Kt=Jt<0?Vt:Gt:Kt=Vt+Zt*Math.pow((Ht-kt)/Jt,1/Dt),Xt[Yt]=Kt,Yt+=1,zt+=256/(jt-1);return Xt.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){var _e,Dt=this.filterManager.effectElements;this.feFuncRComposed&&(kt||Dt[3].p._mdf||Dt[4].p._mdf||Dt[5].p._mdf||Dt[6].p._mdf||Dt[7].p._mdf)&&(_e=this.getTableValue(Dt[3].p.v,Dt[4].p.v,Dt[5].p.v,Dt[6].p.v,Dt[7].p.v),this.feFuncRComposed.setAttribute("tableValues",_e),this.feFuncGComposed.setAttribute("tableValues",_e),this.feFuncBComposed.setAttribute("tableValues",_e)),this.feFuncR&&(kt||Dt[10].p._mdf||Dt[11].p._mdf||Dt[12].p._mdf||Dt[13].p._mdf||Dt[14].p._mdf)&&(_e=this.getTableValue(Dt[10].p.v,Dt[11].p.v,Dt[12].p.v,Dt[13].p.v,Dt[14].p.v),this.feFuncR.setAttribute("tableValues",_e)),this.feFuncG&&(kt||Dt[17].p._mdf||Dt[18].p._mdf||Dt[19].p._mdf||Dt[20].p._mdf||Dt[21].p._mdf)&&(_e=this.getTableValue(Dt[17].p.v,Dt[18].p.v,Dt[19].p.v,Dt[20].p.v,Dt[21].p.v),this.feFuncG.setAttribute("tableValues",_e)),this.feFuncB&&(kt||Dt[24].p._mdf||Dt[25].p._mdf||Dt[26].p._mdf||Dt[27].p._mdf||Dt[28].p._mdf)&&(_e=this.getTableValue(Dt[24].p.v,Dt[25].p.v,Dt[26].p.v,Dt[27].p.v,Dt[28].p.v),this.feFuncB.setAttribute("tableValues",_e)),this.feFuncA&&(kt||Dt[31].p._mdf||Dt[32].p._mdf||Dt[33].p._mdf||Dt[34].p._mdf||Dt[35].p._mdf)&&(_e=this.getTableValue(Dt[31].p.v,Dt[32].p.v,Dt[33].p.v,Dt[34].p.v,Dt[35].p.v),this.feFuncA.setAttribute("tableValues",_e))}};function SVGDropShadowEffect(kt,_e,Dt,Vt,Gt){var zt=_e.container.globalData.renderConfig.filterSize,jt=_e.data.fs||zt;kt.setAttribute("x",jt.x||zt.x),kt.setAttribute("y",jt.y||zt.y),kt.setAttribute("width",jt.width||zt.width),kt.setAttribute("height",jt.height||zt.height),this.filterManager=_e;var Ht=createNS("feGaussianBlur");Ht.setAttribute("in","SourceAlpha"),Ht.setAttribute("result",Vt+"_drop_shadow_1"),Ht.setAttribute("stdDeviation","0"),this.feGaussianBlur=Ht,kt.appendChild(Ht);var Wt=createNS("feOffset");Wt.setAttribute("dx","25"),Wt.setAttribute("dy","0"),Wt.setAttribute("in",Vt+"_drop_shadow_1"),Wt.setAttribute("result",Vt+"_drop_shadow_2"),this.feOffset=Wt,kt.appendChild(Wt);var qt=createNS("feFlood");qt.setAttribute("flood-color","#00ff00"),qt.setAttribute("flood-opacity","1"),qt.setAttribute("result",Vt+"_drop_shadow_3"),this.feFlood=qt,kt.appendChild(qt);var Xt=createNS("feComposite");Xt.setAttribute("in",Vt+"_drop_shadow_3"),Xt.setAttribute("in2",Vt+"_drop_shadow_2"),Xt.setAttribute("operator","in"),Xt.setAttribute("result",Vt+"_drop_shadow_4"),kt.appendChild(Xt);var Kt=this.createMergeNode(Vt,[Vt+"_drop_shadow_4",Gt]);kt.appendChild(Kt)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){if((kt||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),kt||this.filterManager.effectElements[0].p._mdf){var _e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(_e[0]*255),Math.round(_e[1]*255),Math.round(_e[2]*255)))}if((kt||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),kt||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var Dt=this.filterManager.effectElements[3].p.v,Vt=(this.filterManager.effectElements[2].p.v-90)*degToRads,Gt=Dt*Math.cos(Vt),zt=Dt*Math.sin(Vt);this.feOffset.setAttribute("dx",Gt),this.feOffset.setAttribute("dy",zt)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(kt,_e,Dt){this.initialized=!1,this.filterManager=_e,this.filterElem=kt,this.elem=Dt,Dt.matteElement=createNS("g"),Dt.matteElement.appendChild(Dt.layerElement),Dt.matteElement.appendChild(Dt.transformedElement),Dt.baseElement=Dt.matteElement}SVGMatte3Effect.prototype.findSymbol=function(kt){for(var _e=0,Dt=_svgMatteSymbols.length;_e<Dt;){if(_svgMatteSymbols[_e]===kt)return _svgMatteSymbols[_e];_e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(kt,_e){var Dt=kt.layerElement.parentNode;if(Dt){for(var Vt=Dt.children,Gt=0,zt=Vt.length;Gt<zt&&Vt[Gt]!==kt.layerElement;)Gt+=1;var jt;Gt<=zt-2&&(jt=Vt[Gt+1]);var Ht=createNS("use");Ht.setAttribute("href","#"+_e),jt?Dt.insertBefore(Ht,jt):Dt.appendChild(Ht)}},SVGMatte3Effect.prototype.setElementAsMask=function(kt,_e){if(!this.findSymbol(_e)){var Dt=createElementID(),Vt=createNS("mask");Vt.setAttribute("id",_e.layerId),Vt.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(_e);var Gt=kt.globalData.defs;Gt.appendChild(Vt);var zt=createNS("symbol");zt.setAttribute("id",Dt),this.replaceInParent(_e,Dt),zt.appendChild(_e.layerElement),Gt.appendChild(zt);var jt=createNS("use");jt.setAttribute("href","#"+Dt),Vt.appendChild(jt),_e.data.hd=!1,_e.show()}kt.setMatte(_e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var kt=this.filterManager.effectElements[0].p.v,_e=this.elem.comp.elements,Dt=0,Vt=_e.length;Dt<Vt;)_e[Dt]&&_e[Dt].data.ind===kt&&this.setElementAsMask(this.elem,_e[Dt]),Dt+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()};function SVGGaussianBlurEffect(kt,_e,Dt,Vt){kt.setAttribute("x","-100%"),kt.setAttribute("y","-100%"),kt.setAttribute("width","300%"),kt.setAttribute("height","300%"),this.filterManager=_e;var Gt=createNS("feGaussianBlur");Gt.setAttribute("result",Vt),kt.appendChild(Gt),this.feGaussianBlur=Gt}SVGGaussianBlurEffect.prototype.renderFrame=function(kt){if(kt||this.filterManager._mdf){var _e=.3,Dt=this.filterManager.effectElements[0].p.v*_e,Vt=this.filterManager.effectElements[1].p.v,Gt=Vt==3?0:Dt,zt=Vt==2?0:Dt;this.feGaussianBlur.setAttribute("stdDeviation",Gt+" "+zt);var jt=this.filterManager.effectElements[2].p.v==1?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",jt)}};function TransformEffect(){}TransformEffect.prototype.init=function(kt){this.effectsManager=kt,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(kt){if(this._opMdf=!1,this._mdf=!1,kt||this.effectsManager._mdf){var _e=this.effectsManager.effectElements,Dt=_e[0].p.v,Vt=_e[1].p.v,Gt=_e[2].p.v===1,zt=_e[3].p.v,jt=Gt?zt:_e[4].p.v,Ht=_e[5].p.v,Wt=_e[6].p.v,qt=_e[7].p.v;this.matrix.reset(),this.matrix.translate(-Dt[0],-Dt[1],Dt[2]),this.matrix.scale(jt*.01,zt*.01,1),this.matrix.rotate(-qt*degToRads),this.matrix.skewFromAxis(-Ht*degToRads,(Wt+90)*degToRads),this.matrix.translate(Vt[0],Vt[1],0),this._mdf=!0,this.opacity!==_e[8].p.v&&(this.opacity=_e[8].p.v,this._opMdf=!0)}};function SVGTransformEffect(kt,_e){this.init(_e)}extendPrototype([TransformEffect],SVGTransformEffect);function CVTransformEffect(kt){this.init(kt)}return extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie})})(lottie$1,lottie$1.exports);var lottieExports=lottie$1.exports;const lottie=getDefaultExportFromCjs(lottieExports);function _iterableToArrayLimit(kt,_e){var Dt=kt==null?null:typeof Symbol<"u"&&kt[Symbol.iterator]||kt["@@iterator"];if(Dt!=null){var Vt,Gt,zt,jt,Ht=[],Wt=!0,qt=!1;try{if(zt=(Dt=Dt.call(kt)).next,_e===0){if(Object(Dt)!==Dt)return;Wt=!1}else for(;!(Wt=(Vt=zt.call(Dt)).done)&&(Ht.push(Vt.value),Ht.length!==_e);Wt=!0);}catch(Xt){qt=!0,Gt=Xt}finally{try{if(!Wt&&Dt.return!=null&&(jt=Dt.return(),Object(jt)!==jt))return}finally{if(qt)throw Gt}}return Ht}}function ownKeys$1(kt,_e){var Dt=Object.keys(kt);if(Object.getOwnPropertySymbols){var Vt=Object.getOwnPropertySymbols(kt);_e&&(Vt=Vt.filter(function(Gt){return Object.getOwnPropertyDescriptor(kt,Gt).enumerable})),Dt.push.apply(Dt,Vt)}return Dt}function _objectSpread2$1(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e]!=null?arguments[_e]:{};_e%2?ownKeys$1(Object(Dt),!0).forEach(function(Vt){_defineProperty$1(kt,Vt,Dt[Vt])}):Object.getOwnPropertyDescriptors?Object.defineProperties(kt,Object.getOwnPropertyDescriptors(Dt)):ownKeys$1(Object(Dt)).forEach(function(Vt){Object.defineProperty(kt,Vt,Object.getOwnPropertyDescriptor(Dt,Vt))})}return kt}function _defineProperty$1(kt,_e,Dt){return _e=_toPropertyKey$1(_e),_e in kt?Object.defineProperty(kt,_e,{value:Dt,enumerable:!0,configurable:!0,writable:!0}):kt[_e]=Dt,kt}function _objectWithoutPropertiesLoose$1(kt,_e){if(kt==null)return{};var Dt={},Vt=Object.keys(kt),Gt,zt;for(zt=0;zt<Vt.length;zt++)Gt=Vt[zt],!(_e.indexOf(Gt)>=0)&&(Dt[Gt]=kt[Gt]);return Dt}function _objectWithoutProperties$1(kt,_e){if(kt==null)return{};var Dt=_objectWithoutPropertiesLoose$1(kt,_e),Vt,Gt;if(Object.getOwnPropertySymbols){var zt=Object.getOwnPropertySymbols(kt);for(Gt=0;Gt<zt.length;Gt++)Vt=zt[Gt],!(_e.indexOf(Vt)>=0)&&Object.prototype.propertyIsEnumerable.call(kt,Vt)&&(Dt[Vt]=kt[Vt])}return Dt}function _slicedToArray(kt,_e){return _arrayWithHoles(kt)||_iterableToArrayLimit(kt,_e)||_unsupportedIterableToArray(kt,_e)||_nonIterableRest()}function _arrayWithHoles(kt){if(Array.isArray(kt))return kt}function _unsupportedIterableToArray(kt,_e){if(kt){if(typeof kt=="string")return _arrayLikeToArray(kt,_e);var Dt=Object.prototype.toString.call(kt).slice(8,-1);if(Dt==="Object"&&kt.constructor&&(Dt=kt.constructor.name),Dt==="Map"||Dt==="Set")return Array.from(kt);if(Dt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Dt))return _arrayLikeToArray(kt,_e)}}function _arrayLikeToArray(kt,_e){(_e==null||_e>kt.length)&&(_e=kt.length);for(var Dt=0,Vt=new Array(_e);Dt<_e;Dt++)Vt[Dt]=kt[Dt];return Vt}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3950
3950
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _toPrimitive$1(kt,_e){if(typeof kt!="object"||kt===null)return kt;var Dt=kt[Symbol.toPrimitive];if(Dt!==void 0){var Vt=Dt.call(kt,_e||"default");if(typeof Vt!="object")return Vt;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_e==="string"?String:Number)(kt)}function _toPropertyKey$1(kt){var _e=_toPrimitive$1(kt,"string");return typeof _e=="symbol"?_e:String(_e)}var _excluded$1=["animationData","loop","autoplay","initialSegment","onComplete","onLoopComplete","onEnterFrame","onSegmentStart","onConfigReady","onDataReady","onDataFailed","onLoadedImages","onDOMLoaded","onDestroy","lottieRef","renderer","name","assetsPath","rendererSettings"],useLottie=function kt(_e,Dt){var Vt=_e.animationData,Gt=_e.loop,zt=_e.autoplay,jt=_e.initialSegment,Ht=_e.onComplete,Wt=_e.onLoopComplete,qt=_e.onEnterFrame,Xt=_e.onSegmentStart,Kt=_e.onConfigReady,Yt=_e.onDataReady,Zt=_e.onDataFailed,Jt=_e.onLoadedImages,nn=_e.onDOMLoaded,rn=_e.onDestroy;_e.lottieRef,_e.renderer,_e.name,_e.assetsPath,_e.rendererSettings;var Qt=_objectWithoutProperties$1(_e,_excluded$1),en=reactExports.useState(!1),tn=_slicedToArray(en,2),sn=tn[0],cn=tn[1],un=reactExports.useRef(),hn=reactExports.useRef(null),dn=function(){var Rn;(Rn=un.current)===null||Rn===void 0||Rn.play()},pn=function(){var Rn;(Rn=un.current)===null||Rn===void 0||Rn.stop()},fn=function(){var Rn;(Rn=un.current)===null||Rn===void 0||Rn.pause()},mn=function(Rn){var Dn;(Dn=un.current)===null||Dn===void 0||Dn.setSpeed(Rn)},vn=function(Rn,Dn){var kn;(kn=un.current)===null||kn===void 0||kn.goToAndPlay(Rn,Dn)},_n=function(Rn,Dn){var kn;(kn=un.current)===null||kn===void 0||kn.goToAndStop(Rn,Dn)},En=function(Rn){var Dn;(Dn=un.current)===null||Dn===void 0||Dn.setDirection(Rn)},An=function(Rn,Dn){var kn;(kn=un.current)===null||kn===void 0||kn.playSegments(Rn,Dn)},Tn=function(Rn){var Dn;(Dn=un.current)===null||Dn===void 0||Dn.setSubframe(Rn)},Cn=function(Rn){var Dn;return(Dn=un.current)===null||Dn===void 0?void 0:Dn.getDuration(Rn)},yn=function(){var Rn;(Rn=un.current)===null||Rn===void 0||Rn.destroy(),un.current=void 0},Sn=function(){var Rn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Dn;if(hn.current){(Dn=un.current)===null||Dn===void 0||Dn.destroy();var kn=_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({},_e),Rn),{},{container:hn.current});return un.current=lottie.loadAnimation(kn),cn(!!un.current),function(){var Fn;(Fn=un.current)===null||Fn===void 0||Fn.destroy(),un.current=void 0}}};reactExports.useEffect(function(){var xn=Sn();return function(){return xn?.()}},[Vt,Gt]),reactExports.useEffect(function(){un.current&&(un.current.autoplay=!!zt)},[zt]),reactExports.useEffect(function(){if(un.current){if(!jt){un.current.resetSegments(!0);return}!Array.isArray(jt)||!jt.length||((un.current.currentRawFrame<jt[0]||un.current.currentRawFrame>jt[1])&&(un.current.currentRawFrame=jt[0]),un.current.setSegment(jt[0],jt[1]))}},[jt]),reactExports.useEffect(function(){var xn=[{name:"complete",handler:Ht},{name:"loopComplete",handler:Wt},{name:"enterFrame",handler:qt},{name:"segmentStart",handler:Xt},{name:"config_ready",handler:Kt},{name:"data_ready",handler:Yt},{name:"data_failed",handler:Zt},{name:"loaded_images",handler:Jt},{name:"DOMLoaded",handler:nn},{name:"destroy",handler:rn}],Rn=xn.filter(function(kn){return kn.handler!=null});if(Rn.length){var Dn=Rn.map(function(kn){var Fn;return(Fn=un.current)===null||Fn===void 0||Fn.addEventListener(kn.name,kn.handler),function(){var Pn;(Pn=un.current)===null||Pn===void 0||Pn.removeEventListener(kn.name,kn.handler)}});return function(){Dn.forEach(function(kn){return kn()})}}},[Ht,Wt,qt,Xt,Kt,Yt,Zt,Jt,nn,rn]);var wn=React.createElement("div",_objectSpread2$1({style:Dt,ref:hn},Qt));return{View:wn,play:dn,stop:pn,pause:fn,setSpeed:mn,goToAndStop:_n,goToAndPlay:vn,setDirection:En,playSegments:An,setSubframe:Tn,getDuration:Cn,destroy:yn,animationContainerRef:hn,animationLoaded:sn,animationItem:un.current}};function getContainerVisibility(kt){var _e=kt.getBoundingClientRect(),Dt=_e.top,Vt=_e.height,Gt=window.innerHeight-Dt,zt=window.innerHeight+Vt;return Gt/zt}function getContainerCursorPosition(kt,_e,Dt){var Vt=kt.getBoundingClientRect(),Gt=Vt.top,zt=Vt.left,jt=Vt.width,Ht=Vt.height,Wt=(_e-zt)/jt,qt=(Dt-Gt)/Ht;return{x:Wt,y:qt}}var useInitInteractivity=function kt(_e){var Dt=_e.wrapperRef,Vt=_e.animationItem,Gt=_e.mode,zt=_e.actions;reactExports.useEffect(function(){var jt=Dt.current;if(!(!jt||!Vt||!zt.length)){Vt.stop();var Ht=function(){var Xt=null,Kt=function(){var Zt=getContainerVisibility(jt),Jt=zt.find(function(rn){var Qt=rn.visibility;return Qt&&Zt>=Qt[0]&&Zt<=Qt[1]});if(Jt){if(Jt.type==="seek"&&Jt.visibility&&Jt.frames.length===2){var nn=Jt.frames[0]+Math.ceil((Zt-Jt.visibility[0])/(Jt.visibility[1]-Jt.visibility[0])*Jt.frames[1]);//! goToAndStop must be relative to the start of the current segment
3951
- Vt.goToAndStop(nn-Vt.firstFrame-1,!0)}Jt.type==="loop"&&(Xt===null||Xt!==Jt.frames||Vt.isPaused)&&(Vt.playSegments(Jt.frames,!0),Xt=Jt.frames),Jt.type==="play"&&Vt.isPaused&&(Vt.resetSegments(!0),Vt.play()),Jt.type==="stop"&&Vt.goToAndStop(Jt.frames[0]-Vt.firstFrame-1,!0)}};return document.addEventListener("scroll",Kt),function(){document.removeEventListener("scroll",Kt)}},Wt=function(){var Xt=function(Jt,nn){var rn=Jt,Qt=nn;if(rn!==-1&&Qt!==-1){var en=getContainerCursorPosition(jt,rn,Qt);rn=en.x,Qt=en.y}var tn=zt.find(function(un){var hn=un.position;return hn&&Array.isArray(hn.x)&&Array.isArray(hn.y)?rn>=hn.x[0]&&rn<=hn.x[1]&&Qt>=hn.y[0]&&Qt<=hn.y[1]:hn&&!Number.isNaN(hn.x)&&!Number.isNaN(hn.y)?rn===hn.x&&Qt===hn.y:!1});if(tn){if(tn.type==="seek"&&tn.position&&Array.isArray(tn.position.x)&&Array.isArray(tn.position.y)&&tn.frames.length===2){var sn=(rn-tn.position.x[0])/(tn.position.x[1]-tn.position.x[0]),cn=(Qt-tn.position.y[0])/(tn.position.y[1]-tn.position.y[0]);Vt.playSegments(tn.frames,!0),Vt.goToAndStop(Math.ceil((sn+cn)/2*(tn.frames[1]-tn.frames[0])),!0)}tn.type==="loop"&&Vt.playSegments(tn.frames,!0),tn.type==="play"&&(Vt.isPaused&&Vt.resetSegments(!1),Vt.playSegments(tn.frames)),tn.type==="stop"&&Vt.goToAndStop(tn.frames[0],!0)}},Kt=function(Jt){Xt(Jt.clientX,Jt.clientY)},Yt=function(){Xt(-1,-1)};return jt.addEventListener("mousemove",Kt),jt.addEventListener("mouseout",Yt),function(){jt.removeEventListener("mousemove",Kt),jt.removeEventListener("mouseout",Yt)}};switch(Gt){case"scroll":return Ht();case"cursor":return Wt()}}},[Gt,Vt])},useLottieInteractivity=function kt(_e){var Dt=_e.actions,Vt=_e.mode,Gt=_e.lottieObj,zt=Gt.animationItem,jt=Gt.View,Ht=Gt.animationContainerRef;return useInitInteractivity({actions:Dt,animationItem:zt,mode:Vt,wrapperRef:Ht}),jt},_excluded$2=["style","interactivity"],Lottie=function kt(_e){var Dt,Vt,Gt,zt=_e.style,jt=_e.interactivity,Ht=_objectWithoutProperties$1(_e,_excluded$2),Wt=useLottie(Ht,zt),qt=Wt.View,Xt=Wt.play,Kt=Wt.stop,Yt=Wt.pause,Zt=Wt.setSpeed,Jt=Wt.goToAndStop,nn=Wt.goToAndPlay,rn=Wt.setDirection,Qt=Wt.playSegments,en=Wt.setSubframe,tn=Wt.getDuration,sn=Wt.destroy,cn=Wt.animationContainerRef,un=Wt.animationLoaded,hn=Wt.animationItem;return reactExports.useEffect(function(){_e.lottieRef&&(_e.lottieRef.current={play:Xt,stop:Kt,pause:Yt,setSpeed:Zt,goToAndPlay:nn,goToAndStop:Jt,setDirection:rn,playSegments:Qt,setSubframe:en,getDuration:tn,destroy:sn,animationContainerRef:cn,animationLoaded:un,animationItem:hn})},[(Dt=_e.lottieRef)===null||Dt===void 0?void 0:Dt.current]),useLottieInteractivity({lottieObj:{View:qt,play:Xt,stop:Kt,pause:Yt,setSpeed:Zt,goToAndStop:Jt,goToAndPlay:nn,setDirection:rn,playSegments:Qt,setSubframe:en,getDuration:tn,destroy:sn,animationContainerRef:cn,animationLoaded:un,animationItem:hn},actions:(Vt=jt?.actions)!==null&&Vt!==void 0?Vt:[],mode:(Gt=jt?.mode)!==null&&Gt!==void 0?Gt:"scroll"})};const InstructionModal=reactExports.forwardRef((kt,_e)=>{const Dt=kt.stores.uiSceneStore(en=>en.CORE_API),[Vt,Gt]=reactExports.useState(0),[zt,jt]=reactExports.useState(!1),[Ht,Wt]=reactExports.useState(null),[qt,Xt]=reactExports.useState("Instruction step header here."),[Kt,Yt]=reactExports.useState("Instruction step description here."),Zt=reactExports.useCallback(()=>{const en=Dt.sceneSettings.instructionsSettings;!en||en.length<=0||(_e.current?(Gt(0),jt(!0),_e.current.show()):LOGGER.warn("Instructions modal not initialized"))},[Gt,Ht,Dt,_e]);addCoreEventListener(kt.stores,Dt.EVENTS.UI.Instructions_Show,Zt);const Jt=async en=>{try{const tn=await fetch(resolveAssetUrl(en));if(!tn.ok)throw new Error("Network response was not ok");const sn=await tn.json();setTimeout(()=>{Wt(sn)},Vt===0?800:0)}catch(tn){LOGGER.error("Error fetching JSON data:",tn)}};reactExports.useEffect(()=>{Wt(null);const en=Dt.sceneSettings.instructionsSettings;if(!en||en.length<=0)return;const tn=en[Vt];Jt(tn.lottieURL),Xt(tn.header),Yt(tn.description)},[Vt]),reactExports.useEffect(()=>{_e.current&&kt.showOnStartup&&(localStorage.getItem("instructionsDisplayed-"+Dt.projectId)||Dt.showInstructions())},[_e,kt]);const nn=reactExports.useCallback(()=>{const en=Dt.sceneSettings.instructionsSettings.length,tn=((Vt+1/en)*100).toFixed(2);Dt.sendInstructionsAnalyticsCompletionRate(tn)},[Dt,Vt]),rn=()=>{nn(),localStorage.setItem("instructionsDisplayed-"+Dt.projectId,"true")},Qt=reactExports.useCallback(()=>{nn(),Vt<Dt.sceneSettings.instructionsSettings.length-1?Gt(Vt+1):(localStorage.setItem("instructionsDisplayed-"+Dt.projectId,"true"),jt(!1),_e.current.hide())},[Dt,Vt,_e]);return jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:zt,onExit:rn,ref:_e,className:"instructionsModalFSModal",children:jsxRuntimeExports.jsxs("div",{className:"ins-panel",children:[Ht?jsxRuntimeExports.jsx(Lottie,{className:"lottie-anim-ins",animationData:Ht,loop:!0,autoplay:!0}):jsxRuntimeExports.jsx("div",{className:"lottie-anim-loader",children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",style:{margin:"auto",background:"none",display:"block",shapeRendering:"auto"},width:"50px",height:"50px",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",children:jsxRuntimeExports.jsx("path",{d:"M10 50A40 40 0 0 0 90 50A40 42 0 0 1 10 50",fill:"#000000",stroke:"none",children:jsxRuntimeExports.jsx("animateTransform",{attributeName:"transform",type:"rotate",dur:"1s",repeatCount:"indefinite",keyTimes:"0;1",values:"0 50 51;360 50 51"})})})}),jsxRuntimeExports.jsxs("div",{className:"ins-instructions",children:[jsxRuntimeExports.jsx("p",{className:"ins-header",children:qt}),jsxRuntimeExports.jsx("p",{className:"ins-description",children:Kt}),jsxRuntimeExports.jsx("button",{role:"button","aria-label":"Next Button","aria-hidden":!zt,tabIndex:zt?0:-1,onClick:Qt,className:"ins-nextButton",children:Vt<Dt.sceneSettings.instructionsSettings.length-1?"Next":"Close"})]})]})})}),OverlayUIManager$1=({stores:kt,configuratorWcRef:_e,coreRef:Dt,viewInYourSpaceRef:Vt,disableUI:Gt})=>{const zt=kt.uiSceneStore(Ln=>Ln.setSideMenuState),jt=kt.uiSceneStore(Ln=>Ln.sideMenuState),Ht=kt.uiSceneStore(Ln=>Ln.sideMenuOpen),Wt=kt.uiSceneStore(Ln=>Ln.setSideMenuOpen),[qt,Xt]=reactExports.useState(!1),[Kt,Yt]=reactExports.useState(!1),Zt=kt.infoStore(Ln=>Ln.infoModalOpen),Jt=kt.infoStore(Ln=>Ln.updateInfoModalOpen);reactExports.useState(!1);const[nn,rn]=reactExports.useState(!1),[Qt,en]=reactExports.useState("Link not generated!"),[tn,sn]=reactExports.useState(!1),[cn,un]=reactExports.useState(!1),hn=kt.uiSceneStore(Ln=>Ln.loadConfigId),dn=kt.uiSceneStore(Ln=>Ln.loadConfigModalOpen),pn=kt.uiSceneStore(Ln=>Ln.setLoadConfigModalOpen),fn=kt.uiSceneStore(Ln=>Ln.removeModalOpen),mn=kt.uiSceneStore(Ln=>Ln.setRemoveModalOpen),vn=kt.uiSceneStore(Ln=>Ln.moveModalOpen),_n=kt.uiSceneStore(Ln=>Ln.setMoveModalOpen),En=kt.uiSceneStore(Ln=>Ln.outOfStockModalOpen),An=kt.uiSceneStore(Ln=>Ln.setOutOfStockModalOpen),Tn=reactExports.useRef(null),Cn=reactExports.useRef(null),yn=reactExports.useRef(null),Sn=reactExports.useRef(null),[wn,xn]=reactExports.useState({}),[Rn,Dn]=reactExports.useState({}),[kn,Fn]=reactExports.useState(!1),[Pn,Bn]=reactExports.useState(""),[qn,tr]=reactExports.useState(""),[lr,zn]=reactExports.useState(""),ur=kt.productDataStore(Ln=>Ln.productData),Hn=kt.cartStore(Ln=>Ln.cart),sr=kt.cartStore(Ln=>Ln.previewCartModalOpen),vr=kt.cartStore(Ln=>Ln.togglePreviewCartModal),[fr,Un]=reactExports.useState(!1),[In,jn]=reactExports.useState(!1),[or,cr]=reactExports.useState(!0),ar=kt.uiHotspotStore(Ln=>Ln),gr=kt.uiSceneStore(Ln=>Ln.CORE_API),[mr,Ar]=reactExports.useState(!1),[Lr,Cr]=reactExports.useState(!0),[Rr,zr]=reactExports.useState(!1),[Pr,Fr]=reactExports.useState(gr.sceneSettings.showSaveButton),[os,rs]=reactExports.useState(gr.sceneSettings.showContextMenu),Qr=kt.uiSceneStore(Ln=>Ln.viewInYourSpaceMenuBtnVisible),[cs,fs]=reactExports.useState(gr.sceneSettings.showResetBtn),Br=reactExports.useRef(null),[rr,Dr]=reactExports.useState(gr.sceneSettings.showInstructionsBtn),[_r,Gr]=reactExports.useState(gr.sceneSettings.showInstructionsOnStartup),[Yr,Es]=reactExports.useState(gr.sceneSettings.showDimensionBtn),[gs,Ts]=reactExports.useState(gr.sceneSettings.showHotspotsBtn),[Ps,bs]=reactExports.useState(gr.sceneSettings.currency);reactExports.useEffect(()=>(cr(gr.areHotspotsVisible()),()=>{}),[jt]);const Vs=reactExports.useCallback(()=>{cr(!gr.areHotspotsVisible()),gr.areHotspotsVisible()?gr.hideAllHotspots():gr.showAllHotspots()},[]),Gs=reactExports.useCallback(()=>{gr.sendShowInstructionsBtnAnalyticsEvent(),gr.showInstructions()},[gr]),to=reactExports.useCallback(()=>{Ar(!gr.areDimensionsVisible()),gr.areDimensionsVisible()?gr.hideDimensions():gr.showDimensions()},[]);function Fo(){un(!0)}const Bo=reactExports.useCallback(()=>{jn(!0),rn(!0),gr.shareScene().then(Ln=>{en(Ln),jn(!1),gr.alert({alertMsg:"Configuration saved successfully!",alertTime:4e3,alertType:"success",alertLabel:"Success",alertId:"configurationSaved"})}).catch(Ln=>{jn(!1),gr.alert({alertMsg:"Error saving this configuration!",alertTime:5e3,alertType:"error",alertLabel:"Unsaved Changes",persistant:!0})})},[]);reactExports.useEffect(()=>{Cn.current&&Cn.current.appendChild(Dt.current)},[Cn]),reactExports.useEffect(()=>{yn.current&&yn.current.appendChild(Vt.current)},[yn]),addCoreEventListener(kt,gr.EVENTS.SCENE.Hotspot_Enter,Ln=>{LOGGER.info({title:gr.getActiveHotspot()}),Dn(gr.getActiveHotspot().hotspotData),Yt(!0);const{hotspotAbsID:$n}=Ln;ar.actions.enterHotspotInFeaturesTab($n)}),addCoreEventListener(kt,gr.EVENTS.SCENE.Hotspot_Exit,Ln=>{ar.actions.exitHotspot()}),addCoreEventListener(kt,gr.EVENTS.SCENE.MaterialOverrides_Exists,Ln=>{kt.uiSceneStore.setState({materialOverrideExists:Ln})}),addCoreEventListener(kt,gr.EVENTS.UI.UtilityMenu_Hide,Ln=>{Cr(!1)}),addCoreEventListener(kt,gr.EVENTS.UI.UtilityMenu_Show,Ln=>{Cr(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ShareButton_Hide,Ln=>{zr(!1)}),addCoreEventListener(kt,gr.EVENTS.UI.ShareButton_Show,Ln=>{zr(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ContextMenu_Show,Ln=>{xn(Ln?.primary.data),Un(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ContextMenu_Hide,Ln=>{LOGGER.info({title:"Context Menu Closed"}),Un(!1)}),addCoreEventListener(kt,gr.EVENTS.SCENE.ItemRemoveModalTriggered,Ln=>{mn(!0);let $n=`Deleting this item will remove it from your build, as well as any item attached to it. Below is a list of all items that will be removed:
3951
+ Vt.goToAndStop(nn-Vt.firstFrame-1,!0)}Jt.type==="loop"&&(Xt===null||Xt!==Jt.frames||Vt.isPaused)&&(Vt.playSegments(Jt.frames,!0),Xt=Jt.frames),Jt.type==="play"&&Vt.isPaused&&(Vt.resetSegments(!0),Vt.play()),Jt.type==="stop"&&Vt.goToAndStop(Jt.frames[0]-Vt.firstFrame-1,!0)}};return document.addEventListener("scroll",Kt),function(){document.removeEventListener("scroll",Kt)}},Wt=function(){var Xt=function(Jt,nn){var rn=Jt,Qt=nn;if(rn!==-1&&Qt!==-1){var en=getContainerCursorPosition(jt,rn,Qt);rn=en.x,Qt=en.y}var tn=zt.find(function(un){var hn=un.position;return hn&&Array.isArray(hn.x)&&Array.isArray(hn.y)?rn>=hn.x[0]&&rn<=hn.x[1]&&Qt>=hn.y[0]&&Qt<=hn.y[1]:hn&&!Number.isNaN(hn.x)&&!Number.isNaN(hn.y)?rn===hn.x&&Qt===hn.y:!1});if(tn){if(tn.type==="seek"&&tn.position&&Array.isArray(tn.position.x)&&Array.isArray(tn.position.y)&&tn.frames.length===2){var sn=(rn-tn.position.x[0])/(tn.position.x[1]-tn.position.x[0]),cn=(Qt-tn.position.y[0])/(tn.position.y[1]-tn.position.y[0]);Vt.playSegments(tn.frames,!0),Vt.goToAndStop(Math.ceil((sn+cn)/2*(tn.frames[1]-tn.frames[0])),!0)}tn.type==="loop"&&Vt.playSegments(tn.frames,!0),tn.type==="play"&&(Vt.isPaused&&Vt.resetSegments(!1),Vt.playSegments(tn.frames)),tn.type==="stop"&&Vt.goToAndStop(tn.frames[0],!0)}},Kt=function(Jt){Xt(Jt.clientX,Jt.clientY)},Yt=function(){Xt(-1,-1)};return jt.addEventListener("mousemove",Kt),jt.addEventListener("mouseout",Yt),function(){jt.removeEventListener("mousemove",Kt),jt.removeEventListener("mouseout",Yt)}};switch(Gt){case"scroll":return Ht();case"cursor":return Wt()}}},[Gt,Vt])},useLottieInteractivity=function kt(_e){var Dt=_e.actions,Vt=_e.mode,Gt=_e.lottieObj,zt=Gt.animationItem,jt=Gt.View,Ht=Gt.animationContainerRef;return useInitInteractivity({actions:Dt,animationItem:zt,mode:Vt,wrapperRef:Ht}),jt},_excluded$2=["style","interactivity"],Lottie=function kt(_e){var Dt,Vt,Gt,zt=_e.style,jt=_e.interactivity,Ht=_objectWithoutProperties$1(_e,_excluded$2),Wt=useLottie(Ht,zt),qt=Wt.View,Xt=Wt.play,Kt=Wt.stop,Yt=Wt.pause,Zt=Wt.setSpeed,Jt=Wt.goToAndStop,nn=Wt.goToAndPlay,rn=Wt.setDirection,Qt=Wt.playSegments,en=Wt.setSubframe,tn=Wt.getDuration,sn=Wt.destroy,cn=Wt.animationContainerRef,un=Wt.animationLoaded,hn=Wt.animationItem;return reactExports.useEffect(function(){_e.lottieRef&&(_e.lottieRef.current={play:Xt,stop:Kt,pause:Yt,setSpeed:Zt,goToAndPlay:nn,goToAndStop:Jt,setDirection:rn,playSegments:Qt,setSubframe:en,getDuration:tn,destroy:sn,animationContainerRef:cn,animationLoaded:un,animationItem:hn})},[(Dt=_e.lottieRef)===null||Dt===void 0?void 0:Dt.current]),useLottieInteractivity({lottieObj:{View:qt,play:Xt,stop:Kt,pause:Yt,setSpeed:Zt,goToAndStop:Jt,goToAndPlay:nn,setDirection:rn,playSegments:Qt,setSubframe:en,getDuration:tn,destroy:sn,animationContainerRef:cn,animationLoaded:un,animationItem:hn},actions:(Vt=jt?.actions)!==null&&Vt!==void 0?Vt:[],mode:(Gt=jt?.mode)!==null&&Gt!==void 0?Gt:"scroll"})};const InstructionModal=reactExports.forwardRef((kt,_e)=>{const Dt=kt.stores.uiSceneStore(en=>en.CORE_API),[Vt,Gt]=reactExports.useState(0),[zt,jt]=reactExports.useState(!1),[Ht,Wt]=reactExports.useState(null),[qt,Xt]=reactExports.useState("Instruction step header here."),[Kt,Yt]=reactExports.useState("Instruction step description here."),Zt=reactExports.useCallback(()=>{const en=Dt.sceneSettings.instructionsSettings;!en||en.length<=0||(_e.current?(Gt(0),jt(!0),_e.current.show()):LOGGER$1.warn("Instructions modal not initialized"))},[Gt,Ht,Dt,_e]);addCoreEventListener(kt.stores,Dt.EVENTS.UI.Instructions_Show,Zt);const Jt=async en=>{try{const tn=await fetch(resolveAssetUrl(en));if(!tn.ok)throw new Error("Network response was not ok");const sn=await tn.json();setTimeout(()=>{Wt(sn)},Vt===0?800:0)}catch(tn){LOGGER$1.error("Error fetching JSON data:",tn)}};reactExports.useEffect(()=>{Wt(null);const en=Dt.sceneSettings.instructionsSettings;if(!en||en.length<=0)return;const tn=en[Vt];Jt(tn.lottieURL),Xt(tn.header),Yt(tn.description)},[Vt]),reactExports.useEffect(()=>{_e.current&&kt.showOnStartup&&(localStorage.getItem("instructionsDisplayed-"+Dt.projectId)||Dt.showInstructions())},[_e,kt]);const nn=reactExports.useCallback(()=>{const en=Dt.sceneSettings.instructionsSettings.length,tn=((Vt+1/en)*100).toFixed(2);Dt.sendInstructionsAnalyticsCompletionRate(tn)},[Dt,Vt]),rn=()=>{nn(),localStorage.setItem("instructionsDisplayed-"+Dt.projectId,"true")},Qt=reactExports.useCallback(()=>{nn(),Vt<Dt.sceneSettings.instructionsSettings.length-1?Gt(Vt+1):(localStorage.setItem("instructionsDisplayed-"+Dt.projectId,"true"),jt(!1),_e.current.hide())},[Dt,Vt,_e]);return jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:zt,onExit:rn,ref:_e,className:"instructionsModalFSModal",children:jsxRuntimeExports.jsxs("div",{className:"ins-panel",children:[Ht?jsxRuntimeExports.jsx(Lottie,{className:"lottie-anim-ins",animationData:Ht,loop:!0,autoplay:!0}):jsxRuntimeExports.jsx("div",{className:"lottie-anim-loader",children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",style:{margin:"auto",background:"none",display:"block",shapeRendering:"auto"},width:"50px",height:"50px",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",children:jsxRuntimeExports.jsx("path",{d:"M10 50A40 40 0 0 0 90 50A40 42 0 0 1 10 50",fill:"#000000",stroke:"none",children:jsxRuntimeExports.jsx("animateTransform",{attributeName:"transform",type:"rotate",dur:"1s",repeatCount:"indefinite",keyTimes:"0;1",values:"0 50 51;360 50 51"})})})}),jsxRuntimeExports.jsxs("div",{className:"ins-instructions",children:[jsxRuntimeExports.jsx("p",{className:"ins-header",children:qt}),jsxRuntimeExports.jsx("p",{className:"ins-description",children:Kt}),jsxRuntimeExports.jsx("button",{role:"button","aria-label":"Next Button","aria-hidden":!zt,tabIndex:zt?0:-1,onClick:Qt,className:"ins-nextButton",children:Vt<Dt.sceneSettings.instructionsSettings.length-1?"Next":"Close"})]})]})})}),OverlayUIManager$1=({stores:kt,configuratorWcRef:_e,coreRef:Dt,viewInYourSpaceRef:Vt,disableUI:Gt})=>{const zt=kt.uiSceneStore(Ln=>Ln.setSideMenuState),jt=kt.uiSceneStore(Ln=>Ln.sideMenuState),Ht=kt.uiSceneStore(Ln=>Ln.sideMenuOpen),Wt=kt.uiSceneStore(Ln=>Ln.setSideMenuOpen),[qt,Xt]=reactExports.useState(!1),[Kt,Yt]=reactExports.useState(!1),Zt=kt.infoStore(Ln=>Ln.infoModalOpen),Jt=kt.infoStore(Ln=>Ln.updateInfoModalOpen);reactExports.useState(!1);const[nn,rn]=reactExports.useState(!1),[Qt,en]=reactExports.useState("Link not generated!"),[tn,sn]=reactExports.useState(!1),[cn,un]=reactExports.useState(!1),hn=kt.uiSceneStore(Ln=>Ln.loadConfigId),dn=kt.uiSceneStore(Ln=>Ln.loadConfigModalOpen),pn=kt.uiSceneStore(Ln=>Ln.setLoadConfigModalOpen),fn=kt.uiSceneStore(Ln=>Ln.removeModalOpen),mn=kt.uiSceneStore(Ln=>Ln.setRemoveModalOpen),vn=kt.uiSceneStore(Ln=>Ln.moveModalOpen),_n=kt.uiSceneStore(Ln=>Ln.setMoveModalOpen),En=kt.uiSceneStore(Ln=>Ln.outOfStockModalOpen),An=kt.uiSceneStore(Ln=>Ln.setOutOfStockModalOpen),Tn=reactExports.useRef(null),Cn=reactExports.useRef(null),yn=reactExports.useRef(null),Sn=reactExports.useRef(null),[wn,xn]=reactExports.useState({}),[Rn,Dn]=reactExports.useState({}),[kn,Fn]=reactExports.useState(!1),[Pn,Bn]=reactExports.useState(""),[qn,tr]=reactExports.useState(""),[lr,zn]=reactExports.useState(""),ur=kt.productDataStore(Ln=>Ln.productData),Hn=kt.cartStore(Ln=>Ln.cart),sr=kt.cartStore(Ln=>Ln.previewCartModalOpen),vr=kt.cartStore(Ln=>Ln.togglePreviewCartModal),[fr,Un]=reactExports.useState(!1),[In,jn]=reactExports.useState(!1),[or,cr]=reactExports.useState(!0),ar=kt.uiHotspotStore(Ln=>Ln),gr=kt.uiSceneStore(Ln=>Ln.CORE_API),[mr,Ar]=reactExports.useState(!1),[Lr,Cr]=reactExports.useState(!0),[Rr,zr]=reactExports.useState(!1),[Pr,Fr]=reactExports.useState(gr.sceneSettings.showSaveButton),[os,rs]=reactExports.useState(gr.sceneSettings.showContextMenu),Qr=kt.uiSceneStore(Ln=>Ln.viewInYourSpaceMenuBtnVisible),[cs,fs]=reactExports.useState(gr.sceneSettings.showResetBtn),Br=reactExports.useRef(null),[rr,Dr]=reactExports.useState(gr.sceneSettings.showInstructionsBtn),[_r,Gr]=reactExports.useState(gr.sceneSettings.showInstructionsOnStartup),[Yr,Es]=reactExports.useState(gr.sceneSettings.showDimensionBtn),[gs,Ts]=reactExports.useState(gr.sceneSettings.showHotspotsBtn),[Ps,bs]=reactExports.useState(gr.sceneSettings.currency);reactExports.useEffect(()=>(cr(gr.areHotspotsVisible()),()=>{}),[jt]);const Vs=reactExports.useCallback(()=>{cr(!gr.areHotspotsVisible()),gr.areHotspotsVisible()?gr.hideAllHotspots():gr.showAllHotspots()},[]),Gs=reactExports.useCallback(()=>{gr.sendShowInstructionsBtnAnalyticsEvent(),gr.showInstructions()},[gr]),to=reactExports.useCallback(()=>{Ar(!gr.areDimensionsVisible()),gr.areDimensionsVisible()?gr.hideDimensions():gr.showDimensions()},[]);function Fo(){un(!0)}const Bo=reactExports.useCallback(()=>{jn(!0),rn(!0),gr.shareScene().then(Ln=>{en(Ln),jn(!1),gr.alert({alertMsg:"Configuration saved successfully!",alertTime:4e3,alertType:"success",alertLabel:"Success",alertId:"configurationSaved"})}).catch(Ln=>{jn(!1),gr.alert({alertMsg:"Error saving this configuration!",alertTime:5e3,alertType:"error",alertLabel:"Unsaved Changes",persistant:!0})})},[]);reactExports.useEffect(()=>{Cn.current&&Cn.current.appendChild(Dt.current)},[Cn]),reactExports.useEffect(()=>{yn.current&&yn.current.appendChild(Vt.current)},[yn]),addCoreEventListener(kt,gr.EVENTS.SCENE.Hotspot_Enter,Ln=>{LOGGER$1.info({title:gr.getActiveHotspot()}),Dn(gr.getActiveHotspot().hotspotData),Yt(!0);const{hotspotAbsID:$n}=Ln;ar.actions.enterHotspotInFeaturesTab($n)}),addCoreEventListener(kt,gr.EVENTS.SCENE.Hotspot_Exit,Ln=>{ar.actions.exitHotspot()}),addCoreEventListener(kt,gr.EVENTS.SCENE.MaterialOverrides_Exists,Ln=>{kt.uiSceneStore.setState({materialOverrideExists:Ln})}),addCoreEventListener(kt,gr.EVENTS.UI.UtilityMenu_Hide,Ln=>{Cr(!1)}),addCoreEventListener(kt,gr.EVENTS.UI.UtilityMenu_Show,Ln=>{Cr(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ShareButton_Hide,Ln=>{zr(!1)}),addCoreEventListener(kt,gr.EVENTS.UI.ShareButton_Show,Ln=>{zr(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ContextMenu_Show,Ln=>{xn(Ln?.primary.data),Un(!0)}),addCoreEventListener(kt,gr.EVENTS.UI.ContextMenu_Hide,Ln=>{LOGGER$1.info({title:"Context Menu Closed"}),Un(!1)}),addCoreEventListener(kt,gr.EVENTS.SCENE.ItemRemoveModalTriggered,Ln=>{mn(!0);let $n=`Deleting this item will remove it from your build, as well as any item attached to it. Below is a list of all items that will be removed:
3952
3952
  `;const On={};Object.keys(Ln).forEach(Gn=>{const{skuID:Wn,name:er,gltfURL:ir,ignoreInCart:pr}=Ln[Gn].itemData;!ir||pr===!0||(On[Wn]={count:(On[Wn]?.count||0)+1,name:er||Wn})}),Object.keys(On).forEach(Gn=>{$n+=`
3953
3953
  • ${On[Gn].name} (qty ${On[Gn].count})`}),tr($n)}),addCoreEventListener(kt,gr.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,Ln=>{_n(!0);let $n="";const On={};Object.keys(Ln).forEach(Gn=>{const{skuID:Wn,name:er}=Ln[Gn].itemData;Ln[Gn].itemData.gltfURL&&(On[Wn]={count:(On[Wn]?.count||0)+1,name:er||Wn})}),$n+=Object.keys(On).length==1?`Moving this item will remove some of the attached items from your build. Below is the item that will be removed:
3954
3954
  `:`Moving this item will remove some of the attached items from your build. Below is a list of all items that will be removed:
@@ -4243,7 +4243,7 @@ void main() {
4243
4243
  *
4244
4244
  * This source code is licensed under the MIT license found in the
4245
4245
  * LICENSE file in the root directory of this source tree.
4246
- */var h$1=reactExports,n=shimExports;function p$1(kt,_e){return kt===_e&&(kt!==0||1/kt===1/_e)||kt!==kt&&_e!==_e}var q$2=typeof Object.is=="function"?Object.is:p$1,r=n.useSyncExternalStore,t=h$1.useRef,u$1=h$1.useEffect,v=h$1.useMemo,w$1=h$1.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(kt,_e,Dt,Vt,Gt){var zt=t(null);if(zt.current===null){var jt={hasValue:!1,value:null};zt.current=jt}else jt=zt.current;zt=v(function(){function Wt(Zt){if(!qt){if(qt=!0,Xt=Zt,Zt=Vt(Zt),Gt!==void 0&&jt.hasValue){var Jt=jt.value;if(Gt(Jt,Zt))return Kt=Jt}return Kt=Zt}if(Jt=Kt,q$2(Xt,Zt))return Jt;var nn=Vt(Zt);return Gt!==void 0&&Gt(Jt,nn)?Jt:(Xt=Zt,Kt=nn)}var qt=!1,Xt,Kt,Yt=Dt===void 0?null:Dt;return[function(){return Wt(_e())},Yt===null?void 0:function(){return Wt(Yt())}]},[_e,Dt,Vt,Gt]);var Ht=r(kt,zt[0],zt[1]);return u$1(function(){jt.hasValue=!0,jt.value=Ht},[Ht]),w$1(Ht),Ht};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;let didWarnAboutEqualityFn=!1;function useStore(kt,_e=kt.getState,Dt){const Vt=useSyncExternalStoreWithSelector(kt.subscribe,kt.getState,kt.getServerState||kt.getState,_e,Dt);return reactExports.useDebugValue(Vt),Vt}const createImpl=kt=>{const _e=typeof kt=="function"?createStore(kt):kt,Dt=(Vt,Gt)=>useStore(_e,Vt,Gt);return Object.assign(Dt,_e),Dt},create=kt=>kt?createImpl(kt):createImpl,LightManager=({stores:kt})=>{const[_e,Dt]=reactExports.useState(!1),Vt=kt.productDataStore(Ht=>Ht),Gt=kt.lightStore(Ht=>Ht),[zt,jt]=reactExports.useState(1);return reactExports.useEffect(()=>{const Ht=Vt.assetsData,Wt=Ht?.sceneMoodSettings?.envMap;Wt&&(kt.lightStore.setState({defaultEnvMapUrl:Wt}),Gt.actions.setEnvLightMap(Wt)),Gt.envMapUrl===""&&Gt.actions.setEnvLightMap(kt.lightStore.getState().defaultEnvMapUrl);const qt=Ht?.sceneMoodSettings?.ambientLightIntensity;qt!==void 0&&jt(qt),Dt(!0)},[]),reactExports.useEffect(()=>{_e!==!1&&(LOGGER.groupCollapsed("SCENE LIGHTING INFO:"),LOGGER.table({title:"Scene Lights",details:{"Environment Map":Gt.envMapUrl,"Ambient Light Intensity":zt}}),LOGGER.groupEnd())},[_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e===!0&&jsxRuntimeExports.jsxs("group",{name:"GRP_LIGHTS",children:[jsxRuntimeExports.jsx("ambientLight",{intensity:zt}),jsxRuntimeExports.jsx(Environment,{background:!1,files:kt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(Gt.envMapUrl)})]})})},ColliderGeo=({itemKey:kt,stores:_e})=>{const Dt=reactExports.useRef(null),Vt=_e.itemStore(Gt=>Gt);return reactExports.useEffect(()=>{if(Dt.current)return Vt.collidersRef.push(Dt),Vt.actions.setCollidersRef([...Vt.collidersRef]),()=>{const Gt=Vt.collidersRef.indexOf(Dt);Gt>-1&&Vt.collidersRef.splice(Gt,1),Vt.actions.setCollidersRef([...Vt.collidersRef])}},[Dt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:(kt.itemData.hasOwnProperty("disableCollider")?!kt.itemData.disableCollider:!_e.coreSceneStore.getState().sceneSettings.disableCollider)&&jsxRuntimeExports.jsx("group",{name:"GRP_LoadingPlaceholder",children:jsxRuntimeExports.jsx("group",{position:kt.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxRuntimeExports.jsx(Box,{ref:Dt,scale:Vec3ToArr(kt.itemData.boundingBoxSize),visible:!1})})})})},ProxyGeo=({stores:kt,proxyScene:_e,proxyOnly:Dt,scale:Vt,itemKey:Gt})=>{const[zt,jt]=reactExports.useState(!Dt),Ht=reactExports.useRef(null),Wt=reactExports.useMemo(()=>_e.clone(),[_e]);return reactExports.useEffect(()=>()=>{dispose3(Wt)},[Wt]),reactExports.useEffect(()=>{if(Dt){if(kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Gt.itemData.guid)==null)return;kt.attachmentStore.getState().actions.updateFittingSkuIds(),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Gt.itemData.skuID),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Added,{...Gt,visualizedInScene:!1})}else{const qt=Xt=>{Gt.itemData.skuID===Xt.data&&jt(!1)};kt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,qt,{once:!0})}},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("group",{name:"GRP_ProxyMesh",onClick:()=>{kt.coreSceneStore.getState().CORE_API.closeContextMenu()},children:jsxRuntimeExports.jsx("primitive",{ref:Ht,name:"proxyGeometry",autoFocusEnabled:!Dt,object:Wt,scale:Vt,visible:zt&&!Dt,wireframe:zt&&!Dt,children:zt&&!Dt&&jsxRuntimeExports.jsx(Html,{center:!0,distanceFactor:Gt.itemData.boundingBoxSize.x*4>1?1:Gt.itemData.boundingBoxSize.x*4,position:Gt.itemData.boundingSphereCenter,zIndexRange:[29,0],children:jsxRuntimeExports.jsx("img",{alt:"Loading...",draggable:"false",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg"})})})})})},ensureUniqueNames=kt=>{const _e=[],Dt=new Set;for(const Vt of kt){let Gt=Vt,zt=0;for(;Dt.has(Gt);)Gt=Vt+"."+ ++zt;Dt.add(Gt),_e.push(Gt)}return _e},mappingsArrayToTable=(kt,_e)=>{const Dt={};for(const Vt of kt.mappings)for(const Gt of Vt.variants)Dt[_e[Gt]]={material:null,gltfMaterialIndex:Vt.material};return Dt},compatibleObject=kt=>kt.material!==void 0&&kt.userData&&kt.userData.variantMaterials,traversePair=(kt,_e,Dt)=>{Dt(kt,_e);for(let Vt=0;Vt<kt.children.length;Vt++)traversePair(kt.children[Vt],_e.children[Vt],Dt)},copyVariantMaterials=(kt,_e)=>{_e.userData.variantMaterials!==void 0&&(kt.userData.variantMaterials=Object.assign({},_e.userData.variantMaterials)),_e.userData.originalMaterial!==void 0&&(kt.userData.originalMaterial=_e.userData.originalMaterial)};class GLTFMaterialsVariantsExtension{constructor(_e){this.parser=_e,this.name="KHR_materials_variants"}afterRoot(_e){const Dt=this.parser,Vt=Dt.json;if(!Vt.extensions||!Vt.extensions[this.name])return null;const zt=Vt.extensions[this.name].variants||[],jt=ensureUniqueNames(zt.map(qt=>qt.name));for(const qt of _e.scenes)qt.traverse(Xt=>{const Kt=Dt.associations.get(Xt);if(!Kt||Kt.meshes===void 0||Kt.primitives===void 0)return;const Jt=Vt.meshes[Kt.meshes].primitives[Kt.primitives].extensions;!Jt||!Jt[this.name]||(Xt.userData.variantMaterials=mappingsArrayToTable(Jt[this.name],jt))});_e.userData.variants=jt,_e.functions=_e.functions||{};const Ht=async(qt,Xt,Kt)=>{qt.userData.originalMaterial||(qt.userData.originalMaterial=qt.material);const Yt=qt.material;let Zt=null;if(Xt===null||!qt.userData.variantMaterials[Xt])qt.material=qt.userData.originalMaterial,Dt.associations.has(qt.material)&&(Zt=Dt.associations.get(qt.material).index);else{const Jt=qt.userData.variantMaterials[Xt];Jt.material?(qt.material=Jt.material,Jt.gltfMaterialIndex!==void 0&&(Zt=Jt.gltfMaterialIndex)):(Zt=Jt.gltfMaterialIndex,qt.material=await Dt.getDependency("material",Zt),Dt.assignFinalMaterial(qt),Jt.material=qt.material)}Kt!==null&&Kt(qt,Yt,Zt)},Wt=qt=>{const Xt=qt.material,Kt=qt.userData.variantMaterials,Yt=[];for(const Zt in Kt){const Jt=Kt[Zt];if(Jt.material)continue;const nn=Jt.gltfMaterialIndex;Yt.push(Dt.getDependency("material",nn).then(rn=>{qt.material=rn,Dt.assignFinalMaterial(qt),Kt[Zt].material=qt.material}))}return Promise.all(Yt).then(()=>{qt.material=Xt})};_e.functions.selectVariant=(qt,Xt,Kt=!0,Yt=null)=>{const Zt=[];return Kt?qt.traverse(Jt=>compatibleObject(Jt)&&Zt.push(Ht(Jt,Xt,Yt))):compatibleObject(qt)&&Zt.push(Ht(qt,Xt,Yt)),Promise.all(Zt)},_e.functions.ensureLoadVariants=(qt,Xt=!0)=>{const Kt=[];return Xt?qt.traverse(Yt=>compatibleObject(Yt)&&Kt.push(Wt(Yt))):compatibleObject(qt)&&Kt.push(Wt(qt)),Promise.all(Kt)},_e.functions.copyVariantMaterials=(qt,Xt,Kt=!0)=>{Kt?traversePair(qt,Xt,(Yt,Zt)=>copyVariantMaterials(Yt,Zt)):copyVariantMaterials(qt,Xt)}}}function Draggable({stores:kt,children:_e,guid:Dt,onDragStartHandler:Vt,onDragEndHandler:Gt,onItemClickHandler:zt,onPointerEnter:jt,onPointerLeave:Ht,dragging:Wt=!1,intersectingGhostObject:qt=null,isInteractive:Xt=!0,initialIntersectedGhostUUID:Kt=null,isSnapAllowed:Yt=!1,...Zt}){const Jt=reactExports.useRef(),nn=reactExports.useRef(-1),rn=reactExports.useRef([]),Qt=reactExports.useRef([]),{raycaster:en,size:tn,camera:sn}=useThree(),cn=kt.hotspotStore(xn=>xn.isAnyHotspotActive),un=kt.coreSceneStore(xn=>xn.multipleTouchDetected),[hn,dn]=reactExports.useState(null),{raycasterGhost:pn}=reactExports.useMemo(()=>({raycasterGhost:new Raycaster})),fn=xn=>{let Rn;return xn.isGhost===!0?Rn=xn:xn.parent?xn.parent.isGhost===!0?Rn=xn.parent:Rn=fn(xn.parent):Rn=null,Rn},mn=xn=>{pn.layers.enable(GHOST_LAYER),pn.setFromCamera(xn,sn);const Rn=pn.intersectObject(kt.ghostStore.getState().ghostParentRef);let Dn=null;return Rn.length>0&&(Dn=fn(Rn[0].object)),Dn},vn=xn=>{let Rn=xn.whichNodesAreAttachedToUs();return Rn.map(Dn=>{vn(Dn).map(Fn=>{Rn.push(Fn)})}),Rn},{initialMouse2D:_n,mouse2D:En,mouse3D:An,offset:Tn,normal:Cn,plane:yn,pointerDownPos:Sn}=reactExports.useMemo(()=>({initialMouse2D:new Vector2,mouse2D:new Vector2,mouse3D:new Vector3,offset:new Vector3,normal:new Vector3,plane:new Plane,pointerDownPos:new Vector2}),[]);reactExports.useEffect(()=>{let xn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);dn(xn)},[]);const wn=useGesture({onPointerEnter:xn=>{un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu||kt.coreSceneStore.getState().itemDraggedSkuID||kt.coreSceneStore.getState().cameraActive!==!0&&!kt.coreSceneStore.getState().dragging&&!cn&&(hn&&!hn.isEndNode?kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.POINTER):kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),jt(xn.event))},onPointerLeave:xn=>{un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu||kt.coreSceneStore.getState().itemDraggedSkuID||kt.coreSceneStore.getState().cameraActive!==!0&&!kt.coreSceneStore.getState().dragging&&!cn&&(kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),Ht(xn.event))},onClick:xn=>{if(xn.event.stopPropagation(),!un){if(kt.coreSceneStore.getState().builderMode){const{eventObject:Rn,point:Dn}=xn.event;Rn.getWorldPosition(Tn).sub(Dn),An.copy(Dn);const kn=xn.event.offsetX,Fn=xn.event.offsetY,Pn=kn/tn.width*2-1,Bn=-Fn/tn.height*2+1;En.set(Pn,Bn);const qn=new Raycaster;qn.setFromCamera(En,sn);const tr=qn.intersectObject(kt.coreSceneStore.getState().sceneRef.getObjectByName("proxyGeometry"));tr.length>0&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.CONFIGURATION.OnClickItem,{point:tr[0].point,camera:qn.camera})}if(!kt.coreSceneStore.getState().sceneSettings.disableContextMenu)if(!xn.dragging&&!cn){const Rn=Math.abs(xn.event.x-Sn.x),Dn=kt.coreSceneStore.getState().sceneSettings.dragThreshold;if(Rn>Dn)return;zt(xn.event.offsetX,xn.event.offsetY,Dt)}else kt.hotspotStore.getState().actions.exitHotspot(!0)}},onDrag:async xn=>{if(kt.coreSceneStore.getState().simulateDragEnd===!0||kt.coreSceneStore.getState().dragging&&kt.coreSceneStore.getState().draggingItemGUID!==hn.guid||kt.coreSceneStore.getState().sceneSettings.disableDragDrop)return;const Rn=xn.event;if(Rn.stopPropagation(),cn){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}if(kt.itemStore.getState().selectedItemData){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}if(Object.keys(kt.itemStore.getState().itemsSpawned).length<2){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}const kn=xn.event.offsetX,Fn=xn.event.offsetY;if(!kt.coreSceneStore.getState().dragging){const{dragThreshold:tr,dragTimeout:lr}=kt.coreSceneStore.getState().sceneSettings,zn=kt.coreSceneStore.getState().lastDragEndTime;if(Date.now()-zn<lr||(kt.itemStore.setState({busyDraggingItem:!0}),Math.abs(Rn.x-Sn.x)<=tr))return;if(hn&&!hn.canDrag){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}const vr=hn.whichPlugAreWeAttachedUsing().attachedPlug.guid;let fr=hn.swapRoot();fr||(fr={rootDetachedPlugs:hn.detachNodeFromReceiver()}),rn.current=vn(hn),Qt.current=[],rn.current.map(ar=>{Qt.current.push(ar.guid),hn.ref.attach(ar.ref),hn.dragging=!0,ar.dragging=!0}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.MOVE);const In=kt.productDataStore.getState().productData[hn.skuID].lookDetails[hn.currentVariant].thumbnails.low;kt.coreSceneStore.setState({dragging:!0,draggingItemGUID:hn.guid,pointerDownPos:xn.event.clientX,mouseDragging:!1,mouseDownImgSrc:kt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(In),mouseDownSkuID:hn.skuID,moveThreshold:0}),Yt=!1,qt=null,Kt=null,nn.current=-1;const jn=kn/tn.width*2-1,or=-Fn/tn.height*2+1;_n.set(jn,or);const cr=await Vt({guid:Dt,node:hn,detachedData:fr,attachedChildrenGuids:Qt.current});if(!cr||cr.length<=0||cr.transforms===void 0)return;cr.transforms.map((ar,gr)=>{ar.receiverPlugGUID===vr&&(nn.current=gr)})}const Pn=kn/tn.width*2-1,Bn=-Fn/tn.height*2+1;En.set(Pn,Bn),en.setFromCamera(En,sn),sn.getWorldDirection(Cn).negate(),yn.setFromNormalAndCoplanarPoint(Cn,An),en.ray.intersectPlane(yn,An),hn.ref.visible=!1;const qn=kt.ghostStore.getState().ghostParentRef;if(qn.children.length>0){qt=mn(En),Kt===null&&nn.current!==-1&&nn.current<qn.children.length&&qn.children[nn.current]!==void 0&&(Kt=qn.children[nn.current].children[0].uuid);const tr=kt.coreSceneStore.getState().hoveredGhostIndex;qt?tr!==qt.index&&kt.coreSceneStore.setState({hoveredGhostIndex:qt.index}):tr!==-1&&kt.coreSceneStore.setState({hoveredGhostIndex:-1}),hn.ref.position.copy(An).add(Tn)}if(Pn>1||Pn<-1||Bn<-1||Bn>1){kt.itemStore.setState({busyDraggingItem:!1}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB);const tr=kt.coreSceneStore.getState().dragImgElRef;tr.style.opacity=0,hn.ref.visible=!0,kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,simulateDragEnd:!0,dragging:!1,draggingItemGUID:null,hoveredGhostIndex:-1,lastDragEndTime:currentTime}),Gt({node:hn,intersectingGhostObject:qt,attachedChildrenGuids:Qt.current,attachedNodesToCurrentNode:rn.current});const lr=kt.attachmentStore.getState().attachmentSystem.currentStructure.nodes;kt.dynamicHookStore.getState().hookOnSceneItemsUpdated(lr,kt.coreSceneStore.getState().CORE_API)}},onDragStart:({event:xn})=>{if(kt.coreSceneStore.setState({simulateDragEnd:!1}),un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;xn.stopPropagation(),kt.cameraStore.getState().actions.canCameraRotate(!1);const{eventObject:Rn,point:Dn}=xn;Rn.getWorldPosition(Tn).sub(Dn),An.copy(Dn),Sn.set(xn.x,xn.y)},onDragEnd:({event:xn})=>{if(kt.coreSceneStore.setState({simulateDragEnd:!1}),kt.coreSceneStore.getState().dragging&&kt.coreSceneStore.getState().draggingItemGUID!==hn.guid||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;xn.stopPropagation(),kt.cameraStore.getState().actions.canCameraRotate(!0);const Rn=kt.coreSceneStore.getState().dragImgElRef;Rn.style.opacity=0,hn.ref.visible=!0,kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,dragging:!1,hoveredGhostIndex:-1,draggingItemGUID:null,lastDragEndTime:Date.now()}),kt.itemStore.setState({busyDraggingItem:!1}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),Gt({node:hn,intersectingGhostObject:qt,attachedChildrenGuids:Qt.current,attachedNodesToCurrentNode:rn.current});const Dn=kt.attachmentStore.getState().attachmentSystem.currentStructure.nodes;kt.dynamicHookStore.getState().hookOnSceneItemsUpdated(Dn,kt.coreSceneStore.getState().CORE_API)}});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xt?jsxRuntimeExports.jsx("group",{ref:Jt,...wn(),...Zt,children:_e}):jsxRuntimeExports.jsx("group",{ref:Jt,...Zt,children:_e})})}const selectionContext=reactExports.createContext(null);function Selection$1({children:kt,enabled:_e=!0}){const[Dt,Vt]=reactExports.useState([]),Gt=reactExports.useMemo(()=>({selected:Dt,select:Vt,enabled:_e}),[Dt,Vt,_e]);return jsxRuntimeExports.jsx(selectionContext.Provider,{value:Gt,children:kt})}function Select({enabled:kt=!1,children:_e,...Dt}){const Vt=reactExports.useRef(null),Gt=reactExports.useContext(selectionContext);return reactExports.useEffect(()=>{if(Gt&&kt){let zt=!1;const jt=[];if(Vt.current.traverse(Ht=>{Ht.type==="Mesh"&&jt.push(Ht),Gt.selected.indexOf(Ht)===-1&&(zt=!0)}),zt)return Gt.select(Ht=>[...Ht,...jt]),()=>{Gt.select(Ht=>Ht.filter(Wt=>!jt.includes(Wt)))}}},[kt,_e,Gt]),jsxRuntimeExports.jsx("group",{ref:Vt,...Dt,children:_e})}/**
4246
+ */var h$1=reactExports,n=shimExports;function p$1(kt,_e){return kt===_e&&(kt!==0||1/kt===1/_e)||kt!==kt&&_e!==_e}var q$2=typeof Object.is=="function"?Object.is:p$1,r=n.useSyncExternalStore,t=h$1.useRef,u$1=h$1.useEffect,v=h$1.useMemo,w$1=h$1.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(kt,_e,Dt,Vt,Gt){var zt=t(null);if(zt.current===null){var jt={hasValue:!1,value:null};zt.current=jt}else jt=zt.current;zt=v(function(){function Wt(Zt){if(!qt){if(qt=!0,Xt=Zt,Zt=Vt(Zt),Gt!==void 0&&jt.hasValue){var Jt=jt.value;if(Gt(Jt,Zt))return Kt=Jt}return Kt=Zt}if(Jt=Kt,q$2(Xt,Zt))return Jt;var nn=Vt(Zt);return Gt!==void 0&&Gt(Jt,nn)?Jt:(Xt=Zt,Kt=nn)}var qt=!1,Xt,Kt,Yt=Dt===void 0?null:Dt;return[function(){return Wt(_e())},Yt===null?void 0:function(){return Wt(Yt())}]},[_e,Dt,Vt,Gt]);var Ht=r(kt,zt[0],zt[1]);return u$1(function(){jt.hasValue=!0,jt.value=Ht},[Ht]),w$1(Ht),Ht};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;let didWarnAboutEqualityFn=!1;function useStore(kt,_e=kt.getState,Dt){const Vt=useSyncExternalStoreWithSelector(kt.subscribe,kt.getState,kt.getServerState||kt.getState,_e,Dt);return reactExports.useDebugValue(Vt),Vt}const createImpl=kt=>{const _e=typeof kt=="function"?createStore(kt):kt,Dt=(Vt,Gt)=>useStore(_e,Vt,Gt);return Object.assign(Dt,_e),Dt},create=kt=>kt?createImpl(kt):createImpl,LightManager=({stores:kt})=>{const[_e,Dt]=reactExports.useState(!1),Vt=kt.productDataStore(Ht=>Ht),Gt=kt.lightStore(Ht=>Ht),[zt,jt]=reactExports.useState(1);return reactExports.useEffect(()=>{const Ht=Vt.assetsData,Wt=Ht?.sceneMoodSettings?.envMap;Wt&&(kt.lightStore.setState({defaultEnvMapUrl:Wt}),Gt.actions.setEnvLightMap(Wt)),Gt.envMapUrl===""&&Gt.actions.setEnvLightMap(kt.lightStore.getState().defaultEnvMapUrl);const qt=Ht?.sceneMoodSettings?.ambientLightIntensity;qt!==void 0&&jt(qt),Dt(!0)},[]),reactExports.useEffect(()=>{_e!==!1&&(LOGGER$1.groupCollapsed("SCENE LIGHTING INFO:"),LOGGER$1.table({title:"Scene Lights",details:{"Environment Map":Gt.envMapUrl,"Ambient Light Intensity":zt}}),LOGGER$1.groupEnd())},[_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e===!0&&jsxRuntimeExports.jsxs("group",{name:"GRP_LIGHTS",children:[jsxRuntimeExports.jsx("ambientLight",{intensity:zt}),jsxRuntimeExports.jsx(Environment,{background:!1,files:kt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(Gt.envMapUrl)})]})})},ColliderGeo=({itemKey:kt,stores:_e})=>{const Dt=reactExports.useRef(null),Vt=_e.itemStore(Gt=>Gt);return reactExports.useEffect(()=>{if(Dt.current)return Vt.collidersRef.push(Dt),Vt.actions.setCollidersRef([...Vt.collidersRef]),()=>{const Gt=Vt.collidersRef.indexOf(Dt);Gt>-1&&Vt.collidersRef.splice(Gt,1),Vt.actions.setCollidersRef([...Vt.collidersRef])}},[Dt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:(kt.itemData.hasOwnProperty("disableCollider")?!kt.itemData.disableCollider:!_e.coreSceneStore.getState().sceneSettings.disableCollider)&&jsxRuntimeExports.jsx("group",{name:"GRP_LoadingPlaceholder",children:jsxRuntimeExports.jsx("group",{position:kt.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxRuntimeExports.jsx(Box,{ref:Dt,scale:Vec3ToArr(kt.itemData.boundingBoxSize),visible:!1})})})})},ProxyGeo=({stores:kt,proxyScene:_e,proxyOnly:Dt,scale:Vt,itemKey:Gt})=>{const[zt,jt]=reactExports.useState(!Dt),Ht=reactExports.useRef(null),Wt=reactExports.useMemo(()=>_e.clone(),[_e]);return reactExports.useEffect(()=>()=>{dispose3(Wt)},[Wt]),reactExports.useEffect(()=>{if(Dt){if(kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Gt.itemData.guid)==null)return;kt.attachmentStore.getState().actions.updateFittingSkuIds(),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Gt.itemData.skuID),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Added,{...Gt,visualizedInScene:!1})}else{const qt=Xt=>{Gt.itemData.skuID===Xt.data&&jt(!1)};kt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,qt,{once:!0})}},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("group",{name:"GRP_ProxyMesh",onClick:()=>{kt.coreSceneStore.getState().CORE_API.closeContextMenu()},children:jsxRuntimeExports.jsx("primitive",{ref:Ht,name:"proxyGeometry",autoFocusEnabled:!Dt,object:Wt,scale:Vt,visible:zt&&!Dt,wireframe:zt&&!Dt,children:zt&&!Dt&&jsxRuntimeExports.jsx(Html,{center:!0,distanceFactor:Gt.itemData.boundingBoxSize.x*4>1?1:Gt.itemData.boundingBoxSize.x*4,position:Gt.itemData.boundingSphereCenter,zIndexRange:[29,0],children:jsxRuntimeExports.jsx("img",{alt:"Loading...",draggable:"false",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg"})})})})})},ensureUniqueNames=kt=>{const _e=[],Dt=new Set;for(const Vt of kt){let Gt=Vt,zt=0;for(;Dt.has(Gt);)Gt=Vt+"."+ ++zt;Dt.add(Gt),_e.push(Gt)}return _e},mappingsArrayToTable=(kt,_e)=>{const Dt={};for(const Vt of kt.mappings)for(const Gt of Vt.variants)Dt[_e[Gt]]={material:null,gltfMaterialIndex:Vt.material};return Dt},compatibleObject=kt=>kt.material!==void 0&&kt.userData&&kt.userData.variantMaterials,traversePair=(kt,_e,Dt)=>{Dt(kt,_e);for(let Vt=0;Vt<kt.children.length;Vt++)traversePair(kt.children[Vt],_e.children[Vt],Dt)},copyVariantMaterials=(kt,_e)=>{_e.userData.variantMaterials!==void 0&&(kt.userData.variantMaterials=Object.assign({},_e.userData.variantMaterials)),_e.userData.originalMaterial!==void 0&&(kt.userData.originalMaterial=_e.userData.originalMaterial)};class GLTFMaterialsVariantsExtension{constructor(_e){this.parser=_e,this.name="KHR_materials_variants"}afterRoot(_e){const Dt=this.parser,Vt=Dt.json;if(!Vt.extensions||!Vt.extensions[this.name])return null;const zt=Vt.extensions[this.name].variants||[],jt=ensureUniqueNames(zt.map(qt=>qt.name));for(const qt of _e.scenes)qt.traverse(Xt=>{const Kt=Dt.associations.get(Xt);if(!Kt||Kt.meshes===void 0||Kt.primitives===void 0)return;const Jt=Vt.meshes[Kt.meshes].primitives[Kt.primitives].extensions;!Jt||!Jt[this.name]||(Xt.userData.variantMaterials=mappingsArrayToTable(Jt[this.name],jt))});_e.userData.variants=jt,_e.functions=_e.functions||{};const Ht=async(qt,Xt,Kt)=>{qt.userData.originalMaterial||(qt.userData.originalMaterial=qt.material);const Yt=qt.material;let Zt=null;if(Xt===null||!qt.userData.variantMaterials[Xt])qt.material=qt.userData.originalMaterial,Dt.associations.has(qt.material)&&(Zt=Dt.associations.get(qt.material).index);else{const Jt=qt.userData.variantMaterials[Xt];Jt.material?(qt.material=Jt.material,Jt.gltfMaterialIndex!==void 0&&(Zt=Jt.gltfMaterialIndex)):(Zt=Jt.gltfMaterialIndex,qt.material=await Dt.getDependency("material",Zt),Dt.assignFinalMaterial(qt),Jt.material=qt.material)}Kt!==null&&Kt(qt,Yt,Zt)},Wt=qt=>{const Xt=qt.material,Kt=qt.userData.variantMaterials,Yt=[];for(const Zt in Kt){const Jt=Kt[Zt];if(Jt.material)continue;const nn=Jt.gltfMaterialIndex;Yt.push(Dt.getDependency("material",nn).then(rn=>{qt.material=rn,Dt.assignFinalMaterial(qt),Kt[Zt].material=qt.material}))}return Promise.all(Yt).then(()=>{qt.material=Xt})};_e.functions.selectVariant=(qt,Xt,Kt=!0,Yt=null)=>{const Zt=[];return Kt?qt.traverse(Jt=>compatibleObject(Jt)&&Zt.push(Ht(Jt,Xt,Yt))):compatibleObject(qt)&&Zt.push(Ht(qt,Xt,Yt)),Promise.all(Zt)},_e.functions.ensureLoadVariants=(qt,Xt=!0)=>{const Kt=[];return Xt?qt.traverse(Yt=>compatibleObject(Yt)&&Kt.push(Wt(Yt))):compatibleObject(qt)&&Kt.push(Wt(qt)),Promise.all(Kt)},_e.functions.copyVariantMaterials=(qt,Xt,Kt=!0)=>{Kt?traversePair(qt,Xt,(Yt,Zt)=>copyVariantMaterials(Yt,Zt)):copyVariantMaterials(qt,Xt)}}}function Draggable({stores:kt,children:_e,guid:Dt,onDragStartHandler:Vt,onDragEndHandler:Gt,onItemClickHandler:zt,onPointerEnter:jt,onPointerLeave:Ht,dragging:Wt=!1,intersectingGhostObject:qt=null,isInteractive:Xt=!0,initialIntersectedGhostUUID:Kt=null,isSnapAllowed:Yt=!1,...Zt}){const Jt=reactExports.useRef(),nn=reactExports.useRef(-1),rn=reactExports.useRef([]),Qt=reactExports.useRef([]),{raycaster:en,size:tn,camera:sn}=useThree(),cn=kt.hotspotStore(xn=>xn.isAnyHotspotActive),un=kt.coreSceneStore(xn=>xn.multipleTouchDetected),[hn,dn]=reactExports.useState(null),{raycasterGhost:pn}=reactExports.useMemo(()=>({raycasterGhost:new Raycaster})),fn=xn=>{let Rn;return xn.isGhost===!0?Rn=xn:xn.parent?xn.parent.isGhost===!0?Rn=xn.parent:Rn=fn(xn.parent):Rn=null,Rn},mn=xn=>{pn.layers.enable(GHOST_LAYER),pn.setFromCamera(xn,sn);const Rn=pn.intersectObject(kt.ghostStore.getState().ghostParentRef);let Dn=null;return Rn.length>0&&(Dn=fn(Rn[0].object)),Dn},vn=xn=>{let Rn=xn.whichNodesAreAttachedToUs();return Rn.map(Dn=>{vn(Dn).map(Fn=>{Rn.push(Fn)})}),Rn},{initialMouse2D:_n,mouse2D:En,mouse3D:An,offset:Tn,normal:Cn,plane:yn,pointerDownPos:Sn}=reactExports.useMemo(()=>({initialMouse2D:new Vector2,mouse2D:new Vector2,mouse3D:new Vector3,offset:new Vector3,normal:new Vector3,plane:new Plane,pointerDownPos:new Vector2}),[]);reactExports.useEffect(()=>{let xn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);dn(xn)},[]);const wn=useGesture({onPointerEnter:xn=>{un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu||kt.coreSceneStore.getState().itemDraggedSkuID||kt.coreSceneStore.getState().cameraActive!==!0&&!kt.coreSceneStore.getState().dragging&&!cn&&(hn&&!hn.isEndNode?kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.POINTER):kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),jt(xn.event))},onPointerLeave:xn=>{un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu||kt.coreSceneStore.getState().itemDraggedSkuID||kt.coreSceneStore.getState().cameraActive!==!0&&!kt.coreSceneStore.getState().dragging&&!cn&&(kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),Ht(xn.event))},onClick:xn=>{if(xn.event.stopPropagation(),!un){if(kt.coreSceneStore.getState().builderMode){const{eventObject:Rn,point:Dn}=xn.event;Rn.getWorldPosition(Tn).sub(Dn),An.copy(Dn);const kn=xn.event.offsetX,Fn=xn.event.offsetY,Pn=kn/tn.width*2-1,Bn=-Fn/tn.height*2+1;En.set(Pn,Bn);const qn=new Raycaster;qn.setFromCamera(En,sn);const tr=qn.intersectObject(kt.coreSceneStore.getState().sceneRef.getObjectByName("proxyGeometry"));tr.length>0&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.CONFIGURATION.OnClickItem,{point:tr[0].point,camera:qn.camera})}if(!kt.coreSceneStore.getState().sceneSettings.disableContextMenu)if(!xn.dragging&&!cn){const Rn=Math.abs(xn.event.x-Sn.x),Dn=kt.coreSceneStore.getState().sceneSettings.dragThreshold;if(Rn>Dn)return;zt(xn.event.offsetX,xn.event.offsetY,Dt)}else kt.hotspotStore.getState().actions.exitHotspot(!0)}},onDrag:async xn=>{if(kt.coreSceneStore.getState().simulateDragEnd===!0||kt.coreSceneStore.getState().dragging&&kt.coreSceneStore.getState().draggingItemGUID!==hn.guid||kt.coreSceneStore.getState().sceneSettings.disableDragDrop)return;const Rn=xn.event;if(Rn.stopPropagation(),cn){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}if(kt.itemStore.getState().selectedItemData){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}if(Object.keys(kt.itemStore.getState().itemsSpawned).length<2){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}const kn=xn.event.offsetX,Fn=xn.event.offsetY;if(!kt.coreSceneStore.getState().dragging){const{dragThreshold:tr,dragTimeout:lr}=kt.coreSceneStore.getState().sceneSettings,zn=kt.coreSceneStore.getState().lastDragEndTime;if(Date.now()-zn<lr||(kt.itemStore.setState({busyDraggingItem:!0}),Math.abs(Rn.x-Sn.x)<=tr))return;if(hn&&!hn.canDrag){kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.BLOCKED);return}const vr=hn.whichPlugAreWeAttachedUsing().attachedPlug.guid;let fr=hn.swapRoot();fr||(fr={rootDetachedPlugs:hn.detachNodeFromReceiver()}),rn.current=vn(hn),Qt.current=[],rn.current.map(ar=>{Qt.current.push(ar.guid),hn.ref.attach(ar.ref),hn.dragging=!0,ar.dragging=!0}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.MOVE);const In=kt.productDataStore.getState().productData[hn.skuID].lookDetails[hn.currentVariant].thumbnails.low;kt.coreSceneStore.setState({dragging:!0,draggingItemGUID:hn.guid,pointerDownPos:xn.event.clientX,mouseDragging:!1,mouseDownImgSrc:kt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(In),mouseDownSkuID:hn.skuID,moveThreshold:0}),Yt=!1,qt=null,Kt=null,nn.current=-1;const jn=kn/tn.width*2-1,or=-Fn/tn.height*2+1;_n.set(jn,or);const cr=await Vt({guid:Dt,node:hn,detachedData:fr,attachedChildrenGuids:Qt.current});if(!cr||cr.length<=0||cr.transforms===void 0)return;cr.transforms.map((ar,gr)=>{ar.receiverPlugGUID===vr&&(nn.current=gr)})}const Pn=kn/tn.width*2-1,Bn=-Fn/tn.height*2+1;En.set(Pn,Bn),en.setFromCamera(En,sn),sn.getWorldDirection(Cn).negate(),yn.setFromNormalAndCoplanarPoint(Cn,An),en.ray.intersectPlane(yn,An),hn.ref.visible=!1;const qn=kt.ghostStore.getState().ghostParentRef;if(qn.children.length>0){qt=mn(En),Kt===null&&nn.current!==-1&&nn.current<qn.children.length&&qn.children[nn.current]!==void 0&&(Kt=qn.children[nn.current].children[0].uuid);const tr=kt.coreSceneStore.getState().hoveredGhostIndex;qt?tr!==qt.index&&kt.coreSceneStore.setState({hoveredGhostIndex:qt.index}):tr!==-1&&kt.coreSceneStore.setState({hoveredGhostIndex:-1}),hn.ref.position.copy(An).add(Tn)}if(Pn>1||Pn<-1||Bn<-1||Bn>1){kt.itemStore.setState({busyDraggingItem:!1}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB);const tr=kt.coreSceneStore.getState().dragImgElRef;tr.style.opacity=0,hn.ref.visible=!0,kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,simulateDragEnd:!0,dragging:!1,draggingItemGUID:null,hoveredGhostIndex:-1,lastDragEndTime:currentTime}),Gt({node:hn,intersectingGhostObject:qt,attachedChildrenGuids:Qt.current,attachedNodesToCurrentNode:rn.current});const lr=kt.attachmentStore.getState().attachmentSystem.currentStructure.nodes;kt.dynamicHookStore.getState().hookOnSceneItemsUpdated(lr,kt.coreSceneStore.getState().CORE_API)}},onDragStart:({event:xn})=>{if(kt.coreSceneStore.setState({simulateDragEnd:!1}),un||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;xn.stopPropagation(),kt.cameraStore.getState().actions.canCameraRotate(!1);const{eventObject:Rn,point:Dn}=xn;Rn.getWorldPosition(Tn).sub(Dn),An.copy(Dn),Sn.set(xn.x,xn.y)},onDragEnd:({event:xn})=>{if(kt.coreSceneStore.setState({simulateDragEnd:!1}),kt.coreSceneStore.getState().dragging&&kt.coreSceneStore.getState().draggingItemGUID!==hn.guid||kt.coreSceneStore.getState().sceneSettings.disableDragDrop&&kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;xn.stopPropagation(),kt.cameraStore.getState().actions.canCameraRotate(!0);const Rn=kt.coreSceneStore.getState().dragImgElRef;Rn.style.opacity=0,hn.ref.visible=!0,kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,dragging:!1,hoveredGhostIndex:-1,draggingItemGUID:null,lastDragEndTime:Date.now()}),kt.itemStore.setState({busyDraggingItem:!1}),kt.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),Gt({node:hn,intersectingGhostObject:qt,attachedChildrenGuids:Qt.current,attachedNodesToCurrentNode:rn.current});const Dn=kt.attachmentStore.getState().attachmentSystem.currentStructure.nodes;kt.dynamicHookStore.getState().hookOnSceneItemsUpdated(Dn,kt.coreSceneStore.getState().CORE_API)}});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xt?jsxRuntimeExports.jsx("group",{ref:Jt,...wn(),...Zt,children:_e}):jsxRuntimeExports.jsx("group",{ref:Jt,...Zt,children:_e})})}const selectionContext=reactExports.createContext(null);function Selection$1({children:kt,enabled:_e=!0}){const[Dt,Vt]=reactExports.useState([]),Gt=reactExports.useMemo(()=>({selected:Dt,select:Vt,enabled:_e}),[Dt,Vt,_e]);return jsxRuntimeExports.jsx(selectionContext.Provider,{value:Gt,children:kt})}function Select({enabled:kt=!1,children:_e,...Dt}){const Vt=reactExports.useRef(null),Gt=reactExports.useContext(selectionContext);return reactExports.useEffect(()=>{if(Gt&&kt){let zt=!1;const jt=[];if(Vt.current.traverse(Ht=>{Ht.type==="Mesh"&&jt.push(Ht),Gt.selected.indexOf(Ht)===-1&&(zt=!0)}),zt)return Gt.select(Ht=>[...Ht,...jt]),()=>{Gt.select(Ht=>Ht.filter(Wt=>!jt.includes(Wt)))}}},[kt,_e,Gt]),jsxRuntimeExports.jsx("group",{ref:Vt,...Dt,children:_e})}/**
4247
4247
  * postprocessing v6.36.0 build Thu Jul 25 2024
4248
4248
  * https://github.com/pmndrs/postprocessing
4249
4249
  * Copyright 2015-2024 Raoul van Rüschen
@@ -4458,14 +4458,14 @@ return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
4458
4458
  `+Vt),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,kt.colorSpace===SRGBColorSpace$1&&(Vt+=`color0 = sRGBToLinear(color0);
4459
4459
  `),kt.uvTransformation?(Gt=`vec2 transformedUv = vUv;
4460
4460
  `+Gt,kt.defines.set("UV","transformedUv")):kt.defines.set("UV","vUv"),kt.shaderParts.set(EffectShaderSection.FRAGMENT_HEAD,Dt),kt.shaderParts.set(EffectShaderSection.FRAGMENT_MAIN_IMAGE,Vt),kt.shaderParts.set(EffectShaderSection.FRAGMENT_MAIN_UV,Gt);for(const[jt,Ht]of kt.shaderParts)Ht!==null&&kt.shaderParts.set(jt,Ht.trim().replace(/^#/,`
4461
- #`));this.skipRendering=_e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(kt)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(kt,_e=BasicDepthPacking){this.fullscreenMaterial.depthBuffer=kt,this.fullscreenMaterial.depthPacking=_e;for(const Dt of this.effects)Dt.setDepthTexture(kt,_e)}render(kt,_e,Dt,Vt,Gt){for(const zt of this.effects)zt.update(kt,_e,Vt);if(!this.skipRendering||this.renderToScreen){const zt=this.fullscreenMaterial;zt.inputBuffer=_e.texture,zt.time+=Vt*this.timeScale,kt.setRenderTarget(this.renderToScreen?null:Dt),kt.render(this.scene,this.camera)}}setSize(kt,_e){this.fullscreenMaterial.setSize(kt,_e);for(const Dt of this.effects)Dt.setSize(kt,_e)}initialize(kt,_e,Dt){this.renderer=kt;for(const Vt of this.effects)Vt.initialize(kt,_e,Dt);this.updateMaterial(),Dt!==void 0&&Dt!==UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const kt of this.effects)kt.removeEventListener("change",this.listener),kt.dispose()}handleEvent(kt){switch(kt.type){case"change":this.recompile();break}}},NormalPass=class extends Pass{constructor(kt,_e,{renderTarget:Dt,resolutionScale:Vt=1,width:Gt=Resolution.AUTO_SIZE,height:zt=Resolution.AUTO_SIZE,resolutionX:jt=Gt,resolutionY:Ht=zt}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new RenderPass(kt,_e,new MeshNormalMaterial);const Wt=this.renderPass;Wt.ignoreBackground=!0,Wt.skipShadowMapUpdate=!0;const qt=Wt.getClearPass();qt.overrideClearColor=new Color$1(7829503),qt.overrideClearAlpha=1,this.renderTarget=Dt,this.renderTarget===void 0&&(this.renderTarget=new WebGLRenderTarget(1,1,{minFilter:NearestFilter,magFilter:NearestFilter}),this.renderTarget.texture.name="NormalPass.Target");const Xt=this.resolution=new Resolution(this,jt,Ht,Vt);Xt.addEventListener("change",Kt=>this.setSize(Xt.baseWidth,Xt.baseHeight))}set mainScene(kt){this.renderPass.mainScene=kt}set mainCamera(kt){this.renderPass.mainCamera=kt}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(kt){this.resolution.scale=kt}render(kt,_e,Dt,Vt,Gt){const zt=this.renderToScreen?null:this.renderTarget;this.renderPass.render(kt,zt,zt)}setSize(kt,_e){const Dt=this.resolution;Dt.setBaseSize(kt,_e),this.renderTarget.setSize(Dt.width,Dt.height)}};const EffectComposerContext=reactExports.createContext(null),isConvolution=kt=>(kt.getAttributes()&EffectAttribute.CONVOLUTION)===EffectAttribute.CONVOLUTION,EffectComposer=React.memo(reactExports.forwardRef(({children:kt,camera:_e,scene:Dt,resolutionScale:Vt,enabled:Gt=!0,renderPriority:zt=1,autoClear:jt=!0,depthBuffer:Ht,enableNormalPass:Wt,stencilBuffer:qt,multisampling:Xt=8,frameBufferType:Kt=HalfFloatType},Yt)=>{const{gl:Zt,scene:Jt,camera:nn,size:rn}=useThree(),Qt=Dt||Jt,en=_e||nn,[tn,sn,cn]=reactExports.useMemo(()=>{const pn=isWebGL2Available(),fn=new EffectComposer$1(Zt,{depthBuffer:Ht,stencilBuffer:qt,multisampling:Xt>0&&pn?Xt:0,frameBufferType:Kt});fn.addPass(new RenderPass(Qt,en));let mn=null,vn=null;return Wt&&(vn=new NormalPass(Qt,en),vn.enabled=!1,fn.addPass(vn),Vt!==void 0&&pn&&(mn=new DepthDownsamplingPass({normalBuffer:vn.texture,resolutionScale:Vt}),mn.enabled=!1,fn.addPass(mn))),[fn,vn,mn]},[en,Zt,Ht,qt,Xt,Kt,Qt,Wt,Vt]);reactExports.useEffect(()=>tn?.setSize(rn.width,rn.height),[tn,rn]),useFrame((pn,fn)=>{if(Gt){const mn=Zt.autoClear;Zt.autoClear=jt,qt&&!jt&&Zt.clearStencil(),tn.render(fn),Zt.autoClear=mn}},Gt?zt:0);const un=reactExports.useRef(null),hn=useInstanceHandle(un);reactExports.useLayoutEffect(()=>{const pn=[];if(un.current&&hn.current&&tn){const fn=hn.current.objects;for(let mn=0;mn<fn.length;mn++){const vn=fn[mn];if(vn instanceof Effect){const _n=[vn];if(!isConvolution(vn)){let An=null;for(;(An=fn[mn+1])instanceof Effect&&!isConvolution(An);)_n.push(An),mn++}const En=new EffectPass(en,..._n);pn.push(En)}else vn instanceof Pass&&pn.push(vn)}for(const mn of pn)tn?.addPass(mn);sn&&(sn.enabled=!0),cn&&(cn.enabled=!0)}return()=>{for(const fn of pn)tn?.removePass(fn);sn&&(sn.enabled=!1),cn&&(cn.enabled=!1)}},[tn,kt,en,sn,cn,hn]),reactExports.useEffect(()=>{const pn=Zt.toneMapping;return Zt.toneMapping=NoToneMapping,()=>{Zt.toneMapping=pn}},[]);const dn=reactExports.useMemo(()=>({composer:tn,normalPass:sn,downSamplingPass:cn,resolutionScale:Vt,camera:en,scene:Qt}),[tn,sn,cn,Vt,en,Qt]);return reactExports.useImperativeHandle(Yt,()=>tn,[tn]),jsxRuntimeExports.jsx(EffectComposerContext.Provider,{value:dn,children:jsxRuntimeExports.jsx("group",{ref:un,children:kt})})})),resolveRef=kt=>typeof kt=="object"&&kt!=null&&"current"in kt?kt.current:kt,Outline=reactExports.forwardRef(function kt({selection:_e=[],selectionLayer:Dt=10,blendFunction:Vt,patternTexture:Gt,edgeStrength:zt,pulseSpeed:jt,visibleEdgeColor:Ht,hiddenEdgeColor:Wt,width:qt,height:Xt,kernelSize:Kt,blur:Yt,xRay:Zt,...Jt},nn){const rn=useThree(cn=>cn.invalidate),{scene:Qt,camera:en}=reactExports.useContext(EffectComposerContext),tn=reactExports.useMemo(()=>new OutlineEffect(Qt,en,{blendFunction:Vt,patternTexture:Gt,edgeStrength:zt,pulseSpeed:jt,visibleEdgeColor:Ht,hiddenEdgeColor:Wt,width:qt,height:Xt,kernelSize:Kt,blur:Yt,xRay:Zt,...Jt}),[Vt,Yt,en,zt,Xt,Wt,Kt,Gt,jt,Qt,Ht,qt,Zt]),sn=reactExports.useContext(selectionContext);return reactExports.useEffect(()=>{if(!sn&&_e)return tn.selection.set(Array.isArray(_e)?_e.map(resolveRef):[resolveRef(_e)]),rn(),()=>{tn.selection.clear(),rn()}},[tn,_e,sn,rn]),reactExports.useEffect(()=>{tn.selectionLayer=Dt,rn()},[tn,rn,Dt]),reactExports.useRef(),reactExports.useEffect(()=>{var cn;if(sn&&sn.enabled&&(cn=sn.selected)!=null&&cn.length)return tn.selection.set(sn.selected),rn(),()=>{tn.selection.clear(),rn()}},[sn,tn.selection,rn]),reactExports.useEffect(()=>()=>{tn.dispose()},[tn]),jsxRuntimeExports.jsx("primitive",{ref:nn,object:tn})}),ToneMapping=reactExports.forwardRef(function kt({blendFunction:_e,adaptive:Dt,mode:Vt,resolution:Gt,maxLuminance:zt,whitePoint:jt,middleGrey:Ht,minLuminance:Wt,averageLuminance:qt,adaptationRate:Xt,...Kt},Yt){const Zt=reactExports.useMemo(()=>new ToneMappingEffect({blendFunction:_e,adaptive:Dt,mode:Vt,resolution:Gt,maxLuminance:zt,whitePoint:jt,middleGrey:Ht,minLuminance:Wt,averageLuminance:qt,adaptationRate:Xt}),[_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt]);return reactExports.useEffect(()=>{Zt.dispose()},[Zt]),jsxRuntimeExports.jsx("primitive",{...Kt,ref:Yt,object:Zt,attributes:EffectAttribute.CONVOLUTION})}),Model=reactExports.forwardRef(({stores:kt,itemKey:_e,mainModel:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt,stockAlert:Ht=!0},Wt)=>{const qt=kt.itemStore(hn=>hn.focusedGUID),Xt=kt.itemStore(hn=>hn),Kt=kt.itemStore(hn=>hn.hoveredItemRef),Yt=reactExports.useRef(null),Zt=reactExports.useRef([]),Jt=reactExports.useRef(0),nn=reactExports.useRef(0),[rn,Qt]=reactExports.useState(!1);reactExports.useEffect(()=>()=>{dispose3(Dt)},[Dt]);const en=reactExports.useCallback(()=>{if(!Wt.current)return;const hn=nn.current<1e-4,{meshArr:dn,restored:pn}=findMeshAndCloneMatFromScene(kt,Wt.current,Wt.current.inStock,hn);if(Zt.current=dn,Zt.current.length==0)return;if(Wt.current.inStock===!1){Ht==!0&&(Ht=!1,kt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"}));return}if(pn)return;const{current:fn}=nn;for(let mn=0;mn<Zt.current.length;mn++){const vn=Zt.current[mn].material;vn.emissiveIntensity=fn}},[nn,Wt]),tn=reactExports.useCallback(()=>{Jt.current=0},[Zt]),sn=reactExports.useCallback(()=>{Jt.current=.005},[Zt,Dt]);useFrame(()=>{if(!rn||kt.coreSceneStore.getState().builderMode)return;const hn=kt.cameraStore.getState().userDragging,dn=0;nn.current=MathUtils.lerp(nn.current,hn?dn:Jt.current,.1),en()}),reactExports.useEffect(()=>{const hn=kt.attachmentStore.getState().attachmentSystem.currentStructure,dn=hn.getNodeByGUID(_e.itemData.guid);if(dn?.isDependent&&!dn.isInteractive&&Object.keys(Kt).length>0){const pn=hn.getNodeByGUID(Object.keys(Kt)[0]);if(!pn||!pn.myDependenciesGUID)return;pn.myDependenciesGUID.includes(_e.itemData.guid)?tn():sn()}else Kt.hasOwnProperty(_e.itemData.guid)||Object.keys(Kt).length==0?tn():sn()},[Kt]);const cn=reactExports.useCallback(hn=>{hn.stopPropagation();const dn=Xt.selectedItemData;kt.coreSceneStore.setState({canvasTooltipText:"-"+_e.itemData.name+"-"}),dn||kt.itemStore.setState({hoveredItemRef:{}});let pn=kt.itemStore.getState().hoveredItemRef;const fn=kt.attachmentStore.getState().attachmentSystem.currentStructure;if(pn.hasOwnProperty(_e.itemData.guid)||(pn[_e.itemData.guid]={instance:Wt.current}),fn){const mn=fn.getNodeByGUID(_e.itemData.guid);mn&&mn.getNonInteractiveBranchedNodesIncludingSelf&&mn.getNonInteractiveBranchedNodesIncludingSelf().forEach(_n=>{const En=_n.guid;pn.hasOwnProperty(En)||(pn[En]={instance:null})})}Xt.actions.setHoveredItemRef({...pn})},[Xt,Kt,Yt]),un=reactExports.useCallback(hn=>{hn.stopPropagation();const dn=Xt.selectedItemData;if(kt.coreSceneStore.setState({canvasTooltipText:""}),dn){if(dn.itemData.guid==_e.itemData.guid)return;Kt[_e.itemData.guid]&&(delete Kt[_e.itemData.guid],Xt.actions.setHoveredItemRef({...Kt}))}else kt.itemStore.setState({hoveredItemRef:{}})},[Yt,Xt,Kt]);return reactExports.useEffect(()=>{kt.attachmentStore.getState().actions.updateFittingSkuIds();const dn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e.itemData.guid);dn&&dn.checkGeometryVariant(),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,_e.itemData.skuID),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Added,{..._e,visualizedInScene:!0}),Qt(!0)},[]),reactExports.useEffect(()=>{rn&&(kt.coreSceneStore.getState().actions.refreshShadows(),kt.coreSceneStore.getState().actions.triggerAutoFocus())},[rn]),jsxRuntimeExports.jsx(Select,{enabled:qt===_e.itemData.guid,children:jsxRuntimeExports.jsx(Draggable,{stores:kt,guid:_e.itemData.guid,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt,onPointerEnter:cn,onPointerLeave:un,isInteractive:_e.itemData.isInteractive,children:jsxRuntimeExports.jsx(Clone,{name:"GRP_RenderGeometry",ref:Wt,object:Dt,scale:Vt,inStock:!0})})})}),ModelAnimation=({stores:kt,modelAnimations:_e,mainModel:Dt,itemKey:Vt,scale:Gt,onDragStartHandler:zt,onDragEndHandler:jt,onItemClickHandler:Ht})=>{const{ref:Wt,actions:qt,names:Xt}=useAnimations(_e),Kt=kt.hotspotStore(nn=>nn),Yt=reactExports.useRef(null),Zt=reactExports.useCallback((nn,rn,Qt,en)=>playAnimation(nn,rn,Qt,en,Xt,qt),[Xt,qt]),Jt=reactExports.useCallback(nn=>stopAnimation(nn,Xt,qt),[Xt,qt]);return reactExports.useEffect(()=>{if(Yt.current===Vt.itemData.guid){if(Yt.current=null,!Kt.lastActiveHotspotData)return;let nn=Kt.lastActiveHotspotData.hotspotData;if(!nn)return;if(nn.exitAnim?Zt(nn.exitAnim,!1,!1,!1):nn.entryAnim&&Zt(nn.entryAnim,!1,!0,!1),nn.activeAnim&&Jt(nn.activeAnim),Kt.activeHotspotData){if(Vt.itemData.guid===Kt.activeHotspotData.itemData.guid){Yt.current=Vt.itemData.guid;let rn=Kt.activeHotspotData.hotspotData;if(!rn)return;rn.entryAnim&&Zt(rn.entryAnim,!1,!1,!0),rn.activeAnim&&Zt(rn.activeAnim,!0,!1,!1)}}else return}else if(Kt.activeHotspotData){if(Vt.itemData.guid===Kt.activeHotspotData.itemData.guid){Yt.current=Vt.itemData.guid;let nn=Kt.activeHotspotData.hotspotData;if(!nn)return;nn.entryAnim&&Zt(nn.entryAnim,!1,!1,!0),nn.activeAnim&&Zt(nn.activeAnim,!0,!1,!1)}}else return},[Kt.activeHotspotData]),jsxRuntimeExports.jsx(Model,{stores:kt,ref:Wt,mainModel:Dt,itemKey:Vt,scale:Gt,onDragStartHandler:zt,onDragEndHandler:jt,onItemClickHandler:Ht})};function playAnimation(kt,_e,Dt,Vt,Gt,zt){if(!Gt.includes(kt))return;const jt=zt[kt];jt.setLoop(_e?LoopRepeat:LoopOnce),jt.clampWhenFinished=!_e,Vt&&jt.reset(),Dt?jt.fadeOut(.5).play():jt.fadeIn(.5).play()}function stopAnimation(kt,_e,Dt){if(!_e.includes(kt))return;Dt[kt].stop()}const RenderGeo=({stores:kt,url:_e,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt})=>{const[Ht,Wt]=reactExports.useState(!1),qt=useLoader(GLTFLoader,_e,Xt=>{Xt.setDRACOLoader(kt.assetStore.getState().dracoLoader),Xt.register(Kt=>new GLTFMaterialsVariantsExtension(Kt))});return reactExports.useEffect(()=>((async()=>{if(qt.functions){const Kt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.itemData.guid);if(Kt){Kt.modelFunctions=qt.functions;const Yt=findVariantForGUID(kt,Dt.itemData.guid);Yt&&(Kt.currentVariant=Yt,await qt.functions.selectVariant(qt.scene,Yt),kt.itemStore.setState({variantChangeAlert:!kt.itemStore.getState().variantChangeAlert}))}}LOGGER.info({title:"model loaded: "+Dt.itemData.skuID}),Dt.itemData.hasItemLoaded=!0,kt.itemStore.getState().actions.triggerModelLoaded(),await kt.attachmentStore.getState().actions.updateFittingSkuIds(),Wt(!0)})(),()=>{kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Dt.itemData.skuID)}),[qt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Ht&&qt&&(qt.animations?jsxRuntimeExports.jsx(ModelAnimation,{stores:kt,modelAnimations:qt.animations,mainModel:qt.scene,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt}):jsxRuntimeExports.jsx(Model,{stores:kt,mainModel:qt.scene,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt}))})},SceneItem=({stores:kt,position:_e,rotation:Dt,itemKey:Vt,scale:Gt,rejectFunc:zt,onItemClickHandler:jt,onDragEndHandler:Ht,onDragStartHandler:Wt,itemIndex:qt,proxyScene:Xt,proxyOnly:Kt})=>{const Yt=reactExports.useRef(null);return reactExports.useEffect(()=>{if(!Yt.current)return;const Zt=kt.coreSceneStore.getState().sceneRef;if(Zt&&Vt.itemData.hasOwnProperty("excludeFromSceneBounds")&&Vt.itemData.excludeFromSceneBounds){const rn=Zt.getObjectByName("#GRP_EXCLUDED");rn!==void 0&&rn.attach(Yt.current)}const nn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt.itemData.guid);nn&&nn.ref!==Yt.current&&(nn.ref=Yt.current,nn.transform={position:_e,rotation:Dt})},[Yt]),jsxRuntimeExports.jsxs("group",{ref:Yt,position:_e,quaternion:Dt,name:`GRP_${Vt.itemData.name}_`+qt.toString().padStart(2,"0"),children:[jsxRuntimeExports.jsx(ColliderGeo,{stores:kt,itemKey:Vt}),jsxRuntimeExports.jsx(ProxyGeo,{stores:kt,proxyScene:Xt,scale:Gt,proxyOnly:Kt,itemKey:Vt}),!Kt&&jsxRuntimeExports.jsx(reactExports.Suspense,{children:jsxRuntimeExports.jsx(RenderGeo,{stores:kt,scale:Gt,itemKey:Vt,url:resolveAssetUrl(kt.coreSceneStore.getState().CORE_API.isMobile&&Vt.itemData.gltfURL_mobile?Vt.itemData.gltfURL_mobile:Vt.itemData.gltfURL),onDragStartHandler:Wt,onDragEndHandler:Ht,onItemClickHandler:jt})})]})};function GhostEventHandler({index:kt,children:_e,...Dt}){const Vt=reactExports.useRef(),Gt=useGesture({onPointerEnter:zt=>{zt.event.stopPropagation(),Dt.stores.coreSceneStore.getState().itemDraggedSkuID&&Dt.stores.coreSceneStore.setState({hoveredGhostIndex:kt})},onPointerLeave:zt=>{zt.event.stopPropagation(),Dt.stores.coreSceneStore.getState().itemDraggedSkuID&&Dt.stores.coreSceneStore.getState().hoveredGhostIndex===kt&&Dt.stores.coreSceneStore.setState({hoveredGhostIndex:-1})}});return jsxRuntimeExports.jsx("group",{ref:Vt,...Gt(),...Dt,children:_e})}const Ghost=({stores:kt,ghostVisibility:_e,ghostData:Dt,ghostTransform:Vt,index:Gt})=>{const zt=reactExports.useRef(),jt=reactExports.useMemo(()=>{let Wt=null;const qt=Vt?.skuID,Xt=kt?.assetStore?.getState?kt.assetStore.getState():null;return qt&&Xt?.assets?.items?.[qt]?.proxy?.data?.scene?Wt=Xt.assets.items[qt].proxy.data.scene.clone():Dt&&Dt.proxyScene?Wt=Dt.proxyScene.clone():Wt=null,Wt},[Dt,Vt,kt]),Ht=kt.coreSceneStore(Wt=>Wt.hoveredGhostIndex);return reactExports.useEffect(()=>()=>{dispose3(jt)},[jt]),reactExports.useEffect(()=>{const{current:Wt}=zt;Wt&&(Wt.userData.incomingPlugName=Vt.incomingPlugName,Wt.userData.receiverPlugName=Vt.receiverPlugName,Wt.userData.incomingPlugGUID=Vt.incomingPlugGUID,Wt.userData.receiverPlugGUID=Vt.receiverPlugGUID,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,{ghostData:Dt,ghostTransform:Vt}))},[zt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(GhostEventHandler,{stores:kt,index:Gt,children:jsxRuntimeExports.jsx(Select,{enabled:Ht===Gt,children:jsxRuntimeExports.jsx("primitive",{isGhost:!0,ref:zt,index:Gt,autoFocusEnabled:_e,position:Vt.position,scale:kt.coreSceneStore.getState().sceneSettings.ghostScale,quaternion:Vt.rotation,object:jt,castShadow:!1,receiveShadow:!1,frustumCulled:!1},`ghost${Gt}`)})})})},GhostManager=({stores:kt,intersectingGhostObject:_e=null})=>{const{camera:Dt}=useThree(),Vt=kt.ghostStore(Xt=>Xt.ghostVisibility),Gt=kt.ghostStore(Xt=>Xt.ghostData),zt=kt.ghostStore(Xt=>Xt.ghostsTransform),jt=reactExports.useRef(),{_touch2D:Ht,raycasterGhost:Wt}=reactExports.useMemo(()=>({_touch2D:new Vector2,raycasterGhost:new Raycaster}),[]);reactExports.useEffect(()=>{const{current:Xt}=jt;Xt&&kt.ghostStore.setState({ghostParentRef:Xt})},[jt]);const qt=Xt=>{let Kt=0,Yt=0;if(Xt.touches&&Xt.touches[0])Kt=Xt.touches[0].clientX,Yt=Xt.touches[0].clientY;else return;if(!kt.coreSceneStore.getState().itemDraggedSkuID)return;const Zt=kt.coreSceneStore.getState().cursorParentRef,Jt=kt.coreSceneStore.getState().canvasSize;if(!Zt)return;const nn=Zt.getBoundingClientRect(),rn=nn.top,Qt=nn.left,en=(Kt-Qt)/Jt.width*2-1,tn=(-Yt+rn)/Jt.height*2+1;Ht.set(en,tn),Wt.layers.enable(GHOST_LAYER),Wt.setFromCamera(Ht,Dt);const sn=Wt.intersectObject(kt.ghostStore.getState().ghostParentRef);sn.length>0?(_e=sn[0].object,kt.coreSceneStore.setState({hoveredGhostIndex:_e.parent.index})):(_e=null,kt.coreSceneStore.setState({hoveredGhostIndex:-1}))};return reactExports.useEffect(()=>(kt.wcRef.addEventListener("touchmove",qt,!1),LOGGER.info({title:"Ghost Manager Mounted!"}),()=>{const Kt=kt.wcRef;Kt&&Kt.removeEventListener("touchmove",qt,!1)}),[]),jsxRuntimeExports.jsx("group",{name:"#GRP_GhostParent",visible:Vt,scale:Vt?[1,1,1]:[0,0,0],ref:jt,children:Gt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:zt.map((Xt,Kt)=>Kt<Gt.count&&jsxRuntimeExports.jsx(Ghost,{stores:kt,ghostVisibility:Vt,ghostData:Gt,ghostTransform:Xt,index:Kt},"ghosts"+Kt))})})},ItemManager=({stores:kt})=>{const _e=kt.attachmentStore(fn=>fn),Dt=kt.itemStore(fn=>fn.removeItemTrigger),Vt=kt.itemStore(fn=>fn.variantChangeAlert),Gt=kt.hotspotStore(fn=>fn),zt=kt.coreSceneStore(fn=>fn.showDimensions),jt=kt.itemStore(fn=>fn),Ht=kt.itemStore(fn=>fn.lastDeletedItemData),Wt=kt.cameraStore(fn=>fn),qt=kt.itemStore(fn=>fn.selectedItemData),Xt=kt.itemStore(fn=>fn.itemsSpawned),Kt=kt.itemStore(fn=>fn.fittingSkuIds),Yt=kt.coreSceneStore(fn=>fn.coreReady),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(!1),rn=reactExports.useRef(null),Qt=reactExports.useRef(null),en=reactExports.useRef(!1),tn=reactExports.useRef(!1);reactExports.useRef(!1),reactExports.useRef(!1);const sn=reactExports.useCallback(async({guid:fn,node:mn,detachedData:vn,attachedChildrenGuids:_n})=>{if(nn.current===!0)return;const En=kt.attachmentStore.getState().attachmentSystem.currentStructure;return nn.current=!0,kt.cameraStore.getState().actions.canCameraRotate(!1),Gt.actions.switchHotspotsVisibility(!1,!0),rn.current={position:mn.ref.position.clone(),rotation:mn.ref.rotation.clone()},Qt.current=vn,await En.removeNodeFromStructure(mn),_n.length<=0&&(_n=!1),kt.ghostStore.getState().actions.spawnGhostsForSkuID(Xt[fn].itemData.skuID,_n)},[Wt,Xt]),cn=reactExports.useCallback(async({node:fn,intersectingGhostObject:mn,attachedChildrenGuids:vn,attachedNodesToCurrentNode:_n})=>{if(!nn.current)return;const En=kt.attachmentStore.getState().attachmentSystem.currentStructure;nn.current=!1,kt.cameraStore.getState().actions.canCameraRotate(!0),Gt.actions.switchHotspotsVisibility(!0,!0);function An(){fn.ref.position.set(0,0,0),kt.ghostStore.getState().actions.clearAllGhosts()}if(!kt.ghostStore.getState().ghostData?.connectablePlugs){An();return}En.addNode(fn);let Cn=null,yn=null,Sn=!1,wn=[],xn={};if(kt.coreSceneStore.getState().sceneSettings.ignoreCollisionPostDragging===!1&&vn.map((Rn,Dn)=>{wn[Dn]=En.checkCollisionForGUID(Rn,vn),wn[Dn]&&(xn[Rn]=Xt[Rn],En.getNodeByGUID(Rn).getAllBranchedNodesAttachedToUs().map(Pn=>{xn[Pn.guid]=Xt[Pn.guid]}))}),wn.map(Rn=>{Sn||(Sn=Rn)}),mn&&Sn){kt.coreSceneStore.setState({draggingOnDropCollisionData:{node:fn,attachedChildrenGuids:vn,collidingStatus:wn,intersectingGhostObject:mn,initPosition:rn.current.position,initRotation:rn.current.rotation,detachedPlugs:Qt.current,attachedNodesToCurrentNode:_n}}),fn.ref.position.set(mn.position.x,mn.position.y,mn.position.z),fn.ref.setRotationFromEuler(mn.rotation),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,xn);return}if(mn){const Rn=mn.userData;Cn=fn.getPlugByName(Rn.incomingPlugName),yn=En.getPlugByGUID(Rn.receiverPlugGUID),fn.ref.position.set(mn.position.x,mn.position.y,mn.position.z),fn.ref.setRotationFromEuler(mn.rotation),fn.transform={position:mn.position,rotation:mn.quaternion}}else{const Rn=Qt.current.neighborDetachedPlugs;Rn&&(Qt.current.neighborNode.detachNodeFromReceiver(),En.connectPlugs({incomingPlug:Rn.incomingPlug,receiverPlug:Rn.receiverPlug})),Cn=Qt.current.rootDetachedPlugs.incomingPlug,yn=Qt.current.rootDetachedPlugs.receiverPlug,fn.ref.position.set(rn.current.position.x,rn.current.position.y,rn.current.position.z),fn.ref.setRotationFromEuler(rn.current.rotation);let Dn=new Quaternion().identity();fn.ref.getWorldQuaternion(Dn),fn.transform={position:rn.current.position,rotation:Dn}}En.connectPlugs({incomingPlug:Cn,receiverPlug:yn}),kt.ghostStore.getState().actions.clearAllGhosts(),kt.itemStore.getState().actions.deselectItem(),_n.map(Rn=>{fn.ref.parent.attach(Rn.ref),Rn.transform={position:Rn.ref.position,rotation:Rn.ref.quaternion},fn.dragging=!1,Rn.dragging=!1}),await kt.attachmentStore.getState().actions.updateFittingSkuIds()},[Wt,kt.coreSceneStore,kt.ghostStore,_e,Xt]),un=reactExports.useCallback((fn,mn,vn)=>{if(kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;const _n=kt.attachmentStore.getState().attachmentSystem.currentStructure,En=_n.getNodeByGUID(vn);let An=[];if(!En?.myDependenciesGUID)return;En.myDependenciesGUID.map(yn=>{const Sn=_n.getNodeByGUID(yn);if(!Sn)return;let wn={guid:yn,name:Xt[yn].itemData.guid,data:{...Xt[yn],overrideVariant:Sn.overrideVariant,currentVariant:Sn.currentVariant,offsetX:fn,offsetY:mn}};An.push(wn)}),An.sort((yn,Sn)=>yn.name>Sn.name?1:Sn.name>yn.name?-1:0);let Tn=kt.inventoryStore.getState().inventoryData[Xt[vn].itemData.skuID];const Cn={primary:{guid:vn,name:Xt[vn].itemData.name,data:{inventory:Tn,...Xt[vn],overrideVariant:En.overrideVariant,currentVariant:En.currentVariant,offsetX:fn,offsetY:mn}},dependencies:An};jt.actions.setSelectedItemData(Cn.primary.data),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Show,Cn)},[Xt]),hn=reactExports.useCallback(fn=>{if(!fn)return;kt.itemStore.setState({lastDeletedItemData:{...Xt[fn]}});const mn={...Xt[fn]};delete Xt[fn],jt.actions.setItemsSpawned({...Xt}),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,mn)},[jt,kt.itemStore,Xt]);reactExports.useEffect(()=>{let fn=kt.itemStore.getState().removeItems;if(fn.length<=0&&!Ht)return;let mn=fn.pop();hn(mn)},[Dt,Ht]);const dn=reactExports.useCallback(function(fn){const mn=kt.coreSceneStore.getState().sceneSettings,vn=fn>1?!0:fn===1?Object.values(Xt)[0].itemData.skuID.toLowerCase()!=="root":!1,_n=!vn;LOGGER.groupCollapsed("Resolving buttons visibility"),LOGGER.table({sceneIsEmpty:_n,sceneIsNotEmpty:vn}),LOGGER.groupEnd(),mn.showViewInYourSpaceBtn===!0&&(vn&&en.current===!1?(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ViewInYourSpaceButton_Show),en.current=!0):_n&&en.current===!0&&(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ViewInYourSpaceButton_Hide),en.current=!1)),mn.showShareBtn===!0&&(vn&&tn.current===!1?(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ShareButton_Show),tn.current=!0):_n&&tn.current===!0&&(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ShareButton_Hide),tn.current=!1))},[Xt]);reactExports.useEffect(()=>{kt.coreSceneStore.getState().preconfigurationLoaded&&kt.coreSceneStore.getState().configurationLoaded&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Xt});const fn=kt.coreSceneStore.getState().sceneSettings,mn=kt.itemStore.getState().defaultSceneItemCount;Object.keys(Xt).length===mn?kt.coreSceneStore.setState({canvasTooltipText:fn.textSettings.tooltipEmptySceneText}):Object.keys(Xt).length===mn+1&&kt.coreSceneStore.setState({canvasTooltipText:fn.textSettings.tooltipInstructionText})},[Xt]),reactExports.useEffect(()=>{Yt===!0&&dn(Object.keys(Xt).length)},[Xt,Yt]),reactExports.useEffect(()=>{if(kt.inventoryStore.getState().actions.refreshInventory(Xt),!kt.coreSceneStore.getState().preconfigurationLoaded||!kt.coreSceneStore.getState().configurationLoaded)return;async function fn(){const mn=kt.attachmentStore.getState().attachmentSystem;if(!mn)return;const vn=await mn.getCartItemsAsync();kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,vn),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,mn.currentStructure.getCurrentItemsInReplaceableCategory())}fn()},[Xt,Vt]);const pn=reactExports.useCallback((fn,mn,vn)=>{kt.coreSceneStore.getState().CORE_API.removeItemByGUID(vn),kt.coreSceneStore.getState().CORE_API.alert({alertMsg:mn+": "+fn,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return reactExports.useEffect(()=>{const{current:fn}=Jt;fn&&kt.attachmentStore.setState({colliderMeshRef:fn})},[Jt]),reactExports.useEffect(()=>{const{current:fn}=Zt;fn&&kt.coreSceneStore.setState({sceneRef:fn})},[Zt]),reactExports.useEffect(()=>{let fn=qt?kt.cameraStore.getState().cameraSettings.zoomingMultiplier:kt.cameraStore.getState().cameraSettings.zoomingMultiplier+.1;fn+=zt?.3:.1,kt.cameraStore.setState({boundsMargin:fn}),kt.coreSceneStore.getState().actions.triggerAutoFocus()},[zt,qt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Kt})},[Kt]),reactExports.useEffect(()=>{const fn=kt.itemStore.getState().itemsSpawned;if(LOGGER.info({title:"item Manager mounted"}),!kt.coreSceneStore.getState().preconfigurationLoaded)kt.attachmentStore.getState().actions.loadDefaultStructure();else if(Object.keys(fn).length===1){const mn=Object.keys(fn)[0];kt.itemStore.getState().actions.resolvePlugDependencyOnGUID(mn)}},[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("group",{name:"Scene",ref:Zt,onPointerMissed:()=>{qt&&jt.actions.deselectItem(),kt.hotspotStore.getState().isAnyHotspotActive&&kt.hotspotStore.getState().actions.exitHotspot()},children:[jsxRuntimeExports.jsx("group",{name:"#GRP_EXCLUDED"}),jsxRuntimeExports.jsxs("group",{name:"#ITEMS_AND_GHOSTS",children:[jsxRuntimeExports.jsx("group",{name:"#ITEMS",children:Object.keys(Xt).map((fn,mn)=>jsxRuntimeExports.jsx(SceneItem,{stores:kt,scale:[1,1,1],onDragStartHandler:sn,onDragEndHandler:cn,onItemClickHandler:un,itemKey:Xt[fn],position:Xt[fn].itemData.position,rotation:Xt[fn].itemData.rotation,itemIndex:mn,proxyScene:Xt[fn].itemData.proxyScene,rejectFunc:pn,proxyOnly:Xt[fn].itemData.gltfURL==""},fn))}),jsxRuntimeExports.jsx(GhostManager,{stores:kt})]})]}),jsxRuntimeExports.jsx("group",{name:"#Parent_ColliderMesh",children:jsxRuntimeExports.jsx("mesh",{ref:Jt,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:jsxRuntimeExports.jsx("meshPhongMaterial",{depthTest:!1,transparent:!0,opacity:.8})})})]})},ContactShadows=reactExports.forwardRef(({scale:kt=10,frames:_e=1/0,excludeLayer:Dt=-1,bbmin:Vt=1,bbmax:Gt=1,opacity:zt=1,width:jt=1,height:Ht=1,blur:Wt=1,near:qt=0,far:Xt=10,resolution:Kt=512,smooth:Yt=!0,color:Zt="#000000",depthWrite:Jt=!1,renderOrder:nn,...rn},Qt)=>{const en=reactExports.useRef(null),tn=useThree(Cn=>Cn.scene),sn=useThree(Cn=>Cn.gl),cn=reactExports.useRef(null);jt=jt*(Array.isArray(kt)?kt[0]:kt||1),Ht=Ht*(Array.isArray(kt)?kt[1]:kt||1);const[un,hn,dn,pn,fn,mn,vn]=reactExports.useMemo(()=>{const Cn=new WebGLRenderTarget(Kt,Kt),yn=new WebGLRenderTarget(Kt,Kt);yn.texture.generateMipmaps=Cn.texture.generateMipmaps=!1;const Sn=new PlaneGeometry(jt,Ht).rotateX(Math.PI/2),wn=new Mesh(Sn),xn=new MeshDepthMaterial;xn.depthTest=xn.depthWrite=!1,xn.onBeforeCompile=kn=>{kn.uniforms={...kn.uniforms,ucolor:{value:new Color$1(Zt)}},kn.fragmentShader=kn.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
4461
+ #`));this.skipRendering=_e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(kt)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(kt,_e=BasicDepthPacking){this.fullscreenMaterial.depthBuffer=kt,this.fullscreenMaterial.depthPacking=_e;for(const Dt of this.effects)Dt.setDepthTexture(kt,_e)}render(kt,_e,Dt,Vt,Gt){for(const zt of this.effects)zt.update(kt,_e,Vt);if(!this.skipRendering||this.renderToScreen){const zt=this.fullscreenMaterial;zt.inputBuffer=_e.texture,zt.time+=Vt*this.timeScale,kt.setRenderTarget(this.renderToScreen?null:Dt),kt.render(this.scene,this.camera)}}setSize(kt,_e){this.fullscreenMaterial.setSize(kt,_e);for(const Dt of this.effects)Dt.setSize(kt,_e)}initialize(kt,_e,Dt){this.renderer=kt;for(const Vt of this.effects)Vt.initialize(kt,_e,Dt);this.updateMaterial(),Dt!==void 0&&Dt!==UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const kt of this.effects)kt.removeEventListener("change",this.listener),kt.dispose()}handleEvent(kt){switch(kt.type){case"change":this.recompile();break}}},NormalPass=class extends Pass{constructor(kt,_e,{renderTarget:Dt,resolutionScale:Vt=1,width:Gt=Resolution.AUTO_SIZE,height:zt=Resolution.AUTO_SIZE,resolutionX:jt=Gt,resolutionY:Ht=zt}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new RenderPass(kt,_e,new MeshNormalMaterial);const Wt=this.renderPass;Wt.ignoreBackground=!0,Wt.skipShadowMapUpdate=!0;const qt=Wt.getClearPass();qt.overrideClearColor=new Color$1(7829503),qt.overrideClearAlpha=1,this.renderTarget=Dt,this.renderTarget===void 0&&(this.renderTarget=new WebGLRenderTarget(1,1,{minFilter:NearestFilter,magFilter:NearestFilter}),this.renderTarget.texture.name="NormalPass.Target");const Xt=this.resolution=new Resolution(this,jt,Ht,Vt);Xt.addEventListener("change",Kt=>this.setSize(Xt.baseWidth,Xt.baseHeight))}set mainScene(kt){this.renderPass.mainScene=kt}set mainCamera(kt){this.renderPass.mainCamera=kt}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(kt){this.resolution.scale=kt}render(kt,_e,Dt,Vt,Gt){const zt=this.renderToScreen?null:this.renderTarget;this.renderPass.render(kt,zt,zt)}setSize(kt,_e){const Dt=this.resolution;Dt.setBaseSize(kt,_e),this.renderTarget.setSize(Dt.width,Dt.height)}};const EffectComposerContext=reactExports.createContext(null),isConvolution=kt=>(kt.getAttributes()&EffectAttribute.CONVOLUTION)===EffectAttribute.CONVOLUTION,EffectComposer=React.memo(reactExports.forwardRef(({children:kt,camera:_e,scene:Dt,resolutionScale:Vt,enabled:Gt=!0,renderPriority:zt=1,autoClear:jt=!0,depthBuffer:Ht,enableNormalPass:Wt,stencilBuffer:qt,multisampling:Xt=8,frameBufferType:Kt=HalfFloatType},Yt)=>{const{gl:Zt,scene:Jt,camera:nn,size:rn}=useThree(),Qt=Dt||Jt,en=_e||nn,[tn,sn,cn]=reactExports.useMemo(()=>{const pn=isWebGL2Available(),fn=new EffectComposer$1(Zt,{depthBuffer:Ht,stencilBuffer:qt,multisampling:Xt>0&&pn?Xt:0,frameBufferType:Kt});fn.addPass(new RenderPass(Qt,en));let mn=null,vn=null;return Wt&&(vn=new NormalPass(Qt,en),vn.enabled=!1,fn.addPass(vn),Vt!==void 0&&pn&&(mn=new DepthDownsamplingPass({normalBuffer:vn.texture,resolutionScale:Vt}),mn.enabled=!1,fn.addPass(mn))),[fn,vn,mn]},[en,Zt,Ht,qt,Xt,Kt,Qt,Wt,Vt]);reactExports.useEffect(()=>tn?.setSize(rn.width,rn.height),[tn,rn]),useFrame((pn,fn)=>{if(Gt){const mn=Zt.autoClear;Zt.autoClear=jt,qt&&!jt&&Zt.clearStencil(),tn.render(fn),Zt.autoClear=mn}},Gt?zt:0);const un=reactExports.useRef(null),hn=useInstanceHandle(un);reactExports.useLayoutEffect(()=>{const pn=[];if(un.current&&hn.current&&tn){const fn=hn.current.objects;for(let mn=0;mn<fn.length;mn++){const vn=fn[mn];if(vn instanceof Effect){const _n=[vn];if(!isConvolution(vn)){let An=null;for(;(An=fn[mn+1])instanceof Effect&&!isConvolution(An);)_n.push(An),mn++}const En=new EffectPass(en,..._n);pn.push(En)}else vn instanceof Pass&&pn.push(vn)}for(const mn of pn)tn?.addPass(mn);sn&&(sn.enabled=!0),cn&&(cn.enabled=!0)}return()=>{for(const fn of pn)tn?.removePass(fn);sn&&(sn.enabled=!1),cn&&(cn.enabled=!1)}},[tn,kt,en,sn,cn,hn]),reactExports.useEffect(()=>{const pn=Zt.toneMapping;return Zt.toneMapping=NoToneMapping,()=>{Zt.toneMapping=pn}},[]);const dn=reactExports.useMemo(()=>({composer:tn,normalPass:sn,downSamplingPass:cn,resolutionScale:Vt,camera:en,scene:Qt}),[tn,sn,cn,Vt,en,Qt]);return reactExports.useImperativeHandle(Yt,()=>tn,[tn]),jsxRuntimeExports.jsx(EffectComposerContext.Provider,{value:dn,children:jsxRuntimeExports.jsx("group",{ref:un,children:kt})})})),resolveRef=kt=>typeof kt=="object"&&kt!=null&&"current"in kt?kt.current:kt,Outline=reactExports.forwardRef(function kt({selection:_e=[],selectionLayer:Dt=10,blendFunction:Vt,patternTexture:Gt,edgeStrength:zt,pulseSpeed:jt,visibleEdgeColor:Ht,hiddenEdgeColor:Wt,width:qt,height:Xt,kernelSize:Kt,blur:Yt,xRay:Zt,...Jt},nn){const rn=useThree(cn=>cn.invalidate),{scene:Qt,camera:en}=reactExports.useContext(EffectComposerContext),tn=reactExports.useMemo(()=>new OutlineEffect(Qt,en,{blendFunction:Vt,patternTexture:Gt,edgeStrength:zt,pulseSpeed:jt,visibleEdgeColor:Ht,hiddenEdgeColor:Wt,width:qt,height:Xt,kernelSize:Kt,blur:Yt,xRay:Zt,...Jt}),[Vt,Yt,en,zt,Xt,Wt,Kt,Gt,jt,Qt,Ht,qt,Zt]),sn=reactExports.useContext(selectionContext);return reactExports.useEffect(()=>{if(!sn&&_e)return tn.selection.set(Array.isArray(_e)?_e.map(resolveRef):[resolveRef(_e)]),rn(),()=>{tn.selection.clear(),rn()}},[tn,_e,sn,rn]),reactExports.useEffect(()=>{tn.selectionLayer=Dt,rn()},[tn,rn,Dt]),reactExports.useRef(),reactExports.useEffect(()=>{var cn;if(sn&&sn.enabled&&(cn=sn.selected)!=null&&cn.length)return tn.selection.set(sn.selected),rn(),()=>{tn.selection.clear(),rn()}},[sn,tn.selection,rn]),reactExports.useEffect(()=>()=>{tn.dispose()},[tn]),jsxRuntimeExports.jsx("primitive",{ref:nn,object:tn})}),ToneMapping=reactExports.forwardRef(function kt({blendFunction:_e,adaptive:Dt,mode:Vt,resolution:Gt,maxLuminance:zt,whitePoint:jt,middleGrey:Ht,minLuminance:Wt,averageLuminance:qt,adaptationRate:Xt,...Kt},Yt){const Zt=reactExports.useMemo(()=>new ToneMappingEffect({blendFunction:_e,adaptive:Dt,mode:Vt,resolution:Gt,maxLuminance:zt,whitePoint:jt,middleGrey:Ht,minLuminance:Wt,averageLuminance:qt,adaptationRate:Xt}),[_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt]);return reactExports.useEffect(()=>{Zt.dispose()},[Zt]),jsxRuntimeExports.jsx("primitive",{...Kt,ref:Yt,object:Zt,attributes:EffectAttribute.CONVOLUTION})});function buildHoverGroupMap(kt,_e,Dt){const Vt={};if(!kt||!_e)return Vt;const Gt=kt.getNodeByGUID(_e);return Gt&&(Vt[_e]={instance:Dt},Gt.getNonInteractiveBranchedNodesIncludingSelf&&Gt.getNonInteractiveBranchedNodesIncludingSelf().forEach(jt=>{const Ht=jt.guid;Vt.hasOwnProperty(Ht)||(Vt[Ht]={instance:null})})),Vt}const Model=reactExports.forwardRef(({stores:kt,itemKey:_e,mainModel:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt,stockAlert:Ht=!0},Wt)=>{const qt=kt.itemStore(un=>un.focusedGUID),Xt=kt.itemStore(un=>un),Kt=kt.itemStore(un=>un.hoveredItemRef);reactExports.useRef(null);const Yt=reactExports.useRef([]),Zt=reactExports.useRef(0),Jt=reactExports.useRef(0),[nn,rn]=reactExports.useState(!1);reactExports.useEffect(()=>()=>{dispose3(Dt)},[Dt]);const Qt=reactExports.useCallback(()=>{if(!Wt.current)return;const un=Jt.current<1e-4,{meshArr:hn,restored:dn}=findMeshAndCloneMatFromScene(kt,Wt.current,Wt.current.inStock,un);if(Yt.current=hn,Yt.current.length==0)return;if(Wt.current.inStock===!1){Ht==!0&&(Ht=!1,kt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"}));return}if(dn)return;const{current:pn}=Jt;for(let fn=0;fn<Yt.current.length;fn++){const mn=Yt.current[fn].material;mn.emissiveIntensity=pn}},[Jt,Wt]),en=reactExports.useCallback(()=>{Zt.current=0},[Yt]),tn=reactExports.useCallback(()=>{Zt.current=.005},[Yt,Dt]);useFrame(()=>{if(!nn||kt.coreSceneStore.getState().builderMode)return;const un=kt.cameraStore.getState().userDragging,hn=0;Jt.current=MathUtils.lerp(Jt.current,un?hn:Zt.current,.1),Qt()}),reactExports.useEffect(()=>{const un=kt.attachmentStore.getState().attachmentSystem.currentStructure,hn=un.getNodeByGUID(_e.itemData.guid);if(hn?.isDependent&&!hn.isInteractive&&Object.keys(Kt).length>0){const dn=un.getNodeByGUID(Object.keys(Kt)[0]);if(!dn||!dn.myDependenciesGUID)return;dn.myDependenciesGUID.includes(_e.itemData.guid)?en():tn()}else Kt.hasOwnProperty(_e.itemData.guid)||Object.keys(Kt).length==0?en():tn()},[Kt]);const sn=reactExports.useCallback(un=>{un.stopPropagation(),kt.coreSceneStore.setState({canvasTooltipText:"-"+_e.itemData.name+"-"});const hn=kt.attachmentStore.getState().attachmentSystem.currentStructure,dn=buildHoverGroupMap(hn,_e.itemData.guid,Wt.current);Xt.actions.setHoveredItemRef(dn)},[Xt,_e.itemData.guid,_e.itemData.name]),cn=reactExports.useCallback(un=>{un.stopPropagation();const hn=Xt.selectedItemData;if(kt.coreSceneStore.setState({canvasTooltipText:""}),hn){if(hn.itemData.guid==_e.itemData.guid)return;const dn=kt.attachmentStore.getState().attachmentSystem.currentStructure;let pn={};try{pn=buildHoverGroupMap(dn,hn.itemData.guid,null)}catch(fn){LOGGER.error({title:"Couldn't resolve hovered items...",details:fn})}Xt.actions.setHoveredItemRef(pn)}else kt.itemStore.setState({hoveredItemRef:{}})},[Xt,_e.itemData.guid]);return reactExports.useEffect(()=>{kt.attachmentStore.getState().actions.updateFittingSkuIds();const hn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e.itemData.guid);hn&&hn.checkGeometryVariant(),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,_e.itemData.skuID),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Added,{..._e,visualizedInScene:!0}),rn(!0)},[]),reactExports.useEffect(()=>{nn&&(kt.coreSceneStore.getState().actions.refreshShadows(),kt.coreSceneStore.getState().actions.triggerAutoFocus())},[nn]),jsxRuntimeExports.jsx(Select,{enabled:qt===_e.itemData.guid,children:jsxRuntimeExports.jsx(Draggable,{stores:kt,guid:_e.itemData.guid,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt,onPointerEnter:sn,onPointerLeave:cn,isInteractive:_e.itemData.isInteractive,children:jsxRuntimeExports.jsx(Clone,{name:"GRP_RenderGeometry",ref:Wt,object:Dt,scale:Vt,inStock:!0})})})}),ModelAnimation=({stores:kt,modelAnimations:_e,mainModel:Dt,itemKey:Vt,scale:Gt,onDragStartHandler:zt,onDragEndHandler:jt,onItemClickHandler:Ht})=>{const{ref:Wt,actions:qt,names:Xt}=useAnimations(_e),Kt=kt.hotspotStore(nn=>nn),Yt=reactExports.useRef(null),Zt=reactExports.useCallback((nn,rn,Qt,en)=>playAnimation(nn,rn,Qt,en,Xt,qt),[Xt,qt]),Jt=reactExports.useCallback(nn=>stopAnimation(nn,Xt,qt),[Xt,qt]);return reactExports.useEffect(()=>{if(Yt.current===Vt.itemData.guid){if(Yt.current=null,!Kt.lastActiveHotspotData)return;let nn=Kt.lastActiveHotspotData.hotspotData;if(!nn)return;if(nn.exitAnim?Zt(nn.exitAnim,!1,!1,!1):nn.entryAnim&&Zt(nn.entryAnim,!1,!0,!1),nn.activeAnim&&Jt(nn.activeAnim),Kt.activeHotspotData){if(Vt.itemData.guid===Kt.activeHotspotData.itemData.guid){Yt.current=Vt.itemData.guid;let rn=Kt.activeHotspotData.hotspotData;if(!rn)return;rn.entryAnim&&Zt(rn.entryAnim,!1,!1,!0),rn.activeAnim&&Zt(rn.activeAnim,!0,!1,!1)}}else return}else if(Kt.activeHotspotData){if(Vt.itemData.guid===Kt.activeHotspotData.itemData.guid){Yt.current=Vt.itemData.guid;let nn=Kt.activeHotspotData.hotspotData;if(!nn)return;nn.entryAnim&&Zt(nn.entryAnim,!1,!1,!0),nn.activeAnim&&Zt(nn.activeAnim,!0,!1,!1)}}else return},[Kt.activeHotspotData]),jsxRuntimeExports.jsx(Model,{stores:kt,ref:Wt,mainModel:Dt,itemKey:Vt,scale:Gt,onDragStartHandler:zt,onDragEndHandler:jt,onItemClickHandler:Ht})};function playAnimation(kt,_e,Dt,Vt,Gt,zt){if(!Gt.includes(kt))return;const jt=zt[kt];jt.setLoop(_e?LoopRepeat:LoopOnce),jt.clampWhenFinished=!_e,Vt&&jt.reset(),Dt?jt.fadeOut(.5).play():jt.fadeIn(.5).play()}function stopAnimation(kt,_e,Dt){if(!_e.includes(kt))return;Dt[kt].stop()}const RenderGeo=({stores:kt,url:_e,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt})=>{const[Ht,Wt]=reactExports.useState(!1),qt=useLoader(GLTFLoader,_e,Xt=>{Xt.setDRACOLoader(kt.assetStore.getState().dracoLoader),Xt.register(Kt=>new GLTFMaterialsVariantsExtension(Kt))});return reactExports.useEffect(()=>((async()=>{if(qt.functions){const Kt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.itemData.guid);if(Kt){Kt.modelFunctions=qt.functions;const Yt=findVariantForGUID(kt,Dt.itemData.guid);Yt&&(Kt.currentVariant=Yt,await qt.functions.selectVariant(qt.scene,Yt),kt.itemStore.setState({variantChangeAlert:!kt.itemStore.getState().variantChangeAlert}))}}LOGGER$1.info({title:"model loaded: "+Dt.itemData.skuID}),Dt.itemData.hasItemLoaded=!0,kt.itemStore.getState().actions.triggerModelLoaded(),await kt.attachmentStore.getState().actions.updateFittingSkuIds(),Wt(!0)})(),()=>{kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Dt.itemData.skuID)}),[qt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Ht&&qt&&(qt.animations?jsxRuntimeExports.jsx(ModelAnimation,{stores:kt,modelAnimations:qt.animations,mainModel:qt.scene,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt}):jsxRuntimeExports.jsx(Model,{stores:kt,mainModel:qt.scene,itemKey:Dt,scale:Vt,onDragStartHandler:Gt,onDragEndHandler:zt,onItemClickHandler:jt}))})},SceneItem=({stores:kt,position:_e,rotation:Dt,itemKey:Vt,scale:Gt,rejectFunc:zt,onItemClickHandler:jt,onDragEndHandler:Ht,onDragStartHandler:Wt,itemIndex:qt,proxyScene:Xt,proxyOnly:Kt})=>{const Yt=reactExports.useRef(null);return reactExports.useEffect(()=>{if(!Yt.current)return;const Zt=kt.coreSceneStore.getState().sceneRef;if(Zt&&Vt.itemData.hasOwnProperty("excludeFromSceneBounds")&&Vt.itemData.excludeFromSceneBounds){const rn=Zt.getObjectByName("#GRP_EXCLUDED");rn!==void 0&&rn.attach(Yt.current)}const nn=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt.itemData.guid);nn&&nn.ref!==Yt.current&&(nn.ref=Yt.current,nn.transform={position:_e,rotation:Dt})},[Yt]),jsxRuntimeExports.jsxs("group",{ref:Yt,position:_e,quaternion:Dt,name:`GRP_${Vt.itemData.name}_`+qt.toString().padStart(2,"0"),children:[jsxRuntimeExports.jsx(ColliderGeo,{stores:kt,itemKey:Vt}),jsxRuntimeExports.jsx(ProxyGeo,{stores:kt,proxyScene:Xt,scale:Gt,proxyOnly:Kt,itemKey:Vt}),!Kt&&jsxRuntimeExports.jsx(reactExports.Suspense,{children:jsxRuntimeExports.jsx(RenderGeo,{stores:kt,scale:Gt,itemKey:Vt,url:resolveAssetUrl(kt.coreSceneStore.getState().CORE_API.isMobile&&Vt.itemData.gltfURL_mobile?Vt.itemData.gltfURL_mobile:Vt.itemData.gltfURL),onDragStartHandler:Wt,onDragEndHandler:Ht,onItemClickHandler:jt})})]})};function GhostEventHandler({index:kt,children:_e,...Dt}){const Vt=reactExports.useRef(),Gt=useGesture({onPointerEnter:zt=>{zt.event.stopPropagation(),Dt.stores.coreSceneStore.getState().itemDraggedSkuID&&Dt.stores.coreSceneStore.setState({hoveredGhostIndex:kt})},onPointerLeave:zt=>{zt.event.stopPropagation(),Dt.stores.coreSceneStore.getState().itemDraggedSkuID&&Dt.stores.coreSceneStore.getState().hoveredGhostIndex===kt&&Dt.stores.coreSceneStore.setState({hoveredGhostIndex:-1})}});return jsxRuntimeExports.jsx("group",{ref:Vt,...Gt(),...Dt,children:_e})}const Ghost=({stores:kt,ghostVisibility:_e,ghostData:Dt,ghostTransform:Vt,index:Gt})=>{const zt=reactExports.useRef(),jt=reactExports.useMemo(()=>{let Wt=null;const qt=Vt?.skuID,Xt=kt?.assetStore?.getState?kt.assetStore.getState():null;return qt&&Xt?.assets?.items?.[qt]?.proxy?.data?.scene?Wt=Xt.assets.items[qt].proxy.data.scene.clone():Dt&&Dt.proxyScene?Wt=Dt.proxyScene.clone():Wt=null,Wt},[Dt,Vt,kt]),Ht=kt.coreSceneStore(Wt=>Wt.hoveredGhostIndex);return reactExports.useEffect(()=>()=>{dispose3(jt)},[jt]),reactExports.useEffect(()=>{const{current:Wt}=zt;Wt&&(Wt.userData.incomingPlugName=Vt.incomingPlugName,Wt.userData.receiverPlugName=Vt.receiverPlugName,Wt.userData.incomingPlugGUID=Vt.incomingPlugGUID,Wt.userData.receiverPlugGUID=Vt.receiverPlugGUID,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,{ghostData:Dt,ghostTransform:Vt}))},[zt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(GhostEventHandler,{stores:kt,index:Gt,children:jsxRuntimeExports.jsx(Select,{enabled:Ht===Gt,children:jsxRuntimeExports.jsx("primitive",{isGhost:!0,ref:zt,index:Gt,autoFocusEnabled:_e,position:Vt.position,scale:kt.coreSceneStore.getState().sceneSettings.ghostScale,quaternion:Vt.rotation,object:jt,castShadow:!1,receiveShadow:!1,frustumCulled:!1},`ghost${Gt}`)})})})},GhostManager=({stores:kt,intersectingGhostObject:_e=null})=>{const{camera:Dt}=useThree(),Vt=kt.ghostStore(Xt=>Xt.ghostVisibility),Gt=kt.ghostStore(Xt=>Xt.ghostData),zt=kt.ghostStore(Xt=>Xt.ghostsTransform),jt=reactExports.useRef(),{_touch2D:Ht,raycasterGhost:Wt}=reactExports.useMemo(()=>({_touch2D:new Vector2,raycasterGhost:new Raycaster}),[]);reactExports.useEffect(()=>{const{current:Xt}=jt;Xt&&kt.ghostStore.setState({ghostParentRef:Xt})},[jt]);const qt=Xt=>{let Kt=0,Yt=0;if(Xt.touches&&Xt.touches[0])Kt=Xt.touches[0].clientX,Yt=Xt.touches[0].clientY;else return;if(!kt.coreSceneStore.getState().itemDraggedSkuID)return;const Zt=kt.coreSceneStore.getState().cursorParentRef,Jt=kt.coreSceneStore.getState().canvasSize;if(!Zt)return;const nn=Zt.getBoundingClientRect(),rn=nn.top,Qt=nn.left,en=(Kt-Qt)/Jt.width*2-1,tn=(-Yt+rn)/Jt.height*2+1;Ht.set(en,tn),Wt.layers.enable(GHOST_LAYER),Wt.setFromCamera(Ht,Dt);const sn=Wt.intersectObject(kt.ghostStore.getState().ghostParentRef);sn.length>0?(_e=sn[0].object,kt.coreSceneStore.setState({hoveredGhostIndex:_e.parent.index})):(_e=null,kt.coreSceneStore.setState({hoveredGhostIndex:-1}))};return reactExports.useEffect(()=>(kt.wcRef.addEventListener("touchmove",qt,!1),LOGGER$1.info({title:"Ghost Manager Mounted!"}),()=>{const Kt=kt.wcRef;Kt&&Kt.removeEventListener("touchmove",qt,!1)}),[]),jsxRuntimeExports.jsx("group",{name:"#GRP_GhostParent",visible:Vt,scale:Vt?[1,1,1]:[0,0,0],ref:jt,children:Gt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:zt.map((Xt,Kt)=>Kt<Gt.count&&jsxRuntimeExports.jsx(Ghost,{stores:kt,ghostVisibility:Vt,ghostData:Gt,ghostTransform:Xt,index:Kt},"ghosts"+Kt))})})},ItemManager=({stores:kt})=>{const _e=kt.attachmentStore(fn=>fn),Dt=kt.itemStore(fn=>fn.removeItemTrigger),Vt=kt.itemStore(fn=>fn.variantChangeAlert),Gt=kt.hotspotStore(fn=>fn),zt=kt.coreSceneStore(fn=>fn.showDimensions),jt=kt.itemStore(fn=>fn),Ht=kt.itemStore(fn=>fn.lastDeletedItemData),Wt=kt.cameraStore(fn=>fn),qt=kt.itemStore(fn=>fn.selectedItemData),Xt=kt.itemStore(fn=>fn.itemsSpawned),Kt=kt.itemStore(fn=>fn.fittingSkuIds),Yt=kt.coreSceneStore(fn=>fn.coreReady),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(!1),rn=reactExports.useRef(null),Qt=reactExports.useRef(null),en=reactExports.useRef(!1),tn=reactExports.useRef(!1);reactExports.useRef(!1),reactExports.useRef(!1);const sn=reactExports.useCallback(async({guid:fn,node:mn,detachedData:vn,attachedChildrenGuids:_n})=>{if(nn.current===!0)return;const En=kt.attachmentStore.getState().attachmentSystem.currentStructure;return nn.current=!0,kt.cameraStore.getState().actions.canCameraRotate(!1),Gt.actions.switchHotspotsVisibility(!1,!0),rn.current={position:mn.ref.position.clone(),rotation:mn.ref.rotation.clone()},Qt.current=vn,await En.removeNodeFromStructure(mn),_n.length<=0&&(_n=!1),kt.ghostStore.getState().actions.spawnGhostsForSkuID(Xt[fn].itemData.skuID,_n)},[Wt,Xt]),cn=reactExports.useCallback(async({node:fn,intersectingGhostObject:mn,attachedChildrenGuids:vn,attachedNodesToCurrentNode:_n})=>{if(!nn.current)return;const En=kt.attachmentStore.getState().attachmentSystem.currentStructure;nn.current=!1,kt.cameraStore.getState().actions.canCameraRotate(!0),Gt.actions.switchHotspotsVisibility(!0,!0);function An(){fn.ref.position.set(0,0,0),kt.ghostStore.getState().actions.clearAllGhosts()}if(!kt.ghostStore.getState().ghostData?.connectablePlugs){An();return}En.addNode(fn);let Cn=null,yn=null,Sn=!1,wn=[],xn={};if(kt.coreSceneStore.getState().sceneSettings.ignoreCollisionPostDragging===!1&&vn.map((Rn,Dn)=>{wn[Dn]=En.checkCollisionForGUID(Rn,vn),wn[Dn]&&(xn[Rn]=Xt[Rn],En.getNodeByGUID(Rn).getAllBranchedNodesAttachedToUs().map(Pn=>{xn[Pn.guid]=Xt[Pn.guid]}))}),wn.map(Rn=>{Sn||(Sn=Rn)}),mn&&Sn){kt.coreSceneStore.setState({draggingOnDropCollisionData:{node:fn,attachedChildrenGuids:vn,collidingStatus:wn,intersectingGhostObject:mn,initPosition:rn.current.position,initRotation:rn.current.rotation,detachedPlugs:Qt.current,attachedNodesToCurrentNode:_n}}),fn.ref.position.set(mn.position.x,mn.position.y,mn.position.z),fn.ref.setRotationFromEuler(mn.rotation),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,xn);return}if(mn){const Rn=mn.userData;Cn=fn.getPlugByName(Rn.incomingPlugName),yn=En.getPlugByGUID(Rn.receiverPlugGUID),fn.ref.position.set(mn.position.x,mn.position.y,mn.position.z),fn.ref.setRotationFromEuler(mn.rotation),fn.transform={position:mn.position,rotation:mn.quaternion}}else{const Rn=Qt.current.neighborDetachedPlugs;Rn&&(Qt.current.neighborNode.detachNodeFromReceiver(),En.connectPlugs({incomingPlug:Rn.incomingPlug,receiverPlug:Rn.receiverPlug})),Cn=Qt.current.rootDetachedPlugs.incomingPlug,yn=Qt.current.rootDetachedPlugs.receiverPlug,fn.ref.position.set(rn.current.position.x,rn.current.position.y,rn.current.position.z),fn.ref.setRotationFromEuler(rn.current.rotation);let Dn=new Quaternion().identity();fn.ref.getWorldQuaternion(Dn),fn.transform={position:rn.current.position,rotation:Dn}}En.connectPlugs({incomingPlug:Cn,receiverPlug:yn}),kt.ghostStore.getState().actions.clearAllGhosts(),kt.itemStore.getState().actions.deselectItem(),_n.map(Rn=>{fn.ref.parent.attach(Rn.ref),Rn.transform={position:Rn.ref.position,rotation:Rn.ref.quaternion},fn.dragging=!1,Rn.dragging=!1}),await kt.attachmentStore.getState().actions.updateFittingSkuIds()},[Wt,kt.coreSceneStore,kt.ghostStore,_e,Xt]),un=reactExports.useCallback((fn,mn,vn)=>{if(kt.coreSceneStore.getState().sceneSettings.disableContextMenu)return;const _n=kt.attachmentStore.getState().attachmentSystem.currentStructure,En=_n.getNodeByGUID(vn);let An=[];if(!En?.myDependenciesGUID)return;En.myDependenciesGUID.map(yn=>{const Sn=_n.getNodeByGUID(yn);if(!Sn)return;let wn={guid:yn,name:Xt[yn].itemData.guid,data:{...Xt[yn],overrideVariant:Sn.overrideVariant,currentVariant:Sn.currentVariant,offsetX:fn,offsetY:mn}};An.push(wn)}),An.sort((yn,Sn)=>yn.name>Sn.name?1:Sn.name>yn.name?-1:0);let Tn=kt.inventoryStore.getState().inventoryData[Xt[vn].itemData.skuID];const Cn={primary:{guid:vn,name:Xt[vn].itemData.name,data:{inventory:Tn,...Xt[vn],overrideVariant:En.overrideVariant,currentVariant:En.currentVariant,offsetX:fn,offsetY:mn}},dependencies:An};jt.actions.setSelectedItemData(Cn.primary.data),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Show,Cn)},[Xt]),hn=reactExports.useCallback(fn=>{if(!fn)return;kt.itemStore.setState({lastDeletedItemData:{...Xt[fn]}});const mn={...Xt[fn]};delete Xt[fn],jt.actions.setItemsSpawned({...Xt}),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,mn)},[jt,kt.itemStore,Xt]);reactExports.useEffect(()=>{let fn=kt.itemStore.getState().removeItems;if(fn.length<=0&&!Ht)return;let mn=fn.pop();hn(mn)},[Dt,Ht]);const dn=reactExports.useCallback(function(fn){const mn=kt.coreSceneStore.getState().sceneSettings,vn=fn>1?!0:fn===1?Object.values(Xt)[0].itemData.skuID.toLowerCase()!=="root":!1,_n=!vn;LOGGER$1.groupCollapsed("Resolving buttons visibility"),LOGGER$1.table({sceneIsEmpty:_n,sceneIsNotEmpty:vn}),LOGGER$1.groupEnd(),mn.showViewInYourSpaceBtn===!0&&(vn&&en.current===!1?(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ViewInYourSpaceButton_Show),en.current=!0):_n&&en.current===!0&&(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ViewInYourSpaceButton_Hide),en.current=!1)),mn.showShareBtn===!0&&(vn&&tn.current===!1?(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ShareButton_Show),tn.current=!0):_n&&tn.current===!0&&(kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ShareButton_Hide),tn.current=!1))},[Xt]);reactExports.useEffect(()=>{kt.coreSceneStore.getState().preconfigurationLoaded&&kt.coreSceneStore.getState().configurationLoaded&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Xt});const fn=kt.coreSceneStore.getState().sceneSettings,mn=kt.itemStore.getState().defaultSceneItemCount;Object.keys(Xt).length===mn?kt.coreSceneStore.setState({canvasTooltipText:fn.textSettings.tooltipEmptySceneText}):Object.keys(Xt).length===mn+1&&kt.coreSceneStore.setState({canvasTooltipText:fn.textSettings.tooltipInstructionText})},[Xt]),reactExports.useEffect(()=>{Yt===!0&&dn(Object.keys(Xt).length)},[Xt,Yt]),reactExports.useEffect(()=>{if(kt.inventoryStore.getState().actions.refreshInventory(Xt),!kt.coreSceneStore.getState().preconfigurationLoaded||!kt.coreSceneStore.getState().configurationLoaded)return;async function fn(){const mn=kt.attachmentStore.getState().attachmentSystem;if(!mn)return;const vn=await mn.getCartItemsAsync();kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,vn),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,mn.currentStructure.getCurrentItemsInReplaceableCategory())}fn()},[Xt,Vt]);const pn=reactExports.useCallback((fn,mn,vn)=>{kt.coreSceneStore.getState().CORE_API.removeItemByGUID(vn),kt.coreSceneStore.getState().CORE_API.alert({alertMsg:mn+": "+fn,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return reactExports.useEffect(()=>{const{current:fn}=Jt;fn&&kt.attachmentStore.setState({colliderMeshRef:fn})},[Jt]),reactExports.useEffect(()=>{const{current:fn}=Zt;fn&&kt.coreSceneStore.setState({sceneRef:fn})},[Zt]),reactExports.useEffect(()=>{let fn=qt?kt.cameraStore.getState().cameraSettings.zoomingMultiplier:kt.cameraStore.getState().cameraSettings.zoomingMultiplier+.1;fn+=zt?.3:.1,kt.cameraStore.setState({boundsMargin:fn}),kt.coreSceneStore.getState().actions.triggerAutoFocus()},[zt,qt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Kt})},[Kt]),reactExports.useEffect(()=>{const fn=kt.itemStore.getState().itemsSpawned;if(LOGGER$1.info({title:"item Manager mounted"}),!kt.coreSceneStore.getState().preconfigurationLoaded)kt.attachmentStore.getState().actions.loadDefaultStructure();else if(Object.keys(fn).length===1){const mn=Object.keys(fn)[0];kt.itemStore.getState().actions.resolvePlugDependencyOnGUID(mn)}},[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("group",{name:"Scene",ref:Zt,onPointerMissed:()=>{qt&&jt.actions.deselectItem(),kt.hotspotStore.getState().isAnyHotspotActive&&kt.hotspotStore.getState().actions.exitHotspot()},children:[jsxRuntimeExports.jsx("group",{name:"#GRP_EXCLUDED"}),jsxRuntimeExports.jsxs("group",{name:"#ITEMS_AND_GHOSTS",children:[jsxRuntimeExports.jsx("group",{name:"#ITEMS",children:Object.keys(Xt).map((fn,mn)=>jsxRuntimeExports.jsx(SceneItem,{stores:kt,scale:[1,1,1],onDragStartHandler:sn,onDragEndHandler:cn,onItemClickHandler:un,itemKey:Xt[fn],position:Xt[fn].itemData.position,rotation:Xt[fn].itemData.rotation,itemIndex:mn,proxyScene:Xt[fn].itemData.proxyScene,rejectFunc:pn,proxyOnly:Xt[fn].itemData.gltfURL==""},fn))}),jsxRuntimeExports.jsx(GhostManager,{stores:kt})]})]}),jsxRuntimeExports.jsx("group",{name:"#Parent_ColliderMesh",children:jsxRuntimeExports.jsx("mesh",{ref:Jt,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:jsxRuntimeExports.jsx("meshPhongMaterial",{depthTest:!1,transparent:!0,opacity:.8})})})]})},ContactShadows=reactExports.forwardRef(({scale:kt=10,frames:_e=1/0,excludeLayer:Dt=-1,bbmin:Vt=1,bbmax:Gt=1,opacity:zt=1,width:jt=1,height:Ht=1,blur:Wt=1,near:qt=0,far:Xt=10,resolution:Kt=512,smooth:Yt=!0,color:Zt="#000000",depthWrite:Jt=!1,renderOrder:nn,...rn},Qt)=>{const en=reactExports.useRef(null),tn=useThree(Cn=>Cn.scene),sn=useThree(Cn=>Cn.gl),cn=reactExports.useRef(null);jt=jt*(Array.isArray(kt)?kt[0]:kt||1),Ht=Ht*(Array.isArray(kt)?kt[1]:kt||1);const[un,hn,dn,pn,fn,mn,vn]=reactExports.useMemo(()=>{const Cn=new WebGLRenderTarget(Kt,Kt),yn=new WebGLRenderTarget(Kt,Kt);yn.texture.generateMipmaps=Cn.texture.generateMipmaps=!1;const Sn=new PlaneGeometry(jt,Ht).rotateX(Math.PI/2),wn=new Mesh(Sn),xn=new MeshDepthMaterial;xn.depthTest=xn.depthWrite=!1,xn.onBeforeCompile=kn=>{kn.uniforms={...kn.uniforms,ucolor:{value:new Color$1(Zt)}},kn.fragmentShader=kn.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
4462
4462
  void main() {
4463
- `),kn.fragmentShader=kn.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Rn=new ShaderMaterial(HorizontalBlurShader),Dn=new ShaderMaterial(VerticalBlurShader);return Dn.depthTest=Rn.depthTest=!1,[Cn,Sn,xn,wn,Rn,Dn,yn]},[Kt,jt,Ht,kt,Zt]),_n=Cn=>{pn.visible=!0,pn.material=fn,fn.uniforms.tDiffuse.value=un.texture,fn.uniforms.h.value=Cn*1/256,sn.setRenderTarget(vn),sn.render(pn,cn.current),pn.material=mn,mn.uniforms.tDiffuse.value=vn.texture,mn.uniforms.v.value=Cn*1/256,sn.setRenderTarget(un),sn.render(pn,cn.current),pn.visible=!1};let En=0,An,Tn;return useFrame(()=>{cn.current&&(_e===1/0||En<_e)&&(En++,An=tn.background,Tn=tn.overrideMaterial,en.current.visible=!1,tn.background=null,tn.overrideMaterial=dn,sn.setRenderTarget(un),sn.render(tn,cn.current),_n(Wt),Yt&&_n(Wt*.4),sn.setRenderTarget(null),en.current.visible=!0,tn.overrideMaterial=Tn,tn.background=An)}),reactExports.useEffect(()=>()=>{cn.current&&cn.current.layers.disable(Dt)},[cn]),reactExports.useEffect(()=>()=>{un.dispose(),vn.dispose(),hn.dispose(),dn.dispose(),pn.geometry.dispose(),fn.dispose(),mn.dispose()},[]),reactExports.useImperativeHandle(Qt,()=>en.current,[]),reactExports.createElement("group",_extends$1({"rotation-x":Math.PI/2},rn,{ref:en}),reactExports.createElement("mesh",{renderOrder:nn,geometry:hn,layers:2,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},reactExports.createElement("meshBasicMaterial",{transparent:!0,map:un.texture,opacity:zt,depthWrite:Jt})),reactExports.createElement("orthographicCamera",{ref:cn,args:[-jt/2,jt/2,Ht/2,-Ht/2,qt,Xt]}))}),EffectsComposer=({stores:kt})=>{const[_e,Dt]=reactExports.useState(10),Vt=kt.coreSceneStore(Wt=>Wt.bbox),Gt=kt.itemStore(Wt=>Wt.itemsSpawned),zt=kt.ghostStore(Wt=>Wt.ghostsTransform),jt=kt.coreSceneStore(Wt=>Wt.sceneSettings),Ht=kt.coreSceneStore(Wt=>Wt.shadowRefreshKey);return reactExports.useEffect(()=>{zt.length===0&&kt.coreSceneStore.getState().actions.refreshShadows()},[Gt,zt]),reactExports.useEffect(()=>{if(!Vt||!Vt.isBox3){Dt(10);return}const Wt=new Vector3(0,0,0);let qt=Wt.distanceTo(Vt.min)*2,Xt=Wt.distanceTo(Vt.max)*2,Kt=Xt>qt?Xt:qt;Kt!=1/0&&Kt!=-1/0&&(Kt+=5,Dt(Kt||10))},[Vt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(EffectComposer,{multisampling:4,autoClear:!1,disableNormalPass:!0,children:[jsxRuntimeExports.jsx(ToneMapping,{mode:ToneMappingMode.ACES_FILMIC,blendFunction:BlendFunction.NORMAL,adaptive:!1,resolution:256,maxLuminance:40,middleGrey:5}),jsxRuntimeExports.jsx(Outline,{...jt.outlineSettings})]}),jt.contactShadowVisibility&&jsxRuntimeExports.jsx(ContactShadows,{excludeLayer:GHOST_LAYER,position:[0,0,0],opacity:.3,scale:_e,blur:.35,far:2,resolution:256,frames:1},Ht)]})};function Hotspot({stores:kt,hotspotKey:_e}){const Dt=kt.coreSceneStore(tn=>tn.sceneSettings),Vt=kt.attachmentStore(tn=>tn.attachmentSystem),Gt=kt.hotspotStore(tn=>tn),zt=kt.hotspotStore(tn=>tn.activeHotspotData),jt=kt.itemStore(tn=>tn.lastDeletedItemData),Ht=kt.ghostStore(tn=>tn.ghostData),Wt=kt.hotspotStore(tn=>tn.actions),qt=kt.hotspotStore(tn=>tn.hotspotsVisibility),Xt=kt.hotspotStore(tn=>tn.hotspotsTempVisibility),[Kt,Yt]=reactExports.useState(null),[Zt,Jt]=reactExports.useState(!1),nn=reactExports.useRef(null),rn=reactExports.useRef(null),Qt=reactExports.useRef(null),en=reactExports.useCallback(tn=>{tn.includes(_e.itemData.skuID+"_"+_e.hotspotData.hotspotID)&&Jt(!0)},[_e]);return reactExports.useEffect(()=>en(Gt.visitedHotspotsID),[Gt,en]),reactExports.useEffect(()=>{Yt(zt?zt.hotspotData.guid:null)},[zt]),reactExports.useEffect(()=>{rn.current&&(Kt===_e.hotspotData.guid?rn.current.parentNode.classList.add("topmostActive"):rn.current.parentNode.classList.remove("topmostActive"))},[Kt]),reactExports.useEffect(()=>{nn.current&&Kt===_e.hotspotData.guid&&(nn.current.style.opacity=1)},[Kt,nn]),reactExports.useEffect(()=>{if(!Qt.current&&!jt)return;let tn=Vt.currentStructure.getNodeByGUID(_e.itemData.guid);tn?.ref&&(Qt.current.parent=tn.ref)},[Qt,Vt,qt,jt]),jsxRuntimeExports.jsx("group",{ref:Qt,position:_e.hotspotData.hotspotPointTransform,children:jsxRuntimeExports.jsx(Html,{ref:rn,zIndexRange:[6,0],style:qt&&Xt&&!Ht&&Dt.showHotspotsBtn?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:jsxRuntimeExports.jsxs("button",{style:{display:_e.hotspotData.visibleInScene==!1?"none":"block"},ref:nn,className:Kt===_e.hotspotData.guid?"hotspot hotspot-0 active":Zt?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:tn=>{tn.stopPropagation(),nn.current&&Kt!==_e.hotspotData.guid&&(nn.current.getClientRects()[0].left>kt.coreSceneStore.getState().canvasSize.width/1.6?nn.current.classList.add("left"):nn.current.classList.remove("left")),rn.current&&rn.current.parentNode.classList.add("topmostHover")},onPointerLeave:tn=>{tn.stopPropagation(),rn.current&&rn.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+_e.itemData.skuID+"_"+_e.hotspotData.hotspotID,role:"button",tabIndex:0,"aria-label":_e.hotspotData.title,onClick:tn=>{if(tn.stopPropagation(),Gt.isAnyHotspotActive&&Gt.activeHotspotData.hotspotData.guid===_e.hotspotData.guid){Wt.exitHotspot();return}Wt.clickHotspot(_e.hotspotData.hotspotID,_e.hotspotData.guid,_e.itemData.guid)},children:[jsxRuntimeExports.jsx("span",{className:"inner-circle"}),jsxRuntimeExports.jsx("span",{className:"hotspot-annotation",children:_e.hotspotData.title})]})})})}const HotspotManager=({stores:kt})=>{const{camera:_e}=useThree(),Dt=reactExports.useRef(null),Vt=reactExports.useRef(0),[Gt,zt]=reactExports.useState(null),jt=kt.hotspotStore(Qt=>Qt),Ht=kt.hotspotStore(Qt=>Qt.hotspotsHealthCheck),Wt=kt.itemStore(Qt=>Qt.lastDeletedItemData),qt=kt.hotspotStore(Qt=>Qt.hotspotsSpawned),Xt=kt.itemStore(Qt=>Qt.itemsSpawned),Kt=kt.hotspotStore(Qt=>Qt.activeHotspotData),{raycasterHotspot:Yt,worldPos:Zt}=reactExports.useMemo(()=>({raycasterHotspot:new Raycaster,worldPos:new Vector3}),[]),Jt=reactExports.useCallback(()=>{const Qt=kt.hotspotStore.getState().hotspotSpawnedForCategoryIDs,en=kt.attachmentStore.getState().attachmentSystem.globalGeometryVariants;Object.entries(Xt).forEach(([tn,sn])=>{if(!sn.hotspotsData)return;let cn=!1;Object.entries(qt).forEach(([un,hn])=>{const dn=hn.hotspotData.geometryVariantID;if(dn&&!Object.values(en).includes(dn)){cn=!0;const pn=hn.hotspotData.categoryID;Qt.splice(Qt.indexOf(pn),1),delete qt[un]}}),cn&&kt.hotspotStore.setState({hotspotSpawned:{...qt},hotspotSpawnedForCategoryIDs:Qt}),sn.hotspotsData.forEach(un=>{un.geometryVariantID&&!Object.values(en).includes(un.geometryVariantID)||un.categoryID!==""&&Qt.includes(un.categoryID)||(sn.hotspotSpawned=!0,Qt.push(un.categoryID),nn(tn,un))})})},[Xt,qt]),nn=reactExports.useCallback((Qt,en)=>{const tn=`${Xt[Qt].itemData.skuID}_${en.hotspotID}`;qt[tn]={itemData:{guid:Qt,...Xt[Qt].itemData},hotspotData:{guid:tn,...en}},kt.hotspotStore.setState({hotspotsSpawned:{...qt}})},[Xt,jt,qt]);reactExports.useEffect(()=>{if(!Wt?.itemData)return;if(Wt.hotspotSpawned){kt.hotspotStore.getState().actions.removeHotspotForItem({...Wt});const en=kt.hotspotStore.getState().hotspotSpawnedForCategoryIDs,tn=Wt.hotspotsData.map(sn=>sn.categoryID);filterArrWithCondition(en,sn=>!tn.includes(sn)),kt.hotspotStore.setState({hotspotSpawnedForCategoryIDs:en})}kt.itemStore.setState({lastDeletedItemData:null});const Qt=kt.attachmentStore.getState().attachmentSystem;Qt.currentStructure.removeNodeByGUID(Wt.itemData.guid),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,Qt.currentStructure.materialOverrideExists()),kt.coreSceneStore.getState().actions.triggerAutoFocus()},[Wt]);const rn=(Qt,en)=>{const tn=Qt.clone().sub(_e.position),sn=tn.length();Yt.set(_e.position,tn.normalize());const cn=Yt.intersectObject(kt.coreSceneStore.getState().sceneRef);en.style.opacity=cn.length>0&&cn[0].distance<sn||Gt?.5:1};return reactExports.useEffect(()=>{zt(Kt?.hotspotData.guid||null)},[Kt]),useFrame(()=>{if(!Dt.current||Dt.current.children.length===0)return;Vt.current=(Vt.current+1)%Dt.current.children.length;const Qt=Object.keys(qt)[Vt.current];if(!qt[Qt])return;const en=`hotspot3D_${qt[Qt].itemData.skuID}_${qt[Qt].hotspotData.hotspotID}`,tn=kt.coreSceneStore.getState().CORE_API.coreWCRef.shadowRootRef.getElementById(en);Gt===Qt||!tn||(Dt.current.children[Vt.current].getWorldPosition(Zt),rn(Zt,tn))}),reactExports.useEffect(()=>{Jt()},[Object.keys(Xt).length,Ht]),reactExports.useEffect(()=>()=>{kt.hotspotStore.setState({hotspotsSpawned:{}}),kt.hotspotStore.setState({hotspotSpawnedForCategoryIDs:[]})},[]),jt.hotspotsVisibility&&jsxRuntimeExports.jsx("group",{name:"#GRP_HotspotManager",ref:Dt,children:Object.entries(qt).map(([Qt,en])=>jsxRuntimeExports.jsx(Hotspot,{stores:kt,hotspotKey:en},Qt))})};var objectTypes$3={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},lodash__objecttypes=objectTypes$3,objectTypes$2=lodash__objecttypes;function isObject$4(kt){return!!(kt&&objectTypes$2[typeof kt])}var lodash_isobject=isObject$4,objectProto$1=Object.prototype,toString=objectProto$1.toString,reNative$4=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),lodash__renative=reNative$4,objectTypes$1=lodash__objecttypes,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,shimKeys$1=function(kt){var _e,Dt=kt,Vt=[];if(!Dt||!objectTypes$1[typeof kt])return Vt;for(_e in Dt)hasOwnProperty.call(Dt,_e)&&Vt.push(_e);return Vt},lodash__shimkeys=shimKeys$1,isObject$3=lodash_isobject,reNative$3=lodash__renative,shimKeys=lodash__shimkeys,nativeKeys=reNative$3.test(nativeKeys=Object.keys)&&nativeKeys,keys$2=nativeKeys?function(kt){return isObject$3(kt)?nativeKeys(kt):[]}:shimKeys,lodash_keys=keys$2;function noop$1(){}var lodash_noop=noop$1,isObject$2=lodash_isobject,reNative$2=lodash__renative,nativeCreate=reNative$2.test(nativeCreate=Object.create)&&nativeCreate;function baseCreate$2(kt,_e){return isObject$2(kt)?nativeCreate(kt):{}}nativeCreate||(baseCreate$2=function(){function kt(){}return function(_e){if(isObject$2(_e)){kt.prototype=_e;var Dt=new kt;kt.prototype=null}return Dt||commonjsGlobal.Object()}}());var lodash__basecreate=baseCreate$2,noop=lodash_noop,reNative$1=lodash__renative,descriptor={configurable:!1,enumerable:!1,value:null,writable:!1},defineProperty=function(){try{var kt={},_e=reNative$1.test(_e=Object.defineProperty)&&_e,Dt=_e(kt,kt,kt)&&_e}catch{}return Dt}(),setBindData$3=defineProperty?function(kt,_e){descriptor.value=_e,defineProperty(kt,"__bindData__",descriptor)}:noop,lodash__setbinddata=setBindData$3,baseCreate$1=lodash__basecreate,isObject$1=lodash_isobject,setBindData$2=lodash__setbinddata,arrayRef$2=[],push$2=arrayRef$2.push;function baseBind$1(kt){var _e=kt[0],Dt=kt[2],Vt=kt[4];function Gt(){if(Dt){var zt=Dt.slice();push$2.apply(zt,arguments)}if(this instanceof Gt){var jt=baseCreate$1(_e.prototype),Ht=_e.apply(jt,zt||arguments);return isObject$1(Ht)?Ht:jt}return _e.apply(Vt,zt||arguments)}return setBindData$2(Gt,kt),Gt}var lodash__basebind=baseBind$1;function slice$2(kt,_e,Dt){_e||(_e=0),typeof Dt>"u"&&(Dt=kt?kt.length:0);for(var Vt=-1,Gt=Dt-_e||0,zt=Array(Gt<0?0:Gt);++Vt<Gt;)zt[Vt]=kt[_e+Vt];return zt}var lodash__slice=slice$2,baseCreate=lodash__basecreate,isObject=lodash_isobject,setBindData$1=lodash__setbinddata,slice$1=lodash__slice,arrayRef$1=[],push$1=arrayRef$1.push;function baseCreateWrapper$1(kt){var _e=kt[0],Dt=kt[1],Vt=kt[2],Gt=kt[3],zt=kt[4],jt=kt[5],Ht=Dt&1,Wt=Dt&2,qt=Dt&4,Xt=Dt&8,Kt=_e;function Yt(){var Zt=Ht?zt:this;if(Vt){var Jt=Vt.slice();push$1.apply(Jt,arguments)}if((Gt||qt)&&(Jt||(Jt=slice$1(arguments)),Gt&&push$1.apply(Jt,Gt),qt&&Jt.length<jt))return Dt|=16,baseCreateWrapper$1([_e,Xt?Dt:Dt&-4,Jt,null,zt,jt]);if(Jt||(Jt=arguments),Wt&&(_e=Zt[Kt]),this instanceof Yt){Zt=baseCreate(_e.prototype);var nn=_e.apply(Zt,Jt);return isObject(nn)?nn:Zt}return _e.apply(Zt,Jt)}return setBindData$1(Yt,kt),Yt}var lodash__basecreatewrapper=baseCreateWrapper$1;function isFunction$1(kt){return typeof kt=="function"}var lodash_isfunction=isFunction$1,baseBind=lodash__basebind,baseCreateWrapper=lodash__basecreatewrapper,isFunction=lodash_isfunction,arrayRef=[],push=arrayRef.push;function createWrapper$1(kt,_e,Dt,Vt,Gt,zt){var jt=_e&1,Ht=_e&2,Wt=_e&4,qt=_e&16,Xt=_e&32;if(!Ht&&!isFunction(kt))throw new TypeError;qt&&!Dt.length&&(_e&=-17,qt=Dt=!1),Xt&&!Vt.length&&(_e&=-33,Xt=Vt=!1);var Kt=kt&&kt.__bindData__;if(Kt&&Kt!==!0)return Kt=Kt.slice(),jt&&!(Kt[1]&1)&&(Kt[4]=Gt),!jt&&Kt[1]&1&&(_e|=8),Wt&&!(Kt[1]&4)&&(Kt[5]=zt),qt&&push.apply(Kt[2]||(Kt[2]=[]),Dt),Xt&&push.apply(Kt[3]||(Kt[3]=[]),Vt),Kt[1]|=_e,createWrapper$1.apply(null,Kt);var Yt=_e==1||_e===17?baseBind:baseCreateWrapper;return Yt([kt,_e,Dt,Vt,Gt,zt])}var lodash__createwrapper=createWrapper$1,createWrapper=lodash__createwrapper,slice=lodash__slice;function bind$1(kt,_e){return arguments.length>2?createWrapper(kt,17,slice(arguments,2),null,_e):createWrapper(kt,1,null,null,_e)}var lodash_bind=bind$1;function identity$1(kt){return kt}var lodash_identity=identity$1,reNative=lodash__renative,reThis$1=/\bthis\b/,support$1={};support$1.funcDecomp=!reNative.test(commonjsGlobal.WinRTError)&&reThis$1.test(function(){return this});support$1.funcNames=typeof Function.name=="string";var lodash_support=support$1,bind=lodash_bind,identity=lodash_identity,setBindData=lodash__setbinddata,support=lodash_support,reFuncName=/^\s*function[ \n\r\t]+\w/,reThis=/\bthis\b/,fnToString=Function.prototype.toString;function baseCreateCallback$2(kt,_e,Dt){if(typeof kt!="function")return identity;if(typeof _e>"u"||!("prototype"in kt))return kt;var Vt=kt.__bindData__;if(typeof Vt>"u"&&(support.funcNames&&(Vt=!kt.name),Vt=Vt||!support.funcDecomp,!Vt)){var Gt=fnToString.call(kt);support.funcNames||(Vt=!reFuncName.test(Gt)),Vt||(Vt=reThis.test(Gt),setBindData(kt,Vt))}if(Vt===!1||Vt!==!0&&Vt[1]&1)return kt;switch(Dt){case 1:return function(zt){return kt.call(_e,zt)};case 2:return function(zt,jt){return kt.call(_e,zt,jt)};case 3:return function(zt,jt,Ht){return kt.call(_e,zt,jt,Ht)};case 4:return function(zt,jt,Ht,Wt){return kt.call(_e,zt,jt,Ht,Wt)}}return bind(kt,_e)}var lodash__basecreatecallback=baseCreateCallback$2,baseCreateCallback$1=lodash__basecreatecallback,keys$1=lodash_keys,objectTypes=lodash__objecttypes,forOwn$1=function(kt,_e,Dt){var Vt,Gt=kt,zt=Gt;if(!Gt||!objectTypes[typeof Gt])return zt;_e=_e&&typeof Dt>"u"?_e:baseCreateCallback$1(_e,Dt,3);for(var jt=-1,Ht=objectTypes[typeof Gt]&&keys$1(Gt),Wt=Ht?Ht.length:0;++jt<Wt;)if(Vt=Ht[jt],_e(Gt[Vt],Vt,kt)===!1)return zt;return zt},lodash_forown=forOwn$1,baseCreateCallback=lodash__basecreatecallback,forOwn=lodash_forown;function forEach(kt,_e,Dt){var Vt=-1,Gt=kt?kt.length:0;if(_e=_e&&typeof Dt>"u"?_e:baseCreateCallback(_e,Dt,3),typeof Gt=="number")for(;++Vt<Gt&&_e(kt[Vt],Vt,kt)!==!1;);else forOwn(kt,_e);return kt}var lodash_foreach=forEach,metric$b,imperial$9;metric$b={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}};imperial$9={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}};var length={metric:metric$b,imperial:imperial$9,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},metric$a,imperial$8;metric$a={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}};imperial$8={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}};var area={metric:metric$a,imperial:imperial$8,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},metric$9,imperial$7;metric$9={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}};imperial$7={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}};var mass={metric:metric$9,imperial:imperial$7,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},metric$8,imperial$6;metric$8={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}};imperial$6={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}};var volume={metric:metric$8,imperial:imperial$6,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},metric$7;metric$7={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var each$1={metric:metric$7,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},metric$6,imperial$5;metric$6={C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}};imperial$5={F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}};var temperature={metric:metric$6,imperial:imperial$5,_anchors:{metric:{unit:"C",transform:function(kt){return kt/(5/9)+32}},imperial:{unit:"F",transform:function(kt){return(kt-32)*(5/9)}}}},time,daysInYear=365.25;time={ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:60*60},d:{name:{singular:"Day",plural:"Days"},to_anchor:60*60*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:60*60*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:60*60*24*daysInYear/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*daysInYear}};var time_1={metric:time,_anchors:{metric:{unit:"s",ratio:1}}},bits,bytes;bits={b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}};bytes={B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}};var digital={bits,bytes,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},metric$5;metric$5={ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}};var partsPer={metric:metric$5,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},metric$4,imperial$4;metric$4={"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}};imperial$4={"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}};var speed={metric:metric$4,imperial:imperial$4,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},metric$3,imperial$3;metric$3={"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}};imperial$3={"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}};var pace={metric:metric$3,imperial:imperial$3,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},metric$2,imperial$2;metric$2={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}};imperial$2={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}};var pressure={metric:metric$2,imperial:imperial$2,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},current;current={A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}};var current_1={metric:current,_anchors:{metric:{unit:"A",ratio:1}}},voltage;voltage={V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}};var voltage_1={metric:voltage,_anchors:{metric:{unit:"V",ratio:1}}},power;power={W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}};var power_1={metric:power,_anchors:{metric:{unit:"W",ratio:1}}},reactivePower;reactivePower={VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}};var reactivePower_1={metric:reactivePower,_anchors:{metric:{unit:"VAR",ratio:1}}},apparentPower;apparentPower={VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}};var apparentPower_1={metric:apparentPower,_anchors:{metric:{unit:"VA",ratio:1}}},energy;energy={Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}};var energy_1={metric:energy,_anchors:{metric:{unit:"J",ratio:1}}},reactiveEnergy;reactiveEnergy={VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}};var reactiveEnergy_1={metric:reactiveEnergy,_anchors:{metric:{unit:"VARh",ratio:1}}},metric$1,imperial$1;metric$1={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}};imperial$1={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}};var volumeFlowRate={metric:metric$1,imperial:imperial$1,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},metric,imperial;metric={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};imperial={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var illuminance={metric,imperial,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},frequency;frequency={mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}};var frequency_1={metric:frequency,_anchors:{frequency:{unit:"hz",ratio:1}}},angle;angle={rad:{name:{singular:"radian",plural:"radians"},to_anchor:180/Math.PI},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:9/10},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:1/60},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:1/3600}};var angle_1={metric:angle,_anchors:{metric:{unit:"deg",ratio:1}}},convert,keys=lodash_keys,each=lodash_foreach,measures={length,area,mass,volume,each:each$1,temperature,time:time_1,digital,partsPer,speed,pace,pressure,current:current_1,voltage:voltage_1,power:power_1,reactivePower:reactivePower_1,apparentPower:apparentPower_1,energy:energy_1,reactiveEnergy:reactiveEnergy_1,volumeFlowRate,illuminance,frequency:frequency_1,angle:angle_1},Converter;Converter=function(kt,_e){_e?this.val=kt/_e:this.val=kt};Converter.prototype.from=function(kt){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(kt),this.origin||this.throwUnsupportedUnitError(kt),this};Converter.prototype.to=function(kt){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(kt);var _e,Dt;if(this.destination||this.throwUnsupportedUnitError(kt),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!=this.origin.measure)throw new Error("Cannot convert incompatible measures of "+this.destination.measure+" and "+this.origin.measure);return _e=this.val*this.origin.unit.to_anchor,this.origin.unit.anchor_shift&&(_e-=this.origin.unit.anchor_shift),this.origin.system!=this.destination.system&&(Dt=measures[this.origin.measure]._anchors[this.origin.system].transform,typeof Dt=="function"?_e=Dt(_e):_e*=measures[this.origin.measure]._anchors[this.origin.system].ratio),this.destination.unit.anchor_shift&&(_e+=this.destination.unit.anchor_shift),_e/this.destination.unit.to_anchor};Converter.prototype.toBest=function(_e){if(!this.origin)throw new Error(".toBest must be called after .from");var _e=Object.assign({exclude:[],cutOffNumber:1},_e),Dt;return each(this.possibilities(),function(Vt){var Gt=this.describe(Vt),zt=_e.exclude.indexOf(Vt)===-1;if(zt&&Gt.system===this.origin.system){var jt=this.to(Vt);(!Dt||jt>=_e.cutOffNumber&&jt<Dt.val)&&(Dt={val:jt,unit:Vt,singular:Gt.singular,plural:Gt.plural})}}.bind(this)),Dt};Converter.prototype.getUnit=function(kt){var _e;return each(measures,function(Dt,Vt){if(each(Dt,function(Gt,zt){if(zt=="_anchors"||(each(Gt,function(jt,Ht){if(Ht==kt)return _e={abbr:kt,measure:Vt,system:zt,unit:jt},!1}),_e))return!1}),_e)return!1}),_e};var describe=function(kt){return{abbr:kt.abbr,measure:kt.measure,system:kt.system,singular:kt.unit.name.singular,plural:kt.unit.name.plural}};Converter.prototype.describe=function(kt){var _e=Converter.prototype.getUnit(kt),Dt=null;try{Dt=describe(_e)}catch{this.throwUnsupportedUnitError(kt)}return Dt};Converter.prototype.list=function(kt){var _e=[];return each(measures,function(Dt,Vt){kt&&kt!==Vt||each(Dt,function(Gt,zt){if(zt=="_anchors")return!1;each(Gt,function(jt,Ht){_e=_e.concat(describe({abbr:Ht,measure:Vt,system:zt,unit:jt}))})})}),_e};Converter.prototype.throwUnsupportedUnitError=function(kt){var _e=[];throw each(measures,function(Dt,Vt){each(Dt,function(Gt,zt){if(zt=="_anchors")return!1;_e=_e.concat(keys(Gt))})}),new Error("Unsupported unit "+kt+", use one of: "+_e.join(", "))};Converter.prototype.possibilities=function(kt){var _e=[];return!this.origin&&!kt?each(keys(measures),function(Dt){each(measures[Dt],function(Vt,Gt){if(Gt=="_anchors")return!1;_e=_e.concat(keys(Vt))})}):(kt=kt||this.origin.measure,each(measures[kt],function(Dt,Vt){if(Vt=="_anchors")return!1;_e=_e.concat(keys(Dt))})),_e};Converter.prototype.measures=function(){return keys(measures)};convert=function(kt){return new Converter(kt)};var lib=convert;const convert$1=getDefaultExportFromCjs(lib),DimensionsManager=({stores:kt})=>{const _e=kt.itemStore(Jt=>Jt.itemsSpawned),{showDimensions:Dt,sceneSettings:Vt,boundData:Gt}=kt.coreSceneStore(),{sceneScaleUnit:zt,sceneScaleDisplayUnit:jt}=Vt||{},Ht=reactExports.useRef(null),Wt=reactExports.useRef(0),qt=reactExports.useMemo(()=>{if(!Vt)return"#000000";const{r:Jt,g:nn,b:rn}=Vt.dimensionColor;return rgbToHex(Jt,nn,rn)},[Vt]),[Xt,Kt]=reactExports.useMemo(()=>{if(!Gt||!Gt.size)return[.2,.01];const Jt=Math.min(Gt.size.x,Gt.size.z),nn=Math.min(Jt/20,.005);return[Math.min(Jt,.2),nn]},[Gt]);reactExports.useEffect(()=>{Wt.current=0},[Dt]),useFrame(()=>{Ht.current&&Wt.current<1&&(Wt.current+=.05,Ht.current.scale.set(Wt.current,Wt.current,Wt.current))});const Yt=Jt=>jsxRuntimeExports.jsxs(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(Jt).from("m").to(zt).toFixed(Vt.measurementPrecision),jt??zt]}),Zt=(Jt,nn,rn,Qt)=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(RoundedBox,{position:Jt,rotation:nn,scale:rn,visible:!0,children:[jsxRuntimeExports.jsx(RoundedBox,{position:[0,.5,0],scale:Qt==="z"?[7,Kt,1]:[1,Kt,7],visible:!0,children:jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt})}),jsxRuntimeExports.jsx(RoundedBox,{position:[0,-.5,0],scale:Qt==="z"?[7,Kt,1]:[1,Kt,7],visible:!0,children:jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt})}),jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt}),Yt(Gt.size[Qt])]})});return!Dt||!Gt||Object.keys(Gt.size).some(Jt=>Gt.size[Jt]===0)||Object.keys(_e).length===0?null:jsxRuntimeExports.jsxs("group",{ref:Ht,children:[Zt([Gt.center.x,Gt.center.y-Gt.size.y/2,Gt.center.z+Gt.size.z/2+Xt],[0,0,degToRad(90)],[Kt,Gt.size.x,Kt],"x"),Zt([Gt.center.x-Gt.size.x/2-Xt,Gt.center.y,Gt.center.z+Gt.size.z/2+Xt],[0,0,0],[Kt,Gt.size.y,Kt],"y"),Zt([Gt.center.x+Gt.size.x/2+Xt,Gt.center.y-Gt.size.y/2,Gt.center.z],[degToRad(90),0,0],[Kt,Gt.size.z,Kt],"z")]})},BaseScene=({stores:kt})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HotspotManager,{stores:kt}),jsxRuntimeExports.jsx(DimensionsManager,{stores:kt}),jsxRuntimeExports.jsxs(Selection$1,{children:[jsxRuntimeExports.jsx(ItemManager,{stores:kt}),jsxRuntimeExports.jsx(EffectsComposer,{stores:kt})]})]}),CameraManager=({stores:kt})=>{const _e=reactExports.useRef(null),Dt=kt.hotspotStore(Jt=>Jt.isAnyHotspotActive),Vt=kt.cameraStore(Jt=>Jt.cameraSettings),Gt=kt.cameraStore(Jt=>Jt.disableAutoRotate),zt=kt.coreSceneStore(Jt=>Jt.autoFocusTrigger),jt=kt.coreSceneStore(Jt=>Jt.dragging),Ht=kt.cameraStore(Jt=>Jt.sendCameraDetailsTrigger),Wt=kt.cameraStore(Jt=>Jt.focusPointPosition),qt=kt.cameraStore(Jt=>Jt.viewPointPosition),{raycaster:Xt,camera:Kt}=useThree(),Yt=kt.ghostStore(Jt=>Jt.ghostsTransform),Zt=()=>{if(_e.current===null)return;const nn=1/_e.current._lastZoom,rn=kt.cameraStore.getState().boundsMargin,Qt=kt.coreSceneStore.getState().autoFocusRef;let en=new Box3;Qt?en.setFromObject(Qt):kt.coreSceneStore.getState().sceneRef.traverse(sn=>{sn.autoFocusEnabled&&en.expandByObject(sn)}),Qt||kt.coreSceneStore.setState({bbox:en});const tn=new Vector3;if(en.getSize(tn),tn.x>0){const sn=new Vector3;en.getCenter(sn);const cn=new Vector3(en.max.x,en.max.y,en.max.z);cn.sub(en.min),kt.coreSceneStore.setState({boundData:{center:sn,size:cn}}),_e.current.setBoundary(en);const un=new Box3(en.min,en.max);un.min=new Vector3((un.min.x-rn/2)*nn,(un.min.y-rn/2)*nn,(un.min.z-rn/2)*nn),un.max=new Vector3((un.max.x+rn/2)*nn,(un.max.y+rn/2)*nn,(un.max.z+rn/2)*nn);const hn=un.getBoundingSphere(new Sphere(sn));hn.radius>0&&_e.current.fitToSphere(hn,!0)}else{const sn=new Vector3(0,0,0),cn=new Vector3(0,0,0);kt.coreSceneStore.setState({boundData:{center:sn,size:cn}})}_e.current.zoomTo(1,!0)};return reactExports.useEffect(()=>{Zt()},[zt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API!=null&&(kt.itemStore.getState().isBusy()||(kt.coreSceneStore.getState().sceneSettings.focusCameraOnGhosts===!0?kt.coreSceneStore.getState().CORE_API.focusOnGhosts():kt.coreSceneStore.getState().CORE_API.refocus()))},[Yt]),reactExports.useEffect(()=>{if(_e.current===null)return;const Jt=kt.cameraStore.getState().savedState,nn=kt.cameraStore.getState().resetToLastPosition;if(Dt===!1){Jt===!0&&(nn===!0?_e.current.reset(!0):kt.cameraStore.setState({resetToLastPosition:!0}),kt.cameraStore.setState({savedState:!1}));return}Jt===!1&&nn===!0&&(_e.current.saveState(),kt.cameraStore.setState({savedState:!0})),_e.current.setLookAt(qt.x,qt.y,qt.z,Wt.x,Wt.y,Wt.z,!0)},[Dt,qt,Wt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API!=null&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.CONFIGURATION.CameraDetails_Update,Kt)},[Ht]),useFrame(Jt=>{Vt.canAutoRotate===!1||_e.current===null||Gt===!1&&Dt===!1&&(_e.current.azimuthAngle+=20*Jt*MathUtils.DEG2RAD*Vt.autoRotateSpeed)}),reactExports.useEffect(()=>{_e.current!==null&&(Vt.canZoom===!0&&jt===!1?(_e.current.mouseButtons.wheel=CAMERA_ACTION.ZOOM,_e.current.mouseButtons.middle=CAMERA_ACTION.ZOOM):(_e.current.mouseButtons.wheel=CAMERA_ACTION.NONE,_e.current.mouseButtons.middle=CAMERA_ACTION.NONE),Vt.canPan===!0&&jt===!1?(_e.current.mouseButtons.right=CAMERA_ACTION.OFFSET,Vt.canZoom===!0&&jt===!1?(_e.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM_OFFSET,_e.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM_OFFSET):(_e.current.touches.two=CAMERA_ACTION.TOUCH_OFFSET,_e.current.touches.three=CAMERA_ACTION.TOUCH_OFFSET)):(_e.current.mouseButtons.right=CAMERA_ACTION.NONE,Vt.canZoom===!0&&jt===!1?(_e.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM,_e.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM):(_e.current.touches.two=CAMERA_ACTION.NONE,_e.current.touches.three=CAMERA_ACTION.NONE)))},[_e,Vt,jt]),reactExports.useEffect(()=>{if(_e.current===null)return;Kt.fov=Vt.fov,Kt.updateProjectionMatrix();const Jt=()=>{_e.current!==null&&(_e.current.removeEventListener("rest",Jt),kt.cameraStore.setState({userDragging:!1,disableAutoRotate:!1}))};_e.current.addEventListener("controlstart",()=>{kt.hotspotStore.getState().isAnyHotspotActive&&kt.hotspotStore.getState().actions.exitHotspot(),_e.current!==null&&(_e.current.removeEventListener("rest",Jt),kt.cameraStore.setState({userDragging:!0,disableAutoRotate:!0}))}),_e.current.addEventListener("controlend",()=>{_e.current!==null&&(_e.current.active?_e.current.addEventListener("rest",Jt):Jt())}),_e.current.addEventListener("transitionstart",()=>{_e.current!==null&&kt.cameraStore.getState().userDragging!==!0&&(kt.cameraStore.setState({disableAutoRotate:!0}),_e.current.addEventListener("rest",Jt))})},[_e]),reactExports.useEffect(()=>{_e.current&&(Xt.layers.enable(GHOST_LAYER),Kt.layers.enable(GHOST_LAYER),kt.cameraStore.setState({cameraControlsRef:_e.current}))},[_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(CameraControls,{ref:_e,makeDefault:!0,dollySpeed:Vt.dollySpeed,truckSpeed:Vt.truckSpeed,minZoom:Vt.minZoom,maxZoom:Vt.maxZoom,minPolarAngle:Dt?-Math.PI:degToRad(Vt.minPolarAngle),maxPolarAngle:Dt?Math.PI:degToRad(Vt.maxPolarAngle)})})},Root=({stores:kt})=>{const{gl:_e}=useThree();return reactExports.useEffect(()=>{kt.coreSceneStore.setState({glContext:_e}),_e.getContext("3d").canvas.ariaLabel="A 3D Canvas to visualize products from the Configurator."},[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(BaseScene,{stores:kt}),jsxRuntimeExports.jsx(CameraManager,{stores:kt}),jsxRuntimeExports.jsx(LightManager,{stores:kt})]})},Alert=({stores:kt,handleCloseAlert:_e,alertData:Dt})=>{const Vt=reactExports.useRef(null),Gt=reactExports.useRef(null),zt=reactExports.useRef(null),jt=kt.uiSceneStore(Xt=>Xt.dialogPopupOpen),Ht=kt.uiSceneStore(Xt=>Xt.isScreenPortrait),Wt=kt.cartStore(Xt=>Xt.previewCartModalOpen),qt=()=>{clearTimeout(Vt.current),zt.current.style="",Gt.current.style="",_e()};return reactExports.useEffect(()=>{if(zt.current===null||Gt.current===null)return;const Xt=Dt.alertTime?Dt.alertTime:1e3;zt.current.style="animation: loader "+Xt+"ms; animation-timing-function: linear;",Gt.current.style="animation: loader "+Xt+"ms; animation-timing-function: linear;",Vt.current=setTimeout(qt,Xt)},[zt,Gt,Dt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"alert-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),tabIndex:Ht?-1:0,"aria-hidden":Ht,children:[jsxRuntimeExports.jsx("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),children:jsxRuntimeExports.jsx("img",{src:ALERT_TYPES[Dt.alertType].src,className:"alert-icon",alt:Dt.alertType})}),jsxRuntimeExports.jsxs("div",{className:"alert-msg-cross-timer-bg",children:[jsxRuntimeExports.jsxs("div",{className:"alert-msg-cross-bg",children:[jsxRuntimeExports.jsxs("div",{className:"alert-msg-bg",style:Dt.alertLabel?{}:{display:"flex",alignItems:"center"},children:[Dt.alertLabel&&jsxRuntimeExports.jsx("p",{className:"alert-label",children:Dt.alertLabel}),jsxRuntimeExports.jsx("span",{className:"alert-msg",children:Dt.alertMsg})]}),jsxRuntimeExports.jsx("div",{className:"alert-close-btn-bg",children:jsxRuntimeExports.jsx("img",{tabIndex:jt?-1:0,"aria-hidden":jt,onClick:qt,className:"alert-cross-btn",alt:"Close",role:"button","aria-label":"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg"})})]}),jsxRuntimeExports.jsx("div",{ref:Gt,className:"alert-timer ".concat(ALERT_TYPES[Dt.alertType].cssClass)})]})]}),jsxRuntimeExports.jsxs("div",{className:"alert-bg alert-mobile ".concat(ALERT_TYPES[Dt.alertType].cssClass),tabIndex:Ht?0:-1,"aria-hidden":!Ht,children:[jsxRuntimeExports.jsxs("div",{className:"alert-icon-msg-cross-bg",children:[jsxRuntimeExports.jsx("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),children:jsxRuntimeExports.jsx("img",{src:ALERT_TYPES[Dt.alertType].src,className:"alert-icon",alt:Dt.alertType})}),jsxRuntimeExports.jsxs("div",{className:"alert-msg-bg",children:[Dt.alertLabel&&jsxRuntimeExports.jsx("p",{className:"alert-label",children:Dt.alertLabel}),jsxRuntimeExports.jsx("span",{className:"alert-msg",children:Dt.alertMsg_Mobile?Dt.alertMsg_Mobile:Dt.alertMsg})]}),jsxRuntimeExports.jsx("div",{className:"alert-close-btn-bg",children:jsxRuntimeExports.jsx("img",{tabIndex:!jt&&!Wt?0:-1,"aria-hidden":jt||Wt,onClick:qt,className:"alert-cross-btn",alt:"Close",role:"button","aria-label":"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg"})})]}),jsxRuntimeExports.jsx("div",{ref:zt,className:"alert-timer ".concat(ALERT_TYPES[Dt.alertType].cssClass)})]})]})},AlertManager=({stores:kt})=>{const _e=kt.coreSceneStore(Wt=>Wt.alertData),Dt=kt.coreSceneStore(Wt=>Wt.persistantAlertData),Vt=kt.coreSceneStore(Wt=>Wt.currentAlertData),Gt=Wt=>{kt.coreSceneStore.setState({currentAlertData:Wt})};reactExports.useEffect(()=>{!_e||!_e.alertMsg||zt(_e)},[_e]),reactExports.useEffect(()=>{const Wt=kt.coreSceneStore.getState().alertQueue;Wt.length<=0||(Vt===null&&(Gt(Wt[0]),Wt[0].persistant===!0&&kt.coreSceneStore.setState({persistantAlertData:Wt[0]})),kt.coreSceneStore.getState().actions.popFromAlertQueue())},[Vt]);const zt=reactExports.useCallback(Wt=>{if(kt.coreSceneStore.getState().sceneSettings.disableAlerts===!0)return;let qt=Wt.alertType,Xt=Wt.alertId;const Kt=kt.coreSceneStore.getState().sceneSettings.alertControl;let Yt=!1;Object.keys(Kt).map(nn=>{nn==Xt&&(Yt=!0)}),Yt==!1&&(Xt="default");let Zt=!1;if(Object.keys(ALERT_TYPES).map(nn=>{nn==qt.toLowerCase()&&(Zt=!0)}),Zt==!1&&(qt=ALERT_TYPES.info.id,Wt.alertType=qt),ALERT_TYPES[Wt.alertType].level<kt.coreSceneStore.getState().sceneSettings.alertLevel||kt.coreSceneStore.getState().sceneSettings.alertControl[Xt]!==!0)return;const Jt=kt.coreSceneStore.getState().actions.addToAlertQueue(Wt);Vt===null&&Jt.length===1&&(Gt(Wt),Wt.persistant===!0&&kt.coreSceneStore.setState({persistantAlertData:Wt}))},[Vt]),jt=reactExports.useCallback(()=>{Gt(Dt)},[Dt]),Ht=reactExports.useCallback(async()=>{Gt(null)},[]);return reactExports.useEffect(()=>{async function Wt(){await wait(1500);let qt=null,Xt={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};kt.coreSceneStore.getState().alertSettings&&(kt.coreSceneStore.getState().alertSettings.welcomeMessage&&(qt=kt.coreSceneStore.getState().alertSettings.welcomeMessage),kt.coreSceneStore.getState().alertSettings.instructionMessage&&(Xt=kt.coreSceneStore.getState().alertSettings.instructionMessage)),qt!==null&&zt(qt),zt(Xt)}Wt()},[]),jsxRuntimeExports.jsxs("div",{className:"alert-space",children:[Vt===null&&Dt&&jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Alert Button",onClick:jt,className:"alert-persistant-btn-bg",style:{background:ALERT_TYPES[Dt.alertType].background,border:"1px solid "+ALERT_TYPES[Dt.alertType].color},children:jsxRuntimeExports.jsx("img",{style:{filter:ALERT_TYPES[Dt.alertType].filter},className:"alert-persistant-btn",alt:Dt.alertType,src:ALERT_TYPES[Dt.alertType].src})}),Vt&&jsxRuntimeExports.jsx(Alert,{stores:kt,handleCloseAlert:Ht,alertData:Vt})]})},FocusManager=({stores:kt})=>{const _e=kt.itemStore(Gt=>Gt.itemsSpawned),Dt=kt.uiSceneStore(Gt=>Gt.dialogPopupOpen),Vt=kt.cartStore(Gt=>Gt.previewCartModalOpen);return jsxRuntimeExports.jsx("div",{id:"focusBtns",children:Object.keys(_e).map((Gt,zt)=>jsxRuntimeExports.jsx("div",{children:_e[Gt].itemData.isInteractive&&_e[Gt].itemData.gltfURL&&jsxRuntimeExports.jsx("div",{onFocus:()=>{kt.itemStore.setState({focusedGUID:Gt})},onBlur:()=>{kt.itemStore.setState({focusedGUID:null})},onClick:()=>{const jt=kt.coreSceneStore.getState().canvasSize,Ht=kt.itemStore.getState().itemsSpawned,Wt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Gt),qt={primary:{guid:Gt,name:_e[Gt].itemData.name,data:{...Ht[Gt],overrideVariant:Wt.overrideVariant,currentVariant:Wt.currentVariant,offsetX:jt.width/2,offsetY:jt.height/2}}};kt.itemStore.getState().actions.setSelectedItemData(qt.primary.data),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Show,qt)},role:"button",id:"focusBtn-"+Gt,tabIndex:!Vt&&!Dt?0:-1,className:"canvasFocusButton","aria-hidden":Vt||Dt,"aria-label":_e[Gt].itemData.name?_e[Gt].itemData.name:_e[Gt].itemData.skuID},"focusBtn-key-"+Gt)},"focusBtn-single-key-"+Gt))},"focusBtns")},OverlayUIManager=({stores:kt})=>{const _e=kt.coreSceneStore(zt=>zt.canvasTooltipText),Dt=kt.coreSceneStore(zt=>zt.sceneSettings),Vt=kt.ghostStore(zt=>zt.ghostData),Gt=kt.itemStore(zt=>zt.defaultSceneItemCount);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(AlertManager,{stores:kt}),jsxRuntimeExports.jsx(FocusManager,{stores:kt}),kt.coreSceneStore.getState().CORE_API.getSceneItemCount()<=Gt&&!Vt&&jsxRuntimeExports.jsx("div",{style:{fontSize:Dt.emptySceneTextFontSize},className:"emptySceneBG",children:Dt.emptySceneText}),jsxRuntimeExports.jsx("div",{className:"canvasTooltip",children:_e})]})})};function getPlugAttributesFromObject(kt){let _e={};if(kt.type.toLowerCase()==="object3d"){const Dt=kt.userData;if(Dt?.isPlug===1){const Vt=Dt.name;Vt&&typeof Vt=="string"&&(_e.name=Vt);const Gt=Dt.type;Gt&&typeof Gt=="string"?_e.type=Gt:_e.type="";const zt=Dt.weight;zt&&typeof zt=="number"?_e.weight=zt:_e.weight=1;const jt=Dt.affectedNodes;jt&&typeof jt=="string"?_e.affectedNodes=jt.replaceAll(" ","").split(","):_e.affectedNodes=[];const Ht=Dt.acceptedPlugTypes;Ht&&typeof Ht=="string"?_e.acceptedPlugTypes=Ht.replaceAll(" ","").split(","):_e.acceptedPlugTypes=[];const Wt=Dt.connectsToPlugTypes;Wt&&typeof Wt=="string"?_e.connectsToPlugTypes=Wt.replaceAll(" ","").split(","):_e.connectsToPlugTypes=[];const qt=Dt.dependencySku;qt&&typeof qt=="string"?_e.dependencySku=qt:_e.dependencySku="";const Xt=Dt.isDependencySkuInteractive;qt!==void 0&&typeof Xt=="number"?_e.isDependencySkuInteractive=Xt:_e.isDependencySkuInteractive=1}}return _e}async function loadAllDynamicHooks(kt,_e){if(!kt){LOGGER.info({title:"No hook URL provided"});return}try{const Dt=resolveAssetUrl(kt),Vt=_e.dynamicHookStore.getState(),Gt=await __vitePreload(()=>import(Dt),[]);for(const[zt,jt]of Object.entries(Gt))typeof jt=="function"&&(Vt[zt]!==void 0?(Vt[zt]=jt,LOGGER.info({title:`${zt} successfully updated from `+Dt})):LOGGER.warn({title:`No matching hook found for ${zt}`}))}catch(Dt){LOGGER.error({title:`Error loading dynamic hooks from: ${kt}`,details:Dt})}}async function loadAllProxies(kt,_e){kt.assetStore.getState().actions.init();const Dt=kt.assetStore.getState().actions,Vt=kt.coreSceneStore.getState().sceneSettings,Gt=Object.keys(_e).length;LOGGER.info({title:`Starting concurrent loading of ${Gt} proxies`});const zt=performance.now(),jt=Object.entries(_e).map(([Kt,Yt])=>loadSingleProxy(Kt,Yt,Dt,Vt)),Ht=await Promise.all(jt),Wt=performance.now(),qt=Ht.filter(Kt=>Kt.success).length;LOGGER.info({title:`Concurrent loading completed: ${qt}/${Gt} proxies loaded successfully in ${((Wt-zt)/1e3).toFixed(2)} seconds`});const Xt=Ht.filter(Kt=>!Kt.success);Xt.length>0&&LOGGER.warn({title:`Failed to load ${Xt.length} proxies:`,details:Xt.map(Kt=>Kt.skuID)})}async function loadSingleProxy(kt,_e,Dt,Vt){try{LOGGER.info({title:`Loading proxy: ${kt}`});const Gt=performance.now(),zt=await Dt.loadProxyAsset(kt,!0),jt=performance.now();if(LOGGER.info({title:`${kt} proxy: ${((jt-Gt)/1e3).toFixed(2)} seconds to load.`}),LOGGER.info({title:`Loaded proxy: ${kt}`,details:zt}),!zt?.proxy?.data)return{success:!1,skuID:kt,error:"No proxy data available"};const Ht=!_e.plugs||_e.plugs.length===0;Ht&&LOGGER.info({title:`Collecting plugs information for ${kt} from the proxy mesh`});let Wt=[];return zt.proxy.data.scene.traverse(qt=>{if(Ht){const Xt=getPlugAttributesFromObject(qt);Object.keys(Xt).length>0&&Wt.push(Xt)}qt.isMesh&&processMesh(qt,Vt)}),Wt.length>0&&(_e.plugs=Wt),updateBoundingBoxInfo(_e,zt),{success:!0,skuID:kt}}catch(Gt){return LOGGER.error({title:`Error loading proxy ${kt}:`,details:Gt}),{success:!1,skuID:kt,error:Gt.message}}}function processMesh(kt,_e){kt.layers.set(GHOST_LAYER);const Dt=_e.ghostColor;Object.assign(kt.material,{color:new Color$1(0,0,0),emissive:new Color$1(Dt.r/255,Dt.g/255,Dt.b/255),emissiveIntensity:.75,alphaTest:Dt.a,transparent:Dt.a<1,opacity:Dt.a,depthTest:!1,reflectivity:0,metalness:0,wireframe:_e.ghostAsWireframe})}function updateBoundingBoxInfo(kt,_e){const{boundingBox:Dt,boundingSphere:Vt}=computeProxyBoundingBox(_e);if(Dt&&Vt){const Gt=calculateBoundingBoxSize(Dt);Object.assign(kt,{boundingBox:Dt,boundingSphereCenter:Vt.center,boundingBoxSize:Gt})}else kt.boundingSphereCenter={x:0,y:0,z:0},kt.boundingBoxSize={x:0,y:0,z:0}}function calculateBoundingBoxSize(kt){return{x:kt.max.x-kt.min.x,y:kt.max.y-kt.min.y,z:kt.max.z-kt.min.z}}function computeProxyBoundingBox(kt){const _e=kt.proxy.data.scene;if(_e){let Dt=null;return _e.traverse(Vt=>{if(Vt.isMesh){Dt=Vt;return}}),Dt?(Dt.geometry.boundingBox||Dt.geometry.computeBoundingBox(),{boundingBox:Dt.geometry.boundingBox,boundingSphere:Dt.geometry.boundingSphere}):!1}}const AlertStyles=`.alert-space{position:absolute;width:auto;height:auto;max-width:40%;top:0;margin:1rem}.alert-bg{display:flex;flex-direction:row;border-radius:5.04px}.alert-mobile{display:none}.alert-persistant-btn{width:2rem;height:2rem;margin:4px;filter:invert(100%) brightness(200%)}.alert-persistant-btn-bg{cursor:pointer;display:flex;justify-content:center;align-items:center;border-radius:4px}.alert-persistant-btn-bg:hover{opacity:.9!important}.alert-icon{width:2rem;height:2rem;margin:14px;filter:invert(100%) brightness(200%)}.alert-icon-bg{border-radius:5.04px 0 0 5.04px}.alert-msg-bg{padding:1rem}.alert-label{font-weight:600;font-size:1.125rem;margin:0 0 4px;text-transform:capitalize}.alert-msg{font-size:1rem}.alert-cross-btn{width:1.5rem;cursor:pointer;margin:.5rem}.alert-msg-cross-timer-bg{display:flex;flex-direction:column;justify-content:space-between}.alert-msg-cross-bg{display:flex;flex-direction:row}.alert-timer{width:0%;height:2px;transition:10ms}.alert-bg.alert-info,.alert-bg.alert-mobile.alert-info{background-color:var(--info-light);border:1.26px solid var(--info-dark)}.alert-icon-bg.alert-info{background-color:var(--info-dark);border:1.26px solid var(--info-dark)}.alert-timer.alert-info{background-color:var(--info-dark)}.alert-bg.alert-warn,.alert-bg.alert-mobile.alert-warn{background-color:var(--warn-light);border:1.26px solid var(--warn-dark)}.alert-icon-bg.alert-warn{background-color:var(--warn-dark);border:1.26px solid var(--warn-dark)}.alert-timer.alert-warn{background-color:var(--warn-dark)}.alert-bg.alert-error,.alert-bg.alert-mobile.alert-error{background-color:var(--error-light);border:1.26px solid var(--error-dark)}.alert-icon-bg.alert-error{background-color:var(--error-dark);border:1.26px solid var(--error-dark)}.alert-timer.alert-error{background-color:var(--error-dark)}.alert-bg.alert-success,.alert-bg.alert-mobile.alert-success{background-color:var(--success-light);border:1.26px solid var(--success-dark)}.alert-icon-bg.alert-success{background-color:var(--success-dark);border:1.26px solid var(--success-dark)}.alert-timer.alert-success{background-color:var(--success-dark)}@keyframes loader{0%{width:0%}to{width:100%}}@media only screen and (orientation: portrait){.alert-label{margin:auto}.alert-close-btn-bg{display:flex;justify-content:center}.alert-icon-msg-cross-bg{display:flex;flex-direction:row;width:100%;align-items:center}.alert-space{width:100%;max-width:100%;margin:auto}.alert-bg{display:none;flex-direction:column}.alert-mobile{display:flex;justify-content:center;align-items:flex-start}.alert-icon{margin:4px}.alert-icon-bg{display:flex;justify-content:center;align-items:center;border-radius:5.04px;margin:8px 16px;height:fit-content}.alert-msg-bg{padding:1rem 0rem;width:calc(100% - 70px)}.alert-persistant-btn{margin:4px!important}.alert-persistant-btn-bg{display:flex;justify-content:center;width:calc(8px + 2rem)!important;align-items:center;border-radius:5.04px;margin:8px 16px}}
4463
+ `),kn.fragmentShader=kn.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Rn=new ShaderMaterial(HorizontalBlurShader),Dn=new ShaderMaterial(VerticalBlurShader);return Dn.depthTest=Rn.depthTest=!1,[Cn,Sn,xn,wn,Rn,Dn,yn]},[Kt,jt,Ht,kt,Zt]),_n=Cn=>{pn.visible=!0,pn.material=fn,fn.uniforms.tDiffuse.value=un.texture,fn.uniforms.h.value=Cn*1/256,sn.setRenderTarget(vn),sn.render(pn,cn.current),pn.material=mn,mn.uniforms.tDiffuse.value=vn.texture,mn.uniforms.v.value=Cn*1/256,sn.setRenderTarget(un),sn.render(pn,cn.current),pn.visible=!1};let En=0,An,Tn;return useFrame(()=>{cn.current&&(_e===1/0||En<_e)&&(En++,An=tn.background,Tn=tn.overrideMaterial,en.current.visible=!1,tn.background=null,tn.overrideMaterial=dn,sn.setRenderTarget(un),sn.render(tn,cn.current),_n(Wt),Yt&&_n(Wt*.4),sn.setRenderTarget(null),en.current.visible=!0,tn.overrideMaterial=Tn,tn.background=An)}),reactExports.useEffect(()=>()=>{cn.current&&cn.current.layers.disable(Dt)},[cn]),reactExports.useEffect(()=>()=>{un.dispose(),vn.dispose(),hn.dispose(),dn.dispose(),pn.geometry.dispose(),fn.dispose(),mn.dispose()},[]),reactExports.useImperativeHandle(Qt,()=>en.current,[]),reactExports.createElement("group",_extends$1({"rotation-x":Math.PI/2},rn,{ref:en}),reactExports.createElement("mesh",{renderOrder:nn,geometry:hn,layers:2,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},reactExports.createElement("meshBasicMaterial",{transparent:!0,map:un.texture,opacity:zt,depthWrite:Jt})),reactExports.createElement("orthographicCamera",{ref:cn,args:[-jt/2,jt/2,Ht/2,-Ht/2,qt,Xt]}))}),EffectsComposer=({stores:kt})=>{const[_e,Dt]=reactExports.useState(10),Vt=kt.coreSceneStore(Wt=>Wt.bbox),Gt=kt.itemStore(Wt=>Wt.itemsSpawned),zt=kt.ghostStore(Wt=>Wt.ghostsTransform),jt=kt.coreSceneStore(Wt=>Wt.sceneSettings),Ht=kt.coreSceneStore(Wt=>Wt.shadowRefreshKey);return reactExports.useEffect(()=>{zt.length===0&&kt.coreSceneStore.getState().actions.refreshShadows()},[Gt,zt]),reactExports.useEffect(()=>{if(!Vt||!Vt.isBox3){Dt(10);return}const Wt=new Vector3(0,0,0);let qt=Wt.distanceTo(Vt.min)*2,Xt=Wt.distanceTo(Vt.max)*2,Kt=Xt>qt?Xt:qt;Kt!=1/0&&Kt!=-1/0&&(Kt+=5,Dt(Kt||10))},[Vt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(EffectComposer,{multisampling:4,autoClear:!1,disableNormalPass:!0,children:[jsxRuntimeExports.jsx(ToneMapping,{mode:ToneMappingMode.ACES_FILMIC,blendFunction:BlendFunction.NORMAL,adaptive:!1,resolution:256,maxLuminance:40,middleGrey:5}),jsxRuntimeExports.jsx(Outline,{...jt.outlineSettings})]}),jt.contactShadowVisibility&&jsxRuntimeExports.jsx(ContactShadows,{excludeLayer:GHOST_LAYER,position:[0,0,0],opacity:.3,scale:_e,blur:.35,far:2,resolution:256,frames:1},Ht)]})};function Hotspot({stores:kt,hotspotKey:_e}){const Dt=kt.coreSceneStore(tn=>tn.sceneSettings),Vt=kt.attachmentStore(tn=>tn.attachmentSystem),Gt=kt.hotspotStore(tn=>tn),zt=kt.hotspotStore(tn=>tn.activeHotspotData),jt=kt.itemStore(tn=>tn.lastDeletedItemData),Ht=kt.ghostStore(tn=>tn.ghostData),Wt=kt.hotspotStore(tn=>tn.actions),qt=kt.hotspotStore(tn=>tn.hotspotsVisibility),Xt=kt.hotspotStore(tn=>tn.hotspotsTempVisibility),[Kt,Yt]=reactExports.useState(null),[Zt,Jt]=reactExports.useState(!1),nn=reactExports.useRef(null),rn=reactExports.useRef(null),Qt=reactExports.useRef(null),en=reactExports.useCallback(tn=>{tn.includes(_e.itemData.skuID+"_"+_e.hotspotData.hotspotID)&&Jt(!0)},[_e]);return reactExports.useEffect(()=>en(Gt.visitedHotspotsID),[Gt,en]),reactExports.useEffect(()=>{Yt(zt?zt.hotspotData.guid:null)},[zt]),reactExports.useEffect(()=>{rn.current&&(Kt===_e.hotspotData.guid?rn.current.parentNode.classList.add("topmostActive"):rn.current.parentNode.classList.remove("topmostActive"))},[Kt]),reactExports.useEffect(()=>{nn.current&&Kt===_e.hotspotData.guid&&(nn.current.style.opacity=1)},[Kt,nn]),reactExports.useEffect(()=>{if(!Qt.current&&!jt)return;let tn=Vt.currentStructure.getNodeByGUID(_e.itemData.guid);tn?.ref&&(Qt.current.parent=tn.ref)},[Qt,Vt,qt,jt]),jsxRuntimeExports.jsx("group",{ref:Qt,position:_e.hotspotData.hotspotPointTransform,children:jsxRuntimeExports.jsx(Html,{ref:rn,zIndexRange:[6,0],style:qt&&Xt&&!Ht&&Dt.showHotspotsBtn?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:jsxRuntimeExports.jsxs("button",{style:{display:_e.hotspotData.visibleInScene==!1?"none":"block"},ref:nn,className:Kt===_e.hotspotData.guid?"hotspot hotspot-0 active":Zt?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:tn=>{tn.stopPropagation(),nn.current&&Kt!==_e.hotspotData.guid&&(nn.current.getClientRects()[0].left>kt.coreSceneStore.getState().canvasSize.width/1.6?nn.current.classList.add("left"):nn.current.classList.remove("left")),rn.current&&rn.current.parentNode.classList.add("topmostHover")},onPointerLeave:tn=>{tn.stopPropagation(),rn.current&&rn.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+_e.itemData.skuID+"_"+_e.hotspotData.hotspotID,role:"button",tabIndex:0,"aria-label":_e.hotspotData.title,onClick:tn=>{if(tn.stopPropagation(),Gt.isAnyHotspotActive&&Gt.activeHotspotData.hotspotData.guid===_e.hotspotData.guid){Wt.exitHotspot();return}Wt.clickHotspot(_e.hotspotData.hotspotID,_e.hotspotData.guid,_e.itemData.guid)},children:[jsxRuntimeExports.jsx("span",{className:"inner-circle"}),jsxRuntimeExports.jsx("span",{className:"hotspot-annotation",children:_e.hotspotData.title})]})})})}const HotspotManager=({stores:kt})=>{const{camera:_e}=useThree(),Dt=reactExports.useRef(null),Vt=reactExports.useRef(0),[Gt,zt]=reactExports.useState(null),jt=kt.hotspotStore(Qt=>Qt),Ht=kt.hotspotStore(Qt=>Qt.hotspotsHealthCheck),Wt=kt.itemStore(Qt=>Qt.lastDeletedItemData),qt=kt.hotspotStore(Qt=>Qt.hotspotsSpawned),Xt=kt.itemStore(Qt=>Qt.itemsSpawned),Kt=kt.hotspotStore(Qt=>Qt.activeHotspotData),{raycasterHotspot:Yt,worldPos:Zt}=reactExports.useMemo(()=>({raycasterHotspot:new Raycaster,worldPos:new Vector3}),[]),Jt=reactExports.useCallback(()=>{const Qt=kt.hotspotStore.getState().hotspotSpawnedForCategoryIDs,en=kt.attachmentStore.getState().attachmentSystem.globalGeometryVariants;Object.entries(Xt).forEach(([tn,sn])=>{if(!sn.hotspotsData)return;let cn=!1;Object.entries(qt).forEach(([un,hn])=>{const dn=hn.hotspotData.geometryVariantID;if(dn&&!Object.values(en).includes(dn)){cn=!0;const pn=hn.hotspotData.categoryID;Qt.splice(Qt.indexOf(pn),1),delete qt[un]}}),cn&&kt.hotspotStore.setState({hotspotSpawned:{...qt},hotspotSpawnedForCategoryIDs:Qt}),sn.hotspotsData.forEach(un=>{un.geometryVariantID&&!Object.values(en).includes(un.geometryVariantID)||un.categoryID!==""&&Qt.includes(un.categoryID)||(sn.hotspotSpawned=!0,Qt.push(un.categoryID),nn(tn,un))})})},[Xt,qt]),nn=reactExports.useCallback((Qt,en)=>{const tn=`${Xt[Qt].itemData.skuID}_${en.hotspotID}`;qt[tn]={itemData:{guid:Qt,...Xt[Qt].itemData},hotspotData:{guid:tn,...en}},kt.hotspotStore.setState({hotspotsSpawned:{...qt}})},[Xt,jt,qt]);reactExports.useEffect(()=>{if(!Wt?.itemData)return;if(Wt.hotspotSpawned){kt.hotspotStore.getState().actions.removeHotspotForItem({...Wt});const en=kt.hotspotStore.getState().hotspotSpawnedForCategoryIDs,tn=Wt.hotspotsData.map(sn=>sn.categoryID);filterArrWithCondition(en,sn=>!tn.includes(sn)),kt.hotspotStore.setState({hotspotSpawnedForCategoryIDs:en})}kt.itemStore.setState({lastDeletedItemData:null});const Qt=kt.attachmentStore.getState().attachmentSystem;Qt.currentStructure.removeNodeByGUID(Wt.itemData.guid),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,Qt.currentStructure.materialOverrideExists()),kt.coreSceneStore.getState().actions.triggerAutoFocus()},[Wt]);const rn=(Qt,en)=>{const tn=Qt.clone().sub(_e.position),sn=tn.length();Yt.set(_e.position,tn.normalize());const cn=Yt.intersectObject(kt.coreSceneStore.getState().sceneRef);en.style.opacity=cn.length>0&&cn[0].distance<sn||Gt?.5:1};return reactExports.useEffect(()=>{zt(Kt?.hotspotData.guid||null)},[Kt]),useFrame(()=>{if(!Dt.current||Dt.current.children.length===0)return;Vt.current=(Vt.current+1)%Dt.current.children.length;const Qt=Object.keys(qt)[Vt.current];if(!qt[Qt])return;const en=`hotspot3D_${qt[Qt].itemData.skuID}_${qt[Qt].hotspotData.hotspotID}`,tn=kt.coreSceneStore.getState().CORE_API.coreWCRef.shadowRootRef.getElementById(en);Gt===Qt||!tn||(Dt.current.children[Vt.current].getWorldPosition(Zt),rn(Zt,tn))}),reactExports.useEffect(()=>{Jt()},[Object.keys(Xt).length,Ht]),reactExports.useEffect(()=>()=>{kt.hotspotStore.setState({hotspotsSpawned:{}}),kt.hotspotStore.setState({hotspotSpawnedForCategoryIDs:[]})},[]),jt.hotspotsVisibility&&jsxRuntimeExports.jsx("group",{name:"#GRP_HotspotManager",ref:Dt,children:Object.entries(qt).map(([Qt,en])=>jsxRuntimeExports.jsx(Hotspot,{stores:kt,hotspotKey:en},Qt))})};var objectTypes$3={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},lodash__objecttypes=objectTypes$3,objectTypes$2=lodash__objecttypes;function isObject$4(kt){return!!(kt&&objectTypes$2[typeof kt])}var lodash_isobject=isObject$4,objectProto$1=Object.prototype,toString=objectProto$1.toString,reNative$4=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),lodash__renative=reNative$4,objectTypes$1=lodash__objecttypes,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,shimKeys$1=function(kt){var _e,Dt=kt,Vt=[];if(!Dt||!objectTypes$1[typeof kt])return Vt;for(_e in Dt)hasOwnProperty.call(Dt,_e)&&Vt.push(_e);return Vt},lodash__shimkeys=shimKeys$1,isObject$3=lodash_isobject,reNative$3=lodash__renative,shimKeys=lodash__shimkeys,nativeKeys=reNative$3.test(nativeKeys=Object.keys)&&nativeKeys,keys$2=nativeKeys?function(kt){return isObject$3(kt)?nativeKeys(kt):[]}:shimKeys,lodash_keys=keys$2;function noop$1(){}var lodash_noop=noop$1,isObject$2=lodash_isobject,reNative$2=lodash__renative,nativeCreate=reNative$2.test(nativeCreate=Object.create)&&nativeCreate;function baseCreate$2(kt,_e){return isObject$2(kt)?nativeCreate(kt):{}}nativeCreate||(baseCreate$2=function(){function kt(){}return function(_e){if(isObject$2(_e)){kt.prototype=_e;var Dt=new kt;kt.prototype=null}return Dt||commonjsGlobal.Object()}}());var lodash__basecreate=baseCreate$2,noop=lodash_noop,reNative$1=lodash__renative,descriptor={configurable:!1,enumerable:!1,value:null,writable:!1},defineProperty=function(){try{var kt={},_e=reNative$1.test(_e=Object.defineProperty)&&_e,Dt=_e(kt,kt,kt)&&_e}catch{}return Dt}(),setBindData$3=defineProperty?function(kt,_e){descriptor.value=_e,defineProperty(kt,"__bindData__",descriptor)}:noop,lodash__setbinddata=setBindData$3,baseCreate$1=lodash__basecreate,isObject$1=lodash_isobject,setBindData$2=lodash__setbinddata,arrayRef$2=[],push$2=arrayRef$2.push;function baseBind$1(kt){var _e=kt[0],Dt=kt[2],Vt=kt[4];function Gt(){if(Dt){var zt=Dt.slice();push$2.apply(zt,arguments)}if(this instanceof Gt){var jt=baseCreate$1(_e.prototype),Ht=_e.apply(jt,zt||arguments);return isObject$1(Ht)?Ht:jt}return _e.apply(Vt,zt||arguments)}return setBindData$2(Gt,kt),Gt}var lodash__basebind=baseBind$1;function slice$2(kt,_e,Dt){_e||(_e=0),typeof Dt>"u"&&(Dt=kt?kt.length:0);for(var Vt=-1,Gt=Dt-_e||0,zt=Array(Gt<0?0:Gt);++Vt<Gt;)zt[Vt]=kt[_e+Vt];return zt}var lodash__slice=slice$2,baseCreate=lodash__basecreate,isObject=lodash_isobject,setBindData$1=lodash__setbinddata,slice$1=lodash__slice,arrayRef$1=[],push$1=arrayRef$1.push;function baseCreateWrapper$1(kt){var _e=kt[0],Dt=kt[1],Vt=kt[2],Gt=kt[3],zt=kt[4],jt=kt[5],Ht=Dt&1,Wt=Dt&2,qt=Dt&4,Xt=Dt&8,Kt=_e;function Yt(){var Zt=Ht?zt:this;if(Vt){var Jt=Vt.slice();push$1.apply(Jt,arguments)}if((Gt||qt)&&(Jt||(Jt=slice$1(arguments)),Gt&&push$1.apply(Jt,Gt),qt&&Jt.length<jt))return Dt|=16,baseCreateWrapper$1([_e,Xt?Dt:Dt&-4,Jt,null,zt,jt]);if(Jt||(Jt=arguments),Wt&&(_e=Zt[Kt]),this instanceof Yt){Zt=baseCreate(_e.prototype);var nn=_e.apply(Zt,Jt);return isObject(nn)?nn:Zt}return _e.apply(Zt,Jt)}return setBindData$1(Yt,kt),Yt}var lodash__basecreatewrapper=baseCreateWrapper$1;function isFunction$1(kt){return typeof kt=="function"}var lodash_isfunction=isFunction$1,baseBind=lodash__basebind,baseCreateWrapper=lodash__basecreatewrapper,isFunction=lodash_isfunction,arrayRef=[],push=arrayRef.push;function createWrapper$1(kt,_e,Dt,Vt,Gt,zt){var jt=_e&1,Ht=_e&2,Wt=_e&4,qt=_e&16,Xt=_e&32;if(!Ht&&!isFunction(kt))throw new TypeError;qt&&!Dt.length&&(_e&=-17,qt=Dt=!1),Xt&&!Vt.length&&(_e&=-33,Xt=Vt=!1);var Kt=kt&&kt.__bindData__;if(Kt&&Kt!==!0)return Kt=Kt.slice(),jt&&!(Kt[1]&1)&&(Kt[4]=Gt),!jt&&Kt[1]&1&&(_e|=8),Wt&&!(Kt[1]&4)&&(Kt[5]=zt),qt&&push.apply(Kt[2]||(Kt[2]=[]),Dt),Xt&&push.apply(Kt[3]||(Kt[3]=[]),Vt),Kt[1]|=_e,createWrapper$1.apply(null,Kt);var Yt=_e==1||_e===17?baseBind:baseCreateWrapper;return Yt([kt,_e,Dt,Vt,Gt,zt])}var lodash__createwrapper=createWrapper$1,createWrapper=lodash__createwrapper,slice=lodash__slice;function bind$1(kt,_e){return arguments.length>2?createWrapper(kt,17,slice(arguments,2),null,_e):createWrapper(kt,1,null,null,_e)}var lodash_bind=bind$1;function identity$1(kt){return kt}var lodash_identity=identity$1,reNative=lodash__renative,reThis$1=/\bthis\b/,support$1={};support$1.funcDecomp=!reNative.test(commonjsGlobal.WinRTError)&&reThis$1.test(function(){return this});support$1.funcNames=typeof Function.name=="string";var lodash_support=support$1,bind=lodash_bind,identity=lodash_identity,setBindData=lodash__setbinddata,support=lodash_support,reFuncName=/^\s*function[ \n\r\t]+\w/,reThis=/\bthis\b/,fnToString=Function.prototype.toString;function baseCreateCallback$2(kt,_e,Dt){if(typeof kt!="function")return identity;if(typeof _e>"u"||!("prototype"in kt))return kt;var Vt=kt.__bindData__;if(typeof Vt>"u"&&(support.funcNames&&(Vt=!kt.name),Vt=Vt||!support.funcDecomp,!Vt)){var Gt=fnToString.call(kt);support.funcNames||(Vt=!reFuncName.test(Gt)),Vt||(Vt=reThis.test(Gt),setBindData(kt,Vt))}if(Vt===!1||Vt!==!0&&Vt[1]&1)return kt;switch(Dt){case 1:return function(zt){return kt.call(_e,zt)};case 2:return function(zt,jt){return kt.call(_e,zt,jt)};case 3:return function(zt,jt,Ht){return kt.call(_e,zt,jt,Ht)};case 4:return function(zt,jt,Ht,Wt){return kt.call(_e,zt,jt,Ht,Wt)}}return bind(kt,_e)}var lodash__basecreatecallback=baseCreateCallback$2,baseCreateCallback$1=lodash__basecreatecallback,keys$1=lodash_keys,objectTypes=lodash__objecttypes,forOwn$1=function(kt,_e,Dt){var Vt,Gt=kt,zt=Gt;if(!Gt||!objectTypes[typeof Gt])return zt;_e=_e&&typeof Dt>"u"?_e:baseCreateCallback$1(_e,Dt,3);for(var jt=-1,Ht=objectTypes[typeof Gt]&&keys$1(Gt),Wt=Ht?Ht.length:0;++jt<Wt;)if(Vt=Ht[jt],_e(Gt[Vt],Vt,kt)===!1)return zt;return zt},lodash_forown=forOwn$1,baseCreateCallback=lodash__basecreatecallback,forOwn=lodash_forown;function forEach(kt,_e,Dt){var Vt=-1,Gt=kt?kt.length:0;if(_e=_e&&typeof Dt>"u"?_e:baseCreateCallback(_e,Dt,3),typeof Gt=="number")for(;++Vt<Gt&&_e(kt[Vt],Vt,kt)!==!1;);else forOwn(kt,_e);return kt}var lodash_foreach=forEach,metric$b,imperial$9;metric$b={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}};imperial$9={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}};var length={metric:metric$b,imperial:imperial$9,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},metric$a,imperial$8;metric$a={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}};imperial$8={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}};var area={metric:metric$a,imperial:imperial$8,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},metric$9,imperial$7;metric$9={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}};imperial$7={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}};var mass={metric:metric$9,imperial:imperial$7,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},metric$8,imperial$6;metric$8={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}};imperial$6={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}};var volume={metric:metric$8,imperial:imperial$6,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},metric$7;metric$7={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var each$1={metric:metric$7,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},metric$6,imperial$5;metric$6={C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}};imperial$5={F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}};var temperature={metric:metric$6,imperial:imperial$5,_anchors:{metric:{unit:"C",transform:function(kt){return kt/(5/9)+32}},imperial:{unit:"F",transform:function(kt){return(kt-32)*(5/9)}}}},time,daysInYear=365.25;time={ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:60*60},d:{name:{singular:"Day",plural:"Days"},to_anchor:60*60*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:60*60*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:60*60*24*daysInYear/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*daysInYear}};var time_1={metric:time,_anchors:{metric:{unit:"s",ratio:1}}},bits,bytes;bits={b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}};bytes={B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}};var digital={bits,bytes,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},metric$5;metric$5={ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}};var partsPer={metric:metric$5,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},metric$4,imperial$4;metric$4={"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}};imperial$4={"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}};var speed={metric:metric$4,imperial:imperial$4,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},metric$3,imperial$3;metric$3={"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}};imperial$3={"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}};var pace={metric:metric$3,imperial:imperial$3,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},metric$2,imperial$2;metric$2={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}};imperial$2={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}};var pressure={metric:metric$2,imperial:imperial$2,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},current;current={A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}};var current_1={metric:current,_anchors:{metric:{unit:"A",ratio:1}}},voltage;voltage={V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}};var voltage_1={metric:voltage,_anchors:{metric:{unit:"V",ratio:1}}},power;power={W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}};var power_1={metric:power,_anchors:{metric:{unit:"W",ratio:1}}},reactivePower;reactivePower={VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}};var reactivePower_1={metric:reactivePower,_anchors:{metric:{unit:"VAR",ratio:1}}},apparentPower;apparentPower={VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}};var apparentPower_1={metric:apparentPower,_anchors:{metric:{unit:"VA",ratio:1}}},energy;energy={Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}};var energy_1={metric:energy,_anchors:{metric:{unit:"J",ratio:1}}},reactiveEnergy;reactiveEnergy={VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}};var reactiveEnergy_1={metric:reactiveEnergy,_anchors:{metric:{unit:"VARh",ratio:1}}},metric$1,imperial$1;metric$1={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}};imperial$1={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}};var volumeFlowRate={metric:metric$1,imperial:imperial$1,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},metric,imperial;metric={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};imperial={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var illuminance={metric,imperial,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},frequency;frequency={mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}};var frequency_1={metric:frequency,_anchors:{frequency:{unit:"hz",ratio:1}}},angle;angle={rad:{name:{singular:"radian",plural:"radians"},to_anchor:180/Math.PI},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:9/10},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:1/60},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:1/3600}};var angle_1={metric:angle,_anchors:{metric:{unit:"deg",ratio:1}}},convert,keys=lodash_keys,each=lodash_foreach,measures={length,area,mass,volume,each:each$1,temperature,time:time_1,digital,partsPer,speed,pace,pressure,current:current_1,voltage:voltage_1,power:power_1,reactivePower:reactivePower_1,apparentPower:apparentPower_1,energy:energy_1,reactiveEnergy:reactiveEnergy_1,volumeFlowRate,illuminance,frequency:frequency_1,angle:angle_1},Converter;Converter=function(kt,_e){_e?this.val=kt/_e:this.val=kt};Converter.prototype.from=function(kt){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(kt),this.origin||this.throwUnsupportedUnitError(kt),this};Converter.prototype.to=function(kt){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(kt);var _e,Dt;if(this.destination||this.throwUnsupportedUnitError(kt),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!=this.origin.measure)throw new Error("Cannot convert incompatible measures of "+this.destination.measure+" and "+this.origin.measure);return _e=this.val*this.origin.unit.to_anchor,this.origin.unit.anchor_shift&&(_e-=this.origin.unit.anchor_shift),this.origin.system!=this.destination.system&&(Dt=measures[this.origin.measure]._anchors[this.origin.system].transform,typeof Dt=="function"?_e=Dt(_e):_e*=measures[this.origin.measure]._anchors[this.origin.system].ratio),this.destination.unit.anchor_shift&&(_e+=this.destination.unit.anchor_shift),_e/this.destination.unit.to_anchor};Converter.prototype.toBest=function(_e){if(!this.origin)throw new Error(".toBest must be called after .from");var _e=Object.assign({exclude:[],cutOffNumber:1},_e),Dt;return each(this.possibilities(),function(Vt){var Gt=this.describe(Vt),zt=_e.exclude.indexOf(Vt)===-1;if(zt&&Gt.system===this.origin.system){var jt=this.to(Vt);(!Dt||jt>=_e.cutOffNumber&&jt<Dt.val)&&(Dt={val:jt,unit:Vt,singular:Gt.singular,plural:Gt.plural})}}.bind(this)),Dt};Converter.prototype.getUnit=function(kt){var _e;return each(measures,function(Dt,Vt){if(each(Dt,function(Gt,zt){if(zt=="_anchors"||(each(Gt,function(jt,Ht){if(Ht==kt)return _e={abbr:kt,measure:Vt,system:zt,unit:jt},!1}),_e))return!1}),_e)return!1}),_e};var describe=function(kt){return{abbr:kt.abbr,measure:kt.measure,system:kt.system,singular:kt.unit.name.singular,plural:kt.unit.name.plural}};Converter.prototype.describe=function(kt){var _e=Converter.prototype.getUnit(kt),Dt=null;try{Dt=describe(_e)}catch{this.throwUnsupportedUnitError(kt)}return Dt};Converter.prototype.list=function(kt){var _e=[];return each(measures,function(Dt,Vt){kt&&kt!==Vt||each(Dt,function(Gt,zt){if(zt=="_anchors")return!1;each(Gt,function(jt,Ht){_e=_e.concat(describe({abbr:Ht,measure:Vt,system:zt,unit:jt}))})})}),_e};Converter.prototype.throwUnsupportedUnitError=function(kt){var _e=[];throw each(measures,function(Dt,Vt){each(Dt,function(Gt,zt){if(zt=="_anchors")return!1;_e=_e.concat(keys(Gt))})}),new Error("Unsupported unit "+kt+", use one of: "+_e.join(", "))};Converter.prototype.possibilities=function(kt){var _e=[];return!this.origin&&!kt?each(keys(measures),function(Dt){each(measures[Dt],function(Vt,Gt){if(Gt=="_anchors")return!1;_e=_e.concat(keys(Vt))})}):(kt=kt||this.origin.measure,each(measures[kt],function(Dt,Vt){if(Vt=="_anchors")return!1;_e=_e.concat(keys(Dt))})),_e};Converter.prototype.measures=function(){return keys(measures)};convert=function(kt){return new Converter(kt)};var lib=convert;const convert$1=getDefaultExportFromCjs(lib),DimensionsManager=({stores:kt})=>{const _e=kt.itemStore(Jt=>Jt.itemsSpawned),{showDimensions:Dt,sceneSettings:Vt,boundData:Gt}=kt.coreSceneStore(),{sceneScaleUnit:zt,sceneScaleDisplayUnit:jt}=Vt||{},Ht=reactExports.useRef(null),Wt=reactExports.useRef(0),qt=reactExports.useMemo(()=>{if(!Vt)return"#000000";const{r:Jt,g:nn,b:rn}=Vt.dimensionColor;return rgbToHex(Jt,nn,rn)},[Vt]),[Xt,Kt]=reactExports.useMemo(()=>{if(!Gt||!Gt.size)return[.2,.01];const Jt=Math.min(Gt.size.x,Gt.size.z),nn=Math.min(Jt/20,.005);return[Math.min(Jt,.2),nn]},[Gt]);reactExports.useEffect(()=>{Wt.current=0},[Dt]),useFrame(()=>{Ht.current&&Wt.current<1&&(Wt.current+=.05,Ht.current.scale.set(Wt.current,Wt.current,Wt.current))});const Yt=Jt=>jsxRuntimeExports.jsxs(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(Jt).from("m").to(zt).toFixed(Vt.measurementPrecision),jt??zt]}),Zt=(Jt,nn,rn,Qt)=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(RoundedBox,{position:Jt,rotation:nn,scale:rn,visible:!0,children:[jsxRuntimeExports.jsx(RoundedBox,{position:[0,.5,0],scale:Qt==="z"?[7,Kt,1]:[1,Kt,7],visible:!0,children:jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt})}),jsxRuntimeExports.jsx(RoundedBox,{position:[0,-.5,0],scale:Qt==="z"?[7,Kt,1]:[1,Kt,7],visible:!0,children:jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt})}),jsxRuntimeExports.jsx("meshBasicMaterial",{color:qt}),Yt(Gt.size[Qt])]})});return!Dt||!Gt||Object.keys(Gt.size).some(Jt=>Gt.size[Jt]===0)||Object.keys(_e).length===0?null:jsxRuntimeExports.jsxs("group",{ref:Ht,children:[Zt([Gt.center.x,Gt.center.y-Gt.size.y/2,Gt.center.z+Gt.size.z/2+Xt],[0,0,degToRad(90)],[Kt,Gt.size.x,Kt],"x"),Zt([Gt.center.x-Gt.size.x/2-Xt,Gt.center.y,Gt.center.z+Gt.size.z/2+Xt],[0,0,0],[Kt,Gt.size.y,Kt],"y"),Zt([Gt.center.x+Gt.size.x/2+Xt,Gt.center.y-Gt.size.y/2,Gt.center.z],[degToRad(90),0,0],[Kt,Gt.size.z,Kt],"z")]})},BaseScene=({stores:kt})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HotspotManager,{stores:kt}),jsxRuntimeExports.jsx(DimensionsManager,{stores:kt}),jsxRuntimeExports.jsxs(Selection$1,{children:[jsxRuntimeExports.jsx(ItemManager,{stores:kt}),jsxRuntimeExports.jsx(EffectsComposer,{stores:kt})]})]}),CameraManager=({stores:kt})=>{const _e=reactExports.useRef(null),Dt=kt.hotspotStore(Jt=>Jt.isAnyHotspotActive),Vt=kt.cameraStore(Jt=>Jt.cameraSettings),Gt=kt.cameraStore(Jt=>Jt.disableAutoRotate),zt=kt.coreSceneStore(Jt=>Jt.autoFocusTrigger),jt=kt.coreSceneStore(Jt=>Jt.dragging),Ht=kt.cameraStore(Jt=>Jt.sendCameraDetailsTrigger),Wt=kt.cameraStore(Jt=>Jt.focusPointPosition),qt=kt.cameraStore(Jt=>Jt.viewPointPosition),{raycaster:Xt,camera:Kt}=useThree(),Yt=kt.ghostStore(Jt=>Jt.ghostsTransform),Zt=()=>{if(_e.current===null)return;const nn=1/_e.current._lastZoom,rn=kt.cameraStore.getState().boundsMargin,Qt=kt.coreSceneStore.getState().autoFocusRef;let en=new Box3;Qt?en.setFromObject(Qt):kt.coreSceneStore.getState().sceneRef.traverse(sn=>{sn.autoFocusEnabled&&en.expandByObject(sn)}),Qt||kt.coreSceneStore.setState({bbox:en});const tn=new Vector3;if(en.getSize(tn),tn.x>0){const sn=new Vector3;en.getCenter(sn);const cn=new Vector3(en.max.x,en.max.y,en.max.z);cn.sub(en.min),kt.coreSceneStore.setState({boundData:{center:sn,size:cn}}),_e.current.setBoundary(en);const un=new Box3(en.min,en.max);un.min=new Vector3((un.min.x-rn/2)*nn,(un.min.y-rn/2)*nn,(un.min.z-rn/2)*nn),un.max=new Vector3((un.max.x+rn/2)*nn,(un.max.y+rn/2)*nn,(un.max.z+rn/2)*nn);const hn=un.getBoundingSphere(new Sphere(sn));hn.radius>0&&_e.current.fitToSphere(hn,!0)}else{const sn=new Vector3(0,0,0),cn=new Vector3(0,0,0);kt.coreSceneStore.setState({boundData:{center:sn,size:cn}})}_e.current.zoomTo(1,!0)};return reactExports.useEffect(()=>{Zt()},[zt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API!=null&&(kt.itemStore.getState().isBusy()||(kt.coreSceneStore.getState().sceneSettings.focusCameraOnGhosts===!0?kt.coreSceneStore.getState().CORE_API.focusOnGhosts():kt.coreSceneStore.getState().CORE_API.refocus()))},[Yt]),reactExports.useEffect(()=>{if(_e.current===null)return;const Jt=kt.cameraStore.getState().savedState,nn=kt.cameraStore.getState().resetToLastPosition;if(Dt===!1){Jt===!0&&(nn===!0?_e.current.reset(!0):kt.cameraStore.setState({resetToLastPosition:!0}),kt.cameraStore.setState({savedState:!1}));return}Jt===!1&&nn===!0&&(_e.current.saveState(),kt.cameraStore.setState({savedState:!0})),_e.current.setLookAt(qt.x,qt.y,qt.z,Wt.x,Wt.y,Wt.z,!0)},[Dt,qt,Wt]),reactExports.useEffect(()=>{kt.coreSceneStore.getState().CORE_API!=null&&kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.CONFIGURATION.CameraDetails_Update,Kt)},[Ht]),useFrame(Jt=>{Vt.canAutoRotate===!1||_e.current===null||Gt===!1&&Dt===!1&&(_e.current.azimuthAngle+=20*Jt*MathUtils.DEG2RAD*Vt.autoRotateSpeed)}),reactExports.useEffect(()=>{_e.current!==null&&(Vt.canZoom===!0&&jt===!1?(_e.current.mouseButtons.wheel=CAMERA_ACTION.ZOOM,_e.current.mouseButtons.middle=CAMERA_ACTION.ZOOM):(_e.current.mouseButtons.wheel=CAMERA_ACTION.NONE,_e.current.mouseButtons.middle=CAMERA_ACTION.NONE),Vt.canPan===!0&&jt===!1?(_e.current.mouseButtons.right=CAMERA_ACTION.OFFSET,Vt.canZoom===!0&&jt===!1?(_e.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM_OFFSET,_e.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM_OFFSET):(_e.current.touches.two=CAMERA_ACTION.TOUCH_OFFSET,_e.current.touches.three=CAMERA_ACTION.TOUCH_OFFSET)):(_e.current.mouseButtons.right=CAMERA_ACTION.NONE,Vt.canZoom===!0&&jt===!1?(_e.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM,_e.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM):(_e.current.touches.two=CAMERA_ACTION.NONE,_e.current.touches.three=CAMERA_ACTION.NONE)))},[_e,Vt,jt]),reactExports.useEffect(()=>{if(_e.current===null)return;Kt.fov=Vt.fov,Kt.updateProjectionMatrix();const Jt=()=>{_e.current!==null&&(_e.current.removeEventListener("rest",Jt),kt.cameraStore.setState({userDragging:!1,disableAutoRotate:!1}))};_e.current.addEventListener("controlstart",()=>{kt.hotspotStore.getState().isAnyHotspotActive&&kt.hotspotStore.getState().actions.exitHotspot(),_e.current!==null&&(_e.current.removeEventListener("rest",Jt),kt.cameraStore.setState({userDragging:!0,disableAutoRotate:!0}))}),_e.current.addEventListener("controlend",()=>{_e.current!==null&&(_e.current.active?_e.current.addEventListener("rest",Jt):Jt())}),_e.current.addEventListener("transitionstart",()=>{_e.current!==null&&kt.cameraStore.getState().userDragging!==!0&&(kt.cameraStore.setState({disableAutoRotate:!0}),_e.current.addEventListener("rest",Jt))})},[_e]),reactExports.useEffect(()=>{_e.current&&(Xt.layers.enable(GHOST_LAYER),Kt.layers.enable(GHOST_LAYER),kt.cameraStore.setState({cameraControlsRef:_e.current}))},[_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(CameraControls,{ref:_e,makeDefault:!0,dollySpeed:Vt.dollySpeed,truckSpeed:Vt.truckSpeed,minZoom:Vt.minZoom,maxZoom:Vt.maxZoom,minPolarAngle:Dt?-Math.PI:degToRad(Vt.minPolarAngle),maxPolarAngle:Dt?Math.PI:degToRad(Vt.maxPolarAngle)})})},Root=({stores:kt})=>{const{gl:_e}=useThree();return reactExports.useEffect(()=>{kt.coreSceneStore.setState({glContext:_e}),_e.getContext("3d").canvas.ariaLabel="A 3D Canvas to visualize products from the Configurator."},[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(BaseScene,{stores:kt}),jsxRuntimeExports.jsx(CameraManager,{stores:kt}),jsxRuntimeExports.jsx(LightManager,{stores:kt})]})},Alert=({stores:kt,handleCloseAlert:_e,alertData:Dt})=>{const Vt=reactExports.useRef(null),Gt=reactExports.useRef(null),zt=reactExports.useRef(null),jt=kt.uiSceneStore(Xt=>Xt.dialogPopupOpen),Ht=kt.uiSceneStore(Xt=>Xt.isScreenPortrait),Wt=kt.cartStore(Xt=>Xt.previewCartModalOpen),qt=()=>{clearTimeout(Vt.current),zt.current.style="",Gt.current.style="",_e()};return reactExports.useEffect(()=>{if(zt.current===null||Gt.current===null)return;const Xt=Dt.alertTime?Dt.alertTime:1e3;zt.current.style="animation: loader "+Xt+"ms; animation-timing-function: linear;",Gt.current.style="animation: loader "+Xt+"ms; animation-timing-function: linear;",Vt.current=setTimeout(qt,Xt)},[zt,Gt,Dt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"alert-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),tabIndex:Ht?-1:0,"aria-hidden":Ht,children:[jsxRuntimeExports.jsx("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),children:jsxRuntimeExports.jsx("img",{src:ALERT_TYPES[Dt.alertType].src,className:"alert-icon",alt:Dt.alertType})}),jsxRuntimeExports.jsxs("div",{className:"alert-msg-cross-timer-bg",children:[jsxRuntimeExports.jsxs("div",{className:"alert-msg-cross-bg",children:[jsxRuntimeExports.jsxs("div",{className:"alert-msg-bg",style:Dt.alertLabel?{}:{display:"flex",alignItems:"center"},children:[Dt.alertLabel&&jsxRuntimeExports.jsx("p",{className:"alert-label",children:Dt.alertLabel}),jsxRuntimeExports.jsx("span",{className:"alert-msg",children:Dt.alertMsg})]}),jsxRuntimeExports.jsx("div",{className:"alert-close-btn-bg",children:jsxRuntimeExports.jsx("img",{tabIndex:jt?-1:0,"aria-hidden":jt,onClick:qt,className:"alert-cross-btn",alt:"Close",role:"button","aria-label":"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg"})})]}),jsxRuntimeExports.jsx("div",{ref:Gt,className:"alert-timer ".concat(ALERT_TYPES[Dt.alertType].cssClass)})]})]}),jsxRuntimeExports.jsxs("div",{className:"alert-bg alert-mobile ".concat(ALERT_TYPES[Dt.alertType].cssClass),tabIndex:Ht?0:-1,"aria-hidden":!Ht,children:[jsxRuntimeExports.jsxs("div",{className:"alert-icon-msg-cross-bg",children:[jsxRuntimeExports.jsx("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[Dt.alertType].cssClass),children:jsxRuntimeExports.jsx("img",{src:ALERT_TYPES[Dt.alertType].src,className:"alert-icon",alt:Dt.alertType})}),jsxRuntimeExports.jsxs("div",{className:"alert-msg-bg",children:[Dt.alertLabel&&jsxRuntimeExports.jsx("p",{className:"alert-label",children:Dt.alertLabel}),jsxRuntimeExports.jsx("span",{className:"alert-msg",children:Dt.alertMsg_Mobile?Dt.alertMsg_Mobile:Dt.alertMsg})]}),jsxRuntimeExports.jsx("div",{className:"alert-close-btn-bg",children:jsxRuntimeExports.jsx("img",{tabIndex:!jt&&!Wt?0:-1,"aria-hidden":jt||Wt,onClick:qt,className:"alert-cross-btn",alt:"Close",role:"button","aria-label":"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg"})})]}),jsxRuntimeExports.jsx("div",{ref:zt,className:"alert-timer ".concat(ALERT_TYPES[Dt.alertType].cssClass)})]})]})},AlertManager=({stores:kt})=>{const _e=kt.coreSceneStore(Wt=>Wt.alertData),Dt=kt.coreSceneStore(Wt=>Wt.persistantAlertData),Vt=kt.coreSceneStore(Wt=>Wt.currentAlertData),Gt=Wt=>{kt.coreSceneStore.setState({currentAlertData:Wt})};reactExports.useEffect(()=>{!_e||!_e.alertMsg||zt(_e)},[_e]),reactExports.useEffect(()=>{const Wt=kt.coreSceneStore.getState().alertQueue;Wt.length<=0||(Vt===null&&(Gt(Wt[0]),Wt[0].persistant===!0&&kt.coreSceneStore.setState({persistantAlertData:Wt[0]})),kt.coreSceneStore.getState().actions.popFromAlertQueue())},[Vt]);const zt=reactExports.useCallback(Wt=>{if(kt.coreSceneStore.getState().sceneSettings.disableAlerts===!0)return;let qt=Wt.alertType,Xt=Wt.alertId;const Kt=kt.coreSceneStore.getState().sceneSettings.alertControl;let Yt=!1;Object.keys(Kt).map(nn=>{nn==Xt&&(Yt=!0)}),Yt==!1&&(Xt="default");let Zt=!1;if(Object.keys(ALERT_TYPES).map(nn=>{nn==qt.toLowerCase()&&(Zt=!0)}),Zt==!1&&(qt=ALERT_TYPES.info.id,Wt.alertType=qt),ALERT_TYPES[Wt.alertType].level<kt.coreSceneStore.getState().sceneSettings.alertLevel||kt.coreSceneStore.getState().sceneSettings.alertControl[Xt]!==!0)return;const Jt=kt.coreSceneStore.getState().actions.addToAlertQueue(Wt);Vt===null&&Jt.length===1&&(Gt(Wt),Wt.persistant===!0&&kt.coreSceneStore.setState({persistantAlertData:Wt}))},[Vt]),jt=reactExports.useCallback(()=>{Gt(Dt)},[Dt]),Ht=reactExports.useCallback(async()=>{Gt(null)},[]);return reactExports.useEffect(()=>{async function Wt(){await wait(1500);let qt=null,Xt={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};kt.coreSceneStore.getState().alertSettings&&(kt.coreSceneStore.getState().alertSettings.welcomeMessage&&(qt=kt.coreSceneStore.getState().alertSettings.welcomeMessage),kt.coreSceneStore.getState().alertSettings.instructionMessage&&(Xt=kt.coreSceneStore.getState().alertSettings.instructionMessage)),qt!==null&&zt(qt),zt(Xt)}Wt()},[]),jsxRuntimeExports.jsxs("div",{className:"alert-space",children:[Vt===null&&Dt&&jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Alert Button",onClick:jt,className:"alert-persistant-btn-bg",style:{background:ALERT_TYPES[Dt.alertType].background,border:"1px solid "+ALERT_TYPES[Dt.alertType].color},children:jsxRuntimeExports.jsx("img",{style:{filter:ALERT_TYPES[Dt.alertType].filter},className:"alert-persistant-btn",alt:Dt.alertType,src:ALERT_TYPES[Dt.alertType].src})}),Vt&&jsxRuntimeExports.jsx(Alert,{stores:kt,handleCloseAlert:Ht,alertData:Vt})]})},FocusManager=({stores:kt})=>{const _e=kt.itemStore(Gt=>Gt.itemsSpawned),Dt=kt.uiSceneStore(Gt=>Gt.dialogPopupOpen),Vt=kt.cartStore(Gt=>Gt.previewCartModalOpen);return jsxRuntimeExports.jsx("div",{id:"focusBtns",children:Object.keys(_e).map((Gt,zt)=>jsxRuntimeExports.jsx("div",{children:_e[Gt].itemData.isInteractive&&_e[Gt].itemData.gltfURL&&jsxRuntimeExports.jsx("div",{onFocus:()=>{kt.itemStore.setState({focusedGUID:Gt})},onBlur:()=>{kt.itemStore.setState({focusedGUID:null})},onClick:()=>{const jt=kt.coreSceneStore.getState().canvasSize,Ht=kt.itemStore.getState().itemsSpawned,Wt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Gt),qt={primary:{guid:Gt,name:_e[Gt].itemData.name,data:{...Ht[Gt],overrideVariant:Wt.overrideVariant,currentVariant:Wt.currentVariant,offsetX:jt.width/2,offsetY:jt.height/2}}};kt.itemStore.getState().actions.setSelectedItemData(qt.primary.data),kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Show,qt)},role:"button",id:"focusBtn-"+Gt,tabIndex:!Vt&&!Dt?0:-1,className:"canvasFocusButton","aria-hidden":Vt||Dt,"aria-label":_e[Gt].itemData.name?_e[Gt].itemData.name:_e[Gt].itemData.skuID},"focusBtn-key-"+Gt)},"focusBtn-single-key-"+Gt))},"focusBtns")},OverlayUIManager=({stores:kt})=>{const _e=kt.coreSceneStore(zt=>zt.canvasTooltipText),Dt=kt.coreSceneStore(zt=>zt.sceneSettings),Vt=kt.ghostStore(zt=>zt.ghostData),Gt=kt.itemStore(zt=>zt.defaultSceneItemCount);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(AlertManager,{stores:kt}),jsxRuntimeExports.jsx(FocusManager,{stores:kt}),kt.coreSceneStore.getState().CORE_API.getSceneItemCount()<=Gt&&!Vt&&jsxRuntimeExports.jsx("div",{style:{fontSize:Dt.emptySceneTextFontSize},className:"emptySceneBG",children:Dt.emptySceneText}),jsxRuntimeExports.jsx("div",{className:"canvasTooltip",children:_e})]})})};function getPlugAttributesFromObject(kt){let _e={};if(kt.type.toLowerCase()==="object3d"){const Dt=kt.userData;if(Dt?.isPlug===1){const Vt=Dt.name;Vt&&typeof Vt=="string"&&(_e.name=Vt);const Gt=Dt.type;Gt&&typeof Gt=="string"?_e.type=Gt:_e.type="";const zt=Dt.weight;zt&&typeof zt=="number"?_e.weight=zt:_e.weight=1;const jt=Dt.affectedNodes;jt&&typeof jt=="string"?_e.affectedNodes=jt.replaceAll(" ","").split(","):_e.affectedNodes=[];const Ht=Dt.acceptedPlugTypes;Ht&&typeof Ht=="string"?_e.acceptedPlugTypes=Ht.replaceAll(" ","").split(","):_e.acceptedPlugTypes=[];const Wt=Dt.connectsToPlugTypes;Wt&&typeof Wt=="string"?_e.connectsToPlugTypes=Wt.replaceAll(" ","").split(","):_e.connectsToPlugTypes=[];const qt=Dt.dependencySku;qt&&typeof qt=="string"?_e.dependencySku=qt:_e.dependencySku="";const Xt=Dt.isDependencySkuInteractive;qt!==void 0&&typeof Xt=="number"?_e.isDependencySkuInteractive=Xt:_e.isDependencySkuInteractive=1}}return _e}async function loadAllDynamicHooks(kt,_e){if(!kt){LOGGER$1.info({title:"No hook URL provided"});return}try{const Dt=resolveAssetUrl(kt),Vt=_e.dynamicHookStore.getState(),Gt=await __vitePreload(()=>import(Dt),[]);for(const[zt,jt]of Object.entries(Gt))typeof jt=="function"&&(Vt[zt]!==void 0?(Vt[zt]=jt,LOGGER$1.info({title:`${zt} successfully updated from `+Dt})):LOGGER$1.warn({title:`No matching hook found for ${zt}`}))}catch(Dt){LOGGER$1.error({title:`Error loading dynamic hooks from: ${kt}`,details:Dt})}}async function loadAllProxies(kt,_e){kt.assetStore.getState().actions.init();const Dt=kt.assetStore.getState().actions,Vt=kt.coreSceneStore.getState().sceneSettings,Gt=Object.keys(_e).length;LOGGER$1.info({title:`Starting concurrent loading of ${Gt} proxies`});const zt=performance.now(),jt=Object.entries(_e).map(([Kt,Yt])=>loadSingleProxy(Kt,Yt,Dt,Vt)),Ht=await Promise.all(jt),Wt=performance.now(),qt=Ht.filter(Kt=>Kt.success).length;LOGGER$1.info({title:`Concurrent loading completed: ${qt}/${Gt} proxies loaded successfully in ${((Wt-zt)/1e3).toFixed(2)} seconds`});const Xt=Ht.filter(Kt=>!Kt.success);Xt.length>0&&LOGGER$1.warn({title:`Failed to load ${Xt.length} proxies:`,details:Xt.map(Kt=>Kt.skuID)})}async function loadSingleProxy(kt,_e,Dt,Vt){try{LOGGER$1.info({title:`Loading proxy: ${kt}`});const Gt=performance.now(),zt=await Dt.loadProxyAsset(kt,!0),jt=performance.now();if(LOGGER$1.info({title:`${kt} proxy: ${((jt-Gt)/1e3).toFixed(2)} seconds to load.`}),LOGGER$1.info({title:`Loaded proxy: ${kt}`,details:zt}),!zt?.proxy?.data)return{success:!1,skuID:kt,error:"No proxy data available"};const Ht=!_e.plugs||_e.plugs.length===0;Ht&&LOGGER$1.info({title:`Collecting plugs information for ${kt} from the proxy mesh`});let Wt=[];return zt.proxy.data.scene.traverse(qt=>{if(Ht){const Xt=getPlugAttributesFromObject(qt);Object.keys(Xt).length>0&&Wt.push(Xt)}qt.isMesh&&processMesh(qt,Vt)}),Wt.length>0&&(_e.plugs=Wt),updateBoundingBoxInfo(_e,zt),{success:!0,skuID:kt}}catch(Gt){return LOGGER$1.error({title:`Error loading proxy ${kt}:`,details:Gt}),{success:!1,skuID:kt,error:Gt.message}}}function processMesh(kt,_e){kt.layers.set(GHOST_LAYER);const Dt=_e.ghostColor;Object.assign(kt.material,{color:new Color$1(0,0,0),emissive:new Color$1(Dt.r/255,Dt.g/255,Dt.b/255),emissiveIntensity:.75,alphaTest:Dt.a,transparent:Dt.a<1,opacity:Dt.a,depthTest:!1,reflectivity:0,metalness:0,wireframe:_e.ghostAsWireframe})}function updateBoundingBoxInfo(kt,_e){const{boundingBox:Dt,boundingSphere:Vt}=computeProxyBoundingBox(_e);if(Dt&&Vt){const Gt=calculateBoundingBoxSize(Dt);Object.assign(kt,{boundingBox:Dt,boundingSphereCenter:Vt.center,boundingBoxSize:Gt})}else kt.boundingSphereCenter={x:0,y:0,z:0},kt.boundingBoxSize={x:0,y:0,z:0}}function calculateBoundingBoxSize(kt){return{x:kt.max.x-kt.min.x,y:kt.max.y-kt.min.y,z:kt.max.z-kt.min.z}}function computeProxyBoundingBox(kt){const _e=kt.proxy.data.scene;if(_e){let Dt=null;return _e.traverse(Vt=>{if(Vt.isMesh){Dt=Vt;return}}),Dt?(Dt.geometry.boundingBox||Dt.geometry.computeBoundingBox(),{boundingBox:Dt.geometry.boundingBox,boundingSphere:Dt.geometry.boundingSphere}):!1}}const AlertStyles=`.alert-space{position:absolute;width:auto;height:auto;max-width:40%;top:0;margin:1rem}.alert-bg{display:flex;flex-direction:row;border-radius:5.04px}.alert-mobile{display:none}.alert-persistant-btn{width:2rem;height:2rem;margin:4px;filter:invert(100%) brightness(200%)}.alert-persistant-btn-bg{cursor:pointer;display:flex;justify-content:center;align-items:center;border-radius:4px}.alert-persistant-btn-bg:hover{opacity:.9!important}.alert-icon{width:2rem;height:2rem;margin:14px;filter:invert(100%) brightness(200%)}.alert-icon-bg{border-radius:5.04px 0 0 5.04px}.alert-msg-bg{padding:1rem}.alert-label{font-weight:600;font-size:1.125rem;margin:0 0 4px;text-transform:capitalize}.alert-msg{font-size:1rem}.alert-cross-btn{width:1.5rem;cursor:pointer;margin:.5rem}.alert-msg-cross-timer-bg{display:flex;flex-direction:column;justify-content:space-between}.alert-msg-cross-bg{display:flex;flex-direction:row}.alert-timer{width:0%;height:2px;transition:10ms}.alert-bg.alert-info,.alert-bg.alert-mobile.alert-info{background-color:var(--info-light);border:1.26px solid var(--info-dark)}.alert-icon-bg.alert-info{background-color:var(--info-dark);border:1.26px solid var(--info-dark)}.alert-timer.alert-info{background-color:var(--info-dark)}.alert-bg.alert-warn,.alert-bg.alert-mobile.alert-warn{background-color:var(--warn-light);border:1.26px solid var(--warn-dark)}.alert-icon-bg.alert-warn{background-color:var(--warn-dark);border:1.26px solid var(--warn-dark)}.alert-timer.alert-warn{background-color:var(--warn-dark)}.alert-bg.alert-error,.alert-bg.alert-mobile.alert-error{background-color:var(--error-light);border:1.26px solid var(--error-dark)}.alert-icon-bg.alert-error{background-color:var(--error-dark);border:1.26px solid var(--error-dark)}.alert-timer.alert-error{background-color:var(--error-dark)}.alert-bg.alert-success,.alert-bg.alert-mobile.alert-success{background-color:var(--success-light);border:1.26px solid var(--success-dark)}.alert-icon-bg.alert-success{background-color:var(--success-dark);border:1.26px solid var(--success-dark)}.alert-timer.alert-success{background-color:var(--success-dark)}@keyframes loader{0%{width:0%}to{width:100%}}@media only screen and (orientation: portrait){.alert-label{margin:auto}.alert-close-btn-bg{display:flex;justify-content:center}.alert-icon-msg-cross-bg{display:flex;flex-direction:row;width:100%;align-items:center}.alert-space{width:100%;max-width:100%;margin:auto}.alert-bg{display:none;flex-direction:column}.alert-mobile{display:flex;justify-content:center;align-items:flex-start}.alert-icon{margin:4px}.alert-icon-bg{display:flex;justify-content:center;align-items:center;border-radius:5.04px;margin:8px 16px;height:fit-content}.alert-msg-bg{padding:1rem 0rem;width:calc(100% - 70px)}.alert-persistant-btn{margin:4px!important}.alert-persistant-btn-bg{display:flex;justify-content:center;width:calc(8px + 2rem)!important;align-items:center;border-radius:5.04px;margin:8px 16px}}
4464
4464
  `,GenericStyles=`#epigraphConfiguratorCore{width:100%;height:100%;margin:0;padding:0;overflow:hidden;display:flex;align-items:center;justify-content:space-evenly;align-content:center;flex-direction:row}*{user-select:none!important;-webkit-user-select:none!important}.coreContainer{position:relative;width:100%;height:100%}.grabCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Move.svg) 6 3,auto}.grabbingCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Grab.svg) 6 3,auto}.pointerCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Click.svg) 6 2,auto}.blockedCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Block.svg),auto}.moveCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-MoveArrows.svg) 8.65 8.65,auto}.mainCanvas{width:100%!important;height:100%!important;background:white}.uninteractable{pointer-events:none;opacity:.8}.dimensionsButtonParent{position:relative;display:flex}.dimensionText{font-size:.8rem;font-style:normal;font-weight:600}.dimensionActive{border-color:#c7c7c7!important}.canvasFocusButton{width:0;height:0;position:absolute;top:0}.color-grid{display:flex;gap:1rem}.canvasTooltip{position:absolute;width:100%;display:flex;padding:1rem;bottom:0;justify-content:center;color:#898989;font-style:italic;font-size:.75rem;font-family:Inter,helvetica,sans-serif;opacity:1;transition:.2s all ease;-webkit-transition:.2s all ease;pointer-events:none;text-transform:uppercase;margin-bottom:5rem}.emptySceneBG{position:absolute;width:100%;height:100%;display:flex;padding:1rem;bottom:0;font-size:2rem;justify-content:center;align-items:center;text-align:center;color:#89898939;font-family:Inter,helvetica,sans-serif;opacity:1;transition:.2s all ease;-webkit-transition:.2s all ease;pointer-events:none;text-transform:uppercase}
4465
4465
  `,HotspotStyles=`.topmostActive{z-index:1001!important}.topmostHover{z-index:1002!important}.hotspot{margin-left:0;transition:max-width .5s ease 0s;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:auto;max-width:36px;height:36px;border:3px solid var(--hotspot-button-border-color);border-radius:18px;box-shadow:#0000001f 0 1px 3px,#0000003d 0 1px 2px;background-color:var(--hotspot-button-background-color);transition:all .5s ease 0s;position:absolute;z-index:0;cursor:pointer;overflow:hidden;color:#000}.hotspot.left{right:-36px}.hotspot:hover{border:3px solid #000}.hotspot:hover,.hotspot.active{opacity:1!important;cursor:pointer;max-width:400px;box-shadow:#00000040 0 14px 28px,#00000038 0 10px 10px}.hotspot:hover .inner-circle{border:2px solid #000}.hotspot.active .inner-circle{background:#fff;border:10px solid var(--hotspot-active-inner-circle-border-color);width:30px;height:30px;left:-.2px;top:-.2px}.hotspot-annotation{display:inline-flex;margin:0 27px 0 34px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-style:normal;font-weight:500;font-size:14px;white-space:nowrap}.hotspot.visited:not(:focus) .inner-circle{background:#fff;border:12px solid var(--visited-color)}.hotspot .inner-circle{width:36px;height:36px;border:3px solid var(--hotspot-inner-circle-border-color);background:white;border-radius:18px;box-sizing:border-box;position:absolute;top:-3px;left:-3px;transition:.1s}.hotspot.left .inner-circle{left:auto;right:-2px}.hotspot.left:hover .inner-circle{left:auto;right:-3px}.hotspot.left .hotspot-annotation{margin:0 34px 0 27px}@media screen and (orientation: portrait){.hotspot:hover{opacity:1!important;cursor:pointer;max-width:36px;box-shadow:#0000001f 0 1px 3px,#0000003d 0 1px 2px;border:3px solid var(--hotspot-button-border-color)}.hotspot:hover .inner-circle{border:3px solid var(--hotspot-inner-circle-border-color)}.hotspot.active{opacity:1!important;cursor:pointer;max-width:400px;box-shadow:#00000040 0 14px 28px,#00000038 0 10px 10px}.hotspot.active .inner-circle{background:#fff;border:10px solid var(--hotspot-active-inner-circle-border-color);width:30px;height:30px;left:-.2px;top:-.2px}}
4466
4466
  `,DimensionStyles=`.dimensionsText{background:rgb(0,0,0);padding:.2rem .6rem;border-radius:.5rem;color:#fff;white-space:nowrap;transition:.5s}.dimensions:before{content:"";display:block;position:absolute;top:50%;left:-30px;width:30px;height:1px;background-color:#000}.dimensions:after{content:"";display:block;position:absolute;top:50%;right:-30px;width:30px;height:1px;background-color:#000}.yDimension{transform:rotate(90deg)}.zDimension{transform:rotateY(90deg)}
4467
4467
  `,MobileStyles=`@media only screen and (orientation: portrait){.shellCanvasBottomOptions,.shellCanvasTopOptions{display:none}.shellButtonContainer .buttonContent{min-width:1.75rem;max-width:1.75rem;min-height:1.75rem;max-height:1.75rem}.shellButtonContainer{padding-left:.5rem}.canvasTooltip{position:absolute;width:100%;display:flex;padding-left:2rem;padding-right:2rem;bottom:0;justify-content:center;color:#898989;font-style:italic;font-size:.75rem;font-family:Inter,helvetica,sans-serif;opacity:1;transition:.2s all ease;-webkit-transition:.2s all ease;pointer-events:none;text-transform:uppercase;margin-bottom:0rem;text-align:center}}
4468
- `,CORE_LOCAL_STYLES=[{id:"alertStyle",contents:AlertStyles},{id:"styles",contents:GenericStyles},{id:"hotspotStyle",contents:HotspotStyles},{id:"dimensions",contents:DimensionStyles},{id:"coreMobileStyles",contents:MobileStyles}];function App$1({parsedData:kt,stores:_e,clientAccessKey:Dt,initialConfigId:Vt,builderMode:Gt,disableCart:zt}){const jt=_e.productDataStore(dn=>dn),Ht=_e.coreSceneStore(dn=>dn.preconfigurationLoaded),Wt=_e.coreSceneStore(dn=>dn.frameLoop),qt=_e.cameraStore(dn=>dn.viewPointPosition),[Xt,Kt]=reactExports.useState(!1),Yt=_e.coreSceneStore(dn=>dn.cssLoaded),[Zt,Jt]=reactExports.useState(null),[nn,rn]=reactExports.useState(!1),Qt=reactExports.useRef(null),en=reactExports.useRef(null),tn=_e.coreSceneStore(dn=>dn.setCSSLoaded),sn=reactExports.useRef(!1);async function cn(){let dn=kt.productData;_e.productDataStore.getState().actions.setProductData({...dn});let pn=kt.configuratorSettings,fn=kt.categoryData;Gt&&(_e.coreSceneStore.setState({builderMode:Gt}),fn.build.map(En=>En.replace=!1),pn.coreSettings.disableContextMenu=!0,pn.coreSettings.disableDragDrop=!0),pn.alertSettings&&_e.coreSceneStore.getState().actions.setAlertSettings({...pn.alertSettings}),_e.coreSceneStore.getState().actions.setCoreSettings({...pn.coreSettings}),await loadAllProxies(_e,dn),_e.cameraStore.getState().actions.setCameraSettings({...pn.cameraSettings}),fn&&fn.geometryVariants===void 0&&(fn.geometryVariants=[]),_e.productDataStore.getState().actions.setCategoryData({...fn});let mn=kt.lookData;Object.keys(mn).map(En=>mn[En].id=En),mn&&_e.productDataStore.getState().actions.setLookData({...mn});let vn=kt.hotspotsData;vn&&_e.productDataStore.getState().actions.setHotspotsData({...vn});let _n=kt.assetsData;return _n&&_e.productDataStore.getState().actions.setAssetsData({..._n}),await loadAllDynamicHooks(_n.hooks,_e),zt===!0&&_e.coreSceneStore.getState().actions.disableCart(),{success:!0,productData:dn,categoryData:fn,lookData:mn,hotspotsData:vn,assetsData:_n}}async function un(dn){LOGGER.group("LOADING INITIAL DATA"),LOGGER.table({initialConfigId:dn,clientAccessKey:Dt}),LOGGER.groupEnd();const pn=await cn();let fn=_e.attachmentStore.getState().defaultConfig;return dn&&dn!=="default"?(_e.coreSceneStore.setState({sceneHasDefaultConfigurationID:!1}),fn=await _e.attachmentStore.getState().actions.loadSavedStructureFromConfigID(dn),fn&&(_e.coreSceneStore.getState().CORE_API.lastSharedConfigurationID=dn,_e.coreSceneStore.getState().CORE_API.hasSceneChanged=!1,_e.attachmentStore.setState({defaultConfig:fn}),Kt(!0))):!Gt&&_e.coreSceneStore.getState().sceneSettings.defaultConfigurationID?(_e.coreSceneStore.setState({sceneHasDefaultConfigurationID:!0}),fn=await _e.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e.coreSceneStore.getState().sceneSettings.defaultConfigurationID),fn&&(_e.attachmentStore.setState({defaultConfig:fn}),Kt(!0))):(_e.coreSceneStore.setState({preconfigurationLoaded:!0}),Kt(!0)),await _e.attachmentStore.getState().actions.initializeAttachmentSystem(_e),rn(pn.success),pn.success?pn:null}const hn=reactExports.useCallback(()=>{en.current&&_e.coreSceneStore.setState({canvasSize:en.current.getClientRects()[0]})},[en]);return reactExports.useEffect(()=>{async function dn(){if(sn.current)return;sn.current=!0;const pn=tabletCheck(),fn=pn||mobileCheck(),mn=!(fn||pn),vn=touchDeviceCheck(),_n=window.matchMedia("(orientation: portrait)"),En=!_n.matches;_e.coreSceneStore.setState({isMobile:fn,isTablet:pn,isDesktop:mn,isTouchDevice:vn,isLandscape:En}),_n.addEventListener("change",function(Tn){Tn.matches?_e.coreSceneStore.setState({isLandscape:!1}):_e.coreSceneStore.setState({isLandscape:!0})});const An=await un(Vt);Jt(An)}dn()},[sn]),reactExports.useEffect(()=>{const{current:dn}=en;if(!dn)return;_e.coreSceneStore.setState({cursorParentRef:dn}),_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),new ResizeObserver(()=>{hn()}).observe(dn)},[en]),reactExports.useEffect(()=>{Yt&&Zt&&Ht&&(LOGGER.info({title:"Firing coreApi:ready event."}),_e.coreSceneStore.getState().CORE_API.fireEvent("coreApi:ready",Zt),_e.coreSceneStore.getState().CORE_API.configuratorWCRef.launchInAr&&(LOGGER.info({title:"Attempting to auto launch view in your space"}),_e.coreSceneStore.getState().CORE_API.viewInYourSpace()))},[Yt,Zt,Ht]),reactExports.useEffect(()=>{const dn=_e.wcRef;dn.addEventListener("mousedown",()=>_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRABBING)),window.addEventListener("mouseup",()=>_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB)),dn.addEventListener("touchstart",pn=>{pn.touches.length>1&&_e.coreSceneStore.setState({multipleTouchDetected:!0})}),window.addEventListener("touchend",pn=>{pn.touches.length==0&&_e.coreSceneStore.setState({multipleTouchDetected:!1})}),window.addEventListener("resize",()=>hn())},[]),jsxRuntimeExports.jsxs("div",{className:"coreContainer",ref:en,children:[jsxRuntimeExports.jsx(StyleManager,{stores:_e,containerId:"coreStylesContainer",localStyles:CORE_LOCAL_STYLES,dynamicStylesId:"coreStyles",setCSSLoaded:tn}),Yt&&nn&&Object.keys(jt.productData).length>0&&Object.keys(jt.categoryData).length>0&&Xt&&jsxRuntimeExports.jsx(Canvas,{ref:Qt,frameloop:Wt,className:"mainCanvas",gl:{preserveDrawingBuffer:Gt||_e.coreSceneStore.getState().sceneSettings.preserveDrawingBuffer},camera:{position:qt},shadows:!0,dpr:[1,2],style:{background:_e.cameraStore.getState().cameraSettings.clearColour},children:jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:null,children:jsxRuntimeExports.jsx(Root,{stores:_e})})}),Yt&&nn&&Object.keys(jt.productData).length>0&&Object.keys(jt.categoryData).length>0&&Xt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(OverlayUIManager,{stores:_e})})]})}let _renderer,fullscreenQuadGeometry,fullscreenQuadMaterial,fullscreenQuad;function decompress(kt,_e=1/0,Dt=null){fullscreenQuadGeometry||(fullscreenQuadGeometry=new PlaneGeometry(2,2,1,1)),fullscreenQuadMaterial||(fullscreenQuadMaterial=new ShaderMaterial({uniforms:{blitTexture:new Uniform(kt)},vertexShader:`
4468
+ `,CORE_LOCAL_STYLES=[{id:"alertStyle",contents:AlertStyles},{id:"styles",contents:GenericStyles},{id:"hotspotStyle",contents:HotspotStyles},{id:"dimensions",contents:DimensionStyles},{id:"coreMobileStyles",contents:MobileStyles}];function App$1({parsedData:kt,stores:_e,clientAccessKey:Dt,initialConfigId:Vt,builderMode:Gt,disableCart:zt}){const jt=_e.productDataStore(dn=>dn),Ht=_e.coreSceneStore(dn=>dn.preconfigurationLoaded),Wt=_e.coreSceneStore(dn=>dn.frameLoop),qt=_e.cameraStore(dn=>dn.viewPointPosition),[Xt,Kt]=reactExports.useState(!1),Yt=_e.coreSceneStore(dn=>dn.cssLoaded),[Zt,Jt]=reactExports.useState(null),[nn,rn]=reactExports.useState(!1),Qt=reactExports.useRef(null),en=reactExports.useRef(null),tn=_e.coreSceneStore(dn=>dn.setCSSLoaded),sn=reactExports.useRef(!1);async function cn(){let dn=kt.productData;_e.productDataStore.getState().actions.setProductData({...dn});let pn=kt.configuratorSettings,fn=kt.categoryData;Gt&&(_e.coreSceneStore.setState({builderMode:Gt}),fn.build.map(En=>En.replace=!1),pn.coreSettings.disableContextMenu=!0,pn.coreSettings.disableDragDrop=!0),pn.alertSettings&&_e.coreSceneStore.getState().actions.setAlertSettings({...pn.alertSettings}),_e.coreSceneStore.getState().actions.setCoreSettings({...pn.coreSettings}),await loadAllProxies(_e,dn),_e.cameraStore.getState().actions.setCameraSettings({...pn.cameraSettings}),fn&&fn.geometryVariants===void 0&&(fn.geometryVariants=[]),_e.productDataStore.getState().actions.setCategoryData({...fn});let mn=kt.lookData;Object.keys(mn).map(En=>mn[En].id=En),mn&&_e.productDataStore.getState().actions.setLookData({...mn});let vn=kt.hotspotsData;vn&&_e.productDataStore.getState().actions.setHotspotsData({...vn});let _n=kt.assetsData;return _n&&_e.productDataStore.getState().actions.setAssetsData({..._n}),await loadAllDynamicHooks(_n.hooks,_e),zt===!0&&_e.coreSceneStore.getState().actions.disableCart(),{success:!0,productData:dn,categoryData:fn,lookData:mn,hotspotsData:vn,assetsData:_n}}async function un(dn){LOGGER$1.group("LOADING INITIAL DATA"),LOGGER$1.table({initialConfigId:dn,clientAccessKey:Dt}),LOGGER$1.groupEnd();const pn=await cn();let fn=_e.attachmentStore.getState().defaultConfig;return dn&&dn!=="default"?(_e.coreSceneStore.setState({sceneHasDefaultConfigurationID:!1}),fn=await _e.attachmentStore.getState().actions.loadSavedStructureFromConfigID(dn),fn&&(_e.coreSceneStore.getState().CORE_API.lastSharedConfigurationID=dn,_e.coreSceneStore.getState().CORE_API.hasSceneChanged=!1,_e.attachmentStore.setState({defaultConfig:fn}),Kt(!0))):!Gt&&_e.coreSceneStore.getState().sceneSettings.defaultConfigurationID?(_e.coreSceneStore.setState({sceneHasDefaultConfigurationID:!0}),fn=await _e.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e.coreSceneStore.getState().sceneSettings.defaultConfigurationID),fn&&(_e.attachmentStore.setState({defaultConfig:fn}),Kt(!0))):(_e.coreSceneStore.setState({preconfigurationLoaded:!0}),Kt(!0)),await _e.attachmentStore.getState().actions.initializeAttachmentSystem(_e),rn(pn.success),pn.success?pn:null}const hn=reactExports.useCallback(()=>{en.current&&_e.coreSceneStore.setState({canvasSize:en.current.getClientRects()[0]})},[en]);return reactExports.useEffect(()=>{async function dn(){if(sn.current)return;sn.current=!0;const pn=tabletCheck(),fn=pn||mobileCheck(),mn=!(fn||pn),vn=touchDeviceCheck(),_n=window.matchMedia("(orientation: portrait)"),En=!_n.matches;_e.coreSceneStore.setState({isMobile:fn,isTablet:pn,isDesktop:mn,isTouchDevice:vn,isLandscape:En}),_n.addEventListener("change",function(Tn){Tn.matches?_e.coreSceneStore.setState({isLandscape:!1}):_e.coreSceneStore.setState({isLandscape:!0})});const An=await un(Vt);Jt(An)}dn()},[sn]),reactExports.useEffect(()=>{const{current:dn}=en;if(!dn)return;_e.coreSceneStore.setState({cursorParentRef:dn}),_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB),new ResizeObserver(()=>{hn()}).observe(dn)},[en]),reactExports.useEffect(()=>{Yt&&Zt&&Ht&&(LOGGER$1.info({title:"Firing coreApi:ready event."}),_e.coreSceneStore.getState().CORE_API.fireEvent("coreApi:ready",Zt),_e.coreSceneStore.getState().CORE_API.configuratorWCRef.launchInAr&&(LOGGER$1.info({title:"Attempting to auto launch view in your space"}),_e.coreSceneStore.getState().CORE_API.viewInYourSpace()))},[Yt,Zt,Ht]),reactExports.useEffect(()=>{const dn=_e.wcRef;dn.addEventListener("mousedown",()=>_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRABBING)),window.addEventListener("mouseup",()=>_e.coreSceneStore.getState().CORE_API.switchCursor(CURSORS.GRAB)),dn.addEventListener("touchstart",pn=>{pn.touches.length>1&&_e.coreSceneStore.setState({multipleTouchDetected:!0})}),window.addEventListener("touchend",pn=>{pn.touches.length==0&&_e.coreSceneStore.setState({multipleTouchDetected:!1})}),window.addEventListener("resize",()=>hn())},[]),jsxRuntimeExports.jsxs("div",{className:"coreContainer",ref:en,children:[jsxRuntimeExports.jsx(StyleManager,{stores:_e,containerId:"coreStylesContainer",localStyles:CORE_LOCAL_STYLES,dynamicStylesId:"coreStyles",setCSSLoaded:tn}),Yt&&nn&&Object.keys(jt.productData).length>0&&Object.keys(jt.categoryData).length>0&&Xt&&jsxRuntimeExports.jsx(Canvas,{ref:Qt,frameloop:Wt,className:"mainCanvas",gl:{preserveDrawingBuffer:Gt||_e.coreSceneStore.getState().sceneSettings.preserveDrawingBuffer},camera:{position:qt},shadows:!0,dpr:[1,2],style:{background:_e.cameraStore.getState().cameraSettings.clearColour},children:jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:null,children:jsxRuntimeExports.jsx(Root,{stores:_e})})}),Yt&&nn&&Object.keys(jt.productData).length>0&&Object.keys(jt.categoryData).length>0&&Xt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(OverlayUIManager,{stores:_e})})]})}let _renderer,fullscreenQuadGeometry,fullscreenQuadMaterial,fullscreenQuad;function decompress(kt,_e=1/0,Dt=null){fullscreenQuadGeometry||(fullscreenQuadGeometry=new PlaneGeometry(2,2,1,1)),fullscreenQuadMaterial||(fullscreenQuadMaterial=new ShaderMaterial({uniforms:{blitTexture:new Uniform(kt)},vertexShader:`
4469
4469
  varying vec2 vUv;
4470
4470
  void main(){
4471
4471
  vUv = uv;
@@ -4633,7 +4633,7 @@ ${zt.join(`
4633
4633
  float verticalAperture = ${kt.getFilmHeight().toPrecision(PRECISION)}
4634
4634
  }
4635
4635
 
4636
- `}class EventDispatcher{constructor(){this._listeners={}}addEventListener(_e,Dt){const Vt=this._listeners;return Vt[_e]===void 0&&(Vt[_e]=[]),Vt[_e].indexOf(Dt)===-1&&Vt[_e].push(Dt),this}removeEventListener(_e,Dt){if(this._listeners===void 0)return this;const Gt=this._listeners[_e];if(Gt!==void 0){const zt=Gt.indexOf(Dt);zt!==-1&&Gt.splice(zt,1)}return this}dispatchEvent(_e){if(this._listeners===void 0)return this;const Vt=this._listeners[_e.type];if(Vt!==void 0){const Gt=Vt.slice(0);for(let zt=0,jt=Gt.length;zt<jt;zt++)Gt[zt].call(this,_e)}return this}dispose(){for(const _e in this._listeners)delete this._listeners[_e]}}class GraphEdge extends EventDispatcher{constructor(_e,Dt,Vt,Gt={}){if(super(),this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=_e,this._parent=Dt,this._child=Vt,this._attributes=Gt,!Dt.isOnGraph(Vt))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(_e){return this._child=_e,this}getAttributes(){return this._attributes}dispose(){this._disposed||(this._disposed=!0,this.dispatchEvent({type:"dispose",target:this}),super.dispose())}isDisposed(){return this._disposed}}class Graph extends EventDispatcher{constructor(..._e){super(..._e),this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(_e){return Array.from(this._childEdges.get(_e)||this._emptySet)}listParents(_e){return this.listParentEdges(_e).map(Dt=>Dt.getParent())}listChildEdges(_e){return Array.from(this._parentEdges.get(_e)||this._emptySet)}listChildren(_e){return this.listChildEdges(_e).map(Dt=>Dt.getChild())}disconnectParents(_e,Dt){let Vt=this.listParentEdges(_e);return Dt&&(Vt=Vt.filter(Gt=>Dt(Gt.getParent()))),Vt.forEach(Gt=>Gt.dispose()),this}createEdge(_e,Dt,Vt,Gt){return this._registerEdge(new GraphEdge(_e,Dt,Vt,Gt))}_registerEdge(_e){this._edges.add(_e);const Dt=_e.getParent();this._parentEdges.has(Dt)||this._parentEdges.set(Dt,new Set),this._parentEdges.get(Dt).add(_e);const Vt=_e.getChild();return this._childEdges.has(Vt)||this._childEdges.set(Vt,new Set),this._childEdges.get(Vt).add(_e),_e.addEventListener("dispose",()=>this._removeEdge(_e)),_e}_removeEdge(_e){return this._edges.delete(_e),this._parentEdges.get(_e.getParent()).delete(_e),this._childEdges.get(_e.getChild()).delete(_e),this}}function _extends(){return _extends=Object.assign||function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},_extends.apply(this,arguments)}function isRef(kt){return kt instanceof GraphEdge}function isRefList(kt){return Array.isArray(kt)&&kt[0]instanceof GraphEdge}function isRefMap(kt){return!!(isPlainObject(kt)&&getFirstValue(kt)instanceof GraphEdge)}function getFirstValue(kt){for(const _e in kt)return kt[_e]}function isPlainObject(kt){return!!kt&&Object.getPrototypeOf(kt)===Object.prototype}const $attributes=Symbol("attributes"),$immutableKeys=Symbol("immutableKeys");class GraphNode extends EventDispatcher{constructor(_e){super(),this._disposed=!1,this.graph=void 0,this[$attributes]=void 0,this[$immutableKeys]=void 0,this.graph=_e,this[$immutableKeys]=new Set,this[$attributes]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){const _e=this.getDefaults(),Dt={};for(const Vt in _e){const Gt=_e[Vt];if(Gt instanceof GraphNode){const zt=this.graph.createEdge(Vt,this,Gt);zt.addEventListener("dispose",()=>Gt.dispose()),this[$immutableKeys].add(Vt),Dt[Vt]=zt}else Dt[Vt]=Gt}return Dt}isOnGraph(_e){return this.graph===_e.graph}isDisposed(){return this._disposed}dispose(){this._disposed||(this.graph.listChildEdges(this).forEach(_e=>_e.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"}))}detach(){return this.graph.disconnectParents(this),this}swap(_e,Dt){for(const Vt in this[$attributes]){const Gt=this[$attributes][Vt];if(isRef(Gt)){const zt=Gt;zt.getChild()===_e&&this.setRef(Vt,Dt,zt.getAttributes())}else if(isRefList(Gt)){const jt=Gt.find(Ht=>Ht.getChild()===_e);if(jt){const Ht=jt.getAttributes();this.removeRef(Vt,_e).addRef(Vt,Dt,Ht)}}else if(isRefMap(Gt)){const zt=Gt;for(const jt in zt){const Ht=zt[jt];Ht.getChild()===_e&&this.setRefMap(Vt,jt,Dt,Ht.getAttributes())}}}return this}get(_e){return this[$attributes][_e]}set(_e,Dt){return this[$attributes][_e]=Dt,this.dispatchEvent({type:"change",attribute:_e})}getRef(_e){const Dt=this[$attributes][_e];return Dt?Dt.getChild():null}setRef(_e,Dt,Vt){if(this[$immutableKeys].has(_e))throw new Error(`Cannot overwrite immutable attribute, "${_e}".`);const Gt=this[$attributes][_e];if(Gt&&Gt.dispose(),!Dt)return this;const zt=this.graph.createEdge(_e,this,Dt,Vt);return zt.addEventListener("dispose",()=>{delete this[$attributes][_e],this.dispatchEvent({type:"change",attribute:_e})}),this[$attributes][_e]=zt,this.dispatchEvent({type:"change",attribute:_e})}listRefs(_e){return this[$attributes][_e].map(Vt=>Vt.getChild())}addRef(_e,Dt,Vt){const Gt=this.graph.createEdge(_e,this,Dt,Vt),zt=this[$attributes][_e];return zt.push(Gt),Gt.addEventListener("dispose",()=>{let jt;for(;(jt=zt.indexOf(Gt))!==-1;)zt.splice(jt,1);this.dispatchEvent({type:"change",attribute:_e})}),this.dispatchEvent({type:"change",attribute:_e})}removeRef(_e,Dt){return this[$attributes][_e].filter(zt=>zt.getChild()===Dt).forEach(zt=>zt.dispose()),this}listRefMapKeys(_e){return Object.keys(this[$attributes][_e])}listRefMapValues(_e){return Object.values(this[$attributes][_e]).map(Dt=>Dt.getChild())}getRefMap(_e,Dt){const Vt=this[$attributes][_e];return Vt[Dt]?Vt[Dt].getChild():null}setRefMap(_e,Dt,Vt,Gt){const zt=this[$attributes][_e],jt=zt[Dt];if(jt&&jt.dispose(),!Vt)return this;Gt=Object.assign(Gt||{},{key:Dt});const Ht=this.graph.createEdge(_e,this,Vt,_extends({},Gt,{key:Dt}));return Ht.addEventListener("dispose",()=>{delete zt[Dt],this.dispatchEvent({type:"change",attribute:_e,key:Dt})}),zt[Dt]=Ht,this.dispatchEvent({type:"change",attribute:_e,key:Dt})}dispatchEvent(_e){return super.dispatchEvent(_extends({},_e,{target:this})),this.graph.dispatchEvent(_extends({},_e,{target:this,type:`node:${_e.type}`})),this}}const u="v3.7.3",c="@glb.bin";var h,f,l,d,g;(function(kt){kt.ACCESSOR="Accessor",kt.ANIMATION="Animation",kt.ANIMATION_CHANNEL="AnimationChannel",kt.ANIMATION_SAMPLER="AnimationSampler",kt.BUFFER="Buffer",kt.CAMERA="Camera",kt.MATERIAL="Material",kt.MESH="Mesh",kt.PRIMITIVE="Primitive",kt.PRIMITIVE_TARGET="PrimitiveTarget",kt.NODE="Node",kt.ROOT="Root",kt.SCENE="Scene",kt.SKIN="Skin",kt.TEXTURE="Texture",kt.TEXTURE_INFO="TextureInfo"})(h||(h={})),function(kt){kt.INTERLEAVED="interleaved",kt.SEPARATE="separate"}(f||(f={})),function(kt){kt.ARRAY_BUFFER="ARRAY_BUFFER",kt.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",kt.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",kt.OTHER="OTHER",kt.SPARSE="SPARSE"}(l||(l={})),function(kt){kt[kt.R=4096]="R",kt[kt.G=256]="G",kt[kt.B=16]="B",kt[kt.A=1]="A"}(d||(d={})),function(kt){kt.GLTF="GLTF",kt.GLB="GLB"}(g||(g={}));const p={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var m,w=typeof Float32Array<"u"?Float32Array:Array;function y(kt){return Math.hypot(kt[0],kt[1],kt[2])}Math.hypot||(Math.hypot=function(){for(var kt=0,_e=arguments.length;_e--;)kt+=arguments[_e]*arguments[_e];return Math.sqrt(kt)}),m=new w(3),w!=Float32Array&&(m[0]=0,m[1]=0,m[2]=0);class E{static createBufferFromDataURI(_e){if(typeof Buffer>"u"){const Dt=atob(_e.split(",")[1]),Vt=new Uint8Array(Dt.length);for(let Gt=0;Gt<Dt.length;Gt++)Vt[Gt]=Dt.charCodeAt(Gt);return Vt}{const Dt=_e.split(",")[1],Vt=_e.indexOf("base64")>=0;return Buffer.from(Dt,Vt?"base64":"utf8")}}static encodeText(_e){return typeof TextEncoder<"u"?new TextEncoder().encode(_e):Buffer.from(_e)}static decodeText(_e){return typeof TextDecoder<"u"?new TextDecoder().decode(_e):Buffer.from(_e).toString("utf8")}static concat(_e){let Dt=0;for(const zt of _e)Dt+=zt.byteLength;const Vt=new Uint8Array(Dt);let Gt=0;for(const zt of _e)Vt.set(zt,Gt),Gt+=zt.byteLength;return Vt}static pad(_e,Dt=0){const Vt=this.padNumber(_e.byteLength);if(Vt===_e.byteLength)return _e;const Gt=new Uint8Array(Vt);if(Gt.set(_e),Dt!==0)for(let zt=_e.byteLength;zt<Vt;zt++)Gt[zt]=Dt;return Gt}static padNumber(_e){return 4*Math.ceil(_e/4)}static equals(_e,Dt){if(_e===Dt)return!0;if(_e.byteLength!==Dt.byteLength)return!1;let Vt=_e.byteLength;for(;Vt--;)if(_e[Vt]!==Dt[Vt])return!1;return!0}static toView(_e,Dt=0,Vt=1/0){return new Uint8Array(_e.buffer,_e.byteOffset+Dt,Math.min(_e.byteLength,Vt))}static assertView(_e){if(_e&&!ArrayBuffer.isView(_e))throw new Error(`Method requires Uint8Array parameter; received "${typeof _e}".`);return _e}}class S{static hexToFactor(_e,Dt){_e=Math.floor(_e);const Vt=Dt;return Vt[0]=(_e>>16&255)/255,Vt[1]=(_e>>8&255)/255,Vt[2]=(255&_e)/255,this.convertSRGBToLinear(Dt,Dt)}static factorToHex(_e){const Dt=[..._e],[Vt,Gt,zt]=this.convertLinearToSRGB(_e,Dt);return 255*Vt<<16^255*Gt<<8^255*zt<<0}static convertSRGBToLinear(_e,Dt){const Vt=_e,Gt=Dt;for(let zt=0;zt<3;zt++)Gt[zt]=Vt[zt]<.04045?.0773993808*Vt[zt]:Math.pow(.9478672986*Vt[zt]+.0521327014,2.4);return Dt}static convertLinearToSRGB(_e,Dt){const Vt=_e,Gt=Dt;for(let zt=0;zt<3;zt++)Gt[zt]=Vt[zt]<.0031308?12.92*Vt[zt]:1.055*Math.pow(Vt[zt],.41666)-.055;return Dt}}class M{match(_e){return _e.length>=8&&_e[0]===137&&_e[1]===80&&_e[2]===78&&_e[3]===71&&_e[4]===13&&_e[5]===10&&_e[6]===26&&_e[7]===10}getSize(_e){const Dt=new DataView(_e.buffer,_e.byteOffset);return E.decodeText(_e.slice(12,16))===M.PNG_FRIED_CHUNK_NAME?[Dt.getUint32(32,!1),Dt.getUint32(36,!1)]:[Dt.getUint32(16,!1),Dt.getUint32(20,!1)]}getChannels(_e){return 4}}M.PNG_FRIED_CHUNK_NAME="CgBI";class I{static registerFormat(_e,Dt){this.impls[_e]=Dt}static getMimeType(_e){for(const Dt in this.impls)if(this.impls[Dt].match(_e))return Dt;return null}static getSize(_e,Dt){return this.impls[Dt]?this.impls[Dt].getSize(_e):null}static getChannels(_e,Dt){return this.impls[Dt]?this.impls[Dt].getChannels(_e):null}static getVRAMByteLength(_e,Dt){if(!this.impls[Dt])return null;if(this.impls[Dt].getVRAMByteLength)return this.impls[Dt].getVRAMByteLength(_e);let Vt=0;const Gt=this.getSize(_e,Dt);if(!Gt)return null;for(;Gt[0]>1||Gt[1]>1;)Vt+=Gt[0]*Gt[1]*4,Gt[0]=Math.max(Math.floor(Gt[0]/2),1),Gt[1]=Math.max(Math.floor(Gt[1]/2),1);return Vt+=4,Vt}static mimeTypeToExtension(_e){return _e==="image/jpeg"?"jpg":_e.split("/").pop()}static extensionToMimeType(_e){return _e==="jpg"?"image/jpeg":_e?`image/${_e}`:""}}function R(kt,_e){if(_e>kt.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(kt.getUint8(_e)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return kt}I.impls={"image/jpeg":new class{match(kt){return kt.length>=3&&kt[0]===255&&kt[1]===216&&kt[2]===255}getSize(kt){let _e,Dt,Vt=new DataView(kt.buffer,kt.byteOffset+4);for(;Vt.byteLength;){if(_e=Vt.getUint16(0,!1),R(Vt,_e),Dt=Vt.getUint8(_e+1),Dt===192||Dt===193||Dt===194)return[Vt.getUint16(_e+7,!1),Vt.getUint16(_e+5,!1)];Vt=new DataView(kt.buffer,Vt.byteOffset+_e+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(kt){return 3}},"image/png":new M};class N{static basename(_e){const Dt=_e.split(/[\\/]/).pop();return Dt.substring(0,Dt.lastIndexOf("."))}static extension(_e){if(_e.startsWith("data:image/")){const Dt=_e.match(/data:(image\/\w+)/)[1];return I.mimeTypeToExtension(Dt)}return _e.startsWith("data:model/gltf+json")?"gltf":_e.startsWith("data:model/gltf-binary")?"glb":_e.startsWith("data:application/")?"bin":_e.split(/[\\/]/).pop().split(/[.]/).pop()}}function O(kt){return Object.prototype.toString.call(kt)==="[object Object]"}function C(kt){if(O(kt)===!1)return!1;const _e=kt.constructor;if(_e===void 0)return!0;const Dt=_e.prototype;return O(Dt)!==!1&&Object.prototype.hasOwnProperty.call(Dt,"isPrototypeOf")!==!1}var F,U;(function(kt){kt[kt.SILENT=4]="SILENT",kt[kt.ERROR=3]="ERROR",kt[kt.WARN=2]="WARN",kt[kt.INFO=1]="INFO",kt[kt.DEBUG=0]="DEBUG"})(U||(U={}));let B$1=class Ql{constructor(_e){this.verbosity=void 0,this.verbosity=_e}debug(_e){this.verbosity<=Ql.Verbosity.DEBUG&&console.debug(_e)}info(_e){this.verbosity<=Ql.Verbosity.INFO&&console.info(_e)}warn(_e){this.verbosity<=Ql.Verbosity.WARN&&console.warn(_e)}error(_e){this.verbosity<=Ql.Verbosity.ERROR&&console.error(_e)}};function P(kt,_e,Dt){var Vt=_e[0],Gt=_e[1],zt=_e[2],jt=_e[3],Ht=_e[4],Wt=_e[5],qt=_e[6],Xt=_e[7],Kt=_e[8],Yt=_e[9],Zt=_e[10],Jt=_e[11],nn=_e[12],rn=_e[13],Qt=_e[14],en=_e[15],tn=Dt[0],sn=Dt[1],cn=Dt[2],un=Dt[3];return kt[0]=tn*Vt+sn*Ht+cn*Kt+un*nn,kt[1]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[2]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[3]=tn*jt+sn*Xt+cn*Jt+un*en,kt[4]=(tn=Dt[4])*Vt+(sn=Dt[5])*Ht+(cn=Dt[6])*Kt+(un=Dt[7])*nn,kt[5]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[6]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[7]=tn*jt+sn*Xt+cn*Jt+un*en,kt[8]=(tn=Dt[8])*Vt+(sn=Dt[9])*Ht+(cn=Dt[10])*Kt+(un=Dt[11])*nn,kt[9]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[10]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[11]=tn*jt+sn*Xt+cn*Jt+un*en,kt[12]=(tn=Dt[12])*Vt+(sn=Dt[13])*Ht+(cn=Dt[14])*Kt+(un=Dt[15])*nn,kt[13]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[14]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[15]=tn*jt+sn*Xt+cn*Jt+un*en,kt}F=B$1,B$1.Verbosity=U,B$1.DEFAULT_INSTANCE=new F(F.Verbosity.INFO);class L{static identity(_e){return _e}static eq(_e,Dt,Vt=1e-5){if(_e.length!==Dt.length)return!1;for(let Gt=0;Gt<_e.length;Gt++)if(Math.abs(_e[Gt]-Dt[Gt])>Vt)return!1;return!0}static decodeNormalizedInt(_e,Dt){switch(Dt){case 5126:return _e;case 5123:return _e/65535;case 5121:return _e/255;case 5122:return Math.max(_e/32767,-1);case 5120:return Math.max(_e/127,-1);default:throw new Error("Invalid component type.")}}static denormalize(_e,Dt){return L.decodeNormalizedInt(_e,Dt)}static encodeNormalizedInt(_e,Dt){switch(Dt){case 5126:return _e;case 5123:return Math.round(65535*_e);case 5121:return Math.round(255*_e);case 5122:return Math.round(32767*_e);case 5120:return Math.round(127*_e);default:throw new Error("Invalid component type.")}}static normalize(_e,Dt){return L.encodeNormalizedInt(_e,Dt)}static decompose(_e,Dt,Vt,Gt){let zt=y([_e[0],_e[1],_e[2]]);const jt=y([_e[4],_e[5],_e[6]]),Ht=y([_e[8],_e[9],_e[10]]);var Wt,qt,Xt,Kt,Yt,Zt,Jt,nn,rn,Qt,en,tn,sn,cn,un,hn,dn;((qt=(Wt=_e)[0])*(Jt=Wt[5])-(Xt=Wt[1])*(Zt=Wt[4]))*((tn=Wt[10])*(dn=Wt[15])-(sn=Wt[11])*(hn=Wt[14]))-(qt*(nn=Wt[6])-(Kt=Wt[2])*Zt)*((en=Wt[9])*dn-sn*(un=Wt[13]))+(qt*(rn=Wt[7])-(Yt=Wt[3])*Zt)*(en*hn-tn*un)+(Xt*nn-Kt*Jt)*((Qt=Wt[8])*dn-sn*(cn=Wt[12]))-(Xt*rn-Yt*Jt)*(Qt*hn-tn*cn)+(Kt*rn-Yt*nn)*(Qt*un-en*cn)<0&&(zt=-zt),Dt[0]=_e[12],Dt[1]=_e[13],Dt[2]=_e[14];const pn=_e.slice(),fn=1/zt,mn=1/jt,vn=1/Ht;pn[0]*=fn,pn[1]*=fn,pn[2]*=fn,pn[4]*=mn,pn[5]*=mn,pn[6]*=mn,pn[8]*=vn,pn[9]*=vn,pn[10]*=vn,function(_n,En){var An=new w(3);(function(lr,zn){var ur=zn[4],Hn=zn[5],sr=zn[6],vr=zn[8],fr=zn[9],Un=zn[10];lr[0]=Math.hypot(zn[0],zn[1],zn[2]),lr[1]=Math.hypot(ur,Hn,sr),lr[2]=Math.hypot(vr,fr,Un)})(An,En);var Tn=1/An[0],Cn=1/An[1],yn=1/An[2],Sn=En[0]*Tn,wn=En[1]*Cn,xn=En[2]*yn,Rn=En[4]*Tn,Dn=En[5]*Cn,kn=En[6]*yn,Fn=En[8]*Tn,Pn=En[9]*Cn,Bn=En[10]*yn,qn=Sn+Dn+Bn,tr=0;qn>0?(tr=2*Math.sqrt(qn+1),_n[3]=.25*tr,_n[0]=(kn-Pn)/tr,_n[1]=(Fn-xn)/tr,_n[2]=(wn-Rn)/tr):Sn>Dn&&Sn>Bn?(tr=2*Math.sqrt(1+Sn-Dn-Bn),_n[3]=(kn-Pn)/tr,_n[0]=.25*tr,_n[1]=(wn+Rn)/tr,_n[2]=(Fn+xn)/tr):Dn>Bn?(tr=2*Math.sqrt(1+Dn-Sn-Bn),_n[3]=(Fn-xn)/tr,_n[0]=(wn+Rn)/tr,_n[1]=.25*tr,_n[2]=(kn+Pn)/tr):(tr=2*Math.sqrt(1+Bn-Sn-Dn),_n[3]=(wn-Rn)/tr,_n[0]=(Fn+xn)/tr,_n[1]=(kn+Pn)/tr,_n[2]=.25*tr)}(Vt,pn),Gt[0]=zt,Gt[1]=jt,Gt[2]=Ht}static compose(_e,Dt,Vt,Gt){const zt=Gt,jt=Dt[0],Ht=Dt[1],Wt=Dt[2],qt=Dt[3],Xt=jt+jt,Kt=Ht+Ht,Yt=Wt+Wt,Zt=jt*Xt,Jt=jt*Kt,nn=jt*Yt,rn=Ht*Kt,Qt=Ht*Yt,en=Wt*Yt,tn=qt*Xt,sn=qt*Kt,cn=qt*Yt,un=Vt[0],hn=Vt[1],dn=Vt[2];return zt[0]=(1-(rn+en))*un,zt[1]=(Jt+cn)*un,zt[2]=(nn-sn)*un,zt[3]=0,zt[4]=(Jt-cn)*hn,zt[5]=(1-(Zt+en))*hn,zt[6]=(Qt+tn)*hn,zt[7]=0,zt[8]=(nn+sn)*dn,zt[9]=(Qt-tn)*dn,zt[10]=(1-(Zt+rn))*dn,zt[11]=0,zt[12]=_e[0],zt[13]=_e[1],zt[14]=_e[2],zt[15]=1,zt}}function j(kt,_e){if(!!kt!=!!_e)return!1;const Dt=kt.getChild(),Vt=_e.getChild();return Dt===Vt||Dt.equals(Vt)}function D(kt,_e){if(!!kt!=!!_e||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++){const Vt=kt[Dt],Gt=_e[Dt];if(Vt.getChild()!==Gt.getChild()&&!Vt.getChild().equals(Gt.getChild()))return!1}return!0}function _(kt,_e){if(!!kt!=!!_e)return!1;const Dt=Object.keys(kt),Vt=Object.keys(_e);if(Dt.length!==Vt.length)return!1;for(const Gt in kt){const zt=kt[Gt],jt=_e[Gt];if(!!zt!=!!jt)return!1;const Ht=zt.getChild(),Wt=jt.getChild();if(Ht!==Wt&&!Ht.equals(Wt))return!1}return!0}function k(kt,_e){if(kt===_e)return!0;if(!!kt!=!!_e||!kt||!_e||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++)if(kt[Dt]!==_e[Dt])return!1;return!0}function z(kt,_e){if(kt===_e)return!0;if(!!kt!=!!_e)return!1;if(!C(kt)||!C(_e))return kt===_e;const Dt=kt,Vt=_e;let Gt,zt=0,jt=0;for(Gt in Dt)zt++;for(Gt in Vt)jt++;if(zt!==jt)return!1;for(Gt in Dt){const Ht=Dt[Gt],Wt=Vt[Gt];if(G(Ht)&&G(Wt)){if(!k(Ht,Wt))return!1}else if(C(Ht)&&C(Wt)){if(!z(Ht,Wt))return!1}else if(Ht!==Wt)return!1}return!0}function G(kt){return Array.isArray(kt)||ArrayBuffer.isView(kt)}const J=new Set,$=function(){let kt="";for(let _e=0;_e<6;_e++)kt+="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ".charAt(Math.floor(42*Math.random()));return kt},V=function(){for(let kt=0;kt<999;kt++){const _e=$();if(!J.has(_e))return J.add(_e),_e}return""},W="https://null.example";let q$1=class{static dirname(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.substring(0,Dt+1)}static basename(_e){return N.basename(new URL(_e,W).pathname)}static extension(_e){return N.extension(new URL(_e,W).pathname)}static resolve(_e,Dt){if(!this.isRelativePath(Dt))return Dt;const Vt=_e.split("/"),Gt=Dt.split("/");Vt.pop();for(let zt=0;zt<Gt.length;zt++)Gt[zt]!=="."&&(Gt[zt]===".."?Vt.pop():Vt.push(Gt[zt]));return Vt.join("/")}static isAbsoluteURL(_e){return this.PROTOCOL_REGEXP.test(_e)}static isRelativePath(_e){return!/^(?:[a-zA-Z]+:)?\//.test(_e)}};q$1.DEFAULT_INIT={},q$1.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;const H=kt=>kt,Y=new Set;let Z$1=class extends GraphNode{constructor(_e,Dt=""){super(_e),this[$attributes].name=Dt,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(_e,Dt){return Array.isArray(Dt)&&(Dt=Dt.slice()),super.set(_e,Dt)}getName(){return this.get("name")}setName(_e){return this.set("name",_e)}getExtras(){return this.get("extras")}setExtras(_e){return this.set("extras",_e)}clone(){return new this.constructor(this.graph).copy(this,H)}copy(_e,Dt=H){for(const Vt in this[$attributes]){const Gt=this[$attributes][Vt];if(Gt instanceof GraphEdge)this[$immutableKeys].has(Vt)||Gt.dispose();else if(isRefList(Gt))for(const zt of Gt)zt.dispose();else if(isRefMap(Gt))for(const zt in Gt)Gt[zt].dispose()}for(const Vt in _e[$attributes]){const Gt=this[$attributes][Vt],zt=_e[$attributes][Vt];if(zt instanceof GraphEdge)this[$immutableKeys].has(Vt)?Gt.getChild().copy(Dt(zt.getChild()),Dt):this.setRef(Vt,Dt(zt.getChild()),zt.getAttributes());else if(isRefList(zt))for(const jt of zt)this.addRef(Vt,Dt(jt.getChild()),jt.getAttributes());else if(isRefMap(zt))for(const jt in zt){const Ht=zt[jt];this.setRefMap(Vt,jt,Dt(Ht.getChild()),Ht.getAttributes())}else this[$attributes][Vt]=C(zt)?JSON.parse(JSON.stringify(zt)):Array.isArray(zt)||zt instanceof ArrayBuffer||ArrayBuffer.isView(zt)?zt.slice():zt}return this}equals(_e,Dt=Y){if(this===_e)return!0;if(this.propertyType!==_e.propertyType)return!1;for(const Vt in this[$attributes]){if(Dt.has(Vt))continue;const Gt=this[$attributes][Vt],zt=_e[$attributes][Vt];if(isRef(Gt)||isRef(zt)){if(!j(Gt,zt))return!1}else if(isRefList(Gt)||isRefList(zt)){if(!D(Gt,zt))return!1}else if(isRefMap(Gt)||isRefMap(zt)){if(!_(Gt,zt))return!1}else if(C(Gt)||C(zt)){if(!z(Gt,zt))return!1}else if(G(Gt)||G(zt)){if(!k(Gt,zt))return!1}else if(Gt!==zt)return!1}return!0}detach(){return this.graph.disconnectParents(this,_e=>_e.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}};class K extends Z$1{getDefaults(){return Object.assign(super.getDefaults(),{extensions:{}})}getExtension(_e){return this.getRefMap("extensions",_e)}setExtension(_e,Dt){return Dt&&Dt.t(this),this.setRefMap("extensions",_e,Dt)}listExtensions(){return this.listRefMapValues("extensions")}}class Q extends K{constructor(..._e){super(..._e),this.i=L.identity,this.o=L.identity}init(){this.propertyType=h.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:Q.Type.SCALAR,componentType:Q.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}copy(_e,Dt=H){return super.copy(_e,Dt),this.i=_e.i,this.o=_e.o,this}static getElementSize(_e){switch(_e){case Q.Type.SCALAR:return 1;case Q.Type.VEC2:return 2;case Q.Type.VEC3:return 3;case Q.Type.VEC4:case Q.Type.MAT2:return 4;case Q.Type.MAT3:return 9;case Q.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+_e)}}static getComponentSize(_e){switch(_e){case Q.ComponentType.BYTE:case Q.ComponentType.UNSIGNED_BYTE:return 1;case Q.ComponentType.SHORT:case Q.ComponentType.UNSIGNED_SHORT:return 2;case Q.ComponentType.UNSIGNED_INT:case Q.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+_e)}}getMinNormalized(_e){const Dt=this.getElementSize();this.getMin(_e);for(let Vt=0;Vt<Dt;Vt++)_e[Vt]=this.o(_e[Vt]);return _e}getMin(_e){const Dt=this.get("array"),Vt=this.getCount(),Gt=this.getElementSize();for(let zt=0;zt<Gt;zt++)_e[zt]=1/0;for(let zt=0;zt<Vt*Gt;zt+=Gt)for(let jt=0;jt<Gt;jt++){const Ht=Dt[zt+jt];Number.isFinite(Ht)&&(_e[jt]=Math.min(_e[jt],Ht))}return _e}getMaxNormalized(_e){const Dt=this.getElementSize();this.getMax(_e);for(let Vt=0;Vt<Dt;Vt++)_e[Vt]=this.o(_e[Vt]);return _e}getMax(_e){const Dt=this.get("array"),Vt=this.getCount(),Gt=this.getElementSize();for(let zt=0;zt<Gt;zt++)_e[zt]=-1/0;for(let zt=0;zt<Vt*Gt;zt+=Gt)for(let jt=0;jt<Gt;jt++){const Ht=Dt[zt+jt];Number.isFinite(Ht)&&(_e[jt]=Math.max(_e[jt],Ht))}return _e}getCount(){const _e=this.get("array");return _e?_e.length/this.getElementSize():0}getType(){return this.get("type")}setType(_e){return this.set("type",_e)}getElementSize(){return Q.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(_e){return this.set("normalized",_e),_e?(this.o=Dt=>L.decodeNormalizedInt(Dt,this.get("componentType")),this.i=Dt=>L.encodeNormalizedInt(Dt,this.get("componentType"))):(this.o=L.identity,this.i=L.identity),this}getScalar(_e){const Dt=this.getElementSize();return this.o(this.get("array")[_e*Dt])}setScalar(_e,Dt){return this.get("array")[_e*this.getElementSize()]=this.i(Dt),this}getElement(_e,Dt){const Vt=this.getElementSize(),Gt=this.get("array");for(let zt=0;zt<Vt;zt++)Dt[zt]=this.o(Gt[_e*Vt+zt]);return Dt}setElement(_e,Dt){const Vt=this.getElementSize(),Gt=this.get("array");for(let zt=0;zt<Vt;zt++)Gt[_e*Vt+zt]=this.i(Dt[zt]);return this}getSparse(){return this.get("sparse")}setSparse(_e){return this.set("sparse",_e)}getBuffer(){return this.getRef("buffer")}setBuffer(_e){return this.setRef("buffer",_e)}getArray(){return this.get("array")}setArray(_e){return this.set("componentType",_e?function(Dt){switch(Dt.constructor){case Float32Array:return Q.ComponentType.FLOAT;case Uint32Array:return Q.ComponentType.UNSIGNED_INT;case Uint16Array:return Q.ComponentType.UNSIGNED_SHORT;case Uint8Array:return Q.ComponentType.UNSIGNED_BYTE;case Int16Array:return Q.ComponentType.SHORT;case Int8Array:return Q.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}(_e):Q.ComponentType.FLOAT),this.set("array",_e),this}getByteLength(){const _e=this.get("array");return _e?_e.byteLength:0}}Q.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"},Q.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};class X extends K{init(){this.propertyType=h.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:[],samplers:[]})}addChannel(_e){return this.addRef("channels",_e)}removeChannel(_e){return this.removeRef("channels",_e)}listChannels(){return this.listRefs("channels")}addSampler(_e){return this.addRef("samplers",_e)}removeSampler(_e){return this.removeRef("samplers",_e)}listSamplers(){return this.listRefs("samplers")}}class tt extends K{init(){this.propertyType=h.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(_e){return this.set("targetPath",_e)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(_e){return this.setRef("targetNode",_e)}getSampler(){return this.getRef("sampler")}setSampler(_e){return this.setRef("sampler",_e)}}tt.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class et extends K{init(){this.propertyType=h.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:et.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(_e){return this.set("interpolation",_e)}getInput(){return this.getRef("input")}setInput(_e){return this.setRef("input",_e,{usage:l.OTHER})}getOutput(){return this.getRef("output")}setOutput(_e){return this.setRef("output",_e,{usage:l.OTHER})}}et.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class rt extends K{init(){this.propertyType=h.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(_e){return this.set("uri",_e)}}class st extends K{init(){this.propertyType=h.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:st.Type.PERSPECTIVE,znear:.1,zfar:100,aspectRatio:null,yfov:2*Math.PI*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(_e){return this.set("type",_e)}getZNear(){return this.get("znear")}setZNear(_e){return this.set("znear",_e)}getZFar(){return this.get("zfar")}setZFar(_e){return this.set("zfar",_e)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(_e){return this.set("aspectRatio",_e)}getYFov(){return this.get("yfov")}setYFov(_e){return this.set("yfov",_e)}getXMag(){return this.get("xmag")}setXMag(_e){return this.set("xmag",_e)}getYMag(){return this.get("ymag")}setYMag(_e){return this.set("ymag",_e)}}st.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class nt extends Z$1{t(_e){if(!this.parentTypes.includes(_e.propertyType))throw new Error(`Parent "${_e.propertyType}" invalid for child "${this.propertyType}".`)}}nt.EXTENSION_NAME=void 0;class it extends K{init(){this.propertyType=h.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:it.WrapMode.REPEAT,wrapT:it.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(_e){return this.set("texCoord",_e)}getMagFilter(){return this.get("magFilter")}setMagFilter(_e){return this.set("magFilter",_e)}getMinFilter(){return this.get("minFilter")}setMinFilter(_e){return this.set("minFilter",_e)}getWrapS(){return this.get("wrapS")}setWrapS(_e){return this.set("wrapS",_e)}getWrapT(){return this.get("wrapT")}setWrapT(_e){return this.set("wrapT",_e)}}it.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},it.MagFilter={NEAREST:9728,LINEAR:9729},it.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};const{R:ot,G:at,B:ut,A:ct}=d;class ht extends K{init(){this.propertyType=h.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:ht.AlphaMode.OPAQUE,alphaCutoff:.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new it(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new it(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new it(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new it(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new it(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(_e){return this.set("doubleSided",_e)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(_e){const Dt=this.get("baseColorFactor").slice();return Dt[3]=_e,this.set("baseColorFactor",Dt)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(_e){return this.set("alphaMode",_e)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(_e){return this.set("alphaCutoff",_e)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(_e){return this.set("baseColorFactor",_e)}getBaseColorHex(){return S.factorToHex(this.get("baseColorFactor"))}setBaseColorHex(_e){const Dt=this.get("baseColorFactor").slice();return this.set("baseColorFactor",S.hexToFactor(_e,Dt))}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(_e){return this.setRef("baseColorTexture",_e,{channels:ot|at|ut|ct,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(_e){return this.set("emissiveFactor",_e)}getEmissiveHex(){return S.factorToHex(this.get("emissiveFactor"))}setEmissiveHex(_e){const Dt=this.get("emissiveFactor").slice();return this.set("emissiveFactor",S.hexToFactor(_e,Dt))}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(_e){return this.setRef("emissiveTexture",_e,{channels:ot|at|ut,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(_e){return this.set("normalScale",_e)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(_e){return this.setRef("normalTexture",_e,{channels:ot|at|ut})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(_e){return this.set("occlusionStrength",_e)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(_e){return this.setRef("occlusionTexture",_e,{channels:ot})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(_e){return this.set("roughnessFactor",_e)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(_e){return this.set("metallicFactor",_e)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(_e){return this.setRef("metallicRoughnessTexture",_e,{channels:at|ut})}}ht.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class ft extends K{init(){this.propertyType=h.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:[]})}addPrimitive(_e){return this.addRef("primitives",_e)}removePrimitive(_e){return this.removeRef("primitives",_e)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(_e){return this.set("weights",_e)}}class lt extends K{constructor(..._e){super(..._e),this.u=null,this.h=new Set}init(){this.propertyType=h.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:[]})}copy(_e,Dt=H){if(Dt===H)throw new Error("Node cannot be copied.");return super.copy(_e,Dt)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(_e){return this.set("translation",_e)}setRotation(_e){return this.set("rotation",_e)}setScale(_e){return this.set("scale",_e)}getMatrix(){return L.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(_e){const Dt=this.get("translation").slice(),Vt=this.get("rotation").slice(),Gt=this.get("scale").slice();return L.decompose(_e,Dt,Vt,Gt),this.set("translation",Dt).set("rotation",Vt).set("scale",Gt)}getWorldTranslation(){const _e=[0,0,0];return L.decompose(this.getWorldMatrix(),_e,[0,0,0,1],[1,1,1]),_e}getWorldRotation(){const _e=[0,0,0,1];return L.decompose(this.getWorldMatrix(),[0,0,0],_e,[1,1,1]),_e}getWorldScale(){const _e=[1,1,1];return L.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],_e),_e}getWorldMatrix(){const _e=[];for(let Gt=this;Gt!=null;Gt=Gt.u)_e.push(Gt);let Dt;const Vt=_e.pop().getMatrix();for(;Dt=_e.pop();)P(Vt,Vt,Dt.getMatrix());return Vt}addChild(_e){if(_e.u&&_e.u.removeChild(_e),_e.h.size)for(const Vt of _e.h)Vt.removeChild(_e);this.addRef("children",_e),_e.u=this;const Dt=this[$attributes].children;return Dt[Dt.length-1].addEventListener("dispose",()=>_e.u=null),this}removeChild(_e){return this.removeRef("children",_e)}listChildren(){return this.listRefs("children")}getParent(){return this.u?this.u:this.listParents().find(_e=>_e.propertyType===h.SCENE)||null}getParentNode(){return this.u}getMesh(){return this.getRef("mesh")}setMesh(_e){return this.setRef("mesh",_e)}getCamera(){return this.getRef("camera")}setCamera(_e){return this.setRef("camera",_e)}getSkin(){return this.getRef("skin")}setSkin(_e){return this.setRef("skin",_e)}getWeights(){return this.get("weights")}setWeights(_e){return this.set("weights",_e)}traverse(_e){_e(this);for(const Dt of this.listChildren())Dt.traverse(_e);return this}}class dt extends K{init(){this.propertyType=h.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:dt.Mode.TRIANGLES,material:null,indices:null,attributes:{},targets:[]})}getIndices(){return this.getRef("indices")}setIndices(_e){return this.setRef("indices",_e,{usage:l.ELEMENT_ARRAY_BUFFER})}getAttribute(_e){return this.getRefMap("attributes",_e)}setAttribute(_e,Dt){return this.setRefMap("attributes",_e,Dt,{usage:l.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(_e){return this.setRef("material",_e)}getMode(){return this.get("mode")}setMode(_e){return this.set("mode",_e)}listTargets(){return this.listRefs("targets")}addTarget(_e){return this.addRef("targets",_e)}removeTarget(_e){return this.removeRef("targets",_e)}}dt.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class gt extends Z$1{init(){this.propertyType=h.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:{}})}getAttribute(_e){return this.getRefMap("attributes",_e)}setAttribute(_e,Dt){return this.setRefMap("attributes",_e,Dt,{usage:l.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function pt(){return pt=Object.assign?Object.assign.bind():function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},pt.apply(this,arguments)}class mt extends K{init(){this.propertyType=h.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:[]})}copy(_e,Dt=H){if(Dt===H)throw new Error("Scene cannot be copied.");return super.copy(_e,Dt)}addChild(_e){_e.u&&_e.u.removeChild(_e),this.addRef("children",_e),_e.h.add(this);const Dt=this[$attributes].children;return Dt[Dt.length-1].addEventListener("dispose",()=>_e.h.delete(this)),this}removeChild(_e){return this.removeRef("children",_e)}listChildren(){return this.listRefs("children")}traverse(_e){for(const Dt of this.listChildren())Dt.traverse(_e);return this}}class wt extends K{init(){this.propertyType=h.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:[]})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(_e){return this.setRef("skeleton",_e)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(_e){return this.setRef("inverseBindMatrices",_e,{usage:l.INVERSE_BIND_MATRICES})}addJoint(_e){return this.addRef("joints",_e)}removeJoint(_e){return this.removeRef("joints",_e)}listJoints(){return this.listRefs("joints")}}class yt extends K{init(){this.propertyType=h.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||I.extensionToMimeType(N.extension(this.get("uri")))}setMimeType(_e){return this.set("mimeType",_e)}getURI(){return this.get("uri")}setURI(_e){this.set("uri",_e);const Dt=I.extensionToMimeType(N.extension(_e));return Dt&&this.set("mimeType",Dt),this}getImage(){return this.get("image")}setImage(_e){return this.set("image",E.assertView(_e))}getSize(){const _e=this.get("image");return _e?I.getSize(_e,this.getMimeType()):null}}class vt extends K{init(){this.propertyType=h.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${u}`,version:"2.0"},defaultScene:null,accessors:[],animations:[],buffers:[],cameras:[],materials:[],meshes:[],nodes:[],scenes:[],skins:[],textures:[]})}constructor(_e){super(_e),this.l=new Set,_e.addEventListener("node:create",Dt=>{this.g(Dt.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(_e,Dt=H){if(Dt===H)throw new Error("Root cannot be copied.");this.set("asset",pt({},_e.get("asset"))),this.setName(_e.getName()),this.setExtras(pt({},_e.getExtras())),this.setDefaultScene(_e.getDefaultScene()?Dt(_e.getDefaultScene()):null);for(const Vt of _e.listRefMapKeys("extensions")){const Gt=_e.getExtension(Vt);this.setExtension(Vt,Dt(Gt))}return this}g(_e){return _e instanceof mt?this.addRef("scenes",_e):_e instanceof lt?this.addRef("nodes",_e):_e instanceof st?this.addRef("cameras",_e):_e instanceof wt?this.addRef("skins",_e):_e instanceof ft?this.addRef("meshes",_e):_e instanceof ht?this.addRef("materials",_e):_e instanceof yt?this.addRef("textures",_e):_e instanceof X?this.addRef("animations",_e):_e instanceof Q?this.addRef("accessors",_e):_e instanceof rt&&this.addRef("buffers",_e),this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this.l)}listExtensionsRequired(){return this.listExtensionsUsed().filter(_e=>_e.isRequired())}p(_e){return this.l.add(_e),this}m(_e){return this.l.delete(_e),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(_e){return this.setRef("defaultScene",_e)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class Tt{static fromGraph(_e){return Tt.v.get(_e)||null}constructor(){this.T=new Graph,this.S=new vt(this.T),this.M=B$1.DEFAULT_INSTANCE,Tt.v.set(this.T,this)}getRoot(){return this.S}getGraph(){return this.T}getLogger(){return this.M}setLogger(_e){return this.M=_e,this}clone(){return new Tt().setLogger(this.M).merge(this)}merge(_e){for(const zt of _e.getRoot().listExtensionsUsed()){const jt=this.createExtension(zt.constructor);zt.isRequired()&&jt.setRequired(!0)}const Dt=new Set,Vt=new Map;Dt.add(_e.S),Vt.set(_e.S,this.S);for(const zt of _e.T.listEdges())for(const jt of[zt.getParent(),zt.getChild()]){if(Dt.has(jt))continue;let Ht;Ht=jt.propertyType===h.TEXTURE_INFO?jt:new jt.constructor(this.T),Vt.set(jt,Ht),Dt.add(jt)}const Gt=zt=>{const jt=Vt.get(zt);if(!jt)throw new Error("Could resolve property.");return jt};for(const zt of Dt){const jt=Vt.get(zt);if(!jt)throw new Error("Could resolve property.");jt.propertyType!==h.TEXTURE_INFO&&jt.copy(zt,Gt)}return this}async transform(..._e){const Dt=_e.map(Vt=>Vt.name);for(const Vt of _e)await Vt(this,{stack:Dt});return this}createExtension(_e){const Dt=_e.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(Vt=>Vt.extensionName===Dt)||new _e(this)}createScene(_e=""){return new mt(this.T,_e)}createNode(_e=""){return new lt(this.T,_e)}createCamera(_e=""){return new st(this.T,_e)}createSkin(_e=""){return new wt(this.T,_e)}createMesh(_e=""){return new ft(this.T,_e)}createPrimitive(){return new dt(this.T)}createPrimitiveTarget(_e=""){return new gt(this.T,_e)}createMaterial(_e=""){return new ht(this.T,_e)}createTexture(_e=""){return new yt(this.T,_e)}createAnimation(_e=""){return new X(this.T,_e)}createAnimationChannel(_e=""){return new tt(this.T,_e)}createAnimationSampler(_e=""){return new et(this.T,_e)}createAccessor(_e="",Dt=null){return Dt||(Dt=this.getRoot().listBuffers()[0]),new Q(this.T,_e).setBuffer(Dt)}createBuffer(_e=""){return new rt(this.T,_e)}}Tt.v=new WeakMap;class xt{constructor(_e){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=_e}setTextureInfo(_e,Dt){this.textureInfos.set(_e,Dt),Dt.texCoord!==void 0&&_e.setTexCoord(Dt.texCoord),Dt.extras!==void 0&&_e.setExtras(Dt.extras);const Vt=this.jsonDoc.json.textures[Dt.index];if(Vt.sampler===void 0)return;const Gt=this.jsonDoc.json.samplers[Vt.sampler];Gt.magFilter!==void 0&&_e.setMagFilter(Gt.magFilter),Gt.minFilter!==void 0&&_e.setMinFilter(Gt.minFilter),Gt.wrapS!==void 0&&_e.setWrapS(Gt.wrapS),Gt.wrapT!==void 0&&_e.setWrapT(Gt.wrapT)}}const At={logger:B$1.DEFAULT_INSTANCE,extensions:[],dependencies:{}};class Et{static read(_e,Dt=At){const Vt=pt({},At,Dt),{json:Gt}=_e,zt=new Tt().setLogger(Vt.logger);this.validate(_e,Vt);const jt=new xt(_e),Ht=Gt.asset,Wt=zt.getRoot().getAsset();Ht.copyright&&(Wt.copyright=Ht.copyright),Ht.extras&&(Wt.extras=Ht.extras),Gt.extras!==void 0&&zt.getRoot().setExtras(pt({},Gt.extras));const qt=Gt.extensionsUsed||[],Xt=Gt.extensionsRequired||[];for(const en of Vt.extensions)if(qt.includes(en.EXTENSION_NAME)){const tn=zt.createExtension(en).setRequired(Xt.includes(en.EXTENSION_NAME));for(const sn of tn.readDependencies)tn.install(sn,Vt.dependencies[sn])}const Kt=Gt.buffers||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.BUFFER)).forEach(en=>en.preread(jt,h.BUFFER)),jt.buffers=Kt.map(en=>{const tn=zt.createBuffer(en.name);return en.extras&&tn.setExtras(en.extras),en.uri&&en.uri.indexOf("__")!==0&&tn.setURI(en.uri),tn}),jt.bufferViewBuffers=(Gt.bufferViews||[]).map((en,tn)=>{if(!jt.bufferViews[tn]){const sn=_e.json.buffers[en.buffer];jt.bufferViews[tn]=E.toView(sn.uri?_e.resources[sn.uri]:_e.resources[c],en.byteOffset||0,en.byteLength)}return jt.buffers[en.buffer]});const Yt=Gt.accessors||[];jt.accessors=Yt.map(en=>{const tn=zt.createAccessor(en.name,jt.bufferViewBuffers[en.bufferView]).setType(en.type);return en.extras&&tn.setExtras(en.extras),en.normalized!==void 0&&tn.setNormalized(en.normalized),en.bufferView===void 0||tn.setArray(St(en,jt)),tn});const Zt=Gt.images||[],Jt=Gt.textures||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.TEXTURE)).forEach(en=>en.preread(jt,h.TEXTURE)),jt.textures=Zt.map(en=>{const tn=zt.createTexture(en.name);if(en.extras&&tn.setExtras(en.extras),en.bufferView!==void 0){const sn=Gt.bufferViews[en.bufferView],cn=_e.json.buffers[sn.buffer],un=sn.byteOffset||0,hn=(cn.uri?_e.resources[cn.uri]:_e.resources[c]).slice(un,un+sn.byteLength);tn.setImage(hn)}else en.uri!==void 0&&(tn.setImage(_e.resources[en.uri]),en.uri.indexOf("__")!==0&&tn.setURI(en.uri));if(en.mimeType!==void 0)tn.setMimeType(en.mimeType);else if(en.uri){const sn=N.extension(en.uri);tn.setMimeType(I.extensionToMimeType(sn))}return tn}),jt.materials=(Gt.materials||[]).map(en=>{const tn=zt.createMaterial(en.name);en.extras&&tn.setExtras(en.extras),en.alphaMode!==void 0&&tn.setAlphaMode(en.alphaMode),en.alphaCutoff!==void 0&&tn.setAlphaCutoff(en.alphaCutoff),en.doubleSided!==void 0&&tn.setDoubleSided(en.doubleSided);const sn=en.pbrMetallicRoughness||{};if(sn.baseColorFactor!==void 0&&tn.setBaseColorFactor(sn.baseColorFactor),en.emissiveFactor!==void 0&&tn.setEmissiveFactor(en.emissiveFactor),sn.metallicFactor!==void 0&&tn.setMetallicFactor(sn.metallicFactor),sn.roughnessFactor!==void 0&&tn.setRoughnessFactor(sn.roughnessFactor),sn.baseColorTexture!==void 0){const cn=sn.baseColorTexture;tn.setBaseColorTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getBaseColorTextureInfo(),cn)}if(en.emissiveTexture!==void 0){const cn=en.emissiveTexture;tn.setEmissiveTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getEmissiveTextureInfo(),cn)}if(en.normalTexture!==void 0){const cn=en.normalTexture;tn.setNormalTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getNormalTextureInfo(),cn),en.normalTexture.scale!==void 0&&tn.setNormalScale(en.normalTexture.scale)}if(en.occlusionTexture!==void 0){const cn=en.occlusionTexture;tn.setOcclusionTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getOcclusionTextureInfo(),cn),en.occlusionTexture.strength!==void 0&&tn.setOcclusionStrength(en.occlusionTexture.strength)}if(sn.metallicRoughnessTexture!==void 0){const cn=sn.metallicRoughnessTexture;tn.setMetallicRoughnessTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getMetallicRoughnessTextureInfo(),cn)}return tn});const nn=Gt.meshes||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.PRIMITIVE)).forEach(en=>en.preread(jt,h.PRIMITIVE)),jt.meshes=nn.map(en=>{const tn=zt.createMesh(en.name);return en.extras&&tn.setExtras(en.extras),en.weights!==void 0&&tn.setWeights(en.weights),(en.primitives||[]).forEach(sn=>{const cn=zt.createPrimitive();sn.extras&&cn.setExtras(sn.extras),sn.material!==void 0&&cn.setMaterial(jt.materials[sn.material]),sn.mode!==void 0&&cn.setMode(sn.mode);for(const[hn,dn]of Object.entries(sn.attributes||{}))cn.setAttribute(hn,jt.accessors[dn]);sn.indices!==void 0&&cn.setIndices(jt.accessors[sn.indices]);const un=en.extras&&en.extras.targetNames||[];(sn.targets||[]).forEach((hn,dn)=>{const pn=un[dn]||dn.toString(),fn=zt.createPrimitiveTarget(pn);for(const[mn,vn]of Object.entries(hn))fn.setAttribute(mn,jt.accessors[vn]);cn.addTarget(fn)}),tn.addPrimitive(cn)}),tn}),jt.cameras=(Gt.cameras||[]).map(en=>{const tn=zt.createCamera(en.name).setType(en.type);if(en.extras&&tn.setExtras(en.extras),en.type===st.Type.PERSPECTIVE){const sn=en.perspective;tn.setYFov(sn.yfov),tn.setZNear(sn.znear),sn.zfar!==void 0&&tn.setZFar(sn.zfar),sn.aspectRatio!==void 0&&tn.setAspectRatio(sn.aspectRatio)}else{const sn=en.orthographic;tn.setZNear(sn.znear).setZFar(sn.zfar).setXMag(sn.xmag).setYMag(sn.ymag)}return tn});const rn=Gt.nodes||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.NODE)).forEach(en=>en.preread(jt,h.NODE)),jt.nodes=rn.map(en=>{const tn=zt.createNode(en.name);if(en.extras&&tn.setExtras(en.extras),en.translation!==void 0&&tn.setTranslation(en.translation),en.rotation!==void 0&&tn.setRotation(en.rotation),en.scale!==void 0&&tn.setScale(en.scale),en.matrix!==void 0){const sn=[0,0,0],cn=[0,0,0,1],un=[1,1,1];L.decompose(en.matrix,sn,cn,un),tn.setTranslation(sn),tn.setRotation(cn),tn.setScale(un)}return en.weights!==void 0&&tn.setWeights(en.weights),tn}),jt.skins=(Gt.skins||[]).map(en=>{const tn=zt.createSkin(en.name);en.extras&&tn.setExtras(en.extras),en.inverseBindMatrices!==void 0&&tn.setInverseBindMatrices(jt.accessors[en.inverseBindMatrices]),en.skeleton!==void 0&&tn.setSkeleton(jt.nodes[en.skeleton]);for(const sn of en.joints)tn.addJoint(jt.nodes[sn]);return tn}),rn.map((en,tn)=>{const sn=jt.nodes[tn];(en.children||[]).forEach(cn=>sn.addChild(jt.nodes[cn])),en.mesh!==void 0&&sn.setMesh(jt.meshes[en.mesh]),en.camera!==void 0&&sn.setCamera(jt.cameras[en.camera]),en.skin!==void 0&&sn.setSkin(jt.skins[en.skin])}),jt.animations=(Gt.animations||[]).map(en=>{const tn=zt.createAnimation(en.name);en.extras&&tn.setExtras(en.extras);const sn=(en.samplers||[]).map(cn=>{const un=zt.createAnimationSampler().setInput(jt.accessors[cn.input]).setOutput(jt.accessors[cn.output]).setInterpolation(cn.interpolation||et.Interpolation.LINEAR);return cn.extras&&un.setExtras(cn.extras),tn.addSampler(un),un});return(en.channels||[]).forEach(cn=>{const un=zt.createAnimationChannel().setSampler(sn[cn.sampler]).setTargetPath(cn.target.path);cn.target.node!==void 0&&un.setTargetNode(jt.nodes[cn.target.node]),cn.extras&&un.setExtras(cn.extras),tn.addChannel(un)}),tn});const Qt=Gt.scenes||[];return zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.SCENE)).forEach(en=>en.preread(jt,h.SCENE)),jt.scenes=Qt.map(en=>{const tn=zt.createScene(en.name);return en.extras&&tn.setExtras(en.extras),(en.nodes||[]).map(sn=>jt.nodes[sn]).forEach(sn=>tn.addChild(sn)),tn}),Gt.scene!==void 0&&zt.getRoot().setDefaultScene(jt.scenes[Gt.scene]),zt.getRoot().listExtensionsUsed().forEach(en=>en.read(jt)),Yt.forEach((en,tn)=>{const sn=jt.accessors[tn],cn=!!en.sparse,un=!en.bufferView&&!sn.getArray();(cn||un)&&sn.setSparse(!0).setArray(function(hn,dn){const pn=p[hn.componentType],fn=Q.getElementSize(hn.type);let mn;mn=hn.bufferView!==void 0?St(hn,dn):new pn(hn.count*fn);const vn=hn.sparse;if(!vn)return mn;const _n=vn.count,En=pt({},hn,vn.indices,{count:_n,type:"SCALAR"}),An=pt({},hn,vn.values,{count:_n}),Tn=St(En,dn),Cn=St(An,dn);for(let yn=0;yn<En.count;yn++)for(let Sn=0;Sn<fn;Sn++)mn[Tn[yn]*fn+Sn]=Cn[yn*fn+Sn];return mn}(en,jt))}),zt}static validate(_e,Dt){const Vt=_e.json;if(Vt.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${Vt.asset.version}".`);if(Vt.extensionsRequired){for(const Gt of Vt.extensionsRequired)if(!Dt.extensions.find(zt=>zt.EXTENSION_NAME===Gt))throw new Error(`Missing required extension, "${Gt}".`)}if(Vt.extensionsUsed)for(const Gt of Vt.extensionsUsed)Dt.extensions.find(zt=>zt.EXTENSION_NAME===Gt)||Dt.logger.warn(`Missing optional extension, "${Gt}".`)}}function St(kt,_e){const Dt=_e.bufferViews[kt.bufferView],Vt=_e.jsonDoc.json.bufferViews[kt.bufferView],Gt=p[kt.componentType],zt=Q.getElementSize(kt.type),jt=Gt.BYTES_PER_ELEMENT;if(Vt.byteStride!==void 0&&Vt.byteStride!==zt*jt)return function(Wt,qt){const Xt=qt.bufferViews[Wt.bufferView],Kt=qt.jsonDoc.json.bufferViews[Wt.bufferView],Yt=p[Wt.componentType],Zt=Q.getElementSize(Wt.type),Jt=Yt.BYTES_PER_ELEMENT,nn=Wt.byteOffset||0,rn=new Yt(Wt.count*Zt),Qt=new DataView(Xt.buffer,Xt.byteOffset,Xt.byteLength),en=Kt.byteStride;for(let tn=0;tn<Wt.count;tn++)for(let sn=0;sn<Zt;sn++){const cn=nn+tn*en+sn*Jt;let un;switch(Wt.componentType){case Q.ComponentType.FLOAT:un=Qt.getFloat32(cn,!0);break;case Q.ComponentType.UNSIGNED_INT:un=Qt.getUint32(cn,!0);break;case Q.ComponentType.UNSIGNED_SHORT:un=Qt.getUint16(cn,!0);break;case Q.ComponentType.UNSIGNED_BYTE:un=Qt.getUint8(cn);break;case Q.ComponentType.SHORT:un=Qt.getInt16(cn,!0);break;case Q.ComponentType.BYTE:un=Qt.getInt8(cn);break;default:throw new Error(`Unexpected componentType "${Wt.componentType}".`)}rn[tn*Zt+sn]=un}return rn}(kt,_e);const Ht=Dt.byteOffset+(kt.byteOffset||0);return new Gt(Dt.buffer.slice(Ht,Ht+kt.count*zt*jt))}var Mt;(function(kt){kt[kt.ARRAY_BUFFER=34962]="ARRAY_BUFFER",kt[kt.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Mt||(Mt={}));class It{constructor(_e,Dt,Vt){this.C=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this.F=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this.C=_e,this.jsonDoc=Dt,this.options=Vt;const Gt=_e.getRoot(),zt=Gt.listBuffers().length,jt=Gt.listTextures().length;this.bufferURIGenerator=new Rt(zt>1,()=>Vt.basename||"buffer"),this.imageURIGenerator=new Rt(jt>1,Ht=>function(Wt,qt){const Xt=Wt.getGraph().listParentEdges(qt).find(Kt=>Kt.getParent()!==Wt.getRoot());return Xt?Xt.getName().replace(/texture$/i,""):""}(_e,Ht)||Vt.basename||"texture"),this.logger=_e.getLogger()}createTextureInfoDef(_e,Dt){const Vt={magFilter:Dt.getMagFilter()||void 0,minFilter:Dt.getMinFilter()||void 0,wrapS:Dt.getWrapS(),wrapT:Dt.getWrapT()},Gt=JSON.stringify(Vt);this.samplerDefIndexMap.has(Gt)||(this.samplerDefIndexMap.set(Gt,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(Vt));const zt={source:this.imageIndexMap.get(_e),sampler:this.samplerDefIndexMap.get(Gt)},jt=JSON.stringify(zt);this.textureDefIndexMap.has(jt)||(this.textureDefIndexMap.set(jt,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(zt));const Ht={index:this.textureDefIndexMap.get(jt)};return Dt.getTexCoord()!==0&&(Ht.texCoord=Dt.getTexCoord()),Object.keys(Dt.getExtras()).length>0&&(Ht.extras=Dt.getExtras()),this.textureInfoDefMap.set(Dt,Ht),Ht}createPropertyDef(_e){const Dt={};return _e.getName()&&(Dt.name=_e.getName()),Object.keys(_e.getExtras()).length>0&&(Dt.extras=_e.getExtras()),Dt}createAccessorDef(_e){const Dt=this.createPropertyDef(_e);return Dt.type=_e.getType(),Dt.componentType=_e.getComponentType(),Dt.count=_e.getCount(),this.C.getGraph().listParentEdges(_e).some(Vt=>Vt.getName()==="attributes"&&Vt.getAttributes().key==="POSITION"||Vt.getName()==="input")&&(Dt.max=_e.getMax([]).map(Math.fround),Dt.min=_e.getMin([]).map(Math.fround)),_e.getNormalized()&&(Dt.normalized=_e.getNormalized()),Dt}createImageData(_e,Dt,Vt){if(this.options.format===g.GLB)this.imageBufferViews.push(Dt),_e.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:Dt.byteLength});else{const Gt=I.mimeTypeToExtension(Vt.getMimeType());_e.uri=this.imageURIGenerator.createURI(Vt,Gt),this.jsonDoc.resources[_e.uri]=Dt}}getAccessorUsage(_e){const Dt=this.F.get(_e);if(Dt)return Dt;if(_e.getSparse())return l.SPARSE;for(const Vt of this.C.getGraph().listParentEdges(_e)){const{usage:Gt}=Vt.getAttributes();if(Gt)return Gt;Vt.getParent().propertyType!==h.ROOT&&this.logger.warn(`Missing attribute ".usage" on edge, "${Vt.getName()}".`)}return l.OTHER}addAccessorToUsageGroup(_e,Dt){const Vt=this.F.get(_e);if(Vt&&Vt!==Dt)throw new Error(`Accessor with usage "${Vt}" cannot be reused as "${Dt}".`);return this.F.set(_e,Dt),this}listAccessorUsageGroups(){const _e={};for(const[Dt,Vt]of Array.from(this.F.entries()))_e[Vt]=_e[Vt]||[],_e[Vt].push(Dt);return _e}}It.BufferViewTarget=Mt,It.BufferViewUsage=l,It.USAGE_TO_TARGET={[l.ARRAY_BUFFER]:Mt.ARRAY_BUFFER,[l.ELEMENT_ARRAY_BUFFER]:Mt.ELEMENT_ARRAY_BUFFER};class Rt{constructor(_e,Dt){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=_e,this.basename=Dt}createURI(_e,Dt){if(_e.getURI())return _e.getURI();if(this.multiple){const Vt=this.basename(_e);return this.counter[Vt]=this.counter[Vt]||1,`${Vt}_${this.counter[Vt]++}.${Dt}`}return`${this.basename(_e)}.${Dt}`}}const{BufferViewUsage:Nt}=It,{UNSIGNED_INT:Ot,UNSIGNED_SHORT:Ct,UNSIGNED_BYTE:Ft}=Q.ComponentType;class Ut{static write(_e,Dt){const Vt=_e.getRoot(),Gt={asset:pt({generator:`glTF-Transform ${u}`},Vt.getAsset()),extras:pt({},Vt.getExtras())},zt={json:Gt,resources:{}},jt=new It(_e,zt,Dt),Ht=Dt.logger||B$1.DEFAULT_INSTANCE,Wt=new Set(Dt.extensions.map(rn=>rn.EXTENSION_NAME)),qt=_e.getRoot().listExtensionsUsed().filter(rn=>Wt.has(rn.extensionName)),Xt=_e.getRoot().listExtensionsRequired().filter(rn=>Wt.has(rn.extensionName));qt.length<_e.getRoot().listExtensionsUsed().length&&Ht.warn("Some extensions were not registered for I/O, and will not be written.");for(const rn of qt)for(const Qt of rn.writeDependencies)rn.install(Qt,Dt.dependencies[Qt]);function Kt(rn,Qt,en,tn){const sn=[];let cn=0;for(const hn of rn){const dn=jt.createAccessorDef(hn);dn.bufferView=Gt.bufferViews.length;const pn=hn.getArray(),fn=E.pad(E.toView(pn));dn.byteOffset=cn,cn+=fn.byteLength,sn.push(fn),jt.accessorIndexMap.set(hn,Gt.accessors.length),Gt.accessors.push(dn)}const un={buffer:Qt,byteOffset:en,byteLength:E.concat(sn).byteLength};return tn&&(un.target=tn),Gt.bufferViews.push(un),{buffers:sn,byteLength:cn}}function Yt(rn,Qt,en){const tn=rn[0].getCount();let sn=0;for(const dn of rn){const pn=jt.createAccessorDef(dn);pn.bufferView=Gt.bufferViews.length,pn.byteOffset=sn;const fn=dn.getElementSize(),mn=dn.getComponentSize();sn+=E.padNumber(fn*mn),jt.accessorIndexMap.set(dn,Gt.accessors.length),Gt.accessors.push(pn)}const cn=tn*sn,un=new ArrayBuffer(cn),hn=new DataView(un);for(let dn=0;dn<tn;dn++){let pn=0;for(const fn of rn){const mn=fn.getElementSize(),vn=fn.getComponentSize(),_n=fn.getComponentType(),En=fn.getArray();for(let An=0;An<mn;An++){const Tn=dn*sn+pn+An*vn,Cn=En[dn*mn+An];switch(_n){case Q.ComponentType.FLOAT:hn.setFloat32(Tn,Cn,!0);break;case Q.ComponentType.BYTE:hn.setInt8(Tn,Cn);break;case Q.ComponentType.SHORT:hn.setInt16(Tn,Cn,!0);break;case Q.ComponentType.UNSIGNED_BYTE:hn.setUint8(Tn,Cn);break;case Q.ComponentType.UNSIGNED_SHORT:hn.setUint16(Tn,Cn,!0);break;case Q.ComponentType.UNSIGNED_INT:hn.setUint32(Tn,Cn,!0);break;default:throw new Error("Unexpected component type: "+_n)}}pn+=E.padNumber(mn*vn)}}return Gt.bufferViews.push({buffer:Qt,byteOffset:en,byteLength:cn,byteStride:sn,target:It.BufferViewTarget.ARRAY_BUFFER}),{byteLength:cn,buffers:[new Uint8Array(un)]}}function Zt(rn,Qt,en){const tn=[];let sn=0;const cn=new Map;let un=-1/0;for(const _n of rn){const En=jt.createAccessorDef(_n);Gt.accessors.push(En),jt.accessorIndexMap.set(_n,Gt.accessors.length-1);const An=[],Tn=[],Cn=[],yn=new Array(_n.getElementSize()).fill(0);for(let Rn=0,Dn=_n.getCount();Rn<Dn;Rn++)if(_n.getElement(Rn,Cn),!L.eq(Cn,yn,0)){un=Math.max(Rn,un),An.push(Rn);for(let kn=0;kn<Cn.length;kn++)Tn.push(Cn[kn])}const Sn=An.length,wn={accessorDef:En,count:Sn};if(cn.set(_n,wn),Sn===0)continue;if(Sn>_n.getCount()/3){const Rn=(100*An.length/_n.getCount()).toFixed(1);Ht.warn(`Sparse accessor with many non-zero elements (${Rn}%) may increase file size.`)}const xn=p[_n.getComponentType()];wn.indices=An,wn.values=new xn(Tn)}if(!Number.isFinite(un))return{buffers:tn,byteLength:sn};const hn=un<255?Uint8Array:un<65535?Uint16Array:Uint32Array,dn=un<255?Ft:un<65535?Ct:Ot,pn={buffer:Qt,byteOffset:en+sn,byteLength:0};for(const _n of rn){const En=cn.get(_n);if(En.count===0)continue;En.indicesByteOffset=pn.byteLength;const An=E.pad(E.toView(new hn(En.indices)));tn.push(An),sn+=An.byteLength,pn.byteLength+=An.byteLength}Gt.bufferViews.push(pn);const fn=Gt.bufferViews.length-1,mn={buffer:Qt,byteOffset:en+sn,byteLength:0};for(const _n of rn){const En=cn.get(_n);if(En.count===0)continue;En.valuesByteOffset=mn.byteLength;const An=E.pad(E.toView(En.values));tn.push(An),sn+=An.byteLength,mn.byteLength+=An.byteLength}Gt.bufferViews.push(mn);const vn=Gt.bufferViews.length-1;for(const _n of rn){const En=cn.get(_n);En.count!==0&&(En.accessorDef.sparse={count:En.count,indices:{bufferView:fn,byteOffset:En.indicesByteOffset,componentType:dn},values:{bufferView:vn,byteOffset:En.valuesByteOffset}})}return{buffers:tn,byteLength:sn}}const Jt=new Map;for(const rn of _e.getGraph().listEdges()){if(rn.getParent()===Vt)continue;const Qt=rn.getChild();if(Qt instanceof Q){const en=Jt.get(Qt)||[];en.push(rn),Jt.set(Qt,en)}}if(Gt.accessors=[],Gt.bufferViews=[],Gt.samplers=[],Gt.textures=[],Gt.images=Vt.listTextures().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);rn.getMimeType()&&(en.mimeType=rn.getMimeType());const tn=rn.getImage();return tn&&jt.createImageData(en,tn,rn),jt.imageIndexMap.set(rn,Qt),en}),qt.filter(rn=>rn.prewriteTypes.includes(h.ACCESSOR)).forEach(rn=>rn.prewrite(jt,h.ACCESSOR)),Vt.listAccessors().forEach(rn=>{const Qt=jt.accessorUsageGroupedByParent,en=jt.accessorParents;if(jt.accessorIndexMap.has(rn))return;const tn=Jt.get(rn)||[],sn=jt.getAccessorUsage(rn);if(jt.addAccessorToUsageGroup(rn,sn),Qt.has(sn)){const cn=tn[0].getParent(),un=en.get(cn)||new Set;un.add(rn),en.set(cn,un)}}),qt.filter(rn=>rn.prewriteTypes.includes(h.BUFFER)).forEach(rn=>rn.prewrite(jt,h.BUFFER)),(Vt.listAccessors().length>0||Vt.listTextures().length>0||jt.otherBufferViews.size>0)&&Vt.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");Gt.buffers=[],Vt.listBuffers().forEach((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=jt.accessorUsageGroupedByParent,sn=jt.accessorParents,cn=rn.listParents().filter(mn=>mn instanceof Q),un=new Set(cn),hn=[],dn=Gt.buffers.length;let pn=0;const fn=jt.listAccessorUsageGroups();for(const mn in fn)if(tn.has(mn))for(const vn of Array.from(sn.values())){const _n=Array.from(vn).filter(En=>un.has(En)).filter(En=>jt.getAccessorUsage(En)===mn);if(_n.length)if(mn!==Nt.ARRAY_BUFFER||Dt.vertexLayout===f.INTERLEAVED){const En=mn===Nt.ARRAY_BUFFER?Yt(_n,dn,pn):Kt(_n,dn,pn);pn+=En.byteLength,hn.push(...En.buffers)}else for(const En of _n){const An=Yt([En],dn,pn);pn+=An.byteLength,hn.push(...An.buffers)}}else{const vn=fn[mn].filter(An=>un.has(An));if(!vn.length)continue;const _n=mn===Nt.ELEMENT_ARRAY_BUFFER?It.BufferViewTarget.ELEMENT_ARRAY_BUFFER:void 0,En=mn===Nt.SPARSE?Zt(vn,dn,pn):Kt(vn,dn,pn,_n);pn+=En.byteLength,hn.push(...En.buffers)}if(jt.imageBufferViews.length&&Qt===0){for(let mn=0;mn<jt.imageBufferViews.length;mn++)if(Gt.bufferViews[Gt.images[mn].bufferView].byteOffset=pn,pn+=jt.imageBufferViews[mn].byteLength,hn.push(jt.imageBufferViews[mn]),pn%8){const vn=8-pn%8;pn+=vn,hn.push(new Uint8Array(vn))}}if(jt.otherBufferViews.has(rn))for(const mn of jt.otherBufferViews.get(rn))Gt.bufferViews.push({buffer:dn,byteOffset:pn,byteLength:mn.byteLength}),jt.otherBufferViewsIndexMap.set(mn,Gt.bufferViews.length-1),pn+=mn.byteLength,hn.push(mn);if(pn){let mn;Dt.format===g.GLB?mn=c:(mn=jt.bufferURIGenerator.createURI(rn,"bin"),en.uri=mn),en.byteLength=pn,zt.resources[mn]=E.concat(hn)}Gt.buffers.push(en),jt.bufferIndexMap.set(rn,Qt)}),Vt.listAccessors().find(rn=>!rn.getBuffer())&&Ht.warn("Skipped writing one or more Accessors: no Buffer assigned."),Gt.materials=Vt.listMaterials().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);if(rn.getAlphaMode()!==ht.AlphaMode.OPAQUE&&(en.alphaMode=rn.getAlphaMode()),rn.getAlphaMode()===ht.AlphaMode.MASK&&(en.alphaCutoff=rn.getAlphaCutoff()),rn.getDoubleSided()&&(en.doubleSided=!0),en.pbrMetallicRoughness={},L.eq(rn.getBaseColorFactor(),[1,1,1,1])||(en.pbrMetallicRoughness.baseColorFactor=rn.getBaseColorFactor()),L.eq(rn.getEmissiveFactor(),[0,0,0])||(en.emissiveFactor=rn.getEmissiveFactor()),rn.getRoughnessFactor()!==1&&(en.pbrMetallicRoughness.roughnessFactor=rn.getRoughnessFactor()),rn.getMetallicFactor()!==1&&(en.pbrMetallicRoughness.metallicFactor=rn.getMetallicFactor()),rn.getBaseColorTexture()){const tn=rn.getBaseColorTexture(),sn=rn.getBaseColorTextureInfo();en.pbrMetallicRoughness.baseColorTexture=jt.createTextureInfoDef(tn,sn)}if(rn.getEmissiveTexture()){const tn=rn.getEmissiveTexture(),sn=rn.getEmissiveTextureInfo();en.emissiveTexture=jt.createTextureInfoDef(tn,sn)}if(rn.getNormalTexture()){const tn=rn.getNormalTexture(),sn=rn.getNormalTextureInfo(),cn=jt.createTextureInfoDef(tn,sn);rn.getNormalScale()!==1&&(cn.scale=rn.getNormalScale()),en.normalTexture=cn}if(rn.getOcclusionTexture()){const tn=rn.getOcclusionTexture(),sn=rn.getOcclusionTextureInfo(),cn=jt.createTextureInfoDef(tn,sn);rn.getOcclusionStrength()!==1&&(cn.strength=rn.getOcclusionStrength()),en.occlusionTexture=cn}if(rn.getMetallicRoughnessTexture()){const tn=rn.getMetallicRoughnessTexture(),sn=rn.getMetallicRoughnessTextureInfo();en.pbrMetallicRoughness.metallicRoughnessTexture=jt.createTextureInfoDef(tn,sn)}return jt.materialIndexMap.set(rn,Qt),en}),Gt.meshes=Vt.listMeshes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);let tn=null;return en.primitives=rn.listPrimitives().map(sn=>{const cn={attributes:{}};cn.mode=sn.getMode();const un=sn.getMaterial();un&&(cn.material=jt.materialIndexMap.get(un)),Object.keys(sn.getExtras()).length&&(cn.extras=sn.getExtras());const hn=sn.getIndices();hn&&(cn.indices=jt.accessorIndexMap.get(hn));for(const dn of sn.listSemantics())cn.attributes[dn]=jt.accessorIndexMap.get(sn.getAttribute(dn));for(const dn of sn.listTargets()){const pn={};for(const fn of dn.listSemantics())pn[fn]=jt.accessorIndexMap.get(dn.getAttribute(fn));cn.targets=cn.targets||[],cn.targets.push(pn)}return sn.listTargets().length&&!tn&&(tn=sn.listTargets().map(dn=>dn.getName())),cn}),rn.getWeights().length&&(en.weights=rn.getWeights()),tn&&(en.extras=en.extras||{},en.extras.targetNames=tn),jt.meshIndexMap.set(rn,Qt),en}),Gt.cameras=Vt.listCameras().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);if(en.type=rn.getType(),en.type===st.Type.PERSPECTIVE){en.perspective={znear:rn.getZNear(),zfar:rn.getZFar(),yfov:rn.getYFov()};const tn=rn.getAspectRatio();tn!==null&&(en.perspective.aspectRatio=tn)}else en.orthographic={znear:rn.getZNear(),zfar:rn.getZFar(),xmag:rn.getXMag(),ymag:rn.getYMag()};return jt.cameraIndexMap.set(rn,Qt),en}),Gt.nodes=Vt.listNodes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);return L.eq(rn.getTranslation(),[0,0,0])||(en.translation=rn.getTranslation()),L.eq(rn.getRotation(),[0,0,0,1])||(en.rotation=rn.getRotation()),L.eq(rn.getScale(),[1,1,1])||(en.scale=rn.getScale()),rn.getWeights().length&&(en.weights=rn.getWeights()),jt.nodeIndexMap.set(rn,Qt),en}),Gt.skins=Vt.listSkins().map((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=rn.getInverseBindMatrices();tn&&(en.inverseBindMatrices=jt.accessorIndexMap.get(tn));const sn=rn.getSkeleton();return sn&&(en.skeleton=jt.nodeIndexMap.get(sn)),en.joints=rn.listJoints().map(cn=>jt.nodeIndexMap.get(cn)),jt.skinIndexMap.set(rn,Qt),en}),Vt.listNodes().forEach((rn,Qt)=>{const en=Gt.nodes[Qt],tn=rn.getMesh();tn&&(en.mesh=jt.meshIndexMap.get(tn));const sn=rn.getCamera();sn&&(en.camera=jt.cameraIndexMap.get(sn));const cn=rn.getSkin();cn&&(en.skin=jt.skinIndexMap.get(cn)),rn.listChildren().length>0&&(en.children=rn.listChildren().map(un=>jt.nodeIndexMap.get(un)))}),Gt.animations=Vt.listAnimations().map((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=new Map;return en.samplers=rn.listSamplers().map((sn,cn)=>{const un=jt.createPropertyDef(sn);return un.input=jt.accessorIndexMap.get(sn.getInput()),un.output=jt.accessorIndexMap.get(sn.getOutput()),un.interpolation=sn.getInterpolation(),tn.set(sn,cn),un}),en.channels=rn.listChannels().map(sn=>{const cn=jt.createPropertyDef(sn);return cn.sampler=tn.get(sn.getSampler()),cn.target={node:jt.nodeIndexMap.get(sn.getTargetNode()),path:sn.getTargetPath()},cn}),jt.animationIndexMap.set(rn,Qt),en}),Gt.scenes=Vt.listScenes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);return en.nodes=rn.listChildren().map(tn=>jt.nodeIndexMap.get(tn)),jt.sceneIndexMap.set(rn,Qt),en});const nn=Vt.getDefaultScene();return nn&&(Gt.scene=Vt.listScenes().indexOf(nn)),Gt.extensionsUsed=qt.map(rn=>rn.extensionName),Gt.extensionsRequired=Xt.map(rn=>rn.extensionName),qt.forEach(rn=>rn.write(jt)),function(rn){const Qt=[];for(const en in rn){const tn=rn[en];(Array.isArray(tn)&&tn.length===0||tn===null||tn===""||tn&&typeof tn=="object"&&Object.keys(tn).length===0)&&Qt.push(en)}for(const en of Qt)delete rn[en]}(Gt),zt}}var Bt;(function(kt){kt[kt.JSON=1313821514]="JSON",kt[kt.BIN=5130562]="BIN"})(Bt||(Bt={}));class Pt{constructor(){this.M=B$1.DEFAULT_INSTANCE,this.l=new Set,this.U={},this.P=f.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(_e){return this.M=_e,this}registerExtensions(_e){for(const Dt of _e)this.l.add(Dt),Dt.register();return this}registerDependencies(_e){return Object.assign(this.U,_e),this}setVertexLayout(_e){return this.P=_e,this}async read(_e){return await this.readJSON(await this.readAsJSON(_e))}async readAsJSON(_e){const Dt=await this.readURI(_e,"view");this.lastReadBytes=Dt.byteLength;const Vt=Lt(Dt)?this.L(Dt):{json:JSON.parse(E.decodeText(Dt)),resources:{}};return await this.j(Vt,this.dirname(_e)),this.D(Vt),Vt}async readJSON(_e){return _e=this._(_e),this.D(_e),Et.read(_e,{extensions:Array.from(this.l),dependencies:this.U,logger:this.M})}async binaryToJSON(_e){const Dt=this.L(E.assertView(_e));this.D(Dt);const Vt=Dt.json;if(Vt.buffers&&Vt.buffers.some(Gt=>function(zt,jt){return jt.uri!==void 0&&!(jt.uri in zt.resources)}(Dt,Gt)))throw new Error("Cannot resolve external buffers with binaryToJSON().");if(Vt.images&&Vt.images.some(Gt=>function(zt,jt){return jt.uri!==void 0&&!(jt.uri in zt.resources)&&jt.bufferView===void 0}(Dt,Gt)))throw new Error("Cannot resolve external images with binaryToJSON().");return Dt}async readBinary(_e){return this.readJSON(await this.binaryToJSON(E.assertView(_e)))}async writeJSON(_e,Dt={}){if(Dt.format===g.GLB&&_e.getRoot().listBuffers().length>1)throw new Error("GLB must have 0–1 buffers.");return Ut.write(_e,{format:Dt.format||g.GLTF,basename:Dt.basename||"",logger:this.M,vertexLayout:this.P,dependencies:pt({},this.U),extensions:Array.from(this.l)})}async writeBinary(_e){const{json:Dt,resources:Vt}=await this.writeJSON(_e,{format:g.GLB}),Gt=new Uint32Array([1179937895,2,12]),zt=JSON.stringify(Dt),jt=E.pad(E.encodeText(zt),32),Ht=E.toView(new Uint32Array([jt.byteLength,1313821514])),Wt=E.concat([Ht,jt]);Gt[Gt.length-1]+=Wt.byteLength;const qt=Object.values(Vt)[0];if(!qt||!qt.byteLength)return E.concat([E.toView(Gt),Wt]);const Xt=E.pad(qt,0),Kt=E.toView(new Uint32Array([Xt.byteLength,5130562])),Yt=E.concat([Kt,Xt]);return Gt[Gt.length-1]+=Yt.byteLength,E.concat([E.toView(Gt),Wt,Yt])}async j(_e,Dt){var Vt=this;const Gt=[..._e.json.images||[],..._e.json.buffers||[]].map(async function(zt){const jt=zt.uri;if(!jt||jt.match(/data:/))return Promise.resolve();_e.resources[jt]=await Vt.readURI(Vt.resolve(Dt,jt),"view"),Vt.lastReadBytes+=_e.resources[jt].byteLength});await Promise.all(Gt)}D(_e){function Dt(Vt){if(Vt.uri){if(Vt.uri in _e.resources)E.assertView(_e.resources[Vt.uri]);else if(Vt.uri.match(/data:/)){const Gt=`__${V()}.${N.extension(Vt.uri)}`;_e.resources[Gt]=E.createBufferFromDataURI(Vt.uri),Vt.uri=Gt}}}(_e.json.images||[]).forEach(Vt=>{if(Vt.bufferView===void 0&&Vt.uri===void 0)throw new Error("Missing resource URI or buffer view.");Dt(Vt)}),(_e.json.buffers||[]).forEach(Dt)}_(_e){const{images:Dt,buffers:Vt}=_e.json;return _e={json:pt({},_e.json),resources:pt({},_e.resources)},Dt&&(_e.json.images=Dt.map(Gt=>pt({},Gt))),Vt&&(_e.json.buffers=Vt.map(Gt=>pt({},Gt))),_e}L(_e){if(!Lt(_e))throw new Error("Invalid glTF 2.0 binary.");const Dt=new Uint32Array(_e.buffer,_e.byteOffset+12,2);if(Dt[1]!==Bt.JSON)throw new Error("Missing required GLB JSON chunk.");const Vt=Dt[0],Gt=E.decodeText(E.toView(_e,20,Vt)),zt=JSON.parse(Gt),jt=20+Vt;if(_e.byteLength<=jt)return{json:zt,resources:{}};const Ht=new Uint32Array(_e.buffer,_e.byteOffset+jt,2);if(Ht[1]!==Bt.BIN)throw new Error("Expected GLB BIN in second chunk.");const Wt=E.toView(_e,jt+8,Ht[0]);return{json:zt,resources:{[c]:Wt}}}}function Lt(kt){if(kt.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;const _e=new Uint32Array(kt.buffer,kt.byteOffset,3);return _e[0]===1179937895&&_e[1]===2}class _t extends Pt{constructor(_e=q$1.DEFAULT_INIT){super(),this.J=void 0,this.J=_e}async readURI(_e,Dt){const Vt=await fetch(_e,this.J);switch(Dt){case"view":return new Uint8Array(await Vt.arrayBuffer());case"text":return Vt.text()}}resolve(_e,Dt){return q$1.resolve(_e,Dt)}dirname(_e){return q$1.dirname(_e)}}function q(){return q=Object.assign?Object.assign.bind():function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},q.apply(this,arguments)}function B(kt,_e){return Object.defineProperty(_e,"name",{value:kt}),_e}function Z(kt,_e){if(kt==null&&_e==null)return!0;if(kt==null||_e==null||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++)if(kt[Dt]!==_e[Dt])return!1;return!0}var ae=typeof Float32Array<"u"?Float32Array:Array;function ge(){var kt=new ae(3);return ae!=Float32Array&&(kt[0]=0,kt[1]=0,kt[2]=0),kt}function Ae(){var kt=new ae(4);return ae!=Float32Array&&(kt[0]=0,kt[1]=0,kt[2]=0,kt[3]=0),kt}Math.hypot||(Math.hypot=function(){for(var kt=0,_e=arguments.length;_e--;)kt+=arguments[_e]*arguments[_e];return Math.sqrt(kt)}),ge(),Ae();const Te="dedup",ye={propertyTypes:[h.ACCESSOR,h.MESH,h.TEXTURE,h.MATERIAL,h.SKIN]};function Ee(kt=ye){const _e=q({},ye,kt),Dt=new Set(_e.propertyTypes);for(const Vt of _e.propertyTypes)if(!ye.propertyTypes.includes(Vt))throw new Error(`${Te}: Unsupported deduplication on type "${Vt}".`);return B(Te,Vt=>{const Gt=Vt.getLogger();Dt.has(h.ACCESSOR)&&function(zt){const jt=zt.getLogger(),Ht=new Map,Wt=new Map,qt=new Map,Xt=new Map,Kt=zt.getRoot().listMeshes();Kt.forEach(rn=>{rn.listPrimitives().forEach(Qt=>{Qt.listAttributes().forEach(en=>Yt(en,Wt)),Yt(Qt.getIndices(),Ht)})});for(const rn of zt.getRoot().listAnimations())for(const Qt of rn.listSamplers())Yt(Qt.getInput(),qt),Yt(Qt.getOutput(),Xt);function Yt(rn,Qt){if(!rn)return;const en=[rn.getCount(),rn.getType(),rn.getComponentType(),rn.getNormalized(),rn.getSparse()].join(":");let tn=Qt.get(en);tn||Qt.set(en,tn=new Set),tn.add(rn)}function Zt(rn,Qt){for(let en=0;en<rn.length;en++){const tn=rn[en],sn=E.toView(tn.getArray());if(!Qt.has(tn))for(let cn=en+1;cn<rn.length;cn++){const un=rn[cn];Qt.has(un)||E.equals(sn,E.toView(un.getArray()))&&Qt.set(un,tn)}}}let Jt=0;const nn=new Map;for(const rn of[Wt,Ht,qt,Xt])for(const Qt of rn.values())Jt+=Qt.size,Zt(Array.from(Qt),nn);jt.debug(`${Te}: Merged ${nn.size} of ${Jt} accessors.`),Kt.forEach(rn=>{rn.listPrimitives().forEach(Qt=>{Qt.listAttributes().forEach(tn=>{nn.has(tn)&&Qt.swap(tn,nn.get(tn))});const en=Qt.getIndices();en&&nn.has(en)&&Qt.swap(en,nn.get(en))})});for(const rn of zt.getRoot().listAnimations())for(const Qt of rn.listSamplers()){const en=Qt.getInput(),tn=Qt.getOutput();en&&nn.has(en)&&Qt.swap(en,nn.get(en)),tn&&nn.has(tn)&&Qt.swap(tn,nn.get(tn))}Array.from(nn.keys()).forEach(rn=>rn.dispose())}(Vt),Dt.has(h.TEXTURE)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot(),Wt=Ht.listTextures(),qt=new Map;for(let Xt=0;Xt<Wt.length;Xt++){const Kt=Wt[Xt],Yt=Kt.getImage();if(!qt.has(Kt))for(let Zt=Xt+1;Zt<Wt.length;Zt++){const Jt=Wt[Zt],nn=Jt.getImage();if(qt.has(Jt)||Kt.getMimeType()!==Jt.getMimeType())continue;const rn=Kt.getSize(),Qt=Jt.getSize();rn&&Qt&&rn[0]===Qt[0]&&rn[1]===Qt[1]&&Yt&&nn&&E.equals(Yt,nn)&&qt.set(Jt,Kt)}}jt.debug(`${Te}: Merged ${qt.size} of ${Ht.listTextures().length} textures.`),Array.from(qt.entries()).forEach(([Xt,Kt])=>{Xt.listParents().forEach(Yt=>{Yt instanceof vt||Yt.swap(Xt,Kt)}),Xt.dispose()})}(Vt),Dt.has(h.MATERIAL)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot().listMaterials(),Wt=new Map,qt=new Set(["name"]),Xt=new Map;for(let Kt=0;Kt<Ht.length;Kt++){const Yt=Ht[Kt];if(!Wt.has(Yt)&&!Me(Yt,Xt))for(let Zt=Kt+1;Zt<Ht.length;Zt++){const Jt=Ht[Zt];Wt.has(Jt)||Me(Jt,Xt)||Yt.equals(Jt,qt)&&Wt.set(Jt,Yt)}}jt.debug(`${Te}: Merged ${Wt.size} of ${Ht.length} materials.`),Array.from(Wt.entries()).forEach(([Kt,Yt])=>{Kt.listParents().forEach(Zt=>{Zt instanceof vt||Zt.swap(Kt,Yt)}),Kt.dispose()})}(Vt),Dt.has(h.MESH)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot(),Wt=new Map;Ht.listAccessors().forEach((Kt,Yt)=>Wt.set(Kt,Yt)),Ht.listMaterials().forEach((Kt,Yt)=>Wt.set(Kt,Yt));const qt=Ht.listMeshes().length,Xt=new Map;for(const Kt of Ht.listMeshes()){const Yt=[];for(const Jt of Kt.listPrimitives())Yt.push(Se(Jt,Wt));const Zt=Yt.join(";");if(Xt.has(Zt)){const Jt=Xt.get(Zt);Kt.listParents().forEach(nn=>{nn.propertyType!==h.ROOT&&nn.swap(Kt,Jt)}),Kt.dispose()}else Xt.set(Zt,Kt)}jt.debug(`${Te}: Merged ${qt-Xt.size} of ${qt} meshes.`)}(Vt),Dt.has(h.SKIN)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot().listSkins(),Wt=new Map,qt=new Set(["name","joints"]);for(let Xt=0;Xt<Ht.length;Xt++){const Kt=Ht[Xt];if(!Wt.has(Kt))for(let Yt=Xt+1;Yt<Ht.length;Yt++){const Zt=Ht[Yt];Wt.has(Zt)||Kt.equals(Zt,qt)&&Z(Kt.listJoints(),Zt.listJoints())&&Wt.set(Zt,Kt)}}jt.debug(`${Te}: Merged ${Wt.size} of ${Ht.length} skins.`),Array.from(Wt.entries()).forEach(([Xt,Kt])=>{Xt.listParents().forEach(Yt=>{Yt instanceof vt||Yt.swap(Xt,Kt)}),Xt.dispose()})}(Vt),Gt.debug(`${Te}: Complete.`)})}function Se(kt,_e){const Dt=[];for(const Vt of kt.listSemantics()){const Gt=kt.getAttribute(Vt);Dt.push(Vt+":"+_e.get(Gt))}if(kt instanceof dt){const Vt=kt.getIndices();Vt&&Dt.push("indices:"+_e.get(Vt));const Gt=kt.getMaterial();Gt&&Dt.push("material:"+_e.get(Gt)),Dt.push("mode:"+kt.getMode());for(const zt of kt.listTargets())Dt.push("target:"+Se(zt,_e))}return Dt.join(",")}function Me(kt,_e){if(_e.has(kt))return _e.get(kt);const Dt=kt.getGraph(),Vt=new Set,Gt=Dt.listParentEdges(kt);for(;Gt.length>0;){const zt=Gt.pop();if(zt.getAttributes().modifyChild===!0)return _e.set(kt,!0),!0;const jt=zt.getChild();if(!Vt.has(jt))for(const Ht of Dt.listChildEdges(jt))Gt.push(Ht)}return _e.set(kt,!1),!1}function we(kt){const _e=kt.getGraph(),Dt=new Set,Vt=new Set;return function Gt(zt){const jt=new Set;for(const Ht of _e.listChildEdges(zt))Ht.getChild()instanceof yt&&jt.add(Ht.getName()+"Info");for(const Ht of _e.listChildEdges(zt)){const Wt=Ht.getChild();Dt.has(Wt)||(Dt.add(Wt),Wt instanceof it&&jt.has(Ht.getName())?Vt.add(Wt):Wt instanceof nt&&Gt(Wt))}}(kt),Array.from(Vt)}const be="prune",Ne={propertyTypes:[h.NODE,h.SKIN,h.MESH,h.CAMERA,h.PRIMITIVE,h.PRIMITIVE_TARGET,h.ANIMATION,h.MATERIAL,h.TEXTURE,h.ACCESSOR,h.BUFFER],keepLeaves:!1,keepAttributes:!0};function Re(kt=Ne){const _e=q({},Ne,kt),Dt=new Set(_e.propertyTypes);return B(be,Vt=>{const Gt=Vt.getLogger(),zt=Vt.getRoot(),jt=Vt.getGraph(),Ht={};if(Dt.has(h.MESH))for(const Yt of zt.listMeshes())Yt.listPrimitives().length>0||(Yt.dispose(),Kt(Yt));if(Dt.has(h.NODE)&&!_e.keepLeaves&&zt.listScenes().forEach(function Yt(Zt){if(Zt.listChildren().forEach(Yt),Zt instanceof mt)return;const Jt=jt.listParentEdges(Zt).some(nn=>{const rn=nn.getParent().propertyType;return rn!==h.ROOT&&rn!==h.SCENE&&rn!==h.NODE});jt.listChildren(Zt).length!==0||Jt||(Zt.dispose(),Kt(Zt))}),Dt.has(h.NODE)&&zt.listNodes().forEach(Wt),Dt.has(h.SKIN)&&zt.listSkins().forEach(Wt),Dt.has(h.MESH)&&zt.listMeshes().forEach(Wt),Dt.has(h.CAMERA)&&zt.listCameras().forEach(Wt),Dt.has(h.PRIMITIVE)&&qt(jt,h.PRIMITIVE),Dt.has(h.PRIMITIVE_TARGET)&&qt(jt,h.PRIMITIVE_TARGET),!_e.keepAttributes&&Dt.has(h.ACCESSOR)){const Yt=new Map;for(const Zt of zt.listMeshes())for(const Jt of Zt.listPrimitives()){const nn=Jt.getMaterial(),rn=Ce(Jt,Oe(Vt,nn));Xt(Jt,rn),Jt.listTargets().forEach(Qt=>Xt(Qt,rn)),nn&&(Yt.has(nn)?Yt.get(nn).add(Jt):Yt.set(nn,new Set([Jt])))}for(const[Zt,Jt]of Yt)$e(Zt,Array.from(Jt))}if(Dt.has(h.ANIMATION))for(const Yt of zt.listAnimations()){for(const Zt of Yt.listChannels())Zt.getTargetNode()||(Zt.dispose(),Kt(Zt));if(Yt.listChannels().length)Yt.listSamplers().forEach(Wt);else{const Zt=Yt.listSamplers();Wt(Yt),Zt.forEach(Wt)}}if(Dt.has(h.MATERIAL)&&zt.listMaterials().forEach(Wt),Dt.has(h.TEXTURE)&&zt.listTextures().forEach(Wt),Dt.has(h.ACCESSOR)&&zt.listAccessors().forEach(Wt),Dt.has(h.BUFFER)&&zt.listBuffers().forEach(Wt),Object.keys(Ht).length){const Yt=Object.keys(Ht).map(Zt=>`${Zt} (${Ht[Zt]})`).join(", ");Gt.info(`${be}: Removed types... ${Yt}`)}else Gt.info(`${be}: No unused properties found.`);function Wt(Yt){Yt.listParents().filter(Zt=>!(Zt instanceof vt||Zt instanceof tt)).length||(Yt.dispose(),Kt(Yt))}function qt(Yt,Zt){Yt.listEdges().map(Jt=>Jt.getParent()).filter(Jt=>Jt.propertyType===Zt).forEach(Wt)}function Xt(Yt,Zt){for(const Jt of Zt)Yt.setAttribute(Jt,null)}function Kt(Yt){Ht[Yt.propertyType]=Ht[Yt.propertyType]||0,Ht[Yt.propertyType]++}Gt.debug(`${be}: Complete.`)})}function Ce(kt,_e){const Dt=[];for(const Vt of kt.listSemantics())Vt!=="TANGENT"||_e.has(Vt)?(Vt.startsWith("TEXCOORD_")&&!_e.has(Vt)||Vt.startsWith("COLOR_")&&Vt!=="COLOR_0")&&Dt.push(Vt):Dt.push(Vt);return Dt}function Oe(kt,_e,Dt=new Set){if(!_e)return Dt;const Vt=kt.getGraph().listChildEdges(_e),Gt=new Set;for(const zt of Vt)zt.getChild()instanceof yt&&Gt.add(zt.getName());for(const zt of Vt){const jt=zt.getName(),Ht=zt.getChild();Ht instanceof it&&Gt.has(jt.replace(/Info$/,""))&&Dt.add(`TEXCOORD_${Ht.getTexCoord()}`),Ht instanceof yt&&jt.match(/normalTexture/i)&&Dt.add("TANGENT"),Ht instanceof nt&&Oe(kt,Ht,Dt)}return Dt}function $e(kt,_e){const Dt=we(kt),Vt=new Set(Dt.map(Wt=>Wt.getTexCoord())),Gt=Array.from(Vt).sort(),zt=new Map(Gt.map((Wt,qt)=>[Wt,qt])),jt=new Map(Gt.map((Wt,qt)=>[`TEXCOORD_${Wt}`,`TEXCOORD_${qt}`]));for(const Wt of Dt){const qt=Wt.getTexCoord();Wt.setTexCoord(zt.get(qt))}for(const Wt of _e){const qt=Wt.listSemantics().filter(Xt=>Xt.startsWith("TEXCOORD_")).sort();Ht(Wt,qt),Wt.listTargets().forEach(Xt=>Ht(Xt,qt))}function Ht(Wt,qt){for(const Xt of qt){const Kt=Wt.getAttribute(Xt);if(!Kt)continue;const Yt=jt.get(Xt);Yt!==Xt&&(Wt.setAttribute(Yt,Kt),Wt.setAttribute(Xt,null))}}}tt.TargetPath;var Vn;function Xn(kt,_e,Dt){for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++)Dt[Vt]=kt[_e*Gt+Vt];return Dt}function Kn(kt,_e,Dt){for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++)kt[_e*Gt+Vt]=Dt[Vt]}function Jn(kt,_e,Dt=0){if(kt.length!==_e.length)return!1;for(let Vt=0;Vt<kt.length;Vt++)if(Math.abs(kt[Vt]-_e[Vt])>Dt)return!1;return!0}function Zn(kt,_e,Dt){return kt*(1-Dt)+_e*Dt}function Qn(kt,_e,Dt,Vt){for(let Gt=0;Gt<_e.length;Gt++)kt[Gt]=Zn(_e[Gt],Dt[Gt],Vt);return kt}function Yn(kt,_e,Dt,Vt){let Gt,zt,jt,Ht,Wt,qt=_e[0],Xt=_e[1],Kt=_e[2],Yt=_e[3],Zt=Dt[0],Jt=Dt[1],nn=Dt[2],rn=Dt[3];return zt=qt*Zt+Xt*Jt+Kt*nn+Yt*rn,zt<0&&(zt=-zt,Zt=-Zt,Jt=-Jt,nn=-nn,rn=-rn),1-zt>1e-6?(Gt=Math.acos(zt),jt=Math.sin(Gt),Ht=Math.sin((1-Vt)*Gt)/jt,Wt=Math.sin(Vt*Gt)/jt):(Ht=1-Vt,Wt=Vt),kt[0]=Ht*qt+Wt*Zt,kt[1]=Ht*Xt+Wt*Jt,kt[2]=Ht*Kt+Wt*nn,kt[3]=Ht*Yt+Wt*rn,kt}function eo(kt,_e){const Dt=function(Vt,Gt){return Vt[0]*Gt[0]+Vt[1]*Gt[1]+Vt[2]*Gt[2]+Vt[3]*Gt[3]}(kt,_e);return Math.acos(2*Dt*Dt-1)}(function(kt){kt[kt.STEP=0]="STEP",kt[kt.LERP=1]="LERP",kt[kt.SLERP=2]="SLERP"})(Vn||(Vn={}));Promise.resolve();var yo;(function(kt){kt.LANCZOS3="lanczos3",kt.LANCZOS2="lanczos2"})(yo||(yo={}));yo.LANCZOS3;yo.LANCZOS3;async function getCurrentScene(kt){return kt.coreSceneStore.getState().sceneRef}function calculateSceneCenter(kt){const _e=new Box3().setFromObject(kt),Dt=new Vector3;return _e.getCenter(Dt),Dt.y=_e.min.y,Dt}function getItemsGroupFromScene(kt){return kt.getObjectByName("#ITEMS")}function filterOnlyItems(kt){return getItemsGroupFromScene(kt).children}async function getSceneAsUsdzUrl(kt){kt.coreSceneStore.setState({frameLoop:"never"}),await wait(1e3);try{const _e=new USDZExporter,Dt=await getCurrentScene(kt),Vt=calculateSceneCenter(Dt);Dt.position.sub(Vt);const Gt=Dt.rotation.clone(),zt=kt.coreSceneStore.getState().sceneSettings.arTransforms.rotation;Dt.rotation.set(MathUtils.degToRad(zt[0]),MathUtils.degToRad(zt[1]),MathUtils.degToRad(zt[2])),Dt.updateMatrixWorld();const jt=kt.coreSceneStore.getState().sceneSettings.usdzPrecision,Ht=kt.coreSceneStore.getState().sceneSettings.usdzMaxTextureSize,Wt=await _e.parseAsync(Dt,jt,Ht),qt=new Blob([Wt],{type:"model/vnd.usdz+zip"}),Xt=URL.createObjectURL(qt);return Dt.position.add(Vt),Dt.rotation.set(Gt.x,Gt.y,Gt.z),kt.coreSceneStore.setState({frameLoop:"always"}),Xt}catch(_e){return LOGGER.error("Error exporting USDZ: "+_e),kt.coreSceneStore.setState({frameLoop:"always"}),null}}async function getSceneAsGLBUrl(kt){kt.coreSceneStore.setState({frameLoop:"never"}),await wait(1e3);try{const _e=new _t,Dt=new GLTFExporter,Vt=await getCurrentScene(kt),Gt=filterOnlyItems(Vt),zt=calculateSceneCenter(Vt);for(const Yt of Gt)Yt.position.sub(zt);const jt={binary:!0,forceIndices:!0,trs:!1,onlyVisible:!0,embedImages:!0,maxTextureSize:1024},Ht=await Dt.parseAsync(Gt,jt),Wt=await _e.readBinary(new Uint8Array(Ht));for(const Yt of Gt)Yt.position.add(zt);const qt=await optimiseGlb(Wt),Xt=await _e.writeBinary(qt),Kt=await saveArrayBufferAsURL(Xt);return kt.coreSceneStore.setState({frameLoop:"always"}),Kt}catch(_e){return LOGGER.error({title:"Error exporting GLB: "+_e}),kt.coreSceneStore.setState({frameLoop:"always"}),null}}async function optimiseGlb(kt){const Dt=kt.getRoot().listNodes();for(const Vt of Dt){Vt.setExtras({});const Gt=Vt.getName();(Gt==="GRP_ProxyMesh"||Gt==="GRP_LoadingPlaceholder")&&Vt.dispose()}return await kt.transform(Ee(),Re()),LOGGER.info({title:"GLB as json"}),LOGGER.info({title:kt.getRoot().listTextures()}),kt}async function saveArrayBufferAsURL(kt){const _e=new Blob([kt],{type:"application/gltf-buffer"});return LOGGER.info({title:"Approx scene GLB size: "+_e.size/1e6}),URL.createObjectURL(_e)}const byteToHex=[];for(let kt=0;kt<256;++kt)byteToHex.push((kt+256).toString(16).slice(1));function unsafeStringify(kt,_e=0){return(byteToHex[kt[_e+0]]+byteToHex[kt[_e+1]]+byteToHex[kt[_e+2]]+byteToHex[kt[_e+3]]+"-"+byteToHex[kt[_e+4]]+byteToHex[kt[_e+5]]+"-"+byteToHex[kt[_e+6]]+byteToHex[kt[_e+7]]+"-"+byteToHex[kt[_e+8]]+byteToHex[kt[_e+9]]+"-"+byteToHex[kt[_e+10]]+byteToHex[kt[_e+11]]+byteToHex[kt[_e+12]]+byteToHex[kt[_e+13]]+byteToHex[kt[_e+14]]+byteToHex[kt[_e+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(kt,_e,Dt){if(native.randomUUID&&!_e&&!kt)return native.randomUUID();kt=kt||{};const Vt=kt.random??kt.rng?.()??rng();if(Vt.length<16)throw new Error("Random bytes length must be >= 16");if(Vt[6]=Vt[6]&15|64,Vt[8]=Vt[8]&63|128,_e){if(Dt=Dt||0,Dt<0||Dt+16>_e.length)throw new RangeError(`UUID byte range ${Dt}:${Dt+15} is out of buffer bounds`);for(let Gt=0;Gt<16;++Gt)_e[Dt+Gt]=Vt[Gt];return _e}return unsafeStringify(Vt)}class Plug{position=new Vector3;constructor(_e,Dt,Vt=null){this.stores=Dt.stores,this._attachedPlug=null,this._name=_e.name,this._acceptedPlugTypes=_e.acceptedPlugTypes,this._affectedNodes=_e.affectedNodes,this._unvisualizedCount=_e.unvisualizedCount,this._weight=_e.weight,this._connectsToPlugTypes=_e.connectsToPlugTypes,this._dependencySku=_e.dependencySku,this._isDependencySkuInteractive=_e.isDependencySkuInteractive,this._autoSpawnDependencyIfMissing=_e.autoSpawnDependencyIfMissing,this._node=Dt,Vt?(this._comboPlugConnector=Vt.comboPlugConnector,this._guid=Vt.guid,this._isOpen=Vt.isOpen,this._type=Vt.type,this._isReceiverPlug=Vt.isReceiverPlug,this._attachedPlugGUID=Vt.attachedPlugGUID):(this._comboPlugConnector=!1,this._guid=v4(),this._isOpen=!0,this._type=_e.type,this._isReceiverPlug=!1,this._attachedPlugGUID=null)}export(){return this.isOpen?null:{guid:this._guid,type:this._type,isOpen:this._isOpen,comboPlugConnector:this._comboPlugConnector,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}get plug3dObject(){if(this._node.ref)return this._node.ref.getObjectByName(""+this.name)}get absoluteWorldPosition(){return this.plug3dObject?(this.plug3dObject.getWorldPosition(this.position),this.position):null}set comboPlugConnector(_e){this._comboPlugConnector=_e}get comboPlugConnector(){return this._comboPlugConnector}get attachedPlug(){return this._attachedPlug}set attachedPlug(_e){this._attachedPlug=_e}get attachedNode(){return this._attachedPlug?this._attachedPlug.node:null}get attachedPlugGUID(){return this._attachedPlugGUID}set type(_e){this._type=_e}get type(){return this._type}get weight(){return this._weight}get unvisualizedCount(){return this.__unvisualizedCount}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(_e){this._acceptedPlugTypes=_e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(_e){this._connectsToPlugTypes=_e}get isOpen(){return this._isOpen}get isOccupied(){return!this.isOpen}get dependencySku(){return this._dependencySku}get isDependencySkuInteractive(){return this._isDependencySkuInteractive}attachPlug(_e,Dt=!1){this._attachedPlug=_e,this._attachedPlugGUID=_e.guid,this._isOpen=!1,this._isReceiverPlug=Dt;const Vt=this,Gt=this._node;if(Gt.isConnectedToRoot&&Dt){const zt=Gt.whichPlugAreWeAttachedUsing();switch(_e.type){case"weighted_hider":zt.weight<Vt.weight&&(Gt.showNodes(zt.affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Gt.guid+":modelLoaded",function(){Gt.showNodes(zt.affectedNodes)},{once:!0}));break}}if(Dt&&_e.type!==""&&_e.type==Vt._type)switch(_e.type){default:case"weighted_hider":Vt._weight>_e.weight?_e.node.hideNodes(_e.affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.node.guid+":modelLoaded",function(){_e.node.hideNodes(_e.affectedNodes)},{once:!0}):Vt._weight<_e.weight&&(Gt.hideNodes(Vt._affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Gt.guid+":modelLoaded",function(){Gt.hideNodes(Vt._affectedNodes)},{once:!0}));break}Dt&&(Gt.isEndNode=!1)}async openPlug(){if(this._comboPlugConnector&&(this._comboPlugConnector=!1),this._node.isConnectedToRoot){const _e=this._node.whichPlugAreWeAttachedUsing();if(_e&&this._guid!==_e.guid)switch(this.type){case"weighted_hider":_e.type==="weighted_hider"&&_e.weight<this.weight&&this._node.hideNodes(_e.affectedNodes);break}}if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}if(this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode()),!!this._dependencySku&&!(this._autoSpawnDependencyIfMissing==!1||this._isDependencySkuInteractive||this.stores.coreSceneStore.getState().configurationLoaded===!1))try{const _e=await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(this._dependencySku,!0);if(!_e)return;const Dt=_e.connectablePlugs;let Vt=!1;const Gt=this._isDependencySkuInteractive?this.isDependencySkuInteractive===1:!1;for(const zt of Dt){if(zt.receiverPlug.guid!==this._guid)continue;Vt=!0;const jt=await this.stores.itemStore.getState().actions.addItemBySkuID(this._dependencySku,Dt.indexOf(zt),!0,Gt);jt!==null&&this._node.addMyDependenciesGUID(jt)}Vt||await this.stores.ghostStore.getState().actions.clearAllGhosts()}catch{LOGGER.info({title:"The Plug has been removed!"})}}canAttachToPlug(_e){for(let Dt=0;Dt<this._connectsToPlugTypes.length;Dt++)if(_e._acceptedPlugTypes.includes(this._connectsToPlugTypes[Dt]))return!0;return!1}distanceToPlug(_e){return this.absoluteWorldPosition===null?null:this.absoluteWorldPosition.distanceTo(_e.absoluteWorldPosition)}distanceToPlugSquared(_e){return this.absoluteWorldPosition===null?null:this.absoluteWorldPosition.distanceToSquared(_e.absoluteWorldPosition)}}let Node$1=class{#t="default";#i=!1;#n=!1;#s=!0;#r={};#c=!1;#o=[];constructor(_e,Dt,Vt=null,Gt,zt){this.stores=_e;let jt=_e.productDataStore.getState().productData;this._plugs=[],this._skuID=Dt,this._ref=null,this._dragging=!1,this._modelFunctions=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=jt[Dt].followsParent,this._categoryID=jt[Dt].categoryID,this._replace=jt[Dt].replace,this._swappable=jt[Dt].swappable,this._price=this.#l(),this._compareAtPrice=this.#a(),this.#i=jt[Dt]?.ignoreInCart,Vt?(this._guid=Vt.guid,this._isEndNode=Vt.isEndNode,this._overrideVariant=Vt.overrideVariant,this.generatePlugsWithData(Dt,Vt.plugs)):(this._guid=v4(),this._isEndNode=!0,this.generatePlugsForNode(Dt)),Gt&&Object.keys(Gt).map(Ht=>{if(jt[Dt].looks&&jt[Dt].looks.includes(Ht)){this.#t=Ht;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Xt=>{Xt.id==_e&&(zt=Xt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;jt.map(Xt=>{Xt.products.map(Kt=>{this.skuID===Kt&&Xt.products.map(Yt=>{Wt.map(Zt=>{if(Zt==Yt){const Jt=this.stores.productDataStore.getState().actions.getProductDataById(Zt);this.skuID=Jt.skuID;const nn=qt[this.guid];nn&&nn.itemData&&Object.keys(Jt).map(rn=>{nn.itemData[rn]=Jt[rn]}),this.hideNodes(Jt.geometriesToHide),this.showNodes(Jt.geometriesToShow),this.updatePricing(),this.resetInStock(),this.stores.inventoryStore.getState().actions.refreshInventory(qt)}})})})})}resetInStock(){this.#r={},this.#c=!0}setInStockForRef(_e){if(!this.ref)return!1;let Dt=this.ref.getObjectByName("GRP_RenderGeometry");return Dt?(Dt.inStock=_e,!0):!1}set inStock({variantName:_e,newValue:Dt}){if(this.#r[_e]&&this.#r[_e]==Dt||(this.#r[_e]=Dt,_e!==this.currentVariant&&this.#c===!1))return;const Vt=()=>{this.setInStockForRef(Dt)};Vt()||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",Vt,{once:!0})}get myDependenciesGUID(){return this.#o}set myDependenciesGUID(_e){this.#o=_e}get dragging(){return this._dragging}set dragging(_e){this._dragging=_e}addMyDependenciesGUID(_e){this.#o.push(_e)}get isDependent(){return this.#n}set isDependent(_e){this.#n=_e}get isInteractive(){return this.#s}set isInteractive(_e){this.#s=_e}update(_e){this._skuID=_e;const Dt=this.stores.productDataStore.getState().productData,Vt=Dt[_e]?.plugs;if(this.ignoreInCart=Dt[_e].ignoreInCart,!!Vt)for(let Gt=0;Gt<this._plugs.length;Gt++)for(let zt=0;zt<Vt.length;zt++)this._plugs[Gt].name==Vt[zt].name&&(this._plugs[Gt].acceptedPlugTypes=Vt[zt].acceptedPlugTypes,this._plugs[Gt].connectsToPlugTypes=Vt[zt].connectsToPlugTypes)}export(){let _e={};for(let Dt=0;Dt<this._plugs.length;Dt++){let Vt=this._plugs[Dt].export();Vt&&(_e[this._plugs[Dt].name]=Vt)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:_e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#i}set ignoreInCart(_e){this.#i=_e}get isTypeCombo(){const _e=this.whichPlugAreWeAttachedUsing();return _e?_e.type=="comboPlug"&&_e.connectsToPlugTypes.length>0:!1}get canRotate(){let _e=!0;if(this.isTypeCombo)return!1;if(!this._isEndNode){const Vt=this.whichNodesAreAttachedToUs();if(Vt.length>0){let Gt=!0;if(Vt.map(zt=>{zt.followsParent===!1&&(Gt=!1)}),!Gt)return!1}}let Dt=!1;for(let Vt=0;Vt<this.plugs.length;Vt++)if(!this.plugs[Vt].isOpen&&this.plugs[Vt].attachedPlug.isReceiverPlug){const Gt=this.plugs[Vt].attachedPlug.acceptedPlugTypes;for(let zt=0;zt<this.plugs.length;zt++)if(Vt!=zt)for(let jt=0;jt<this.plugs[zt].connectsToPlugTypes.length;jt++)Gt.includes(this.plugs[zt].connectsToPlugTypes[jt])&&(Dt=!0)}if(_e=Dt,_e){const Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure;_e=Vt&&Vt.hasValidAlternateRotation(this.guid)}return _e}hideNodes(_e){if(!this.ref)return!1;const Dt=this.ref.getObjectByName("GRP_RenderGeometry"),Vt=this.ref.getObjectByName("GRP_ProxyMesh");return _e.map(Gt=>{if(Dt){const zt=Dt.getObjectByName(Gt);zt&&(zt.visible=!1)}if(Vt){const zt=Vt.getObjectByName(Gt);zt&&(zt.visible=!1)}}),!0}showNodes(_e){if(!this.ref)return!1;const Dt=this.ref.getObjectByName("GRP_RenderGeometry"),Vt=this.ref.getObjectByName("GRP_ProxyMesh");return _e.map(Gt=>{if(Dt){const zt=Dt.getObjectByName(Gt);zt&&(zt.visible=!0)}if(Vt){const zt=Vt.getObjectByName(Gt);zt&&(zt.visible=!0)}}),!0}canConnectToPlugType(_e){let Dt=!1;return this._plugs.map(Vt=>{Vt.connectsToPlugTypes.map(Gt=>{Gt==_e&&(Dt=!0)})}),Dt}isConnectedToSkuID(_e){let Dt=!1;return this._plugs.map(Vt=>{if(Vt.isOpen||Dt===!0)return;let Gt=Vt.attachedPlug;!Gt&&Vt.attachedPlugGUID&&(Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getPlugByGUID(Vt.attachedPlugGUID)),Gt.node.skuID==_e&&(Dt=!0)}),Dt}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const Dt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Vt=this.whichNodesAreAttachedToUs();let Gt=null;Vt.map(qt=>{qt.followsParent===!1&&(Gt=qt)});const zt=Gt.detachNodeFromReceiver();let jt=null;this._plugs.map(qt=>{qt.isOpen||qt.attachedPlug.node.skuID=="Root"&&(jt=qt.attachedPlug)});const Ht=this.detachNodeFromReceiver();let Wt=null;return Gt.plugs.map(qt=>{qt.connectsToPlugTypes.includes("root")&&(Wt=qt)}),Dt.connectPlugs({incomingPlug:Wt,receiverPlug:jt}),{neighborDetachedPlugs:zt,rootDetachedPlugs:Ht,neighborNode:Gt}}get canSwapRoot(){if(this.stores.coreSceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let _e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const Vt=this.whichNodesAreAttachedToUs();let Gt=0,zt=null;Vt.map(jt=>{jt.followsParent===!1&&(Gt++,zt=jt)}),Gt==1?zt.canConnectToPlugType("root")&&(_e=!0):Gt>0&&(_e=!1)}return _e}get canRemove(){let _e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(Vt=>{Vt.followsParent===!1&&(_e=!1)}),_e||(_e=this.canSwapRoot)),_e}getComboPlugNodesAttachedToUs(){let _e=[];return this.whichNodesAreAttachedToUs().forEach(Vt=>{Vt.isTypeCombo&&_e.push(Vt);const Gt=Vt.getComboPlugNodesAttachedToUs();Gt.length>0&&(_e=_e.concat(Gt))}),_e}getAllBranchedNodesAttachedToUs(){let _e=[];const Dt=this.whichNodesAreAttachedToUs();for(let Vt=0;Vt<Dt.length;Vt++){_e.push(Dt[Vt]);const Gt=Dt[Vt].getAllBranchedNodesAttachedToUs();Gt.length>0&&(_e=_e.concat(Gt))}return _e}getNonInteractiveBranchedNodesIncludingSelf(){const _e=[],Dt=(Vt,Gt=!1)=>{const zt=Vt.isInteractive;if(!Gt&&zt)return;zt||_e.push(Vt),Vt.whichNodesAreAttachedToUs().forEach(Ht=>{Dt(Ht,!1)})};return Dt(this,!0),_e}get canDrag(){let _e=!0;if(this.stores.coreSceneStore.getState().dragging||this.isTypeCombo)return!1;for(let Vt=0;Vt<this._plugs.length;Vt++)if(this._plugs[Vt].isOpen==!1&&this._plugs[Vt].attachedPlug.type=="comboPlug")return!1;const Dt=this.getComboPlugNodesAttachedToUs();if(Dt.length>0){const Vt=this.getAllBranchedNodesAttachedToUs();let Gt=!0;if(Dt.map(zt=>{const jt=zt.whichNodesIsThisComboPlugAttachedTo();let Ht=!0;if(jt.map(Wt=>{let qt=!1;if(Vt.map(Xt=>{Wt.guid===Xt.guid&&(qt=!0)}),qt==!1){Ht=!1;return}}),Ht==!1){Gt=!1;return}}),Gt==!1)return!1}return this._isEndNode||(this.whichNodesAreAttachedToUs().map(Gt=>{Gt.followsParent===!1&&(_e=!1)}),_e||(_e=this.canSwapRoot)),_e}get followsParent(){return this._followsParent}set followsParent(_e){this._followsParent=_e}resetFollowsParent(){const _e=this.stores.productDataStore.getState().productData;this._followsParent=_e[this.skuID].followsParent}get currentVariant(){return this.#t==="default"?this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(_e){this._price=_e}get compareAtPrice(){return this._compareAtPrice}set compareAtPrice(_e){this._compareAtPrice=_e}updateCompareAtPricing(){this._compareAtPrice=this.#a()}updatePricing(){this._price=this.#l()}#a(){let Dt=this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.compareAtPrice;return Dt||(Dt=0),Dt}#l(){let Dt=this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return Dt||(Dt=0),Dt}set currentVariant(_e){this.#t=_e,this._price=this.#l(),this._compareAtPrice=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(_e){this._overrideVariant=_e,this.#t=this._overrideVariant,this._price=this.#l(),this._compareAtPrice=this.#a()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(_e){this._skuID=_e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(_e){this._ref=_e}get modelFunctions(){return this._modelFunctions}set modelFunctions(_e){this._modelFunctions=_e}checkGeometryVariant(){let _e=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const Dt=this.stores.attachmentStore.getState().attachmentSystem;Dt.globalGeometryVariants&&Object.keys(Dt.globalGeometryVariants).map(Vt=>{this.updateGeometryVariant(Vt,Dt.globalGeometryVariants[Vt])}),_e.data={},this.stores.coreSceneStore.getState().CORE_API.coreWCRef?this.stores.coreSceneStore.getState().CORE_API.coreWCRef.dispatchEvent(_e):LOGGER.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(_e){this._isEndNode=_e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(_e){this._transform=_e}setModelVisibility(_e){_e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let _e=!0;for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&(_e=!1);this.isEndNode=_e}whichNodesAreAttachedToUs(){const _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&_e.push(this._plugs[Dt].attachedPlug.node);return _e}whichPlugsAreAttachedToUs(){const _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&_e.push({receiverPlug:this._plugs[Dt],incomingPlug:this._plugs[Dt].attachedPlug});return _e}whichNodeAreWeAttachedTo(){let _e=null;for(const Dt of this._plugs)Dt?.attachedPlug?.isReceiverPlug&&(_e=Dt.attachedPlug.node);return _e}whichNodesIsThisComboPlugAttachedTo(){if(!this.isTypeCombo)return[];let _e=[];for(const Dt of this._plugs)Dt?.attachedPlug?.isReceiverPlug&&_e.push(Dt.attachedPlug.node);return _e}isReplaceableWithSkuIdOld(_e){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;let Gt=0;if(!Vt)return!1;for(let zt=0;zt<this._plugs.length;zt++)for(let jt=0;jt<Vt.length;jt++)this._plugs[zt].name==Vt[jt].name&&Gt++;return Gt==this._plugs.length}isReplaceableWithSkuId(_e){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;if(!Vt)return LOGGER.warn({title:`The new sku ${_e} is invalid for this experience to replace this node: `,details:this}),!1;let Gt=!1,zt=!0;const jt=this.whichPlugAreWeAttachedTo();for(const Wt of Vt)if(Gt=hasCommonElement(jt.acceptedPlugTypes,Wt.connectsToPlugTypes),Gt===!0)break;const Ht=this.whichPlugsAreAttachedToUs();for(const Wt of Ht)for(const qt of Vt)if(zt=hasCommonElement(qt.acceptedPlugTypes,Wt.connectsToPlugTypes),zt===!1)break;return Gt&&zt}getAllSkusThatCanReplaceMe(){let _e=[];const Dt=this.stores.productDataStore.getState().productData;return Object.keys(Dt).map(Vt=>{Vt!=this.skuID&&this.isReplaceableWithSkuId(Vt)&&_e.push(Vt)}),_e}whichPlugAreWeAttachedUsing(){for(let _e=0;_e<this._plugs.length;_e++){const Dt=this._plugs[_e];let Vt=Dt.attachedPlug;if(!Vt&&Dt.attachedPlugGUID&&(Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getPlugByGUID(Dt.attachedPlugGUID)),!Dt.isOpen&&Vt.isReceiverPlug)return Dt}}whichPlugAreWeAttachedTo(){for(let _e=0;_e<this._plugs.length;_e++)if(!this._plugs[_e].isOpen&&this._plugs[_e].attachedPlug.isReceiverPlug)return this._plugs[_e].attachedPlug}getPlugWhichCanConnectToType(_e){for(const Dt of this._plugs)if(Dt.connectsToPlugTypes.includes(_e))return Dt;return null}getOpenPlugsWeCanAttachFrom(){let _e=[];if(this.whichNodeAreWeAttachedTo())return _e;for(let Dt=0;Dt<this._plugs.length;Dt++)this.plugs[Dt].isOpen&&this.plugs[Dt].connectsToPlugTypes.length>0&&_e.push(this._plugs[Dt]);return _e}getOpenPlugsFromNode(){let _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isOpen&&this._plugs[Dt].acceptedPlugTypes.length>0&&_e.push(this._plugs[Dt]);return _e}generatePlugsForNode(_e){this._plugs=[];let Dt=this.stores.productDataStore.getState().productData[_e]?.plugs;if(Dt)for(let Vt=0;Vt<Dt.length;Vt++)if(Dt[Vt].type==="unvisualizedPlug"){const Gt=Dt[Vt]?.unvisualizedCount>=0?Dt[Vt].unvisualizedCount:1e3;for(let zt=0;zt<Gt;zt++){const jt=new Plug({...Dt[Vt],name:`${Dt[Vt].name}_${zt}`},this);this._plugs.push(jt)}}else{const Gt=new Plug(Dt[Vt],this);this._plugs.push(Gt)}}generatePlugsWithData(_e,Dt){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;Vt&&Vt.forEach(Gt=>{if(Gt.type==="unvisualizedPlug"){const zt=Gt.unvisualizedCount&&Gt.unvisualizedCount>=0?Gt.unvisualizedCount:1e3;for(let jt=0;jt<zt;jt++){const Ht=new Plug({...Gt,name:`${Gt.name}_${jt}`},this,Dt[`${Gt.name}_${jt}`]);this._plugs.push(Ht)}}else{const zt=new Plug(Gt,this,Dt[Gt.name]);this._plugs.push(zt)}})}detachNodeFromReceiver(){for(let _e=0;_e<this.plugs.length;_e++)if(!this.plugs[_e].isOpen&&this.plugs[_e].attachedPlug.isReceiverPlug){const Dt={incomingPlug:this.plugs[_e],receiverPlug:this.plugs[_e].attachedPlug};return this.plugs[_e].attachedPlug.openPlug(),this.plugs[_e].openPlug(),Dt}}detachNodeCompletely(){for(let _e=0;_e<this._plugs.length;_e++)this._plugs[_e].isOpen||(this._plugs[_e].attachedPlug.openPlug(),this._plugs[_e].openPlug())}getPlugByName(_e){for(let Dt=0;Dt<this._plugs.length;Dt++)if(this._plugs[Dt].name==_e)return this._plugs[Dt];return null}getPlugByGUID(_e){for(let Dt=0;Dt<this._plugs.length;Dt++)if(this._plugs[Dt].guid==_e)return this._plugs[Dt];return null}async removeNode(){const _e=[];for(const Dt of this._plugs)if(!Dt.isOpen){if(Dt.type==="comboPlug"&&Dt.connectsToPlugTypes.length>0){Dt.attachedPlug.openPlug();continue}Dt.attachedPlug.isReceiverPlug?Dt.attachedPlug.openPlug():_e.push(Dt.attachedPlug.node.guid)}if(_e.length>0)for(const Dt of _e)this.stores.itemStore.getState().actions.addToRemoveItems(Dt);this.modelFunctions=null,this.ref=null}};const EPIGRAPH_CONFIGURATOR_CATEGORY="Epigraph - Configurator",CONFIGURATOR_LOADING={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoading",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_READY={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReady",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_FAILED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorFailed",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_REVIEW_CART_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartShown",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_REVIEW_CART_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckout",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT_ITEM={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckoutItemDetails",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalGeometryVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOCAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLocalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOAD_FROM_PRECONFIG={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoadFromPreConfiguration",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"preconfigurationItemAdded",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_SCENE_RESTARTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneRestarted",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_AR_REQUESTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorArRequested",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_REMOVED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemRemoved",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemAdded",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsBtnClicked",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsStageCompletionRate",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_ENTER={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotEnter",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_EXIT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotExit",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_SCENE_SHARED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneShared",label:"",interaction:{nonInteraction:!1}};/* @license
4636
+ `}class EventDispatcher{constructor(){this._listeners={}}addEventListener(_e,Dt){const Vt=this._listeners;return Vt[_e]===void 0&&(Vt[_e]=[]),Vt[_e].indexOf(Dt)===-1&&Vt[_e].push(Dt),this}removeEventListener(_e,Dt){if(this._listeners===void 0)return this;const Gt=this._listeners[_e];if(Gt!==void 0){const zt=Gt.indexOf(Dt);zt!==-1&&Gt.splice(zt,1)}return this}dispatchEvent(_e){if(this._listeners===void 0)return this;const Vt=this._listeners[_e.type];if(Vt!==void 0){const Gt=Vt.slice(0);for(let zt=0,jt=Gt.length;zt<jt;zt++)Gt[zt].call(this,_e)}return this}dispose(){for(const _e in this._listeners)delete this._listeners[_e]}}class GraphEdge extends EventDispatcher{constructor(_e,Dt,Vt,Gt={}){if(super(),this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=_e,this._parent=Dt,this._child=Vt,this._attributes=Gt,!Dt.isOnGraph(Vt))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(_e){return this._child=_e,this}getAttributes(){return this._attributes}dispose(){this._disposed||(this._disposed=!0,this.dispatchEvent({type:"dispose",target:this}),super.dispose())}isDisposed(){return this._disposed}}class Graph extends EventDispatcher{constructor(..._e){super(..._e),this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(_e){return Array.from(this._childEdges.get(_e)||this._emptySet)}listParents(_e){return this.listParentEdges(_e).map(Dt=>Dt.getParent())}listChildEdges(_e){return Array.from(this._parentEdges.get(_e)||this._emptySet)}listChildren(_e){return this.listChildEdges(_e).map(Dt=>Dt.getChild())}disconnectParents(_e,Dt){let Vt=this.listParentEdges(_e);return Dt&&(Vt=Vt.filter(Gt=>Dt(Gt.getParent()))),Vt.forEach(Gt=>Gt.dispose()),this}createEdge(_e,Dt,Vt,Gt){return this._registerEdge(new GraphEdge(_e,Dt,Vt,Gt))}_registerEdge(_e){this._edges.add(_e);const Dt=_e.getParent();this._parentEdges.has(Dt)||this._parentEdges.set(Dt,new Set),this._parentEdges.get(Dt).add(_e);const Vt=_e.getChild();return this._childEdges.has(Vt)||this._childEdges.set(Vt,new Set),this._childEdges.get(Vt).add(_e),_e.addEventListener("dispose",()=>this._removeEdge(_e)),_e}_removeEdge(_e){return this._edges.delete(_e),this._parentEdges.get(_e.getParent()).delete(_e),this._childEdges.get(_e.getChild()).delete(_e),this}}function _extends(){return _extends=Object.assign||function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},_extends.apply(this,arguments)}function isRef(kt){return kt instanceof GraphEdge}function isRefList(kt){return Array.isArray(kt)&&kt[0]instanceof GraphEdge}function isRefMap(kt){return!!(isPlainObject(kt)&&getFirstValue(kt)instanceof GraphEdge)}function getFirstValue(kt){for(const _e in kt)return kt[_e]}function isPlainObject(kt){return!!kt&&Object.getPrototypeOf(kt)===Object.prototype}const $attributes=Symbol("attributes"),$immutableKeys=Symbol("immutableKeys");class GraphNode extends EventDispatcher{constructor(_e){super(),this._disposed=!1,this.graph=void 0,this[$attributes]=void 0,this[$immutableKeys]=void 0,this.graph=_e,this[$immutableKeys]=new Set,this[$attributes]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){const _e=this.getDefaults(),Dt={};for(const Vt in _e){const Gt=_e[Vt];if(Gt instanceof GraphNode){const zt=this.graph.createEdge(Vt,this,Gt);zt.addEventListener("dispose",()=>Gt.dispose()),this[$immutableKeys].add(Vt),Dt[Vt]=zt}else Dt[Vt]=Gt}return Dt}isOnGraph(_e){return this.graph===_e.graph}isDisposed(){return this._disposed}dispose(){this._disposed||(this.graph.listChildEdges(this).forEach(_e=>_e.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"}))}detach(){return this.graph.disconnectParents(this),this}swap(_e,Dt){for(const Vt in this[$attributes]){const Gt=this[$attributes][Vt];if(isRef(Gt)){const zt=Gt;zt.getChild()===_e&&this.setRef(Vt,Dt,zt.getAttributes())}else if(isRefList(Gt)){const jt=Gt.find(Ht=>Ht.getChild()===_e);if(jt){const Ht=jt.getAttributes();this.removeRef(Vt,_e).addRef(Vt,Dt,Ht)}}else if(isRefMap(Gt)){const zt=Gt;for(const jt in zt){const Ht=zt[jt];Ht.getChild()===_e&&this.setRefMap(Vt,jt,Dt,Ht.getAttributes())}}}return this}get(_e){return this[$attributes][_e]}set(_e,Dt){return this[$attributes][_e]=Dt,this.dispatchEvent({type:"change",attribute:_e})}getRef(_e){const Dt=this[$attributes][_e];return Dt?Dt.getChild():null}setRef(_e,Dt,Vt){if(this[$immutableKeys].has(_e))throw new Error(`Cannot overwrite immutable attribute, "${_e}".`);const Gt=this[$attributes][_e];if(Gt&&Gt.dispose(),!Dt)return this;const zt=this.graph.createEdge(_e,this,Dt,Vt);return zt.addEventListener("dispose",()=>{delete this[$attributes][_e],this.dispatchEvent({type:"change",attribute:_e})}),this[$attributes][_e]=zt,this.dispatchEvent({type:"change",attribute:_e})}listRefs(_e){return this[$attributes][_e].map(Vt=>Vt.getChild())}addRef(_e,Dt,Vt){const Gt=this.graph.createEdge(_e,this,Dt,Vt),zt=this[$attributes][_e];return zt.push(Gt),Gt.addEventListener("dispose",()=>{let jt;for(;(jt=zt.indexOf(Gt))!==-1;)zt.splice(jt,1);this.dispatchEvent({type:"change",attribute:_e})}),this.dispatchEvent({type:"change",attribute:_e})}removeRef(_e,Dt){return this[$attributes][_e].filter(zt=>zt.getChild()===Dt).forEach(zt=>zt.dispose()),this}listRefMapKeys(_e){return Object.keys(this[$attributes][_e])}listRefMapValues(_e){return Object.values(this[$attributes][_e]).map(Dt=>Dt.getChild())}getRefMap(_e,Dt){const Vt=this[$attributes][_e];return Vt[Dt]?Vt[Dt].getChild():null}setRefMap(_e,Dt,Vt,Gt){const zt=this[$attributes][_e],jt=zt[Dt];if(jt&&jt.dispose(),!Vt)return this;Gt=Object.assign(Gt||{},{key:Dt});const Ht=this.graph.createEdge(_e,this,Vt,_extends({},Gt,{key:Dt}));return Ht.addEventListener("dispose",()=>{delete zt[Dt],this.dispatchEvent({type:"change",attribute:_e,key:Dt})}),zt[Dt]=Ht,this.dispatchEvent({type:"change",attribute:_e,key:Dt})}dispatchEvent(_e){return super.dispatchEvent(_extends({},_e,{target:this})),this.graph.dispatchEvent(_extends({},_e,{target:this,type:`node:${_e.type}`})),this}}const u="v3.7.3",c="@glb.bin";var h,f,l,d,g;(function(kt){kt.ACCESSOR="Accessor",kt.ANIMATION="Animation",kt.ANIMATION_CHANNEL="AnimationChannel",kt.ANIMATION_SAMPLER="AnimationSampler",kt.BUFFER="Buffer",kt.CAMERA="Camera",kt.MATERIAL="Material",kt.MESH="Mesh",kt.PRIMITIVE="Primitive",kt.PRIMITIVE_TARGET="PrimitiveTarget",kt.NODE="Node",kt.ROOT="Root",kt.SCENE="Scene",kt.SKIN="Skin",kt.TEXTURE="Texture",kt.TEXTURE_INFO="TextureInfo"})(h||(h={})),function(kt){kt.INTERLEAVED="interleaved",kt.SEPARATE="separate"}(f||(f={})),function(kt){kt.ARRAY_BUFFER="ARRAY_BUFFER",kt.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",kt.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",kt.OTHER="OTHER",kt.SPARSE="SPARSE"}(l||(l={})),function(kt){kt[kt.R=4096]="R",kt[kt.G=256]="G",kt[kt.B=16]="B",kt[kt.A=1]="A"}(d||(d={})),function(kt){kt.GLTF="GLTF",kt.GLB="GLB"}(g||(g={}));const p={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var m,w=typeof Float32Array<"u"?Float32Array:Array;function y(kt){return Math.hypot(kt[0],kt[1],kt[2])}Math.hypot||(Math.hypot=function(){for(var kt=0,_e=arguments.length;_e--;)kt+=arguments[_e]*arguments[_e];return Math.sqrt(kt)}),m=new w(3),w!=Float32Array&&(m[0]=0,m[1]=0,m[2]=0);class E{static createBufferFromDataURI(_e){if(typeof Buffer>"u"){const Dt=atob(_e.split(",")[1]),Vt=new Uint8Array(Dt.length);for(let Gt=0;Gt<Dt.length;Gt++)Vt[Gt]=Dt.charCodeAt(Gt);return Vt}{const Dt=_e.split(",")[1],Vt=_e.indexOf("base64")>=0;return Buffer.from(Dt,Vt?"base64":"utf8")}}static encodeText(_e){return typeof TextEncoder<"u"?new TextEncoder().encode(_e):Buffer.from(_e)}static decodeText(_e){return typeof TextDecoder<"u"?new TextDecoder().decode(_e):Buffer.from(_e).toString("utf8")}static concat(_e){let Dt=0;for(const zt of _e)Dt+=zt.byteLength;const Vt=new Uint8Array(Dt);let Gt=0;for(const zt of _e)Vt.set(zt,Gt),Gt+=zt.byteLength;return Vt}static pad(_e,Dt=0){const Vt=this.padNumber(_e.byteLength);if(Vt===_e.byteLength)return _e;const Gt=new Uint8Array(Vt);if(Gt.set(_e),Dt!==0)for(let zt=_e.byteLength;zt<Vt;zt++)Gt[zt]=Dt;return Gt}static padNumber(_e){return 4*Math.ceil(_e/4)}static equals(_e,Dt){if(_e===Dt)return!0;if(_e.byteLength!==Dt.byteLength)return!1;let Vt=_e.byteLength;for(;Vt--;)if(_e[Vt]!==Dt[Vt])return!1;return!0}static toView(_e,Dt=0,Vt=1/0){return new Uint8Array(_e.buffer,_e.byteOffset+Dt,Math.min(_e.byteLength,Vt))}static assertView(_e){if(_e&&!ArrayBuffer.isView(_e))throw new Error(`Method requires Uint8Array parameter; received "${typeof _e}".`);return _e}}class S{static hexToFactor(_e,Dt){_e=Math.floor(_e);const Vt=Dt;return Vt[0]=(_e>>16&255)/255,Vt[1]=(_e>>8&255)/255,Vt[2]=(255&_e)/255,this.convertSRGBToLinear(Dt,Dt)}static factorToHex(_e){const Dt=[..._e],[Vt,Gt,zt]=this.convertLinearToSRGB(_e,Dt);return 255*Vt<<16^255*Gt<<8^255*zt<<0}static convertSRGBToLinear(_e,Dt){const Vt=_e,Gt=Dt;for(let zt=0;zt<3;zt++)Gt[zt]=Vt[zt]<.04045?.0773993808*Vt[zt]:Math.pow(.9478672986*Vt[zt]+.0521327014,2.4);return Dt}static convertLinearToSRGB(_e,Dt){const Vt=_e,Gt=Dt;for(let zt=0;zt<3;zt++)Gt[zt]=Vt[zt]<.0031308?12.92*Vt[zt]:1.055*Math.pow(Vt[zt],.41666)-.055;return Dt}}class M{match(_e){return _e.length>=8&&_e[0]===137&&_e[1]===80&&_e[2]===78&&_e[3]===71&&_e[4]===13&&_e[5]===10&&_e[6]===26&&_e[7]===10}getSize(_e){const Dt=new DataView(_e.buffer,_e.byteOffset);return E.decodeText(_e.slice(12,16))===M.PNG_FRIED_CHUNK_NAME?[Dt.getUint32(32,!1),Dt.getUint32(36,!1)]:[Dt.getUint32(16,!1),Dt.getUint32(20,!1)]}getChannels(_e){return 4}}M.PNG_FRIED_CHUNK_NAME="CgBI";class I{static registerFormat(_e,Dt){this.impls[_e]=Dt}static getMimeType(_e){for(const Dt in this.impls)if(this.impls[Dt].match(_e))return Dt;return null}static getSize(_e,Dt){return this.impls[Dt]?this.impls[Dt].getSize(_e):null}static getChannels(_e,Dt){return this.impls[Dt]?this.impls[Dt].getChannels(_e):null}static getVRAMByteLength(_e,Dt){if(!this.impls[Dt])return null;if(this.impls[Dt].getVRAMByteLength)return this.impls[Dt].getVRAMByteLength(_e);let Vt=0;const Gt=this.getSize(_e,Dt);if(!Gt)return null;for(;Gt[0]>1||Gt[1]>1;)Vt+=Gt[0]*Gt[1]*4,Gt[0]=Math.max(Math.floor(Gt[0]/2),1),Gt[1]=Math.max(Math.floor(Gt[1]/2),1);return Vt+=4,Vt}static mimeTypeToExtension(_e){return _e==="image/jpeg"?"jpg":_e.split("/").pop()}static extensionToMimeType(_e){return _e==="jpg"?"image/jpeg":_e?`image/${_e}`:""}}function R(kt,_e){if(_e>kt.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(kt.getUint8(_e)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return kt}I.impls={"image/jpeg":new class{match(kt){return kt.length>=3&&kt[0]===255&&kt[1]===216&&kt[2]===255}getSize(kt){let _e,Dt,Vt=new DataView(kt.buffer,kt.byteOffset+4);for(;Vt.byteLength;){if(_e=Vt.getUint16(0,!1),R(Vt,_e),Dt=Vt.getUint8(_e+1),Dt===192||Dt===193||Dt===194)return[Vt.getUint16(_e+7,!1),Vt.getUint16(_e+5,!1)];Vt=new DataView(kt.buffer,Vt.byteOffset+_e+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(kt){return 3}},"image/png":new M};class N{static basename(_e){const Dt=_e.split(/[\\/]/).pop();return Dt.substring(0,Dt.lastIndexOf("."))}static extension(_e){if(_e.startsWith("data:image/")){const Dt=_e.match(/data:(image\/\w+)/)[1];return I.mimeTypeToExtension(Dt)}return _e.startsWith("data:model/gltf+json")?"gltf":_e.startsWith("data:model/gltf-binary")?"glb":_e.startsWith("data:application/")?"bin":_e.split(/[\\/]/).pop().split(/[.]/).pop()}}function O(kt){return Object.prototype.toString.call(kt)==="[object Object]"}function C(kt){if(O(kt)===!1)return!1;const _e=kt.constructor;if(_e===void 0)return!0;const Dt=_e.prototype;return O(Dt)!==!1&&Object.prototype.hasOwnProperty.call(Dt,"isPrototypeOf")!==!1}var F,U;(function(kt){kt[kt.SILENT=4]="SILENT",kt[kt.ERROR=3]="ERROR",kt[kt.WARN=2]="WARN",kt[kt.INFO=1]="INFO",kt[kt.DEBUG=0]="DEBUG"})(U||(U={}));let B$1=class Ql{constructor(_e){this.verbosity=void 0,this.verbosity=_e}debug(_e){this.verbosity<=Ql.Verbosity.DEBUG&&console.debug(_e)}info(_e){this.verbosity<=Ql.Verbosity.INFO&&console.info(_e)}warn(_e){this.verbosity<=Ql.Verbosity.WARN&&console.warn(_e)}error(_e){this.verbosity<=Ql.Verbosity.ERROR&&console.error(_e)}};function P(kt,_e,Dt){var Vt=_e[0],Gt=_e[1],zt=_e[2],jt=_e[3],Ht=_e[4],Wt=_e[5],qt=_e[6],Xt=_e[7],Kt=_e[8],Yt=_e[9],Zt=_e[10],Jt=_e[11],nn=_e[12],rn=_e[13],Qt=_e[14],en=_e[15],tn=Dt[0],sn=Dt[1],cn=Dt[2],un=Dt[3];return kt[0]=tn*Vt+sn*Ht+cn*Kt+un*nn,kt[1]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[2]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[3]=tn*jt+sn*Xt+cn*Jt+un*en,kt[4]=(tn=Dt[4])*Vt+(sn=Dt[5])*Ht+(cn=Dt[6])*Kt+(un=Dt[7])*nn,kt[5]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[6]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[7]=tn*jt+sn*Xt+cn*Jt+un*en,kt[8]=(tn=Dt[8])*Vt+(sn=Dt[9])*Ht+(cn=Dt[10])*Kt+(un=Dt[11])*nn,kt[9]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[10]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[11]=tn*jt+sn*Xt+cn*Jt+un*en,kt[12]=(tn=Dt[12])*Vt+(sn=Dt[13])*Ht+(cn=Dt[14])*Kt+(un=Dt[15])*nn,kt[13]=tn*Gt+sn*Wt+cn*Yt+un*rn,kt[14]=tn*zt+sn*qt+cn*Zt+un*Qt,kt[15]=tn*jt+sn*Xt+cn*Jt+un*en,kt}F=B$1,B$1.Verbosity=U,B$1.DEFAULT_INSTANCE=new F(F.Verbosity.INFO);class L{static identity(_e){return _e}static eq(_e,Dt,Vt=1e-5){if(_e.length!==Dt.length)return!1;for(let Gt=0;Gt<_e.length;Gt++)if(Math.abs(_e[Gt]-Dt[Gt])>Vt)return!1;return!0}static decodeNormalizedInt(_e,Dt){switch(Dt){case 5126:return _e;case 5123:return _e/65535;case 5121:return _e/255;case 5122:return Math.max(_e/32767,-1);case 5120:return Math.max(_e/127,-1);default:throw new Error("Invalid component type.")}}static denormalize(_e,Dt){return L.decodeNormalizedInt(_e,Dt)}static encodeNormalizedInt(_e,Dt){switch(Dt){case 5126:return _e;case 5123:return Math.round(65535*_e);case 5121:return Math.round(255*_e);case 5122:return Math.round(32767*_e);case 5120:return Math.round(127*_e);default:throw new Error("Invalid component type.")}}static normalize(_e,Dt){return L.encodeNormalizedInt(_e,Dt)}static decompose(_e,Dt,Vt,Gt){let zt=y([_e[0],_e[1],_e[2]]);const jt=y([_e[4],_e[5],_e[6]]),Ht=y([_e[8],_e[9],_e[10]]);var Wt,qt,Xt,Kt,Yt,Zt,Jt,nn,rn,Qt,en,tn,sn,cn,un,hn,dn;((qt=(Wt=_e)[0])*(Jt=Wt[5])-(Xt=Wt[1])*(Zt=Wt[4]))*((tn=Wt[10])*(dn=Wt[15])-(sn=Wt[11])*(hn=Wt[14]))-(qt*(nn=Wt[6])-(Kt=Wt[2])*Zt)*((en=Wt[9])*dn-sn*(un=Wt[13]))+(qt*(rn=Wt[7])-(Yt=Wt[3])*Zt)*(en*hn-tn*un)+(Xt*nn-Kt*Jt)*((Qt=Wt[8])*dn-sn*(cn=Wt[12]))-(Xt*rn-Yt*Jt)*(Qt*hn-tn*cn)+(Kt*rn-Yt*nn)*(Qt*un-en*cn)<0&&(zt=-zt),Dt[0]=_e[12],Dt[1]=_e[13],Dt[2]=_e[14];const pn=_e.slice(),fn=1/zt,mn=1/jt,vn=1/Ht;pn[0]*=fn,pn[1]*=fn,pn[2]*=fn,pn[4]*=mn,pn[5]*=mn,pn[6]*=mn,pn[8]*=vn,pn[9]*=vn,pn[10]*=vn,function(_n,En){var An=new w(3);(function(lr,zn){var ur=zn[4],Hn=zn[5],sr=zn[6],vr=zn[8],fr=zn[9],Un=zn[10];lr[0]=Math.hypot(zn[0],zn[1],zn[2]),lr[1]=Math.hypot(ur,Hn,sr),lr[2]=Math.hypot(vr,fr,Un)})(An,En);var Tn=1/An[0],Cn=1/An[1],yn=1/An[2],Sn=En[0]*Tn,wn=En[1]*Cn,xn=En[2]*yn,Rn=En[4]*Tn,Dn=En[5]*Cn,kn=En[6]*yn,Fn=En[8]*Tn,Pn=En[9]*Cn,Bn=En[10]*yn,qn=Sn+Dn+Bn,tr=0;qn>0?(tr=2*Math.sqrt(qn+1),_n[3]=.25*tr,_n[0]=(kn-Pn)/tr,_n[1]=(Fn-xn)/tr,_n[2]=(wn-Rn)/tr):Sn>Dn&&Sn>Bn?(tr=2*Math.sqrt(1+Sn-Dn-Bn),_n[3]=(kn-Pn)/tr,_n[0]=.25*tr,_n[1]=(wn+Rn)/tr,_n[2]=(Fn+xn)/tr):Dn>Bn?(tr=2*Math.sqrt(1+Dn-Sn-Bn),_n[3]=(Fn-xn)/tr,_n[0]=(wn+Rn)/tr,_n[1]=.25*tr,_n[2]=(kn+Pn)/tr):(tr=2*Math.sqrt(1+Bn-Sn-Dn),_n[3]=(wn-Rn)/tr,_n[0]=(Fn+xn)/tr,_n[1]=(kn+Pn)/tr,_n[2]=.25*tr)}(Vt,pn),Gt[0]=zt,Gt[1]=jt,Gt[2]=Ht}static compose(_e,Dt,Vt,Gt){const zt=Gt,jt=Dt[0],Ht=Dt[1],Wt=Dt[2],qt=Dt[3],Xt=jt+jt,Kt=Ht+Ht,Yt=Wt+Wt,Zt=jt*Xt,Jt=jt*Kt,nn=jt*Yt,rn=Ht*Kt,Qt=Ht*Yt,en=Wt*Yt,tn=qt*Xt,sn=qt*Kt,cn=qt*Yt,un=Vt[0],hn=Vt[1],dn=Vt[2];return zt[0]=(1-(rn+en))*un,zt[1]=(Jt+cn)*un,zt[2]=(nn-sn)*un,zt[3]=0,zt[4]=(Jt-cn)*hn,zt[5]=(1-(Zt+en))*hn,zt[6]=(Qt+tn)*hn,zt[7]=0,zt[8]=(nn+sn)*dn,zt[9]=(Qt-tn)*dn,zt[10]=(1-(Zt+rn))*dn,zt[11]=0,zt[12]=_e[0],zt[13]=_e[1],zt[14]=_e[2],zt[15]=1,zt}}function j(kt,_e){if(!!kt!=!!_e)return!1;const Dt=kt.getChild(),Vt=_e.getChild();return Dt===Vt||Dt.equals(Vt)}function D(kt,_e){if(!!kt!=!!_e||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++){const Vt=kt[Dt],Gt=_e[Dt];if(Vt.getChild()!==Gt.getChild()&&!Vt.getChild().equals(Gt.getChild()))return!1}return!0}function _(kt,_e){if(!!kt!=!!_e)return!1;const Dt=Object.keys(kt),Vt=Object.keys(_e);if(Dt.length!==Vt.length)return!1;for(const Gt in kt){const zt=kt[Gt],jt=_e[Gt];if(!!zt!=!!jt)return!1;const Ht=zt.getChild(),Wt=jt.getChild();if(Ht!==Wt&&!Ht.equals(Wt))return!1}return!0}function k(kt,_e){if(kt===_e)return!0;if(!!kt!=!!_e||!kt||!_e||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++)if(kt[Dt]!==_e[Dt])return!1;return!0}function z(kt,_e){if(kt===_e)return!0;if(!!kt!=!!_e)return!1;if(!C(kt)||!C(_e))return kt===_e;const Dt=kt,Vt=_e;let Gt,zt=0,jt=0;for(Gt in Dt)zt++;for(Gt in Vt)jt++;if(zt!==jt)return!1;for(Gt in Dt){const Ht=Dt[Gt],Wt=Vt[Gt];if(G(Ht)&&G(Wt)){if(!k(Ht,Wt))return!1}else if(C(Ht)&&C(Wt)){if(!z(Ht,Wt))return!1}else if(Ht!==Wt)return!1}return!0}function G(kt){return Array.isArray(kt)||ArrayBuffer.isView(kt)}const J=new Set,$=function(){let kt="";for(let _e=0;_e<6;_e++)kt+="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ".charAt(Math.floor(42*Math.random()));return kt},V=function(){for(let kt=0;kt<999;kt++){const _e=$();if(!J.has(_e))return J.add(_e),_e}return""},W="https://null.example";let q$1=class{static dirname(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.substring(0,Dt+1)}static basename(_e){return N.basename(new URL(_e,W).pathname)}static extension(_e){return N.extension(new URL(_e,W).pathname)}static resolve(_e,Dt){if(!this.isRelativePath(Dt))return Dt;const Vt=_e.split("/"),Gt=Dt.split("/");Vt.pop();for(let zt=0;zt<Gt.length;zt++)Gt[zt]!=="."&&(Gt[zt]===".."?Vt.pop():Vt.push(Gt[zt]));return Vt.join("/")}static isAbsoluteURL(_e){return this.PROTOCOL_REGEXP.test(_e)}static isRelativePath(_e){return!/^(?:[a-zA-Z]+:)?\//.test(_e)}};q$1.DEFAULT_INIT={},q$1.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;const H=kt=>kt,Y=new Set;let Z$1=class extends GraphNode{constructor(_e,Dt=""){super(_e),this[$attributes].name=Dt,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(_e,Dt){return Array.isArray(Dt)&&(Dt=Dt.slice()),super.set(_e,Dt)}getName(){return this.get("name")}setName(_e){return this.set("name",_e)}getExtras(){return this.get("extras")}setExtras(_e){return this.set("extras",_e)}clone(){return new this.constructor(this.graph).copy(this,H)}copy(_e,Dt=H){for(const Vt in this[$attributes]){const Gt=this[$attributes][Vt];if(Gt instanceof GraphEdge)this[$immutableKeys].has(Vt)||Gt.dispose();else if(isRefList(Gt))for(const zt of Gt)zt.dispose();else if(isRefMap(Gt))for(const zt in Gt)Gt[zt].dispose()}for(const Vt in _e[$attributes]){const Gt=this[$attributes][Vt],zt=_e[$attributes][Vt];if(zt instanceof GraphEdge)this[$immutableKeys].has(Vt)?Gt.getChild().copy(Dt(zt.getChild()),Dt):this.setRef(Vt,Dt(zt.getChild()),zt.getAttributes());else if(isRefList(zt))for(const jt of zt)this.addRef(Vt,Dt(jt.getChild()),jt.getAttributes());else if(isRefMap(zt))for(const jt in zt){const Ht=zt[jt];this.setRefMap(Vt,jt,Dt(Ht.getChild()),Ht.getAttributes())}else this[$attributes][Vt]=C(zt)?JSON.parse(JSON.stringify(zt)):Array.isArray(zt)||zt instanceof ArrayBuffer||ArrayBuffer.isView(zt)?zt.slice():zt}return this}equals(_e,Dt=Y){if(this===_e)return!0;if(this.propertyType!==_e.propertyType)return!1;for(const Vt in this[$attributes]){if(Dt.has(Vt))continue;const Gt=this[$attributes][Vt],zt=_e[$attributes][Vt];if(isRef(Gt)||isRef(zt)){if(!j(Gt,zt))return!1}else if(isRefList(Gt)||isRefList(zt)){if(!D(Gt,zt))return!1}else if(isRefMap(Gt)||isRefMap(zt)){if(!_(Gt,zt))return!1}else if(C(Gt)||C(zt)){if(!z(Gt,zt))return!1}else if(G(Gt)||G(zt)){if(!k(Gt,zt))return!1}else if(Gt!==zt)return!1}return!0}detach(){return this.graph.disconnectParents(this,_e=>_e.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}};class K extends Z$1{getDefaults(){return Object.assign(super.getDefaults(),{extensions:{}})}getExtension(_e){return this.getRefMap("extensions",_e)}setExtension(_e,Dt){return Dt&&Dt.t(this),this.setRefMap("extensions",_e,Dt)}listExtensions(){return this.listRefMapValues("extensions")}}class Q extends K{constructor(..._e){super(..._e),this.i=L.identity,this.o=L.identity}init(){this.propertyType=h.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:Q.Type.SCALAR,componentType:Q.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}copy(_e,Dt=H){return super.copy(_e,Dt),this.i=_e.i,this.o=_e.o,this}static getElementSize(_e){switch(_e){case Q.Type.SCALAR:return 1;case Q.Type.VEC2:return 2;case Q.Type.VEC3:return 3;case Q.Type.VEC4:case Q.Type.MAT2:return 4;case Q.Type.MAT3:return 9;case Q.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+_e)}}static getComponentSize(_e){switch(_e){case Q.ComponentType.BYTE:case Q.ComponentType.UNSIGNED_BYTE:return 1;case Q.ComponentType.SHORT:case Q.ComponentType.UNSIGNED_SHORT:return 2;case Q.ComponentType.UNSIGNED_INT:case Q.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+_e)}}getMinNormalized(_e){const Dt=this.getElementSize();this.getMin(_e);for(let Vt=0;Vt<Dt;Vt++)_e[Vt]=this.o(_e[Vt]);return _e}getMin(_e){const Dt=this.get("array"),Vt=this.getCount(),Gt=this.getElementSize();for(let zt=0;zt<Gt;zt++)_e[zt]=1/0;for(let zt=0;zt<Vt*Gt;zt+=Gt)for(let jt=0;jt<Gt;jt++){const Ht=Dt[zt+jt];Number.isFinite(Ht)&&(_e[jt]=Math.min(_e[jt],Ht))}return _e}getMaxNormalized(_e){const Dt=this.getElementSize();this.getMax(_e);for(let Vt=0;Vt<Dt;Vt++)_e[Vt]=this.o(_e[Vt]);return _e}getMax(_e){const Dt=this.get("array"),Vt=this.getCount(),Gt=this.getElementSize();for(let zt=0;zt<Gt;zt++)_e[zt]=-1/0;for(let zt=0;zt<Vt*Gt;zt+=Gt)for(let jt=0;jt<Gt;jt++){const Ht=Dt[zt+jt];Number.isFinite(Ht)&&(_e[jt]=Math.max(_e[jt],Ht))}return _e}getCount(){const _e=this.get("array");return _e?_e.length/this.getElementSize():0}getType(){return this.get("type")}setType(_e){return this.set("type",_e)}getElementSize(){return Q.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(_e){return this.set("normalized",_e),_e?(this.o=Dt=>L.decodeNormalizedInt(Dt,this.get("componentType")),this.i=Dt=>L.encodeNormalizedInt(Dt,this.get("componentType"))):(this.o=L.identity,this.i=L.identity),this}getScalar(_e){const Dt=this.getElementSize();return this.o(this.get("array")[_e*Dt])}setScalar(_e,Dt){return this.get("array")[_e*this.getElementSize()]=this.i(Dt),this}getElement(_e,Dt){const Vt=this.getElementSize(),Gt=this.get("array");for(let zt=0;zt<Vt;zt++)Dt[zt]=this.o(Gt[_e*Vt+zt]);return Dt}setElement(_e,Dt){const Vt=this.getElementSize(),Gt=this.get("array");for(let zt=0;zt<Vt;zt++)Gt[_e*Vt+zt]=this.i(Dt[zt]);return this}getSparse(){return this.get("sparse")}setSparse(_e){return this.set("sparse",_e)}getBuffer(){return this.getRef("buffer")}setBuffer(_e){return this.setRef("buffer",_e)}getArray(){return this.get("array")}setArray(_e){return this.set("componentType",_e?function(Dt){switch(Dt.constructor){case Float32Array:return Q.ComponentType.FLOAT;case Uint32Array:return Q.ComponentType.UNSIGNED_INT;case Uint16Array:return Q.ComponentType.UNSIGNED_SHORT;case Uint8Array:return Q.ComponentType.UNSIGNED_BYTE;case Int16Array:return Q.ComponentType.SHORT;case Int8Array:return Q.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}(_e):Q.ComponentType.FLOAT),this.set("array",_e),this}getByteLength(){const _e=this.get("array");return _e?_e.byteLength:0}}Q.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"},Q.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};class X extends K{init(){this.propertyType=h.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:[],samplers:[]})}addChannel(_e){return this.addRef("channels",_e)}removeChannel(_e){return this.removeRef("channels",_e)}listChannels(){return this.listRefs("channels")}addSampler(_e){return this.addRef("samplers",_e)}removeSampler(_e){return this.removeRef("samplers",_e)}listSamplers(){return this.listRefs("samplers")}}class tt extends K{init(){this.propertyType=h.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(_e){return this.set("targetPath",_e)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(_e){return this.setRef("targetNode",_e)}getSampler(){return this.getRef("sampler")}setSampler(_e){return this.setRef("sampler",_e)}}tt.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class et extends K{init(){this.propertyType=h.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:et.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(_e){return this.set("interpolation",_e)}getInput(){return this.getRef("input")}setInput(_e){return this.setRef("input",_e,{usage:l.OTHER})}getOutput(){return this.getRef("output")}setOutput(_e){return this.setRef("output",_e,{usage:l.OTHER})}}et.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class rt extends K{init(){this.propertyType=h.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(_e){return this.set("uri",_e)}}class st extends K{init(){this.propertyType=h.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:st.Type.PERSPECTIVE,znear:.1,zfar:100,aspectRatio:null,yfov:2*Math.PI*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(_e){return this.set("type",_e)}getZNear(){return this.get("znear")}setZNear(_e){return this.set("znear",_e)}getZFar(){return this.get("zfar")}setZFar(_e){return this.set("zfar",_e)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(_e){return this.set("aspectRatio",_e)}getYFov(){return this.get("yfov")}setYFov(_e){return this.set("yfov",_e)}getXMag(){return this.get("xmag")}setXMag(_e){return this.set("xmag",_e)}getYMag(){return this.get("ymag")}setYMag(_e){return this.set("ymag",_e)}}st.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class nt extends Z$1{t(_e){if(!this.parentTypes.includes(_e.propertyType))throw new Error(`Parent "${_e.propertyType}" invalid for child "${this.propertyType}".`)}}nt.EXTENSION_NAME=void 0;class it extends K{init(){this.propertyType=h.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:it.WrapMode.REPEAT,wrapT:it.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(_e){return this.set("texCoord",_e)}getMagFilter(){return this.get("magFilter")}setMagFilter(_e){return this.set("magFilter",_e)}getMinFilter(){return this.get("minFilter")}setMinFilter(_e){return this.set("minFilter",_e)}getWrapS(){return this.get("wrapS")}setWrapS(_e){return this.set("wrapS",_e)}getWrapT(){return this.get("wrapT")}setWrapT(_e){return this.set("wrapT",_e)}}it.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},it.MagFilter={NEAREST:9728,LINEAR:9729},it.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};const{R:ot,G:at,B:ut,A:ct}=d;class ht extends K{init(){this.propertyType=h.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:ht.AlphaMode.OPAQUE,alphaCutoff:.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new it(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new it(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new it(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new it(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new it(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(_e){return this.set("doubleSided",_e)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(_e){const Dt=this.get("baseColorFactor").slice();return Dt[3]=_e,this.set("baseColorFactor",Dt)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(_e){return this.set("alphaMode",_e)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(_e){return this.set("alphaCutoff",_e)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(_e){return this.set("baseColorFactor",_e)}getBaseColorHex(){return S.factorToHex(this.get("baseColorFactor"))}setBaseColorHex(_e){const Dt=this.get("baseColorFactor").slice();return this.set("baseColorFactor",S.hexToFactor(_e,Dt))}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(_e){return this.setRef("baseColorTexture",_e,{channels:ot|at|ut|ct,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(_e){return this.set("emissiveFactor",_e)}getEmissiveHex(){return S.factorToHex(this.get("emissiveFactor"))}setEmissiveHex(_e){const Dt=this.get("emissiveFactor").slice();return this.set("emissiveFactor",S.hexToFactor(_e,Dt))}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(_e){return this.setRef("emissiveTexture",_e,{channels:ot|at|ut,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(_e){return this.set("normalScale",_e)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(_e){return this.setRef("normalTexture",_e,{channels:ot|at|ut})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(_e){return this.set("occlusionStrength",_e)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(_e){return this.setRef("occlusionTexture",_e,{channels:ot})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(_e){return this.set("roughnessFactor",_e)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(_e){return this.set("metallicFactor",_e)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(_e){return this.setRef("metallicRoughnessTexture",_e,{channels:at|ut})}}ht.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class ft extends K{init(){this.propertyType=h.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:[]})}addPrimitive(_e){return this.addRef("primitives",_e)}removePrimitive(_e){return this.removeRef("primitives",_e)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(_e){return this.set("weights",_e)}}class lt extends K{constructor(..._e){super(..._e),this.u=null,this.h=new Set}init(){this.propertyType=h.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:[]})}copy(_e,Dt=H){if(Dt===H)throw new Error("Node cannot be copied.");return super.copy(_e,Dt)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(_e){return this.set("translation",_e)}setRotation(_e){return this.set("rotation",_e)}setScale(_e){return this.set("scale",_e)}getMatrix(){return L.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(_e){const Dt=this.get("translation").slice(),Vt=this.get("rotation").slice(),Gt=this.get("scale").slice();return L.decompose(_e,Dt,Vt,Gt),this.set("translation",Dt).set("rotation",Vt).set("scale",Gt)}getWorldTranslation(){const _e=[0,0,0];return L.decompose(this.getWorldMatrix(),_e,[0,0,0,1],[1,1,1]),_e}getWorldRotation(){const _e=[0,0,0,1];return L.decompose(this.getWorldMatrix(),[0,0,0],_e,[1,1,1]),_e}getWorldScale(){const _e=[1,1,1];return L.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],_e),_e}getWorldMatrix(){const _e=[];for(let Gt=this;Gt!=null;Gt=Gt.u)_e.push(Gt);let Dt;const Vt=_e.pop().getMatrix();for(;Dt=_e.pop();)P(Vt,Vt,Dt.getMatrix());return Vt}addChild(_e){if(_e.u&&_e.u.removeChild(_e),_e.h.size)for(const Vt of _e.h)Vt.removeChild(_e);this.addRef("children",_e),_e.u=this;const Dt=this[$attributes].children;return Dt[Dt.length-1].addEventListener("dispose",()=>_e.u=null),this}removeChild(_e){return this.removeRef("children",_e)}listChildren(){return this.listRefs("children")}getParent(){return this.u?this.u:this.listParents().find(_e=>_e.propertyType===h.SCENE)||null}getParentNode(){return this.u}getMesh(){return this.getRef("mesh")}setMesh(_e){return this.setRef("mesh",_e)}getCamera(){return this.getRef("camera")}setCamera(_e){return this.setRef("camera",_e)}getSkin(){return this.getRef("skin")}setSkin(_e){return this.setRef("skin",_e)}getWeights(){return this.get("weights")}setWeights(_e){return this.set("weights",_e)}traverse(_e){_e(this);for(const Dt of this.listChildren())Dt.traverse(_e);return this}}class dt extends K{init(){this.propertyType=h.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:dt.Mode.TRIANGLES,material:null,indices:null,attributes:{},targets:[]})}getIndices(){return this.getRef("indices")}setIndices(_e){return this.setRef("indices",_e,{usage:l.ELEMENT_ARRAY_BUFFER})}getAttribute(_e){return this.getRefMap("attributes",_e)}setAttribute(_e,Dt){return this.setRefMap("attributes",_e,Dt,{usage:l.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(_e){return this.setRef("material",_e)}getMode(){return this.get("mode")}setMode(_e){return this.set("mode",_e)}listTargets(){return this.listRefs("targets")}addTarget(_e){return this.addRef("targets",_e)}removeTarget(_e){return this.removeRef("targets",_e)}}dt.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class gt extends Z$1{init(){this.propertyType=h.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:{}})}getAttribute(_e){return this.getRefMap("attributes",_e)}setAttribute(_e,Dt){return this.setRefMap("attributes",_e,Dt,{usage:l.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function pt(){return pt=Object.assign?Object.assign.bind():function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},pt.apply(this,arguments)}class mt extends K{init(){this.propertyType=h.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:[]})}copy(_e,Dt=H){if(Dt===H)throw new Error("Scene cannot be copied.");return super.copy(_e,Dt)}addChild(_e){_e.u&&_e.u.removeChild(_e),this.addRef("children",_e),_e.h.add(this);const Dt=this[$attributes].children;return Dt[Dt.length-1].addEventListener("dispose",()=>_e.h.delete(this)),this}removeChild(_e){return this.removeRef("children",_e)}listChildren(){return this.listRefs("children")}traverse(_e){for(const Dt of this.listChildren())Dt.traverse(_e);return this}}class wt extends K{init(){this.propertyType=h.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:[]})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(_e){return this.setRef("skeleton",_e)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(_e){return this.setRef("inverseBindMatrices",_e,{usage:l.INVERSE_BIND_MATRICES})}addJoint(_e){return this.addRef("joints",_e)}removeJoint(_e){return this.removeRef("joints",_e)}listJoints(){return this.listRefs("joints")}}class yt extends K{init(){this.propertyType=h.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||I.extensionToMimeType(N.extension(this.get("uri")))}setMimeType(_e){return this.set("mimeType",_e)}getURI(){return this.get("uri")}setURI(_e){this.set("uri",_e);const Dt=I.extensionToMimeType(N.extension(_e));return Dt&&this.set("mimeType",Dt),this}getImage(){return this.get("image")}setImage(_e){return this.set("image",E.assertView(_e))}getSize(){const _e=this.get("image");return _e?I.getSize(_e,this.getMimeType()):null}}class vt extends K{init(){this.propertyType=h.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${u}`,version:"2.0"},defaultScene:null,accessors:[],animations:[],buffers:[],cameras:[],materials:[],meshes:[],nodes:[],scenes:[],skins:[],textures:[]})}constructor(_e){super(_e),this.l=new Set,_e.addEventListener("node:create",Dt=>{this.g(Dt.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(_e,Dt=H){if(Dt===H)throw new Error("Root cannot be copied.");this.set("asset",pt({},_e.get("asset"))),this.setName(_e.getName()),this.setExtras(pt({},_e.getExtras())),this.setDefaultScene(_e.getDefaultScene()?Dt(_e.getDefaultScene()):null);for(const Vt of _e.listRefMapKeys("extensions")){const Gt=_e.getExtension(Vt);this.setExtension(Vt,Dt(Gt))}return this}g(_e){return _e instanceof mt?this.addRef("scenes",_e):_e instanceof lt?this.addRef("nodes",_e):_e instanceof st?this.addRef("cameras",_e):_e instanceof wt?this.addRef("skins",_e):_e instanceof ft?this.addRef("meshes",_e):_e instanceof ht?this.addRef("materials",_e):_e instanceof yt?this.addRef("textures",_e):_e instanceof X?this.addRef("animations",_e):_e instanceof Q?this.addRef("accessors",_e):_e instanceof rt&&this.addRef("buffers",_e),this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this.l)}listExtensionsRequired(){return this.listExtensionsUsed().filter(_e=>_e.isRequired())}p(_e){return this.l.add(_e),this}m(_e){return this.l.delete(_e),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(_e){return this.setRef("defaultScene",_e)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class Tt{static fromGraph(_e){return Tt.v.get(_e)||null}constructor(){this.T=new Graph,this.S=new vt(this.T),this.M=B$1.DEFAULT_INSTANCE,Tt.v.set(this.T,this)}getRoot(){return this.S}getGraph(){return this.T}getLogger(){return this.M}setLogger(_e){return this.M=_e,this}clone(){return new Tt().setLogger(this.M).merge(this)}merge(_e){for(const zt of _e.getRoot().listExtensionsUsed()){const jt=this.createExtension(zt.constructor);zt.isRequired()&&jt.setRequired(!0)}const Dt=new Set,Vt=new Map;Dt.add(_e.S),Vt.set(_e.S,this.S);for(const zt of _e.T.listEdges())for(const jt of[zt.getParent(),zt.getChild()]){if(Dt.has(jt))continue;let Ht;Ht=jt.propertyType===h.TEXTURE_INFO?jt:new jt.constructor(this.T),Vt.set(jt,Ht),Dt.add(jt)}const Gt=zt=>{const jt=Vt.get(zt);if(!jt)throw new Error("Could resolve property.");return jt};for(const zt of Dt){const jt=Vt.get(zt);if(!jt)throw new Error("Could resolve property.");jt.propertyType!==h.TEXTURE_INFO&&jt.copy(zt,Gt)}return this}async transform(..._e){const Dt=_e.map(Vt=>Vt.name);for(const Vt of _e)await Vt(this,{stack:Dt});return this}createExtension(_e){const Dt=_e.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(Vt=>Vt.extensionName===Dt)||new _e(this)}createScene(_e=""){return new mt(this.T,_e)}createNode(_e=""){return new lt(this.T,_e)}createCamera(_e=""){return new st(this.T,_e)}createSkin(_e=""){return new wt(this.T,_e)}createMesh(_e=""){return new ft(this.T,_e)}createPrimitive(){return new dt(this.T)}createPrimitiveTarget(_e=""){return new gt(this.T,_e)}createMaterial(_e=""){return new ht(this.T,_e)}createTexture(_e=""){return new yt(this.T,_e)}createAnimation(_e=""){return new X(this.T,_e)}createAnimationChannel(_e=""){return new tt(this.T,_e)}createAnimationSampler(_e=""){return new et(this.T,_e)}createAccessor(_e="",Dt=null){return Dt||(Dt=this.getRoot().listBuffers()[0]),new Q(this.T,_e).setBuffer(Dt)}createBuffer(_e=""){return new rt(this.T,_e)}}Tt.v=new WeakMap;class xt{constructor(_e){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=_e}setTextureInfo(_e,Dt){this.textureInfos.set(_e,Dt),Dt.texCoord!==void 0&&_e.setTexCoord(Dt.texCoord),Dt.extras!==void 0&&_e.setExtras(Dt.extras);const Vt=this.jsonDoc.json.textures[Dt.index];if(Vt.sampler===void 0)return;const Gt=this.jsonDoc.json.samplers[Vt.sampler];Gt.magFilter!==void 0&&_e.setMagFilter(Gt.magFilter),Gt.minFilter!==void 0&&_e.setMinFilter(Gt.minFilter),Gt.wrapS!==void 0&&_e.setWrapS(Gt.wrapS),Gt.wrapT!==void 0&&_e.setWrapT(Gt.wrapT)}}const At={logger:B$1.DEFAULT_INSTANCE,extensions:[],dependencies:{}};class Et{static read(_e,Dt=At){const Vt=pt({},At,Dt),{json:Gt}=_e,zt=new Tt().setLogger(Vt.logger);this.validate(_e,Vt);const jt=new xt(_e),Ht=Gt.asset,Wt=zt.getRoot().getAsset();Ht.copyright&&(Wt.copyright=Ht.copyright),Ht.extras&&(Wt.extras=Ht.extras),Gt.extras!==void 0&&zt.getRoot().setExtras(pt({},Gt.extras));const qt=Gt.extensionsUsed||[],Xt=Gt.extensionsRequired||[];for(const en of Vt.extensions)if(qt.includes(en.EXTENSION_NAME)){const tn=zt.createExtension(en).setRequired(Xt.includes(en.EXTENSION_NAME));for(const sn of tn.readDependencies)tn.install(sn,Vt.dependencies[sn])}const Kt=Gt.buffers||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.BUFFER)).forEach(en=>en.preread(jt,h.BUFFER)),jt.buffers=Kt.map(en=>{const tn=zt.createBuffer(en.name);return en.extras&&tn.setExtras(en.extras),en.uri&&en.uri.indexOf("__")!==0&&tn.setURI(en.uri),tn}),jt.bufferViewBuffers=(Gt.bufferViews||[]).map((en,tn)=>{if(!jt.bufferViews[tn]){const sn=_e.json.buffers[en.buffer];jt.bufferViews[tn]=E.toView(sn.uri?_e.resources[sn.uri]:_e.resources[c],en.byteOffset||0,en.byteLength)}return jt.buffers[en.buffer]});const Yt=Gt.accessors||[];jt.accessors=Yt.map(en=>{const tn=zt.createAccessor(en.name,jt.bufferViewBuffers[en.bufferView]).setType(en.type);return en.extras&&tn.setExtras(en.extras),en.normalized!==void 0&&tn.setNormalized(en.normalized),en.bufferView===void 0||tn.setArray(St(en,jt)),tn});const Zt=Gt.images||[],Jt=Gt.textures||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.TEXTURE)).forEach(en=>en.preread(jt,h.TEXTURE)),jt.textures=Zt.map(en=>{const tn=zt.createTexture(en.name);if(en.extras&&tn.setExtras(en.extras),en.bufferView!==void 0){const sn=Gt.bufferViews[en.bufferView],cn=_e.json.buffers[sn.buffer],un=sn.byteOffset||0,hn=(cn.uri?_e.resources[cn.uri]:_e.resources[c]).slice(un,un+sn.byteLength);tn.setImage(hn)}else en.uri!==void 0&&(tn.setImage(_e.resources[en.uri]),en.uri.indexOf("__")!==0&&tn.setURI(en.uri));if(en.mimeType!==void 0)tn.setMimeType(en.mimeType);else if(en.uri){const sn=N.extension(en.uri);tn.setMimeType(I.extensionToMimeType(sn))}return tn}),jt.materials=(Gt.materials||[]).map(en=>{const tn=zt.createMaterial(en.name);en.extras&&tn.setExtras(en.extras),en.alphaMode!==void 0&&tn.setAlphaMode(en.alphaMode),en.alphaCutoff!==void 0&&tn.setAlphaCutoff(en.alphaCutoff),en.doubleSided!==void 0&&tn.setDoubleSided(en.doubleSided);const sn=en.pbrMetallicRoughness||{};if(sn.baseColorFactor!==void 0&&tn.setBaseColorFactor(sn.baseColorFactor),en.emissiveFactor!==void 0&&tn.setEmissiveFactor(en.emissiveFactor),sn.metallicFactor!==void 0&&tn.setMetallicFactor(sn.metallicFactor),sn.roughnessFactor!==void 0&&tn.setRoughnessFactor(sn.roughnessFactor),sn.baseColorTexture!==void 0){const cn=sn.baseColorTexture;tn.setBaseColorTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getBaseColorTextureInfo(),cn)}if(en.emissiveTexture!==void 0){const cn=en.emissiveTexture;tn.setEmissiveTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getEmissiveTextureInfo(),cn)}if(en.normalTexture!==void 0){const cn=en.normalTexture;tn.setNormalTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getNormalTextureInfo(),cn),en.normalTexture.scale!==void 0&&tn.setNormalScale(en.normalTexture.scale)}if(en.occlusionTexture!==void 0){const cn=en.occlusionTexture;tn.setOcclusionTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getOcclusionTextureInfo(),cn),en.occlusionTexture.strength!==void 0&&tn.setOcclusionStrength(en.occlusionTexture.strength)}if(sn.metallicRoughnessTexture!==void 0){const cn=sn.metallicRoughnessTexture;tn.setMetallicRoughnessTexture(jt.textures[Jt[cn.index].source]),jt.setTextureInfo(tn.getMetallicRoughnessTextureInfo(),cn)}return tn});const nn=Gt.meshes||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.PRIMITIVE)).forEach(en=>en.preread(jt,h.PRIMITIVE)),jt.meshes=nn.map(en=>{const tn=zt.createMesh(en.name);return en.extras&&tn.setExtras(en.extras),en.weights!==void 0&&tn.setWeights(en.weights),(en.primitives||[]).forEach(sn=>{const cn=zt.createPrimitive();sn.extras&&cn.setExtras(sn.extras),sn.material!==void 0&&cn.setMaterial(jt.materials[sn.material]),sn.mode!==void 0&&cn.setMode(sn.mode);for(const[hn,dn]of Object.entries(sn.attributes||{}))cn.setAttribute(hn,jt.accessors[dn]);sn.indices!==void 0&&cn.setIndices(jt.accessors[sn.indices]);const un=en.extras&&en.extras.targetNames||[];(sn.targets||[]).forEach((hn,dn)=>{const pn=un[dn]||dn.toString(),fn=zt.createPrimitiveTarget(pn);for(const[mn,vn]of Object.entries(hn))fn.setAttribute(mn,jt.accessors[vn]);cn.addTarget(fn)}),tn.addPrimitive(cn)}),tn}),jt.cameras=(Gt.cameras||[]).map(en=>{const tn=zt.createCamera(en.name).setType(en.type);if(en.extras&&tn.setExtras(en.extras),en.type===st.Type.PERSPECTIVE){const sn=en.perspective;tn.setYFov(sn.yfov),tn.setZNear(sn.znear),sn.zfar!==void 0&&tn.setZFar(sn.zfar),sn.aspectRatio!==void 0&&tn.setAspectRatio(sn.aspectRatio)}else{const sn=en.orthographic;tn.setZNear(sn.znear).setZFar(sn.zfar).setXMag(sn.xmag).setYMag(sn.ymag)}return tn});const rn=Gt.nodes||[];zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.NODE)).forEach(en=>en.preread(jt,h.NODE)),jt.nodes=rn.map(en=>{const tn=zt.createNode(en.name);if(en.extras&&tn.setExtras(en.extras),en.translation!==void 0&&tn.setTranslation(en.translation),en.rotation!==void 0&&tn.setRotation(en.rotation),en.scale!==void 0&&tn.setScale(en.scale),en.matrix!==void 0){const sn=[0,0,0],cn=[0,0,0,1],un=[1,1,1];L.decompose(en.matrix,sn,cn,un),tn.setTranslation(sn),tn.setRotation(cn),tn.setScale(un)}return en.weights!==void 0&&tn.setWeights(en.weights),tn}),jt.skins=(Gt.skins||[]).map(en=>{const tn=zt.createSkin(en.name);en.extras&&tn.setExtras(en.extras),en.inverseBindMatrices!==void 0&&tn.setInverseBindMatrices(jt.accessors[en.inverseBindMatrices]),en.skeleton!==void 0&&tn.setSkeleton(jt.nodes[en.skeleton]);for(const sn of en.joints)tn.addJoint(jt.nodes[sn]);return tn}),rn.map((en,tn)=>{const sn=jt.nodes[tn];(en.children||[]).forEach(cn=>sn.addChild(jt.nodes[cn])),en.mesh!==void 0&&sn.setMesh(jt.meshes[en.mesh]),en.camera!==void 0&&sn.setCamera(jt.cameras[en.camera]),en.skin!==void 0&&sn.setSkin(jt.skins[en.skin])}),jt.animations=(Gt.animations||[]).map(en=>{const tn=zt.createAnimation(en.name);en.extras&&tn.setExtras(en.extras);const sn=(en.samplers||[]).map(cn=>{const un=zt.createAnimationSampler().setInput(jt.accessors[cn.input]).setOutput(jt.accessors[cn.output]).setInterpolation(cn.interpolation||et.Interpolation.LINEAR);return cn.extras&&un.setExtras(cn.extras),tn.addSampler(un),un});return(en.channels||[]).forEach(cn=>{const un=zt.createAnimationChannel().setSampler(sn[cn.sampler]).setTargetPath(cn.target.path);cn.target.node!==void 0&&un.setTargetNode(jt.nodes[cn.target.node]),cn.extras&&un.setExtras(cn.extras),tn.addChannel(un)}),tn});const Qt=Gt.scenes||[];return zt.getRoot().listExtensionsUsed().filter(en=>en.prereadTypes.includes(h.SCENE)).forEach(en=>en.preread(jt,h.SCENE)),jt.scenes=Qt.map(en=>{const tn=zt.createScene(en.name);return en.extras&&tn.setExtras(en.extras),(en.nodes||[]).map(sn=>jt.nodes[sn]).forEach(sn=>tn.addChild(sn)),tn}),Gt.scene!==void 0&&zt.getRoot().setDefaultScene(jt.scenes[Gt.scene]),zt.getRoot().listExtensionsUsed().forEach(en=>en.read(jt)),Yt.forEach((en,tn)=>{const sn=jt.accessors[tn],cn=!!en.sparse,un=!en.bufferView&&!sn.getArray();(cn||un)&&sn.setSparse(!0).setArray(function(hn,dn){const pn=p[hn.componentType],fn=Q.getElementSize(hn.type);let mn;mn=hn.bufferView!==void 0?St(hn,dn):new pn(hn.count*fn);const vn=hn.sparse;if(!vn)return mn;const _n=vn.count,En=pt({},hn,vn.indices,{count:_n,type:"SCALAR"}),An=pt({},hn,vn.values,{count:_n}),Tn=St(En,dn),Cn=St(An,dn);for(let yn=0;yn<En.count;yn++)for(let Sn=0;Sn<fn;Sn++)mn[Tn[yn]*fn+Sn]=Cn[yn*fn+Sn];return mn}(en,jt))}),zt}static validate(_e,Dt){const Vt=_e.json;if(Vt.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${Vt.asset.version}".`);if(Vt.extensionsRequired){for(const Gt of Vt.extensionsRequired)if(!Dt.extensions.find(zt=>zt.EXTENSION_NAME===Gt))throw new Error(`Missing required extension, "${Gt}".`)}if(Vt.extensionsUsed)for(const Gt of Vt.extensionsUsed)Dt.extensions.find(zt=>zt.EXTENSION_NAME===Gt)||Dt.logger.warn(`Missing optional extension, "${Gt}".`)}}function St(kt,_e){const Dt=_e.bufferViews[kt.bufferView],Vt=_e.jsonDoc.json.bufferViews[kt.bufferView],Gt=p[kt.componentType],zt=Q.getElementSize(kt.type),jt=Gt.BYTES_PER_ELEMENT;if(Vt.byteStride!==void 0&&Vt.byteStride!==zt*jt)return function(Wt,qt){const Xt=qt.bufferViews[Wt.bufferView],Kt=qt.jsonDoc.json.bufferViews[Wt.bufferView],Yt=p[Wt.componentType],Zt=Q.getElementSize(Wt.type),Jt=Yt.BYTES_PER_ELEMENT,nn=Wt.byteOffset||0,rn=new Yt(Wt.count*Zt),Qt=new DataView(Xt.buffer,Xt.byteOffset,Xt.byteLength),en=Kt.byteStride;for(let tn=0;tn<Wt.count;tn++)for(let sn=0;sn<Zt;sn++){const cn=nn+tn*en+sn*Jt;let un;switch(Wt.componentType){case Q.ComponentType.FLOAT:un=Qt.getFloat32(cn,!0);break;case Q.ComponentType.UNSIGNED_INT:un=Qt.getUint32(cn,!0);break;case Q.ComponentType.UNSIGNED_SHORT:un=Qt.getUint16(cn,!0);break;case Q.ComponentType.UNSIGNED_BYTE:un=Qt.getUint8(cn);break;case Q.ComponentType.SHORT:un=Qt.getInt16(cn,!0);break;case Q.ComponentType.BYTE:un=Qt.getInt8(cn);break;default:throw new Error(`Unexpected componentType "${Wt.componentType}".`)}rn[tn*Zt+sn]=un}return rn}(kt,_e);const Ht=Dt.byteOffset+(kt.byteOffset||0);return new Gt(Dt.buffer.slice(Ht,Ht+kt.count*zt*jt))}var Mt;(function(kt){kt[kt.ARRAY_BUFFER=34962]="ARRAY_BUFFER",kt[kt.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Mt||(Mt={}));class It{constructor(_e,Dt,Vt){this.C=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this.F=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this.C=_e,this.jsonDoc=Dt,this.options=Vt;const Gt=_e.getRoot(),zt=Gt.listBuffers().length,jt=Gt.listTextures().length;this.bufferURIGenerator=new Rt(zt>1,()=>Vt.basename||"buffer"),this.imageURIGenerator=new Rt(jt>1,Ht=>function(Wt,qt){const Xt=Wt.getGraph().listParentEdges(qt).find(Kt=>Kt.getParent()!==Wt.getRoot());return Xt?Xt.getName().replace(/texture$/i,""):""}(_e,Ht)||Vt.basename||"texture"),this.logger=_e.getLogger()}createTextureInfoDef(_e,Dt){const Vt={magFilter:Dt.getMagFilter()||void 0,minFilter:Dt.getMinFilter()||void 0,wrapS:Dt.getWrapS(),wrapT:Dt.getWrapT()},Gt=JSON.stringify(Vt);this.samplerDefIndexMap.has(Gt)||(this.samplerDefIndexMap.set(Gt,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(Vt));const zt={source:this.imageIndexMap.get(_e),sampler:this.samplerDefIndexMap.get(Gt)},jt=JSON.stringify(zt);this.textureDefIndexMap.has(jt)||(this.textureDefIndexMap.set(jt,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(zt));const Ht={index:this.textureDefIndexMap.get(jt)};return Dt.getTexCoord()!==0&&(Ht.texCoord=Dt.getTexCoord()),Object.keys(Dt.getExtras()).length>0&&(Ht.extras=Dt.getExtras()),this.textureInfoDefMap.set(Dt,Ht),Ht}createPropertyDef(_e){const Dt={};return _e.getName()&&(Dt.name=_e.getName()),Object.keys(_e.getExtras()).length>0&&(Dt.extras=_e.getExtras()),Dt}createAccessorDef(_e){const Dt=this.createPropertyDef(_e);return Dt.type=_e.getType(),Dt.componentType=_e.getComponentType(),Dt.count=_e.getCount(),this.C.getGraph().listParentEdges(_e).some(Vt=>Vt.getName()==="attributes"&&Vt.getAttributes().key==="POSITION"||Vt.getName()==="input")&&(Dt.max=_e.getMax([]).map(Math.fround),Dt.min=_e.getMin([]).map(Math.fround)),_e.getNormalized()&&(Dt.normalized=_e.getNormalized()),Dt}createImageData(_e,Dt,Vt){if(this.options.format===g.GLB)this.imageBufferViews.push(Dt),_e.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:Dt.byteLength});else{const Gt=I.mimeTypeToExtension(Vt.getMimeType());_e.uri=this.imageURIGenerator.createURI(Vt,Gt),this.jsonDoc.resources[_e.uri]=Dt}}getAccessorUsage(_e){const Dt=this.F.get(_e);if(Dt)return Dt;if(_e.getSparse())return l.SPARSE;for(const Vt of this.C.getGraph().listParentEdges(_e)){const{usage:Gt}=Vt.getAttributes();if(Gt)return Gt;Vt.getParent().propertyType!==h.ROOT&&this.logger.warn(`Missing attribute ".usage" on edge, "${Vt.getName()}".`)}return l.OTHER}addAccessorToUsageGroup(_e,Dt){const Vt=this.F.get(_e);if(Vt&&Vt!==Dt)throw new Error(`Accessor with usage "${Vt}" cannot be reused as "${Dt}".`);return this.F.set(_e,Dt),this}listAccessorUsageGroups(){const _e={};for(const[Dt,Vt]of Array.from(this.F.entries()))_e[Vt]=_e[Vt]||[],_e[Vt].push(Dt);return _e}}It.BufferViewTarget=Mt,It.BufferViewUsage=l,It.USAGE_TO_TARGET={[l.ARRAY_BUFFER]:Mt.ARRAY_BUFFER,[l.ELEMENT_ARRAY_BUFFER]:Mt.ELEMENT_ARRAY_BUFFER};class Rt{constructor(_e,Dt){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=_e,this.basename=Dt}createURI(_e,Dt){if(_e.getURI())return _e.getURI();if(this.multiple){const Vt=this.basename(_e);return this.counter[Vt]=this.counter[Vt]||1,`${Vt}_${this.counter[Vt]++}.${Dt}`}return`${this.basename(_e)}.${Dt}`}}const{BufferViewUsage:Nt}=It,{UNSIGNED_INT:Ot,UNSIGNED_SHORT:Ct,UNSIGNED_BYTE:Ft}=Q.ComponentType;class Ut{static write(_e,Dt){const Vt=_e.getRoot(),Gt={asset:pt({generator:`glTF-Transform ${u}`},Vt.getAsset()),extras:pt({},Vt.getExtras())},zt={json:Gt,resources:{}},jt=new It(_e,zt,Dt),Ht=Dt.logger||B$1.DEFAULT_INSTANCE,Wt=new Set(Dt.extensions.map(rn=>rn.EXTENSION_NAME)),qt=_e.getRoot().listExtensionsUsed().filter(rn=>Wt.has(rn.extensionName)),Xt=_e.getRoot().listExtensionsRequired().filter(rn=>Wt.has(rn.extensionName));qt.length<_e.getRoot().listExtensionsUsed().length&&Ht.warn("Some extensions were not registered for I/O, and will not be written.");for(const rn of qt)for(const Qt of rn.writeDependencies)rn.install(Qt,Dt.dependencies[Qt]);function Kt(rn,Qt,en,tn){const sn=[];let cn=0;for(const hn of rn){const dn=jt.createAccessorDef(hn);dn.bufferView=Gt.bufferViews.length;const pn=hn.getArray(),fn=E.pad(E.toView(pn));dn.byteOffset=cn,cn+=fn.byteLength,sn.push(fn),jt.accessorIndexMap.set(hn,Gt.accessors.length),Gt.accessors.push(dn)}const un={buffer:Qt,byteOffset:en,byteLength:E.concat(sn).byteLength};return tn&&(un.target=tn),Gt.bufferViews.push(un),{buffers:sn,byteLength:cn}}function Yt(rn,Qt,en){const tn=rn[0].getCount();let sn=0;for(const dn of rn){const pn=jt.createAccessorDef(dn);pn.bufferView=Gt.bufferViews.length,pn.byteOffset=sn;const fn=dn.getElementSize(),mn=dn.getComponentSize();sn+=E.padNumber(fn*mn),jt.accessorIndexMap.set(dn,Gt.accessors.length),Gt.accessors.push(pn)}const cn=tn*sn,un=new ArrayBuffer(cn),hn=new DataView(un);for(let dn=0;dn<tn;dn++){let pn=0;for(const fn of rn){const mn=fn.getElementSize(),vn=fn.getComponentSize(),_n=fn.getComponentType(),En=fn.getArray();for(let An=0;An<mn;An++){const Tn=dn*sn+pn+An*vn,Cn=En[dn*mn+An];switch(_n){case Q.ComponentType.FLOAT:hn.setFloat32(Tn,Cn,!0);break;case Q.ComponentType.BYTE:hn.setInt8(Tn,Cn);break;case Q.ComponentType.SHORT:hn.setInt16(Tn,Cn,!0);break;case Q.ComponentType.UNSIGNED_BYTE:hn.setUint8(Tn,Cn);break;case Q.ComponentType.UNSIGNED_SHORT:hn.setUint16(Tn,Cn,!0);break;case Q.ComponentType.UNSIGNED_INT:hn.setUint32(Tn,Cn,!0);break;default:throw new Error("Unexpected component type: "+_n)}}pn+=E.padNumber(mn*vn)}}return Gt.bufferViews.push({buffer:Qt,byteOffset:en,byteLength:cn,byteStride:sn,target:It.BufferViewTarget.ARRAY_BUFFER}),{byteLength:cn,buffers:[new Uint8Array(un)]}}function Zt(rn,Qt,en){const tn=[];let sn=0;const cn=new Map;let un=-1/0;for(const _n of rn){const En=jt.createAccessorDef(_n);Gt.accessors.push(En),jt.accessorIndexMap.set(_n,Gt.accessors.length-1);const An=[],Tn=[],Cn=[],yn=new Array(_n.getElementSize()).fill(0);for(let Rn=0,Dn=_n.getCount();Rn<Dn;Rn++)if(_n.getElement(Rn,Cn),!L.eq(Cn,yn,0)){un=Math.max(Rn,un),An.push(Rn);for(let kn=0;kn<Cn.length;kn++)Tn.push(Cn[kn])}const Sn=An.length,wn={accessorDef:En,count:Sn};if(cn.set(_n,wn),Sn===0)continue;if(Sn>_n.getCount()/3){const Rn=(100*An.length/_n.getCount()).toFixed(1);Ht.warn(`Sparse accessor with many non-zero elements (${Rn}%) may increase file size.`)}const xn=p[_n.getComponentType()];wn.indices=An,wn.values=new xn(Tn)}if(!Number.isFinite(un))return{buffers:tn,byteLength:sn};const hn=un<255?Uint8Array:un<65535?Uint16Array:Uint32Array,dn=un<255?Ft:un<65535?Ct:Ot,pn={buffer:Qt,byteOffset:en+sn,byteLength:0};for(const _n of rn){const En=cn.get(_n);if(En.count===0)continue;En.indicesByteOffset=pn.byteLength;const An=E.pad(E.toView(new hn(En.indices)));tn.push(An),sn+=An.byteLength,pn.byteLength+=An.byteLength}Gt.bufferViews.push(pn);const fn=Gt.bufferViews.length-1,mn={buffer:Qt,byteOffset:en+sn,byteLength:0};for(const _n of rn){const En=cn.get(_n);if(En.count===0)continue;En.valuesByteOffset=mn.byteLength;const An=E.pad(E.toView(En.values));tn.push(An),sn+=An.byteLength,mn.byteLength+=An.byteLength}Gt.bufferViews.push(mn);const vn=Gt.bufferViews.length-1;for(const _n of rn){const En=cn.get(_n);En.count!==0&&(En.accessorDef.sparse={count:En.count,indices:{bufferView:fn,byteOffset:En.indicesByteOffset,componentType:dn},values:{bufferView:vn,byteOffset:En.valuesByteOffset}})}return{buffers:tn,byteLength:sn}}const Jt=new Map;for(const rn of _e.getGraph().listEdges()){if(rn.getParent()===Vt)continue;const Qt=rn.getChild();if(Qt instanceof Q){const en=Jt.get(Qt)||[];en.push(rn),Jt.set(Qt,en)}}if(Gt.accessors=[],Gt.bufferViews=[],Gt.samplers=[],Gt.textures=[],Gt.images=Vt.listTextures().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);rn.getMimeType()&&(en.mimeType=rn.getMimeType());const tn=rn.getImage();return tn&&jt.createImageData(en,tn,rn),jt.imageIndexMap.set(rn,Qt),en}),qt.filter(rn=>rn.prewriteTypes.includes(h.ACCESSOR)).forEach(rn=>rn.prewrite(jt,h.ACCESSOR)),Vt.listAccessors().forEach(rn=>{const Qt=jt.accessorUsageGroupedByParent,en=jt.accessorParents;if(jt.accessorIndexMap.has(rn))return;const tn=Jt.get(rn)||[],sn=jt.getAccessorUsage(rn);if(jt.addAccessorToUsageGroup(rn,sn),Qt.has(sn)){const cn=tn[0].getParent(),un=en.get(cn)||new Set;un.add(rn),en.set(cn,un)}}),qt.filter(rn=>rn.prewriteTypes.includes(h.BUFFER)).forEach(rn=>rn.prewrite(jt,h.BUFFER)),(Vt.listAccessors().length>0||Vt.listTextures().length>0||jt.otherBufferViews.size>0)&&Vt.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");Gt.buffers=[],Vt.listBuffers().forEach((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=jt.accessorUsageGroupedByParent,sn=jt.accessorParents,cn=rn.listParents().filter(mn=>mn instanceof Q),un=new Set(cn),hn=[],dn=Gt.buffers.length;let pn=0;const fn=jt.listAccessorUsageGroups();for(const mn in fn)if(tn.has(mn))for(const vn of Array.from(sn.values())){const _n=Array.from(vn).filter(En=>un.has(En)).filter(En=>jt.getAccessorUsage(En)===mn);if(_n.length)if(mn!==Nt.ARRAY_BUFFER||Dt.vertexLayout===f.INTERLEAVED){const En=mn===Nt.ARRAY_BUFFER?Yt(_n,dn,pn):Kt(_n,dn,pn);pn+=En.byteLength,hn.push(...En.buffers)}else for(const En of _n){const An=Yt([En],dn,pn);pn+=An.byteLength,hn.push(...An.buffers)}}else{const vn=fn[mn].filter(An=>un.has(An));if(!vn.length)continue;const _n=mn===Nt.ELEMENT_ARRAY_BUFFER?It.BufferViewTarget.ELEMENT_ARRAY_BUFFER:void 0,En=mn===Nt.SPARSE?Zt(vn,dn,pn):Kt(vn,dn,pn,_n);pn+=En.byteLength,hn.push(...En.buffers)}if(jt.imageBufferViews.length&&Qt===0){for(let mn=0;mn<jt.imageBufferViews.length;mn++)if(Gt.bufferViews[Gt.images[mn].bufferView].byteOffset=pn,pn+=jt.imageBufferViews[mn].byteLength,hn.push(jt.imageBufferViews[mn]),pn%8){const vn=8-pn%8;pn+=vn,hn.push(new Uint8Array(vn))}}if(jt.otherBufferViews.has(rn))for(const mn of jt.otherBufferViews.get(rn))Gt.bufferViews.push({buffer:dn,byteOffset:pn,byteLength:mn.byteLength}),jt.otherBufferViewsIndexMap.set(mn,Gt.bufferViews.length-1),pn+=mn.byteLength,hn.push(mn);if(pn){let mn;Dt.format===g.GLB?mn=c:(mn=jt.bufferURIGenerator.createURI(rn,"bin"),en.uri=mn),en.byteLength=pn,zt.resources[mn]=E.concat(hn)}Gt.buffers.push(en),jt.bufferIndexMap.set(rn,Qt)}),Vt.listAccessors().find(rn=>!rn.getBuffer())&&Ht.warn("Skipped writing one or more Accessors: no Buffer assigned."),Gt.materials=Vt.listMaterials().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);if(rn.getAlphaMode()!==ht.AlphaMode.OPAQUE&&(en.alphaMode=rn.getAlphaMode()),rn.getAlphaMode()===ht.AlphaMode.MASK&&(en.alphaCutoff=rn.getAlphaCutoff()),rn.getDoubleSided()&&(en.doubleSided=!0),en.pbrMetallicRoughness={},L.eq(rn.getBaseColorFactor(),[1,1,1,1])||(en.pbrMetallicRoughness.baseColorFactor=rn.getBaseColorFactor()),L.eq(rn.getEmissiveFactor(),[0,0,0])||(en.emissiveFactor=rn.getEmissiveFactor()),rn.getRoughnessFactor()!==1&&(en.pbrMetallicRoughness.roughnessFactor=rn.getRoughnessFactor()),rn.getMetallicFactor()!==1&&(en.pbrMetallicRoughness.metallicFactor=rn.getMetallicFactor()),rn.getBaseColorTexture()){const tn=rn.getBaseColorTexture(),sn=rn.getBaseColorTextureInfo();en.pbrMetallicRoughness.baseColorTexture=jt.createTextureInfoDef(tn,sn)}if(rn.getEmissiveTexture()){const tn=rn.getEmissiveTexture(),sn=rn.getEmissiveTextureInfo();en.emissiveTexture=jt.createTextureInfoDef(tn,sn)}if(rn.getNormalTexture()){const tn=rn.getNormalTexture(),sn=rn.getNormalTextureInfo(),cn=jt.createTextureInfoDef(tn,sn);rn.getNormalScale()!==1&&(cn.scale=rn.getNormalScale()),en.normalTexture=cn}if(rn.getOcclusionTexture()){const tn=rn.getOcclusionTexture(),sn=rn.getOcclusionTextureInfo(),cn=jt.createTextureInfoDef(tn,sn);rn.getOcclusionStrength()!==1&&(cn.strength=rn.getOcclusionStrength()),en.occlusionTexture=cn}if(rn.getMetallicRoughnessTexture()){const tn=rn.getMetallicRoughnessTexture(),sn=rn.getMetallicRoughnessTextureInfo();en.pbrMetallicRoughness.metallicRoughnessTexture=jt.createTextureInfoDef(tn,sn)}return jt.materialIndexMap.set(rn,Qt),en}),Gt.meshes=Vt.listMeshes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);let tn=null;return en.primitives=rn.listPrimitives().map(sn=>{const cn={attributes:{}};cn.mode=sn.getMode();const un=sn.getMaterial();un&&(cn.material=jt.materialIndexMap.get(un)),Object.keys(sn.getExtras()).length&&(cn.extras=sn.getExtras());const hn=sn.getIndices();hn&&(cn.indices=jt.accessorIndexMap.get(hn));for(const dn of sn.listSemantics())cn.attributes[dn]=jt.accessorIndexMap.get(sn.getAttribute(dn));for(const dn of sn.listTargets()){const pn={};for(const fn of dn.listSemantics())pn[fn]=jt.accessorIndexMap.get(dn.getAttribute(fn));cn.targets=cn.targets||[],cn.targets.push(pn)}return sn.listTargets().length&&!tn&&(tn=sn.listTargets().map(dn=>dn.getName())),cn}),rn.getWeights().length&&(en.weights=rn.getWeights()),tn&&(en.extras=en.extras||{},en.extras.targetNames=tn),jt.meshIndexMap.set(rn,Qt),en}),Gt.cameras=Vt.listCameras().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);if(en.type=rn.getType(),en.type===st.Type.PERSPECTIVE){en.perspective={znear:rn.getZNear(),zfar:rn.getZFar(),yfov:rn.getYFov()};const tn=rn.getAspectRatio();tn!==null&&(en.perspective.aspectRatio=tn)}else en.orthographic={znear:rn.getZNear(),zfar:rn.getZFar(),xmag:rn.getXMag(),ymag:rn.getYMag()};return jt.cameraIndexMap.set(rn,Qt),en}),Gt.nodes=Vt.listNodes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);return L.eq(rn.getTranslation(),[0,0,0])||(en.translation=rn.getTranslation()),L.eq(rn.getRotation(),[0,0,0,1])||(en.rotation=rn.getRotation()),L.eq(rn.getScale(),[1,1,1])||(en.scale=rn.getScale()),rn.getWeights().length&&(en.weights=rn.getWeights()),jt.nodeIndexMap.set(rn,Qt),en}),Gt.skins=Vt.listSkins().map((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=rn.getInverseBindMatrices();tn&&(en.inverseBindMatrices=jt.accessorIndexMap.get(tn));const sn=rn.getSkeleton();return sn&&(en.skeleton=jt.nodeIndexMap.get(sn)),en.joints=rn.listJoints().map(cn=>jt.nodeIndexMap.get(cn)),jt.skinIndexMap.set(rn,Qt),en}),Vt.listNodes().forEach((rn,Qt)=>{const en=Gt.nodes[Qt],tn=rn.getMesh();tn&&(en.mesh=jt.meshIndexMap.get(tn));const sn=rn.getCamera();sn&&(en.camera=jt.cameraIndexMap.get(sn));const cn=rn.getSkin();cn&&(en.skin=jt.skinIndexMap.get(cn)),rn.listChildren().length>0&&(en.children=rn.listChildren().map(un=>jt.nodeIndexMap.get(un)))}),Gt.animations=Vt.listAnimations().map((rn,Qt)=>{const en=jt.createPropertyDef(rn),tn=new Map;return en.samplers=rn.listSamplers().map((sn,cn)=>{const un=jt.createPropertyDef(sn);return un.input=jt.accessorIndexMap.get(sn.getInput()),un.output=jt.accessorIndexMap.get(sn.getOutput()),un.interpolation=sn.getInterpolation(),tn.set(sn,cn),un}),en.channels=rn.listChannels().map(sn=>{const cn=jt.createPropertyDef(sn);return cn.sampler=tn.get(sn.getSampler()),cn.target={node:jt.nodeIndexMap.get(sn.getTargetNode()),path:sn.getTargetPath()},cn}),jt.animationIndexMap.set(rn,Qt),en}),Gt.scenes=Vt.listScenes().map((rn,Qt)=>{const en=jt.createPropertyDef(rn);return en.nodes=rn.listChildren().map(tn=>jt.nodeIndexMap.get(tn)),jt.sceneIndexMap.set(rn,Qt),en});const nn=Vt.getDefaultScene();return nn&&(Gt.scene=Vt.listScenes().indexOf(nn)),Gt.extensionsUsed=qt.map(rn=>rn.extensionName),Gt.extensionsRequired=Xt.map(rn=>rn.extensionName),qt.forEach(rn=>rn.write(jt)),function(rn){const Qt=[];for(const en in rn){const tn=rn[en];(Array.isArray(tn)&&tn.length===0||tn===null||tn===""||tn&&typeof tn=="object"&&Object.keys(tn).length===0)&&Qt.push(en)}for(const en of Qt)delete rn[en]}(Gt),zt}}var Bt;(function(kt){kt[kt.JSON=1313821514]="JSON",kt[kt.BIN=5130562]="BIN"})(Bt||(Bt={}));class Pt{constructor(){this.M=B$1.DEFAULT_INSTANCE,this.l=new Set,this.U={},this.P=f.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(_e){return this.M=_e,this}registerExtensions(_e){for(const Dt of _e)this.l.add(Dt),Dt.register();return this}registerDependencies(_e){return Object.assign(this.U,_e),this}setVertexLayout(_e){return this.P=_e,this}async read(_e){return await this.readJSON(await this.readAsJSON(_e))}async readAsJSON(_e){const Dt=await this.readURI(_e,"view");this.lastReadBytes=Dt.byteLength;const Vt=Lt(Dt)?this.L(Dt):{json:JSON.parse(E.decodeText(Dt)),resources:{}};return await this.j(Vt,this.dirname(_e)),this.D(Vt),Vt}async readJSON(_e){return _e=this._(_e),this.D(_e),Et.read(_e,{extensions:Array.from(this.l),dependencies:this.U,logger:this.M})}async binaryToJSON(_e){const Dt=this.L(E.assertView(_e));this.D(Dt);const Vt=Dt.json;if(Vt.buffers&&Vt.buffers.some(Gt=>function(zt,jt){return jt.uri!==void 0&&!(jt.uri in zt.resources)}(Dt,Gt)))throw new Error("Cannot resolve external buffers with binaryToJSON().");if(Vt.images&&Vt.images.some(Gt=>function(zt,jt){return jt.uri!==void 0&&!(jt.uri in zt.resources)&&jt.bufferView===void 0}(Dt,Gt)))throw new Error("Cannot resolve external images with binaryToJSON().");return Dt}async readBinary(_e){return this.readJSON(await this.binaryToJSON(E.assertView(_e)))}async writeJSON(_e,Dt={}){if(Dt.format===g.GLB&&_e.getRoot().listBuffers().length>1)throw new Error("GLB must have 0–1 buffers.");return Ut.write(_e,{format:Dt.format||g.GLTF,basename:Dt.basename||"",logger:this.M,vertexLayout:this.P,dependencies:pt({},this.U),extensions:Array.from(this.l)})}async writeBinary(_e){const{json:Dt,resources:Vt}=await this.writeJSON(_e,{format:g.GLB}),Gt=new Uint32Array([1179937895,2,12]),zt=JSON.stringify(Dt),jt=E.pad(E.encodeText(zt),32),Ht=E.toView(new Uint32Array([jt.byteLength,1313821514])),Wt=E.concat([Ht,jt]);Gt[Gt.length-1]+=Wt.byteLength;const qt=Object.values(Vt)[0];if(!qt||!qt.byteLength)return E.concat([E.toView(Gt),Wt]);const Xt=E.pad(qt,0),Kt=E.toView(new Uint32Array([Xt.byteLength,5130562])),Yt=E.concat([Kt,Xt]);return Gt[Gt.length-1]+=Yt.byteLength,E.concat([E.toView(Gt),Wt,Yt])}async j(_e,Dt){var Vt=this;const Gt=[..._e.json.images||[],..._e.json.buffers||[]].map(async function(zt){const jt=zt.uri;if(!jt||jt.match(/data:/))return Promise.resolve();_e.resources[jt]=await Vt.readURI(Vt.resolve(Dt,jt),"view"),Vt.lastReadBytes+=_e.resources[jt].byteLength});await Promise.all(Gt)}D(_e){function Dt(Vt){if(Vt.uri){if(Vt.uri in _e.resources)E.assertView(_e.resources[Vt.uri]);else if(Vt.uri.match(/data:/)){const Gt=`__${V()}.${N.extension(Vt.uri)}`;_e.resources[Gt]=E.createBufferFromDataURI(Vt.uri),Vt.uri=Gt}}}(_e.json.images||[]).forEach(Vt=>{if(Vt.bufferView===void 0&&Vt.uri===void 0)throw new Error("Missing resource URI or buffer view.");Dt(Vt)}),(_e.json.buffers||[]).forEach(Dt)}_(_e){const{images:Dt,buffers:Vt}=_e.json;return _e={json:pt({},_e.json),resources:pt({},_e.resources)},Dt&&(_e.json.images=Dt.map(Gt=>pt({},Gt))),Vt&&(_e.json.buffers=Vt.map(Gt=>pt({},Gt))),_e}L(_e){if(!Lt(_e))throw new Error("Invalid glTF 2.0 binary.");const Dt=new Uint32Array(_e.buffer,_e.byteOffset+12,2);if(Dt[1]!==Bt.JSON)throw new Error("Missing required GLB JSON chunk.");const Vt=Dt[0],Gt=E.decodeText(E.toView(_e,20,Vt)),zt=JSON.parse(Gt),jt=20+Vt;if(_e.byteLength<=jt)return{json:zt,resources:{}};const Ht=new Uint32Array(_e.buffer,_e.byteOffset+jt,2);if(Ht[1]!==Bt.BIN)throw new Error("Expected GLB BIN in second chunk.");const Wt=E.toView(_e,jt+8,Ht[0]);return{json:zt,resources:{[c]:Wt}}}}function Lt(kt){if(kt.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;const _e=new Uint32Array(kt.buffer,kt.byteOffset,3);return _e[0]===1179937895&&_e[1]===2}class _t extends Pt{constructor(_e=q$1.DEFAULT_INIT){super(),this.J=void 0,this.J=_e}async readURI(_e,Dt){const Vt=await fetch(_e,this.J);switch(Dt){case"view":return new Uint8Array(await Vt.arrayBuffer());case"text":return Vt.text()}}resolve(_e,Dt){return q$1.resolve(_e,Dt)}dirname(_e){return q$1.dirname(_e)}}function q(){return q=Object.assign?Object.assign.bind():function(kt){for(var _e=1;_e<arguments.length;_e++){var Dt=arguments[_e];for(var Vt in Dt)Object.prototype.hasOwnProperty.call(Dt,Vt)&&(kt[Vt]=Dt[Vt])}return kt},q.apply(this,arguments)}function B(kt,_e){return Object.defineProperty(_e,"name",{value:kt}),_e}function Z(kt,_e){if(kt==null&&_e==null)return!0;if(kt==null||_e==null||kt.length!==_e.length)return!1;for(let Dt=0;Dt<kt.length;Dt++)if(kt[Dt]!==_e[Dt])return!1;return!0}var ae=typeof Float32Array<"u"?Float32Array:Array;function ge(){var kt=new ae(3);return ae!=Float32Array&&(kt[0]=0,kt[1]=0,kt[2]=0),kt}function Ae(){var kt=new ae(4);return ae!=Float32Array&&(kt[0]=0,kt[1]=0,kt[2]=0,kt[3]=0),kt}Math.hypot||(Math.hypot=function(){for(var kt=0,_e=arguments.length;_e--;)kt+=arguments[_e]*arguments[_e];return Math.sqrt(kt)}),ge(),Ae();const Te="dedup",ye={propertyTypes:[h.ACCESSOR,h.MESH,h.TEXTURE,h.MATERIAL,h.SKIN]};function Ee(kt=ye){const _e=q({},ye,kt),Dt=new Set(_e.propertyTypes);for(const Vt of _e.propertyTypes)if(!ye.propertyTypes.includes(Vt))throw new Error(`${Te}: Unsupported deduplication on type "${Vt}".`);return B(Te,Vt=>{const Gt=Vt.getLogger();Dt.has(h.ACCESSOR)&&function(zt){const jt=zt.getLogger(),Ht=new Map,Wt=new Map,qt=new Map,Xt=new Map,Kt=zt.getRoot().listMeshes();Kt.forEach(rn=>{rn.listPrimitives().forEach(Qt=>{Qt.listAttributes().forEach(en=>Yt(en,Wt)),Yt(Qt.getIndices(),Ht)})});for(const rn of zt.getRoot().listAnimations())for(const Qt of rn.listSamplers())Yt(Qt.getInput(),qt),Yt(Qt.getOutput(),Xt);function Yt(rn,Qt){if(!rn)return;const en=[rn.getCount(),rn.getType(),rn.getComponentType(),rn.getNormalized(),rn.getSparse()].join(":");let tn=Qt.get(en);tn||Qt.set(en,tn=new Set),tn.add(rn)}function Zt(rn,Qt){for(let en=0;en<rn.length;en++){const tn=rn[en],sn=E.toView(tn.getArray());if(!Qt.has(tn))for(let cn=en+1;cn<rn.length;cn++){const un=rn[cn];Qt.has(un)||E.equals(sn,E.toView(un.getArray()))&&Qt.set(un,tn)}}}let Jt=0;const nn=new Map;for(const rn of[Wt,Ht,qt,Xt])for(const Qt of rn.values())Jt+=Qt.size,Zt(Array.from(Qt),nn);jt.debug(`${Te}: Merged ${nn.size} of ${Jt} accessors.`),Kt.forEach(rn=>{rn.listPrimitives().forEach(Qt=>{Qt.listAttributes().forEach(tn=>{nn.has(tn)&&Qt.swap(tn,nn.get(tn))});const en=Qt.getIndices();en&&nn.has(en)&&Qt.swap(en,nn.get(en))})});for(const rn of zt.getRoot().listAnimations())for(const Qt of rn.listSamplers()){const en=Qt.getInput(),tn=Qt.getOutput();en&&nn.has(en)&&Qt.swap(en,nn.get(en)),tn&&nn.has(tn)&&Qt.swap(tn,nn.get(tn))}Array.from(nn.keys()).forEach(rn=>rn.dispose())}(Vt),Dt.has(h.TEXTURE)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot(),Wt=Ht.listTextures(),qt=new Map;for(let Xt=0;Xt<Wt.length;Xt++){const Kt=Wt[Xt],Yt=Kt.getImage();if(!qt.has(Kt))for(let Zt=Xt+1;Zt<Wt.length;Zt++){const Jt=Wt[Zt],nn=Jt.getImage();if(qt.has(Jt)||Kt.getMimeType()!==Jt.getMimeType())continue;const rn=Kt.getSize(),Qt=Jt.getSize();rn&&Qt&&rn[0]===Qt[0]&&rn[1]===Qt[1]&&Yt&&nn&&E.equals(Yt,nn)&&qt.set(Jt,Kt)}}jt.debug(`${Te}: Merged ${qt.size} of ${Ht.listTextures().length} textures.`),Array.from(qt.entries()).forEach(([Xt,Kt])=>{Xt.listParents().forEach(Yt=>{Yt instanceof vt||Yt.swap(Xt,Kt)}),Xt.dispose()})}(Vt),Dt.has(h.MATERIAL)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot().listMaterials(),Wt=new Map,qt=new Set(["name"]),Xt=new Map;for(let Kt=0;Kt<Ht.length;Kt++){const Yt=Ht[Kt];if(!Wt.has(Yt)&&!Me(Yt,Xt))for(let Zt=Kt+1;Zt<Ht.length;Zt++){const Jt=Ht[Zt];Wt.has(Jt)||Me(Jt,Xt)||Yt.equals(Jt,qt)&&Wt.set(Jt,Yt)}}jt.debug(`${Te}: Merged ${Wt.size} of ${Ht.length} materials.`),Array.from(Wt.entries()).forEach(([Kt,Yt])=>{Kt.listParents().forEach(Zt=>{Zt instanceof vt||Zt.swap(Kt,Yt)}),Kt.dispose()})}(Vt),Dt.has(h.MESH)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot(),Wt=new Map;Ht.listAccessors().forEach((Kt,Yt)=>Wt.set(Kt,Yt)),Ht.listMaterials().forEach((Kt,Yt)=>Wt.set(Kt,Yt));const qt=Ht.listMeshes().length,Xt=new Map;for(const Kt of Ht.listMeshes()){const Yt=[];for(const Jt of Kt.listPrimitives())Yt.push(Se(Jt,Wt));const Zt=Yt.join(";");if(Xt.has(Zt)){const Jt=Xt.get(Zt);Kt.listParents().forEach(nn=>{nn.propertyType!==h.ROOT&&nn.swap(Kt,Jt)}),Kt.dispose()}else Xt.set(Zt,Kt)}jt.debug(`${Te}: Merged ${qt-Xt.size} of ${qt} meshes.`)}(Vt),Dt.has(h.SKIN)&&function(zt){const jt=zt.getLogger(),Ht=zt.getRoot().listSkins(),Wt=new Map,qt=new Set(["name","joints"]);for(let Xt=0;Xt<Ht.length;Xt++){const Kt=Ht[Xt];if(!Wt.has(Kt))for(let Yt=Xt+1;Yt<Ht.length;Yt++){const Zt=Ht[Yt];Wt.has(Zt)||Kt.equals(Zt,qt)&&Z(Kt.listJoints(),Zt.listJoints())&&Wt.set(Zt,Kt)}}jt.debug(`${Te}: Merged ${Wt.size} of ${Ht.length} skins.`),Array.from(Wt.entries()).forEach(([Xt,Kt])=>{Xt.listParents().forEach(Yt=>{Yt instanceof vt||Yt.swap(Xt,Kt)}),Xt.dispose()})}(Vt),Gt.debug(`${Te}: Complete.`)})}function Se(kt,_e){const Dt=[];for(const Vt of kt.listSemantics()){const Gt=kt.getAttribute(Vt);Dt.push(Vt+":"+_e.get(Gt))}if(kt instanceof dt){const Vt=kt.getIndices();Vt&&Dt.push("indices:"+_e.get(Vt));const Gt=kt.getMaterial();Gt&&Dt.push("material:"+_e.get(Gt)),Dt.push("mode:"+kt.getMode());for(const zt of kt.listTargets())Dt.push("target:"+Se(zt,_e))}return Dt.join(",")}function Me(kt,_e){if(_e.has(kt))return _e.get(kt);const Dt=kt.getGraph(),Vt=new Set,Gt=Dt.listParentEdges(kt);for(;Gt.length>0;){const zt=Gt.pop();if(zt.getAttributes().modifyChild===!0)return _e.set(kt,!0),!0;const jt=zt.getChild();if(!Vt.has(jt))for(const Ht of Dt.listChildEdges(jt))Gt.push(Ht)}return _e.set(kt,!1),!1}function we(kt){const _e=kt.getGraph(),Dt=new Set,Vt=new Set;return function Gt(zt){const jt=new Set;for(const Ht of _e.listChildEdges(zt))Ht.getChild()instanceof yt&&jt.add(Ht.getName()+"Info");for(const Ht of _e.listChildEdges(zt)){const Wt=Ht.getChild();Dt.has(Wt)||(Dt.add(Wt),Wt instanceof it&&jt.has(Ht.getName())?Vt.add(Wt):Wt instanceof nt&&Gt(Wt))}}(kt),Array.from(Vt)}const be="prune",Ne={propertyTypes:[h.NODE,h.SKIN,h.MESH,h.CAMERA,h.PRIMITIVE,h.PRIMITIVE_TARGET,h.ANIMATION,h.MATERIAL,h.TEXTURE,h.ACCESSOR,h.BUFFER],keepLeaves:!1,keepAttributes:!0};function Re(kt=Ne){const _e=q({},Ne,kt),Dt=new Set(_e.propertyTypes);return B(be,Vt=>{const Gt=Vt.getLogger(),zt=Vt.getRoot(),jt=Vt.getGraph(),Ht={};if(Dt.has(h.MESH))for(const Yt of zt.listMeshes())Yt.listPrimitives().length>0||(Yt.dispose(),Kt(Yt));if(Dt.has(h.NODE)&&!_e.keepLeaves&&zt.listScenes().forEach(function Yt(Zt){if(Zt.listChildren().forEach(Yt),Zt instanceof mt)return;const Jt=jt.listParentEdges(Zt).some(nn=>{const rn=nn.getParent().propertyType;return rn!==h.ROOT&&rn!==h.SCENE&&rn!==h.NODE});jt.listChildren(Zt).length!==0||Jt||(Zt.dispose(),Kt(Zt))}),Dt.has(h.NODE)&&zt.listNodes().forEach(Wt),Dt.has(h.SKIN)&&zt.listSkins().forEach(Wt),Dt.has(h.MESH)&&zt.listMeshes().forEach(Wt),Dt.has(h.CAMERA)&&zt.listCameras().forEach(Wt),Dt.has(h.PRIMITIVE)&&qt(jt,h.PRIMITIVE),Dt.has(h.PRIMITIVE_TARGET)&&qt(jt,h.PRIMITIVE_TARGET),!_e.keepAttributes&&Dt.has(h.ACCESSOR)){const Yt=new Map;for(const Zt of zt.listMeshes())for(const Jt of Zt.listPrimitives()){const nn=Jt.getMaterial(),rn=Ce(Jt,Oe(Vt,nn));Xt(Jt,rn),Jt.listTargets().forEach(Qt=>Xt(Qt,rn)),nn&&(Yt.has(nn)?Yt.get(nn).add(Jt):Yt.set(nn,new Set([Jt])))}for(const[Zt,Jt]of Yt)$e(Zt,Array.from(Jt))}if(Dt.has(h.ANIMATION))for(const Yt of zt.listAnimations()){for(const Zt of Yt.listChannels())Zt.getTargetNode()||(Zt.dispose(),Kt(Zt));if(Yt.listChannels().length)Yt.listSamplers().forEach(Wt);else{const Zt=Yt.listSamplers();Wt(Yt),Zt.forEach(Wt)}}if(Dt.has(h.MATERIAL)&&zt.listMaterials().forEach(Wt),Dt.has(h.TEXTURE)&&zt.listTextures().forEach(Wt),Dt.has(h.ACCESSOR)&&zt.listAccessors().forEach(Wt),Dt.has(h.BUFFER)&&zt.listBuffers().forEach(Wt),Object.keys(Ht).length){const Yt=Object.keys(Ht).map(Zt=>`${Zt} (${Ht[Zt]})`).join(", ");Gt.info(`${be}: Removed types... ${Yt}`)}else Gt.info(`${be}: No unused properties found.`);function Wt(Yt){Yt.listParents().filter(Zt=>!(Zt instanceof vt||Zt instanceof tt)).length||(Yt.dispose(),Kt(Yt))}function qt(Yt,Zt){Yt.listEdges().map(Jt=>Jt.getParent()).filter(Jt=>Jt.propertyType===Zt).forEach(Wt)}function Xt(Yt,Zt){for(const Jt of Zt)Yt.setAttribute(Jt,null)}function Kt(Yt){Ht[Yt.propertyType]=Ht[Yt.propertyType]||0,Ht[Yt.propertyType]++}Gt.debug(`${be}: Complete.`)})}function Ce(kt,_e){const Dt=[];for(const Vt of kt.listSemantics())Vt!=="TANGENT"||_e.has(Vt)?(Vt.startsWith("TEXCOORD_")&&!_e.has(Vt)||Vt.startsWith("COLOR_")&&Vt!=="COLOR_0")&&Dt.push(Vt):Dt.push(Vt);return Dt}function Oe(kt,_e,Dt=new Set){if(!_e)return Dt;const Vt=kt.getGraph().listChildEdges(_e),Gt=new Set;for(const zt of Vt)zt.getChild()instanceof yt&&Gt.add(zt.getName());for(const zt of Vt){const jt=zt.getName(),Ht=zt.getChild();Ht instanceof it&&Gt.has(jt.replace(/Info$/,""))&&Dt.add(`TEXCOORD_${Ht.getTexCoord()}`),Ht instanceof yt&&jt.match(/normalTexture/i)&&Dt.add("TANGENT"),Ht instanceof nt&&Oe(kt,Ht,Dt)}return Dt}function $e(kt,_e){const Dt=we(kt),Vt=new Set(Dt.map(Wt=>Wt.getTexCoord())),Gt=Array.from(Vt).sort(),zt=new Map(Gt.map((Wt,qt)=>[Wt,qt])),jt=new Map(Gt.map((Wt,qt)=>[`TEXCOORD_${Wt}`,`TEXCOORD_${qt}`]));for(const Wt of Dt){const qt=Wt.getTexCoord();Wt.setTexCoord(zt.get(qt))}for(const Wt of _e){const qt=Wt.listSemantics().filter(Xt=>Xt.startsWith("TEXCOORD_")).sort();Ht(Wt,qt),Wt.listTargets().forEach(Xt=>Ht(Xt,qt))}function Ht(Wt,qt){for(const Xt of qt){const Kt=Wt.getAttribute(Xt);if(!Kt)continue;const Yt=jt.get(Xt);Yt!==Xt&&(Wt.setAttribute(Yt,Kt),Wt.setAttribute(Xt,null))}}}tt.TargetPath;var Vn;function Xn(kt,_e,Dt){for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++)Dt[Vt]=kt[_e*Gt+Vt];return Dt}function Kn(kt,_e,Dt){for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++)kt[_e*Gt+Vt]=Dt[Vt]}function Jn(kt,_e,Dt=0){if(kt.length!==_e.length)return!1;for(let Vt=0;Vt<kt.length;Vt++)if(Math.abs(kt[Vt]-_e[Vt])>Dt)return!1;return!0}function Zn(kt,_e,Dt){return kt*(1-Dt)+_e*Dt}function Qn(kt,_e,Dt,Vt){for(let Gt=0;Gt<_e.length;Gt++)kt[Gt]=Zn(_e[Gt],Dt[Gt],Vt);return kt}function Yn(kt,_e,Dt,Vt){let Gt,zt,jt,Ht,Wt,qt=_e[0],Xt=_e[1],Kt=_e[2],Yt=_e[3],Zt=Dt[0],Jt=Dt[1],nn=Dt[2],rn=Dt[3];return zt=qt*Zt+Xt*Jt+Kt*nn+Yt*rn,zt<0&&(zt=-zt,Zt=-Zt,Jt=-Jt,nn=-nn,rn=-rn),1-zt>1e-6?(Gt=Math.acos(zt),jt=Math.sin(Gt),Ht=Math.sin((1-Vt)*Gt)/jt,Wt=Math.sin(Vt*Gt)/jt):(Ht=1-Vt,Wt=Vt),kt[0]=Ht*qt+Wt*Zt,kt[1]=Ht*Xt+Wt*Jt,kt[2]=Ht*Kt+Wt*nn,kt[3]=Ht*Yt+Wt*rn,kt}function eo(kt,_e){const Dt=function(Vt,Gt){return Vt[0]*Gt[0]+Vt[1]*Gt[1]+Vt[2]*Gt[2]+Vt[3]*Gt[3]}(kt,_e);return Math.acos(2*Dt*Dt-1)}(function(kt){kt[kt.STEP=0]="STEP",kt[kt.LERP=1]="LERP",kt[kt.SLERP=2]="SLERP"})(Vn||(Vn={}));Promise.resolve();var yo;(function(kt){kt.LANCZOS3="lanczos3",kt.LANCZOS2="lanczos2"})(yo||(yo={}));yo.LANCZOS3;yo.LANCZOS3;async function getCurrentScene(kt){return kt.coreSceneStore.getState().sceneRef}function calculateSceneCenter(kt){const _e=new Box3().setFromObject(kt),Dt=new Vector3;return _e.getCenter(Dt),Dt.y=_e.min.y,Dt}function getItemsGroupFromScene(kt){return kt.getObjectByName("#ITEMS")}function filterOnlyItems(kt){return getItemsGroupFromScene(kt).children}async function getSceneAsUsdzUrl(kt){kt.coreSceneStore.setState({frameLoop:"never"}),await wait(1e3);try{const _e=new USDZExporter,Dt=await getCurrentScene(kt),Vt=calculateSceneCenter(Dt);Dt.position.sub(Vt);const Gt=Dt.rotation.clone(),zt=kt.coreSceneStore.getState().sceneSettings.arTransforms.rotation;Dt.rotation.set(MathUtils.degToRad(zt[0]),MathUtils.degToRad(zt[1]),MathUtils.degToRad(zt[2])),Dt.updateMatrixWorld();const jt=kt.coreSceneStore.getState().sceneSettings.usdzPrecision,Ht=kt.coreSceneStore.getState().sceneSettings.usdzMaxTextureSize,Wt=await _e.parseAsync(Dt,jt,Ht),qt=new Blob([Wt],{type:"model/vnd.usdz+zip"}),Xt=URL.createObjectURL(qt);return Dt.position.add(Vt),Dt.rotation.set(Gt.x,Gt.y,Gt.z),kt.coreSceneStore.setState({frameLoop:"always"}),Xt}catch(_e){return LOGGER$1.error("Error exporting USDZ: "+_e),kt.coreSceneStore.setState({frameLoop:"always"}),null}}async function getSceneAsGLBUrl(kt){kt.coreSceneStore.setState({frameLoop:"never"}),await wait(1e3);try{const _e=new _t,Dt=new GLTFExporter,Vt=await getCurrentScene(kt),Gt=filterOnlyItems(Vt),zt=calculateSceneCenter(Vt);for(const Yt of Gt)Yt.position.sub(zt);const jt={binary:!0,forceIndices:!0,trs:!1,onlyVisible:!0,embedImages:!0,maxTextureSize:1024},Ht=await Dt.parseAsync(Gt,jt),Wt=await _e.readBinary(new Uint8Array(Ht));for(const Yt of Gt)Yt.position.add(zt);const qt=await optimiseGlb(Wt),Xt=await _e.writeBinary(qt),Kt=await saveArrayBufferAsURL(Xt);return kt.coreSceneStore.setState({frameLoop:"always"}),Kt}catch(_e){return LOGGER$1.error({title:"Error exporting GLB: "+_e}),kt.coreSceneStore.setState({frameLoop:"always"}),null}}async function optimiseGlb(kt){const Dt=kt.getRoot().listNodes();for(const Vt of Dt){Vt.setExtras({});const Gt=Vt.getName();(Gt==="GRP_ProxyMesh"||Gt==="GRP_LoadingPlaceholder")&&Vt.dispose()}return await kt.transform(Ee(),Re()),LOGGER$1.info({title:"GLB as json"}),LOGGER$1.info({title:kt.getRoot().listTextures()}),kt}async function saveArrayBufferAsURL(kt){const _e=new Blob([kt],{type:"application/gltf-buffer"});return LOGGER$1.info({title:"Approx scene GLB size: "+_e.size/1e6}),URL.createObjectURL(_e)}const byteToHex=[];for(let kt=0;kt<256;++kt)byteToHex.push((kt+256).toString(16).slice(1));function unsafeStringify(kt,_e=0){return(byteToHex[kt[_e+0]]+byteToHex[kt[_e+1]]+byteToHex[kt[_e+2]]+byteToHex[kt[_e+3]]+"-"+byteToHex[kt[_e+4]]+byteToHex[kt[_e+5]]+"-"+byteToHex[kt[_e+6]]+byteToHex[kt[_e+7]]+"-"+byteToHex[kt[_e+8]]+byteToHex[kt[_e+9]]+"-"+byteToHex[kt[_e+10]]+byteToHex[kt[_e+11]]+byteToHex[kt[_e+12]]+byteToHex[kt[_e+13]]+byteToHex[kt[_e+14]]+byteToHex[kt[_e+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(kt,_e,Dt){if(native.randomUUID&&!_e&&!kt)return native.randomUUID();kt=kt||{};const Vt=kt.random??kt.rng?.()??rng();if(Vt.length<16)throw new Error("Random bytes length must be >= 16");if(Vt[6]=Vt[6]&15|64,Vt[8]=Vt[8]&63|128,_e){if(Dt=Dt||0,Dt<0||Dt+16>_e.length)throw new RangeError(`UUID byte range ${Dt}:${Dt+15} is out of buffer bounds`);for(let Gt=0;Gt<16;++Gt)_e[Dt+Gt]=Vt[Gt];return _e}return unsafeStringify(Vt)}class Plug{position=new Vector3;constructor(_e,Dt,Vt=null){this.stores=Dt.stores,this._attachedPlug=null,this._name=_e.name,this._acceptedPlugTypes=_e.acceptedPlugTypes,this._affectedNodes=_e.affectedNodes,this._unvisualizedCount=_e.unvisualizedCount,this._weight=_e.weight,this._connectsToPlugTypes=_e.connectsToPlugTypes,this._dependencySku=_e.dependencySku,this._isDependencySkuInteractive=_e.isDependencySkuInteractive,this._autoSpawnDependencyIfMissing=_e.autoSpawnDependencyIfMissing,this._node=Dt,Vt?(this._comboPlugConnector=Vt.comboPlugConnector,this._guid=Vt.guid,this._isOpen=Vt.isOpen,this._type=Vt.type,this._isReceiverPlug=Vt.isReceiverPlug,this._attachedPlugGUID=Vt.attachedPlugGUID):(this._comboPlugConnector=!1,this._guid=v4(),this._isOpen=!0,this._type=_e.type,this._isReceiverPlug=!1,this._attachedPlugGUID=null)}export(){return this.isOpen?null:{guid:this._guid,type:this._type,isOpen:this._isOpen,comboPlugConnector:this._comboPlugConnector,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}get plug3dObject(){if(this._node.ref)return this._node.ref.getObjectByName(""+this.name)}get absoluteWorldPosition(){return this.plug3dObject?(this.plug3dObject.getWorldPosition(this.position),this.position):null}set comboPlugConnector(_e){this._comboPlugConnector=_e}get comboPlugConnector(){return this._comboPlugConnector}get attachedPlug(){return this._attachedPlug}set attachedPlug(_e){this._attachedPlug=_e}get attachedNode(){return this._attachedPlug?this._attachedPlug.node:null}get attachedPlugGUID(){return this._attachedPlugGUID}set type(_e){this._type=_e}get type(){return this._type}get weight(){return this._weight}get unvisualizedCount(){return this.__unvisualizedCount}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(_e){this._acceptedPlugTypes=_e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(_e){this._connectsToPlugTypes=_e}get isOpen(){return this._isOpen}get isOccupied(){return!this.isOpen}get dependencySku(){return this._dependencySku}get isDependencySkuInteractive(){return this._isDependencySkuInteractive}attachPlug(_e,Dt=!1){this._attachedPlug=_e,this._attachedPlugGUID=_e.guid,this._isOpen=!1,this._isReceiverPlug=Dt;const Vt=this,Gt=this._node;if(Gt.isConnectedToRoot&&Dt){const zt=Gt.whichPlugAreWeAttachedUsing();switch(_e.type){case"weighted_hider":zt.weight<Vt.weight&&(Gt.showNodes(zt.affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Gt.guid+":modelLoaded",function(){Gt.showNodes(zt.affectedNodes)},{once:!0}));break}}if(Dt&&_e.type!==""&&_e.type==Vt._type)switch(_e.type){default:case"weighted_hider":Vt._weight>_e.weight?_e.node.hideNodes(_e.affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.node.guid+":modelLoaded",function(){_e.node.hideNodes(_e.affectedNodes)},{once:!0}):Vt._weight<_e.weight&&(Gt.hideNodes(Vt._affectedNodes)||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Gt.guid+":modelLoaded",function(){Gt.hideNodes(Vt._affectedNodes)},{once:!0}));break}Dt&&(Gt.isEndNode=!1)}async openPlug(){if(this._comboPlugConnector&&(this._comboPlugConnector=!1),this._node.isConnectedToRoot){const _e=this._node.whichPlugAreWeAttachedUsing();if(_e&&this._guid!==_e.guid)switch(this.type){case"weighted_hider":_e.type==="weighted_hider"&&_e.weight<this.weight&&this._node.hideNodes(_e.affectedNodes);break}}if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}if(this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode()),!!this._dependencySku&&!(this._autoSpawnDependencyIfMissing==!1||this._isDependencySkuInteractive||this.stores.coreSceneStore.getState().configurationLoaded===!1))try{const _e=await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(this._dependencySku,!0);if(!_e)return;const Dt=_e.connectablePlugs;let Vt=!1;const Gt=this._isDependencySkuInteractive?this.isDependencySkuInteractive===1:!1;for(const zt of Dt){if(zt.receiverPlug.guid!==this._guid)continue;Vt=!0;const jt=await this.stores.itemStore.getState().actions.addItemBySkuID(this._dependencySku,Dt.indexOf(zt),!0,Gt);jt!==null&&this._node.addMyDependenciesGUID(jt)}Vt||await this.stores.ghostStore.getState().actions.clearAllGhosts()}catch{LOGGER$1.info({title:"The Plug has been removed!"})}}canAttachToPlug(_e){for(let Dt=0;Dt<this._connectsToPlugTypes.length;Dt++)if(_e._acceptedPlugTypes.includes(this._connectsToPlugTypes[Dt]))return!0;return!1}distanceToPlug(_e){return this.absoluteWorldPosition===null?null:this.absoluteWorldPosition.distanceTo(_e.absoluteWorldPosition)}distanceToPlugSquared(_e){return this.absoluteWorldPosition===null?null:this.absoluteWorldPosition.distanceToSquared(_e.absoluteWorldPosition)}}let Node$1=class{#t="default";#i=!1;#n=!1;#s=!0;#r={};#c=!1;#o=[];constructor(_e,Dt,Vt=null,Gt,zt){this.stores=_e;let jt=_e.productDataStore.getState().productData;this._plugs=[],this._skuID=Dt,this._ref=null,this._dragging=!1,this._modelFunctions=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=jt[Dt].followsParent,this._categoryID=jt[Dt].categoryID,this._replace=jt[Dt].replace,this._swappable=jt[Dt].swappable,this._price=this.#l(),this._compareAtPrice=this.#a(),this.#i=jt[Dt]?.ignoreInCart,Vt?(this._guid=Vt.guid,this._isEndNode=Vt.isEndNode,this._overrideVariant=Vt.overrideVariant,this.generatePlugsWithData(Dt,Vt.plugs)):(this._guid=v4(),this._isEndNode=!0,this.generatePlugsForNode(Dt)),Gt&&Object.keys(Gt).map(Ht=>{if(jt[Dt].looks&&jt[Dt].looks.includes(Ht)){this.#t=Ht;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Xt=>{Xt.id==_e&&(zt=Xt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;jt.map(Xt=>{Xt.products.map(Kt=>{this.skuID===Kt&&Xt.products.map(Yt=>{Wt.map(Zt=>{if(Zt==Yt){const Jt=this.stores.productDataStore.getState().actions.getProductDataById(Zt);this.skuID=Jt.skuID;const nn=qt[this.guid];nn&&nn.itemData&&Object.keys(Jt).map(rn=>{nn.itemData[rn]=Jt[rn]}),this.hideNodes(Jt.geometriesToHide),this.showNodes(Jt.geometriesToShow),this.updatePricing(),this.resetInStock(),this.stores.inventoryStore.getState().actions.refreshInventory(qt)}})})})})}resetInStock(){this.#r={},this.#c=!0}setInStockForRef(_e){if(!this.ref)return!1;let Dt=this.ref.getObjectByName("GRP_RenderGeometry");return Dt?(Dt.inStock=_e,!0):!1}set inStock({variantName:_e,newValue:Dt}){if(this.#r[_e]&&this.#r[_e]==Dt||(this.#r[_e]=Dt,_e!==this.currentVariant&&this.#c===!1))return;const Vt=()=>{this.setInStockForRef(Dt)};Vt()||this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",Vt,{once:!0})}get myDependenciesGUID(){return this.#o}set myDependenciesGUID(_e){this.#o=_e}get dragging(){return this._dragging}set dragging(_e){this._dragging=_e}addMyDependenciesGUID(_e){this.#o.push(_e)}get isDependent(){return this.#n}set isDependent(_e){this.#n=_e}get isInteractive(){return this.#s}set isInteractive(_e){this.#s=_e}update(_e){this._skuID=_e;const Dt=this.stores.productDataStore.getState().productData,Vt=Dt[_e]?.plugs;if(this.ignoreInCart=Dt[_e].ignoreInCart,!!Vt)for(let Gt=0;Gt<this._plugs.length;Gt++)for(let zt=0;zt<Vt.length;zt++)this._plugs[Gt].name==Vt[zt].name&&(this._plugs[Gt].acceptedPlugTypes=Vt[zt].acceptedPlugTypes,this._plugs[Gt].connectsToPlugTypes=Vt[zt].connectsToPlugTypes)}export(){let _e={};for(let Dt=0;Dt<this._plugs.length;Dt++){let Vt=this._plugs[Dt].export();Vt&&(_e[this._plugs[Dt].name]=Vt)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:_e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#i}set ignoreInCart(_e){this.#i=_e}get isTypeCombo(){const _e=this.whichPlugAreWeAttachedUsing();return _e?_e.type=="comboPlug"&&_e.connectsToPlugTypes.length>0:!1}get canRotate(){let _e=!0;if(this.isTypeCombo)return!1;if(!this._isEndNode){const Vt=this.whichNodesAreAttachedToUs();if(Vt.length>0){let Gt=!0;if(Vt.map(zt=>{zt.followsParent===!1&&(Gt=!1)}),!Gt)return!1}}let Dt=!1;for(let Vt=0;Vt<this.plugs.length;Vt++)if(!this.plugs[Vt].isOpen&&this.plugs[Vt].attachedPlug.isReceiverPlug){const Gt=this.plugs[Vt].attachedPlug.acceptedPlugTypes;for(let zt=0;zt<this.plugs.length;zt++)if(Vt!=zt)for(let jt=0;jt<this.plugs[zt].connectsToPlugTypes.length;jt++)Gt.includes(this.plugs[zt].connectsToPlugTypes[jt])&&(Dt=!0)}if(_e=Dt,_e){const Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure;_e=Vt&&Vt.hasValidAlternateRotation(this.guid)}return _e}hideNodes(_e){if(!this.ref)return!1;const Dt=this.ref.getObjectByName("GRP_RenderGeometry"),Vt=this.ref.getObjectByName("GRP_ProxyMesh");return _e.map(Gt=>{if(Dt){const zt=Dt.getObjectByName(Gt);zt&&(zt.visible=!1)}if(Vt){const zt=Vt.getObjectByName(Gt);zt&&(zt.visible=!1)}}),!0}showNodes(_e){if(!this.ref)return!1;const Dt=this.ref.getObjectByName("GRP_RenderGeometry"),Vt=this.ref.getObjectByName("GRP_ProxyMesh");return _e.map(Gt=>{if(Dt){const zt=Dt.getObjectByName(Gt);zt&&(zt.visible=!0)}if(Vt){const zt=Vt.getObjectByName(Gt);zt&&(zt.visible=!0)}}),!0}canConnectToPlugType(_e){let Dt=!1;return this._plugs.map(Vt=>{Vt.connectsToPlugTypes.map(Gt=>{Gt==_e&&(Dt=!0)})}),Dt}isConnectedToSkuID(_e){let Dt=!1;return this._plugs.map(Vt=>{if(Vt.isOpen||Dt===!0)return;let Gt=Vt.attachedPlug;!Gt&&Vt.attachedPlugGUID&&(Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getPlugByGUID(Vt.attachedPlugGUID)),Gt.node.skuID==_e&&(Dt=!0)}),Dt}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const Dt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Vt=this.whichNodesAreAttachedToUs();let Gt=null;Vt.map(qt=>{qt.followsParent===!1&&(Gt=qt)});const zt=Gt.detachNodeFromReceiver();let jt=null;this._plugs.map(qt=>{qt.isOpen||qt.attachedPlug.node.skuID=="Root"&&(jt=qt.attachedPlug)});const Ht=this.detachNodeFromReceiver();let Wt=null;return Gt.plugs.map(qt=>{qt.connectsToPlugTypes.includes("root")&&(Wt=qt)}),Dt.connectPlugs({incomingPlug:Wt,receiverPlug:jt}),{neighborDetachedPlugs:zt,rootDetachedPlugs:Ht,neighborNode:Gt}}get canSwapRoot(){if(this.stores.coreSceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let _e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const Vt=this.whichNodesAreAttachedToUs();let Gt=0,zt=null;Vt.map(jt=>{jt.followsParent===!1&&(Gt++,zt=jt)}),Gt==1?zt.canConnectToPlugType("root")&&(_e=!0):Gt>0&&(_e=!1)}return _e}get canRemove(){let _e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(Vt=>{Vt.followsParent===!1&&(_e=!1)}),_e||(_e=this.canSwapRoot)),_e}getComboPlugNodesAttachedToUs(){let _e=[];return this.whichNodesAreAttachedToUs().forEach(Vt=>{Vt.isTypeCombo&&_e.push(Vt);const Gt=Vt.getComboPlugNodesAttachedToUs();Gt.length>0&&(_e=_e.concat(Gt))}),_e}getAllBranchedNodesAttachedToUs(){let _e=[];const Dt=this.whichNodesAreAttachedToUs();for(let Vt=0;Vt<Dt.length;Vt++){_e.push(Dt[Vt]);const Gt=Dt[Vt].getAllBranchedNodesAttachedToUs();Gt.length>0&&(_e=_e.concat(Gt))}return _e}getNonInteractiveBranchedNodesIncludingSelf(){const _e=[],Dt=(Vt,Gt=!1)=>{const zt=Vt.isInteractive;if(!Gt&&zt)return;zt||_e.push(Vt),Vt.whichNodesAreAttachedToUs().forEach(Ht=>{Dt(Ht,!1)})};return Dt(this,!0),_e}get canDrag(){let _e=!0;if(this.stores.coreSceneStore.getState().dragging||this.isTypeCombo)return!1;for(let Vt=0;Vt<this._plugs.length;Vt++)if(this._plugs[Vt].isOpen==!1&&this._plugs[Vt].attachedPlug.type=="comboPlug")return!1;const Dt=this.getComboPlugNodesAttachedToUs();if(Dt.length>0){const Vt=this.getAllBranchedNodesAttachedToUs();let Gt=!0;if(Dt.map(zt=>{const jt=zt.whichNodesIsThisComboPlugAttachedTo();let Ht=!0;if(jt.map(Wt=>{let qt=!1;if(Vt.map(Xt=>{Wt.guid===Xt.guid&&(qt=!0)}),qt==!1){Ht=!1;return}}),Ht==!1){Gt=!1;return}}),Gt==!1)return!1}return this._isEndNode||(this.whichNodesAreAttachedToUs().map(Gt=>{Gt.followsParent===!1&&(_e=!1)}),_e||(_e=this.canSwapRoot)),_e}get followsParent(){return this._followsParent}set followsParent(_e){this._followsParent=_e}resetFollowsParent(){const _e=this.stores.productDataStore.getState().productData;this._followsParent=_e[this.skuID].followsParent}get currentVariant(){return this.#t==="default"?this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(_e){this._price=_e}get compareAtPrice(){return this._compareAtPrice}set compareAtPrice(_e){this._compareAtPrice=_e}updateCompareAtPricing(){this._compareAtPrice=this.#a()}updatePricing(){this._price=this.#l()}#a(){let Dt=this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.compareAtPrice;return Dt||(Dt=0),Dt}#l(){let Dt=this.stores.productDataStore.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return Dt||(Dt=0),Dt}set currentVariant(_e){this.#t=_e,this._price=this.#l(),this._compareAtPrice=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(_e){this._overrideVariant=_e,this.#t=this._overrideVariant,this._price=this.#l(),this._compareAtPrice=this.#a()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(_e){this._skuID=_e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(_e){this._ref=_e}get modelFunctions(){return this._modelFunctions}set modelFunctions(_e){this._modelFunctions=_e}checkGeometryVariant(){let _e=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const Dt=this.stores.attachmentStore.getState().attachmentSystem;Dt.globalGeometryVariants&&Object.keys(Dt.globalGeometryVariants).map(Vt=>{this.updateGeometryVariant(Vt,Dt.globalGeometryVariants[Vt])}),_e.data={},this.stores.coreSceneStore.getState().CORE_API.coreWCRef?this.stores.coreSceneStore.getState().CORE_API.coreWCRef.dispatchEvent(_e):LOGGER$1.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(_e){this._isEndNode=_e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(_e){this._transform=_e}setModelVisibility(_e){_e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let _e=!0;for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&(_e=!1);this.isEndNode=_e}whichNodesAreAttachedToUs(){const _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&_e.push(this._plugs[Dt].attachedPlug.node);return _e}whichPlugsAreAttachedToUs(){const _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isReceiverPlug&&_e.push({receiverPlug:this._plugs[Dt],incomingPlug:this._plugs[Dt].attachedPlug});return _e}whichNodeAreWeAttachedTo(){let _e=null;for(const Dt of this._plugs)Dt?.attachedPlug?.isReceiverPlug&&(_e=Dt.attachedPlug.node);return _e}whichNodesIsThisComboPlugAttachedTo(){if(!this.isTypeCombo)return[];let _e=[];for(const Dt of this._plugs)Dt?.attachedPlug?.isReceiverPlug&&_e.push(Dt.attachedPlug.node);return _e}isReplaceableWithSkuIdOld(_e){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;let Gt=0;if(!Vt)return!1;for(let zt=0;zt<this._plugs.length;zt++)for(let jt=0;jt<Vt.length;jt++)this._plugs[zt].name==Vt[jt].name&&Gt++;return Gt==this._plugs.length}isReplaceableWithSkuId(_e){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;if(!Vt)return LOGGER$1.warn({title:`The new sku ${_e} is invalid for this experience to replace this node: `,details:this}),!1;let Gt=!1,zt=!0;const jt=this.whichPlugAreWeAttachedTo();for(const Wt of Vt)if(Gt=hasCommonElement(jt.acceptedPlugTypes,Wt.connectsToPlugTypes),Gt===!0)break;const Ht=this.whichPlugsAreAttachedToUs();for(const Wt of Ht)for(const qt of Vt)if(zt=hasCommonElement(qt.acceptedPlugTypes,Wt.connectsToPlugTypes),zt===!1)break;return Gt&&zt}getAllSkusThatCanReplaceMe(){let _e=[];const Dt=this.stores.productDataStore.getState().productData;return Object.keys(Dt).map(Vt=>{Vt!=this.skuID&&this.isReplaceableWithSkuId(Vt)&&_e.push(Vt)}),_e}whichPlugAreWeAttachedUsing(){for(let _e=0;_e<this._plugs.length;_e++){const Dt=this._plugs[_e];let Vt=Dt.attachedPlug;if(!Vt&&Dt.attachedPlugGUID&&(Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getPlugByGUID(Dt.attachedPlugGUID)),!Dt.isOpen&&Vt.isReceiverPlug)return Dt}}whichPlugAreWeAttachedTo(){for(let _e=0;_e<this._plugs.length;_e++)if(!this._plugs[_e].isOpen&&this._plugs[_e].attachedPlug.isReceiverPlug)return this._plugs[_e].attachedPlug}getPlugWhichCanConnectToType(_e){for(const Dt of this._plugs)if(Dt.connectsToPlugTypes.includes(_e))return Dt;return null}getOpenPlugsWeCanAttachFrom(){let _e=[];if(this.whichNodeAreWeAttachedTo())return _e;for(let Dt=0;Dt<this._plugs.length;Dt++)this.plugs[Dt].isOpen&&this.plugs[Dt].connectsToPlugTypes.length>0&&_e.push(this._plugs[Dt]);return _e}getOpenPlugsFromNode(){let _e=[];for(let Dt=0;Dt<this._plugs.length;Dt++)this._plugs[Dt].isOpen&&this._plugs[Dt].acceptedPlugTypes.length>0&&_e.push(this._plugs[Dt]);return _e}generatePlugsForNode(_e){this._plugs=[];let Dt=this.stores.productDataStore.getState().productData[_e]?.plugs;if(Dt)for(let Vt=0;Vt<Dt.length;Vt++)if(Dt[Vt].type==="unvisualizedPlug"){const Gt=Dt[Vt]?.unvisualizedCount>=0?Dt[Vt].unvisualizedCount:1e3;for(let zt=0;zt<Gt;zt++){const jt=new Plug({...Dt[Vt],name:`${Dt[Vt].name}_${zt}`},this);this._plugs.push(jt)}}else{const Gt=new Plug(Dt[Vt],this);this._plugs.push(Gt)}}generatePlugsWithData(_e,Dt){const Vt=this.stores.productDataStore.getState().productData[_e]?.plugs;Vt&&Vt.forEach(Gt=>{if(Gt.type==="unvisualizedPlug"){const zt=Gt.unvisualizedCount&&Gt.unvisualizedCount>=0?Gt.unvisualizedCount:1e3;for(let jt=0;jt<zt;jt++){const Ht=new Plug({...Gt,name:`${Gt.name}_${jt}`},this,Dt[`${Gt.name}_${jt}`]);this._plugs.push(Ht)}}else{const zt=new Plug(Gt,this,Dt[Gt.name]);this._plugs.push(zt)}})}detachNodeFromReceiver(){for(let _e=0;_e<this.plugs.length;_e++)if(!this.plugs[_e].isOpen&&this.plugs[_e].attachedPlug.isReceiverPlug){const Dt={incomingPlug:this.plugs[_e],receiverPlug:this.plugs[_e].attachedPlug};return this.plugs[_e].attachedPlug.openPlug(),this.plugs[_e].openPlug(),Dt}}detachNodeCompletely(){for(let _e=0;_e<this._plugs.length;_e++)this._plugs[_e].isOpen||(this._plugs[_e].attachedPlug.openPlug(),this._plugs[_e].openPlug())}getPlugByName(_e){for(let Dt=0;Dt<this._plugs.length;Dt++)if(this._plugs[Dt].name==_e)return this._plugs[Dt];return null}getPlugByGUID(_e){for(let Dt=0;Dt<this._plugs.length;Dt++)if(this._plugs[Dt].guid==_e)return this._plugs[Dt];return null}async removeNode(){const _e=[];for(const Dt of this._plugs)if(!Dt.isOpen){if(Dt.type==="comboPlug"&&Dt.connectsToPlugTypes.length>0){Dt.attachedPlug.openPlug();continue}Dt.attachedPlug.isReceiverPlug?Dt.attachedPlug.openPlug():_e.push(Dt.attachedPlug.node.guid)}if(_e.length>0)for(const Dt of _e)this.stores.itemStore.getState().actions.addToRemoveItems(Dt);this.modelFunctions=null,this.ref=null}};const EPIGRAPH_CONFIGURATOR_CATEGORY="Epigraph - Configurator",CONFIGURATOR_LOADING={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoading",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_READY={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReady",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_FAILED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorFailed",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_REVIEW_CART_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartShown",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_REVIEW_CART_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckout",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT_ITEM={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckoutItemDetails",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalGeometryVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOCAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLocalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOAD_FROM_PRECONFIG={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoadFromPreConfiguration",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"preconfigurationItemAdded",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_SCENE_RESTARTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneRestarted",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_AR_REQUESTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorArRequested",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_REMOVED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemRemoved",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemAdded",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsBtnClicked",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsStageCompletionRate",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_ENTER={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotEnter",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_EXIT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotExit",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_SCENE_SHARED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneShared",label:"",interaction:{nonInteraction:!1}};/* @license
4637
4637
  * Copyright 2019 Google LLC. All Rights Reserved.
4638
4638
  * Licensed under the Apache License, Version 2.0 (the 'License');
4639
4639
  * you may not use this file except in compliance with the License.
@@ -4646,7 +4646,7 @@ ${zt.join(`
4646
4646
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4647
4647
  * See the License for the specific language governing permissions and
4648
4648
  * limitations under the License.
4649
- */const HAS_WEBXR_DEVICE_API=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;HAS_WEBXR_DEVICE_API&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const kt=navigator.userAgent||navigator.vendor||self.opera;let _e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(kt)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(kt.substr(0,4)))&&(_e=!0),_e})();const IS_IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,IS_WKWEBVIEW=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(IS_IOS){if(IS_WKWEBVIEW)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const kt=document.createElement("a");return!!(kt.relList&&kt.relList.supports&&kt.relList.supports("ar"))}}else return!1})();class ConfiguratorCoreAPI{static forwardVector3=new Vector3(0,0,1);#t=!1;#i;#n;#s;#r;#c;#o;#a;#l;#v;#e;#g;#h=!0;#u;#f=!0;#d="";#p="";#m=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide",Instructions_Show:"instructions:show",ReviewCart_Shown:"review-cart-shown",ReviewCart_Hidden:"review-cart-hidden"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollisionDetected:"draggingOnDrop:collisionDetected",ItemRemoveModalTriggered:"itemRemoveModal:triggered",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(_e,Dt,Vt=null){if(Dt.identifier!=="wc-epigraph-configurator-core")return LOGGER.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialize the ConfiguratorCoreAPI class."}),null;this.stores=_e,Object.freeze(this.CORE_EVENTS),this.#r=Dt,this.#o=performance.now(),this.#s=Vt,this.#r.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#u=void 0,this.#h=!0,this.#f=!0}),this.setupAnalyticsEventListeners(),this.#t=!0}set shadowRootRef(_e){this.#i=_e}get shadowRootRef(){return this.#i}set configuratorWCRef(_e){this.#c=_e}get configuratorWCRef(){return this.#c}set clientAccessKey(_e){this.#v=_e}get lastSharedConfigurationID(){return this.#u}set lastSharedConfigurationID(_e){this.#u=_e}set projectId(_e){this.#e=_e}get projectId(){return this.#e}set experienceId(_e){this.#g=_e}get experienceId(){return this.#g}get coreWCRef(){return this.#r}getResolvedAssetUrl(_e){return resolveAssetUrl(_e)}initializeAnalytics(_e,Dt=!1){const Vt=this.coreWCRef.consentPlugin??null,Gt=this.coreWCRef.consentIdentifier??null;if(this.epigraphAnalytics=new S$3(Vt,Gt),_e.gaMeasurementId!=="")try{this.epigraphAnalytics.addEventPlugin(new I$2(_e.gaMeasurementId,!1))}catch(zt){LOGGER.info({title:"Error initializing GA4 Analytics",details:zt})}_e.epgExperienceID!==void 0&&this.epigraphAnalytics.addEventPlugin(new A$1(_e.epgExperienceID,crypto.randomUUID(),"",!1,Dt))}get isReady(){return this.#t}get preloadProgress(){return this.#n}get categoryData(){return this.stores.productDataStore.getState().categoryData}get productData(){return this.stores.productDataStore.getState().productData}get lookData(){return this.stores.productDataStore.getState().lookData}get hotspotsData(){return this.stores.productDataStore.getState().hotspotsData}get sceneSettings(){return this.stores.coreSceneStore.getState().sceneSettings}get assetsData(){return this.stores.productDataStore.getState().assetsData}get isMobile(){return this.stores.coreSceneStore.getState().isMobile}get isScreenPortrait(){return this.stores.uiSceneStore.getState().isScreenPortrait}getDeviceState(){return this.stores.coreSceneStore.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#h}set hasSceneChanged(_e){this.#h=_e}enableCart(){this.stores.coreSceneStore.getState().actions.enableCart()}disableCart(){this.stores.coreSceneStore.getState().actions.disableCart()}fireEvent(_e,Dt){let Vt=new CustomEvent(_e,{bubbles:!0,cancelable:!1,composed:!0});Vt.data=Dt,this.coreWCRef?this.coreWCRef.dispatchEvent(Vt):LOGGER.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",_e=>{let Dt=Object.assign({},CONFIGURATOR_READY);const Vt=((performance.now()-this.#o)/1e3).toFixed(2);this.#a=Vt,Dt.event_label=`${this.#e}`,Dt.parameters={project_id:`${this.#e}`,load_time:Vt},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener("coreApi:failed",_e=>{let Dt=Object.assign({},CONFIGURATOR_FAILED);Dt.parameters={project_id:`${this.#e}`},Dt.event_label=`${this.#e}`,this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,_e=>{LOGGER.info({title:"Add Item",details:_e});const Dt=_e.data.itemData.guid,zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt)?.currentVariant,Ht={item_added:`${`${_e.data.itemData.skuID}(${zt})`}`,project_id:`${this.#e}`},Wt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,qt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(Wt||qt){let Xt=Object.assign({},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED);Xt.parameters=Ht,this.sendAnalyticsEvent(Xt)}else{let Xt=Object.assign({},CONFIGURATOR_ITEM_ADDED);Xt.parameters=Ht,this.sendAnalyticsEvent(Xt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,_e=>{if(LOGGER.info({title:"Remove Item"}),_e.data.itemData==null)return;const Dt=_e.data.itemData.skuID;let Vt=Object.assign({},CONFIGURATOR_ITEM_REMOVED);Vt.parameters={item_removed:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,_e=>{let Dt=Object.assign({},CONFIGURATOR_HOTSPOT_ENTER);const Vt=_e.data.hotspot?.hotspotData?.title;Dt.parameters={hotspot_entered:`${this.sceneSettings.analyticsEventPrefix}${Vt||_e.data.hotspotAbsID}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,_e=>{let Dt=Object.assign({},CONFIGURATOR_HOTSPOT_EXIT);const Vt=_e.data.hotspot?.hotspotData?.title;Dt.parameters={hotspot_exited:`${this.sceneSettings.analyticsEventPrefix}${Vt||_e.data.hotspotAbsID}`,project_id:`${this.#e}`,c_hotspot_time_spent:`${_e.data.hotspotTimeSpent}`},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,_e=>{let Dt=0,Vt=0,Gt=0;_e.data.cartItems.forEach((jt,Ht)=>{Vt++,Gt+=jt.count,Dt+=jt.price;let Wt=Object.assign({},CONFIGURATOR_CHECKOUT_ITEM);Wt.parameters={client_product_id:jt.clientProductId,count_added_to_cart:jt.count,variant:`${jt.currentVariant}`,total_value:jt.price,epigraph_sku:`${jt.skuID}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Wt)});let zt=Object.assign({},CONFIGURATOR_CHECKOUT);zt.parameters={cart_total:Dt,unique_items_count:Vt,total_items:Gt,project_id:`${this.#e}`},this.sendAnalyticsEvent(zt)})}getPreconfigurationModuleData(){return this.stores.productDataStore.getState().categoryData.preconfiguration}setEmptySceneText(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings;Dt.emptySceneText=_e,this.stores.coreSceneStore.setState({sceneSettings:{...Dt}})}getSpawningRequirementForSkuID(_e){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(_e)}getAllSkusThatCanReplaceGuid(_e){if(!this.stores.itemStore.getState().itemsSpawned[_e])return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),[];const zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return zt?zt.getAllSkusThatCanReplaceMe():(LOGGER.warn({title:"Node with guid: "+_e+" doesn't exist"}),[])}getCartItems(){return this.stores.attachmentStore.getState().attachmentSystem.getCartItems()}async getCartItemsAsync(){return await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync()}checkout(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async checkoutAsync(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=await Dt.getCartItemsAsync();return Vt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async reloadCheckedoutScene(){if(!this.#m){LOGGER.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#m)}getCurrentItemsInReplaceableCategory(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#f===!1?this.#d:(URL.revokeObjectURL(this.#d),this.#d=void 0,this.#d=await getSceneAsGLBUrl(this.stores),this.#f=!1,this.#d)}async getSceneAsUsdzUrl(){return this.#f===!1?this.#p:(URL.revokeObjectURL(this.#p),this.#p=void 0,this.#p=await getSceneAsUsdzUrl(this.stores),this.#f=!1,this.#p)}async generateShareableLink(_e=!1){if(!this.#h&&this.#u)LOGGER.info({title:"Reusing the cached configuration ID that was last saved..."});else{LOGGER.info({title:"Generating a new configuration ID..."});let zt=this.stores.attachmentStore.getState().actions.export(),jt=await this.stores.nexusApiInstance.postExperienceSaveAndShare(this.experienceId,zt);this.#u=jt.payload.save_id}const Dt=window.location.href;let Vt=new URL(Dt);_e===!0&&Vt.searchParams.set("launchInAR",!0),Vt.searchParams.set("projectId",this.projectId),Vt.searchParams.set("epgsharedconfigid",this.#u),this.#h=!1;let Gt=Object.assign({},CONFIGURATOR_SCENE_SHARED);return Gt.parameters={shared_url:`${Vt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt),Vt.href}closeContextMenu(){this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem()}updatePreloadProgress(_e){const Dt=this.#n;this.#n=_e;const Vt=new CustomEvent("preload:update",{detail:{progress:this.#n}});window.dispatchEvent(Vt),typeof this.#s=="function"&&this.#s(Dt,_e)}alert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt=!1,alertId:jt}){this.stores.coreSceneStore.getState().actions.sendAlert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt,alertId:jt})}removePersistantAlert(){this.stores.coreSceneStore.setState({persistantAlertData:null})}clickHotspot(_e){let Dt=this.coreWCRef.shadowRootRef.getElementById(_e);Dt&&Dt.click()}exitHotspot(){this.stores.hotspotStore.getState().actions.exitHotspot(!1)}isSystemBusy(){return this.stores.itemStore.getState().isBusy()}async spawnGhostsForSkuID(_e,Dt=!1,Vt){return this.isSystemBusy()?null:await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(_e,Dt,Vt)}removeAllGhosts(){if(this.stores.itemStore.getState().isBusy())return null;this.stores.ghostStore.getState().actions.clearAllGhosts()}printSceneHierarchy(_e=!1){const Dt=this.stores.coreSceneStore.getState().sceneRef;(function Vt(Gt){const zt=`${Gt.name} < ${Gt.type} >`;_e===!0?console.groupCollapsed(zt):console.group(zt),Gt.children.forEach(Vt),console.groupEnd()})(Dt)}getSceneItems(){const _e=this.stores.itemStore.getState().itemsSpawned;if(typeof _e!="object"){LOGGER.error({title:"There was an error while fetching the scene item count."});return}return _e}getSceneItemCount(){let _e;const Dt=this.stores.itemStore.getState().itemsSpawned;return typeof Dt!="object"&&LOGGER.error({title:"There was an error while fetching the scene item count."}),_e=Object.keys(Dt).length,_e}async spawnItemBySkuID(_e,Dt=!1){if(this.isSystemBusy())return null;const Vt=this.getActiveGhostData();return Vt&&Vt.skuID!==_e?null:(Dt===!0&&!Vt&&await this.spawnGhostsForSkuID(_e,!1,1),await this.stores.itemStore.getState().actions.addItemBySkuID(_e,0))}async spawnItemBySkuIDAndGhostIndex(_e,Dt=0){if(this.stores.itemStore.getState().isBusy())return null;let Vt=null;const Gt=this.getActiveGhostData();return Dt>=0&&Gt.count>Dt&&Gt.skuID==_e&&(Vt=await this.stores.itemStore.getState().actions.addItemBySkuID(_e,Dt)),Vt}async replaceItemBySkuId(_e,Dt){return await this.stores.itemStore.getState().actions.replaceGuidItemBySkuId(_e,Dt)}async replaceItemsBySkuId(_e,Dt){if(!Array.isArray(_e))throw new Error("guids parameter must be an array");try{for(const Vt of _e)await this.replaceItemBySkuId(Vt,Dt);return!0}catch(Vt){throw new Error(`Failed to replace items by SKU ID: ${Vt.message}`)}}async replaceAllItemsBySkuId(_e,Dt){const Vt=[],Gt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Gt).map(zt=>{Gt[zt].itemData.skuID==_e&&Vt.push(zt)});try{for(const zt of Vt)await this.replaceItemBySkuId(zt,Dt);return!0}catch(zt){throw new Error(`Failed to replace items by SKU ID: ${zt.message}`)}}async removeItemByGUID(_e,Dt=!1){if(this.stores.itemStore.getState().isBusy())return null;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return Dt===!1&&Gt.canSwapRoot===!0&&Gt.swapRoot(),await this.stores.itemStore.getState().actions.removeItemByGUID(_e)}triggerItemRemoveModal(_e){const Dt=this.getGuidItemAttachedDependencies(_e);Dt&&this.fireEvent(this.EVENTS.SCENE.ItemRemoveModalTriggered,Dt)}async updateFittingSkuIds(){await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}rotateItemByGUID(_e){this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(_e)}rotateSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to rotate"});return}const Dt=_e.itemData.guid;return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(Dt),_e}removeLastItemBySkuId(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=Object.keys(Dt);for(let Gt=Vt.length-1;Gt>=0;Gt--){const zt=Vt[Gt];if(Dt[zt].itemData.skuID===_e){this.doesGuidItemHaveAnAttachedDependency(zt)?(this.selectItemWithGUID(zt),this.triggerItemRemoveModal(zt)):this.removeItemByGUID(zt);break}}}async removeSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to delete"});return}const Dt=_e.itemData.guid;return this.stores.itemStore.getState().actions.deselectItem(),await this.removeItemByGUID(Dt),LOGGER.info({title:`Removed Item: ${Dt}`}),_e}refocus(){this.stores.coreSceneStore.getState().actions.triggerAutoFocus()}getActiveGhostData(){return this.stores.ghostStore.getState().ghostData}focusOnGhosts(){if(this.stores.ghostStore.getState().ghostParentRef===null){LOGGER.warn({title:"Ghost Parent Reference not found"});return}this.stores.ghostStore.getState().ghostParentRef.children.length<=0?this.stores.coreSceneStore.getState().actions.triggerAutoFocus():this.stores.coreSceneStore.getState().actions.triggerAutoFocus(this.stores.ghostStore.getState().ghostParentRef)}exitSelectedItem(){this.stores.itemStore.getState().actions.deselectItem()}getSelectedItemData(){return this.stores.itemStore.getState().selectedItemData}canSelectedItemRotate(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRotate:!1}canSelectedItemBeRemoved(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRemove:!1}canSelectedItemDrag(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(_e){let Dt=!0;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e),zt=Gt.isEndNode;return Dt=!zt,zt||Gt.canSwapRoot&&Gt.whichNodesAreAttachedToUs().length==1&&(Dt=!1),Dt}getGuidItemAttachedDependencies(_e){const Dt=this.stores.attachmentStore.getState().attachmentSystem,Vt=this.stores.itemStore.getState().itemsSpawned,Gt=Dt.currentStructure.getNodeByGUID(_e);if(!Gt)return;let zt={[Gt.guid]:{...Vt[Gt.guid]}};return Gt.getAllBranchedNodesAttachedToUs().forEach(Ht=>{zt[Ht.guid]=Vt[Ht.guid]}),zt}doesSelectedItemHasAttachedDependency(){const _e=this.getSelectedItemData();return _e?this.doesGuidItemHaveAnAttachedDependency(_e.itemData.guid):!1}isSelectedItemAnEndNode(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return this.stores.lightStore.getState().envMapUrl}async switchGlobalGeometryVariant(_e,Dt){if(!_e){LOGGER.WARN({title:"Geometry Category: '"+_e+"' not valid!"});return}this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalGeometryVariant(_e,Dt),await wait(1);let Vt=Object.assign({},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED);Vt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt);const zt=this.stores.productDataStore.getState().categoryData.geometryVariants;let jt=null;if(zt.map(Wt=>{Wt.id==_e&&(jt=Wt)}),!jt)return;const Ht=jt.variants[Dt];this.alert({alertMsg:jt.label.charAt(0).toUpperCase()+jt.label.slice(1)+" was successfully switched to "+Ht.label.charAt(0).toUpperCase()+Ht.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${jt.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(_e,Dt=""){if(!_e){LOGGER.WARN({title:"Look Category: '"+_e+"' not valid!"});return}this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),LOGGER.info({title:`Changing Global Variant: Category: ${_e} Id: ${Dt}`}),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalVariant(_e,Dt),await wait(1);let Vt=Object.assign({},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED);Vt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt)}async overrideSelectedItemMaterial(_e=""){return this.stores.itemStore.getState().selectedItemData?(await this.stores.itemStore.getState().actions.switchToVariant(this.stores.itemStore.getState().selectedItemData.itemData,_e,!0),!0):!1}async overrideItemMaterialByGuid(_e,Dt){const Vt=this.stores.itemStore.getState().itemsSpawned[_e];if(!Vt)return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),!1;await this.stores.itemStore.getState().actions.switchToVariant(Vt.itemData,Dt,!0);let Gt=Object.assign({},CONFIGURATOR_LOCAL_VARIANT_SWITCHED);return Gt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt),!0}getSelectedItemColors(){let _e=[];if(this.getSelectedItemData()==null)return _e;let Vt=this.getSelectedItemData().itemData.looks;if(Vt){let Gt=this.stores.productDataStore.getState().lookData;Vt.map(zt=>{Gt.hasOwnProperty(zt)&&_e.push(Gt[zt])})}return _e}getCanvasSize(){return this.stores.coreSceneStore.getState().canvasSize}async removeAllVariantOverrides(){return this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(_e){this.stores.coreSceneStore&&this.stores.coreSceneStore.getState().actions.switchCursor(_e)}getSceneStructure(){return this.stores.attachmentStore.getState().actions.export()}getSceneStructureRaw(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure}getAllConnectionsInScene(){const _e=this.getSceneStructureRaw(),Dt=new Map;for(const Vt of _e.nodes)for(const Gt of Vt.plugs){if(!Gt.attachedPlugGUID)continue;const zt=[Gt.guid,Gt.attachedPlugGUID].sort().join();Dt.has(zt)||Dt.set(zt,{from:Gt,to:Gt.attachedPlug})}return Dt}async loadSceneFromConfiguration(_e){await this.stores.attachmentStore.getState().actions.loadStructure(_e)}async loadSceneFromConfigurationID(_e,Dt=!0){const Vt=await this.stores.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e);if(!Vt)return null;Dt===!0&&this.stores.attachmentStore.setState({defaultConfig:Vt});let Gt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);Gt.label=`Preconfig ID: ${_e}`,await this.loadSceneFromConfiguration(Vt)}viewInYourSpace(){LOGGER.info({title:"View in your space called from the Core API"});let _e=Object.assign({},CONFIGURATOR_AR_REQUESTED);_e.label="AR Requested",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e),this.#r.epigraphViewInYourSpaceRef.onViewInYourSpaceButtonClicked()}async shareScene(){const _e=await this.generateShareableLink();let Dt=Object.assign({},CONFIGURATOR_SCENE_SHARED);return Dt.parameters={shared_url:`${_e}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Dt),_e}async clearScene(){return await this.stores.attachmentStore.getState().attachmentSystem.clear()}async restartScene(){LOGGER.info({title:"Restarting Scene."}),await this.stores.attachmentStore.getState().attachmentSystem.restart();let _e=Object.assign({},CONFIGURATOR_SCENE_RESTARTED);_e.label="Scene Restarted",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}areDimensionsVisible(){return this.stores.coreSceneStore.getState().showDimensions}getCurrentDimensions(){return this.stores.coreSceneStore.getState().boundData}getActiveHotspot(){return this.stores.hotspotStore.getState().activeHotspotData}reviewCartShown(){let _e=Object.assign({},CONFIGURATOR_REVIEW_CART_SHOWN);_e.label="Review Cart shown",_e.parameters={project_id:`${this.#e}`},this.fireEvent(this.EVENTS.UI.ReviewCart_Shown,_e),this.sendAnalyticsEvent(_e)}isGeometryVisibleForGUID(_e,Dt){const Vt={success:!1,result:!1},zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);return zt.ref&&zt.ref.traverse(jt=>{jt.name===_e&&(console.log(jt),Vt.success=!0,Vt.result=jt.visible)}),Vt}reviewCartHidden(){let _e=Object.assign({},CONFIGURATOR_REVIEW_CART_HIDE);_e.label="Review Cart hidden",_e.parameters={project_id:`${this.#e}`},this.fireEvent(this.EVENTS.UI.ReviewCart_Hidden,_e),this.sendAnalyticsEvent(_e)}sendShowInstructionsBtnAnalyticsEvent(){let _e=Object.assign({},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED);_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}sendInstructionsAnalyticsCompletionRate(_e){let Dt=Date.now()-this.#l,Vt=Math.round(Dt/1e3);this.#l=Date.now();let Gt=Object.assign({},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE);Gt.parameters={completion_rate:_e,time_spent:Vt,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt)}showInstructions(){this.fireEvent(this.EVENTS.UI.Instructions_Show),this.#l=Date.now();let _e=Object.assign({},CONFIGURATOR_INSTRUCTIONS_SHOWN);_e.label="Instructions shown",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}showDimensions(){this.stores.coreSceneStore.setState({showDimensions:!0});let _e=Object.assign({},CONFIGURATOR_DIMENSION_SHOWN);_e.label="Dimensions shown",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}hideDimensions(){this.stores.coreSceneStore.setState({showDimensions:!1});let _e=Object.assign({},CONFIGURATOR_DIMENSION_HIDE);_e.label="Dimensions hidden",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}areHotspotsVisible(){return this.stores.hotspotStore.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return this.stores.hotspotStore.getState().hotspotsTempVisibility}showAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!0,_e)}hideAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!1,_e)}getFittingSkuIds(){return this.stores.attachmentStore.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);this.stores.itemStore.getState().actions.setSelectedItemData({...Dt[_e],overrideVariant:Vt.overrideVariant,currentVariant:Vt.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((_e,Dt)=>{this.coreWCRef.addEventListener(this.EVENTS.CONFIGURATION.CameraDetails_Update,Vt=>{_e(Vt.data)},{once:!0}),this.stores.cameraStore.getState().actions.triggerFetchingCamera()})}moveCamera(_e,Dt,Vt=!0){this.stores.hotspotStore.setState({isAnyHotspotActive:!0}),_e&&this.stores.cameraStore.setState({viewPointPosition:ArrToVec3(_e)}),Dt&&this.stores.cameraStore.setState({focusPointPosition:ArrToVec3(Dt)}),this.stores.cameraStore.setState({resetToLastPosition:Vt})}setEnvLightMap(_e){this.stores.lightStore.setState({envMapUrl:_e})}updateInventoryForAllProducts(_e){return this.stores.inventoryStore.getState().actions.updateInventoryForAllProducts(_e),this.getInventoryInfo()}getInventoryInfo(){return JSON.parse(JSON.stringify(this.stores.inventoryStore.getState().inventoryData))}updateCompareAtPricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}updatePricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}async updateCompareAtPricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}async updatePricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}updatePricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}updateCompareAtPricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}async updatePricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}async updateCompareAtPricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}getCurrentPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentPricingInfo()}getCurrentCompareAtPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentCompareAtPricingInfo()}async itemDragStart(_e){if(this.stores.itemStore.getState().isBusy())return null;this.stores.coreSceneStore.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:_e}),await this.spawnGhostsForSkuID(_e,!1)}async itemDragEnd(){if(this.stores.itemStore.getState().isBusy())return null;const _e=this.stores.coreSceneStore.getState().hoveredGhostIndex;_e!==-1?await this.stores.itemStore.getState().actions.addItemBySkuID(this.stores.coreSceneStore.getState().itemDraggedSkuID,_e):await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(_e,Dt){const Vt=this.stores.productDataStore.getState().productData,Gt=this.stores.attachmentStore.getState().attachmentSystem;if(!Gt)return;const zt=Gt.currentStructure;if(!zt)return;let jt=zt.getNodeByGUID(Dt);jt?(jt._skuID=_e,jt.generatePlugsForNode(_e)):(jt=new Node$1(this.stores,_e,{guid:Dt,isEndNode:!0,overrideVariant:null,plugs:Vt[_e].plugs}),zt.addNode(jt),zt.connectPlugs({incomingPlug:new Plug({name:"tempPlug",acceptedPlugTypes:[],connectsToPlugTypes:[]},jt),receiverPlug:zt.rootNode.plugs[0]}));const Ht=await this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},_e,Dt);return await wait(1),Ht}async getScreenshotForCurrentCamera(_e){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(null,_e)}async getScreenshotForCamera(_e,Dt){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(_e,Dt)}async getAllPredefinedScreenshots(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings.screenshotCameras,Vt=[];for(const Gt of Dt){const zt=await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(Gt,_e);Vt.push(zt)}return Vt}setCameraFocusPointPosition(_e){this.stores.cameraStore.setState({focusPointPosition:_e})}triggerFetchingCamera(){this.stores.cameraStore.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await this.stores.coreSceneStore.getState().actions.completeDropItem()}revertItemDrop(){this.stores.coreSceneStore.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return this.stores.cameraStore.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(_e){if(this.epigraphAnalytics!==null)try{this.epigraphAnalytics.sendEvent(_e)}catch{LOGGER.info()}}isIosDevice(){return IS_IOS}actionButtonClicked(_e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:_e.actionButton.data,skuID:_e.skuID,count:_e.count,price:_e.price,compareAtPrice:_e.compareAtPrice,countAvailable:_e.countAvailable,countUnavailable:_e.countUnavailable,currentVariant:_e.currentVariant})}setCartMessage(_e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:_e})}convertQuaternionToEuler(_e){return new Euler(0,0,0,"XYZ").setFromQuaternion(_e)}convertDegreeToRadians(_e){return MathUtils.degToRad(_e)}convertRadiansToDegree(_e){return MathUtils.radToDeg(_e)}createVector3(_e,Dt,Vt){return new Vector3(_e,Dt,Vt)}isFacingInDirection(_e,Dt){return ConfiguratorCoreAPI.forwardVector3.set(0,0,1),Dt.normalize(),ConfiguratorCoreAPI.forwardVector3.applyQuaternion(_e),ConfiguratorCoreAPI.forwardVector3.dot(Dt)>=0}}const EpigraphConfiguratorCore=reactExports.forwardRef(({customVersionId:kt,experienceId:_e,stores:Dt,viewInYourSpaceRef:Vt,configuratorWcRef:Gt,initialConfigId:zt,clientAccessKey:jt,consentPlugin:Ht,consentIdentifier:Wt,gaMeasurementId:qt,builderMode:Xt,id:Kt,disableCart:Yt,apiMode:Zt},Jt)=>{const[nn,rn]=reactExports.useState(null);reactExports.useEffect(()=>{Jt.current&&(Jt.current.identifier="wc-epigraph-configurator-core",Jt.current.epigraphViewInYourSpaceRef=void 0,Jt.current.initialConfigId="",Jt.current.clientAccessKey="",Jt.current.consentPlugin="",Jt.current.consentIdentifier="",Jt.current.gaMeasurementId="",Jt.current.configuratorWcRef=void 0,Jt.current.builderMode=!1,Jt.current.projectId="",Jt.current.api=null,Jt.current.api=new ConfiguratorCoreAPI(Dt,Jt.current),Dt.coreSceneStore.setState({CORE_API:Jt.current.api}),en(Jt.current))},[Jt]),reactExports.useEffect(()=>{Jt.current&&Vt&&(Vt.current&&(Jt.current.epigraphViewInYourSpaceRef=Vt.current),LOGGER.info({title:"ViewInYourSpace is now accessible from the core: "}))},[Jt,Vt]);const Qt=reactExports.useCallback(tn=>{Gt&&(tn.configuratorWCRef=Gt,tn.shadowRootRef=tn.configuratorWCRef.shadowRoot,tn.api.shadowRootRef=tn.shadowRootRef,tn.api.configuratorWCRef=tn.configuratorWCRef),kt&&(tn.customVersionId=kt),zt&&(tn.initialConfigId=zt),jt&&(tn.clientAccessKey=jt),Ht&&(tn.consentPlugin=Ht),Wt&&(tn.consentIdentifier=Wt),qt&&(tn.gaMeasurementId=qt),Xt&&(tn.builderMode=!0),LOGGER.group("Collected Web Component Attributes"),LOGGER.table({initialConfigId:tn.initialConfigId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,builderMode:tn.builderMode}),LOGGER.groupEnd()},[Xt,zt,qt,jt,Gt]),en=reactExports.useCallback(async tn=>{if(tn.coreReady===!0)return;Qt(tn);let sn=kt;!sn&&IS_DEV_ENV&&(sn="latest");let cn={};if(Zt==="input.json"?cn={payload:{project_id:"local-project",experience_id:"",configurator_data:await __vitePreload(()=>import("./input-afb87ea8.js"),[]),session_details:{environment:"development"}},report:"Local Input Json",success:!0}:jt?cn=await Dt.nexusApiInstance.getConfiguratorByClientAccessKey(jt,sn):cn=await Dt.nexusApiInstance.getConfiguratorByExperienceId(_e,sn),tn.validationPassed=cn.success,tn.validationPassed==!1){LOGGER.error({title:"Request from an invalidated source: "+window.location.href}),Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:failed");return}Dt.nexusApiResponseEnvironment=cn.payload.session_details.environment,tn.projectId=cn.payload.project_id,tn.experienceId=cn.payload.experience_id,Dt.experienceId=cn.payload.experience_id,tn.api.projectId=tn.projectId,tn.api.experienceId=tn.experienceId;const un=cn.payload.configurator_data,hn={gaMeasurementId:tn.gaMeasurementId??void 0,epgExperienceID:tn.experienceId??void 0};Dt.coreSceneStore.getState().CORE_API.initializeAnalytics(hn,IS_DEV_ENV);let dn=Object.assign({},CONFIGURATOR_LOADING);dn.parameters={project_id:`${tn.projectId}`},Dt.coreSceneStore.getState().CORE_API.sendAnalyticsEvent(dn),LOGGER.info({title:"VALIDATION SUCCESSFUL!"}),tn.coreReady=!0;let pn=new URL(window.location).searchParams;pn.has("epgsharedconfigid")&&(tn.initialConfigId=pn.get("epgsharedconfigid")),rn({projectId:tn.projectId,parsedData:un,customVersionId:tn.customVersionId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,initialConfigId:tn.initialConfigId,builderMode:tn.builderMode})},[]);return reactExports.useEffect(()=>()=>{Dt.coreSceneStore.getState().CORE_API&&Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:shutDown")},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{id:Kt,ref:Jt,children:nn&&jsxRuntimeExports.jsx(App$1,{parsedData:nn.parsedData,stores:Dt,clientAccessKey:nn.clientAccessKey,consentPlugin:nn.consentPlugin,consentIdentifier:nn.consentIdentifier,initialConfigId:nn.initialConfigId,builderMode:nn.builderMode,disableCart:Yt!==void 0?Yt:!1})})})}),ViewInYourSpace=React.forwardRef((kt,_e)=>{const[Dt,Vt]=reactExports.useState(!1),[Gt,zt]=reactExports.useState(!1),jt=reactExports.useRef(null),Ht=reactExports.useRef(null),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.stores.uiSceneStore(qn=>qn.dialogPopupOpen),Qt=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),en=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),tn=()=>{kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"])};reactExports.useEffect(()=>{!_e.current||!jt.current||!Ht.current||!Wt.current||!qt.current||!Xt.current||!Kt.current||!Yt.current||!Zt.current||!Jt.current||!nn.current||(tn(),_e.current.getQRForURL=async(qn,tr)=>await Pn(qn,tr),_e.current.onViewInYourSpaceButtonClicked=async qn=>await yn(),_e.current.assetSrc="",_e.current.iosAssetSrc="",_e.current.arLink="",_e.current.coreApi=void 0,_e.current.arInProgress=!1,_e.current._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",_e.current._modelViewer=null,_e.current._qrModalContainer=null,fn(),dn(),un(),_e.current._modelViewer.addEventListener("error",qn=>{Cn(qn)}),_e.current._viewInYourSpaceButton.addEventListener("click",qn=>{yn()}),_e.current.canLaunchAR=sn)},[_e,jt,Ht,Wt,qt,Xt,Kt,Yt,Zt,Jt,nn]);const sn=reactExports.useCallback(()=>_e.current._modelViewer.canActivateAR,[]);reactExports.useEffect(()=>{_e.current&&(kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"]),kt["core-api"]&&(_e.current.coreApi=kt["core-api"]),cn())},[_e,kt]);const cn=()=>{_e.current._modelViewer.setAttribute("src",_e.current.assetSrc),_e.current._modelViewer.setAttribute("ios-src",_e.current.iosAssetSrc),_e.current._modelViewer.style.display="none"},un=()=>{window.customElements.get("model-viewer")===void 0&&hn(),En(),cn(),_e.current._modelViewer.addEventListener("ar-status",qn=>{qn.detail.status==="session-started"?(_e.current._modelViewer.style.display="block",_e.current.arInProgress=!0):(qn.detail.status==="not-presenting"||qn.detail.status==="failed")&&(_e.current._modelViewer.style.display="none",_e.current.arInProgress=!1)})},hn=()=>{_e.current._modelViewerScriptElem=document.createElement("script"),_e.current._modelViewerScriptElem.setAttribute("type","module"),_e.current._modelViewerScriptElem.setAttribute("src",_e.current._modelViewerScriptSource),_e.current._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(_e.current._modelViewerScriptElem)},dn=()=>{_e.current._qrModalContainer=qt.current,_e.current._qrCodeImage=Xt.current,_e.current._arLink=Kt.current,_e.current._qrLoader=Yt.current,_e.current.doneViewInYourSpaceBtn=Zt.current,_e.current.doneViewInYourSpaceBtn.addEventListener("click",()=>{pn(),Tn()})},pn=async()=>{if(_e.current._qrCodeImage!==null)for(;_e.current._qrCodeImage.firstChild;)_e.current._qrCodeImage.removeChild(_e.current._qrCodeImage.firstChild)},fn=()=>{_e.current.arDrawer=jt.current,_e.current._launchARButton=Ht.current,_e.current._modelDownloadLoader=Wt.current,_e.current._launchARButton.addEventListener("click",()=>{_e.current.arInProgress!==!0&&Rn()})},mn=()=>{_e.current._modelDownloadLoader.classList.remove("loader-hide")},vn=()=>{_e.current._modelDownloadLoader.classList.add("loader-hide")},_n=()=>{zt(!0),xn(),_e.current.arDrawer.show()},En=()=>{_e.current._modelViewer=Jt.current,_e.current._viewInYourSpaceButton=nn.current},An=()=>{Vt(!0),_e.current._qrModalContainer.show()},Tn=()=>{Vt(!1),_e.current._qrModalContainer.hide()},Cn=qn=>{console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
4649
+ */const HAS_WEBXR_DEVICE_API=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;HAS_WEBXR_DEVICE_API&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const kt=navigator.userAgent||navigator.vendor||self.opera;let _e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(kt)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(kt.substr(0,4)))&&(_e=!0),_e})();const IS_IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,IS_WKWEBVIEW=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(IS_IOS){if(IS_WKWEBVIEW)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const kt=document.createElement("a");return!!(kt.relList&&kt.relList.supports&&kt.relList.supports("ar"))}}else return!1})();class ConfiguratorCoreAPI{static forwardVector3=new Vector3(0,0,1);#t=!1;#i;#n;#s;#r;#c;#o;#a;#l;#v;#e;#g;#h=!0;#u;#f=!0;#d="";#p="";#m=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide",Instructions_Show:"instructions:show",ReviewCart_Shown:"review-cart-shown",ReviewCart_Hidden:"review-cart-hidden"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollisionDetected:"draggingOnDrop:collisionDetected",ItemRemoveModalTriggered:"itemRemoveModal:triggered",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(_e,Dt,Vt=null){if(Dt.identifier!=="wc-epigraph-configurator-core")return LOGGER$1.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialize the ConfiguratorCoreAPI class."}),null;this.stores=_e,Object.freeze(this.CORE_EVENTS),this.#r=Dt,this.#o=performance.now(),this.#s=Vt,this.#r.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#u=void 0,this.#h=!0,this.#f=!0}),this.setupAnalyticsEventListeners(),this.#t=!0}set shadowRootRef(_e){this.#i=_e}get shadowRootRef(){return this.#i}set configuratorWCRef(_e){this.#c=_e}get configuratorWCRef(){return this.#c}set clientAccessKey(_e){this.#v=_e}get lastSharedConfigurationID(){return this.#u}set lastSharedConfigurationID(_e){this.#u=_e}set projectId(_e){this.#e=_e}get projectId(){return this.#e}set experienceId(_e){this.#g=_e}get experienceId(){return this.#g}get coreWCRef(){return this.#r}getResolvedAssetUrl(_e){return resolveAssetUrl(_e)}initializeAnalytics(_e,Dt=!1){const Vt=this.coreWCRef.consentPlugin??null,Gt=this.coreWCRef.consentIdentifier??null;if(this.epigraphAnalytics=new S$3(Vt,Gt),_e.gaMeasurementId!=="")try{this.epigraphAnalytics.addEventPlugin(new I$2(_e.gaMeasurementId,!1))}catch(zt){LOGGER$1.info({title:"Error initializing GA4 Analytics",details:zt})}_e.epgExperienceID!==void 0&&this.epigraphAnalytics.addEventPlugin(new A$1(_e.epgExperienceID,crypto.randomUUID(),"",!1,Dt))}get isReady(){return this.#t}get preloadProgress(){return this.#n}get categoryData(){return this.stores.productDataStore.getState().categoryData}get productData(){return this.stores.productDataStore.getState().productData}get lookData(){return this.stores.productDataStore.getState().lookData}get hotspotsData(){return this.stores.productDataStore.getState().hotspotsData}get sceneSettings(){return this.stores.coreSceneStore.getState().sceneSettings}get assetsData(){return this.stores.productDataStore.getState().assetsData}get isMobile(){return this.stores.coreSceneStore.getState().isMobile}get isScreenPortrait(){return this.stores.uiSceneStore.getState().isScreenPortrait}getDeviceState(){return this.stores.coreSceneStore.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#h}set hasSceneChanged(_e){this.#h=_e}enableCart(){this.stores.coreSceneStore.getState().actions.enableCart()}disableCart(){this.stores.coreSceneStore.getState().actions.disableCart()}fireEvent(_e,Dt){let Vt=new CustomEvent(_e,{bubbles:!0,cancelable:!1,composed:!0});Vt.data=Dt,this.coreWCRef?this.coreWCRef.dispatchEvent(Vt):LOGGER$1.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",_e=>{let Dt=Object.assign({},CONFIGURATOR_READY);const Vt=((performance.now()-this.#o)/1e3).toFixed(2);this.#a=Vt,Dt.event_label=`${this.#e}`,Dt.parameters={project_id:`${this.#e}`,load_time:Vt},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener("coreApi:failed",_e=>{let Dt=Object.assign({},CONFIGURATOR_FAILED);Dt.parameters={project_id:`${this.#e}`},Dt.event_label=`${this.#e}`,this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,_e=>{LOGGER$1.info({title:"Add Item",details:_e});const Dt=_e.data.itemData.guid,zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt)?.currentVariant,Ht={item_added:`${`${_e.data.itemData.skuID}(${zt})`}`,project_id:`${this.#e}`},Wt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,qt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(Wt||qt){let Xt=Object.assign({},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED);Xt.parameters=Ht,this.sendAnalyticsEvent(Xt)}else{let Xt=Object.assign({},CONFIGURATOR_ITEM_ADDED);Xt.parameters=Ht,this.sendAnalyticsEvent(Xt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,_e=>{if(LOGGER$1.info({title:"Remove Item"}),_e.data.itemData==null)return;const Dt=_e.data.itemData.skuID;let Vt=Object.assign({},CONFIGURATOR_ITEM_REMOVED);Vt.parameters={item_removed:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,_e=>{let Dt=Object.assign({},CONFIGURATOR_HOTSPOT_ENTER);const Vt=_e.data.hotspot?.hotspotData?.title;Dt.parameters={hotspot_entered:`${this.sceneSettings.analyticsEventPrefix}${Vt||_e.data.hotspotAbsID}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,_e=>{let Dt=Object.assign({},CONFIGURATOR_HOTSPOT_EXIT);const Vt=_e.data.hotspot?.hotspotData?.title;Dt.parameters={hotspot_exited:`${this.sceneSettings.analyticsEventPrefix}${Vt||_e.data.hotspotAbsID}`,project_id:`${this.#e}`,c_hotspot_time_spent:`${_e.data.hotspotTimeSpent}`},this.sendAnalyticsEvent(Dt)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,_e=>{let Dt=0,Vt=0,Gt=0;_e.data.cartItems.forEach((jt,Ht)=>{Vt++,Gt+=jt.count,Dt+=jt.price;let Wt=Object.assign({},CONFIGURATOR_CHECKOUT_ITEM);Wt.parameters={client_product_id:jt.clientProductId,count_added_to_cart:jt.count,variant:`${jt.currentVariant}`,total_value:jt.price,epigraph_sku:`${jt.skuID}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Wt)});let zt=Object.assign({},CONFIGURATOR_CHECKOUT);zt.parameters={cart_total:Dt,unique_items_count:Vt,total_items:Gt,project_id:`${this.#e}`},this.sendAnalyticsEvent(zt)})}getPreconfigurationModuleData(){return this.stores.productDataStore.getState().categoryData.preconfiguration}setEmptySceneText(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings;Dt.emptySceneText=_e,this.stores.coreSceneStore.setState({sceneSettings:{...Dt}})}getSpawningRequirementForSkuID(_e){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(_e)}getAllSkusThatCanReplaceGuid(_e){if(!this.stores.itemStore.getState().itemsSpawned[_e])return LOGGER$1.warn({title:"Item with guid: "+_e+" doesn't exist"}),[];const zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return zt?zt.getAllSkusThatCanReplaceMe():(LOGGER$1.warn({title:"Node with guid: "+_e+" doesn't exist"}),[])}getCartItems(){return this.stores.attachmentStore.getState().attachmentSystem.getCartItems()}async getCartItemsAsync(){return await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync()}checkout(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER$1.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER$1.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async checkoutAsync(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=await Dt.getCartItemsAsync();return Vt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER$1.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER$1.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async reloadCheckedoutScene(){if(!this.#m){LOGGER$1.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#m)}getCurrentItemsInReplaceableCategory(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#f===!1?this.#d:(URL.revokeObjectURL(this.#d),this.#d=void 0,this.#d=await getSceneAsGLBUrl(this.stores),this.#f=!1,this.#d)}async getSceneAsUsdzUrl(){return this.#f===!1?this.#p:(URL.revokeObjectURL(this.#p),this.#p=void 0,this.#p=await getSceneAsUsdzUrl(this.stores),this.#f=!1,this.#p)}async generateShareableLink(_e=!1){if(!this.#h&&this.#u)LOGGER$1.info({title:"Reusing the cached configuration ID that was last saved..."});else{LOGGER$1.info({title:"Generating a new configuration ID..."});let zt=this.stores.attachmentStore.getState().actions.export(),jt=await this.stores.nexusApiInstance.postExperienceSaveAndShare(this.experienceId,zt);this.#u=jt.payload.save_id}const Dt=window.location.href;let Vt=new URL(Dt);_e===!0&&Vt.searchParams.set("launchInAR",!0),Vt.searchParams.set("projectId",this.projectId),Vt.searchParams.set("epgsharedconfigid",this.#u),this.#h=!1;let Gt=Object.assign({},CONFIGURATOR_SCENE_SHARED);return Gt.parameters={shared_url:`${Vt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt),Vt.href}closeContextMenu(){this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem()}updatePreloadProgress(_e){const Dt=this.#n;this.#n=_e;const Vt=new CustomEvent("preload:update",{detail:{progress:this.#n}});window.dispatchEvent(Vt),typeof this.#s=="function"&&this.#s(Dt,_e)}alert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt=!1,alertId:jt}){this.stores.coreSceneStore.getState().actions.sendAlert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt,alertId:jt})}removePersistantAlert(){this.stores.coreSceneStore.setState({persistantAlertData:null})}clickHotspot(_e){let Dt=this.coreWCRef.shadowRootRef.getElementById(_e);Dt&&Dt.click()}exitHotspot(){this.stores.hotspotStore.getState().actions.exitHotspot(!1)}isSystemBusy(){return this.stores.itemStore.getState().isBusy()}async spawnGhostsForSkuID(_e,Dt=!1,Vt){return this.isSystemBusy()?null:await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(_e,Dt,Vt)}removeAllGhosts(){if(this.stores.itemStore.getState().isBusy())return null;this.stores.ghostStore.getState().actions.clearAllGhosts()}printSceneHierarchy(_e=!1){const Dt=this.stores.coreSceneStore.getState().sceneRef;(function Vt(Gt){const zt=`${Gt.name} < ${Gt.type} >`;_e===!0?console.groupCollapsed(zt):console.group(zt),Gt.children.forEach(Vt),console.groupEnd()})(Dt)}getSceneItems(){const _e=this.stores.itemStore.getState().itemsSpawned;if(typeof _e!="object"){LOGGER$1.error({title:"There was an error while fetching the scene item count."});return}return _e}getSceneItemCount(){let _e;const Dt=this.stores.itemStore.getState().itemsSpawned;return typeof Dt!="object"&&LOGGER$1.error({title:"There was an error while fetching the scene item count."}),_e=Object.keys(Dt).length,_e}async spawnItemBySkuID(_e,Dt=!1){if(this.isSystemBusy())return null;const Vt=this.getActiveGhostData();return Vt&&Vt.skuID!==_e?null:(Dt===!0&&!Vt&&await this.spawnGhostsForSkuID(_e,!1,1),await this.stores.itemStore.getState().actions.addItemBySkuID(_e,0))}async spawnItemBySkuIDAndGhostIndex(_e,Dt=0){if(this.stores.itemStore.getState().isBusy())return null;let Vt=null;const Gt=this.getActiveGhostData();return Dt>=0&&Gt.count>Dt&&Gt.skuID==_e&&(Vt=await this.stores.itemStore.getState().actions.addItemBySkuID(_e,Dt)),Vt}async replaceItemBySkuId(_e,Dt){return await this.stores.itemStore.getState().actions.replaceGuidItemBySkuId(_e,Dt)}async replaceItemsBySkuId(_e,Dt){if(!Array.isArray(_e))throw new Error("guids parameter must be an array");try{for(const Vt of _e)await this.replaceItemBySkuId(Vt,Dt);return!0}catch(Vt){throw new Error(`Failed to replace items by SKU ID: ${Vt.message}`)}}async replaceAllItemsBySkuId(_e,Dt){const Vt=[],Gt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Gt).map(zt=>{Gt[zt].itemData.skuID==_e&&Vt.push(zt)});try{for(const zt of Vt)await this.replaceItemBySkuId(zt,Dt);return!0}catch(zt){throw new Error(`Failed to replace items by SKU ID: ${zt.message}`)}}async removeItemByGUID(_e,Dt=!1){if(this.stores.itemStore.getState().isBusy())return null;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return Dt===!1&&Gt.canSwapRoot===!0&&Gt.swapRoot(),await this.stores.itemStore.getState().actions.removeItemByGUID(_e)}triggerItemRemoveModal(_e){const Dt=this.getGuidItemAttachedDependencies(_e);Dt&&this.fireEvent(this.EVENTS.SCENE.ItemRemoveModalTriggered,Dt)}async updateFittingSkuIds(){await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}rotateItemByGUID(_e){this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(_e)}rotateSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER$1.info({title:"No current item selected to rotate"});return}const Dt=_e.itemData.guid;return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(Dt),_e}removeLastItemBySkuId(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=Object.keys(Dt);for(let Gt=Vt.length-1;Gt>=0;Gt--){const zt=Vt[Gt];if(Dt[zt].itemData.skuID===_e){this.doesGuidItemHaveAnAttachedDependency(zt)?(this.selectItemWithGUID(zt),this.triggerItemRemoveModal(zt)):this.removeItemByGUID(zt);break}}}async removeSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER$1.info({title:"No current item selected to delete"});return}const Dt=_e.itemData.guid;return this.stores.itemStore.getState().actions.deselectItem(),await this.removeItemByGUID(Dt),LOGGER$1.info({title:`Removed Item: ${Dt}`}),_e}refocus(){this.stores.coreSceneStore.getState().actions.triggerAutoFocus()}getActiveGhostData(){return this.stores.ghostStore.getState().ghostData}focusOnGhosts(){if(this.stores.ghostStore.getState().ghostParentRef===null){LOGGER$1.warn({title:"Ghost Parent Reference not found"});return}this.stores.ghostStore.getState().ghostParentRef.children.length<=0?this.stores.coreSceneStore.getState().actions.triggerAutoFocus():this.stores.coreSceneStore.getState().actions.triggerAutoFocus(this.stores.ghostStore.getState().ghostParentRef)}exitSelectedItem(){this.stores.itemStore.getState().actions.deselectItem()}getSelectedItemData(){return this.stores.itemStore.getState().selectedItemData}canSelectedItemRotate(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRotate:!1}canSelectedItemBeRemoved(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRemove:!1}canSelectedItemDrag(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(_e){let Dt=!0;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e),zt=Gt.isEndNode;return Dt=!zt,zt||Gt.canSwapRoot&&Gt.whichNodesAreAttachedToUs().length==1&&(Dt=!1),Dt}getGuidItemAttachedDependencies(_e){const Dt=this.stores.attachmentStore.getState().attachmentSystem,Vt=this.stores.itemStore.getState().itemsSpawned,Gt=Dt.currentStructure.getNodeByGUID(_e);if(!Gt)return;let zt={[Gt.guid]:{...Vt[Gt.guid]}};return Gt.getAllBranchedNodesAttachedToUs().forEach(Ht=>{zt[Ht.guid]=Vt[Ht.guid]}),zt}doesSelectedItemHasAttachedDependency(){const _e=this.getSelectedItemData();return _e?this.doesGuidItemHaveAnAttachedDependency(_e.itemData.guid):!1}isSelectedItemAnEndNode(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return this.stores.lightStore.getState().envMapUrl}async switchGlobalGeometryVariant(_e,Dt){if(!_e){LOGGER$1.WARN({title:"Geometry Category: '"+_e+"' not valid!"});return}this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalGeometryVariant(_e,Dt),await wait(1);let Vt=Object.assign({},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED);Vt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt);const zt=this.stores.productDataStore.getState().categoryData.geometryVariants;let jt=null;if(zt.map(Wt=>{Wt.id==_e&&(jt=Wt)}),!jt)return;const Ht=jt.variants[Dt];this.alert({alertMsg:jt.label.charAt(0).toUpperCase()+jt.label.slice(1)+" was successfully switched to "+Ht.label.charAt(0).toUpperCase()+Ht.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${jt.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(_e,Dt=""){if(!_e){LOGGER$1.WARN({title:"Look Category: '"+_e+"' not valid!"});return}this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),LOGGER$1.info({title:`Changing Global Variant: Category: ${_e} Id: ${Dt}`}),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalVariant(_e,Dt),await wait(1);let Vt=Object.assign({},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED);Vt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Vt)}async overrideSelectedItemMaterial(_e=""){return this.stores.itemStore.getState().selectedItemData?(await this.stores.itemStore.getState().actions.switchToVariant(this.stores.itemStore.getState().selectedItemData.itemData,_e,!0),!0):!1}async overrideItemMaterialByGuid(_e,Dt){const Vt=this.stores.itemStore.getState().itemsSpawned[_e];if(!Vt)return LOGGER$1.warn({title:"Item with guid: "+_e+" doesn't exist"}),!1;await this.stores.itemStore.getState().actions.switchToVariant(Vt.itemData,Dt,!0);let Gt=Object.assign({},CONFIGURATOR_LOCAL_VARIANT_SWITCHED);return Gt.parameters={variant:`${Dt}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt),!0}getSelectedItemColors(){let _e=[];if(this.getSelectedItemData()==null)return _e;let Vt=this.getSelectedItemData().itemData.looks;if(Vt){let Gt=this.stores.productDataStore.getState().lookData;Vt.map(zt=>{Gt.hasOwnProperty(zt)&&_e.push(Gt[zt])})}return _e}getCanvasSize(){return this.stores.coreSceneStore.getState().canvasSize}async removeAllVariantOverrides(){return this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(_e){this.stores.coreSceneStore&&this.stores.coreSceneStore.getState().actions.switchCursor(_e)}getSceneStructure(){return this.stores.attachmentStore.getState().actions.export()}getSceneStructureRaw(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure}getAllConnectionsInScene(){const _e=this.getSceneStructureRaw(),Dt=new Map;for(const Vt of _e.nodes)for(const Gt of Vt.plugs){if(!Gt.attachedPlugGUID)continue;const zt=[Gt.guid,Gt.attachedPlugGUID].sort().join();Dt.has(zt)||Dt.set(zt,{from:Gt,to:Gt.attachedPlug})}return Dt}async loadSceneFromConfiguration(_e){await this.stores.attachmentStore.getState().actions.loadStructure(_e)}async loadSceneFromConfigurationID(_e,Dt=!0){const Vt=await this.stores.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e);if(!Vt)return null;Dt===!0&&this.stores.attachmentStore.setState({defaultConfig:Vt});let Gt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);Gt.label=`Preconfig ID: ${_e}`,await this.loadSceneFromConfiguration(Vt)}viewInYourSpace(){LOGGER$1.info({title:"View in your space called from the Core API"});let _e=Object.assign({},CONFIGURATOR_AR_REQUESTED);_e.label="AR Requested",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e),this.#r.epigraphViewInYourSpaceRef.onViewInYourSpaceButtonClicked()}async shareScene(){const _e=await this.generateShareableLink();let Dt=Object.assign({},CONFIGURATOR_SCENE_SHARED);return Dt.parameters={shared_url:`${_e}`,project_id:`${this.#e}`},this.sendAnalyticsEvent(Dt),_e}async clearScene(){return await this.stores.attachmentStore.getState().attachmentSystem.clear()}async restartScene(){LOGGER$1.info({title:"Restarting Scene."}),await this.stores.attachmentStore.getState().attachmentSystem.restart();let _e=Object.assign({},CONFIGURATOR_SCENE_RESTARTED);_e.label="Scene Restarted",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}areDimensionsVisible(){return this.stores.coreSceneStore.getState().showDimensions}getCurrentDimensions(){return this.stores.coreSceneStore.getState().boundData}getActiveHotspot(){return this.stores.hotspotStore.getState().activeHotspotData}reviewCartShown(){let _e=Object.assign({},CONFIGURATOR_REVIEW_CART_SHOWN);_e.label="Review Cart shown",_e.parameters={project_id:`${this.#e}`},this.fireEvent(this.EVENTS.UI.ReviewCart_Shown,_e),this.sendAnalyticsEvent(_e)}isGeometryVisibleForGUID(_e,Dt){const Vt={success:!1,result:!1},zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);return zt.ref&&zt.ref.traverse(jt=>{jt.name===_e&&(console.log(jt),Vt.success=!0,Vt.result=jt.visible)}),Vt}reviewCartHidden(){let _e=Object.assign({},CONFIGURATOR_REVIEW_CART_HIDE);_e.label="Review Cart hidden",_e.parameters={project_id:`${this.#e}`},this.fireEvent(this.EVENTS.UI.ReviewCart_Hidden,_e),this.sendAnalyticsEvent(_e)}sendShowInstructionsBtnAnalyticsEvent(){let _e=Object.assign({},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED);_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}sendInstructionsAnalyticsCompletionRate(_e){let Dt=Date.now()-this.#l,Vt=Math.round(Dt/1e3);this.#l=Date.now();let Gt=Object.assign({},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE);Gt.parameters={completion_rate:_e,time_spent:Vt,project_id:`${this.#e}`},this.sendAnalyticsEvent(Gt)}showInstructions(){this.fireEvent(this.EVENTS.UI.Instructions_Show),this.#l=Date.now();let _e=Object.assign({},CONFIGURATOR_INSTRUCTIONS_SHOWN);_e.label="Instructions shown",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}showDimensions(){this.stores.coreSceneStore.setState({showDimensions:!0});let _e=Object.assign({},CONFIGURATOR_DIMENSION_SHOWN);_e.label="Dimensions shown",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}hideDimensions(){this.stores.coreSceneStore.setState({showDimensions:!1});let _e=Object.assign({},CONFIGURATOR_DIMENSION_HIDE);_e.label="Dimensions hidden",_e.parameters={project_id:`${this.#e}`},this.sendAnalyticsEvent(_e)}areHotspotsVisible(){return this.stores.hotspotStore.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return this.stores.hotspotStore.getState().hotspotsTempVisibility}showAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!0,_e)}hideAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!1,_e)}getFittingSkuIds(){return this.stores.attachmentStore.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);this.stores.itemStore.getState().actions.setSelectedItemData({...Dt[_e],overrideVariant:Vt.overrideVariant,currentVariant:Vt.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((_e,Dt)=>{this.coreWCRef.addEventListener(this.EVENTS.CONFIGURATION.CameraDetails_Update,Vt=>{_e(Vt.data)},{once:!0}),this.stores.cameraStore.getState().actions.triggerFetchingCamera()})}moveCamera(_e,Dt,Vt=!0){this.stores.hotspotStore.setState({isAnyHotspotActive:!0}),_e&&this.stores.cameraStore.setState({viewPointPosition:ArrToVec3(_e)}),Dt&&this.stores.cameraStore.setState({focusPointPosition:ArrToVec3(Dt)}),this.stores.cameraStore.setState({resetToLastPosition:Vt})}setEnvLightMap(_e){this.stores.lightStore.setState({envMapUrl:_e})}updateInventoryForAllProducts(_e){return this.stores.inventoryStore.getState().actions.updateInventoryForAllProducts(_e),this.getInventoryInfo()}getInventoryInfo(){return JSON.parse(JSON.stringify(this.stores.inventoryStore.getState().inventoryData))}updateCompareAtPricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}updatePricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}async updateCompareAtPricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}async updatePricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}updatePricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}updateCompareAtPricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}async updatePricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}async updateCompareAtPricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}getCurrentPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentPricingInfo()}getCurrentCompareAtPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentCompareAtPricingInfo()}async itemDragStart(_e){if(this.stores.itemStore.getState().isBusy())return null;this.stores.coreSceneStore.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:_e}),await this.spawnGhostsForSkuID(_e,!1)}async itemDragEnd(){if(this.stores.itemStore.getState().isBusy())return null;const _e=this.stores.coreSceneStore.getState().hoveredGhostIndex;_e!==-1?await this.stores.itemStore.getState().actions.addItemBySkuID(this.stores.coreSceneStore.getState().itemDraggedSkuID,_e):await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(_e,Dt){const Vt=this.stores.productDataStore.getState().productData,Gt=this.stores.attachmentStore.getState().attachmentSystem;if(!Gt)return;const zt=Gt.currentStructure;if(!zt)return;let jt=zt.getNodeByGUID(Dt);jt?(jt._skuID=_e,jt.generatePlugsForNode(_e)):(jt=new Node$1(this.stores,_e,{guid:Dt,isEndNode:!0,overrideVariant:null,plugs:Vt[_e].plugs}),zt.addNode(jt),zt.connectPlugs({incomingPlug:new Plug({name:"tempPlug",acceptedPlugTypes:[],connectsToPlugTypes:[]},jt),receiverPlug:zt.rootNode.plugs[0]}));const Ht=await this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},_e,Dt);return await wait(1),Ht}async getScreenshotForCurrentCamera(_e){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(null,_e)}async getScreenshotForCamera(_e,Dt){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(_e,Dt)}async getAllPredefinedScreenshots(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings.screenshotCameras,Vt=[];for(const Gt of Dt){const zt=await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(Gt,_e);Vt.push(zt)}return Vt}setCameraFocusPointPosition(_e){this.stores.cameraStore.setState({focusPointPosition:_e})}triggerFetchingCamera(){this.stores.cameraStore.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await this.stores.coreSceneStore.getState().actions.completeDropItem()}revertItemDrop(){this.stores.coreSceneStore.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return this.stores.cameraStore.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(_e){if(this.epigraphAnalytics!==null)try{this.epigraphAnalytics.sendEvent(_e)}catch{LOGGER$1.info()}}isIosDevice(){return IS_IOS}actionButtonClicked(_e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:_e.actionButton.data,skuID:_e.skuID,count:_e.count,price:_e.price,compareAtPrice:_e.compareAtPrice,countAvailable:_e.countAvailable,countUnavailable:_e.countUnavailable,currentVariant:_e.currentVariant})}setCartMessage(_e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:_e})}convertQuaternionToEuler(_e){return new Euler(0,0,0,"XYZ").setFromQuaternion(_e)}convertDegreeToRadians(_e){return MathUtils.degToRad(_e)}convertRadiansToDegree(_e){return MathUtils.radToDeg(_e)}createVector3(_e,Dt,Vt){return new Vector3(_e,Dt,Vt)}isFacingInDirection(_e,Dt){return ConfiguratorCoreAPI.forwardVector3.set(0,0,1),Dt.normalize(),ConfiguratorCoreAPI.forwardVector3.applyQuaternion(_e),ConfiguratorCoreAPI.forwardVector3.dot(Dt)>=0}}const EpigraphConfiguratorCore=reactExports.forwardRef(({customVersionId:kt,experienceId:_e,stores:Dt,viewInYourSpaceRef:Vt,configuratorWcRef:Gt,initialConfigId:zt,clientAccessKey:jt,consentPlugin:Ht,consentIdentifier:Wt,gaMeasurementId:qt,builderMode:Xt,id:Kt,disableCart:Yt,apiMode:Zt},Jt)=>{const[nn,rn]=reactExports.useState(null);reactExports.useEffect(()=>{Jt.current&&(Jt.current.identifier="wc-epigraph-configurator-core",Jt.current.epigraphViewInYourSpaceRef=void 0,Jt.current.initialConfigId="",Jt.current.clientAccessKey="",Jt.current.consentPlugin="",Jt.current.consentIdentifier="",Jt.current.gaMeasurementId="",Jt.current.configuratorWcRef=void 0,Jt.current.builderMode=!1,Jt.current.projectId="",Jt.current.api=null,Jt.current.api=new ConfiguratorCoreAPI(Dt,Jt.current),Dt.coreSceneStore.setState({CORE_API:Jt.current.api}),en(Jt.current))},[Jt]),reactExports.useEffect(()=>{Jt.current&&Vt&&(Vt.current&&(Jt.current.epigraphViewInYourSpaceRef=Vt.current),LOGGER$1.info({title:"ViewInYourSpace is now accessible from the core: "}))},[Jt,Vt]);const Qt=reactExports.useCallback(tn=>{Gt&&(tn.configuratorWCRef=Gt,tn.shadowRootRef=tn.configuratorWCRef.shadowRoot,tn.api.shadowRootRef=tn.shadowRootRef,tn.api.configuratorWCRef=tn.configuratorWCRef),kt&&(tn.customVersionId=kt),zt&&(tn.initialConfigId=zt),jt&&(tn.clientAccessKey=jt),Ht&&(tn.consentPlugin=Ht),Wt&&(tn.consentIdentifier=Wt),qt&&(tn.gaMeasurementId=qt),Xt&&(tn.builderMode=!0),LOGGER$1.group("Collected Web Component Attributes"),LOGGER$1.table({initialConfigId:tn.initialConfigId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,builderMode:tn.builderMode}),LOGGER$1.groupEnd()},[Xt,zt,qt,jt,Gt]),en=reactExports.useCallback(async tn=>{if(tn.coreReady===!0)return;Qt(tn);let sn=kt;!sn&&IS_DEV_ENV&&(sn="latest");let cn={};if(Zt==="input.json"?cn={payload:{project_id:"local-project",experience_id:"",configurator_data:await __vitePreload(()=>import("./input-afb87ea8.js"),[]),session_details:{environment:"development"}},report:"Local Input Json",success:!0}:jt?cn=await Dt.nexusApiInstance.getConfiguratorByClientAccessKey(jt,sn):cn=await Dt.nexusApiInstance.getConfiguratorByExperienceId(_e,sn),tn.validationPassed=cn.success,tn.validationPassed==!1){LOGGER$1.error({title:"Request from an invalidated source: "+window.location.href}),Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:failed");return}Dt.nexusApiResponseEnvironment=cn.payload.session_details.environment,tn.projectId=cn.payload.project_id,tn.experienceId=cn.payload.experience_id,Dt.experienceId=cn.payload.experience_id,tn.api.projectId=tn.projectId,tn.api.experienceId=tn.experienceId;const un=cn.payload.configurator_data,hn={gaMeasurementId:tn.gaMeasurementId??void 0,epgExperienceID:tn.experienceId??void 0};Dt.coreSceneStore.getState().CORE_API.initializeAnalytics(hn,IS_DEV_ENV);let dn=Object.assign({},CONFIGURATOR_LOADING);dn.parameters={project_id:`${tn.projectId}`},Dt.coreSceneStore.getState().CORE_API.sendAnalyticsEvent(dn),LOGGER$1.info({title:"VALIDATION SUCCESSFUL!"}),tn.coreReady=!0;let pn=new URL(window.location).searchParams;pn.has("epgsharedconfigid")&&(tn.initialConfigId=pn.get("epgsharedconfigid")),rn({projectId:tn.projectId,parsedData:un,customVersionId:tn.customVersionId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,initialConfigId:tn.initialConfigId,builderMode:tn.builderMode})},[]);return reactExports.useEffect(()=>()=>{Dt.coreSceneStore.getState().CORE_API&&Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:shutDown")},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{id:Kt,ref:Jt,children:nn&&jsxRuntimeExports.jsx(App$1,{parsedData:nn.parsedData,stores:Dt,clientAccessKey:nn.clientAccessKey,consentPlugin:nn.consentPlugin,consentIdentifier:nn.consentIdentifier,initialConfigId:nn.initialConfigId,builderMode:nn.builderMode,disableCart:Yt!==void 0?Yt:!1})})})}),ViewInYourSpace=React.forwardRef((kt,_e)=>{const[Dt,Vt]=reactExports.useState(!1),[Gt,zt]=reactExports.useState(!1),jt=reactExports.useRef(null),Ht=reactExports.useRef(null),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.stores.uiSceneStore(qn=>qn.dialogPopupOpen),Qt=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),en=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),tn=()=>{kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"])};reactExports.useEffect(()=>{!_e.current||!jt.current||!Ht.current||!Wt.current||!qt.current||!Xt.current||!Kt.current||!Yt.current||!Zt.current||!Jt.current||!nn.current||(tn(),_e.current.getQRForURL=async(qn,tr)=>await Pn(qn,tr),_e.current.onViewInYourSpaceButtonClicked=async qn=>await yn(),_e.current.assetSrc="",_e.current.iosAssetSrc="",_e.current.arLink="",_e.current.coreApi=void 0,_e.current.arInProgress=!1,_e.current._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",_e.current._modelViewer=null,_e.current._qrModalContainer=null,fn(),dn(),un(),_e.current._modelViewer.addEventListener("error",qn=>{Cn(qn)}),_e.current._viewInYourSpaceButton.addEventListener("click",qn=>{yn()}),_e.current.canLaunchAR=sn)},[_e,jt,Ht,Wt,qt,Xt,Kt,Yt,Zt,Jt,nn]);const sn=reactExports.useCallback(()=>_e.current._modelViewer.canActivateAR,[]);reactExports.useEffect(()=>{_e.current&&(kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"]),kt["core-api"]&&(_e.current.coreApi=kt["core-api"]),cn())},[_e,kt]);const cn=()=>{_e.current._modelViewer.setAttribute("src",_e.current.assetSrc),_e.current._modelViewer.setAttribute("ios-src",_e.current.iosAssetSrc),_e.current._modelViewer.style.display="none"},un=()=>{window.customElements.get("model-viewer")===void 0&&hn(),En(),cn(),_e.current._modelViewer.addEventListener("ar-status",qn=>{qn.detail.status==="session-started"?(_e.current._modelViewer.style.display="block",_e.current.arInProgress=!0):(qn.detail.status==="not-presenting"||qn.detail.status==="failed")&&(_e.current._modelViewer.style.display="none",_e.current.arInProgress=!1)})},hn=()=>{_e.current._modelViewerScriptElem=document.createElement("script"),_e.current._modelViewerScriptElem.setAttribute("type","module"),_e.current._modelViewerScriptElem.setAttribute("src",_e.current._modelViewerScriptSource),_e.current._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(_e.current._modelViewerScriptElem)},dn=()=>{_e.current._qrModalContainer=qt.current,_e.current._qrCodeImage=Xt.current,_e.current._arLink=Kt.current,_e.current._qrLoader=Yt.current,_e.current.doneViewInYourSpaceBtn=Zt.current,_e.current.doneViewInYourSpaceBtn.addEventListener("click",()=>{pn(),Tn()})},pn=async()=>{if(_e.current._qrCodeImage!==null)for(;_e.current._qrCodeImage.firstChild;)_e.current._qrCodeImage.removeChild(_e.current._qrCodeImage.firstChild)},fn=()=>{_e.current.arDrawer=jt.current,_e.current._launchARButton=Ht.current,_e.current._modelDownloadLoader=Wt.current,_e.current._launchARButton.addEventListener("click",()=>{_e.current.arInProgress!==!0&&Rn()})},mn=()=>{_e.current._modelDownloadLoader.classList.remove("loader-hide")},vn=()=>{_e.current._modelDownloadLoader.classList.add("loader-hide")},_n=()=>{zt(!0),xn(),_e.current.arDrawer.show()},En=()=>{_e.current._modelViewer=Jt.current,_e.current._viewInYourSpaceButton=nn.current},An=()=>{Vt(!0),_e.current._qrModalContainer.show()},Tn=()=>{Vt(!1),_e.current._qrModalContainer.hide()},Cn=qn=>{console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
4650
4650
  Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(qn),console.error("===============================================================")},yn=qn=>{_e.current.canLaunchAR()===!0?Sn():Fn()},Sn=async qn=>{if(_n(),await wait(1e3),_e.current.coreApi.isIosDevice()){_e.current.iosAssetSrc=await _e.current.coreApi.getSceneAsUsdzUrl(kt.stores);const tr=`${GENERIC_PROJECT_ASSET_DATA_ROOT_URL}/3d-assets/proxy/null-product-proxy.glb`;_e.current.assetSrc=tr}else _e.current.assetSrc=await _e.current.coreApi.getSceneAsGlbUrl(kt.stores);cn(),wn()},wn=()=>{_e.current._launchARButton.disabled=!1,vn()},xn=()=>{_e.current._launchARButton.disabled=!0,mn()},Rn=()=>{_e.current._modelViewer.activateAR()},Dn=()=>{_e.current._qrLoader.classList.remove("loader-hide")},kn=()=>{_e.current._qrLoader.classList.add("loader-hide")},Fn=async()=>{_e.current._qrCodeImage.classList.add("img-hide"),_e.current._qrCodeImage.setAttribute("src",""),Dn(),An(),await Bn(_e.current._qrCodeImage),_e.current._qrCodeImage.classList.remove("img-hide"),kn()},Pn=async(qn,tr)=>{QrCreator$1.render({text:qn,radius:.25,ecLevel:"H",fill:"#000000",background:null,size:200},tr),await wait(250)},Bn=async qn=>{_e.current.arLink=await _e.current.coreApi.generateShareableLink(!0),await _e.current.getQRForURL(_e.current.arLink,qn)};return jsxRuntimeExports.jsxs("div",{...kt,ref:_e,children:[jsxRuntimeExports.jsxs("button",{tabIndex:rn?-1:0,id:"viewInYourSpaceButton",ref:nn,className:"viewInYourSpaceButton",children:[jsxRuntimeExports.jsx("img",{alt:"Close",src:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",onError:qn=>{qn.target.src="https://placehold.co/150"}}),"VIEW IN YOUR SPACE"]}),jsxRuntimeExports.jsx("model-viewer",{ref:Jt,ar:!0,"ar-modes":"webxr scene-viewer quick-look","ar-scale":"fixed","ar-placement":kt.arplacement,src:"",alt:"Epigraph View In Your Space","camera-controls":!0,style:{visibility:"hidden"}}),jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:Gt,id:"arDrawer",ref:jt,children:jsxRuntimeExports.jsxs("div",{className:"launch-ar-content-container",children:[jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-title",children:"View In Your Space®"}),jsxRuntimeExports.jsxs("div",{className:"launch-ar-bottom-content-container",children:[jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-instruction",children:"Click the “Launch AR” button below to begin viewing this product in your space."}),jsxRuntimeExports.jsxs("div",{className:"launch-ar-button-container",children:[jsxRuntimeExports.jsx("img",{id:"modelDownloadLoader",ref:Wt,alt:"Loading...",draggable:"false",className:"spinner-loader",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:qn=>{qn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("button",{tabIndex:Gt?0:-1,className:"launch-ar-button",id:"launchARButton",ref:Ht,children:"Launch AR"})]}),jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-requirement",children:en})]}),jsxRuntimeExports.jsxs("div",{id:"arSessionError",className:"launch-ar-modal-error launch-ar-modal-error-hide",children:[" ","Uh Oh! Looks like there was a problem while loading the AR session."," "]})]})}),jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:Dt,id:"qrModalContainer",ref:qt,onExit:pn,children:jsxRuntimeExports.jsxs("div",{className:"qr-content-container",children:[jsxRuntimeExports.jsxs("div",{className:"QR-Parent",children:[jsxRuntimeExports.jsx("div",{id:"qrCodeImage",ref:Xt,className:"qr-code-image"}),jsxRuntimeExports.jsx("img",{id:"qrLoader",ref:Yt,alt:"Loading...",draggable:"false",className:"spinner-loader",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:qn=>{qn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("div",{id:"arLink",ref:Kt})]}),jsxRuntimeExports.jsxs("div",{className:"QR-Content-Parent",children:[jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-title",children:"Scan QR code"}),jsxRuntimeExports.jsxs("div",{className:"qr-ar-bottom-content-container",children:[jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-instruction",children:"Using your mobile device camera, scan the QR code and follow the on-screen directions to view this item in your space."}),jsxRuntimeExports.jsx("div",{className:"launch-ar-button-container",children:jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Done Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"launch-ar-button",id:"doneViewInYourSpaceBtn",ref:Zt,children:"Done"})}),jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-requirement",children:Qt})]})]}),jsxRuntimeExports.jsxs("div",{id:"arSessionError",className:"launch-ar-modal-error launch-ar-modal-error-hide",children:[" ","Uh Oh! Looks like there was a problem while loading the AR session."," "]})]})})]})}),UI_LOCAL_STYLES=[{id:"variables",contents:StyleVariables},{id:"styles",contents:GenericStyles$1},{id:"accordion",contents:AccordionStyles},{id:"productFeaturesUI",contents:FeaturesUiStyles},{id:"sideMenuContent",contents:SideMenuContentStyles},{id:"build",contents:BuildStyles},{id:"mobile",contents:MobileStyles$1},{id:"bottomDrawer",contents:BottomDrawerStyles},{id:"fullScreenModal",contents:FullScreenModalStyles},{id:"viewInYourSpace",contents:ViewInYourSpaceStyles},{id:"instructionsModal",contents:InstructionsModalStyles}];function App({stores:kt,customVersionId:_e,experienceId:Dt,disableUI:Vt,disableCart:Gt,configuratorWcRef:zt,gaMeasurementId:jt}){const Ht=kt.itemStore(cn=>cn.itemsSpawned),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=kt.coreSceneStore(cn=>cn.coreReady),Yt=kt.uiSceneStore(cn=>cn.CORE_API),Zt=kt.uiSceneStore(cn=>cn.cssLoaded),Jt=kt.coreSceneStore(cn=>cn.sceneSettings?.arPlacement),nn=kt.uiSceneStore(cn=>cn.setCSSLoaded),rn=reactExports.useRef(null);addCoreEventListener(kt,"coreApi:ready",cn=>{const un=cn.categoryData.geometryVariants;Object.keys(kt.colorStore.getState().allActiveGeometryVariants).length==0&&un.map(dn=>kt.colorStore.getState().allActiveGeometryVariants[dn.id]=Object.keys(dn.variants)[0]);const hn=cn.categoryData.color;if(Object.keys(kt.colorStore.getState().allActiveVariants).length==0&&hn.map(dn=>kt.colorStore.getState().allActiveVariants[dn.id]=dn.looks[0]),cn.configuration&&cn.configuration.globalVariants){const dn=cn.configuration.globalVariants;Object.keys(dn).map(pn=>{kt.colorStore.getState().allActiveVariants[pn]=dn[pn]}),kt.colorStore.setState({allActiveVariants:{...kt.colorStore.getState().allActiveVariants}})}Xt.current.coreApi=Wt.current.api,kt.coreSceneStore.setState({coreReady:!0})}),addCoreEventListener(kt,"coreApi:failed",cn=>{zt.showHiccupScreen(`AUTHENTICATION FAILED FOR: ${window.location.href}`),kt.coreSceneStore.setState({coreReady:!1})}),reactExports.useEffect(()=>{Qt(Ht)},[Ht]),addCoreEventListener(kt,"globalGeometryVariant:updated",cn=>{kt.colorStore.setState({allActiveGeometryVariants:{...cn}});const un=kt.itemStore.getState().itemsSpawned;Qt(un)}),addCoreEventListener(kt,"globalVariant:updated",cn=>{kt.colorStore.setState({allActiveVariants:{...cn}})}),addCoreEventListener(kt,"cartMessage:updated",cn=>{kt.uiSceneStore.setState({cartMessage:cn.cartMessage})});const Qt=cn=>{let un=[],hn=[];const dn=kt.colorStore.getState().allActiveGeometryVariants;Object.keys(cn).map(pn=>{let fn=cn[pn];fn.hotspotsData&&fn.hotspotsData.map(mn=>{if(mn.geometryVariantID){let vn=!1;if(Object.keys(dn).map(_n=>{mn.geometryVariantID==dn[_n]&&(vn=!0)}),vn===!1)return}mn.categoryID!==""&&hn.includes(mn.categoryID)||(hn.push(mn.categoryID),un=[...un,{itemData:{...cn[pn].itemData},hotspotData:{...mn}}])})}),kt.uiSceneStore.setState({tabSpawnCount:un})};addCoreEventListener(kt,"cart:statusUpdated",cn=>{cn.disableCart!==void 0&&kt.uiSceneStore.setState({disableCart:cn.disableCart})}),addCoreEventListener(kt,"viewInYourSpace:hide",cn=>{kt.uiSceneStore.setState({viewInYourSpaceMenuBtnVisible:!1})}),addCoreEventListener(kt,"viewInYourSpace:show",cn=>{kt.uiSceneStore.setState({viewInYourSpaceMenuBtnVisible:!0})});const en=reactExports.useCallback(cn=>{let un=[];const hn=kt.productDataStore.getState().productData;cn.cartItems.forEach(dn=>{let pn={...dn},fn=hn[dn.skuID];pn.title=fn.lookDetails[dn.currentVariant].title,pn.subheading=fn.subheading,pn.subtitle=fn.lookDetails[dn.currentVariant].subtitle,pn.actionButton=fn.lookDetails[dn.currentVariant].actionButton,pn.thumbnails=fn.lookDetails[dn.currentVariant].thumbnails,un.push(pn)}),kt.cartStore.setState({cart:[...un]}),kt.cartStore.getState().actions.setCartTotalPrice(cn.details.total,cn.details.compareAtTotal)},[]),tn=reactExports.useCallback(async cn=>{if(!Yt)return;kt.uiSceneStore.setState({inventoryData:{...cn}});const un=await Yt.getCartItemsAsync();en(un)},[Yt]),sn=()=>(addCoreEventListener(kt,Yt.EVENTS.UI.PreloadScreen_Hide,()=>{zt.api.ui.hidePreloadScreen()}),addCoreEventListener(kt,Yt.EVENTS.UI.PreloadScreen_Show,()=>{zt.api.ui.showPreloadScreen()}),addCoreEventListener(kt,Yt.EVENTS.SCENE.CartItems_Updated,en),addCoreEventListener(kt,Yt.EVENTS.SCENE.Inventory_Updated,tn),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}));return reactExports.useEffect(()=>{const{current:cn}=Wt;cn&&(kt.uiSceneStore.setState({coreWCRef:cn}),zt.api.core=cn.api,zt.api.core.clientAccessKey=zt.clientAccessKey,zt.api.core.consentPlugin=zt.consentPlugin,zt.api.core.consentIdentifier=zt.consentIdentifier,kt.uiSceneStore.setState({CORE_API:cn.api}))},[Wt]),reactExports.useEffect(()=>{async function cn(){if(Zt===!1||Kt!==!0)return;const un=await Yt.getCartItemsAsync();en(un),zt.api.ui.hidePreloadScreen()}cn()},[Zt,Kt]),reactExports.useEffect(()=>{const{current:cn}=rn;if(!cn)return;let un=window.getComputedStyle(cn);kt.coreSceneStore.setState({dragImgElRef:cn});const hn=En=>{En.preventDefault();const An=kt.coreSceneStore.getState().mouseDownImgSrc;if(An){const Tn=kt.coreSceneStore.getState().pointerDownPos,Cn=kt.coreSceneStore.getState().moveThreshold,yn=kt.coreSceneStore.getState().mouseDragging,Sn=kt.coreSceneStore.getState().mouseDownSkuID;if(Math.abs(En.clientX-Tn)<=Cn)return;const{dragTimeout:xn}=kt.coreSceneStore.getState().sceneSettings,Rn=kt.coreSceneStore.getState().lastDragEndTime;if(Date.now()-Rn<xn)return;const Dn={x:En.offsetX,y:En.offsetY},kn=cn;kn.src=An,kn.style.opacity=.75,kn.style.left=`calc(${Dn.x}px - ${un.width})`,kn.style.top=`calc(${Dn.y}px - ${un.height})`,yn||(kt.coreSceneStore.setState({mouseDragging:!0}),kt.uiSceneStore.getState().CORE_API.itemDragStart(Sn))}},dn=()=>{if(kt.coreSceneStore.getState().mouseDownImgSrc){const An=kt.coreSceneStore.getState().mouseDragging,Tn=cn;Tn.style.opacity=0,An&&kt.uiSceneStore.getState().CORE_API.itemDragEnd(),kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,...An&&{lastDragEndTime:Date.now()}})}},pn=En=>{const An=kt.coreSceneStore.getState().mouseDownImgSrc;if(An){const Tn=kt.coreSceneStore.getState().pointerDownPos,Cn=kt.coreSceneStore.getState().moveThreshold,yn=kt.coreSceneStore.getState().mouseDragging,Sn=kt.coreSceneStore.getState().mouseDownSkuID;if(En.preventDefault(),Math.abs(En.touches[0].clientX-kt.wcRef.offsetLeft-Tn)<=Cn)return;const{dragTimeout:xn}=kt.coreSceneStore.getState().sceneSettings,Rn=kt.coreSceneStore.getState().lastDragEndTime;if(Date.now()-Rn<xn)return;const Dn={x:En.touches[0].clientX-kt.wcRef.offsetLeft,y:En.touches[0].clientY},kn=cn.parentElement.getBoundingClientRect().top,Fn=cn;if(Fn.src=An,Fn.style.opacity=.75,Fn.style.left=`calc(${Dn.x}px - ${un.width})`,Fn.style.top=`calc(${Dn.y}px - ${kn}px - ${un.height})`,!yn){kt.coreSceneStore.setState({mouseDragging:!0});const Pn=qt.current.getElementsByClassName("mobileGrid");for(let Bn=0;Bn<Pn.length;Bn++)Pn[Bn].style="overflow-x:hidden !important";kt.uiSceneStore.getState().CORE_API.itemDragStart(Sn)}}},fn=()=>{if(kt.coreSceneStore.getState().mouseDownImgSrc){const An=kt.coreSceneStore.getState().mouseDragging,Tn=cn;if(Tn.style.left="0px",Tn.style.top="0px",Tn.style.opacity=0,An){kt.uiSceneStore.getState().CORE_API.itemDragEnd();const Cn=qt.current.getElementsByClassName("mobileGrid");for(let yn=0;yn<Cn.length;yn++)Cn[yn].style="overflow-x:auto !important"}kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1,...An&&{lastDragEndTime:Date.now()}})}},mn=window.matchMedia("(orientation: portrait)");function vn(En){kt.uiSceneStore.setState({isScreenPortrait:En.matches})}vn(mn);const _n=kt.wcRef;return _n.addEventListener("mousemove",hn),window.addEventListener("mouseup",dn),_n.addEventListener("touchmove",pn,{passive:!1}),window.addEventListener("touchend",fn),mn.addEventListener("change",vn),()=>{const En=kt.wcRef;En&&(En.removeEventListener("mousemove",hn),En.removeEventListener("touchmove",pn)),window.removeEventListener("mouseup",dn),window.removeEventListener("touchend",fn),mn.removeEventListener("change",vn)}},[rn,qt,Yt]),jsxRuntimeExports.jsxs("div",{className:"configuratorParentDiv",style:{background:kt.cameraStore.getState().cameraSettings.clearColour},ref:qt,children:[Kt&&jsxRuntimeExports.jsx(sn,{}),jsxRuntimeExports.jsx(StyleManager,{stores:kt,containerId:"uiStylesContainer",localStyles:UI_LOCAL_STYLES,dynamicStylesId:"uiStyles",setCSSLoaded:nn}),jsxRuntimeExports.jsx("img",{id:"dragImgElRef",ref:rn,alt:"A placeholder holder element used for drag and drop functionality.",style:{backgroundImage:"url(https://placehold.co/150)"},onError:cn=>{cn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx(EpigraphConfiguratorCore,{stores:kt,ref:Wt,id:"epigraphConfiguratorCore",customVersionId:_e,experienceId:Dt,viewInYourSpaceRef:Xt,gaMeasurementId:jt,...Gt&&{disableCart:""},configuratorWcRef:zt,initialConfigId:zt.initialConfigId,clientAccessKey:zt.clientAccessKey,consentPlugin:zt.consentPlugin,consentIdentifier:zt.consentIdentifier,apiMode:zt.apiMode}),jsxRuntimeExports.jsx(ViewInYourSpace,{stores:kt,ref:Xt,id:"viewInYourSpace",arplacement:Jt}),Kt&&Zt&&jsxRuntimeExports.jsx("div",{className:"uiContainer",children:jsxRuntimeExports.jsx(OverlayUIManager$1,{stores:kt,configuratorWcRef:zt,coreRef:Wt,viewInYourSpaceRef:Xt,disableUI:Vt})})]})}const PRELOAD_MUTED_CSS=document.createElement("template");PRELOAD_MUTED_CSS.innerHTML=`
4651
4651
  <style>
4652
4652
  .preload-main-container{
@@ -4793,4 +4793,4 @@ ${zt.join(`
4793
4793
  There was a problem while trying to initialise the configurator.
4794
4794
  </div>
4795
4795
  </div>
4796
- `;const createCoreSceneStore=kt=>{const _e=coreStoreCreator();return _e.setState({stores:kt}),_e},coreStoreCreator=()=>create((kt,_e)=>({stores:null,shadowRefreshKey:0,CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,lastDragEndTime:0,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},technicalRequirements:{minIosVersion:"11"},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,dragThreshold:25,dragTimeout:250,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{arButtonLabel:"AR",arHoverLabel:"View In Your Space",restartButtonLabel:"Restart",restartHoverLabel:"Restart",saveButtonLabel:"Save",saveHoverLabel:"Save",shareButtonLabel:"Share",shareHoverLabel:"Share",sizeButtonLabel:"Size",sizeHoverLabel:"Size",hotspotsButtonLabel:"Hotspots",hotspotsHoverLabel:"Hotspots",instructionsButtonLabel:"Instructions",instructionsHoverLabel:"Instructions",cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",featuresTabEmptyText:"*Please add an item to the scene to see the features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},actions:{refreshShadows:()=>{const{shadowRefreshKey:Dt}=_e();kt({shadowRefreshKey:Dt+1})},popFromAlertQueue:()=>{const{alertQueue:Dt}=_e();return Dt.shift(),kt({alertQueue:Dt}),Dt},addToAlertQueue:Dt=>{const{alertQueue:Vt,currentAlertData:Gt}=_e();return Vt.length>0&&Vt[Vt.length-1].alertId&&Dt.alertId===Vt[Vt.length-1].alertId||Vt.length==0&&Gt&&Gt.alertId&&Gt.alertId==Dt.alertId||(Vt.push(Dt),kt({alertQueue:Vt})),Vt},getDeviceState:()=>{const{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}=_e();return{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}},enableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!1,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!0,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:Dt}=_e();return Dt},sendAlert:Dt=>{kt({alertData:{...Dt}})},switchCursor(Dt){const{cursorParentRef:Vt}=_e();if(!Vt)return;let Gt="";switch(Dt){default:case CURSORS.GRAB:Gt="grabCursor";break;case CURSORS.GRABBING:Gt="grabbingCursor";break;case CURSORS.BLOCKED:Gt="blockedCursor";break;case CURSORS.POINTER:Gt="pointerCursor";break;case CURSORS.MOVE:Gt="moveCursor";break}for(let zt=0;zt<Vt.classList.length;zt++)Vt.classList[zt].includes("Cursor")&&Vt.classList.remove(Vt.classList[zt]);Vt.classList.add(Gt)},setAlertSettings:Dt=>{kt({alertSettings:Dt})},async completeDropItem(){const{draggingOnDropCollisionData:Dt,CORE_API:Vt,stores:Gt}=_e(),zt=Gt.attachmentStore.getState().attachmentSystem,{node:jt,attachedChildrenGuids:Ht,collidingStatus:Wt,intersectingGhostObject:qt,initPosition:Xt,initRotation:Kt,detachedPlugs:Yt,attachedNodesToCurrentNode:Zt}=Dt;Vt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[Qt,en]of Ht.entries())Wt[Qt]===!0&&await Gt.itemStore.getState().actions.removeItemByGUID(en);const Jt=qt.userData;let nn=jt.getPlugByName(Jt.incomingPlugName),rn=zt.currentStructure.getPlugByGUID(Jt.receiverPlugGUID);jt.ref.position.set(qt.position.x,qt.position.y,qt.position.z),jt.ref.setRotationFromEuler(qt.rotation),jt.transform={position:qt.position,rotation:qt.quaternion},zt.currentStructure.connectPlugs({incomingPlug:nn,receiverPlug:rn}),Gt.ghostStore.getState().actions.clearAllGhosts(),Gt.itemStore.getState().actions.deselectItem(),Zt.map(Qt=>{jt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},jt.dragging=!1,Qt.dragging=!1}),await Gt.attachmentStore.getState().actions.updateFittingSkuIds()},async revertDropItem(){const{draggingOnDropCollisionData:Dt,stores:Vt}=_e(),Gt=Vt.attachmentStore.getState().attachmentSystem,{node:zt,attachedChildrenGuids:jt,collidingStatus:Ht,intersectingGhostObject:Wt,initPosition:qt,initRotation:Xt,detachedPlugs:Kt,attachedNodesToCurrentNode:Yt}=Dt;CORE_API.alert({alertMsg:"Position of item"+zt.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const Zt=Kt.neighbourDetachedPlugs;Zt&&(Kt.neighbourNode.detachNodeFromReceiver(),Gt.currentStructure.connectPlugs({incomingPlug:Zt.incomingPlug,receiverPlug:Zt.receiverPlug}));let Jt=Kt.rootDetachedPlugs.incomingPlug,nn=Kt.rootDetachedPlugs.receiverPlug;zt.ref.position.set(qt.x,qt.y,qt.z),zt.ref.setRotationFromEuler(Xt);let rn=new Quaternion().identity();zt.ref.getWorldQuaternion(rn),zt.transform={position:qt,rotation:rn},Gt.currentStructure.connectPlugs({incomingPlug:Jt,receiverPlug:nn}),Vt.ghostStore.getState().actions.clearAllGhosts(),Vt.itemStore.getState().actions.deselectItem(),Yt.map(Qt=>{zt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},zt.dragging=!1,Qt.dragging=!1}),await Vt.attachmentStore.getState().actions.updateFittingSkuIds()},setCoreSettings:Dt=>{const{sceneSettings:Vt,isMobile:Gt,isTouchDevice:zt,isLandscape:jt,actions:Ht}=_e(),Wt=Gt===!0?"mobile":"desktop",qt=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const Xt of qt)if(Xt==="draggableUI"||Xt==="clickToAddUi"||Xt==="emptySceneTextFontSize"||Xt==="showInstructionsOnStartup"||Xt==="showInstructionsBtn"||Xt==="instructionsSettings"){const Yt=`${Xt}_${jt===!1&&zt===!0?"mobile":"desktop"}`;Dt[Yt]!==void 0?Vt[Xt]=Dt[Yt]:Vt[Yt]!==void 0&&(Vt[Xt]=Vt[Yt])}else if(Xt==="textSettings"||Xt==="variantsTabOrder"||Xt==="alertControl"||Xt==="outlineSettings"){if(Dt.hasOwnProperty(Xt)){let Kt=Vt[Xt];Object.keys(Kt).map(Yt=>{let Zt=Dt[Xt];Zt.hasOwnProperty(Yt)?(Yt==="visibleEdgeColor"||Yt==="hiddenEdgeColor")&&(Zt[Yt]=new Color$1(Zt[Yt]).convertSRGBToLinear()):Zt[Yt]=Kt[Yt]})}}else{const Kt=`${Xt}_${Wt}`;if(Dt[Kt]!==void 0){let Yt=`${Xt}Btn`;Xt=="showContextMenu"&&(Yt=`${Xt}`),Vt[Yt]=Dt[Kt]}}Dt.disableCart===!0&&Ht.disableCart(),Object.keys(Dt).map(Xt=>Vt[Xt]=Dt[Xt]),Vt.emptySceneText===null&&(Vt.emptySceneTextFontSize=Gt?"1.2rem":"1.5rem",Vt.draggableUI===!0?Vt.emptySceneText="Drag an item here to get started":Vt.emptySceneText="Select an item to get started"),kt({sceneSettings:{...Vt,ghostThreeColor:{r:Vt.ghostColor.r/255,g:Vt.ghostColor.g/255,b:Vt.ghostColor.b/255,a:Vt.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:Vt.ghostColorOnHoverWithDraggableUi.r/255,g:Vt.ghostColorOnHoverWithDraggableUi.g/255,b:Vt.ghostColorOnHoverWithDraggableUi.b/255,a:Vt.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(Dt=null)=>kt(Vt=>({autoFocusRef:Dt,autoFocusTrigger:Vt.autoFocusTrigger+1})),requestNewScreenshot:async(Dt,Vt)=>{const{CORE_API:Gt}=_e();return new Promise(async(zt,jt)=>{LOGGER.info({title:"Taking a screenshot"});const{screenshotRenderer:Ht,sceneRef:Wt,screenshotCamera:qt,canvasSize:Xt}=_e(),Kt=await Gt.getCurrentCameraDetails();if(Ht.setClearColor(16777215),qt.copy(Kt),Dt!==null&&(qt.position.copy(Dt.position),qt.rotation.copy(new Euler(Dt.rotation.x,Dt.rotation.y,Dt.rotation.z))),Vt==null?Ht.setSize(Xt.width,Xt.height):Ht.setSize(Vt.width,Vt.height),Ht.render(Wt.parent,qt),Ht.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),jt({success:!1,imageData:null});else{LOGGER.info({title:"Downloading the screenshot"});const Yt=Ht.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");zt({success:!0,imageData:Yt})}})}}})),createProductDataStore=kt=>{const _e=productDataStoreCreator();return _e.setState({stores:kt}),_e},productDataStoreCreator=()=>create((kt,_e)=>({stores:null,productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentCompareAtPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].compareAtPrice)}),Vt[Gt]=jt}),Vt},getCurrentPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].price)}),Vt[Gt]=jt}),Vt},updateCompareAtPricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updateCompareAtPricingForProduct(Gt,jt,zt[jt])})})},updatePricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updatePricingForProduct(Gt,jt,zt[jt])})})},updateCompareAtPricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.compareAtPrice=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updateCompareAtPricing())},updatePricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.price=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updatePricing())},setProductData:Dt=>{const{stores:Vt}=_e();let Gt={};Dt&&Object.keys(Dt).map(zt=>{const jt=Dt[zt];if(jt.skuID=zt,jt.skuID.toLowerCase()==="root"){jt.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},jt.defaultVariant="default";return}if(jt?.lookDetails){const Ht=jt.lookDetails;let Wt=Object.keys(jt.lookDetails);if(Wt.includes("default")){const Xt=Wt.indexOf("default");Wt.splice(Xt,1)}jt.looks=Wt,Object.keys(jt.lookDetails).map(Xt=>{let Kt=jt.lookDetails[Xt];Kt.inventory===void 0&&(Kt.inventory=DEFAULT_INVENTORY),Kt.price===void 0&&(Kt.price=DEFAULT_PRODUCT_PRICE),Kt.compareAtPrice===void 0&&(Kt.compareAtPrice=DEFAULT_PRODUCT_COMPARE_AT_PRICE),Gt[zt]={...Gt[zt],[Xt]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let qt=jt?.defaultVariant;qt||(LOGGER.warn({title:`No defaultVariant set for ${jt.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),qt=Object.keys(jt.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+qt})),Wt.includes(qt)?(jt.lookDetails.default=Ht[qt],jt.lookDetails.default.id=qt):(LOGGER.error({title:`Default look [ ${qt} ] doesn't exist for: ${zt}. Please make sure to select a default variant in Input Data for this project`}),jt.lookDetails.default=null)}}),LOGGER.info({title:"PRODUCT DATA: ",details:Dt}),Vt.inventoryStore.setState({inventoryData:Gt}),kt({productData:Dt})},setCategoryData:Dt=>{const{productData:Vt}=_e();Dt.geometryVariants!==void 0&&Dt.geometryVariants.map(Gt=>{Gt.defaultVariant===void 0&&Object.keys(Gt.variants).length>0&&(Gt.defaultVariant=Object.keys(Gt.variants)[0])}),Dt.color!==void 0&&Dt.color.map(Gt=>{(Gt.defaultLook===void 0&&Gt.looks.length>0||!Gt.looks.includes(Gt.defaultLook))&&(Gt.defaultLook=Gt.looks[0])}),kt({categoryData:Dt}),Dt.build!==void 0&&Dt.build.map(Gt=>{Gt.skus.map(zt=>{Vt[zt].categoryID=Gt.categoryID,Vt[zt].categoryLabel=Gt.label,Vt[zt].swappable=Gt.swappable?Gt.swappable:!1,Vt[zt].replace=Gt.replace})})},getProductDataById:Dt=>{const{productData:Vt}=_e();let Gt=null;return Vt[Dt]&&(Gt=Vt[Dt]),Gt},setLookData:Dt=>kt({lookData:Dt}),setHotspotsData:Dt=>{const{categoryData:Vt,productData:Gt}=_e();Vt.geometryVariants&&Object.keys(Dt).map(zt=>{Dt[zt].map(jt=>{jt.geometryVariantID&&Vt.geometryVariants.map(Ht=>{Object.keys(Ht.variants).map(Wt=>{jt.geometryVariantID==Wt&&Ht.productsInCategory.map(qt=>{let Xt=null;qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)&&(Xt=Dt[Kt])}),qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)||(Dt[Kt]=Xt)})})})})})}),kt({hotspotsData:Dt})},setAssetsData:Dt=>kt({assetsData:Dt})}})),createItemStore=kt=>{const _e=itemStoreCreator();return _e.setState({stores:kt}),_e},itemStoreCreator=()=>create((kt,_e)=>({stores:null,variantChangeAlert:!1,focusedGUID:null,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],fittingSkuIds:[],filteredCollidersRef:[],selectedItemData:null,defaultSceneItemCount:0,busySpawningItem:!1,busyReplacingItem:!1,busySpawningDependency:!1,busyDraggingItem:!1,busyRemovingItem:!1,isBusy:()=>{const{busySpawningItem:Dt,busyReplacingItem:Vt,busySpawningDependency:Gt,busyDraggingItem:zt,busyRemovingItem:jt}=_e();return Dt||Vt||Gt||zt||jt},actions:{triggerModelLoaded:()=>{kt(Dt=>({modelLoadedAlert:Dt.modelLoadedAlert+1}))},triggerRemoveItem:()=>{kt(Dt=>({removeItemTrigger:!Dt.removeItemTrigger}))},addToRemoveItems:Dt=>{const{removeItems:Vt}=_e();Vt.push(Dt)},switchToVariant:async(Dt,Vt,Gt=!1)=>{const{variantChangeAlert:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().categoryData;let qt=jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.guid);const Xt=jt.assetStore.getState().assets.items,Kt=qt.ref.getObjectByName("GRP_RenderGeometry");Xt[Dt.skuID].data||Ht.geometryVariants&&Ht.geometryVariants.map(Yt=>{Yt.productsInCategory.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{nn==Dt.skuID&&(Jt=!0)}),Jt&&Zt.products.map(nn=>{const rn=jt.assetStore.getState().assets.items[nn].data;rn&&(jt.assetStore.getState().assets.items[Dt.skuID].data=rn)})})}),qt.modelFunctions&&(await qt.modelFunctions.selectVariant(Kt,Vt),Gt?(qt.overrideVariant=Vt,jt.coreSceneStore.getState().CORE_API.fireEvent(jt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):qt.currentVariant=Vt,kt({variantChangeAlert:!zt}))},clearAllItems:()=>{kt({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:Dt=>{kt({itemsSpawned:Dt,itemsCount:Object.keys(Dt).length})},setHoveredItemRef:Dt=>kt({hoveredItemRef:Dt}),setCollidersRef:Dt=>{const{stores:Vt}=_e();kt({collidersRef:Dt});let Gt=[];for(let zt=0;zt<Dt.length;zt++)Dt[zt].current&&Gt.push(Dt[zt]);Vt.itemStore.setState({filteredCollidersRef:[...Gt]})},setSelectedItemData:Dt=>{const{selectedItemData:Vt,hoveredItemRef:Gt,actions:zt,stores:jt}=_e();Vt&&(delete Gt[Vt.itemData.guid],zt.setHoveredItemRef({...Gt})),kt({selectedItemData:{...Dt}}),jt.hotspotStore.getState().actions.switchHotspotsVisibility(!1,!0),jt.cameraStore.getState().actions.canCameraRotate(!1)},deselectItem:()=>{const{selectedItemData:Dt,stores:Vt}=_e();Dt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Hide,Dt),kt(()=>({selectedItemData:null})),Vt.hotspotStore.getState().actions.switchHotspotsVisibility(!0,!0),Vt.cameraStore.getState().actions.canCameraRotate(!0),Vt.itemStore.getState().actions.setHoveredItemRef({})},removeItemByGUID:async Dt=>{const{itemsSpawned:Vt,actions:Gt,stores:zt}=_e();if(Vt.hasOwnProperty(Dt))return kt({busyRemovingItem:!0}),new Promise(async(jt,Ht)=>{const Wt=qt=>{Dt===qt.data.itemData.guid&&(kt({busyRemovingItem:!1}),jt(Dt))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,Wt,{once:!0}),Gt.addToRemoveItems(Dt),Gt.triggerRemoveItem()})},addItemBySkuID:async(Dt,Vt=0,Gt=!1,zt)=>{kt({busySpawningItem:!0});const{actions:jt,itemsSpawned:Ht,stores:Wt}=_e(),qt=Wt.productDataStore.getState().productData,Xt=Wt.productDataStore.getState().hotspotsData,Kt=Wt.attachmentStore.getState().attachmentSystem;let Yt=!0;const Zt=await new Promise(async(Jt,nn)=>{if(LOGGER.info({title:`Spawning item: ${Dt}`}),jt.deselectItem(),!qt[Dt]){LOGGER.warn({title:`Product not found: ${Dt}`}),Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:Dt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Yt=!1,nn(Dt+": product not found!");return}const rn=[...Wt.ghostStore.getState().ghostsTransform],Qt={...Wt.ghostStore.getState().ghostData};if(rn.length<=0){Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),Yt=!1,nn("No available connections for this product to attach to");return}const en=tn=>{Dt===tn.data&&Jt(Qt.newNodes[Vt].guid)};if(Wt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,en,{once:!0}),Qt.addItemOrSwap[Vt]=="replace")await replaceItem(kt,Wt,Ht,Qt.skuID,rn[Vt],Qt.newNodes[Vt]);else{Wt.ghostStore.getState().actions.clearAllGhosts();const tn=Qt.newNodes[Vt];tn.isDependent=Gt;let sn=!0;if(qt[Qt.skuID].hasOwnProperty("disableInteraction")){const dn=qt[Qt.skuID].disableInteraction;(dn==!0||dn==!1)&&(sn=!dn)}zt!=null&&(sn=zt),tn.isInteractive=sn;const{position:cn,rotation:un}=rn[Vt];tn.transform={position:cn,rotation:un},Kt.currentStructure.addNode(tn),Qt.connectablePlugs[Vt].receiverPlug.type=="unvisualizedPlug"&&Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"This product is not shown in your 3D configuration but can be found in your shopping list.",alertTime:3e3,alertType:"warn",alertLabel:"Internal Storage",persistant:!1,alertId:"unvisualizedItemSpawn"}),Qt.comboPlugs[Vt].length>0&&Qt.connectablePlugs[Vt].incomingPlug.type=="comboPlug"&&Qt.comboPlugs[Vt].map(dn=>{Kt.currentStructure.connectPlugs(dn)}),Qt.connectablePlugs[Vt].incomingPlug.comboPlugConnector=!0,Kt.currentStructure.connectPlugs(Qt.connectablePlugs[Vt]);const hn=await Wt.assetStore.getState().actions.loadProxyAsset(Qt.skuID,!0);LOGGER.info({title:"GHOST NEW NODE: ",details:tn}),Ht[tn.guid]={itemData:{proxyScene:hn.proxy.data.scene,guid:Qt.newNodes[Vt].guid,...qt[Qt.skuID],position:cn,rotation:un,hasItemLoaded:!1,isDependent:Gt,isInteractive:sn},hotspotsData:Xt[Qt.skuID],hotspotSpawned:!1},await wait(1),jt.setItemsSpawned({...Ht})}}).catch(Jt=>{LOGGER.error({title:Jt}),Yt=!1});if(Yt===!1)return kt({busySpawningItem:!1}),Zt;if(Wt.coreSceneStore.getState().preconfigurationLoaded&&Wt.coreSceneStore.getState().configurationLoaded){const Jt=await Kt.getCartItemsAsync();Jt&&Wt.coreSceneStore.getState().CORE_API.fireEvent(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Jt)}if(await jt.resolvePlugDependencyOnGUID(Zt),kt({busySpawningItem:!1}),!Gt){const Jt=Kt.currentStructure,nn=Jt.getNodeByGUID(Zt);await Wt.dynamicHookStore.getState().hookOnSceneItemAdded(nn,Jt.nodes,Wt.coreSceneStore.getState().CORE_API),await Wt.attachmentStore.getState().actions.updateFittingSkuIds()}return Zt},async addItemWithTransform(Dt,Vt,Gt,zt=!0){const{actions:jt,itemsSpawned:Ht,defaultSceneItemCount:Wt,stores:qt}=_e(),Xt=qt.productDataStore.getState().productData,Kt=qt.productDataStore.getState().hotspotsData;return await new Promise(async(Zt,Jt)=>{if(jt.deselectItem(),!Xt[Vt]){qt.coreSceneStore.getState().CORE_API.alert({alertMsg:Vt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Jt(Vt+": product not found!");return}const{position:nn,rotation:rn}=Dt;Ht[Gt]!=null&&(qt.hotspotStore.getState().actions.removeHotspotForItem({...Ht[Gt]}),delete Ht[Gt]);const Qt=tn=>{Vt.toLowerCase()==tn.data.toLowerCase()&&Zt(Gt)};qt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(qt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Qt,{once:!0});const en=await qt.assetStore.getState().actions.loadProxyAsset(Vt,!0);if(en==null){Jt(Vt+": Asset not found!");return}await wait(1),Vt.toLowerCase()==="root"&&kt({defaultSceneItemCount:Wt+1}),Ht[Gt]={itemData:{proxyScene:en.proxy.data.scene,guid:Gt,...Xt[Vt],position:nn,rotation:rn,hasItemLoaded:!1,isInteractive:zt},hotspotsData:Kt[Vt],hotspotSpawned:!1},kt({itemsSpawned:{...Ht}})}).catch(Zt=>{LOGGER.info({title:Zt})})},async resolvePlugDependencyOnGUID(Dt){const{actions:Vt,itemsSpawned:Gt,defaultSceneItemCount:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().productData,Wt=jt.attachmentStore.getState().attachmentSystem,qt=Gt[Dt].itemData.skuID,Xt=Ht[qt]?.plugs;if(!Xt)return;let Kt=!1;for(const Yt of Xt)Yt?.dependencySku&&(Kt=!0);Kt&&(kt({busySpawningDependency:!0}),await new Promise(async(Yt,Zt)=>{const Jt=[];for(const nn of Xt){const rn=nn?.dependencySku;if(!rn)continue;const Qt=async()=>{LOGGER.info({title:`Found a dependency: ${rn} on the plug: ${nn.name}`});let en=!0;Ht[rn]&&Ht[rn].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(en=Ht[rn].ignoreSpawningCollisionAsDependency),nn.hasOwnProperty("ignoreSpawningCollision")&&(en=nn.ignoreSpawningCollision);let tn=jt.coreSceneStore.getState().sceneSettings.ignoreSpawningCollision;Ht[rn].hasOwnProperty("ignoreSpawningCollision")&&(tn=Ht[rn].ignoreSpawningCollision),Ht[rn].ignoreSpawningCollision=en,jt.ghostStore.setState({ghostVisibility:!1});const sn=await jt.ghostStore.getState().actions.spawnGhostsForSkuID(rn,en);if(Ht[rn].ignoreSpawningCollision=tn,!sn)return;const cn=Wt.currentStructure.getNodeByGUID(Dt),un=cn.getPlugByName(nn.name)?.guid,hn=nn?.isDependencySkuInteractive?nn.isDependencySkuInteractive===1:!1,dn=sn.connectablePlugs;let pn=-1;for(const mn of dn)mn.receiverPlug.guid===un&&(pn=dn.indexOf(mn));if(pn==-1){jt.ghostStore.getState().actions.clearAllGhosts();return}const fn=await Vt.addItemBySkuID(rn,pn,!0,hn);qt.toLowerCase()==="root"&&Ht[rn].ignoreInCart&&kt({defaultSceneItemCount:zt+1}),fn!==null&&cn.addMyDependenciesGUID(fn)};Jt.push(await Qt())}await Promise.all(Jt),Yt(!0)}),kt({busySpawningDependency:!1}))},async replaceGuidItemBySkuId(Dt,Vt){const{itemsSpawned:Gt,stores:zt}=_e();if(Gt[Dt]==null)return!1;const jt=zt.attachmentStore.getState().attachmentSystem.currentStructure,Ht=jt.getNodeByGUID(Dt);if(!Ht||!Ht.isReplaceableWithSkuId(Vt))return!1;LOGGER.info({title:"Replacing Item"});const qt=zt.productDataStore.getState().productData,Xt=zt.productDataStore.getState().hotspotsData;kt({busyReplacingItem:!0}),await new Promise(async(Kt,Yt)=>{const Zt=async()=>{LOGGER.info({title:"Removed old item with guid: "+Dt});const Jt=async en=>{Vt===en.data&&(jt.recalculateStructureFromNode(Ht.whichNodeAreWeAttachedTo()),await zt.attachmentStore.getState().actions.toggleStructureUpdated(),kt({busyReplacingItem:!1}),Kt(Ht.guid))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Jt,{once:!0});const nn=await zt.assetStore.getState().actions.loadProxyAsset(Vt,!0),rn={receiverPlug:Ht.whichPlugAreWeAttachedTo(),incomingPlug:Ht.whichPlugAreWeAttachedUsing()};jt.findItemTransform(rn);let Qt=!0;if(qt[Vt]&&Object.prototype.hasOwnProperty.call(qt[Vt],"disableInteraction")){const en=qt[Vt].disableInteraction;(en===!0||en===!1)&&(Qt=!en)}Ht.isInteractive=Qt,Gt[Dt]={itemData:{proxyScene:nn.proxy.data.scene,guid:Dt,...qt[Vt],position:Ht.transform.position,rotation:Ht.transform.rotation,hasItemLoaded:!1,isInteractive:Qt},hotspotsData:Xt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:Ht.currentVariant}),zt.itemStore.setState({itemsSpawned:{...Gt}})};zt.hotspotStore.getState().actions.removeHotspotForItem({...Gt[Dt]}),delete Gt[Dt],Ht.update(Vt),zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}}}));async function replaceItem(kt,_e,Dt,Vt,Gt,zt){LOGGER.info({title:"Replacing Item"});const{position:jt,rotation:Ht}=Gt,Wt=_e.productDataStore.getState().productData,qt=_e.productDataStore.getState().hotspotsData,Xt=_e.attachmentStore.getState().attachmentSystem.currentStructure;return kt({busyReplacingItem:!0}),new Promise(async(Kt,Yt)=>{const Zt=async()=>{const Jt=await _e.assetStore.getState().actions.loadProxyAsset(Vt,!0),nn=async Qt=>{Vt===Qt.data&&(Xt.recalculateStructureFromNode(zt),await _e.attachmentStore.getState().actions.toggleStructureUpdated(),_e.ghostStore.getState().actions.clearAllGhosts(),kt({busyReplacingItem:!1}),Kt(zt.guid))};_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,nn,{once:!0});let rn=!0;if(Wt[Vt]&&Object.prototype.hasOwnProperty.call(Wt[Vt],"disableInteraction")){const Qt=Wt[Vt].disableInteraction;(Qt===!0||Qt===!1)&&(rn=!Qt)}zt.isInteractive=rn,Dt[zt.guid]={itemData:{proxyScene:Jt.proxy.data.scene,guid:zt.guid,...Wt[Vt],position:jt,rotation:Ht,hasItemLoaded:!1,isInteractive:rn},hotspotsData:qt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:zt.currentVariant}),zt.currentVariant=zt.currentVariant,zt.transform=Gt,_e.itemStore.setState({itemsSpawned:{...Dt}})};_e.hotspotStore.getState().actions.removeHotspotForItem({...Dt[zt.guid]}),delete Dt[zt.guid],zt.update(Vt),_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}const createInventoryStore=kt=>{const _e=inventoryStoreCreator();return _e.setState({stores:kt}),_e},inventoryStoreCreator=()=>create((kt,_e)=>({stores:null,inventoryData:{},actions:{updateInventoryForAllProducts:Dt=>{const{actions:Vt,stores:Gt}=_e();Object.keys(Dt).map(zt=>{let jt=Dt[zt];Object.keys(jt).map(Ht=>{Vt.updateInventoryForProduct(zt,Ht,jt[Ht].inventory)})}),Vt.refreshInventory(Gt.itemStore.getState().itemsSpawned)},updateInventoryForProduct:(Dt,Vt,Gt)=>{const{inventoryData:zt}=_e();let jt=zt[Dt],Ht=jt[Vt];!jt||!Ht||(Ht.inventory=Gt)},_clearInScene:()=>{const{inventoryData:Dt}=_e();Object.keys(Dt).map(Vt=>{const Gt=Dt[Vt];Object.keys(Gt).map(zt=>{Gt[zt].inScene=[]})})},refreshInventory:Dt=>{if(!Dt)return;LOGGER.info({title:"Refreshing Inventory"});const{actions:Vt,inventoryData:Gt,stores:zt}=_e();Vt._clearInScene();const jt=zt.attachmentStore.getState().attachmentSystem;if(jt===null)return;const Ht=jt.currentStructure;if(Ht===null)return;Object.keys(Dt).map(Kt=>{const Yt=Ht.getNodeByGUID(Kt);if(!Yt)return;const Zt=Yt.overrideVariant?Yt.overrideVariant:Yt.currentVariant;if(!Zt)return;const Jt=Gt[Yt.skuID];if(!Jt||!Jt[Zt]?.inScene)return;Jt[Zt].inScene.push(Kt),zt.coreSceneStore.getState().sceneSettings.disableCart===!0?Yt.inStock={variantName:Zt,newValue:!0}:Jt[Zt].inScene.length>Jt[Zt].inventory?Yt.inStock={variantName:Zt,newValue:!1}:Yt.inStock={variantName:Zt,newValue:!0}});let Wt=!1;Object.keys(Gt).map(Kt=>{const Yt=Gt[Kt];Object.keys(Yt).map(Zt=>{Yt[Zt].countAvailable=Yt[Zt].inventory-Yt[Zt].inScene.length,Yt[Zt].countAvailable<0?(Yt[Zt].countUnavailable=Yt[Zt].countAvailable*-1,Yt[Zt].countAvailable=0,Wt=!0):Yt[Zt].countUnavailable=0})});const qt={alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"},Xt=compareObjects(zt.coreSceneStore.getState().persistantAlertData,qt);Wt===!1&&Xt===!0&&zt.coreSceneStore.getState().CORE_API.removePersistantAlert(),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Inventory_Updated,Gt)}}})),createAssetStore=kt=>{const _e=assetStoreCreator();return _e.setState({stores:kt}),_e},assetStoreCreator=()=>create((kt,_e)=>({stores:null,assets:{items:{}},gltfLoader:null,dracoLoader:null,actions:{init(){const Dt=new DRACOLoader;Dt.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`),Dt.setDecoderConfig({type:"js"});const Vt=new GLTFLoader;Vt.register(Gt=>new GLTFMaterialsVariantsExtension(Gt)),Vt.setDRACOLoader(Dt),kt({dracoLoader:Dt,gltfLoader:Vt})},async loadProxyAsset(Dt){const{assets:Vt,gltfLoader:Gt,stores:zt}=_e(),jt="proxy",Ht=Vt.items[Dt]=Vt.items[Dt]||{isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}},Wt=Ht.proxy;if(Wt.isLoaded)return Ht;if(Wt.errorLoading)throw new Error(`${jt} loading failed for: ${Dt}`);const qt=zt.productDataStore.getState().productData[Dt];if(!qt)throw new Error(`Data doesn't exist for ${Dt}`);const Xt=zt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(qt.colliderProxyGLTF);if(!Xt)return null;try{const Kt=await Gt.loadAsync(Xt,Yt=>{Wt.progress=Yt.loaded/Yt.total*100});return Wt.data=Kt,Wt.isLoaded=!0,Ht}catch(Kt){throw Wt.isLoaded=!1,Wt.errorLoading=!0,Wt.error=Kt,LOGGER.info({title:Xt}),new Error(`Couldn't load ${Dt}`)}},isProxyLoaded(Dt){const Vt=_e().assets.items[Dt];return Vt?Vt.proxy.isLoaded:!1}}}));class Structure{#t=!1;constructor(_e,Dt=null,Vt,Gt){if(this.stores=_e,this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:Dt}),this.setupHookOnSceneItemsUpdated(),Dt){LOGGER.info({title:"PRELOAD Length-----------------:"+Dt.length});for(let zt=0;zt<Dt.length;zt++){LOGGER.info({title:"FOUND PRELOAD-----------------"});const jt=Dt[zt].skuID;if(jt.toLowerCase()=="root"){const Wt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Wt).length>0&&(Dt[zt].guid=Object.keys(Wt)[0])}let Ht=new Node$1(_e,jt,Dt[zt],Vt,Gt);jt.toLowerCase()=="root"&&(this._rootNode=Ht),this._nodes.push(Ht)}}else{const zt=new Node$1(_e,"Root",null,Vt,Gt);this._rootNode=zt,this._nodes.push(zt),this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=this.stores.coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){const _e=this.stores.coreSceneStore.getState().CORE_API;this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.stores.dynamicHookStore.getState().hookOnSceneItemsUpdated(this._nodes,_e)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let _e=0;_e<this._nodes.length;_e++)this._nodes[_e].updatePricing()}getCurrentItemsInReplaceableCategory(){let _e={};for(const Dt of this._nodes)Dt.replace&&(_e[Dt.categoryID]=Dt.skuID);return _e}recalculateStructureFromNode(_e){for(let Dt=0;Dt<_e.plugs.length;Dt++)if(!_e.plugs[Dt].isOpen&&_e.plugs[Dt].isReceiverPlug){const Vt=_e.plugs[Dt].attachedPlug.node,Gt={receiverPlug:_e.plugs[Dt],incomingPlug:_e.plugs[Dt].attachedPlug};if(Gt){const zt=this.findItemTransform(Gt);zt&&(Vt.ref.position.set(zt.position.x,zt.position.y,zt.position.z),zt.rotation.isQuaternion===!0?Vt.ref.setRotationFromQuaternion(zt.rotation):zt.rotation.isEuler===!0&&Vt.ref.setRotationFromEuler(zt.rotation),Vt.transform={position:zt.position,rotation:zt.rotation})}this.recalculateStructureFromNode(Vt)}}rotateNode(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=null,zt=[];for(let Zt=0;Zt<Dt.plugs.length;Zt++)if(!Vt&&!Dt.plugs[Zt].isOpen&&Dt.plugs[Zt].attachedPlug.isReceiverPlug){Dt.plugs[Zt].attachedPlug.acceptedPlugTypes,Vt=Dt.plugs[Zt].attachedPlug,Gt=Dt.plugs[Zt];for(let Jt=Zt+1;Jt<Dt.plugs.length;Jt++)zt.push(Dt.plugs[Jt]);for(let Jt=0;Jt<Zt;Jt++)zt.push(Dt.plugs[Jt]);break}const jt=[];if(Vt){const Zt=Vt.acceptedPlugTypes;for(let Jt=0;Jt<zt.length;Jt++)for(let nn=0;nn<zt[Jt].connectsToPlugTypes.length;nn++)if(Zt.includes(zt[Jt].connectsToPlugTypes[nn])){jt.push(zt[Jt]);break}}if(jt.length===0)return;const Ht=this.findItemTransform({receiverPlug:Vt,incomingPlug:Gt});if(!Ht)return;Dt.detachNodeFromReceiver();const qt=this.stores.coreSceneStore.getState().sceneSettings.disableCollider,Xt=[Dt.guid,...Dt.getAllBranchedNodesAttachedToUs().map(Zt=>Zt.guid)];for(let Zt=0;Zt<jt.length;Zt++){const Jt=jt[Zt],nn=this.findItemTransform({receiverPlug:Vt,incomingPlug:Jt});if(!nn||!nn.position||!nn.rotation)continue;if(!(!qt&&this.isColliding(Dt.skuID,nn,Vt,Xt))){const{position:Qt,rotation:en}=nn;Dt.ref.position.set(Qt.x,Qt.y,Qt.z),en.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(en):en.isEuler===!0&&Dt.ref.setRotationFromEuler(en),Dt.transform={position:Dt.ref.position,rotation:en},this.connectPlugs({receiverPlug:Vt,incomingPlug:Jt}),this.recalculateStructureFromNode(Dt);return}}const{position:Kt,rotation:Yt}=Ht;Dt.ref.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Dt.ref.setRotationFromEuler(Yt),Dt.transform={position:Dt.ref.position,rotation:Yt},this.connectPlugs({receiverPlug:Vt,incomingPlug:Gt}),this.recalculateStructureFromNode(Dt)}hasValidAlternateRotation(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=[];for(let Xt=0;Xt<Dt.plugs.length;Xt++)if(!Vt&&!Dt.plugs[Xt].isOpen&&Dt.plugs[Xt].attachedPlug.isReceiverPlug){Vt=Dt.plugs[Xt].attachedPlug,Dt.plugs[Xt];for(let Kt=Xt+1;Kt<Dt.plugs.length;Kt++)Gt.push(Dt.plugs[Kt]);for(let Kt=0;Kt<Xt;Kt++)Gt.push(Dt.plugs[Kt]);break}const zt=[];if(Vt){const Xt=Vt.acceptedPlugTypes;for(let Kt=0;Kt<Gt.length;Kt++)for(let Yt=0;Yt<Gt[Kt].connectsToPlugTypes.length;Yt++)if(Xt.includes(Gt[Kt].connectsToPlugTypes[Yt])){zt.push(Gt[Kt]);break}}if(zt.length<=1)return!1;const Ht=this.stores.coreSceneStore.getState().sceneSettings.disableCollider,Wt=[Dt.guid,...Dt.getAllBranchedNodesAttachedToUs().map(Xt=>Xt.guid)];let qt=0;for(let Xt=0;Xt<zt.length;Xt++){const Kt=zt[Xt],Yt=this.findItemTransform({receiverPlug:Vt,incomingPlug:Kt});if(!Yt||!Yt.position||!Yt.rotation)continue;if(!(!Ht&&this.isColliding(Dt.skuID,Yt,Vt,Wt))&&(qt++,qt>=2))return!0}return!1}async load(_e){this.resolvePlugConnections(_e),await this.respawnItems()}materialOverrideExists(){let _e=!1;return this.nodes.map(Dt=>{if(Dt.overrideVariant)return _e=!0,!0}),_e}async findGhostTransformForReplacement(_e,Dt){let Vt=[],Gt=[],zt=[];for(const Ht of Dt){if(Ht.skuID==_e)continue;const Wt=this.stores.attachmentStore.getState().attachmentSystem,qt=Ht.whichPlugAreWeAttachedTo(),Xt=Ht.whichPlugAreWeAttachedUsing(),Yt=new Node$1(this.stores,_e,null,Wt.globalVariants,Wt.globalGeometryVariants).getPlugByName(Xt.name);if(!Yt)continue;const Zt={incomingPlug:Yt,receiverPlug:qt},{position:Jt,rotation:nn}=this.findItemTransform(Zt);Jt&&nn&&(Gt.push({position:Jt,rotation:nn,incomingPlugName:Zt.incomingPlug.name,receiverPlugName:Zt.receiverPlug.name,incomingPlugGUID:Zt.incomingPlug.guid,receiverPlugGUID:Zt.receiverPlug.guid}),zt.push(Zt),Vt.push(Ht))}let jt={transforms:Gt,connectablePlugs:zt,newNodes:Vt,skuIdToReplaceWith:_e};return jt=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollectedForReplacement(jt,this.stores.coreSceneStore.getState().CORE_API),jt}async findGhostTransforms(_e,Dt){const Vt=this.getOpenPlugs(),Gt=this.stores.coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(Vt.length<=0)return{transforms:[]};const zt=this.stores.attachmentStore.getState().attachmentSystem,jt=this.stores.productDataStore.getState().productData,Ht=new Node$1(this.stores,_e,null,zt.globalVariants,zt.globalGeometryVariants),Wt=this.getConnectablePlugs(Ht,Vt);let qt=[];if(Wt.length<=0)return{transforms:[]};let Xt=[],Kt=[];const Yt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene;if(!Yt)return!1;let Zt=Yt.clone();for(let rn=0;rn<Wt.length;rn++){let Qt=Dt,{incomingPlug:en,receiverPlug:tn}=Wt[rn],sn=this.findItemTransform(Wt[rn]);if(!sn)continue;let{position:cn,rotation:un}=sn;if(!cn||!un)continue;Zt.position.set(cn.x,cn.y,cn.z),un.isQuaternion===!0?Zt.setRotationFromQuaternion(un):un.isEuler===!0&&Zt.setRotationFromEuler(un);let hn=[],dn=[];if(en.type=="comboPlug"){if(en.connectsToPlugTypes.length<=0)continue;const vn=en.connectsToPlugTypes[0];let _n=!1;if(Kt.map(Cn=>{_n===!0||Cn.length<=0||Cn.map(yn=>{_n===!0||yn.incomingPlug.guid!==en.guid||yn.incomingPlug.connectsToPlugTypes.includes(vn)&&(_n=!0)})}),_n===!0)continue;const An=en.node.plugs;let Tn=!0;if(An.map(Cn=>{if(Cn.type!=="comboPlug"||Cn.guid===en.guid||!Cn.connectsToPlugTypes.includes(vn))return;let yn=!1;if(Vt.map(Sn=>{if(tn.guid===Sn.guid||!Sn.acceptedPlugTypes.includes(vn)||!Sn.node.ref)return;let wn=new Vector3(0,0,0);const xn=Sn.node.ref.getObjectByName(""+Sn.name);if(!xn)return;xn.getWorldPosition(wn);let Rn=new Vector3(0,0,0);const Dn=Zt.getObjectByName(""+Cn.name);if(!Dn)return;Dn.getWorldPosition(Rn);const kn=wn.distanceTo(Rn);Math.abs(kn)<Gt&&(hn.push(tn.node.guid),hn.push(Sn.node.guid),dn.push({receiverPlug:Sn,incomingPlug:Cn}),yn=!0)}),yn==!1){Tn=!1;return}}),!Tn)continue}let pn=Qt;Array.isArray(Qt)===!0&&(pn=!1),hn.length>0&&(pn=!1,Array.isArray(Qt)===!0?hn.map(vn=>{Qt.push(vn)}):Qt=hn),jt[_e].hasOwnProperty("ignoreSpawningCollision")&&(pn=jt[_e].ignoreSpawningCollision),Wt[rn].receiverPlug.type=="unvisualizedPlug"&&(pn=!0),(pn?!1:this.isColliding(Ht.skuID,sn,Wt[rn].receiverPlug,Qt))||(Xt.push({position:cn,rotation:un,incomingPlugName:Wt[rn].incomingPlug.name,receiverPlugName:Wt[rn].receiverPlug.name,incomingPlugGUID:Wt[rn].incomingPlug.guid,receiverPlugGUID:Wt[rn].receiverPlug.guid}),qt.push(Wt[rn]),Kt.push(dn))}let Jt=[];for(let rn=0;rn<Xt.length;rn++)Jt.push(Ht);dispose3(Zt);let nn={transforms:Xt,newNodes:Jt,connectablePlugs:qt,comboPlugs:Kt};return nn=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollected(nn,this.stores.coreSceneStore.getState().CORE_API),nn}resolvePlugConnections(_e){for(let Dt=0;Dt<_e.length;Dt++)Object.keys(_e[Dt].plugs).map(Vt=>{let Gt=_e[Dt].plugs[Vt].guid,zt=this.getPlugInNodesByGUID(Gt);if(!zt||zt.attachedPlug)return;let jt=_e[Dt].plugs[Vt].attachedPlugGUID,Ht=this.getPlugInNodesByGUID(jt);Ht&&(Ht.attachedPlug||(zt.attachPlug(Ht,_e[Dt].plugs[Vt].isReceiverPlug),Ht.attachPlug(zt,!_e[Dt].plugs[Vt].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let _e=[this.rootNode];for(let zt=0;zt<_e.length;zt++){let Ht=_e[zt].whichPlugsAreAttachedToUs();for(let Wt=0;Wt<Ht.length;Wt++){if(Ht[Wt].incomingPlug.type=="comboPlug"&&Ht[Wt].incomingPlug.connectsToPlugTypes.length>0&&!Ht[Wt].incomingPlug.comboPlugConnector)continue;let qt=this.findItemTransformForPreload(Ht[Wt],Ht[Wt].receiverPlug.node.transform);if(qt){const Xt=Ht[Wt].receiverPlug,Kt=Ht[Wt].incomingPlug.node,Yt=this.stores.productDataStore.getState().productData,Zt=Xt.dependencySku===Kt.skuID;let Jt=!0;if(Zt)Jt=Xt.isDependencySkuInteractive===1,Kt.isDependent=!0,Xt.node.addMyDependenciesGUID(Kt.guid);else if(Yt[Kt.skuID].hasOwnProperty("disableInteraction")){const nn=Yt[Kt.skuID].disableInteraction;typeof nn=="boolean"&&(Jt=!nn)}Kt.isInteractive=Jt,await this.stores.itemStore.getState().actions.addItemWithTransform(qt,Kt.skuID,Kt.guid,Jt)}else LOGGER.warn({title:"Problem finding plug transform! "+Ht[Wt].name});Ht[Wt].incomingPlug.node.transform=qt,_e.push(Ht[Wt].incomingPlug.node)}}const Dt=await this.stores.coreSceneStore.getState().CORE_API.getCartItemsAsync();this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...Dt}),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.hotspotStore.getState().actions.checkHotspotHealth();const Vt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Gt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(Vt||Gt){let zt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);zt.parameters={project_id:`${this.stores.coreSceneStore.getState().CORE_API.projectId}`,...Dt},this.stores.coreSceneStore.getState().CORE_API.sendAnalyticsEvent(zt)}}getPlugInNodesByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].getPlugByGUID(_e);if(Vt)return Vt}return null}export(){let _e=[];for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].export();Vt&&_e.push(Vt)}return _e}async clear(){return new Promise(async(_e,Dt)=>{!this._rootNode&&this._rootNode.isEndNode&&_e(!0);let Vt=null;const Gt=this._rootNode.whichNodesAreAttachedToUs();Gt.length>0&&(Vt=Gt[0]),this.#t=!0,this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,zt=>_e(zt.data),{once:!0}),Vt?this.stores.coreSceneStore.getState().CORE_API.removeItemByGUID(Vt.guid,!0):(await wait(500),_e(!0))})}getNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e)return this._nodes[Dt];return null}getPlugByGUID(_e){for(const Dt of this._nodes){const Vt=Dt.getPlugByGUID(_e);if(Vt)return Vt}return null}findItemTransformForPreload(_e,Dt){let{receiverPlug:Vt,incomingPlug:Gt}=_e,zt=Vt,jt=Gt;if(zt.node.skuID=="Root")return this.findItemTransformRoot(_e);let Ht=null,Wt=null,qt=new Object3D,Xt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();qt.add(Xt);let{position:Kt,rotation:Yt}=Dt;if(Xt.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Xt.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Xt.setRotationFromEuler(Yt),Wt=Xt,!Wt||(Ht=Wt.getObjectByName(zt.name),!Ht))return;let Zt=new Vector3(0,0,0);Ht.getWorldPosition(Zt);let Jt=new Quaternion().identity();Ht.getWorldQuaternion(Jt);let nn=new Object3D;Ht.add(nn);let rn=this.stores.assetStore.getState().assets.items[jt.node.skuID].proxy.data.scene.clone();rn.position.set(Zt.x,Zt.y,Zt.z),rn.applyQuaternion(Jt);let Qt=new Vector3;Qt.copy(Xt.up).applyQuaternion(Wt.quaternion);let en=new Vector3;en.copy(rn.up).applyQuaternion(Jt),en.negate();let tn=new Quaternion().setFromUnitVectors(Qt,en);Qt.round(),en.round();let sn=Qt.dot(en);sn!==1&&sn!==-1&&rn.applyQuaternion(tn);let cn=rn.getObjectByName(jt.name),un=new Quaternion().identity();cn.getWorldQuaternion(un);let hn=new Vector3(0,1,0);hn.applyQuaternion(un);let dn=new Vector3(0,1,0);dn.applyQuaternion(Jt),dn.negate();let pn=new Quaternion().setFromUnitVectors(hn,dn);if(hn.round(),dn.round(),hn.dot(dn)!==-1)rn.applyQuaternion(pn);else{let An=new Vector3(0,1,0),Tn=dn.dot(An);if(Tn!==1&&Tn!==-1)rn.rotateOnAxis(An,Math.PI);else{let Cn=new Vector3(0,0,1),yn=dn.dot(Cn);if(yn!==1&&yn!==-1)rn.rotateOnAxis(Cn,Math.PI);else{let Sn=new Vector3(1,0,0),wn=dn.dot(Sn);wn!==1&&wn!==-1&&rn.rotateOnAxis(Sn,Math.PI)}}}let mn=rn.getObjectByName(jt.name),vn=new Vector3(mn.position.x,mn.position.y,mn.position.z);rn.translateX(-vn.x),rn.translateY(-vn.y),rn.translateZ(-vn.z);let _n=new Vector3(0,0,0);rn.getWorldPosition(_n);let En=new Quaternion().identity();return rn.getWorldQuaternion(En),rn=null,{position:_n,rotation:En}}findItemTransformRoot(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Vt;const zt=new Object3D;let jt=zt,Ht=new Vector3(0,0,0);jt.getWorldPosition(Ht);let Wt=new Quaternion().identity(),qt=new Object3D;qt.position.set(0,0,0),zt.add(qt);let Xt=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone();qt.attach(Xt),Xt.translateX(Ht.x),Xt.translateY(Ht.y),Xt.translateZ(Ht.z);let Kt=Xt.getObjectByName(Gt.name),Yt=new Quaternion().identity();Kt&&Kt.getWorldQuaternion(Yt);const Zt=new Vector3(0,1,0);Zt.applyQuaternion(Yt);const Jt=new Vector3(0,1,0);Jt.applyQuaternion(Wt);const nn=Jt.angleTo(Zt),rn=new Vector3(0,0,0);rn.crossVectors(Jt,Zt),rn.round(),rn.length()!==0&&Xt.rotateOnAxis(rn,nn);let Qt=new Matrix4().extractRotation(Xt.matrixWorld),en=new Vector3(0,0,0);Kt&&en.set(Kt.position.x,Kt.position.y,Kt.position.z),en.applyMatrix4(Qt),Xt.translateX(-en.x),Xt.translateY(-en.y),Xt.translateZ(-en.z);let tn=new Vector3(0,0,0);Xt.getWorldPosition(tn);let sn=new Quaternion().identity();return Xt.getWorldQuaternion(sn),qt.remove(Xt),qt=null,Xt=null,{position:tn,rotation:sn}}findItemTransform(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Dt,zt=Vt;if(Gt.node.isRoot)return this.findItemTransformRoot(_e);const jt=Gt.node.transform;if(!jt)return;const Ht=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone(),Wt=new Object3D;Wt.position.set(jt.position.x,jt.position.y,jt.position.z),jt.rotation.isQuaternion===!0?Wt.setRotationFromQuaternion(jt.rotation):jt.rotation.isEuler===!0&&Wt.setRotationFromEuler(jt.rotation),Wt.add(Ht);let qt=Wt.getObjectByName(""+Gt.name);if(!qt){LOGGER.error({title:"Plug: "+Gt.name+" doesn't exist in "+Gt.node.skuID});return}let Xt=new Vector3(0,1,0);qt.getWorldPosition(Xt);let Kt=new Quaternion().identity();qt.getWorldQuaternion(Kt);let Yt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();Yt.position.set(Xt.x,Xt.y,Xt.z),Yt.applyQuaternion(Kt);let Zt=new Vector3;Zt.copy(Ht.up).applyQuaternion(Wt.quaternion);let Jt=new Vector3;Jt.copy(Yt.up).applyQuaternion(Kt),Jt.negate();let nn=new Quaternion().setFromUnitVectors(Zt,Jt);Zt.round(),Jt.round();let rn=Zt.dot(Jt);rn!==1&&rn!==-1&&Yt.applyQuaternion(nn);let Qt=Yt.getObjectByName(zt.name);if(!Qt){LOGGER.error({title:"Plug: "+zt.name+" doesn't exist in "+zt.node.skuID});return}let en=new Quaternion().identity();Qt.getWorldQuaternion(en);let tn=new Vector3(0,1,0);tn.applyQuaternion(en);let sn=new Vector3(0,1,0);sn.applyQuaternion(Kt),sn.negate();let cn=new Quaternion().setFromUnitVectors(tn,sn);if(tn.round(),sn.round(),tn.dot(sn)!==-1)Yt.applyQuaternion(cn);else{let mn=new Vector3(0,1,0),vn=sn.dot(mn);if(vn!==1&&vn!==-1)Yt.rotateOnAxis(mn,Math.PI);else{let _n=new Vector3(0,0,1),En=sn.dot(_n);if(En!==1&&En!==-1)Yt.rotateOnAxis(_n,Math.PI);else{let An=new Vector3(1,0,0),Tn=sn.dot(An);Tn!==1&&Tn!==-1&&Yt.rotateOnAxis(An,Math.PI)}}}let hn=Yt.getObjectByName(zt.name),dn=new Vector3(hn.position.x,hn.position.y,hn.position.z);Yt.translateX(-dn.x),Yt.translateY(-dn.y),Yt.translateZ(-dn.z);let pn=new Vector3(0,0,0);Yt.getWorldPosition(pn);let fn=new Quaternion().identity();return Yt.getWorldQuaternion(fn),Wt.remove(Ht),Yt=null,{position:pn,rotation:fn}}getSpawningRequirementForSkuID(_e){let Dt=[];const Vt=this.stores.productDataStore.getState().productData,Gt=Vt[_e];if(!Gt)return Dt;const zt=[];return Gt.plugs.map(jt=>{jt.connectsToPlugTypes.map(Ht=>{zt.push(Ht)})}),Object.keys(Vt).map(jt=>{for(let Ht=0;Ht<Vt[jt].plugs.length;Ht++){const Wt=Vt[jt].plugs[Ht].acceptedPlugTypes;for(let qt=0;qt<Wt.length;qt++)zt.map(Xt=>{Xt==Wt[qt]&&!Dt.includes(jt)&&Dt.push(jt)})}}),Dt}getConnectablePlugs(_e,Dt){let Vt=[],Gt=_e.getOpenPlugsWeCanAttachFrom();for(let zt=0;zt<Gt.length;zt++)for(let jt=0;jt<Dt.length;jt++){let Ht=!1;for(let qt=0;qt<Vt.length;qt++)if(Vt[qt].receiverPlug.guid==Dt[jt].guid&&Vt[qt].incomingPlug.type!="comboPlug"){Ht=!0;break}if(Ht)continue;Gt[zt].canAttachToPlug(Dt[jt])&&Vt.push({incomingPlug:Gt[zt],receiverPlug:Dt[jt]})}return Vt}getOpenPlugs(){let _e=[];return this._nodes.map(Dt=>{if(Dt.dragging===!0)return;let Vt=Dt.getOpenPlugsFromNode();_e=_e.concat(Vt)}),_e}checkCollisionForGUID(_e,Dt=[]){if(this.stores.coreSceneStore.getState().sceneSettings.disableCollider)return!1;const Vt=this.stores.itemStore.getState().itemsSpawned,Gt=this.stores.productDataStore.getState().productData;if(!Vt[_e])return!1;const jt=this.getNodeByGUID(_e);if(!jt||!jt.ref||Gt[jt.skuID].disableCollider)return!1;let Ht=new Vector3;jt.ref.getWorldPosition(Ht);let Wt=new Quaternion;jt.ref.getWorldQuaternion(Wt);const qt={position:Ht,rotation:Wt},Xt=jt.whichPlugAreWeAttachedTo();return Xt==null?!1:this.isColliding(jt.skuID,qt,Xt,Dt)}isColliding(_e,{position:Dt,rotation:Vt},Gt,zt=[]){const jt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene,Ht=this.stores.productDataStore.getState().productData;if(!jt)return!1;let Wt=jt.clone();Wt.position.set(Dt.x,Dt.y,Dt.z),Vt.isQuaternion===!0?Wt.setRotationFromQuaternion(Vt):Vt.isEuler===!0&&Wt.setRotationFromEuler(Vt);let qt=new Box3().setFromObject(Wt),Xt=new Vector3;qt.getCenter(Xt);let Kt=new Object3D;Kt.position.set(Xt.x,Xt.y,Xt.z),Kt.attach(Wt),Kt.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),qt=new Box3().setFromObject(Kt);const Yt=[];if(this._nodes.forEach(Jt=>{if(Gt.node.guid==Jt.guid||Array.isArray(zt)===!0&&zt.includes(Jt.guid)||!Jt.ref||(Ht[Jt.skuID].hasOwnProperty("disableCollider")?Ht[Jt.skuID].disableCollider:this.stores.coreSceneStore.getState().sceneSettings.disableCollider))return;const nn=Jt.ref.getObjectByName("GRP_ProxyMesh");nn&&Yt.push(nn)}),Yt.length<=0)return!1;let Zt=!1;return Yt.forEach(Jt=>{if(Zt)return;let nn=new Box3().setFromObject(Jt);if(qt.intersectsBox(nn)){Zt=!0;return}}),Kt.clear(),Wt=null,Kt=null,qt=null,Zt}boxOverlapPercent(_e,Dt){if(_e.containsBox(Dt)||Dt.containsBox(_e))return 100;if(!(_e.min.x<Dt.max.x||Dt.min.x<_e.max.x))return 0;let Vt=new Vector3(0,0,0);_e.getSize(Vt),Vt.x*Vt.y*Vt.z;let Gt=new Vector3(0,0,0);Dt.getSize(Gt),Gt.x*Gt.y*Gt.z}checkInsideOutCollision(_e,Dt,Vt){let Gt=Dt.position.clone(),zt=new Float32Array(Vt.attributes.position.array),jt=zt.length/3;for(let Ht=0;Ht<jt;Ht++){let Wt=new Vector3(zt[Ht*3],zt[Ht*3+1],zt[Ht*3+2]),qt=Wt.add(Dt.position);qt=Wt.applyQuaternion(Dt.quaternion);let Xt=qt.sub(Dt.position);const Yt=new Raycaster(Gt,Xt.clone().normalize()).intersectObjects(_e),Zt=Yt.length>0,Jt=Yt[0].distance<Xt.length();if(Zt&&Jt)return!0}return!1}addNode(_e){this._nodes.push(_e)}getFirstNodeByCategoryID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt]._categoryID==_e)return this._nodes[Dt];return null}getNodesBySKUID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt].skuID==_e&&Dt.push(this._nodes[Vt]);return Dt}getNodesByCategoryID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt]._categoryID==_e&&Dt.push(this._nodes[Vt]);return Dt}async connectPlugs({incomingPlug:_e,receiverPlug:Dt}){_e.attachPlug(Dt,!1),Dt.attachPlug(_e,!0),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}removeNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e){this._nodes[Dt].removeNode(),this._nodes.splice(Dt,1);break}this._nodes.length==1&&this.#t&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,!0),this.stores.attachmentStore.getState().actions.updateFittingSkuIds(),this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e.guid){this._nodes.splice(Dt,1);break}await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(_e){this._globalVariants={},this._globalGeometryVariants={},this.stores=_e,this.stores.productDataStore.getState().categoryData.geometryVariants.map(Dt=>{this._globalGeometryVariants[Dt.id]=Dt.defaultVariant}),this.stores.productDataStore.getState().categoryData.color.map(Dt=>{this._globalVariants[Dt.id]=Dt.defaultLook}),this._currentStructure=new Structure(this.stores,null,this._globalVariants,this._globalGeometryVariants);for(const[Dt,Vt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Dt,Vt);for(const[Dt,Vt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Dt,Vt)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(_e,Dt){let Vt;return Vt=this.stores.productDataStore.getState()?.productData[_e]?.lookDetails[Dt],Vt?.clientProductId?Vt?.clientProductId:""}getCartItems(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,Ht.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)});let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt}}}async getCartItemsAsync(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,qt.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,qt.guid=Ht.guid,_e.push(qt)}),_e=await this.stores.dynamicHookStore.getState().hookOnCartItemsCollected(_e,this.stores.coreSceneStore.getState().CORE_API);let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt.toFixed(2)}}}async getFittingSKUIDs(){if(!this.currentStructure)return[];const{productData:_e}=this.stores.productDataStore.getState(),{sceneSettings:Dt}=this.stores.coreSceneStore.getState(),{draggableUI:Vt,ignoreSpawningCollision:Gt}=Dt;if(!this.currentStructure)return[];const{openPlugTypes:zt,closedPlugTypes:jt,existingSkuids:Ht}=this.analyzeCurrentStructure();if(zt.size===0&&jt.size===0)return[];const Wt=this.findFittingSkuids(_e,zt,jt,Ht,Vt);return this.filterNonBlockedSkuids(Wt,_e,Gt)}analyzeCurrentStructure(){const _e=this.currentStructure.nodes,Dt=new Set,Vt=new Set,Gt=new Set;for(const zt of _e){Gt.add(zt.skuID);for(const jt of zt.plugs)jt.isOpen?jt.acceptedPlugTypes.forEach(Ht=>Dt.add(Ht)):jt.attachedPlug.node.replace&&jt.acceptedPlugTypes.forEach(Ht=>Vt.add(Ht))}return{openPlugTypes:Dt,closedPlugTypes:Vt,existingSkuids:Gt}}findFittingSkuids(_e,Dt,Vt,Gt,zt){const jt=new Set;for(const[Ht,Wt]of Object.entries(_e))if(Wt.plugs)for(const qt of Wt.plugs){for(const Xt of qt.connectsToPlugTypes)if((this.isClosedPlugFitting(Ht,Wt,Xt,Vt,Gt,zt)||this.isOpenPlugFitting(Wt,Xt,Dt))&&jt.add(Ht),jt.has(Ht))break;if(jt.has(Ht))break}return jt}isClosedPlugFitting(_e,Dt,Vt,Gt,zt,jt){if(!Gt.has(Vt)||!jt&&zt.has(_e))return!1;const Ht=this.currentStructure.getNodesByCategoryID(Dt.categoryID);for(const Wt of Ht)if(Wt.skuID!==_e&&this.isNodeCompatible(Wt,Dt))return!0;return!1}isNodeCompatible(_e,Dt){let Vt=!1;for(const Gt of _e.plugs)if(!Gt.isOpen&&Gt.isReceiverPlug&&(Vt=!0,this.isPlugCompatible(Gt,Dt.plugs)))return!0;return!Vt}isPlugCompatible(_e,Dt){return Dt.some(Vt=>Vt.name===_e.name&&_e.attachedPlug.connectsToPlugTypes.some(Gt=>Vt.acceptedPlugTypes.includes(Gt)))}isOpenPlugFitting(_e,Dt,Vt){if(!Vt.has(Dt))return!1;const Gt=this.currentStructure.getFirstNodeByCategoryID(_e.categoryID);return!Gt||!Gt.replace}async filterNonBlockedSkuids(_e,Dt,Vt){const Gt=[];for(const zt of _e)if(Dt[zt].replace)Gt.push(zt);else{const jt=await this.currentStructure.findGhostTransforms(zt,Vt);jt&&jt.transforms.length>0&&Gt.push(zt)}return Gt}async removeAllVariantOverrides(){let _e=this._currentStructure.nodes,Dt=this.stores.productDataStore.getState().productData,Vt=this.stores.itemStore.getState().itemsSpawned;return await _e.map(async Gt=>{if(!Gt.overrideVariant||(Gt.overrideVariant=null,!Dt[Gt.skuID].looks))return;let zt=null;Object.keys(this._globalVariants).map(jt=>{Dt[Gt.skuID].looks.includes(this._globalVariants[jt])&&zt==null&&(zt=this._globalVariants[jt])}),zt&&await this.stores.itemStore.getState().actions.switchToVariant(Vt[Gt.guid].itemData,zt)}),this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1),!0}async switchGlobalGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Yt=>{Yt.id==_e&&(zt=Yt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;let Xt=this.stores.productDataStore.getState().categoryData;Wt.map(Yt=>{jt.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{Yt==nn&&(Jt=!0)}),Jt&&Xt.build.map(nn=>{Zt.products.map(rn=>{nn.skus.map((Qt,en)=>{nn.skus[en]==rn&&(nn.skus[en]=Yt)})})})})}),this._currentStructure.nodes.map(Yt=>{jt.map(Zt=>{Zt.products.map(Jt=>{Yt.skuID==Jt&&Yt.ref!==null&&Zt.products.map(nn=>{Wt.map(rn=>{if(rn==nn){const Qt=this.stores.productDataStore.getState().actions.getProductDataById(rn);let en=Qt.geometriesToHide;Yt.plugs.map(sn=>{!sn.isOpen&&sn.attachedPlug&&sn.type=="weighted_hider"&&sn.attachedPlug.weight>sn.weight&&(en=en.concat(sn.affectedNodes))}),Yt.showNodes(Qt.geometriesToShow),Yt.hideNodes(en),Yt.skuID=rn;const tn=qt[Yt.guid];if(tn&&tn.itemData){Object.keys(Qt).map(cn=>{tn.itemData[cn]=Qt[cn]});const sn=this.stores.assetStore.getState().assets.items[rn];sn&&sn.proxy.isLoaded&&(tn.itemData.proxyScene=sn.proxy.data.scene)}Yt.resetInStock(),Yt.updatePricing()}})})})})}),this.stores.itemStore.setState({itemsSpawned:{...this.stores.itemStore.getState().itemsSpawned}}),this._globalGeometryVariants[_e]=Dt,this.stores.hotspotStore.getState().actions.checkHotspotHealth(),this.stores.inventoryStore.getState().actions.refreshInventory(qt),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.productDataStore.setState({categoryData:Xt}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CategoryData_Updated,Xt),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const Kt=await this.getCartItemsAsync();Kt&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Kt)}async switchGlobalVariant(_e,Dt){this._globalVariants[_e]=Dt;const Vt=this.stores.itemStore.getState().actions;let Gt=this.stores.itemStore.getState().itemsSpawned;for(let Wt=0;Wt<Object.keys(Gt).length;Wt++){let qt=Gt[Object.keys(Gt)[Wt]];if(qt.itemData.looks&&qt.itemData.looks.includes(Dt)){let Xt=this._currentStructure.getNodeByGUID(qt.itemData.guid);Xt&&!Xt.overrideVariant&&await Vt.switchToVariant(qt.itemData,Dt)}}const zt=this.stores.productDataStore.getState().lookData;this.stores.lightStore.getState().actions.processLookEnvMapOverride(Dt);const jt=_e;Object.keys(Gt).length>0&&this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:jt.charAt(0).toUpperCase()+jt.slice(1)+" was successfully switched to "+zt[Dt].label+".",alertTime:3e3,alertType:"success",alertLabel:`${jt} Changed`,alertId:"materialVariantChanged"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),this.stores.itemStore.setState({variantChangeAlert:!this.stores.itemStore.getState().variantChangeAlert});const Ht=await this.getCartItemsAsync();Ht&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Ht)}async#t(_e){if(!_e)return;LOGGER.info({title:"Structure to load",details:_e}),delete this._currentStructure,this._globalVariants={..._e.globalVariants},this._globalGeometryVariants=_e.globalGeometryVariants?{..._e.globalGeometryVariants}:{};const Dt=[..._e.structure];this._currentStructure=new Structure(this.stores,Dt,this._globalVariants,this._globalGeometryVariants);for(const[Vt,Gt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Vt,Gt);for(const[Vt,Gt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Vt,Gt);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(Dt),LOGGER.info({title:"Structure Loaded."})}async loadStructure(_e){if(!_e)return;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),this.stores.coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(_e),this.stores.coreSceneStore.getState().preconfigurationLoaded?this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide):this.stores.coreSceneStore.setState({preconfigurationLoaded:!0}),this.stores.coreSceneStore.getState().configurationLoadedOnRestart||this.stores.coreSceneStore.setState({configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.setState({configurationLoaded:!0}),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated();const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}export(){return{experienceId:this.stores.coreSceneStore.getState().CORE_API.experienceId,structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await this._currentStructure.clear(),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem();const _e=this.stores.attachmentStore.getState().defaultConfig;this.stores.coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#t(_e),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated(),this.stores.coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide);const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}}const createAttachmentStore=kt=>{const _e=attachmentStoreCreator();return _e.setState({stores:kt}),_e},attachmentStoreCreator=()=>create((kt,_e)=>({stores:null,attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async Dt=>{const{actions:Vt,defaultConfig:Gt}=_e();LOGGER.info({title:"Initializing Attachment System!"});const zt=await new AttachmentSystem(Dt);kt({attachmentSystem:zt}),await Vt.updateFittingSkuIds(),await Vt.toggleStructureUpdated()},loadSavedStructureFromConfigID:async Dt=>{const{stores:Vt}=_e();LOGGER.info({title:"Fetching Structure Using ConfigID!"});let Gt="";Dt.length==20&&(Gt=FETCH_CONFIG_ENDPOINT_FB+Dt);let zt=null;return Gt!=""?zt=await getJSONFromEndpoint(Gt):zt=await Vt.nexusApiInstance.getExperienceSaveAndShare(Vt.experienceId,Dt),zt.success===!1?null:Dt.length==20?zt.data:zt.payload.save_data},loadDefaultStructure:async()=>{const{actions:Dt,defaultConfig:Vt}=_e();LOGGER.info({title:"Loading Default Structure!"}),await Dt.loadStructure(Vt)},updateFittingSkuIds:async()=>{const{stores:Dt,attachmentSystem:Vt}=_e();if(!Dt.coreSceneStore.getState().preconfigurationLoaded||!Dt.coreSceneStore.getState().configurationLoaded)return;const Gt=await Vt.getFittingSKUIDs();Gt&&(Dt.itemStore.setState({fittingSkuIds:[...Gt]}),Dt.coreSceneStore.getState().CORE_API.fireEvent(Dt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Gt}))},toggleStructureUpdated:async()=>{const{attachmentSystem:Dt,stores:Vt}=_e();if(kt(zt=>({structureUpdated:!zt.structureUpdated})),!Vt.coreSceneStore.getState().preconfigurationLoaded||!Vt.coreSceneStore.getState().configurationLoaded)return;Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Dt.currentStructure.getCurrentItemsInReplaceableCategory());const Gt=await Dt.getCartItemsAsync();Gt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Gt)},loadStructure:async Dt=>{const{attachmentSystem:Vt,stores:Gt}=_e();LOGGER.info({title:"Loading Structure!"}),Vt&&Gt.coreSceneStore.getState().configurationLoaded!==!1&&await Vt.loadStructure(Dt)},export:()=>{const{attachmentSystem:Dt}=_e();if(Dt)return Dt.export()}}})),createInfoStore=kt=>{const _e=infoStoreCreator();return _e.setState({stores:kt}),_e},infoStoreCreator=()=>create((kt,_e)=>({stores:null,infoObject:{},populateInfoObject:Dt=>{kt(Vt=>({infoObject:Dt}))},infoModalOpen:!1,updateInfoModalOpen:Dt=>{kt(Vt=>({infoModalOpen:Dt}))}})),createUIHotspotStore=kt=>{const _e=uiHotspotStoreCreator();return _e.setState({stores:kt}),_e},uiHotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,activeFeatureID:"",actions:{enterHotspotInFeaturesTab(Vt){const{stores:Gt}=_e();Gt.uiSceneStore.getState().sideMenuState!==2&&Gt.uiSceneStore.setState({sideMenuState:2}),kt({activeFeatureID:Vt})},exitHotspot(){kt({activeFeatureID:null})}}})),createColorStore=kt=>{const _e=colorStoreCreator();return _e.setState({stores:kt}),_e},colorStoreCreator=()=>create((kt,_e)=>({stores:null,allActiveVariants:{},allActiveGeometryVariants:{}})),arrayWithoutElementAtIndex=function(kt,_e){return kt.filter(function(Dt,Vt){return _e!==Vt})},updateQuantityAtIndex=function(kt,_e,Dt){let Vt=kt.slice();return Vt[_e].quantity=Dt,Vt},createCartStore=kt=>{const _e=cartStoreCreator();return _e.setState({stores:kt}),_e},cartStoreCreator=()=>create((kt,_e)=>({stores:null,cart:[],cartTotalPrice:0,cartTotalCompareAtPrice:0,deleteCartItem:Dt=>{kt(Vt=>({cart:arrayWithoutElementAtIndex(Vt.cart,Dt)}))},addToCart:Dt=>{kt(Vt=>({cart:[...Vt.cart,Dt]}))},updateQuantity:(Dt,Vt)=>{kt(Gt=>({cart:updateQuantityAtIndex(Gt.cart,Dt,Vt)}))},previewCartModalOpen:!1,togglePreviewCartModal:()=>{const{previewCartModalOpen:Dt,stores:Vt}=_e();Dt===!0?(Vt.uiSceneStore.getState().CORE_API.reviewCartHidden(),kt({previewCartModalOpen:!1,previewCartMinimized:!1})):(Vt.uiSceneStore.getState().CORE_API.reviewCartShown(),kt({previewCartModalOpen:!0}))},previewCartMinimized:!1,togglePreviewCartMinimized:()=>{const{previewCartMinimized:Dt,stores:Vt}=_e(),Gt=!Dt;kt({previewCartMinimized:Gt}),Vt&&Vt.uiSceneStore&&Vt.uiSceneStore.getState().setSideMenuOpen(!Gt)},actions:{setCartTotalPrice:(Dt,Vt)=>{kt(()=>({cartTotalPrice:Dt,cartTotalCompareAtPrice:Vt}))}}})),createLightStore=kt=>{const _e=lightStoreCreator();return _e.setState({stores:kt}),_e},lightStoreCreator=()=>create((kt,_e)=>({stores:null,defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:Dt=>{kt(Vt=>({envMapUrl:Dt}))},processLookEnvMapOverride:Dt=>{const{envMapUrl:Vt,defaultEnvMapUrl:Gt,actions:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().lookData[Dt],Wt=Ht?.envMapOverride;if(!Ht||!Wt){zt.setEnvLightMap(Gt);return}if(Wt===Vt){LOGGER.info({title:`New Env Map Url is the same as the current ${Wt}`});return}zt.setEnvLightMap(Wt)}}})),createHotspotStore=kt=>{const _e=hotspotStoreCreator();return _e.setState({stores:kt}),_e},hotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>kt({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(Dt){const{hotspotsSpawned:Vt}=_e();Object.keys(Vt).map(Gt=>{Vt[Gt].itemData.guid==Dt.itemData.guid&&delete Vt[Gt]}),kt({hotspotsSpawned:{...Vt}})},checkHotspotHealth(){const{hotspotsHealthCheck:Dt}=_e();kt({hotspotsHealthCheck:!Dt})},toggleHotspotVisibility(){const{hotspotsVisibility:Dt}=_e();kt({hotspotsVisibility:!Dt})},switchHotspotsVisibility(Dt,Vt=!1){kt(Vt===!0?{hotspotsTempVisibility:Dt}:{hotspotsVisibility:Dt})},clickHotspot(Dt,Vt,Gt,zt=!1){const{activeHotspotData:jt,stores:Ht}=_e();kt({lastActiveHotspotData:jt}),hotspotEnter(Ht,Dt,Vt,Gt);let qt=Ht.itemStore.getState().itemsSpawned[Gt].itemData.skuID;zt===!1&&(Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(qt,Dt),hotspot:jt}),Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(Dt=!1){const{activeHotspotData:Vt,isAnyHotspotActive:Gt,stores:zt}=_e();if(Gt&&kt({isAnyHotspotActive:!1}),!!Vt&&(kt({lastActiveHotspotData:Vt}),hotspotExit(zt),Dt===!1)){const jt=Math.round((performance.now()-_e().lastActiveHotspotData.hotspotEnterTime)/1e3);zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:_e().lastActiveHotspotData,hotspotTimeSpent:jt}),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(kt){kt.hotspotStore.setState({activeHotspotData:null}),kt.coreSceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(kt,_e,Dt,Vt){let Gt=kt.hotspotStore.getState();const jt=kt.itemStore.getState().itemsSpawned;let Ht=Gt.visitedHotspotsID;const Wt=jt[Vt].hotspotsData.filter(un=>un.hotspotID==_e);if(!Wt||Wt.length<=0)return;const qt=Wt[0],Xt=jt[Vt].itemData.skuID+"_"+_e;let Yt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt),Zt=new Vector3(0,0,0);Yt&&Yt.ref&&Yt.ref.getWorldPosition(Zt);let Jt=new Quaternion().identity();Yt&&Yt.ref&&Yt.ref.getWorldQuaternion(Jt);let nn=qt.focusPointTransform,rn=ArrToVec3(nn);rn.applyQuaternion(Jt);let Qt=qt.viewPointTransform,en=ArrToVec3(Qt);en.applyQuaternion(Jt);let tn=addVector(Vec3ToArr(rn),Vec3ToArr(Zt)),sn=addVector(Vec3ToArr(en),Vec3ToArr(Zt));kt.cameraStore.setState({focusPointPosition:tn,viewPointPosition:sn}),kt.hotspotStore.setState({activeHotspotData:{hotspotData:{guid:Dt,...qt},itemData:{...jt[Vt],guid:Vt},domID:"rd_"+Xt,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),Ht.includes(Xt)||(Ht.push(Xt),kt.hotspotStore.setState({visitedIDs:{...Ht}}))}var replacingNodes=null,swappableNodes=[];const createGhostStore=kt=>{const _e=ghostStoreCreator();return _e.setState({stores:kt}),_e},ghostStoreCreator=()=>create((kt,_e)=>({stores:null,ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(Dt,Vt=!1,Gt)=>{const{ghostData:zt,ghostsTransform:jt,stores:Ht}=_e();if(zt!==null||jt.length>0){LOGGER.info({title:"ghosts are already spawned for: "+zt.skuID});return}return await new Promise(async(qt,Xt)=>{let Kt={};const Yt=()=>{qt(Kt)};Ht.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,Yt,{once:!0});const Zt=Ht.productDataStore.getState().productData,Jt=Ht.attachmentStore.getState().attachmentSystem.currentStructure;replacingNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const nn=Ht.coreSceneStore.getState().sceneSettings.draggableUI,rn=await Jt.findGhostTransforms(Dt,Vt),Qt=nn?rn&&rn.transforms&&rn.transforms.length===0:!0;if(Zt[Dt].replace&&replacingNodes.length>0&&Qt)if(nn){const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null||cn==null||sn.length<=0){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null&&cn==null){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{transforms:tn,newNodes:sn,connectablePlugs:cn,comboPlugs:un}=rn;let hn=tn,dn=cn,pn=sn,fn=[];for(let mn=0;mn<tn.length;mn++)fn.push("add");if(Zt[Dt].swappable&&!Ht.coreSceneStore.getState().dragging){swappableNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const mn=await Jt.findGhostTransformForReplacement(Dt,swappableNodes);if(mn.transforms)for(let vn=0;vn<mn.transforms.length;vn++)hn.push(mn.transforms[vn]),dn.push(mn.connectablePlugs[vn]),pn.push(mn.newNodes[vn]),fn.push("replace"),mn.newNodes[vn].setModelVisibility(!1)}Kt.transforms=hn,Kt.newNodes=pn,Kt.connectablePlugs=dn,Kt.comboPlugs=un,Kt.addItemOrSwap=fn}if(Kt.transforms.length<=0){Xt();return}const en=await Ht.assetStore.getState().actions.loadProxyAsset(Dt,!0);kt({ghostsTransform:Kt.transforms,ghostData:{proxyScene:en.proxy.data.scene,skuID:Dt,newNodes:Kt.newNodes,addItemOrSwap:Kt.addItemOrSwap,connectablePlugs:Kt.connectablePlugs,comboPlugs:Kt.comboPlugs,count:Gt||Kt.transforms.length}})})},clearAllGhosts:()=>{const{ghostsTransform:Dt}=_e();if(replacingNodes)for(const Vt of replacingNodes)Vt.setModelVisibility(!0);if(swappableNodes)for(let Vt=0;Vt<swappableNodes.length;Vt++)swappableNodes[Vt].setModelVisibility(!0);Dt.length<=0||kt({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),createCameraStore=kt=>{const _e=cameraStoreCreator();return _e.setState({stores:kt}),_e},cameraStoreCreator=()=>create((kt,_e)=>({stores:null,focusPointPosition:new Vector3(0,0,0),sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,cameraControlsRef:null,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{canCameraRotate:Dt=>{const{cameraControlsRef:Vt}=_e();Vt&&(Dt===!0?(Vt.mouseButtons.left=CAMERA_ACTION.ROTATE,Vt.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(Vt.mouseButtons.left=CAMERA_ACTION.NONE,Vt.touches.one=CAMERA_ACTION.NONE))},triggerFetchingCamera:()=>{kt(Dt=>({sendCameraDetailsTrigger:!Dt.sendCameraDetailsTrigger}))},setCameraSettings:Dt=>{const{cameraSettings:Vt,stores:Gt}=_e();Gt.coreSceneStore.getState().isMobile===!0&&Dt.zoomingMultiplier_mobile!==void 0?Dt.zoomingMultiplier=Dt.zoomingMultiplier_mobile:Dt.zoomingMultiplier_desktop!==void 0&&(Dt.zoomingMultiplier=Dt.zoomingMultiplier_desktop),Object.keys(Dt).map(jt=>Vt[jt]=Dt[jt]),kt({cameraSettings:{...Vt},viewPointPosition:ArrToVec3(Vt.initialViewPointPosition)})}}})),createUISceneStore=kt=>{const _e=uiSceneStoreCreator();return _e.setState({stores:kt}),_e},uiSceneStoreCreator=()=>create((kt,_e)=>({stores:null,CORE_API:null,sideMenuState:0,sideMenuOpen:!0,setSideMenuOpen:Dt=>kt({sideMenuOpen:Dt}),cssLoaded:!1,isScreenPortrait:!0,materialOverrideExists:!1,tabSpawnCount:[],coreWCRef:null,removeModalOpen:!1,outOfStockModalOpen:!1,disableCart:!1,inventoryData:{},cartMessage:"",loadConfigId:"",dialogPopupOpen:!1,viewInYourSpaceMenuBtnVisible:!1,loadConfigModalOpen:!1,setLoadConfigModalOpen:Dt=>kt({loadConfigModalOpen:Dt}),setOutOfStockModalOpen:Dt=>kt({outOfStockModalOpen:Dt}),setRemoveModalOpen:Dt=>kt({removeModalOpen:Dt}),moveModalOpen:!1,setMoveModalOpen:Dt=>kt({moveModalOpen:Dt}),setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},setSideMenuState:Dt=>{kt(()=>({sideMenuState:Dt}));const{CORE_API:Vt}=_e();Dt!==2?Vt.exitHotspot():Vt.showAllHotspots()}})),createDynamicHookStore=kt=>{const _e=dynamicHookStoreCreator();return _e.setState({stores:kt}),_e},dynamicHookStoreCreator=()=>create((kt,_e)=>({hookOnCartItemsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnCartItemsCollected"}),Promise.resolve(Dt)),hookOnSceneItemsUpdated:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemsUpdated"}),Promise.resolve()),hookOnNewItemGhostsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnNewItemGhostsCollectedForReplacement:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnSceneItemAdded:async(Dt,Vt,Gt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve()),hookOnCheckout:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve(Dt))}));class STORES{experienceId="";uuid=null;wcRef=null;nexusApiResponseEnvironment="production";nexusApiInstance=null;productDataStore=null;coreSceneStore=null;inventoryStore=null;itemStore=null;assetStore=null;attachmentStore=null;lightStore=null;hotspotStore=null;ghostStore=null;cameraStore=null;infoStore=null;uiHotspotStore=null;colorStore=null;cartStore=null;uiSceneStore=null;constructor(_e){this.wcRef=_e,this.uuid=v4(),this.dynamicHookStore=createDynamicHookStore(this),this.productDataStore=createProductDataStore(this),this.coreSceneStore=createCoreSceneStore(this),this.inventoryStore=createInventoryStore(this),this.itemStore=createItemStore(this),this.assetStore=createAssetStore(this),this.attachmentStore=createAttachmentStore(this),this.lightStore=createLightStore(this),this.hotspotStore=createHotspotStore(this),this.ghostStore=createGhostStore(this),this.cameraStore=createCameraStore(this),this.infoStore=createInfoStore(this),this.uiHotspotStore=createUIHotspotStore(this),this.colorStore=createColorStore(this),this.cartStore=createCartStore(this),this.uiSceneStore=createUISceneStore(this)}setupNexusApiInstance(_e){let Dt=p$5.PRODUCTION;_e=="local"?Dt=p$5.LOCAL:_e==="staging"&&(Dt=p$5.STAGING);const Vt=window.location.href,Gt=window.epigraph?window.epigraph.epigraphSessionId:"no-session-id",zt="2.3.3",jt=g$3.generateXPath(this.wcRef);this.nexusApiInstance=new P$2(Dt,Vt,Gt,zt,jt)}}class EpigraphConfigurator extends h$5{#t=void 0;#i=null;#n=null;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";customVersionId="";experienceId="";apiMode="production";gaMeasurementId="";#s=getUrlParameterByName("launchInAR")==="true";#r=!1;api={core:null,ui:null};stores=null;constructor(){let _e=s$2.PRODUCTION;super("2.3.3",_e),this.stores=new STORES(this),this.api.ui=this,this.shadowRoot||this.attachShadow({mode:"open"}),this.hasAttribute("launch-in-ar")&&(this.#s=!0),this.#c(),this.#o()}#c(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(PRELOAD_MUTED_CSS.content.cloneNode(!0)),this.preloadDiv.appendChild(PRELOAD_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv);const _e=this.shadowRoot;this.#n=Dt=>{if(Dt.code=="Enter"){let Vt=_e.activeElement;Vt&&Vt.click()}},this.shadowRoot.addEventListener("keyup",this.#n)}#o(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(HICCUP_MUTED_CSS.content.cloneNode(!0)),this.hiccupUi.appendChild(HICCUP_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}get configuratorWcId(){return this.#t}get launchInAr(){return this.#s}#a(){if(this.hasAttribute("id")?this.#t=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#t=this.getAttribute("id")),this.hasAttribute("custom-version-id")&&(this.customVersionId=this.getAttribute("custom-version-id")),this.hasAttribute("experience-id")&&(this.experienceId=this.getAttribute("experience-id")),this.hasAttribute("api-mode")){const _e=this.getAttribute("api-mode");["local","staging","production"].includes(_e)&&(this.apiMode=_e)}this.stores.setupNexusApiInstance(this.apiMode),(this.hasAttribute("ga-measurement-id")||this.hasAttribute("ga-code"))&&(this.gaMeasurementId=this.getAttribute("ga-measurement-id")??this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.consentPlugin=this.getAttribute("consent-plugin"),this.consentIdentifier=this.getAttribute("consent-identifier"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#r===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#a(),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const _e=document.createElement("div");_e.id="configuratorContainer",_e.style.width="100%",_e.style.height="100%",_e.style.userSelect="none",_e.style.overflow="hidden",this.shadowRoot.appendChild(_e),this.#i=createRoot(_e),this.#i.render(jsxRuntimeExports.jsx(App,{stores:this.stores,customVersionId:this.customVersionId,experienceId:this.experienceId,disableUI:this.hasAttribute("disable-ui"),disableCart:this.hasAttribute("disable-cart"),configuratorWcRef:this,gaMeasurementId:this.gaMeasurementId},"Configurator-App")),this.#r=!0}disconnectedCallback(){for(this.#i&&(this.#i.unmount(),this.#i=null),this.#n&&(this.shadowRoot.removeEventListener("keyup",this.#n),this.#n=null),this.#t=void 0,this.clientAccessKey=null,this.validationPassed=!1,this.projectID="",this.configID="default",this.customVersionId="",this.gaMeasurementId="",this.#s=!1,this.#r=!1,this.api={core:null,ui:null},this.preloadDiv&&(this.preloadDiv.remove(),this.preloadDiv=null),this.hiccupUi&&(this.hiccupUi.remove(),this.hiccupUi=null);this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild)}showPreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload"))}async hidePreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("showPreload"),await wait(1e3),this.preloadDiv.classList.add("no-pointer-events"))}showHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup"))}async hideHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("show-hiccup"),await wait(1e3),this.hiccupUi.classList.add("no-pointer-events"))}}window.customElements.define("epigraph-configurator",EpigraphConfigurator);
4796
+ `;const createCoreSceneStore=kt=>{const _e=coreStoreCreator();return _e.setState({stores:kt}),_e},coreStoreCreator=()=>create((kt,_e)=>({stores:null,shadowRefreshKey:0,CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,lastDragEndTime:0,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},technicalRequirements:{minIosVersion:"11"},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,dragThreshold:25,dragTimeout:250,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{arButtonLabel:"AR",arHoverLabel:"View In Your Space",restartButtonLabel:"Restart",restartHoverLabel:"Restart",saveButtonLabel:"Save",saveHoverLabel:"Save",shareButtonLabel:"Share",shareHoverLabel:"Share",sizeButtonLabel:"Size",sizeHoverLabel:"Size",hotspotsButtonLabel:"Hotspots",hotspotsHoverLabel:"Hotspots",instructionsButtonLabel:"Instructions",instructionsHoverLabel:"Instructions",cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",featuresTabEmptyText:"*Please add an item to the scene to see the features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},actions:{refreshShadows:()=>{const{shadowRefreshKey:Dt}=_e();kt({shadowRefreshKey:Dt+1})},popFromAlertQueue:()=>{const{alertQueue:Dt}=_e();return Dt.shift(),kt({alertQueue:Dt}),Dt},addToAlertQueue:Dt=>{const{alertQueue:Vt,currentAlertData:Gt}=_e();return Vt.length>0&&Vt[Vt.length-1].alertId&&Dt.alertId===Vt[Vt.length-1].alertId||Vt.length==0&&Gt&&Gt.alertId&&Gt.alertId==Dt.alertId||(Vt.push(Dt),kt({alertQueue:Vt})),Vt},getDeviceState:()=>{const{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}=_e();return{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}},enableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!1,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!0,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:Dt}=_e();return Dt},sendAlert:Dt=>{kt({alertData:{...Dt}})},switchCursor(Dt){const{cursorParentRef:Vt}=_e();if(!Vt)return;let Gt="";switch(Dt){default:case CURSORS.GRAB:Gt="grabCursor";break;case CURSORS.GRABBING:Gt="grabbingCursor";break;case CURSORS.BLOCKED:Gt="blockedCursor";break;case CURSORS.POINTER:Gt="pointerCursor";break;case CURSORS.MOVE:Gt="moveCursor";break}for(let zt=0;zt<Vt.classList.length;zt++)Vt.classList[zt].includes("Cursor")&&Vt.classList.remove(Vt.classList[zt]);Vt.classList.add(Gt)},setAlertSettings:Dt=>{kt({alertSettings:Dt})},async completeDropItem(){const{draggingOnDropCollisionData:Dt,CORE_API:Vt,stores:Gt}=_e(),zt=Gt.attachmentStore.getState().attachmentSystem,{node:jt,attachedChildrenGuids:Ht,collidingStatus:Wt,intersectingGhostObject:qt,initPosition:Xt,initRotation:Kt,detachedPlugs:Yt,attachedNodesToCurrentNode:Zt}=Dt;Vt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[Qt,en]of Ht.entries())Wt[Qt]===!0&&await Gt.itemStore.getState().actions.removeItemByGUID(en);const Jt=qt.userData;let nn=jt.getPlugByName(Jt.incomingPlugName),rn=zt.currentStructure.getPlugByGUID(Jt.receiverPlugGUID);jt.ref.position.set(qt.position.x,qt.position.y,qt.position.z),jt.ref.setRotationFromEuler(qt.rotation),jt.transform={position:qt.position,rotation:qt.quaternion},zt.currentStructure.connectPlugs({incomingPlug:nn,receiverPlug:rn}),Gt.ghostStore.getState().actions.clearAllGhosts(),Gt.itemStore.getState().actions.deselectItem(),Zt.map(Qt=>{jt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},jt.dragging=!1,Qt.dragging=!1}),await Gt.attachmentStore.getState().actions.updateFittingSkuIds()},async revertDropItem(){const{draggingOnDropCollisionData:Dt,stores:Vt}=_e(),Gt=Vt.attachmentStore.getState().attachmentSystem,{node:zt,attachedChildrenGuids:jt,collidingStatus:Ht,intersectingGhostObject:Wt,initPosition:qt,initRotation:Xt,detachedPlugs:Kt,attachedNodesToCurrentNode:Yt}=Dt;CORE_API.alert({alertMsg:"Position of item"+zt.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const Zt=Kt.neighbourDetachedPlugs;Zt&&(Kt.neighbourNode.detachNodeFromReceiver(),Gt.currentStructure.connectPlugs({incomingPlug:Zt.incomingPlug,receiverPlug:Zt.receiverPlug}));let Jt=Kt.rootDetachedPlugs.incomingPlug,nn=Kt.rootDetachedPlugs.receiverPlug;zt.ref.position.set(qt.x,qt.y,qt.z),zt.ref.setRotationFromEuler(Xt);let rn=new Quaternion().identity();zt.ref.getWorldQuaternion(rn),zt.transform={position:qt,rotation:rn},Gt.currentStructure.connectPlugs({incomingPlug:Jt,receiverPlug:nn}),Vt.ghostStore.getState().actions.clearAllGhosts(),Vt.itemStore.getState().actions.deselectItem(),Yt.map(Qt=>{zt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},zt.dragging=!1,Qt.dragging=!1}),await Vt.attachmentStore.getState().actions.updateFittingSkuIds()},setCoreSettings:Dt=>{const{sceneSettings:Vt,isMobile:Gt,isTouchDevice:zt,isLandscape:jt,actions:Ht}=_e(),Wt=Gt===!0?"mobile":"desktop",qt=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const Xt of qt)if(Xt==="draggableUI"||Xt==="clickToAddUi"||Xt==="emptySceneTextFontSize"||Xt==="showInstructionsOnStartup"||Xt==="showInstructionsBtn"||Xt==="instructionsSettings"){const Yt=`${Xt}_${jt===!1&&zt===!0?"mobile":"desktop"}`;Dt[Yt]!==void 0?Vt[Xt]=Dt[Yt]:Vt[Yt]!==void 0&&(Vt[Xt]=Vt[Yt])}else if(Xt==="textSettings"||Xt==="variantsTabOrder"||Xt==="alertControl"||Xt==="outlineSettings"){if(Dt.hasOwnProperty(Xt)){let Kt=Vt[Xt];Object.keys(Kt).map(Yt=>{let Zt=Dt[Xt];Zt.hasOwnProperty(Yt)?(Yt==="visibleEdgeColor"||Yt==="hiddenEdgeColor")&&(Zt[Yt]=new Color$1(Zt[Yt]).convertSRGBToLinear()):Zt[Yt]=Kt[Yt]})}}else{const Kt=`${Xt}_${Wt}`;if(Dt[Kt]!==void 0){let Yt=`${Xt}Btn`;Xt=="showContextMenu"&&(Yt=`${Xt}`),Vt[Yt]=Dt[Kt]}}Dt.disableCart===!0&&Ht.disableCart(),Object.keys(Dt).map(Xt=>Vt[Xt]=Dt[Xt]),Vt.emptySceneText===null&&(Vt.emptySceneTextFontSize=Gt?"1.2rem":"1.5rem",Vt.draggableUI===!0?Vt.emptySceneText="Drag an item here to get started":Vt.emptySceneText="Select an item to get started"),kt({sceneSettings:{...Vt,ghostThreeColor:{r:Vt.ghostColor.r/255,g:Vt.ghostColor.g/255,b:Vt.ghostColor.b/255,a:Vt.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:Vt.ghostColorOnHoverWithDraggableUi.r/255,g:Vt.ghostColorOnHoverWithDraggableUi.g/255,b:Vt.ghostColorOnHoverWithDraggableUi.b/255,a:Vt.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(Dt=null)=>kt(Vt=>({autoFocusRef:Dt,autoFocusTrigger:Vt.autoFocusTrigger+1})),requestNewScreenshot:async(Dt,Vt)=>{const{CORE_API:Gt}=_e();return new Promise(async(zt,jt)=>{LOGGER$1.info({title:"Taking a screenshot"});const{screenshotRenderer:Ht,sceneRef:Wt,screenshotCamera:qt,canvasSize:Xt}=_e(),Kt=await Gt.getCurrentCameraDetails();if(Ht.setClearColor(16777215),qt.copy(Kt),Dt!==null&&(qt.position.copy(Dt.position),qt.rotation.copy(new Euler(Dt.rotation.x,Dt.rotation.y,Dt.rotation.z))),Vt==null?Ht.setSize(Xt.width,Xt.height):Ht.setSize(Vt.width,Vt.height),Ht.render(Wt.parent,qt),Ht.preserveDrawingBuffer===!1)LOGGER$1.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),jt({success:!1,imageData:null});else{LOGGER$1.info({title:"Downloading the screenshot"});const Yt=Ht.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");zt({success:!0,imageData:Yt})}})}}})),createProductDataStore=kt=>{const _e=productDataStoreCreator();return _e.setState({stores:kt}),_e},productDataStoreCreator=()=>create((kt,_e)=>({stores:null,productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentCompareAtPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].compareAtPrice)}),Vt[Gt]=jt}),Vt},getCurrentPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].price)}),Vt[Gt]=jt}),Vt},updateCompareAtPricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updateCompareAtPricingForProduct(Gt,jt,zt[jt])})})},updatePricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updatePricingForProduct(Gt,jt,zt[jt])})})},updateCompareAtPricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.compareAtPrice=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updateCompareAtPricing())},updatePricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.price=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updatePricing())},setProductData:Dt=>{const{stores:Vt}=_e();let Gt={};Dt&&Object.keys(Dt).map(zt=>{const jt=Dt[zt];if(jt.skuID=zt,jt.skuID.toLowerCase()==="root"){jt.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},jt.defaultVariant="default";return}if(jt?.lookDetails){const Ht=jt.lookDetails;let Wt=Object.keys(jt.lookDetails);if(Wt.includes("default")){const Xt=Wt.indexOf("default");Wt.splice(Xt,1)}jt.looks=Wt,Object.keys(jt.lookDetails).map(Xt=>{let Kt=jt.lookDetails[Xt];Kt.inventory===void 0&&(Kt.inventory=DEFAULT_INVENTORY),Kt.price===void 0&&(Kt.price=DEFAULT_PRODUCT_PRICE),Kt.compareAtPrice===void 0&&(Kt.compareAtPrice=DEFAULT_PRODUCT_COMPARE_AT_PRICE),Gt[zt]={...Gt[zt],[Xt]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let qt=jt?.defaultVariant;qt||(LOGGER$1.warn({title:`No defaultVariant set for ${jt.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),qt=Object.keys(jt.lookDetails).sort()[0],LOGGER$1.warn({title:"Auto resolved default look ID: "+qt})),Wt.includes(qt)?(jt.lookDetails.default=Ht[qt],jt.lookDetails.default.id=qt):(LOGGER$1.error({title:`Default look [ ${qt} ] doesn't exist for: ${zt}. Please make sure to select a default variant in Input Data for this project`}),jt.lookDetails.default=null)}}),LOGGER$1.info({title:"PRODUCT DATA: ",details:Dt}),Vt.inventoryStore.setState({inventoryData:Gt}),kt({productData:Dt})},setCategoryData:Dt=>{const{productData:Vt}=_e();Dt.geometryVariants!==void 0&&Dt.geometryVariants.map(Gt=>{Gt.defaultVariant===void 0&&Object.keys(Gt.variants).length>0&&(Gt.defaultVariant=Object.keys(Gt.variants)[0])}),Dt.color!==void 0&&Dt.color.map(Gt=>{(Gt.defaultLook===void 0&&Gt.looks.length>0||!Gt.looks.includes(Gt.defaultLook))&&(Gt.defaultLook=Gt.looks[0])}),kt({categoryData:Dt}),Dt.build!==void 0&&Dt.build.map(Gt=>{Gt.skus.map(zt=>{Vt[zt].categoryID=Gt.categoryID,Vt[zt].categoryLabel=Gt.label,Vt[zt].swappable=Gt.swappable?Gt.swappable:!1,Vt[zt].replace=Gt.replace})})},getProductDataById:Dt=>{const{productData:Vt}=_e();let Gt=null;return Vt[Dt]&&(Gt=Vt[Dt]),Gt},setLookData:Dt=>kt({lookData:Dt}),setHotspotsData:Dt=>{const{categoryData:Vt,productData:Gt}=_e();Vt.geometryVariants&&Object.keys(Dt).map(zt=>{Dt[zt].map(jt=>{jt.geometryVariantID&&Vt.geometryVariants.map(Ht=>{Object.keys(Ht.variants).map(Wt=>{jt.geometryVariantID==Wt&&Ht.productsInCategory.map(qt=>{let Xt=null;qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)&&(Xt=Dt[Kt])}),qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)||(Dt[Kt]=Xt)})})})})})}),kt({hotspotsData:Dt})},setAssetsData:Dt=>kt({assetsData:Dt})}})),createItemStore=kt=>{const _e=itemStoreCreator();return _e.setState({stores:kt}),_e},itemStoreCreator=()=>create((kt,_e)=>({stores:null,variantChangeAlert:!1,focusedGUID:null,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],fittingSkuIds:[],filteredCollidersRef:[],selectedItemData:null,defaultSceneItemCount:0,busySpawningItem:!1,busyReplacingItem:!1,busySpawningDependency:!1,busyDraggingItem:!1,busyRemovingItem:!1,isBusy:()=>{const{busySpawningItem:Dt,busyReplacingItem:Vt,busySpawningDependency:Gt,busyDraggingItem:zt,busyRemovingItem:jt}=_e();return Dt||Vt||Gt||zt||jt},actions:{triggerModelLoaded:()=>{kt(Dt=>({modelLoadedAlert:Dt.modelLoadedAlert+1}))},triggerRemoveItem:()=>{kt(Dt=>({removeItemTrigger:!Dt.removeItemTrigger}))},addToRemoveItems:Dt=>{const{removeItems:Vt}=_e();Vt.push(Dt)},switchToVariant:async(Dt,Vt,Gt=!1)=>{const{variantChangeAlert:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().categoryData;let qt=jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.guid);const Xt=jt.assetStore.getState().assets.items,Kt=qt.ref.getObjectByName("GRP_RenderGeometry");Xt[Dt.skuID].data||Ht.geometryVariants&&Ht.geometryVariants.map(Yt=>{Yt.productsInCategory.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{nn==Dt.skuID&&(Jt=!0)}),Jt&&Zt.products.map(nn=>{const rn=jt.assetStore.getState().assets.items[nn].data;rn&&(jt.assetStore.getState().assets.items[Dt.skuID].data=rn)})})}),qt.modelFunctions&&(await qt.modelFunctions.selectVariant(Kt,Vt),Gt?(qt.overrideVariant=Vt,jt.coreSceneStore.getState().CORE_API.fireEvent(jt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):qt.currentVariant=Vt,kt({variantChangeAlert:!zt}))},clearAllItems:()=>{kt({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:Dt=>{kt({itemsSpawned:Dt,itemsCount:Object.keys(Dt).length})},setHoveredItemRef:Dt=>kt({hoveredItemRef:Dt}),setCollidersRef:Dt=>{const{stores:Vt}=_e();kt({collidersRef:Dt});let Gt=[];for(let zt=0;zt<Dt.length;zt++)Dt[zt].current&&Gt.push(Dt[zt]);Vt.itemStore.setState({filteredCollidersRef:[...Gt]})},setSelectedItemData:Dt=>{const{actions:Vt,stores:Gt}=_e(),zt=Gt.attachmentStore.getState().attachmentSystem.currentStructure;kt({selectedItemData:{...Dt}});let jt={};try{jt=buildHoverGroupMap(zt,Dt.itemData.guid,null)}catch(Ht){LOGGER$1.log({title:"Couldn't resolve hovered items...",details:Ht})}Vt.setHoveredItemRef(jt),Gt.hotspotStore.getState().actions.switchHotspotsVisibility(!1,!0),Gt.cameraStore.getState().actions.canCameraRotate(!1)},deselectItem:()=>{const{selectedItemData:Dt,stores:Vt,actions:Gt}=_e();Dt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Hide,Dt),kt(()=>({selectedItemData:null})),Vt.hotspotStore.getState().actions.switchHotspotsVisibility(!0,!0),Vt.cameraStore.getState().actions.canCameraRotate(!0),Gt.setHoveredItemRef({})},removeItemByGUID:async Dt=>{const{itemsSpawned:Vt,actions:Gt,stores:zt}=_e();if(Vt.hasOwnProperty(Dt))return kt({busyRemovingItem:!0}),new Promise(async(jt,Ht)=>{const Wt=qt=>{Dt===qt.data.itemData.guid&&(kt({busyRemovingItem:!1}),jt(Dt))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,Wt,{once:!0}),Gt.addToRemoveItems(Dt),Gt.triggerRemoveItem()})},addItemBySkuID:async(Dt,Vt=0,Gt=!1,zt)=>{kt({busySpawningItem:!0});const{actions:jt,itemsSpawned:Ht,stores:Wt}=_e(),qt=Wt.productDataStore.getState().productData,Xt=Wt.productDataStore.getState().hotspotsData,Kt=Wt.attachmentStore.getState().attachmentSystem;let Yt=!0;const Zt=await new Promise(async(Jt,nn)=>{if(LOGGER$1.info({title:`Spawning item: ${Dt}`}),jt.deselectItem(),!qt[Dt]){LOGGER$1.warn({title:`Product not found: ${Dt}`}),Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:Dt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Yt=!1,nn(Dt+": product not found!");return}const rn=[...Wt.ghostStore.getState().ghostsTransform],Qt={...Wt.ghostStore.getState().ghostData};if(rn.length<=0){Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),Yt=!1,nn("No available connections for this product to attach to");return}const en=tn=>{Dt===tn.data&&Jt(Qt.newNodes[Vt].guid)};if(Wt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,en,{once:!0}),Qt.addItemOrSwap[Vt]=="replace")await replaceItem(kt,Wt,Ht,Qt.skuID,rn[Vt],Qt.newNodes[Vt]);else{Wt.ghostStore.getState().actions.clearAllGhosts();const tn=Qt.newNodes[Vt];tn.isDependent=Gt;let sn=!0;if(qt[Qt.skuID].hasOwnProperty("disableInteraction")){const dn=qt[Qt.skuID].disableInteraction;(dn==!0||dn==!1)&&(sn=!dn)}zt!=null&&(sn=zt),tn.isInteractive=sn;const{position:cn,rotation:un}=rn[Vt];tn.transform={position:cn,rotation:un},Kt.currentStructure.addNode(tn),Qt.connectablePlugs[Vt].receiverPlug.type=="unvisualizedPlug"&&Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"This product is not shown in your 3D configuration but can be found in your shopping list.",alertTime:3e3,alertType:"warn",alertLabel:"Internal Storage",persistant:!1,alertId:"unvisualizedItemSpawn"}),Qt.comboPlugs[Vt].length>0&&Qt.connectablePlugs[Vt].incomingPlug.type=="comboPlug"&&Qt.comboPlugs[Vt].map(dn=>{Kt.currentStructure.connectPlugs(dn)}),Qt.connectablePlugs[Vt].incomingPlug.comboPlugConnector=!0,Kt.currentStructure.connectPlugs(Qt.connectablePlugs[Vt]);const hn=await Wt.assetStore.getState().actions.loadProxyAsset(Qt.skuID,!0);LOGGER$1.info({title:"GHOST NEW NODE: ",details:tn}),Ht[tn.guid]={itemData:{proxyScene:hn.proxy.data.scene,guid:Qt.newNodes[Vt].guid,...qt[Qt.skuID],position:cn,rotation:un,hasItemLoaded:!1,isDependent:Gt,isInteractive:sn},hotspotsData:Xt[Qt.skuID],hotspotSpawned:!1},await wait(1),jt.setItemsSpawned({...Ht})}}).catch(Jt=>{LOGGER$1.error({title:Jt}),Yt=!1});if(Yt===!1)return kt({busySpawningItem:!1}),Zt;if(Wt.coreSceneStore.getState().preconfigurationLoaded&&Wt.coreSceneStore.getState().configurationLoaded){const Jt=await Kt.getCartItemsAsync();Jt&&Wt.coreSceneStore.getState().CORE_API.fireEvent(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Jt)}if(await jt.resolvePlugDependencyOnGUID(Zt),kt({busySpawningItem:!1}),!Gt){const Jt=Kt.currentStructure,nn=Jt.getNodeByGUID(Zt);await Wt.dynamicHookStore.getState().hookOnSceneItemAdded(nn,Jt.nodes,Wt.coreSceneStore.getState().CORE_API),await Wt.attachmentStore.getState().actions.updateFittingSkuIds()}return Zt},async addItemWithTransform(Dt,Vt,Gt,zt=!0){const{actions:jt,itemsSpawned:Ht,defaultSceneItemCount:Wt,stores:qt}=_e(),Xt=qt.productDataStore.getState().productData,Kt=qt.productDataStore.getState().hotspotsData;return await new Promise(async(Zt,Jt)=>{if(jt.deselectItem(),!Xt[Vt]){qt.coreSceneStore.getState().CORE_API.alert({alertMsg:Vt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Jt(Vt+": product not found!");return}const{position:nn,rotation:rn}=Dt;Ht[Gt]!=null&&(qt.hotspotStore.getState().actions.removeHotspotForItem({...Ht[Gt]}),delete Ht[Gt]);const Qt=tn=>{Vt.toLowerCase()==tn.data.toLowerCase()&&Zt(Gt)};qt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(qt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Qt,{once:!0});const en=await qt.assetStore.getState().actions.loadProxyAsset(Vt,!0);if(en==null){Jt(Vt+": Asset not found!");return}await wait(1),Vt.toLowerCase()==="root"&&kt({defaultSceneItemCount:Wt+1}),Ht[Gt]={itemData:{proxyScene:en.proxy.data.scene,guid:Gt,...Xt[Vt],position:nn,rotation:rn,hasItemLoaded:!1,isInteractive:zt},hotspotsData:Kt[Vt],hotspotSpawned:!1},kt({itemsSpawned:{...Ht}})}).catch(Zt=>{LOGGER$1.info({title:Zt})})},async resolvePlugDependencyOnGUID(Dt){const{actions:Vt,itemsSpawned:Gt,defaultSceneItemCount:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().productData,Wt=jt.attachmentStore.getState().attachmentSystem,qt=Gt[Dt].itemData.skuID,Xt=Ht[qt]?.plugs;if(!Xt)return;let Kt=!1;for(const Yt of Xt)Yt?.dependencySku&&(Kt=!0);Kt&&(kt({busySpawningDependency:!0}),await new Promise(async(Yt,Zt)=>{const Jt=[];for(const nn of Xt){const rn=nn?.dependencySku;if(!rn)continue;const Qt=async()=>{LOGGER$1.info({title:`Found a dependency: ${rn} on the plug: ${nn.name}`});let en=!0;Ht[rn]&&Ht[rn].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(en=Ht[rn].ignoreSpawningCollisionAsDependency),nn.hasOwnProperty("ignoreSpawningCollision")&&(en=nn.ignoreSpawningCollision);let tn=jt.coreSceneStore.getState().sceneSettings.ignoreSpawningCollision;Ht[rn].hasOwnProperty("ignoreSpawningCollision")&&(tn=Ht[rn].ignoreSpawningCollision),Ht[rn].ignoreSpawningCollision=en,jt.ghostStore.setState({ghostVisibility:!1});const sn=await jt.ghostStore.getState().actions.spawnGhostsForSkuID(rn,en);if(Ht[rn].ignoreSpawningCollision=tn,!sn)return;const cn=Wt.currentStructure.getNodeByGUID(Dt),un=cn.getPlugByName(nn.name)?.guid,hn=nn?.isDependencySkuInteractive?nn.isDependencySkuInteractive===1:!1,dn=sn.connectablePlugs;let pn=-1;for(const mn of dn)mn.receiverPlug.guid===un&&(pn=dn.indexOf(mn));if(pn==-1){jt.ghostStore.getState().actions.clearAllGhosts();return}const fn=await Vt.addItemBySkuID(rn,pn,!0,hn);qt.toLowerCase()==="root"&&Ht[rn].ignoreInCart&&kt({defaultSceneItemCount:zt+1}),fn!==null&&cn.addMyDependenciesGUID(fn)};Jt.push(await Qt())}await Promise.all(Jt),Yt(!0)}),kt({busySpawningDependency:!1}))},async replaceGuidItemBySkuId(Dt,Vt){const{itemsSpawned:Gt,stores:zt}=_e();if(Gt[Dt]==null)return!1;const jt=zt.attachmentStore.getState().attachmentSystem.currentStructure,Ht=jt.getNodeByGUID(Dt);if(!Ht||!Ht.isReplaceableWithSkuId(Vt))return!1;LOGGER$1.info({title:"Replacing Item"});const qt=zt.productDataStore.getState().productData,Xt=zt.productDataStore.getState().hotspotsData;kt({busyReplacingItem:!0}),await new Promise(async(Kt,Yt)=>{const Zt=async()=>{LOGGER$1.info({title:"Removed old item with guid: "+Dt});const Jt=async en=>{Vt===en.data&&(jt.recalculateStructureFromNode(Ht.whichNodeAreWeAttachedTo()),await zt.attachmentStore.getState().actions.toggleStructureUpdated(),kt({busyReplacingItem:!1}),Kt(Ht.guid))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Jt,{once:!0});const nn=await zt.assetStore.getState().actions.loadProxyAsset(Vt,!0),rn={receiverPlug:Ht.whichPlugAreWeAttachedTo(),incomingPlug:Ht.whichPlugAreWeAttachedUsing()};jt.findItemTransform(rn);let Qt=!0;if(qt[Vt]&&Object.prototype.hasOwnProperty.call(qt[Vt],"disableInteraction")){const en=qt[Vt].disableInteraction;(en===!0||en===!1)&&(Qt=!en)}Ht.isInteractive=Qt,Gt[Dt]={itemData:{proxyScene:nn.proxy.data.scene,guid:Dt,...qt[Vt],position:Ht.transform.position,rotation:Ht.transform.rotation,hasItemLoaded:!1,isInteractive:Qt},hotspotsData:Xt[Vt],hotspotSpawned:!1},LOGGER$1.warn({title:"SWITCHING VARIANT: ",details:Ht.currentVariant}),zt.itemStore.setState({itemsSpawned:{...Gt}})};zt.hotspotStore.getState().actions.removeHotspotForItem({...Gt[Dt]}),delete Gt[Dt],Ht.update(Vt),zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}}}));async function replaceItem(kt,_e,Dt,Vt,Gt,zt){LOGGER$1.info({title:"Replacing Item"});const{position:jt,rotation:Ht}=Gt,Wt=_e.productDataStore.getState().productData,qt=_e.productDataStore.getState().hotspotsData,Xt=_e.attachmentStore.getState().attachmentSystem.currentStructure;return kt({busyReplacingItem:!0}),new Promise(async(Kt,Yt)=>{const Zt=async()=>{const Jt=await _e.assetStore.getState().actions.loadProxyAsset(Vt,!0),nn=async Qt=>{Vt===Qt.data&&(Xt.recalculateStructureFromNode(zt),await _e.attachmentStore.getState().actions.toggleStructureUpdated(),_e.ghostStore.getState().actions.clearAllGhosts(),kt({busyReplacingItem:!1}),Kt(zt.guid))};_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,nn,{once:!0});let rn=!0;if(Wt[Vt]&&Object.prototype.hasOwnProperty.call(Wt[Vt],"disableInteraction")){const Qt=Wt[Vt].disableInteraction;(Qt===!0||Qt===!1)&&(rn=!Qt)}zt.isInteractive=rn,Dt[zt.guid]={itemData:{proxyScene:Jt.proxy.data.scene,guid:zt.guid,...Wt[Vt],position:jt,rotation:Ht,hasItemLoaded:!1,isInteractive:rn},hotspotsData:qt[Vt],hotspotSpawned:!1},LOGGER$1.warn({title:"SWITCHING VARIANT: ",details:zt.currentVariant}),zt.currentVariant=zt.currentVariant,zt.transform=Gt,_e.itemStore.setState({itemsSpawned:{...Dt}})};_e.hotspotStore.getState().actions.removeHotspotForItem({...Dt[zt.guid]}),delete Dt[zt.guid],zt.update(Vt),_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}const createInventoryStore=kt=>{const _e=inventoryStoreCreator();return _e.setState({stores:kt}),_e},inventoryStoreCreator=()=>create((kt,_e)=>({stores:null,inventoryData:{},actions:{updateInventoryForAllProducts:Dt=>{const{actions:Vt,stores:Gt}=_e();Object.keys(Dt).map(zt=>{let jt=Dt[zt];Object.keys(jt).map(Ht=>{Vt.updateInventoryForProduct(zt,Ht,jt[Ht].inventory)})}),Vt.refreshInventory(Gt.itemStore.getState().itemsSpawned)},updateInventoryForProduct:(Dt,Vt,Gt)=>{const{inventoryData:zt}=_e();let jt=zt[Dt],Ht=jt[Vt];!jt||!Ht||(Ht.inventory=Gt)},_clearInScene:()=>{const{inventoryData:Dt}=_e();Object.keys(Dt).map(Vt=>{const Gt=Dt[Vt];Object.keys(Gt).map(zt=>{Gt[zt].inScene=[]})})},refreshInventory:Dt=>{if(!Dt)return;LOGGER$1.info({title:"Refreshing Inventory"});const{actions:Vt,inventoryData:Gt,stores:zt}=_e();Vt._clearInScene();const jt=zt.attachmentStore.getState().attachmentSystem;if(jt===null)return;const Ht=jt.currentStructure;if(Ht===null)return;Object.keys(Dt).map(Kt=>{const Yt=Ht.getNodeByGUID(Kt);if(!Yt)return;const Zt=Yt.overrideVariant?Yt.overrideVariant:Yt.currentVariant;if(!Zt)return;const Jt=Gt[Yt.skuID];if(!Jt||!Jt[Zt]?.inScene)return;Jt[Zt].inScene.push(Kt),zt.coreSceneStore.getState().sceneSettings.disableCart===!0?Yt.inStock={variantName:Zt,newValue:!0}:Jt[Zt].inScene.length>Jt[Zt].inventory?Yt.inStock={variantName:Zt,newValue:!1}:Yt.inStock={variantName:Zt,newValue:!0}});let Wt=!1;Object.keys(Gt).map(Kt=>{const Yt=Gt[Kt];Object.keys(Yt).map(Zt=>{Yt[Zt].countAvailable=Yt[Zt].inventory-Yt[Zt].inScene.length,Yt[Zt].countAvailable<0?(Yt[Zt].countUnavailable=Yt[Zt].countAvailable*-1,Yt[Zt].countAvailable=0,Wt=!0):Yt[Zt].countUnavailable=0})});const qt={alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"},Xt=compareObjects(zt.coreSceneStore.getState().persistantAlertData,qt);Wt===!1&&Xt===!0&&zt.coreSceneStore.getState().CORE_API.removePersistantAlert(),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Inventory_Updated,Gt)}}})),createAssetStore=kt=>{const _e=assetStoreCreator();return _e.setState({stores:kt}),_e},assetStoreCreator=()=>create((kt,_e)=>({stores:null,assets:{items:{}},gltfLoader:null,dracoLoader:null,actions:{init(){const Dt=new DRACOLoader;Dt.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`),Dt.setDecoderConfig({type:"js"});const Vt=new GLTFLoader;Vt.register(Gt=>new GLTFMaterialsVariantsExtension(Gt)),Vt.setDRACOLoader(Dt),kt({dracoLoader:Dt,gltfLoader:Vt})},async loadProxyAsset(Dt){const{assets:Vt,gltfLoader:Gt,stores:zt}=_e(),jt="proxy",Ht=Vt.items[Dt]=Vt.items[Dt]||{isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}},Wt=Ht.proxy;if(Wt.isLoaded)return Ht;if(Wt.errorLoading)throw new Error(`${jt} loading failed for: ${Dt}`);const qt=zt.productDataStore.getState().productData[Dt];if(!qt)throw new Error(`Data doesn't exist for ${Dt}`);const Xt=zt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(qt.colliderProxyGLTF);if(!Xt)return null;try{const Kt=await Gt.loadAsync(Xt,Yt=>{Wt.progress=Yt.loaded/Yt.total*100});return Wt.data=Kt,Wt.isLoaded=!0,Ht}catch(Kt){throw Wt.isLoaded=!1,Wt.errorLoading=!0,Wt.error=Kt,LOGGER$1.info({title:Xt}),new Error(`Couldn't load ${Dt}`)}},isProxyLoaded(Dt){const Vt=_e().assets.items[Dt];return Vt?Vt.proxy.isLoaded:!1}}}));class Structure{#t=!1;constructor(_e,Dt=null,Vt,Gt){if(this.stores=_e,this._nodes=[],this._rootNode=null,LOGGER$1.info({title:"preloadNodes",details:Dt}),this.setupHookOnSceneItemsUpdated(),Dt){LOGGER$1.info({title:"PRELOAD Length-----------------:"+Dt.length});for(let zt=0;zt<Dt.length;zt++){LOGGER$1.info({title:"FOUND PRELOAD-----------------"});const jt=Dt[zt].skuID;if(jt.toLowerCase()=="root"){const Wt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Wt).length>0&&(Dt[zt].guid=Object.keys(Wt)[0])}let Ht=new Node$1(_e,jt,Dt[zt],Vt,Gt);jt.toLowerCase()=="root"&&(this._rootNode=Ht),this._nodes.push(Ht)}}else{const zt=new Node$1(_e,"Root",null,Vt,Gt);this._rootNode=zt,this._nodes.push(zt),this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=this.stores.coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){const _e=this.stores.coreSceneStore.getState().CORE_API;this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.stores.dynamicHookStore.getState().hookOnSceneItemsUpdated(this._nodes,_e)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let _e=0;_e<this._nodes.length;_e++)this._nodes[_e].updatePricing()}getCurrentItemsInReplaceableCategory(){let _e={};for(const Dt of this._nodes)Dt.replace&&(_e[Dt.categoryID]=Dt.skuID);return _e}recalculateStructureFromNode(_e){for(let Dt=0;Dt<_e.plugs.length;Dt++)if(!_e.plugs[Dt].isOpen&&_e.plugs[Dt].isReceiverPlug){const Vt=_e.plugs[Dt].attachedPlug.node,Gt={receiverPlug:_e.plugs[Dt],incomingPlug:_e.plugs[Dt].attachedPlug};if(Gt){const zt=this.findItemTransform(Gt);zt&&(Vt.ref.position.set(zt.position.x,zt.position.y,zt.position.z),zt.rotation.isQuaternion===!0?Vt.ref.setRotationFromQuaternion(zt.rotation):zt.rotation.isEuler===!0&&Vt.ref.setRotationFromEuler(zt.rotation),Vt.transform={position:zt.position,rotation:zt.rotation})}this.recalculateStructureFromNode(Vt)}}rotateNode(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=null,zt=[];for(let Zt=0;Zt<Dt.plugs.length;Zt++)if(!Vt&&!Dt.plugs[Zt].isOpen&&Dt.plugs[Zt].attachedPlug.isReceiverPlug){Dt.plugs[Zt].attachedPlug.acceptedPlugTypes,Vt=Dt.plugs[Zt].attachedPlug,Gt=Dt.plugs[Zt];for(let Jt=Zt+1;Jt<Dt.plugs.length;Jt++)zt.push(Dt.plugs[Jt]);for(let Jt=0;Jt<Zt;Jt++)zt.push(Dt.plugs[Jt]);break}const jt=[];if(Vt){const Zt=Vt.acceptedPlugTypes;for(let Jt=0;Jt<zt.length;Jt++)for(let nn=0;nn<zt[Jt].connectsToPlugTypes.length;nn++)if(Zt.includes(zt[Jt].connectsToPlugTypes[nn])){jt.push(zt[Jt]);break}}if(jt.length===0)return;const Ht=this.findItemTransform({receiverPlug:Vt,incomingPlug:Gt});if(!Ht)return;Dt.detachNodeFromReceiver();const qt=this.stores.coreSceneStore.getState().sceneSettings.disableCollider,Xt=[Dt.guid,...Dt.getAllBranchedNodesAttachedToUs().map(Zt=>Zt.guid)];for(let Zt=0;Zt<jt.length;Zt++){const Jt=jt[Zt],nn=this.findItemTransform({receiverPlug:Vt,incomingPlug:Jt});if(!nn||!nn.position||!nn.rotation)continue;if(!(!qt&&this.isColliding(Dt.skuID,nn,Vt,Xt))){const{position:Qt,rotation:en}=nn;Dt.ref.position.set(Qt.x,Qt.y,Qt.z),en.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(en):en.isEuler===!0&&Dt.ref.setRotationFromEuler(en),Dt.transform={position:Dt.ref.position,rotation:en},this.connectPlugs({receiverPlug:Vt,incomingPlug:Jt}),this.recalculateStructureFromNode(Dt);return}}const{position:Kt,rotation:Yt}=Ht;Dt.ref.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Dt.ref.setRotationFromEuler(Yt),Dt.transform={position:Dt.ref.position,rotation:Yt},this.connectPlugs({receiverPlug:Vt,incomingPlug:Gt}),this.recalculateStructureFromNode(Dt)}hasValidAlternateRotation(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=[];for(let Xt=0;Xt<Dt.plugs.length;Xt++)if(!Vt&&!Dt.plugs[Xt].isOpen&&Dt.plugs[Xt].attachedPlug.isReceiverPlug){Vt=Dt.plugs[Xt].attachedPlug,Dt.plugs[Xt];for(let Kt=Xt+1;Kt<Dt.plugs.length;Kt++)Gt.push(Dt.plugs[Kt]);for(let Kt=0;Kt<Xt;Kt++)Gt.push(Dt.plugs[Kt]);break}const zt=[];if(Vt){const Xt=Vt.acceptedPlugTypes;for(let Kt=0;Kt<Gt.length;Kt++)for(let Yt=0;Yt<Gt[Kt].connectsToPlugTypes.length;Yt++)if(Xt.includes(Gt[Kt].connectsToPlugTypes[Yt])){zt.push(Gt[Kt]);break}}if(zt.length<1)return!1;const Ht=this.stores.coreSceneStore.getState().sceneSettings.disableCollider,Wt=[Dt.guid,...Dt.getAllBranchedNodesAttachedToUs().map(Xt=>Xt.guid)];let qt=0;for(let Xt=0;Xt<zt.length;Xt++){const Kt=zt[Xt],Yt=this.findItemTransform({receiverPlug:Vt,incomingPlug:Kt});if(!Yt||!Yt.position||!Yt.rotation)continue;if(!(!Ht&&this.isColliding(Dt.skuID,Yt,Vt,Wt))&&(qt++,qt>=1))return!0}return!1}async load(_e){this.resolvePlugConnections(_e),await this.respawnItems()}materialOverrideExists(){let _e=!1;return this.nodes.map(Dt=>{if(Dt.overrideVariant)return _e=!0,!0}),_e}async findGhostTransformForReplacement(_e,Dt){let Vt=[],Gt=[],zt=[];for(const Ht of Dt){if(Ht.skuID==_e)continue;const Wt=this.stores.attachmentStore.getState().attachmentSystem,qt=Ht.whichPlugAreWeAttachedTo(),Xt=Ht.whichPlugAreWeAttachedUsing(),Yt=new Node$1(this.stores,_e,null,Wt.globalVariants,Wt.globalGeometryVariants).getPlugByName(Xt.name);if(!Yt)continue;const Zt={incomingPlug:Yt,receiverPlug:qt},{position:Jt,rotation:nn}=this.findItemTransform(Zt);Jt&&nn&&(Gt.push({position:Jt,rotation:nn,incomingPlugName:Zt.incomingPlug.name,receiverPlugName:Zt.receiverPlug.name,incomingPlugGUID:Zt.incomingPlug.guid,receiverPlugGUID:Zt.receiverPlug.guid}),zt.push(Zt),Vt.push(Ht))}let jt={transforms:Gt,connectablePlugs:zt,newNodes:Vt,skuIdToReplaceWith:_e};return jt=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollectedForReplacement(jt,this.stores.coreSceneStore.getState().CORE_API),jt}async findGhostTransforms(_e,Dt){const Vt=this.getOpenPlugs(),Gt=this.stores.coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(Vt.length<=0)return{transforms:[]};const zt=this.stores.attachmentStore.getState().attachmentSystem,jt=this.stores.productDataStore.getState().productData,Ht=new Node$1(this.stores,_e,null,zt.globalVariants,zt.globalGeometryVariants),Wt=this.getConnectablePlugs(Ht,Vt);let qt=[];if(Wt.length<=0)return{transforms:[]};let Xt=[],Kt=[];const Yt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene;if(!Yt)return!1;let Zt=Yt.clone();for(let rn=0;rn<Wt.length;rn++){let Qt=Dt,{incomingPlug:en,receiverPlug:tn}=Wt[rn],sn=this.findItemTransform(Wt[rn]);if(!sn)continue;let{position:cn,rotation:un}=sn;if(!cn||!un)continue;Zt.position.set(cn.x,cn.y,cn.z),un.isQuaternion===!0?Zt.setRotationFromQuaternion(un):un.isEuler===!0&&Zt.setRotationFromEuler(un);let hn=[],dn=[];if(en.type=="comboPlug"){if(en.connectsToPlugTypes.length<=0)continue;const vn=en.connectsToPlugTypes[0];let _n=!1;if(Kt.map(Cn=>{_n===!0||Cn.length<=0||Cn.map(yn=>{_n===!0||yn.incomingPlug.guid!==en.guid||yn.incomingPlug.connectsToPlugTypes.includes(vn)&&(_n=!0)})}),_n===!0)continue;const An=en.node.plugs;let Tn=!0;if(An.map(Cn=>{if(Cn.type!=="comboPlug"||Cn.guid===en.guid||!Cn.connectsToPlugTypes.includes(vn))return;let yn=!1;if(Vt.map(Sn=>{if(tn.guid===Sn.guid||!Sn.acceptedPlugTypes.includes(vn)||!Sn.node.ref)return;let wn=new Vector3(0,0,0);const xn=Sn.node.ref.getObjectByName(""+Sn.name);if(!xn)return;xn.getWorldPosition(wn);let Rn=new Vector3(0,0,0);const Dn=Zt.getObjectByName(""+Cn.name);if(!Dn)return;Dn.getWorldPosition(Rn);const kn=wn.distanceTo(Rn);Math.abs(kn)<Gt&&(hn.push(tn.node.guid),hn.push(Sn.node.guid),dn.push({receiverPlug:Sn,incomingPlug:Cn}),yn=!0)}),yn==!1){Tn=!1;return}}),!Tn)continue}let pn=Qt;Array.isArray(Qt)===!0&&(pn=!1),hn.length>0&&(pn=!1,Array.isArray(Qt)===!0?hn.map(vn=>{Qt.push(vn)}):Qt=hn),jt[_e].hasOwnProperty("ignoreSpawningCollision")&&(pn=jt[_e].ignoreSpawningCollision),Wt[rn].receiverPlug.type=="unvisualizedPlug"&&(pn=!0),(pn?!1:this.isColliding(Ht.skuID,sn,Wt[rn].receiverPlug,Qt))||(Xt.push({position:cn,rotation:un,incomingPlugName:Wt[rn].incomingPlug.name,receiverPlugName:Wt[rn].receiverPlug.name,incomingPlugGUID:Wt[rn].incomingPlug.guid,receiverPlugGUID:Wt[rn].receiverPlug.guid}),qt.push(Wt[rn]),Kt.push(dn))}let Jt=[];for(let rn=0;rn<Xt.length;rn++)Jt.push(Ht);dispose3(Zt);let nn={transforms:Xt,newNodes:Jt,connectablePlugs:qt,comboPlugs:Kt};return nn=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollected(nn,this.stores.coreSceneStore.getState().CORE_API),nn}resolvePlugConnections(_e){for(let Dt=0;Dt<_e.length;Dt++)Object.keys(_e[Dt].plugs).map(Vt=>{let Gt=_e[Dt].plugs[Vt].guid,zt=this.getPlugInNodesByGUID(Gt);if(!zt||zt.attachedPlug)return;let jt=_e[Dt].plugs[Vt].attachedPlugGUID,Ht=this.getPlugInNodesByGUID(jt);Ht&&(Ht.attachedPlug||(zt.attachPlug(Ht,_e[Dt].plugs[Vt].isReceiverPlug),Ht.attachPlug(zt,!_e[Dt].plugs[Vt].isReceiverPlug)))});LOGGER$1.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let _e=[this.rootNode];for(let zt=0;zt<_e.length;zt++){let Ht=_e[zt].whichPlugsAreAttachedToUs();for(let Wt=0;Wt<Ht.length;Wt++){if(Ht[Wt].incomingPlug.type=="comboPlug"&&Ht[Wt].incomingPlug.connectsToPlugTypes.length>0&&!Ht[Wt].incomingPlug.comboPlugConnector)continue;let qt=this.findItemTransformForPreload(Ht[Wt],Ht[Wt].receiverPlug.node.transform);if(qt){const Xt=Ht[Wt].receiverPlug,Kt=Ht[Wt].incomingPlug.node,Yt=this.stores.productDataStore.getState().productData,Zt=Xt.dependencySku===Kt.skuID;let Jt=!0;if(Zt)Jt=Xt.isDependencySkuInteractive===1,Kt.isDependent=!0,Xt.node.addMyDependenciesGUID(Kt.guid);else if(Yt[Kt.skuID].hasOwnProperty("disableInteraction")){const nn=Yt[Kt.skuID].disableInteraction;typeof nn=="boolean"&&(Jt=!nn)}Kt.isInteractive=Jt,await this.stores.itemStore.getState().actions.addItemWithTransform(qt,Kt.skuID,Kt.guid,Jt)}else LOGGER$1.warn({title:"Problem finding plug transform! "+Ht[Wt].name});Ht[Wt].incomingPlug.node.transform=qt,_e.push(Ht[Wt].incomingPlug.node)}}const Dt=await this.stores.coreSceneStore.getState().CORE_API.getCartItemsAsync();this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...Dt}),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.hotspotStore.getState().actions.checkHotspotHealth();const Vt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Gt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(Vt||Gt){let zt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);zt.parameters={project_id:`${this.stores.coreSceneStore.getState().CORE_API.projectId}`,...Dt},this.stores.coreSceneStore.getState().CORE_API.sendAnalyticsEvent(zt)}}getPlugInNodesByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].getPlugByGUID(_e);if(Vt)return Vt}return null}export(){let _e=[];for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].export();Vt&&_e.push(Vt)}return _e}async clear(){return new Promise(async(_e,Dt)=>{!this._rootNode&&this._rootNode.isEndNode&&_e(!0);let Vt=null;const Gt=this._rootNode.whichNodesAreAttachedToUs();Gt.length>0&&(Vt=Gt[0]),this.#t=!0,this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,zt=>_e(zt.data),{once:!0}),Vt?this.stores.coreSceneStore.getState().CORE_API.removeItemByGUID(Vt.guid,!0):(await wait(500),_e(!0))})}getNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e)return this._nodes[Dt];return null}getPlugByGUID(_e){for(const Dt of this._nodes){const Vt=Dt.getPlugByGUID(_e);if(Vt)return Vt}return null}findItemTransformForPreload(_e,Dt){let{receiverPlug:Vt,incomingPlug:Gt}=_e,zt=Vt,jt=Gt;if(zt.node.skuID=="Root")return this.findItemTransformRoot(_e);let Ht=null,Wt=null,qt=new Object3D,Xt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();qt.add(Xt);let{position:Kt,rotation:Yt}=Dt;if(Xt.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Xt.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Xt.setRotationFromEuler(Yt),Wt=Xt,!Wt||(Ht=Wt.getObjectByName(zt.name),!Ht))return;let Zt=new Vector3(0,0,0);Ht.getWorldPosition(Zt);let Jt=new Quaternion().identity();Ht.getWorldQuaternion(Jt);let nn=new Object3D;Ht.add(nn);let rn=this.stores.assetStore.getState().assets.items[jt.node.skuID].proxy.data.scene.clone();rn.position.set(Zt.x,Zt.y,Zt.z),rn.applyQuaternion(Jt);let Qt=new Vector3;Qt.copy(Xt.up).applyQuaternion(Wt.quaternion);let en=new Vector3;en.copy(rn.up).applyQuaternion(Jt),en.negate();let tn=new Quaternion().setFromUnitVectors(Qt,en);Qt.round(),en.round();let sn=Qt.dot(en);sn!==1&&sn!==-1&&rn.applyQuaternion(tn);let cn=rn.getObjectByName(jt.name),un=new Quaternion().identity();cn.getWorldQuaternion(un);let hn=new Vector3(0,1,0);hn.applyQuaternion(un);let dn=new Vector3(0,1,0);dn.applyQuaternion(Jt),dn.negate();let pn=new Quaternion().setFromUnitVectors(hn,dn);if(hn.round(),dn.round(),hn.dot(dn)!==-1)rn.applyQuaternion(pn);else{let An=new Vector3(0,1,0),Tn=dn.dot(An);if(Tn!==1&&Tn!==-1)rn.rotateOnAxis(An,Math.PI);else{let Cn=new Vector3(0,0,1),yn=dn.dot(Cn);if(yn!==1&&yn!==-1)rn.rotateOnAxis(Cn,Math.PI);else{let Sn=new Vector3(1,0,0),wn=dn.dot(Sn);wn!==1&&wn!==-1&&rn.rotateOnAxis(Sn,Math.PI)}}}let mn=rn.getObjectByName(jt.name),vn=new Vector3(mn.position.x,mn.position.y,mn.position.z);rn.translateX(-vn.x),rn.translateY(-vn.y),rn.translateZ(-vn.z);let _n=new Vector3(0,0,0);rn.getWorldPosition(_n);let En=new Quaternion().identity();return rn.getWorldQuaternion(En),rn=null,{position:_n,rotation:En}}findItemTransformRoot(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Vt;const zt=new Object3D;let jt=zt,Ht=new Vector3(0,0,0);jt.getWorldPosition(Ht);let Wt=new Quaternion().identity(),qt=new Object3D;qt.position.set(0,0,0),zt.add(qt);let Xt=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone();qt.attach(Xt),Xt.translateX(Ht.x),Xt.translateY(Ht.y),Xt.translateZ(Ht.z);let Kt=Xt.getObjectByName(Gt.name),Yt=new Quaternion().identity();Kt&&Kt.getWorldQuaternion(Yt);const Zt=new Vector3(0,1,0);Zt.applyQuaternion(Yt);const Jt=new Vector3(0,1,0);Jt.applyQuaternion(Wt);const nn=Jt.angleTo(Zt),rn=new Vector3(0,0,0);rn.crossVectors(Jt,Zt),rn.round(),rn.length()!==0&&Xt.rotateOnAxis(rn,nn);let Qt=new Matrix4().extractRotation(Xt.matrixWorld),en=new Vector3(0,0,0);Kt&&en.set(Kt.position.x,Kt.position.y,Kt.position.z),en.applyMatrix4(Qt),Xt.translateX(-en.x),Xt.translateY(-en.y),Xt.translateZ(-en.z);let tn=new Vector3(0,0,0);Xt.getWorldPosition(tn);let sn=new Quaternion().identity();return Xt.getWorldQuaternion(sn),qt.remove(Xt),qt=null,Xt=null,{position:tn,rotation:sn}}findItemTransform(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Dt,zt=Vt;if(Gt.node.isRoot)return this.findItemTransformRoot(_e);const jt=Gt.node.transform;if(!jt)return;const Ht=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone(),Wt=new Object3D;Wt.position.set(jt.position.x,jt.position.y,jt.position.z),jt.rotation.isQuaternion===!0?Wt.setRotationFromQuaternion(jt.rotation):jt.rotation.isEuler===!0&&Wt.setRotationFromEuler(jt.rotation),Wt.add(Ht);let qt=Wt.getObjectByName(""+Gt.name);if(!qt){LOGGER$1.error({title:"Plug: "+Gt.name+" doesn't exist in "+Gt.node.skuID});return}let Xt=new Vector3(0,1,0);qt.getWorldPosition(Xt);let Kt=new Quaternion().identity();qt.getWorldQuaternion(Kt);let Yt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();Yt.position.set(Xt.x,Xt.y,Xt.z),Yt.applyQuaternion(Kt);let Zt=new Vector3;Zt.copy(Ht.up).applyQuaternion(Wt.quaternion);let Jt=new Vector3;Jt.copy(Yt.up).applyQuaternion(Kt),Jt.negate();let nn=new Quaternion().setFromUnitVectors(Zt,Jt);Zt.round(),Jt.round();let rn=Zt.dot(Jt);rn!==1&&rn!==-1&&Yt.applyQuaternion(nn);let Qt=Yt.getObjectByName(zt.name);if(!Qt){LOGGER$1.error({title:"Plug: "+zt.name+" doesn't exist in "+zt.node.skuID});return}let en=new Quaternion().identity();Qt.getWorldQuaternion(en);let tn=new Vector3(0,1,0);tn.applyQuaternion(en);let sn=new Vector3(0,1,0);sn.applyQuaternion(Kt),sn.negate();let cn=new Quaternion().setFromUnitVectors(tn,sn);if(tn.round(),sn.round(),tn.dot(sn)!==-1)Yt.applyQuaternion(cn);else{let mn=new Vector3(0,1,0),vn=sn.dot(mn);if(vn!==1&&vn!==-1)Yt.rotateOnAxis(mn,Math.PI);else{let _n=new Vector3(0,0,1),En=sn.dot(_n);if(En!==1&&En!==-1)Yt.rotateOnAxis(_n,Math.PI);else{let An=new Vector3(1,0,0),Tn=sn.dot(An);Tn!==1&&Tn!==-1&&Yt.rotateOnAxis(An,Math.PI)}}}let hn=Yt.getObjectByName(zt.name),dn=new Vector3(hn.position.x,hn.position.y,hn.position.z);Yt.translateX(-dn.x),Yt.translateY(-dn.y),Yt.translateZ(-dn.z);let pn=new Vector3(0,0,0);Yt.getWorldPosition(pn);let fn=new Quaternion().identity();return Yt.getWorldQuaternion(fn),Wt.remove(Ht),Yt=null,{position:pn,rotation:fn}}getSpawningRequirementForSkuID(_e){let Dt=[];const Vt=this.stores.productDataStore.getState().productData,Gt=Vt[_e];if(!Gt)return Dt;const zt=[];return Gt.plugs.map(jt=>{jt.connectsToPlugTypes.map(Ht=>{zt.push(Ht)})}),Object.keys(Vt).map(jt=>{for(let Ht=0;Ht<Vt[jt].plugs.length;Ht++){const Wt=Vt[jt].plugs[Ht].acceptedPlugTypes;for(let qt=0;qt<Wt.length;qt++)zt.map(Xt=>{Xt==Wt[qt]&&!Dt.includes(jt)&&Dt.push(jt)})}}),Dt}getConnectablePlugs(_e,Dt){let Vt=[],Gt=_e.getOpenPlugsWeCanAttachFrom();for(let zt=0;zt<Gt.length;zt++)for(let jt=0;jt<Dt.length;jt++){for(let Wt=0;Wt<Vt.length&&!(Vt[Wt].receiverPlug.guid==Dt[jt].guid&&Vt[Wt].incomingPlug.type!="comboPlug");Wt++);Gt[zt].canAttachToPlug(Dt[jt])&&Vt.push({incomingPlug:Gt[zt],receiverPlug:Dt[jt]})}return Vt}getOpenPlugs(){let _e=[];return this._nodes.map(Dt=>{if(Dt.dragging===!0)return;let Vt=Dt.getOpenPlugsFromNode();_e=_e.concat(Vt)}),_e}checkCollisionForGUID(_e,Dt=[]){if(this.stores.coreSceneStore.getState().sceneSettings.disableCollider)return!1;const Vt=this.stores.itemStore.getState().itemsSpawned,Gt=this.stores.productDataStore.getState().productData;if(!Vt[_e])return!1;const jt=this.getNodeByGUID(_e);if(!jt||!jt.ref||Gt[jt.skuID].disableCollider)return!1;let Ht=new Vector3;jt.ref.getWorldPosition(Ht);let Wt=new Quaternion;jt.ref.getWorldQuaternion(Wt);const qt={position:Ht,rotation:Wt},Xt=jt.whichPlugAreWeAttachedTo();return Xt==null?!1:this.isColliding(jt.skuID,qt,Xt,Dt)}isColliding(_e,{position:Dt,rotation:Vt},Gt,zt=[]){const jt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene,Ht=this.stores.productDataStore.getState().productData;if(!jt)return!1;let Wt=jt.clone();Wt.position.set(Dt.x,Dt.y,Dt.z),Vt.isQuaternion===!0?Wt.setRotationFromQuaternion(Vt):Vt.isEuler===!0&&Wt.setRotationFromEuler(Vt);let qt=new Box3().setFromObject(Wt),Xt=new Vector3;qt.getCenter(Xt);let Kt=new Object3D;Kt.position.set(Xt.x,Xt.y,Xt.z),Kt.attach(Wt),Kt.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),qt=new Box3().setFromObject(Kt);const Yt=[];if(this._nodes.forEach(Jt=>{if(Gt.node.guid==Jt.guid||Array.isArray(zt)===!0&&zt.includes(Jt.guid)||!Jt.ref||(Ht[Jt.skuID].hasOwnProperty("disableCollider")?Ht[Jt.skuID].disableCollider:this.stores.coreSceneStore.getState().sceneSettings.disableCollider))return;const nn=Jt.ref.getObjectByName("GRP_ProxyMesh");nn&&Yt.push(nn)}),Yt.length<=0)return!1;let Zt=!1;return Yt.forEach(Jt=>{if(Zt)return;let nn=new Box3().setFromObject(Jt);if(qt.intersectsBox(nn)){Zt=!0;return}}),Kt.clear(),Wt=null,Kt=null,qt=null,Zt}boxOverlapPercent(_e,Dt){if(_e.containsBox(Dt)||Dt.containsBox(_e))return 100;if(!(_e.min.x<Dt.max.x||Dt.min.x<_e.max.x))return 0;let Vt=new Vector3(0,0,0);_e.getSize(Vt),Vt.x*Vt.y*Vt.z;let Gt=new Vector3(0,0,0);Dt.getSize(Gt),Gt.x*Gt.y*Gt.z}checkInsideOutCollision(_e,Dt,Vt){let Gt=Dt.position.clone(),zt=new Float32Array(Vt.attributes.position.array),jt=zt.length/3;for(let Ht=0;Ht<jt;Ht++){let Wt=new Vector3(zt[Ht*3],zt[Ht*3+1],zt[Ht*3+2]),qt=Wt.add(Dt.position);qt=Wt.applyQuaternion(Dt.quaternion);let Xt=qt.sub(Dt.position);const Yt=new Raycaster(Gt,Xt.clone().normalize()).intersectObjects(_e),Zt=Yt.length>0,Jt=Yt[0].distance<Xt.length();if(Zt&&Jt)return!0}return!1}addNode(_e){this._nodes.push(_e)}getFirstNodeByCategoryID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt]._categoryID==_e)return this._nodes[Dt];return null}getNodesBySKUID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt].skuID==_e&&Dt.push(this._nodes[Vt]);return Dt}getNodesByCategoryID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt]._categoryID==_e&&Dt.push(this._nodes[Vt]);return Dt}async connectPlugs({incomingPlug:_e,receiverPlug:Dt}){_e.attachPlug(Dt,!1),Dt.attachPlug(_e,!0),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}removeNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e){this._nodes[Dt].removeNode(),this._nodes.splice(Dt,1);break}this._nodes.length==1&&this.#t&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,!0),this.stores.attachmentStore.getState().actions.updateFittingSkuIds(),this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e.guid){this._nodes.splice(Dt,1);break}await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(_e){this._globalVariants={},this._globalGeometryVariants={},this.stores=_e,this.stores.productDataStore.getState().categoryData.geometryVariants.map(Dt=>{this._globalGeometryVariants[Dt.id]=Dt.defaultVariant}),this.stores.productDataStore.getState().categoryData.color.map(Dt=>{this._globalVariants[Dt.id]=Dt.defaultLook}),this._currentStructure=new Structure(this.stores,null,this._globalVariants,this._globalGeometryVariants);for(const[Dt,Vt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Dt,Vt);for(const[Dt,Vt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Dt,Vt)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(_e,Dt){let Vt;return Vt=this.stores.productDataStore.getState()?.productData[_e]?.lookDetails[Dt],Vt?.clientProductId?Vt?.clientProductId:""}getCartItems(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,Ht.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)});let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt}}}async getCartItemsAsync(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,qt.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,qt.guid=Ht.guid,_e.push(qt)}),_e=await this.stores.dynamicHookStore.getState().hookOnCartItemsCollected(_e,this.stores.coreSceneStore.getState().CORE_API);let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt.toFixed(2)}}}async getFittingSKUIDs(){if(!this.currentStructure)return[];const{productData:_e}=this.stores.productDataStore.getState(),{sceneSettings:Dt}=this.stores.coreSceneStore.getState(),{draggableUI:Vt,ignoreSpawningCollision:Gt}=Dt;if(!this.currentStructure)return[];const{openPlugTypes:zt,closedPlugTypes:jt,existingSkuids:Ht}=this.analyzeCurrentStructure();if(zt.size===0&&jt.size===0)return[];const Wt=this.findFittingSkuids(_e,zt,jt,Ht,Vt);return this.filterNonBlockedSkuids(Wt,_e,Gt)}analyzeCurrentStructure(){const _e=this.currentStructure.nodes,Dt=new Set,Vt=new Set,Gt=new Set;for(const zt of _e){Gt.add(zt.skuID);for(const jt of zt.plugs)jt.isOpen?jt.acceptedPlugTypes.forEach(Ht=>Dt.add(Ht)):jt.attachedPlug.node.replace&&jt.acceptedPlugTypes.forEach(Ht=>Vt.add(Ht))}return{openPlugTypes:Dt,closedPlugTypes:Vt,existingSkuids:Gt}}findFittingSkuids(_e,Dt,Vt,Gt,zt){const jt=new Set;for(const[Ht,Wt]of Object.entries(_e))if(Wt.plugs)for(const qt of Wt.plugs){for(const Xt of qt.connectsToPlugTypes)if((this.isClosedPlugFitting(Ht,Wt,Xt,Vt,Gt,zt)||this.isOpenPlugFitting(Wt,Xt,Dt))&&jt.add(Ht),jt.has(Ht))break;if(jt.has(Ht))break}return jt}isClosedPlugFitting(_e,Dt,Vt,Gt,zt,jt){if(!Gt.has(Vt)||!jt&&zt.has(_e))return!1;const Ht=this.currentStructure.getNodesByCategoryID(Dt.categoryID);for(const Wt of Ht)if(Wt.skuID!==_e&&this.isNodeCompatible(Wt,Dt))return!0;return!1}isNodeCompatible(_e,Dt){let Vt=!1;for(const Gt of _e.plugs)if(!Gt.isOpen&&Gt.isReceiverPlug&&(Vt=!0,this.isPlugCompatible(Gt,Dt.plugs)))return!0;return!Vt}isPlugCompatible(_e,Dt){return Dt.some(Vt=>Vt.name===_e.name&&_e.attachedPlug.connectsToPlugTypes.some(Gt=>Vt.acceptedPlugTypes.includes(Gt)))}isOpenPlugFitting(_e,Dt,Vt){if(!Vt.has(Dt))return!1;const Gt=this.currentStructure.getFirstNodeByCategoryID(_e.categoryID);return!Gt||!Gt.replace}async filterNonBlockedSkuids(_e,Dt,Vt){const Gt=[];for(const zt of _e)if(Dt[zt].replace)Gt.push(zt);else{const jt=await this.currentStructure.findGhostTransforms(zt,Vt);jt&&jt.transforms.length>0&&Gt.push(zt)}return Gt}async removeAllVariantOverrides(){let _e=this._currentStructure.nodes,Dt=this.stores.productDataStore.getState().productData,Vt=this.stores.itemStore.getState().itemsSpawned;return await _e.map(async Gt=>{if(!Gt.overrideVariant||(Gt.overrideVariant=null,!Dt[Gt.skuID].looks))return;let zt=null;Object.keys(this._globalVariants).map(jt=>{Dt[Gt.skuID].looks.includes(this._globalVariants[jt])&&zt==null&&(zt=this._globalVariants[jt])}),zt&&await this.stores.itemStore.getState().actions.switchToVariant(Vt[Gt.guid].itemData,zt)}),this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1),!0}async switchGlobalGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Yt=>{Yt.id==_e&&(zt=Yt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;let Xt=this.stores.productDataStore.getState().categoryData;Wt.map(Yt=>{jt.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{Yt==nn&&(Jt=!0)}),Jt&&Xt.build.map(nn=>{Zt.products.map(rn=>{nn.skus.map((Qt,en)=>{nn.skus[en]==rn&&(nn.skus[en]=Yt)})})})})}),this._currentStructure.nodes.map(Yt=>{jt.map(Zt=>{Zt.products.map(Jt=>{Yt.skuID==Jt&&Yt.ref!==null&&Zt.products.map(nn=>{Wt.map(rn=>{if(rn==nn){const Qt=this.stores.productDataStore.getState().actions.getProductDataById(rn);let en=Qt.geometriesToHide;Yt.plugs.map(sn=>{!sn.isOpen&&sn.attachedPlug&&sn.type=="weighted_hider"&&sn.attachedPlug.weight>sn.weight&&(en=en.concat(sn.affectedNodes))}),Yt.showNodes(Qt.geometriesToShow),Yt.hideNodes(en),Yt.skuID=rn;const tn=qt[Yt.guid];if(tn&&tn.itemData){Object.keys(Qt).map(cn=>{tn.itemData[cn]=Qt[cn]});const sn=this.stores.assetStore.getState().assets.items[rn];sn&&sn.proxy.isLoaded&&(tn.itemData.proxyScene=sn.proxy.data.scene)}Yt.resetInStock(),Yt.updatePricing()}})})})})}),this.stores.itemStore.setState({itemsSpawned:{...this.stores.itemStore.getState().itemsSpawned}}),this._globalGeometryVariants[_e]=Dt,this.stores.hotspotStore.getState().actions.checkHotspotHealth(),this.stores.inventoryStore.getState().actions.refreshInventory(qt),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.productDataStore.setState({categoryData:Xt}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CategoryData_Updated,Xt),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const Kt=await this.getCartItemsAsync();Kt&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Kt)}async switchGlobalVariant(_e,Dt){this._globalVariants[_e]=Dt;const Vt=this.stores.itemStore.getState().actions;let Gt=this.stores.itemStore.getState().itemsSpawned;for(let Wt=0;Wt<Object.keys(Gt).length;Wt++){let qt=Gt[Object.keys(Gt)[Wt]];if(qt.itemData.looks&&qt.itemData.looks.includes(Dt)){let Xt=this._currentStructure.getNodeByGUID(qt.itemData.guid);Xt&&!Xt.overrideVariant&&await Vt.switchToVariant(qt.itemData,Dt)}}const zt=this.stores.productDataStore.getState().lookData;this.stores.lightStore.getState().actions.processLookEnvMapOverride(Dt);const jt=_e;Object.keys(Gt).length>0&&this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:jt.charAt(0).toUpperCase()+jt.slice(1)+" was successfully switched to "+zt[Dt].label+".",alertTime:3e3,alertType:"success",alertLabel:`${jt} Changed`,alertId:"materialVariantChanged"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),this.stores.itemStore.setState({variantChangeAlert:!this.stores.itemStore.getState().variantChangeAlert});const Ht=await this.getCartItemsAsync();Ht&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Ht)}async#t(_e){if(!_e)return;LOGGER$1.info({title:"Structure to load",details:_e}),delete this._currentStructure,this._globalVariants={..._e.globalVariants},this._globalGeometryVariants=_e.globalGeometryVariants?{..._e.globalGeometryVariants}:{};const Dt=[..._e.structure];this._currentStructure=new Structure(this.stores,Dt,this._globalVariants,this._globalGeometryVariants);for(const[Vt,Gt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Vt,Gt);for(const[Vt,Gt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Vt,Gt);LOGGER$1.info({title:"Structure Loading..."}),await this._currentStructure.load(Dt),LOGGER$1.info({title:"Structure Loaded."})}async loadStructure(_e){if(!_e)return;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),this.stores.coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(_e),this.stores.coreSceneStore.getState().preconfigurationLoaded?this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide):this.stores.coreSceneStore.setState({preconfigurationLoaded:!0}),this.stores.coreSceneStore.getState().configurationLoadedOnRestart||this.stores.coreSceneStore.setState({configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.setState({configurationLoaded:!0}),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated();const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}export(){return{experienceId:this.stores.coreSceneStore.getState().CORE_API.experienceId,structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await this._currentStructure.clear(),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER$1.warn({title:"Restarting the Scene!!"}),this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem();const _e=this.stores.attachmentStore.getState().defaultConfig;this.stores.coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#t(_e),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated(),this.stores.coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide);const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}}const createAttachmentStore=kt=>{const _e=attachmentStoreCreator();return _e.setState({stores:kt}),_e},attachmentStoreCreator=()=>create((kt,_e)=>({stores:null,attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async Dt=>{const{actions:Vt,defaultConfig:Gt}=_e();LOGGER$1.info({title:"Initializing Attachment System!"});const zt=await new AttachmentSystem(Dt);kt({attachmentSystem:zt}),await Vt.updateFittingSkuIds(),await Vt.toggleStructureUpdated()},loadSavedStructureFromConfigID:async Dt=>{const{stores:Vt}=_e();LOGGER$1.info({title:"Fetching Structure Using ConfigID!"});let Gt="";Dt.length==20&&(Gt=FETCH_CONFIG_ENDPOINT_FB+Dt);let zt=null;return Gt!=""?zt=await getJSONFromEndpoint(Gt):zt=await Vt.nexusApiInstance.getExperienceSaveAndShare(Vt.experienceId,Dt),zt.success===!1?null:Dt.length==20?zt.data:zt.payload.save_data},loadDefaultStructure:async()=>{const{actions:Dt,defaultConfig:Vt}=_e();LOGGER$1.info({title:"Loading Default Structure!"}),await Dt.loadStructure(Vt)},updateFittingSkuIds:async()=>{const{stores:Dt,attachmentSystem:Vt}=_e();if(!Dt.coreSceneStore.getState().preconfigurationLoaded||!Dt.coreSceneStore.getState().configurationLoaded)return;const Gt=await Vt.getFittingSKUIDs();Gt&&(Dt.itemStore.setState({fittingSkuIds:[...Gt]}),Dt.coreSceneStore.getState().CORE_API.fireEvent(Dt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Gt}))},toggleStructureUpdated:async()=>{const{attachmentSystem:Dt,stores:Vt}=_e();if(kt(zt=>({structureUpdated:!zt.structureUpdated})),!Vt.coreSceneStore.getState().preconfigurationLoaded||!Vt.coreSceneStore.getState().configurationLoaded)return;Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Dt.currentStructure.getCurrentItemsInReplaceableCategory());const Gt=await Dt.getCartItemsAsync();Gt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Gt)},loadStructure:async Dt=>{const{attachmentSystem:Vt,stores:Gt}=_e();LOGGER$1.info({title:"Loading Structure!"}),Vt&&Gt.coreSceneStore.getState().configurationLoaded!==!1&&await Vt.loadStructure(Dt)},export:()=>{const{attachmentSystem:Dt}=_e();if(Dt)return Dt.export()}}})),createInfoStore=kt=>{const _e=infoStoreCreator();return _e.setState({stores:kt}),_e},infoStoreCreator=()=>create((kt,_e)=>({stores:null,infoObject:{},populateInfoObject:Dt=>{kt(Vt=>({infoObject:Dt}))},infoModalOpen:!1,updateInfoModalOpen:Dt=>{kt(Vt=>({infoModalOpen:Dt}))}})),createUIHotspotStore=kt=>{const _e=uiHotspotStoreCreator();return _e.setState({stores:kt}),_e},uiHotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,activeFeatureID:"",actions:{enterHotspotInFeaturesTab(Vt){const{stores:Gt}=_e();Gt.uiSceneStore.getState().sideMenuState!==2&&Gt.uiSceneStore.setState({sideMenuState:2}),kt({activeFeatureID:Vt})},exitHotspot(){kt({activeFeatureID:null})}}})),createColorStore=kt=>{const _e=colorStoreCreator();return _e.setState({stores:kt}),_e},colorStoreCreator=()=>create((kt,_e)=>({stores:null,allActiveVariants:{},allActiveGeometryVariants:{}})),arrayWithoutElementAtIndex=function(kt,_e){return kt.filter(function(Dt,Vt){return _e!==Vt})},updateQuantityAtIndex=function(kt,_e,Dt){let Vt=kt.slice();return Vt[_e].quantity=Dt,Vt},createCartStore=kt=>{const _e=cartStoreCreator();return _e.setState({stores:kt}),_e},cartStoreCreator=()=>create((kt,_e)=>({stores:null,cart:[],cartTotalPrice:0,cartTotalCompareAtPrice:0,deleteCartItem:Dt=>{kt(Vt=>({cart:arrayWithoutElementAtIndex(Vt.cart,Dt)}))},addToCart:Dt=>{kt(Vt=>({cart:[...Vt.cart,Dt]}))},updateQuantity:(Dt,Vt)=>{kt(Gt=>({cart:updateQuantityAtIndex(Gt.cart,Dt,Vt)}))},previewCartModalOpen:!1,togglePreviewCartModal:()=>{const{previewCartModalOpen:Dt,stores:Vt}=_e();Dt===!0?(Vt.uiSceneStore.getState().CORE_API.reviewCartHidden(),kt({previewCartModalOpen:!1,previewCartMinimized:!1})):(Vt.uiSceneStore.getState().CORE_API.reviewCartShown(),kt({previewCartModalOpen:!0}))},previewCartMinimized:!1,togglePreviewCartMinimized:()=>{const{previewCartMinimized:Dt,stores:Vt}=_e(),Gt=!Dt;kt({previewCartMinimized:Gt}),Vt&&Vt.uiSceneStore&&Vt.uiSceneStore.getState().setSideMenuOpen(!Gt)},actions:{setCartTotalPrice:(Dt,Vt)=>{kt(()=>({cartTotalPrice:Dt,cartTotalCompareAtPrice:Vt}))}}})),createLightStore=kt=>{const _e=lightStoreCreator();return _e.setState({stores:kt}),_e},lightStoreCreator=()=>create((kt,_e)=>({stores:null,defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:Dt=>{kt(Vt=>({envMapUrl:Dt}))},processLookEnvMapOverride:Dt=>{const{envMapUrl:Vt,defaultEnvMapUrl:Gt,actions:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().lookData[Dt],Wt=Ht?.envMapOverride;if(!Ht||!Wt){zt.setEnvLightMap(Gt);return}if(Wt===Vt){LOGGER$1.info({title:`New Env Map Url is the same as the current ${Wt}`});return}zt.setEnvLightMap(Wt)}}})),createHotspotStore=kt=>{const _e=hotspotStoreCreator();return _e.setState({stores:kt}),_e},hotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>kt({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(Dt){const{hotspotsSpawned:Vt}=_e();Object.keys(Vt).map(Gt=>{Vt[Gt].itemData.guid==Dt.itemData.guid&&delete Vt[Gt]}),kt({hotspotsSpawned:{...Vt}})},checkHotspotHealth(){const{hotspotsHealthCheck:Dt}=_e();kt({hotspotsHealthCheck:!Dt})},toggleHotspotVisibility(){const{hotspotsVisibility:Dt}=_e();kt({hotspotsVisibility:!Dt})},switchHotspotsVisibility(Dt,Vt=!1){kt(Vt===!0?{hotspotsTempVisibility:Dt}:{hotspotsVisibility:Dt})},clickHotspot(Dt,Vt,Gt,zt=!1){const{activeHotspotData:jt,stores:Ht}=_e();kt({lastActiveHotspotData:jt}),hotspotEnter(Ht,Dt,Vt,Gt);let qt=Ht.itemStore.getState().itemsSpawned[Gt].itemData.skuID;zt===!1&&(Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(qt,Dt),hotspot:jt}),Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(Dt=!1){const{activeHotspotData:Vt,isAnyHotspotActive:Gt,stores:zt}=_e();if(Gt&&kt({isAnyHotspotActive:!1}),!!Vt&&(kt({lastActiveHotspotData:Vt}),hotspotExit(zt),Dt===!1)){const jt=Math.round((performance.now()-_e().lastActiveHotspotData.hotspotEnterTime)/1e3);zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:_e().lastActiveHotspotData,hotspotTimeSpent:jt}),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(kt){kt.hotspotStore.setState({activeHotspotData:null}),kt.coreSceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(kt,_e,Dt,Vt){let Gt=kt.hotspotStore.getState();const jt=kt.itemStore.getState().itemsSpawned;let Ht=Gt.visitedHotspotsID;const Wt=jt[Vt].hotspotsData.filter(un=>un.hotspotID==_e);if(!Wt||Wt.length<=0)return;const qt=Wt[0],Xt=jt[Vt].itemData.skuID+"_"+_e;let Yt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt),Zt=new Vector3(0,0,0);Yt&&Yt.ref&&Yt.ref.getWorldPosition(Zt);let Jt=new Quaternion().identity();Yt&&Yt.ref&&Yt.ref.getWorldQuaternion(Jt);let nn=qt.focusPointTransform,rn=ArrToVec3(nn);rn.applyQuaternion(Jt);let Qt=qt.viewPointTransform,en=ArrToVec3(Qt);en.applyQuaternion(Jt);let tn=addVector(Vec3ToArr(rn),Vec3ToArr(Zt)),sn=addVector(Vec3ToArr(en),Vec3ToArr(Zt));kt.cameraStore.setState({focusPointPosition:tn,viewPointPosition:sn}),kt.hotspotStore.setState({activeHotspotData:{hotspotData:{guid:Dt,...qt},itemData:{...jt[Vt],guid:Vt},domID:"rd_"+Xt,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),Ht.includes(Xt)||(Ht.push(Xt),kt.hotspotStore.setState({visitedIDs:{...Ht}}))}var replacingNodes=null,swappableNodes=[];const createGhostStore=kt=>{const _e=ghostStoreCreator();return _e.setState({stores:kt}),_e},ghostStoreCreator=()=>create((kt,_e)=>({stores:null,ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(Dt,Vt=!1,Gt)=>{const{ghostData:zt,ghostsTransform:jt,stores:Ht}=_e();if(zt!==null||jt.length>0){LOGGER$1.info({title:"ghosts are already spawned for: "+zt.skuID});return}return await new Promise(async(qt,Xt)=>{let Kt={};const Yt=()=>{qt(Kt)};Ht.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,Yt,{once:!0});const Zt=Ht.productDataStore.getState().productData,Jt=Ht.attachmentStore.getState().attachmentSystem.currentStructure;replacingNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const nn=Ht.coreSceneStore.getState().sceneSettings.draggableUI,rn=await Jt.findGhostTransforms(Dt,Vt),Qt=nn?rn&&rn.transforms&&rn.transforms.length===0:!0;if(Zt[Dt].replace&&replacingNodes.length>0&&Qt)if(nn){const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null||cn==null||sn.length<=0){LOGGER$1.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null&&cn==null){LOGGER$1.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{transforms:tn,newNodes:sn,connectablePlugs:cn,comboPlugs:un}=rn;let hn=tn,dn=cn,pn=sn,fn=[];for(let mn=0;mn<tn.length;mn++)fn.push("add");if(Zt[Dt].swappable&&!Ht.coreSceneStore.getState().dragging){swappableNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const mn=await Jt.findGhostTransformForReplacement(Dt,swappableNodes);if(mn.transforms)for(let vn=0;vn<mn.transforms.length;vn++)hn.push(mn.transforms[vn]),dn.push(mn.connectablePlugs[vn]),pn.push(mn.newNodes[vn]),fn.push("replace"),mn.newNodes[vn].setModelVisibility(!1)}Kt.transforms=hn,Kt.newNodes=pn,Kt.connectablePlugs=dn,Kt.comboPlugs=un,Kt.addItemOrSwap=fn}if(Kt.transforms.length<=0){Xt();return}const en=await Ht.assetStore.getState().actions.loadProxyAsset(Dt,!0);kt({ghostsTransform:Kt.transforms,ghostData:{proxyScene:en.proxy.data.scene,skuID:Dt,newNodes:Kt.newNodes,addItemOrSwap:Kt.addItemOrSwap,connectablePlugs:Kt.connectablePlugs,comboPlugs:Kt.comboPlugs,count:Gt||Kt.transforms.length}})})},clearAllGhosts:()=>{const{ghostsTransform:Dt}=_e();if(replacingNodes)for(const Vt of replacingNodes)Vt.setModelVisibility(!0);if(swappableNodes)for(let Vt=0;Vt<swappableNodes.length;Vt++)swappableNodes[Vt].setModelVisibility(!0);Dt.length<=0||kt({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),createCameraStore=kt=>{const _e=cameraStoreCreator();return _e.setState({stores:kt}),_e},cameraStoreCreator=()=>create((kt,_e)=>({stores:null,focusPointPosition:new Vector3(0,0,0),sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,cameraControlsRef:null,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{canCameraRotate:Dt=>{const{cameraControlsRef:Vt}=_e();Vt&&(Dt===!0?(Vt.mouseButtons.left=CAMERA_ACTION.ROTATE,Vt.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(Vt.mouseButtons.left=CAMERA_ACTION.NONE,Vt.touches.one=CAMERA_ACTION.NONE))},triggerFetchingCamera:()=>{kt(Dt=>({sendCameraDetailsTrigger:!Dt.sendCameraDetailsTrigger}))},setCameraSettings:Dt=>{const{cameraSettings:Vt,stores:Gt}=_e();Gt.coreSceneStore.getState().isMobile===!0&&Dt.zoomingMultiplier_mobile!==void 0?Dt.zoomingMultiplier=Dt.zoomingMultiplier_mobile:Dt.zoomingMultiplier_desktop!==void 0&&(Dt.zoomingMultiplier=Dt.zoomingMultiplier_desktop),Object.keys(Dt).map(jt=>Vt[jt]=Dt[jt]),kt({cameraSettings:{...Vt},viewPointPosition:ArrToVec3(Vt.initialViewPointPosition)})}}})),createUISceneStore=kt=>{const _e=uiSceneStoreCreator();return _e.setState({stores:kt}),_e},uiSceneStoreCreator=()=>create((kt,_e)=>({stores:null,CORE_API:null,sideMenuState:0,sideMenuOpen:!0,setSideMenuOpen:Dt=>kt({sideMenuOpen:Dt}),cssLoaded:!1,isScreenPortrait:!0,materialOverrideExists:!1,tabSpawnCount:[],coreWCRef:null,removeModalOpen:!1,outOfStockModalOpen:!1,disableCart:!1,inventoryData:{},cartMessage:"",loadConfigId:"",dialogPopupOpen:!1,viewInYourSpaceMenuBtnVisible:!1,loadConfigModalOpen:!1,setLoadConfigModalOpen:Dt=>kt({loadConfigModalOpen:Dt}),setOutOfStockModalOpen:Dt=>kt({outOfStockModalOpen:Dt}),setRemoveModalOpen:Dt=>kt({removeModalOpen:Dt}),moveModalOpen:!1,setMoveModalOpen:Dt=>kt({moveModalOpen:Dt}),setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},setSideMenuState:Dt=>{kt(()=>({sideMenuState:Dt}));const{CORE_API:Vt}=_e();Dt!==2?Vt.exitHotspot():Vt.showAllHotspots()}})),createDynamicHookStore=kt=>{const _e=dynamicHookStoreCreator();return _e.setState({stores:kt}),_e},dynamicHookStoreCreator=()=>create((kt,_e)=>({hookOnCartItemsCollected:async(Dt,Vt)=>(LOGGER$1.info({title:"No hook provided: hookOnCartItemsCollected"}),Promise.resolve(Dt)),hookOnSceneItemsUpdated:async(Dt,Vt)=>(LOGGER$1.info({title:"No hook provided: hookOnSceneItemsUpdated"}),Promise.resolve()),hookOnNewItemGhostsCollected:async(Dt,Vt)=>(LOGGER$1.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnNewItemGhostsCollectedForReplacement:async(Dt,Vt)=>(LOGGER$1.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnSceneItemAdded:async(Dt,Vt,Gt)=>(LOGGER$1.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve()),hookOnCheckout:async(Dt,Vt)=>(LOGGER$1.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve(Dt))}));class STORES{experienceId="";uuid=null;wcRef=null;nexusApiResponseEnvironment="production";nexusApiInstance=null;productDataStore=null;coreSceneStore=null;inventoryStore=null;itemStore=null;assetStore=null;attachmentStore=null;lightStore=null;hotspotStore=null;ghostStore=null;cameraStore=null;infoStore=null;uiHotspotStore=null;colorStore=null;cartStore=null;uiSceneStore=null;constructor(_e){this.wcRef=_e,this.uuid=v4(),this.dynamicHookStore=createDynamicHookStore(this),this.productDataStore=createProductDataStore(this),this.coreSceneStore=createCoreSceneStore(this),this.inventoryStore=createInventoryStore(this),this.itemStore=createItemStore(this),this.assetStore=createAssetStore(this),this.attachmentStore=createAttachmentStore(this),this.lightStore=createLightStore(this),this.hotspotStore=createHotspotStore(this),this.ghostStore=createGhostStore(this),this.cameraStore=createCameraStore(this),this.infoStore=createInfoStore(this),this.uiHotspotStore=createUIHotspotStore(this),this.colorStore=createColorStore(this),this.cartStore=createCartStore(this),this.uiSceneStore=createUISceneStore(this)}setupNexusApiInstance(_e){let Dt=p$5.PRODUCTION;_e=="local"?Dt=p$5.LOCAL:_e==="staging"&&(Dt=p$5.STAGING);const Vt=window.location.href,Gt=window.epigraph?window.epigraph.epigraphSessionId:"no-session-id",zt="2.3.4",jt=g$3.generateXPath(this.wcRef);this.nexusApiInstance=new P$2(Dt,Vt,Gt,zt,jt)}}class EpigraphConfigurator extends h$5{#t=void 0;#i=null;#n=null;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";customVersionId="";experienceId="";apiMode="production";gaMeasurementId="";#s=getUrlParameterByName("launchInAR")==="true";#r=!1;api={core:null,ui:null};stores=null;constructor(){let _e=s$2.PRODUCTION;super("2.3.4",_e),this.stores=new STORES(this),this.api.ui=this,this.shadowRoot||this.attachShadow({mode:"open"}),this.hasAttribute("launch-in-ar")&&(this.#s=!0),this.#c(),this.#o()}#c(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(PRELOAD_MUTED_CSS.content.cloneNode(!0)),this.preloadDiv.appendChild(PRELOAD_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv);const _e=this.shadowRoot;this.#n=Dt=>{if(Dt.code=="Enter"){let Vt=_e.activeElement;Vt&&Vt.click()}},this.shadowRoot.addEventListener("keyup",this.#n)}#o(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(HICCUP_MUTED_CSS.content.cloneNode(!0)),this.hiccupUi.appendChild(HICCUP_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}get configuratorWcId(){return this.#t}get launchInAr(){return this.#s}#a(){if(this.hasAttribute("id")?this.#t=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#t=this.getAttribute("id")),this.hasAttribute("custom-version-id")&&(this.customVersionId=this.getAttribute("custom-version-id")),this.hasAttribute("experience-id")&&(this.experienceId=this.getAttribute("experience-id")),this.hasAttribute("api-mode")){const _e=this.getAttribute("api-mode");["local","staging","production"].includes(_e)&&(this.apiMode=_e)}this.stores.setupNexusApiInstance(this.apiMode),(this.hasAttribute("ga-measurement-id")||this.hasAttribute("ga-code"))&&(this.gaMeasurementId=this.getAttribute("ga-measurement-id")??this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.consentPlugin=this.getAttribute("consent-plugin"),this.consentIdentifier=this.getAttribute("consent-identifier"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#r===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#a(),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const _e=document.createElement("div");_e.id="configuratorContainer",_e.style.width="100%",_e.style.height="100%",_e.style.userSelect="none",_e.style.overflow="hidden",this.shadowRoot.appendChild(_e),this.#i=createRoot(_e),this.#i.render(jsxRuntimeExports.jsx(App,{stores:this.stores,customVersionId:this.customVersionId,experienceId:this.experienceId,disableUI:this.hasAttribute("disable-ui"),disableCart:this.hasAttribute("disable-cart"),configuratorWcRef:this,gaMeasurementId:this.gaMeasurementId},"Configurator-App")),this.#r=!0}disconnectedCallback(){for(this.#i&&(this.#i.unmount(),this.#i=null),this.#n&&(this.shadowRoot.removeEventListener("keyup",this.#n),this.#n=null),this.#t=void 0,this.clientAccessKey=null,this.validationPassed=!1,this.projectID="",this.configID="default",this.customVersionId="",this.gaMeasurementId="",this.#s=!1,this.#r=!1,this.api={core:null,ui:null},this.preloadDiv&&(this.preloadDiv.remove(),this.preloadDiv=null),this.hiccupUi&&(this.hiccupUi.remove(),this.hiccupUi=null);this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild)}showPreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload"))}async hidePreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("showPreload"),await wait(1e3),this.preloadDiv.classList.add("no-pointer-events"))}showHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup"))}async hideHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("show-hiccup"),await wait(1e3),this.hiccupUi.classList.add("no-pointer-events"))}}window.customElements.define("epigraph-configurator",EpigraphConfigurator);