!function(){var e,t,n,s={"../../../node_modules/css-loader/dist/cjs.js!./src/index.module.css":function(e,t,n){"use strict";var s=n("../../../node_modules/css-loader/dist/runtime/noSourceMaps.js"),i=n.n(s),o=n("../../../node_modules/css-loader/dist/runtime/api.js"),r=n.n(o)()(i());r.push([e.id,"html,\nbody {\n margin: 0;\n height: 100%;\n min-height: 100%;\n}\n\nbody {\n background-color: black;\n}\n\n/*\n * New way, scales canvas while preserving its aspect ratio.\n * https://stackoverflow.com/a/67758567/8107589\n *\n * N.B. The inspector wraps canvas in a div between it and parent. A partial work around is having\n * the css selector skip levels (not '>').\n * TODO!!!: In practice, we need to change out the inspector hooks itself.\n */\n.GfMzfXcr_KfeLZtvm_5X {\n position: fixed;\n inset: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.GfMzfXcr_KfeLZtvm_5X .nUaqqKDtQM1DSOMV9yZm {\n object-fit: contain;\n max-height: 100%;\n max-width: 100%;\n width: 100%;\n height: 100%;\n}\n\n/*\n * Old way, fills entire parent.\n */\n/* .parent .canvas {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n justify-content: flex-start;\n} */\n",""]),r.locals={parent:"GfMzfXcr_KfeLZtvm_5X",canvas:"nUaqqKDtQM1DSOMV9yZm"},t.Z=r},"./src/index.ts":function(e,t,n){"use strict";var s=n("../../babs/core/lib/common/debug_flags.js"),i=n("../../babs/core/lib/game/game_engine.js"),o=n("../../common/lib/check.js"),r=n("../../common/lib/env.js"),a=n("../../common/lib/identity.js"),c=n("../../common/lib/logging.js"),l=JSON.parse('{"vc":{"QB":"ld51","iU":"/ld51-postjam"}}'),u=n("../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),d=n.n(u),h=n("../../../node_modules/style-loader/dist/runtime/styleDomAPI.js"),f=n.n(h),m=n("../../../node_modules/style-loader/dist/runtime/insertBySelector.js"),p=n.n(m),b=n("../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),g=n.n(b),y=n("../../../node_modules/style-loader/dist/runtime/insertStyleElement.js"),v=n.n(y),w=n("../../../node_modules/style-loader/dist/runtime/styleTagTransform.js"),x=n.n(w),j=n("../../../node_modules/css-loader/dist/cjs.js!./src/index.module.css"),S={};S.styleTagTransform=x(),S.setAttributes=g(),S.insert=p().bind(null,"head"),S.domAPI=f(),S.insertStyleElement=v(),d()(j.Z,S);var _=j.Z&&j.Z.locals?j.Z.locals:void 0;const k=l.vc.QB,C=l.vc.iU;function T(){const e=new Proxy(new URLSearchParams(window.location.search),{get:(e,t)=>e.get((0,o.$1)(t,a.HD))}),t=window.location.hash?window.location.hash.slice(1):void 0;return e.game??t??k}async function $(e){return console.log(`Loading game: ${e}`),(await n("../../babs/scenes/src lazy recursive ^\\.\\/.*\\/index\\.ts$ include: index\\.ts$")(`./${e}/index.ts`)).default}(async()=>{const e=document.createElement("canvas");e.classList.add(_.canvas),document.body.classList.add(_.parent),document.body.appendChild(e);let t="/";r.P||(t="/"),await async function(e){(0,c.cM)("version",{build:s.qg,isProd:r.P});const t=new i.dA(e,$,k);await t.start(),window.addEventListener("hashchange",(()=>{t.loadApp(T())})),await t.loadApp(T())}({canvas:e,urlBase:C,assetPrefix:t})})().catch((0,c.H)("main"))},"../../babs/scenes/src lazy recursive ^\\.\\/.*\\/index\\.ts$ include: index\\.ts$":function(e,t,n){var s={"./demolition/index.ts":["../../babs/scenes/src/demolition/index.ts",782],"./infra/index.ts":["../../babs/scenes/src/infra/index.ts",381],"./jukebox/index.ts":["../../babs/scenes/src/jukebox/index.ts",947],"./ld51/index.ts":["../../babs/scenes/src/ld51/index.ts",46],"./roguerally/index.ts":["../../babs/scenes/src/roguerally/index.ts",893],"./template/index.ts":["../../babs/scenes/src/template/index.ts",338],"./unladen/index.ts":["../../babs/scenes/src/unladen/index.ts",868]};function i(e){if(!n.o(s,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return n.e(t[1]).then((function(){return n(i)}))}i.keys=function(){return Object.keys(s)},i.id="../../babs/scenes/src lazy recursive ^\\.\\/.*\\/index\\.ts$ include: index\\.ts$",e.exports=i},"?51d3":function(){},"?eb2f":function(){},"../../babs/core/lib/audio/audio_asset.js":function(e,t,n){"use strict";n.d(t,{W:function(){return d}});var s=n("../../common/lib/check.js"),i=n("../../common/lib/containers.js"),o=n("../../common/lib/identity.js"),r=n("../../common/lib/random.js"),a=n("../../babs/core/lib/common/asset.js");const c=(0,o.SC)().withDefaults({loop:!1,spatial:!1,autoPlay:!1,volumeFactor:1,pauseExempt:!1}),l=(0,o.SC)().withDefaults({index:0,play:!1});let u=0;class d extends a.M{constructor(e,t,n,s){super(e,t,(0,i._2)(n)),this.sounds_=[],this.settings=c.apply(s??{}),this.onDispose((()=>this.sounds_.length=0))}share(e=0){return this.sounds_[(0,s.iY)(e,this.sounds_)]}clone(e,t){const n=l.apply(t??{}),i=this.sounds_[(0,s.iY)(n.index,this.sounds_)],o=i.clone();if(!o)return;e.acquire(o);const r=n?.baseName??i.name,a=n?.attachToMesh;return a?(o.attachToMesh(a),o.name=`${a.name}.${r}`):o.name=`${r}.${u++}`,n.play&&o?.play(),o}playNext(e){if((0,s.BF)(this.sounds_.length>0,"No sounds to play"),1===this.sounds_.length)this.currentIndex=0;else if(void 0===this.currentIndex)this.currentIndex=(0,r.Iy)(this.sounds_.length);else{let e=(0,r.Iy)(this.sounds_.length-1);e>=this.currentIndex&&(e+=1),this.currentIndex=e}const t=this.sounds_[this.currentIndex];t.play(),void 0!==e?.rate&&t.setPlaybackRate(e.rate)}setPlaybackRate(e){void 0!==this.currentIndex&&this.sounds_[this.currentIndex].setPlaybackRate(e)}addSound(e){e.metadata=this,e.setVolume(this.settings.volumeFactor),this.settings.autoPlay&&e.play(),this.sounds_.push(e)}}},"../../babs/core/lib/audio/audio_manager.js":function(e,t,n){"use strict";n.d(t,{LN:function(){return g}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/logging.js"),o=n("../../common/lib/units.js"),r=n("../../babs/core/lib/common/asset_manager.js"),a=n("../../babs/core/lib/common/gauge.js"),c=n("../../babs/core/lib/common/resource.js"),l=n("../../babs/core/lib/game/game_engine.js"),u=n("../../babs/core/lib/input/input.js"),d=n("../../babs/core/lib/audio/audio_asset.js");const h=(0,u.Qw)(c.fi,"muted","KeyM",{persist:!0}),f=o.UH.of(70,o.gG),m=new a.a(c.fi,"volume",{defaultValue:f,minimum:o.gG.zero,maximum:o.UH.of(100,o.gG),persist:!0}),p=o.UH.of(10,o.gG);u.II.register(c.fi,"volume: increase",{keys:"Equal",valued:m}).onClick(c.fi,(()=>{h.value?(m.value=p,h.value=!1):m.increment(p)})),u.II.register(c.fi,"volume: decrease",{keys:"Minus",valued:m}).onClick(c.fi,(()=>{h.value||(m.value.isLessThanOrEqualTo(p)?(h.value=!0,m.value=f):m.decrement(p))}));const b=()=>s.Pa4.Zero();class g extends r.me{constructor(e){super(e,d.W)}setSpatialAudioListener(e,t,n){(0,i.cM)("Spatial Audio",{listener:t.name}),e.audioListenerPositionProvider=n,t.onDispose((()=>{e.audioListenerPositionProvider===n&&((0,i.cM)("Spatial Audio",{listener:"[0,0,0]"}),e.audioListenerPositionProvider=b)}))}onInit(){s.D4V.audioEngine?(l.dA.Paused.onChanged(this,(()=>this.syncVolume()),{immediate:!0}),h.onChanged(this,(e=>{console.log(e?"Muted.":`Unmuted. Volume level is ${String(m.value)}`),this.syncVolume()}),{immediate:!0}),m.onChanged(this,(e=>{h.value||console.log(`Volume level is ${String(e)}`),this.syncVolume()})),this.onNotify(s.D4V.audioEngine.onAudioUnlockedObservable,(()=>{console.log("Audio unlocked."),this.syncVolume()})),this.syncVolume()):console.error("No audio engine.")}onProcess(e,t){l.dA.Paused.onEnabled(e.scope,(()=>{for(const t of e.scene.mainSoundTrack.soundCollection){const e=t.metadata;e&&e.settings.pauseExempt||t.stop()}})),e.fetchAll(t,((n,i)=>{for(const r of n)t.addSound(new s.$uU(t.name,r,e.scene,i(),{loop:t.settings.loop,spatialSound:t.settings.spatial,distanceModel:"inverse",refDistance:o.UH.of(5,o.J4).value,maxDistance:o.UH.of(100,o.J4).value,rolloffFactor:1}))}))}syncVolume(){const e=h.value;s.D4V.audioEngine?.setGlobalVolume(e?0:m.value.value)}}g.I=new g(c.fi)},"../../babs/core/lib/common/asset.js":function(e,t,n){"use strict";n.d(t,{M:function(){return o},x:function(){return i}});var s=n("../../babs/core/lib/common/resource.js");class i extends s.$9{constructor(e,t,n){super(e,t),this.urlPath=n}}class o extends s.$9{constructor(e,t,n){super(e,t),this.urlPaths=n}}},"../../babs/core/lib/common/asset_manager.js":function(e,t,n){"use strict";n.d(t,{NS:function(){return m},ZH:function(){return j},bk:function(){return f},jO:function(){return g},me:function(){return v},ve:function(){return y},wV:function(){return x}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/check.js"),o=n("../../common/lib/identity.js"),r=n("../../common/lib/logging.js"),a=n("../../common/lib/units.js"),c=n("../../babs/core/lib/common/resource.js");const l=console.log,u=Symbol("assetLoadingLogId"),d=a.Lm.one.scale(.25),h="α.";function f(e,t){return"__root__"===t||void 0===t?`α.${e}`:`α.${e}.${t}`}function m(e,t,n){if(!e.startsWith(h))return e;let s=e.indexOf(".",h.length);return s<0&&(s=void 0),t??(t=e.slice(h.length,s)),`${t}.${n}${void 0!==s?e.slice(s):""}`}const p=!0,b=(0,o.SC)().withDefaults({inspectProtoTransformNodes:p,inspectProtoMeshes:p,inspectProtoParticleSystems:p,inspectProtoSkeletons:p,inspectProtoAnimationGroups:p});class g{constructor(e){this.unreadyAssets=0,[this.scope,this.scene,this.display,this.gameEngine,this.urlBase,this.engine]=[e.scope,e.scene,e.display,e.gameEngine,e.urlBase,e.engine],this.prototypes=new s.TJ4(e.scene),this.assetManager=new s.SpM(e.scene),this.scope.onNotify(this.assetManager.onProgressObservable,(e=>{const t=e.totalCount-e.remainingCount;(0,r.cM)("Asset Loading",{total:e.totalCount,numCompleted:t,lastCompleted:e.task.name},{logId:u,rate:d})}))}fetch(e,t){const n=this.assetManager.addBinaryFileTask(e.name,`${this.urlBase}${e.urlPath}`);n.onSuccess=()=>t(n.data,(()=>this.onReadyToUse())),n.onError=(t,n)=>console.warn(`Failed to load asset ${e.urlPath}: ${n}`)}fetchAll(e,t){const n=[];let s=1;const i=()=>{0==--s&&t(n,(()=>this.onReadyToUse()))};for(const t of e.urlPaths){s+=1;const o=this.assetManager.addBinaryFileTask(e.name,`${this.urlBase}${t}`);o.onSuccess=()=>{n.push(o.data),i()},o.onError=(e,n)=>{console.warn(`Failed to load asset ${t}: ${n}`),i()}}i()}fetchScene(e,t,n){const s=b.apply(n??{}),i=e.urlPath.lastIndexOf("/")+1,o=e.urlPath.slice(0,i),r=e.urlPath.slice(i),a=this.assetManager.addContainerTask(e.name,void 0,`${this.urlBase}${o}`,r);a.onSuccess=()=>{a.loadedTransformNodes.forEach((t=>{null===t.parent&&(t.name=f(e.name,t.name),s.inspectProtoTransformNodes&&this.scene.addTransformNode(t))})),a.loadedMeshes.forEach((t=>{null===t.parent&&(t.name=f(e.name,t.name),s.inspectProtoMeshes&&this.scene.addMesh(t))})),a.loadedParticleSystems.forEach((t=>{t.name=f(e.name,t.name),s.inspectProtoParticleSystems&&this.scene.addParticleSystem(t)})),a.loadedSkeletons.forEach((t=>{t.name=f(e.name,t.name),s.inspectProtoSkeletons&&this.scene.addSkeleton(t)})),a.loadedAnimationGroups.forEach((t=>{t.name=f(e.name,t.name),s.inspectProtoAnimationGroups&&this.scene.addAnimationGroup(t)})),t(a.loadedContainer)},a.onError=(t,n,s)=>console.warn(`Failed to load scene ${this.urlBase}${e.urlPath}: ${n}`,s)}fetchTexture(e,t){const n=this.assetManager.addTextureTask(e.name,`${this.urlBase}${e.urlPath}`);n.onSuccess=()=>{n.texture.name=f(e.name),t(n.texture)},n.onError=(t,n)=>console.warn(`Failed to load asset ${this.urlBase}${e.urlPath}: ${n}`)}fetchImage(e,t){const n=this.assetManager.addImageTask(e.name,e.urlPath);n.onSuccess=()=>t(n.image),n.onError=(t,n)=>console.warn(`Failed to load asset ${this.urlBase}${e.urlPath}: ${n}`)}onReadyToUse(){return this.unreadyAssets+=1,l(`[${this.scope.name}] onReadyToUse unreadyAssets: +${this.unreadyAssets}`),()=>{0==--this.unreadyAssets&&(l(`[${this.scope.name}] onReadyToUse unreadyAssets: -${this.unreadyAssets}`),this.allAssetsReady?.())}}async load(){l(`[${this.scope.name}] load`),this.assetManager.autoHideLoadingUI=!1,await this.assetManager.loadAsync(),l(`[${this.scope.name}] loadAsync done`),this.unreadyAssets&&await new Promise((e=>this.allAssetsReady=e)),l(`[${this.scope.name}] unreadyAssets ready`),this.engine.hideLoadingUI()}}class y extends g{constructor(e,t){super(t),this.canvas=e}}class v extends c.$9{constructor(e,t){super(e,`AssetManager of ${t.name}`),this.guard=(0,o.V9)(t)}onInit(e){}onScopeInit(e){}}const w=(0,o.V9)(v);function x(e){c.$9.setScopeInititialized(c.fi),l("initializeManagers"),c.fi.forEachSubsidiary(w,(t=>{l(`Initializing ${t.name}`),t.onInit(e),c.fi.forEachSubsidiary(t.guard,(n=>{l(`[${e.scope.name}] forEach ${t.name}`),t.onProcess(e,n)}))}))}function j(e){c.$9.setScopeInititialized(e.scope),(0,i.Yg)(e.scope,c.fi,"globalScope is processed in initializeManagers"),l(`[${e.scope.name}] processScope`),c.fi.forEachSubsidiary(w,(t=>{l(`[${e.scope.name}] Prepping ${t.name}`),t.onScopeInit(e),e.scope.forEachSubsidiary(t.guard,(n=>{l(`[${e.scope.name}] forEach ${t.name}`),t.onProcess(e,n)}))}))}},"../../babs/core/lib/common/color.js":function(e,t,n){"use strict";n.d(t,{DG:function(){return r},H_:function(){return i},NC:function(){return o},Pf:function(){return a},nV:function(){return l}});var s=n("../../../node_modules/@babylonjs/core/index.js");function i(e){return 7===e.length?s.Wot.FromHexString(e):s.HEv.FromHexString(e)}function o(e){return e.toHexString()}function r(e,t){const n=t?.(e)??{},s={...e,...n};return Object.freeze(s)}const a=r({turquoise:"#1abc9c",emerald:"#2ecc71",peterRiver:"#3498db",amethyst:"#9b59b6",wetAsphalt:"#34495e",greenSea:"#16a085",nephritis:"#27ae60",belizeHole:"#2980b9",wisteria:"#8e44ad",midnightBlue:"#2c3e50",sunFlower:"#f1c40f",carrot:"#e67e22",alizarin:"#e74c3c",clouds:"#ecf0f1",concrete:"#95a5a6",orange:"#f39c12",pumpkin:"#d35400",pomegranate:"#c0392b",silver:"#bdc3c7",asbestos:"#7f8c8d"});const c=Object.freeze(new s.Wot(1,1,1));function l(e,t,n){return function(e,t,n,i){return i??(i=new s.Wot),n??(n=t.a??1),i.r=e.r+(t.r-e.r)*n,i.g=e.g+(t.g-e.g)*n,i.b=e.b+(t.b-e.b)*n,i}(e,c,t,n)}},"../../babs/core/lib/common/debug_flags.js":function(e,t,n){"use strict";n.d(t,{Mz:function(){return l},cG:function(){return d},qg:function(){return a}});var s=n("../../common/lib/env.js"),i=n("../../common/lib/identity.js"),o=n("../../babs/core/lib/input/input.js"),r=n("../../babs/core/lib/common/resource.js");const a="1.9",c=(0,i.Pn)()({enableHighlightLayer:{key:"Alt+H"},showAnimationChange:{key:"Alt+A"},showAxes:{key:"Alt+X"},showColliders:{key:"Alt+C"},showRays:{key:"Shift+R"},showInspector:{key:"Alt+I"},showKeyEvents:{key:"Alt+K"},showPerfMetrics:{key:"Alt+P"},showKeymap:{key:"AltLeft"},logNextFrame:{key:"Alt+F",mode:"ephemeral"},freeLook:{key:"ScrollLock",persist:!1}}),l=(0,i.Yl)(c,((e,t)=>function(e,t,n){const i=n?.mode??"stateful",r=!s.P&&(n?.persist??"stateful"===i),a=s.P?void 0:n?.key;return(0,o.Qw)(e,`debug.${t}`,a,{mode:i,persist:r,...n,validate:e=>!s.P&&e})}(r.fi,t,e))),u=(0,i.QK)(l,(e=>()=>e.value)),d=Object.freeze(Object.assign(u,{true:!0,false:!1}))},"../../babs/core/lib/common/flag.js":function(e,t,n){"use strict";n.d(t,{W:function(){return S}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/check.js"),o=n("../../common/lib/errors.js"),r=n("../../common/lib/identity.js"),a=n("../../common/lib/iterators.js");class c extends o.sH{}function l(...e){return e.join("/")}class u{constructor(e,t){this.bucket_=e,this.prefix_=void 0!==t?t+"/":""}folder(...e){return new u(this.bucket_,this.prefix_+l(...e))}list(){const e=(0,a.NT)(this.bucket_.list(),(e=>e.startsWith(this.prefix_))),t=(0,a.lT)(e,(e=>e.slice(this.prefix_.length)));return(0,a.NT)(t,(e=>!e.includes("/")))}get(e,t){const n=this.bucket_.get(this.prefix_+e);if(void 0!==n){const e=JSON.parse(n);if(t){if(t(e))return e}else if("string"==typeof e)return e}}set(e,t){return this.bucket_.set(this.prefix_+e,JSON.stringify(t))}delete(e){return this.bucket_.delete(this.prefix_+e)}clear(){(0,a.Ed)(this.list(),(e=>this.delete(e)))}}class d{constructor(e){this.store_=e}list(){const e=(0,a.Hb)(this.store_.length),t=(0,a.lT)(e,(e=>this.store_.key(e)));return(0,a.NT)(t,r.EN)}get(e){return this.store_.getItem(e)??void 0}set(e,t){this.store_.setItem(e,t)}delete(e){this.store_.removeItem(e)}clear(){this.store_.clear()}}class h{constructor(){this.values_=new Map}list(){return this.values_.keys()}get(e){return this.values_.get(e)}set(e,t){this.values_.set(e,t)}delete(e){this.values_.delete(e)}clear(){this.values_.clear()}}function f(e){let t;try{t=window[e];const n="__storage_test__";return t.setItem(n,n),t.removeItem(n),!0}catch(e){return e instanceof DOMException&&"QuotaExceededError"===e.name&&void 0!==t&&0!==t.length}}const m=["localStorage","sessionStorage","memory"];let p;var b=n("../../babs/core/lib/common/resource.js");class g extends b._z{constructor(e,t){const n=l(e.name,t);super(e,n),this.path=t,this.store=new u(function(e,t=!0){for(let n=(0,i.vD)(m.indexOf(e),-1);n(0,r.$O)(t,g)&&t.path===e}(t))??new g(e,t)}}var y,v,w,x=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n},j=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};class S{constructor(e,t,n){if(this.scope=e,this.name=t,y.set(this,void 0),v.set(this,new s.y$z),w.set(this,void 0),x(this,w,n.validate??r.yR,"f"),(0,r.$K)(n.defaultValue)?x(this,y,(0,i.ro)(j(this,w,"f").call(this,n.defaultValue),(()=>`Flag (${t}) defaultValue (${String(n.defaultValue)}) does not pass validation.`)),"f"):x(this,y,n.defaultValue,"f"),n.persist){const s=n.persist,i=g.get(e,"flags"),o=i.store.get(t,s.guard),a=void 0!==o?s.deserialize(o):void 0,c=(0,r.$K)(a)?j(this,w,"f").call(this,a):void 0;void 0!==c&&x(this,y,c,"f"),this.onChanged(e,(e=>{const n=s.serialize(e);void 0===n?i.store.delete(t):i.store.set(t,n)}))}}get value(){return j(this,y,"f")}set value(e){(0,r.$K)(e)&&(e=j(this,w,"f").call(this,e)??j(this,y,"f")),e!==j(this,y,"f")&&(x(this,y,e,"f"),j(this,v,"f").notifyObservers(e))}onChanged(e,t,n){if(n?.predicate){const e=t,s=n?.predicate;t=t=>s(t)?e(t):void 0}const s=e.onNotify(j(this,v,"f"),t);s&&n?.immediate&&j(this,v,"f").notifyObserver(s,j(this,y,"f"))}}y=new WeakMap,v=new WeakMap,w=new WeakMap},"../../babs/core/lib/common/gauge.js":function(e,t,n){"use strict";n.d(t,{a:function(){return a}});var s=n("../../common/lib/check.js"),i=n("../../common/lib/identity.js"),o=n("../../common/lib/units.js"),r=n("../../babs/core/lib/common/flag.js");class a extends r.W{constructor(e,t,n){const r=n.units??n.defaultValue?.unit;(0,s.cW)(r);const a={defaultValue:n.defaultValue??r.zero};n.persist&&(a.persist={guard:i.hj,serialize:e=>e.quantity,deserialize:e=>o.UH.of(e,r)}),n.minimum&&n.maximum&&(0,s.BF)(n.minimum.isLessThan(n.maximum),`minimum (${String(n.minimum)}) must be less than or equal to maximum (${String(n.maximum)})`),a.validate=e=>n.minimum&&e.isLessThan(n.minimum)?n.minimum.to(r):n.maximum&&n.maximum.isLessThan(e)?n.maximum.to(r):e.to(r),super(e,t,a),this.units=r}increment(e=this.units.one){this.value=this.value.plus(e)}decrement(e=this.units.one){this.value=this.value.minus(e)}scale(e){this.value=this.value.scale(e)}}},"../../babs/core/lib/common/logging.js":function(e,t,n){"use strict";n.d(t,{Q:function(){return r},t:function(){return a}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/logging.js"),o=n("../../babs/core/lib/common/units.js");function r(){(0,i.hX)(s.Ms4,s.y$z),(0,i.AM)(o.f,(e=>[`%c(%c${(0,i.OS)(e.x.quantity,2)}%c${e.x.unit.label}%c x %c${(0,i.OS)(e.y.quantity,2)}%c${e.y.unit.label}%c x %c${(0,i.OS)(e.z.quantity,2)}%c${e.z.unit.label}%c)`,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default])),(0,i.AM)(o.w,(e=>[`%c(%c${(0,i.OS)(e.x.quantity,2)}%c${e.x.unit.label}%c, %c${(0,i.OS)(e.y.quantity,2)}%c${e.y.unit.label}%c, %c${(0,i.OS)(e.z.quantity,2)}%c${e.z.unit.label}%c)`,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default,i.B$.number,i.B$.subtle,i.B$.default])),(0,i.AM)(s.FM8,(e=>[`%c(%c${(0,i.OS)(e.x,2)}%c, %c${(0,i.OS)(e.y,2)}%c)`,i.B$.default,i.B$.number,i.B$.default,i.B$.number,i.B$.default])),(0,i.AM)(s.Pa4,(e=>[`%c(%c${(0,i.OS)(e.x,2)}%c, %c${(0,i.OS)(e.y,2)}%c, %c${(0,i.OS)(e.z,2)}%c)`,i.B$.default,i.B$.number,i.B$.default,i.B$.number,i.B$.default,i.B$.number,i.B$.default])),(0,i.AM)(s.Wot,(e=>{let t=e.toHexString();return t=t.charAt(1)===t.charAt(2)&&t.charAt(3)===t.charAt(4)&&t.charAt(5)===t.charAt(6)?t.charAt(1)+t.charAt(3)+t.charAt(5):t.substring(1),[`%c#%c${t}`,`color: #${t}`,i.B$.subtle]})),(0,i.AM)(s.HEv,(e=>{let t=e.toHexString();return t=t.charAt(1)===t.charAt(2)&&t.charAt(3)===t.charAt(4)&&t.charAt(5)===t.charAt(6)&&t.charAt(7)===t.charAt(8)?t.charAt(1)+t.charAt(3)+t.charAt(5)+t.charAt(7):t.substring(1),[`%c#%c${t}`,`color: #${t}`,i.B$.subtle]}))}function a(e,t=2){return void 0===e?String(e):"z"in e?`(${(0,i.OS)(e.x,t)}, ${(0,i.OS)(e.y,t)}, ${(0,i.OS)(e.z,t)})`:`(${(0,i.OS)(e.x,t)}, ${(0,i.OS)(e.y,t)})`}},"../../babs/core/lib/common/membership.js":function(e,t,n){"use strict";n.d(t,{Fk:function(){return r},Vp:function(){return o},ai:function(){return a},tY:function(){return c}});var s=n("../../common/lib/check.js"),i=n("../../common/lib/logging.js");class o{constructor(e){this.name=e,(0,s.BF)(!0!==o.allTags[e],`The tag '${e}' already exists.`),o.allTags[e]=!0,(0,i.cM)("Tag",{name:e}),Object.freeze(this)}static addTo(e,...t){e._tags??(e._tags={});for(const n of t)e._tags[n.name]=!0;return e}addTo(...e){e.forEach((e=>{e._tags??(e._tags={}),e._tags[this.name]=!0}))}removeFrom(...e){e.forEach((e=>{e._tags??(e._tags={}),delete e._tags[this.name]}))}in(e){return(e._tags&&this.name in e._tags)??!1}toString(){return this.name}}function r(e){return e._tags?Object.keys(e._tags):[]}function a(e,...t){e._tags??(e._tags={});const n=e._tags;for(const e of t)e._tags=n}function c(e,...t){if(!e._tags)return 0;let n=0,s=1;for(const i of t)e._tags[i.name]&&(n|=s),s<<=1;return n}o.allTags={}},"../../babs/core/lib/common/nodes.js":function(e,t,n){"use strict";n.d(t,{$U:function(){return c},G:function(){return h},Ky:function(){return r},Ol:function(){return d},go:function(){return u},pf:function(){return l}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/containers.js"),o=n("../../common/lib/identity.js");function r(e,t){const n=new s.YOI(e,t);return n.freezeWorldMatrix(),n}function a(e,t,n,s){for(const i of e){n&&s(i)&&t(i);const e=i._children;e&&a(e,t,!0,s)}}function c(e,t,n){const s=n?.applyToRoot??!1,r=n?.type,c=n?.predicate;let l=()=>!0;r&&c?l=e=>(0,o.$O)(e,r)&&c(e):r?l=(0,o.V9)(r):c&&(l=c),a((0,i._2)(e),t,s,l)}function l(e,...t){return t.flatMap((t=>[...e(t)?[t]:[],...t.getDescendants(!1,e)]))}function u(e,...t){return l((0,o.V9)(e),...t)}function d(e,...t){return t.flatMap((t=>t.getDescendants(!0,e)))}function h(e,...t){return d((0,o.V9)(e),...t)}},"../../babs/core/lib/common/resource.js":function(e,t,n){"use strict";n.d(t,{qd:function(){return R},$9:function(){return P},fi:function(){return I},_z:function(){return E},sX:function(){return _},eG:function(){return D},f$:function(){return A},V2:function(){return S},U6:function(){return M}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/errors.js");class o{constructor(){this.callbacks=[]}add(e){this.callbacks.push(e)}runOnce(...e){return this.doRun(e,!1)}run(...e){return this.doRun(e,!0)}doRun(e,t){const n=this.callbacks;t||(this.callbacks=[]),(0,i.f_)(n,(t=>t(...e)))}}var r,a,c,l,u,d,h=n("../../common/lib/check.js"),f=n("../../common/lib/containers.js"),m=n("../../common/lib/core.js"),p=n("../../common/lib/disposable.js"),b=n("../../common/lib/env.js"),g=n("../../common/lib/identity.js"),y=n("../../common/lib/iterators.js"),v=n("../../common/lib/units.js"),w=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n},x=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Symbol("Lifecycle")," ".repeat(10);const j=Symbol("This tag is for private use by the implementations in this file.");function S(e){const t=(0,g.$O)(e,s.xsS)?e:e.getScene();return t.metadata??(t.metadata={resources:new Set}),t.metadata}class _{constructor(e){r.set(this,void 0),this[a]={},void 0!==e&&w(this,r,e,"f")}get name(){return x(this,r,"f")?.startsWith(".")&&w(this,r,`${this.constructor.name}${x(this,r,"f")}`,"f"),x(this,r,"f")??this.constructor.name}typedName(){return void 0!==x(this,r,"f")?`${this.constructor.name}(${x(this,r,"f")})`:this.constructor.name}disposeResources(){this.doDisposalInternal(j,!1)}acquire(e){return e instanceof E?$(e,this):this.onAddInternal(j,e),e}forEach(e,t){this[j].disposables&&!this[j].disposalState&&(0,y.Ed)((0,y.NT)(this[j].disposables.values(),e),t)}get(e){if(!this[j].disposalState&&this[j].disposables)for(const t of this[j].disposables.values())if(e(t))return t}onDispose(e){var t;this[j].disposalState?e():((t=this[j]).callbacks??(t.callbacks=new o),this[j].callbacks.add(e))}onNotify(e,t){if(this[j].disposalState)return null;const n=e.add(t,void 0,!0);return n&&this.onDispose((()=>{e.remove(n)})),n}onTimeout(e,t){var n;if(this[j].disposalState)return;const s=(n=this[j]).timeouts??(n.timeouts=[]);let i;i=setTimeout((()=>{(0,f.Od)(s,i),t()}),e.to(v.HA).quantity),this[j].timeouts.push(i)}onAddInternal(e,t){var n;return this[j].disposalState?(t.dispose(),!1):((n=this[j]).disposables??(n.disposables=new Set),(0,m.BF)(!this[j].disposables.has(t),(()=>`Disposable is already managed by ${this.name}.`)),this[j].disposables.add(t),!0)}onRemoveInternal(e,t){this[j].disposalState||(0,m.BF)(this[j].disposables?.delete(t)??!1)}doDisposalInternal(e,t){return this[j].disposalState?(t&&"partial"===this[j].disposalState&&(this[j].disposalState="full"),!1):(this[j].disposalState=t?"full":"partial",this[j].timeouts&&(this[j].timeouts.forEach((e=>clearTimeout(e))),delete this[j].timeouts),this[j].callbacks&&(this[j].callbacks.runOnce(),delete this[j].callbacks),this[j].disposables&&((0,i.f_)(this[j].disposables.values(),(e=>{(0,g.$O)(e,E)?C.call(e,this):e.dispose()})),delete this[j].disposables),"full"===this[j].disposalState||(delete this[j].disposalState,!1))}}r=new WeakMap,a=j;const k=new Map;function C(e){(0,h.M1)(k.get(this),e),k.delete(this),b.P||(0,g.$O)(e,_)||S(e).resources.delete(this),this.dispose()}function T(e){const t=k.get(e);t&&(k.delete(e),(0,g.$O)(t,_)?t.onRemoveInternal(j,e):(b.P||S(t).resources.delete(e),t.onDisposeObservable.removeCallback(C,e)))}function $(e,t){if(T(e),(0,g.$O)(t,_)){if(!t.onAddInternal(j,e))return}else{if(function(e){return"boolean"==typeof e.isDisposed?e.isDisposed:e.isDisposed()}(t))return void e.dispose();b.P||S(t).resources.add(e),t.onDisposeObservable.add(C,void 0,void 0,e,!0)}k.set(e,t)}class E extends _{constructor(e,t){void 0===t&&(0,g.$O)(e,s.NBX)&&(t=e.name),super(t),$(this,e)}static update(e){x(E,c,"f",l).forEach((t=>t(e)))}onUpdate(e){"full"===this[j].disposalState||"disposed"===this[j].disposalState||(e?x(E,c,"f",l).set(this,e):x(E,c,"f",l).delete(this))}dispose(){return this.doDisposalInternal(j,!0),"You must call super.dispose() when overriding Resource.dispose.\nPrefer to do cleanup using onDispose() instead."}doDisposalInternal(e,t){return!!super.doDisposalInternal(j,t)&&(T(this),x(E,c,"f",l).delete(this),this[j].disposalState="disposed",Object.freeze(this),!0)}}c=E,l={value:new Map};class O extends E{static from(e){return e.metadata?.scope??new O(e)}constructor(e){super(e),e.metadata??(e.metadata={});const t=e.metadata;(0,m.BF)(void 0===t.scope),t.scope=this}}function M(e){return(0,g.$O)(e,_)?e:O.from(e)}class A extends _{constructor(e,t){super(e),u.set(this,void 0),t?.registerSubsidiary(this)}forEachSubsidiary(e,t){x(this,u,"f")&&x(this,u,"f").forEach((n=>e(n)?t(n):void 0))}disposeResources(){x(this,u,"f")&&(0,i.f_)(x(this,u,"f"),(e=>e.disposeResources())),super.disposeResources()}registerSubsidiary(e){w(this,u,x(this,u,"f")??[],"f"),x(this,u,"f").push(e)}}u=new WeakMap;class P extends A{constructor(e,t){(0,m.BF)(!P.isScopeInitialized.has(e),"Registration of new Descriptors in this scope is closed."),super(t,e)}static setScopeInititialized(e){(0,m.BF)(!P.isScopeInitialized.has(e)),P.isScopeInitialized.set(e,!0)}}P.isScopeInitialized=new Map;const I=new A("global");class R extends p.v{constructor(e){super(),d.set(this,void 0);const t=()=>{w(this,d,void 0,"f"),e()};this.scheduler=()=>{void 0===x(this,d,"f")&&w(this,d,setTimeout(t,0),"f")}}dispose(){return void 0!==x(this,d,"f")&&(clearTimeout(x(this,d,"f")),w(this,d,void 0,"f")),super.dispose()}}d=new WeakMap;class D extends E{constructor(e,t,n){super(e),this.context=t,this.value=this.acquire(n(this))}static get(e,t,n){let s=e.get((0,g.V9)(D,(e=>(0,g.fS)(e.context,t,!0))));return s??(s=new D(e,t,n)),s.value}}},"../../babs/core/lib/common/units.js":function(e,t,n){"use strict";n.d(t,{f:function(){return r},w:function(){return o}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/units.js");class o{constructor(e,t,n){this.x=e,this.y=t,this.z=n}static of(e,t){t??(t=i.J4);const n=i.UH.from(e.x,0,t),s=i.UH.from(e.y,0,t),r=i.UH.from(e.z,0,t);return new o(n,s,r)}scale(e){return o.of({x:this.x.scale(e.x??e.factor??1),y:this.y.scale(e.y??e.factor??1),z:this.z.scale(e.z??e.factor??1)})}plus(e){return o.of({x:this.x.plus(e.x),y:this.y.plus(e.y),z:this.z.plus(e.z)})}value(){return new s.Pa4(this.x.value,this.y.value,this.z.value)}toString(){return`(${this.x.toString()}, ${this.y.toString()}, ${this.z.toString()})`}}class r{constructor(e,t,n){this.x=e,this.y=t,this.z=n}static of(e,t){t??(t=i.J4);const n=i.UH.from(e.x,0,t),s=i.UH.from(e.y,0,t),o=i.UH.from(e.z,0,t);return new r(n,s,o)}scale(e){return r.of({x:this.x.scale(e.x??e.factor??1),y:this.y.scale(e.y??e.factor??1),z:this.z.scale(e.z??e.factor??1)})}scaledOffset(e){return o.of({x:this.x.scale(e.x??e.factor??1),y:this.y.scale(e.y??e.factor??1),z:this.z.scale(e.z??e.factor??1)})}value(){return new s.Pa4(this.x.value,this.y.value,this.z.value)}toString(){return`[${this.x.toString()}x${this.y.toString()}x${this.z.toString()}]`}}},"../../babs/core/lib/game/game_engine.js":function(e,t,n){"use strict";n.d(t,{sm:function(){return re},TO:function(){return oe},XT:function(){return he},dA:function(){return fe}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/disposable.js"),o=n("../../common/lib/env.js"),r=n("../../common/lib/logging.js"),a=n("../../common/lib/math.js"),c=n("../../common/lib/units.js"),l=n("../../babs/core/lib/common/asset_manager.js"),u=n("../../babs/core/lib/common/color.js"),d=n("../../babs/core/lib/common/debug_flags.js"),h=n("../../babs/core/lib/common/flag.js"),f=n("../../babs/core/lib/common/logging.js"),m=n("../../babs/core/lib/common/membership.js"),p=n("../../common/lib/check.js"),b=n("../../common/lib/identity.js");class g extends h.W{constructor(e,t,n){const s=n.range,i={defaultValue:n.defaultValue??s[0]};n.persist&&(i.persist={guard:b.HD,serialize:b.yR,deserialize:e=>s.includes(e)?e:void 0}),super(e,t,i),this.range=s}next(){const e=(0,p.vD)(this.range.indexOf(this.value),-1);this.value=this.range[(e+1)%this.range.length]}previous(){const e=(0,p.vD)(this.range.indexOf(this.value),-1);this.value=this.range[(e+this.range.length-1)%this.range.length]}}class y extends h.W{constructor(e,t,n){const s={defaultValue:n.defaultValue,validate:n.validate};n.persist&&(s.persist={guard:b.HD,serialize:b.yR,deserialize:b.yR}),super(e,t,s)}}var v=n("../../babs/core/lib/common/resource.js"),w=n("../../common/lib/core.js");class x{constructor(...e){this.roots=e,[this.initialStaticScopes,this.initialDisposables]=this.computeReachable()}computeDiff(){const[e,t]=this.computeReachable();return this.initialStaticScopes.forEach((t=>e.delete(t))),this.initialDisposables.forEach((e=>t.delete(e))),[e,t]}reportEntry(e,t,n){const s=`ResourceDiff(${this.roots.map((e=>e.scope.name)).join(", ")})`;(0,r.cM)(`${s} ${e} (${n.size} ${t})`,[...n],{density:n.size?"collapsed":"inline"})}report(){const[e,t]=this.computeDiff();e.size&&(this.reportEntry("static scopes","initial",this.initialStaticScopes),this.reportEntry("static scopes","unexpected",e)),t.size&&(this.reportEntry("disposables","initial",this.initialDisposables),this.reportEntry("disposables","undisposed",t))}computeReachable(){const e=new Set;for(const t of this.roots){e.add(t.scope);const n=(0,b.Bv)((()=>!0));t.scope.forEachSubsidiary(n,(t=>{e.add(t)}))}const t=new Set,n=[...e];for(const e of this.roots)e.scene&&(0,v.V2)(e.scene).resources.forEach((e=>{(0,w.BF)(!t.has(e)),t.add(e),n.push(e)}));const s=(0,b.Bv)((()=>!0));for(;n.length;)n.pop()?.forEach(s,(e=>{(0,w.BF)(!t.has(e)),t.add(e),(0,b.$O)(e,v._z)&&n.push(e)}));return[e,t]}}var j=n("../../babs/core/lib/gui/debug.js"),S=n("../../babs/core/lib/gui/display.js"),_=n("../../babs/core/lib/input/input.js"),k=n("../../babs/core/lib/render/cameras.js"),C=n("../../babs/core/lib/render/constants.js"),T=n("../../babs/core/lib/render/meshes.js"),$=(n("../../babs/core/lib/audio/audio_manager.js"),n("../../common/lib/containers.js")),E=n("../../babs/core/lib/gui/table.js"),O=n("../../babs/core/lib/gui/window.js");function M(e,t,n){t[1].style=e.active?n.styles.bold:n.styles.normal,t[1].color=e.connected?E.I.content:E.I.disabled,t[2].style=!0===e.value?n.styles.bold:n.styles.normal,t[2].color=E.I.highlight}function A(e){return`${e.name}.${e.config.code}`}var P=n("../../babs/core/lib/input/keys.js");n("../../babs/core/lib/input/mouse.js");const I=["ShiftLeft","ShiftRight"],R=["ControlLeft","ControlRight"],D=["MetaLeft","MetaRight"],F=["AltLeft","AltRight"];class z{constructor(){this.onKeysChanged=new s.y$z,this.onStateChanged=new s.y$z,this.keyBindings=new Map}track(e){const t=(0,$.tj)(this.keyBindings,e.config.code,(()=>[]));e.priority?t.unshift(e):t.push(e),e.connected.onChanged(e,(n=>{n?e.priority&&t.forEach((t=>{!t.priority&&t.config.hasSameModifiers(e.config)&&t.signal.cancel()})):e.signal.cancel(),this.signalStateChange(e)})),this.onKeysChanged.notifyObservers()}untrack(e){const t=this.keyBindings.get(e.config.code);t&&this.keyBindings.set(e.config.code,t.filter((t=>t!==e))),e.disposeResources(),this.onKeysChanged.notifyObservers()}*enumerateKeys(){for(const[e,t]of this.keyBindings.entries())for(const e of t)yield{name:e.name,connected:e.connected.value,active:e.active,value:e.value,config:e.config}}signalStateChange(e){this.onStateChanged.notifyObservers({name:e.name,connected:e.connected.value,active:e.active,value:e.value,config:e.config})}onEvent(e,t,n){let s=!1,i=!1;for(const o of this.keyBindings.get(e.code)??[]){let r=!1;const a=o.connected.value&&o.config.hasSameModifiers(e);if(!0===t){if(a){if(i&&!o.priority)break;n?r=!0:o.signal.activate()&&(r=!0,this.cancelModifiers(o.config))}}else!1===t?(n||o.signal.deactivate())&&(r=!0):o.signal.update(t)&&(r=!0);!n&&r&&this.signalStateChange(o),s||(s=r),i||(i=r&&o.priority)}return s}cancelModifiers(e){const t=[];e.wantShift&&!I.includes(e.code)&&t.push(...I),e.wantCtrl&&!R.includes(e.code)&&t.push(...R),e.wantMeta&&!D.includes(e.code)&&t.push(...D),e.wantAlt&&!F.includes(e.code)&&t.push(...F),t.forEach((e=>(this.keyBindings.get(e)??[]).forEach((e=>{e.signal.cancel()&&this.signalStateChange(e)}))))}cancelKeySignals(){this.keyBindings.forEach((e=>e.forEach((e=>{e.signal.cancel()&&this.signalStateChange(e)}))))}}class N extends l.me{constructor(e){super(e,_.II),this.tracker=new z,this.axisEventLogOptions={logId:Symbol("axisLogId"),rate:c.UH.of(4,c.Lm),omitDuplicates:!0}}onInit(e){e.display.onNotify(e.scene.onKeyboardObservable,(e=>{const t=e.event;this.onKeyEvent(t)&&(t.stopPropagation(),t.preventDefault())})),e.scene.preventDefaultOnPointerDown=!0,e.scene.preventDefaultOnPointerUp=!0,e.display.onNotify(e.scene.onPointerObservable,(e=>{this.onMouseEvent(e.type,e.event)})),e.canvas.addEventListener("focusout",(e=>this.onFocus(e))),e.canvas.addEventListener("focusin",(e=>this.onFocus(e)));const t=new s.v$X,n=new Map,i=new P.xw("G.LeftStick.X"),o=new P.xw("G.LeftStick.Y"),a=new P.xw("G.RightStick.X"),c=new P.xw("G.RightStick.Y"),l=new P.xw("G.LeftTrigger"),u=new P.xw("G.RightTrigger");e.display.onNotify(t.onGamepadConnectedObservable,(t=>{if((0,r.cM)("onGamepadConnected",{gp:t}),(0,b.$O)(t,s.FI8)){const r=new v._z(e.display);n.set(t.index,r),r.onNotify(t.onButtonDownObservable,(e=>{const n=`G.${s.nRn[e]}`;this.onGamepadEvent(t.index,n,!0)})),r.onNotify(t.onButtonUpObservable,(e=>{const n=`G.${s.nRn[e]}`;this.onGamepadEvent(t.index,n,!1)})),r.onNotify(t.onPadDownObservable,(e=>{const n=`G.Dpad${s._Q$[e]}`;this.onGamepadEvent(t.index,n,!0)})),r.onNotify(t.onPadUpObservable,(e=>{const n=`G.Dpad${s._Q$[e]}`;this.onGamepadEvent(t.index,n,!1)})),t.onleftstickchanged((e=>{this.onGamepadDualAxisEvent(t.index,i,o,e)})),t.onrightstickchanged((e=>{this.onGamepadDualAxisEvent(t.index,a,c,e)})),t.onlefttriggerchanged((e=>{this.onGamepadAxisEvent(t.index,l,e)})),t.onrighttriggerchanged((e=>{this.onGamepadAxisEvent(t.index,u,e)}))}})),e.display.onNotify(t.onGamepadDisconnectedObservable,(e=>{(0,r.cM)("onGamepadDisconnected",{gp:e});const t=n.get(e.index);t&&(n.delete(e.index),t.dispose())}));const h=function(e,t){const n=(0,E.W)(e,"table",{columnRatios:[.6,.2,.2]}),s=(0,O.jX)(e,"Key Map",n.root,{widthRatio:.8,zIndex:100}),i=new v.qd((()=>{const s=Array.from(t.enumerateKeys());!function(e,t,n){t.sort(((e,t)=>{const n=e.name.startsWith("debug."),s=t.name.startsWith("debug.");return n&&!s?1:s&&!n?-1:e.name.localeCompare(t.name)})),e.layout((e=>{for(const s of t){if(s.name.startsWith("_"))continue;const[t,i,o]=e(A(s));s.name.startsWith("debug.")?t.text=s.name.slice(6):t.text=s.name,i.text=`${s.config.toString()}`,o.text=`${s.value}`,M(s,[t,i,o],n)}}))}(n,s,e)}));return n.root.onDisposeObservable.addOnce((()=>i.dispose())),e.onNotify(t.onKeysChanged,i.scheduler),i.scheduler(),s}(e.display,this.tracker);e.display.add(h,!1),d.Mz.showKeymap.onChanged(e.display,(t=>e.display.show(h,t)),{immediate:!0})}onScopeInit(e){e.scene.onDisposeObservable.addOnce((()=>{e.scope.forEachSubsidiary(this.guard,(e=>{e.bindings.forEach((e=>this.tracker.untrack(e)))}))}))}onProcess(e,t){t.bindings.forEach((e=>this.tracker.track(e)))}onKeyEvent(e){const t="keydown"===e.type,n=new P.xw(e.code,e);return d.cG.showKeyEvents&&!e.repeat&&(0,r.cM)("onKeyEvent",{key:`${n.toString()}`,isDown:t,event:e}),this.tracker.onEvent(n,t,e.repeat)}onMouseEvent(e,t){let n,i;switch(t.button){case 0:n="M.Primary";break;case 1:n="M.Tertiary";break;case 2:n="M.Secondary";break;default:return!1}switch(e){case s.kD3.POINTERDOWN:i=!0;break;case s.kD3.POINTERUP:i=!1;break;default:return!1}const o=new P.xw(n,t);return d.cG.showKeyEvents&&(0,r.cM)("onMouseEvent",{key:`${o.toString()}`,isDown:i,event:t}),this.tracker.onEvent(o,i,!1)}onGamepadEvent(e,t,n){const s=new P.xw(t);d.cG.showKeyEvents&&(0,r.cM)("onGamepadEvent",{key:`${s.toString()}`,value:n,index:e}),this.tracker.onEvent(s,n,!1)}onGamepadAxisEvent(e,t,n){n<.1&&n>-.1&&(n=0),d.cG.showKeyEvents&&(0,r.cM)("onGamepadAxisEvent",{key:`${t.toString()}`,value:n,index:e},this.axisEventLogOptions),this.tracker.onEvent(t,n,!1)}onGamepadDualAxisEvent(e,t,n,s){s.x<.1&&s.x>-.1&&(s.x=0),s.y<.1&&s.y>-.1&&(s.y=0),d.cG.showKeyEvents&&(0,r.cM)("onGamepadDualAxisEvent",{x:`${t.toString()}`,y:`${n.toString()}`,value:s,index:e},this.axisEventLogOptions),this.tracker.onEvent(t,s.x,!1),this.tracker.onEvent(n,s.y,!1)}onFocus(e){d.cG.showKeyEvents&&(0,r.cM)("onFocus",{type:e.type,event:e}),this.tracker.cancelKeySignals()}}N.I=new N(v.fi);var L=n("../../babs/core/lib/common/asset.js");class B extends L.x{constructor(e,t,n){super(e,t,n),this.onDispose((()=>{delete this.image_}))}share(){return(0,p.ro)(this.image_)}setImage(e){this.image_=e}}class V extends l.me{constructor(e){super(e,B)}onProcess(e,t){e.fetchImage(t,(e=>{t.setImage(e)}))}}new V(v.fi),n("../../../node_modules/@babylonjs/loaders/glTF/index.d.ts"),n("../../../node_modules/@babylonjs/loaders/OBJ/index.d.ts");var H=n("../../babs/core/lib/common/nodes.js"),G=n("../../babs/core/lib/render/scene_asset.js");class W extends l.me{constructor(e){super(e,G.A)}onProcess(e,t){const n=t.options?.enablePhysicalLighting??!1;e.fetchScene(t,(e=>{const i=t.options?.scale;for(const t of(0,H.go)(s.Kj0,...e.meshes))t.renderingGroupId=C.Yt.meshDefault,i&&(t.scaling=i);const o=new Map(e.animationGroups.map((e=>[e.name,e])));if(t.options?.animations)for(const[e,n]of Object.entries(t.options.animations)){const s=(0,l.bk)(t.name,n),i=(0,w.ro)(o.get(s),`Missing animation ${n} of ${t.name}`);i.stop(),i.name=(0,l.bk)(t.name,e),o.delete(s)}if(!n)for(const t of e.materials)(0,b.$O)(t,s.YVB)&&(t.usePhysicalLightFalloff=!1);o.forEach((e=>e.dispose())),t.setScene(e)}),t.options)}}new W(v.fi);var U=n("../../babs/core/lib/render/texture_asset.js");class q extends l.me{constructor(e){super(e,U.X)}onProcess(e,t){e.fetchTexture(t,(e=>{t.setTexture(e)}))}}new q(v.fi);var K,Q,X,Y,J,Z=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},ee=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n};const te=[C.K2],ne=[C.K2];let se;const ie=new g(v.fi,"FovMode",{range:["expand","crop","horizontal","vertical"],defaultValue:"expand",persist:!0});_.II.register(v.fi,"next FovMode",{keys:"Alt+KeyV",valued:ie}).onClick(v.fi,(()=>ie.next()));const oe=new h.W(v.fi,"CanvasAR",{defaultValue:void 0}),re=new h.W(v.fi,"CameraAR",{defaultValue:void 0}),ae=new g(v.fi,"CameraARMode",{range:["default","16:9","4:3","640x512"],defaultValue:"default",persist:!0});_.II.register(v.fi,"next CameraARMode",{keys:"Alt+KeyB",valued:ae}).onClick(v.fi,(()=>ae.next()));const ce=_.II.register(v.fi,"_freeLookInput",{keys:["W","A","S","D","ArrowUp","ArrowLeft","ArrowDown","ArrowRight"],priority:!0}),le=(0,_.Qw)(v.fi,"Reset scene","Alt+Backspace");function ue(e,t){e.physicsEnabled=!t;for(const n of e.particleSystems)t?void 0===n.unpausedUpdateSpeed&&(n.unpausedUpdateSpeed=n.updateSpeed,n.updateSpeed=0):void 0!==n.unpausedUpdateSpeed&&(n.updateSpeed=n.unpausedUpdateSpeed,delete n.unpausedUpdateSpeed)}function de(e){let t=e.activeCamera;return!t&&e.activeCameras&&e.activeCameras.length&&(t=e.activeCameras[0]),t??void 0}const he=new y(v.fi,"CurrentApp",{persist:!0});class fe{constructor(e,t,n){this.params=e,this.loadScope=t,this.defaultApp=n,K.set(this,void 0),Q.set(this,[]),X.set(this,!1),Y.set(this,void 0),J.set(this,[]),(0,f.Q)(),[s.Wot.BlackReadOnly,s.y3G.IdentityReadOnly,s.Pa4.LeftHandedForwardReadOnly,s.Pa4.LeftReadOnly,s.Pa4.RightHandedForwardReadOnly,s.Pa4.RightReadOnly,s.Pa4.UpReadOnly,s.Pa4.ZeroReadOnly,s.RDh.X,s.RDh.Y,s.RDh.Z].forEach(Object.freeze),(0,r.cM)("GameEngine",{params:e,debug:d.cG,paused:fe.Paused.value},{density:"collapsed"}),this.engine=new s.D4V(this.params.canvas,!1,{adaptToDeviceRatio:!0,stencil:!0})}async loadApp(e){if(Z(this,X,"f"))return console.log(`Deferring load of ${e}`),void ee(this,Y,e,"f");ee(this,X,!0,"f"),window.history.pushState(void 0,document.title,e===this.defaultApp?window.location.pathname+window.location.search:`#${e}`);const t=await this.loadScope(e);await this.addScope(t),ee(this,X,!1,"f"),void 0!==Z(this,Y,"f")&&(e=Z(this,Y,"f"),ee(this,Y,void 0,"f"),setTimeout((()=>{console.log(`Resuming load of ${e}`),this.loadApp(e)})))}async start(){o.P||(document.title=` ${document.title} `,document.body.style.backgroundColor="#252526"),window.addEventListener("resize",(()=>{this.maxWidth=this.maxHeight=void 0,this.updateFoV()})),ie.onChanged(v.fi,(()=>this.updateFoV())),oe.onChanged(v.fi,(()=>this.updateFoV())),re.onChanged(v.fi,(()=>this.updateFoV())),ae.onChanged(v.fi,(()=>this.updateFoV())),window.addEventListener("deviceorientation",(()=>this.updateOrientation(window.screen.orientation))),this.updateOrientation(window.screen.orientation),fe.Paused.onChanged(v.fi,(e=>{(0,r.cM)(e?"Paused.":"Resumed."),Z(this,Q,"f").forEach((t=>ue(t.scene,e)))})),d.Mz.freeLook.onChanged(v.fi,(e=>{this.freeLook(e),fe.Paused.value=e})),le.onEnabled(v.fi,(()=>{he.value=void 0,this.loadApp(this.defaultApp)}));const e=await this.initializeGlobalScope();this.engine.runRenderLoop((()=>{const t=fe.Paused.value;if(!t){const e=c.UH.of(this.engine.getDeltaTime(),c.HA);v._z.update(e)}Z(this,J,"f").splice(0).forEach((e=>e()));let n=0;for(let e=0;e{})),i.speed=.75,i.keysUp=[38,87],i.keysDown=[40,83],i.keysLeft=[37,65],i.keysRight=[39,68],i.inputs.addMouseWheel(),i.attachControl(),t.activeCamera=i;const o=t.onPointerObservable.add((e=>function(e,t){e.pickInfo&&e.pickInfo.pickedMesh&&e.type===s.kD3.POINTERDOUBLETAP&&(se?se.setTarget(e.pickInfo.pickedMesh.absolutePosition):(se=new s.YfP("ArcRotate",Math.PI/3,Math.PI/3,10,e.pickInfo.pickedMesh.absolutePosition,t),se.zoomToMouseLocation=!0,se.attachControl(),t.activeCamera=se))}(e,t)));this.restoreFreeLook=()=>{n.isDisposed()||(t.activeCamera=n),i.dispose(),t.onPointerObservable.remove(o),se&&(se.dispose(),se=void 0)}}async initializeGlobalScope(){const e=new s.xsS(this.engine,{virtual:!0});e.physicsEnabled=!1,e.clearColor=s.HEv.FromHexString(u.Pf.midnightBlue);const t=new S.sS(e),n=(new k.v("tween",s.Pa4.ZeroReadOnly,e),new l.ve(this.params.canvas,{engine:this.engine,scene:e,gameEngine:this,display:t,scope:v.fi,urlBase:this.params.urlBase}));return(0,l.wV)(n),await n.load(),ee(this,K,{scope:v.fi,scene:e},"f"),o.P||(Z(this,K,"f").diff=new x(Z(this,K,"f"))),e}async processScope(e,t,n){const s=new l.jO({engine:this.engine,scene:t,gameEngine:this,display:n,scope:e,urlBase:`${this.params.urlBase}${this.params.assetPrefix}`});(0,l.ZH)(s),await s.load()}async addScope(e,t=!0){if(!o.P&&t){const t=Z(this,Q,"f").length>0;if(this.clearScopes(),t){const e=i.v.snapshot();e.length&&(0,r.cM)(`Tracked(${i.v.label}) (${e.length} undisposed objects)`,e,{density:e.length?"collapsed":"inline"})}i.v.startTracking(`${e.scope.name}`)}const n=new s.xsS(this.engine);fe.Paused.value&&ue(n,!0);const a={scope:e.scope,scene:n};o.P||(a.diff=new x(a)),n.onNewMeshAddedObservable.add((e=>{e.isAnInstance||(e.renderingGroupId=C.Yt.meshDefault,(0,T.yD)(e),m.Vp.addTo(e,...te),(0,C.vP)(e))})),n.onNewCameraAddedObservable.add((e=>{m.Vp.addTo(e,...ne);const t=e.getScene().activeCamera;t&&t!==e||this.onNextLoop((()=>this.updateFoV())),this.onNextLoop((()=>{(0,r.cM)("camera",{name:e.name,position:e.position,fov:c.UH.of(e.fov,c.wI).to(c.P1),fovMode:e.fovMode,aspectRatio:this.getCanvasAR()*(e.viewport.width/e.viewport.height)})}))}));const l=new S.sS(n);a.display=l,(0,j.Lh)(l,n),j.iu.create(n,l),await this.processScope(e.scope,n,l);const u={scope:e.scope,scene:n,display:l,gameEngine:this,urlBase:`${this.params.urlBase}${this.params.assetPrefix}`};return await e.createScene(u),await new Promise((e=>setTimeout(e))),t&&this.clearScopes(),Z(this,Q,"f").push(a),this.updateFoV(),n}clearScopes(){const e=[...Z(this,Q,"f")];Z(this,Q,"f").length=0,e.forEach((e=>{e.scene.dispose(),e.scope.disposeResources(),o.P||(Z(this,K,"f")?.diff?.report(),e.diff?.report())}))}getCanvasAR(){return this.engine.getRenderWidth()/this.engine.getRenderHeight()}updateFoV(){let e=!1;void 0!==this.maxWidth&&void 0!==this.maxHeight||(this.engine.resize(),e=!0,this.maxWidth=this.engine.getRenderWidth(),this.maxHeight=this.engine.getRenderHeight());let t,n,i=this.getCanvasAR();switch(void 0===oe.value?e=this.engine.setSize(this.maxWidth,this.maxHeight):(0,a.cL)(i,oe.value,.002)||(e=oe.value{const n=new i.al(e);return n.resizeToFit=!0,n.horizontalAlignment=i.oT.HORIZONTAL_ALIGNMENT_RIGHT,t.addControl(n),n}}}function f(e,t){let n;l.Mz.showInspector.onChanged(e,(e=>{(0,o.cW)(window.INSPECTOR,"The Inspector code is not loaded."),e?t.debugLayer.show({embedMode:!1}):t.debugLayer.hide(),t.getEngine().getRenderingCanvas()?.focus({preventScroll:!0})}),{immediate:!d.P}),l.Mz.showAxes.onChanged(e,(e=>{e&&!n?n=new s.wMC(t,5):!e&&n&&(n.dispose(),n=void 0)}),{immediate:!d.P})}const m=["onBeforeAnimations","onAfterAnimations","onBeforePhysics","onAfterPhysics","onBeforeRender","onBeforeRenderTargetsRender","onAfterRenderTargetsRender","onBeforeCameraRender","onBeforeActiveMeshesEvaluation","onAfterActiveMeshesEvaluation","onBeforeParticlesRendering","onAfterParticlesRendering","onBeforeDrawPhase","onAfterDrawPhase","onAfterCameraRender","onAfterRender","onBeforeRenderingGroup","onAfterRenderingGroup"];class p{constructor(e){this.index=0,this.total=0,this.values=new Array(e).fill(0)}push(e){this.total-=this.values[this.index],this.values[this.index]=e,this.total+=e,this.index=(this.index+1)%this.values.length}get value(){return this.total/this.values.length}}const b=(0,r.Pn)()({fps:{label:"Frames per second",init:e=>{e.scene.captureFrameTime=!0,e.scene.captureInterFrameTime=!0},value:e=>1e3/(e.scene.frameTimeCounter.current+e.scene.interFrameTimeCounter.current),units:c.XF,precision:0},idle:{label:"Time between frames",init:e=>e.scene.captureInterFrameTime=!0,value:e=>e.scene.interFrameTimeCounter},process:{label:"Time for all frame processing",init:e=>e.scene.captureFrameTime=!0,value:e=>e.scene.frameTimeCounter},physics:{label:"Time for physics simulation",init:e=>e.scene.capturePhysicsTime=!0,value:e=>e.scene.physicsTimeCounter},activeMeshes:{label:"Active Meshes Evaluation",init:e=>e.scene.captureActiveMeshesEvaluationTime=!0,value:e=>e.scene.activeMeshesEvaluationTimeCounter},totalRender:{label:"Time for all frame rendering",init:e=>e.scene.captureRenderTime=!0,value:e=>e.scene.renderTimeCounter},renderTargets:{label:"Render Target Textures",init:e=>e.scene.captureRenderTargetsRenderTime=!0,value:e=>e.scene.renderTargetsRenderTimeCounter},particleRender:{label:"Time for particle rendering",init:e=>e.scene.captureParticlesRenderTime=!0,value:e=>e.scene.particlesRenderTimeCounter},spritesRender:{label:"Time for sprite rendering",init:e=>e.scene.captureSpritesRenderTime=!0,value:e=>e.scene.spritesRenderTimeCounter},cameraRender:{label:"Time for camera rendering",init:e=>e.scene.captureCameraRenderTime=!0,value:e=>e.scene.cameraRenderTimeCounter},gpuRender:{label:"GPU frame render time (parallel with CPU work)",init:e=>e.engine.captureGPUFrameTime=!0,value:e=>e.engine.gpuFrameTimeCounter,factor:1e-6},shaderCompilation:{label:"CPU shader compilation",init:e=>e.engine.captureShaderCompilationTime=!0,value:e=>e.engine.shaderCompilationTimeCounter},drawCalls:{label:"Draw calls per frame",value:e=>e.scene.drawCallsCounter,units:c.XF}}),g=["fps","idle","process","physics","activeMeshes","totalRender","gpuRender"];class y extends u._z{constructor(e,t){super(e),this.scene=e,this.indent="",this.trackingState="inactive",this.showPerfMetrics(t),this.observePhases()}static create(e,t){const n=new y(e,t);y.instance=n,n.onDispose((()=>{y.instance===n&&delete y.instance})),l.Mz.logNextFrame.onEnabled(t,(()=>{y.debugOneFrame()}))}static currentPhase(){return(0,o.ro)(y.instance?.phase)}static get isDebuggingFrame(){return"active"===y.instance?.trackingState}static logFrame(e,t){this.isDebuggingFrame&&y.instance?.logFrame(e,t)}static debugOneFrame(e=!1){const t=(0,o.ro)(y.instance);t.trackingState=e?"waitForNextFrame":"waitForNextPhase",delete t.trackingEndPhase}showPerfMetrics(e){let t=n=>{if(!n)return;const i=h();e.add(i);const o={engine:new s.Pj8(this.scene.getEngine()),scene:new s.Cye(this.scene)},a=g.map((e=>b[e])),l=g.map((e=>i.add(e))),u=g.map((()=>new p(20)));a.forEach((e=>e.init?.(o))),this.scene.registerBeforeRender((()=>{for(let e=0;ee.show(i,t)};l.Mz.showPerfMetrics.onChanged(e,(e=>t(e)),{immediate:!0})}logFrame(e,t){(0,a.cM)("Frame",{label:`${this.indent}${e}`,...t})}observePhases(){let e=[...m];const t=e.filter((e=>e.endsWith("Physics")));this.scene.isPhysicsEnabled()||(e=e.filter((e=>!t.includes(e))));for(const t of e){const n=`${t}Observable`,i=(0,o.ro)(this.scene[n],`Missing Scene.${n}()`);this.onNotify(i,(n=>{const i=this.phase;if(this.phase=t,"inactive"!==this.trackingState&&(this.trackingEndPhase===t?this.trackingState="inactive":("waitForNextPhase"===this.trackingState||"waitForNextFrame"===this.trackingState&&t===e[0])&&(this.trackingState="active",this.indent="",this.trackingEndPhase=t),"active"===this.trackingState)){t.startsWith("onBefore")&&i?.startsWith("onBefore")?this.indent+=" ":t.startsWith("onAfter")&&i?.startsWith("onAfter")&&(this.indent=this.indent.slice(0,this.indent.length-2));const e={};(0,r.$O)(n,s.xsS)||((0,r.$O)(n,s.V1s)?e.camera=n.name:(0,r.$O)(n,s.tYM)&&(e.camera=n.camera?.name,e.renderingGroupId=n.renderingGroupId)),this.logFrame(this.phase,e)}}))}}}},"../../babs/core/lib/gui/display.js":function(e,t,n){"use strict";n.d(t,{Ov:function(){return u},sS:function(){return h},x4:function(){return l}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../../node_modules/@babylonjs/gui/index.js"),o=n("../../common/lib/env.js"),r=n("../../common/lib/identity.js"),a=n("../../babs/core/lib/common/resource.js");const c=window.devicePixelRatio;function l(e){return`${Math.ceil(e*c)}px`}function u(e){return Math.ceil(e*c)}function d(e){return{width:e.getRenderWidth(),height:e.getRenderHeight()}}class h extends a._z{constructor(e){if(super(e),this.scene=e,this.widgets=new Set,this.adt=i.in.CreateFullscreenUI("gui",!0,e),this.adt.layer&&(this.adt.layer.layerMask=1),this.styles=function(e){const t=(t,n,s="normal")=>{const i=e.createStyle();return i.fontFamily=t,i.fontSize=l(n),i.fontWeight=s,i},n="Segoe WPC,Segoe UI,sans-serif",s=(0,r.Pn)()({normal:t(n,13,"400"),bold:t(n,13,"800"),title:t(n,11,"700")});return Object.freeze(s)}(this.adt),o.P)this.addDebugEntry=()=>{};else{const e=h.createDebug();this.adt.addControl(e.root),this.addDebugEntry=t=>e.addEntry(t)}this.onNotify(e.getEngine().onResizeObservable,(e=>{const t=d(e);this.widgets.forEach((e=>e.onResize?.(t)))}));const t=d(e.getEngine());this.widgets.forEach((e=>e.onResize?.(t))),this.onUpdate((()=>{this.widgets.forEach((e=>e.onUpdate?.()))})),this.onDispose((()=>{this.widgets.forEach((e=>e.root.dispose())),this.widgets.clear()}))}static createDebug(){const e=new i.Ae("debug");e.fontFamily="Consolas",e.fontSize=12,e.alpha=.7,e.color="white",e.background="black",e.adaptHeightToChildren=!0,e.adaptWidthToChildren=!0,e.verticalAlignment=i.oT.VERTICAL_ALIGNMENT_TOP,e.horizontalAlignment=i.oT.HORIZONTAL_ALIGNMENT_LEFT;const t=new i.eL("panel");return t.isVertical=!0,t.adaptWidthToChildren=!0,t.paddingLeftInPixels=t.paddingRightInPixels=4,e.addControl(t),{root:e,addEntry:function(e){const n=new i.al(e);return n.resizeToFit=!0,n.horizontalAlignment=i.oT.HORIZONTAL_ALIGNMENT_LEFT,t.addControl(n),n}}}get todo(){return this.adt}coords(e,t){let n=this.scene.pointerX,i=this.scene.pointerY;return t&&(n=t.movementX,i=t.movementY),e?new s.FM8(n,i):new s.FM8(u(n),u(i))}onMouseMove(e,t){const n=this.scene.onPrePointerObservable.add((n=>{e(this.coords(void 0,!0===t?n.event:void 0))}),s.kD3.POINTERMOVE);return{dispose:()=>this.scene.onPrePointerObservable.remove(n)}}add(e,t=!0){return e.onResize&&e.onResize(d(this.scene.getEngine())),this.widgets.add(e),this.show(e,t),e}remove(e){this.show(e,!1),this.widgets.delete(e)}show(e,t=!0){t?this.adt.addControl(e.root):this.adt.removeControl(e.root)}hide(e){this.show(e,!1)}}},"../../babs/core/lib/gui/table.js":function(e,t,n){"use strict";n.d(t,{I:function(){return h},W:function(){return b}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../../node_modules/@babylonjs/gui/index.js"),o=n("../../common/lib/check.js"),r=n("../../common/lib/identity.js"),a=n("../../babs/core/lib/common/color.js"),c=n("../../babs/core/lib/input/input.js"),l=n("../../babs/core/lib/gui/display.js"),u=n("../../babs/core/lib/gui/vscode.js"),d=n("../../babs/core/lib/gui/window.js");const h=(0,a.DG)({text:u.z.text,transparent:"#0000"},(e=>({content:e.text,disabled:u.z.disabledText,highlight:u.z.highlightText,tableFill:u.z.tableFill,tableRow:u.z.tableRow,hoverRowFill:u.z.hoverRowFill}))),f=(0,a.NC)((0,a.nV)((0,a.H_)(h.hoverRowFill),.2));function m(e,t){let n;switch(t){case"hovering":n=h.hoverRowFill;break;case"selecting":n=f;break;default:n=e%2==0?h.tableRow:h.transparent}return n}const p=(0,r.SC)().withDefaults({rowHeight:27,columnRatios:[1]});function b(e,t,n){const a=p.apply(n??{}),u=new i.rj(t);u.verticalAlignment=i.oT.VERTICAL_ALIGNMENT_TOP,u.horizontalAlignment=i.oT.HORIZONTAL_ALIGNMENT_RIGHT,u.paddingTop=u.paddingBottom=(0,l.x4)(d.ld),u.paddingLeft=u.paddingRight=(0,l.x4)(d.ld),u.style=e.styles.normal,u.background=h.tableFill,a.columnRatios.forEach((e=>{(0,o.BF)(e>0&&e<=1),u.addColumnDefinition(e)}));const f=new Map,b=e=>function(e,t,n,s){const r=n.size;for((0,o.M1)(n.get(s),void 0,(()=>`Row with duplicate label: ${s}`)),n.set(s,r);e.rowCount<=r;)e.addRowDefinition((0,l.Ov)(t.rowHeight),!0);const a=[],c=m(r);for(let t=0;t{const n=[];for(let s=0;s{const t=m(e,e===y?v?"selecting":"hovering":void 0);g(e,x).forEach((e=>e.background=t))};u.onPointerMoveObservable.add((()=>{const t=y;u.getLocalCoordinatesToRef(e.coords(),w);const n=Math.floor(w.y/(0,l.Ov)(a.rowHeight));y=n<0||n>=f.size?void 0:n,t!==y&&(void 0!==t&&j(t),void 0!==y&&j(y))})),u.onPointerOutObservable.add((()=>{if(v=!1,void 0!==y){const e=y;y=void 0,j(e)}})),u.onPointerDownObservable.add((e=>{a.onClick&&e.buttonIndex===c.tc.Primary&&(v=!0,void 0!==y&&j(y))}));const S=(0,r.V9)(i.al);return u.onPointerClickObservable.add((e=>{if(a.onClick&&e.buttonIndex===c.tc.Primary&&v&&(v=!1,void 0!==y)){j(y);const e=g(y,S).at(0)?.name;a.onClick((0,o.ro)(e))}})),{root:u,layout:e=>{for(u.clearControls(),f.clear(),e(b);u.rowCount>f.size;)u.removeRowDefinition(u.rowCount-1);const t=2*(0,l.Ov)(d.ld);u.heightInPixels=(0,l.Ov)(a.rowHeight)*u.rowCount+t},get:e=>((e,t)=>{const n=(0,o.ro)(f.get(e));return g(n,t)})(e,S),list:()=>Array.from(f.keys())}}},"../../babs/core/lib/gui/vscode.js":function(e,t,n){"use strict";n.d(t,{z:function(){return s}});const s=(0,n("../../babs/core/lib/common/color.js").DG)({text:"#cccccc",panelFill:"#1e1e1e",headerFill:"#80808033",disabledText:"#808080",highlightText:"#d7ba7d",scrollBar:"#646464b3",tableRow:"#2a2d2e",tableFill:"#252526",hoverRowFill:"#094771"})},"../../babs/core/lib/gui/window.js":function(e,t,n){"use strict";n.d(t,{LW:function(){return l},jX:function(){return h},ld:function(){return u}});var s=n("../../../node_modules/@babylonjs/gui/index.js"),i=n("../../common/lib/identity.js"),o=n("../../babs/core/lib/common/color.js"),r=n("../../babs/core/lib/gui/display.js"),a=n("../../babs/core/lib/gui/vscode.js");const c=(0,o.DG)({text:a.z.text,transparent:"#0000"},(e=>({header:e.text,headerFill:a.z.headerFill,panelFill:a.z.panelFill,scrollBar:a.z.scrollBar}))),l=6,u=10,d=(0,i.SC)().withDefaults({zIndex:0,widthRatio:.5,heightRatio:.5});function h(e,t,n,i){const o=d.apply(i??{}),a=new s.Ae(t);a.isPointerBlocker=!0,a.zIndex=o.zIndex,a.thickness=(0,r.Ov)(1),a.color=c.text,a.background=c.panelFill,a.width=`${Math.round(100*o.widthRatio)}%`;const u=new s.eL("panel");a.addControl(u);const h=new s.Ae("header");h.height=(0,r.x4)(24),h.thickness=0,h.color=c.header,h.background=c.headerFill,u.addControl(h);const f=new s.al("title");f.textHorizontalAlignment=s.oT.HORIZONTAL_ALIGNMENT_LEFT,f.paddingLeft=f.paddingRight=(0,r.x4)(l),f.style=e.styles.title,f.text=t.toUpperCase(),h.addControl(f);const m=new s.am("scroll");return m.forceVerticalBar=!0,m.thickness=0,m.barSize=(0,r.Ov)(10),m.barColor=c.scrollBar,m.barBackground=c.transparent,m.color=c.transparent,m.background=c.transparent,u.addControl(m),m.addControl(n),{root:a,onResize:function(e){const t=Math.ceil(e.height*o.heightRatio);m.height=(0,r.x4)(t),u.height=(0,r.x4)(24+t),a.height=(0,r.x4)(24+t+2)}}}},"../../babs/core/lib/input/input.js":function(e,t,n){"use strict";n.d(t,{II:function(){return k},tc:function(){return v},Qw:function(){return C}});var s,i,o=n("../../../node_modules/@babylonjs/core/index.js"),r=n("../../common/lib/check.js"),a=n("../../common/lib/containers.js"),c=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n},l=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};class u{constructor(e){s.set(this,!1),i.set(this,void 0),c(this,i,e,"f")}activate(){return!l(this,s,"f")&&(c(this,s,!0,"f"),l(this,i,"f").call(this,"activate",1),!0)}deactivate(){return!!l(this,s,"f")&&(c(this,s,!1,"f"),l(this,i,"f").call(this,"deactivate",0),!0)}update(e){const t=0!==e;return l(this,s,"f")!==t?(c(this,s,t,"f"),l(this,i,"f").call(this,t?"activate":"deactivate",e)):t&&l(this,i,"f").call(this,"change",e),!0}cancel(){return!!l(this,s,"f")&&(c(this,s,!1,"f"),l(this,i,"f").call(this,"cancel",0),!0)}dispose(){this.cancel()}}s=new WeakMap,i=new WeakMap;var d=n("../../babs/core/lib/common/resource.js"),h=n("../../common/lib/identity.js"),f=n("../../babs/core/lib/common/flag.js");const m=e=>e;class p extends f.W{constructor(e,t,n){const s={defaultValue:n?.defaultEnabled??!1,validate:n?.validate};n?.persist&&(s.persist={guard:h.jn,serialize:h.yR,deserialize:h.yR}),super(e,t,s)}toggle(){this.value=!this.value}onEnabled(e,t,n){this.onChanged(e,t,{predicate:m,immediate:n})}}var b,g,y,v,w=n("../../babs/core/lib/input/keys.js"),x=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},j=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n};!function(e){e[e.Primary=0]="Primary",e[e.Middle=1]="Middle",e[e.Secondary=2]="Secondary"}(v||(v={}));class S extends d.sX{constructor(e,t,n,s,i=!1){super(e.name),this.input=e,this.valued=t,this.signal=n,this.config=s,this.priority=i}get connected(){return this.input.connected}get active(){return this.input.active}get value(){return this.valued.value}}const _={value:void 0};class k extends d.$9{constructor(e,t,n,s,i){super(e,t),b.add(this),this.onEvent=new o.y$z,this.onChange=new o.y$z,this.connected_=new p(this,"connected"),g.set(this,0),this.bindings=(0,a._2)(n).map((e=>new S(this,s,this.createSignal(),w.xw.from(e),i)))}static register(e,t,n){return new k(e,t,n?.keys??[],n?.valued??_,n?.priority??!1)}get connected(){return this.connected_}get active(){return x(this,g,"f")>0}onValue(e,t,n=!0){const s=this.onChange.add(t);this.updateConnected_(),n&&s&&e.onDispose((()=>{this.onChange.remove(s),this.updateConnected_()}))}onDown(e,t,n,s=!0){const i=this.onEvent.add((e=>{"activate"===e?t():"deactivate"===e&&n()}));this.updateConnected_(),s&&i&&(x(this,g,"f")&&t(),e.onDispose((()=>{x(this,g,"f")&&n(),this.onEvent.remove(i),this.updateConnected_()})))}onClick(e,t,n=!0){const s=this.onEvent.add((e=>{"trigger"===e&&t()}));this.updateConnected_(),n&&s&&e.onDispose((()=>{this.onEvent.remove(s),this.updateConnected_()}))}createSignal(){return this.acquire(new u(((e,t)=>x(this,b,"m",y).call(this,e,t))))}updateConnected_(){this.connected_.value=this.onEvent.observers.some((e=>!e._willBeUnregistered))||this.onChange.observers.some((e=>!e._willBeUnregistered))}}function C(e,t,n,s){const i=new p(e,t,s);if(void 0===n&&!s?.wantInput)return i;!s?.mode&&s?.persist&&(s??(s={}),s.mode="stateful");const o=k.register(e,t,{keys:n,valued:i,...s}),a=e=>{if("stateful"===s?.mode)o.onClick(e,(()=>i.toggle()),void 0!==s?.enable);else{(0,r.BF)(!0!==s?.persist,(()=>"'ephemeral' toggleInput does not support persistence"));const t=s?.defaultEnabled??!1;o.onDown(e,(()=>i.value=!t),(()=>i.value=t),void 0!==s?.enable)}};return s?.enable?s.enable.add(a):a(e),s?.wantInput?{toggle:i,input:o}:i}g=new WeakMap,b=new WeakSet,y=function(e,t){"activate"===e?(j(this,g,x(this,g,"f")+1,"f"),1===x(this,g,"f")&&this.onEvent.notifyObservers("activate")):"change"!==e&&(j(this,g,x(this,g,"f")-1,"f"),0===x(this,g,"f")&&this.onEvent.notifyObservers("deactivate"),"cancel"!==e&&this.onEvent.notifyObservers("trigger")),this.onChange.notifyObservers(t)}},"../../babs/core/lib/input/keys.js":function(e,t,n){"use strict";n.d(t,{xw:function(){return r}});var s,i,o=n("../../common/lib/identity.js");!function(e){e.symbols=(0,o.lG)({"`":"Backquote","-":"Minus","=":"Equal","[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash"}),e.isSymbol=function(t){return t in e.symbols.forward};const t=/^\d$/;e.isDigit=function(e){return t.test(e)};const n=/^[A-Z]$/;e.isLetter=function(e){return n.test(e)}}(s||(s={})),function(e){e.modifiers={ShiftLeft:!0,ControlLeft:!0,MetaLeft:!0,AltLeft:!0,ShiftRight:!0,ControlRight:!0,MetaRight:!0,AltRight:!0},e.isModifier=function(t){return t in e.modifiers}}(i||(i={}));class r{constructor(e,t){this.code=e;const n=(t?.shiftKey??!1)&&"ShiftLeft"!==e&&"ShiftRight"!==e,s=(t?.ctrlKey??!1)&&"ControlLeft"!==e&&"ControlRight"!==e,i=(t?.metaKey??!1)&&"MetaLeft"!==e&&"MetaRight"!==e,o=(t?.altKey??!1)&&"AltLeft"!==e&&"AltRight"!==e;this.modifierMask=(n?1:0)|(s?2:0)|(i?4:0)|(o?8:0)}static fromString(e){const t={},n=e.split("+");for(let e=0;e{a.value=document.pointerLockElement===e.getRenderingCanvas()}),!1))}function u(e){c||l(e),e.isPointerLock||e.enterPointerlock()}function d(e,t,n=!0){const s=t.getEngine();let d;c||l(s),e.onDispose((()=>{!function(e){c||l(e),e.isPointerLock&&e.exitPointerlock()}(s)})),a.onChanged(e,(t=>{if(o.dA.Paused.value=!t,t)return d?.dispose(),void(d=void 0);d?console.warn("Unexpected pointer lock clickAwaiter"):(d=new i._z(e,"PointerLockClickAwaiter"),r.onClick(d,(()=>u(s))),u(s))}),{immediate:n})}},"../../babs/core/lib/physics/ammo.js":function(e,t,n){"use strict";n.d(t,{Pb:function(){return S},K$:function(){return p},xY:function(){return v},ur:function(){return w},KS:function(){return g},Sq:function(){return y}});var s,i=n("../../../node_modules/@babylonjs/core/index.js"),o=n("../../common/lib/check.js"),r=n("../../common/lib/identity.js"),a=n("../../common/lib/logging.js"),c=n("../../common/lib/units.js"),l=n("../../babs/core/lib/common/debug_flags.js"),u=n("../../babs/core/lib/common/resource.js"),d=n("../../../node_modules/ammojs-typed/ammo/ammo.js");let h;var f;window.Ammo=d,(f=s||(s={}))[f.CF_DYNAMIC_OBJECT=0]="CF_DYNAMIC_OBJECT",f[f.CF_STATIC_OBJECT=1]="CF_STATIC_OBJECT",f[f.CF_KINEMATIC_OBJECT=2]="CF_KINEMATIC_OBJECT",f[f.CF_NO_CONTACT_RESPONSE=4]="CF_NO_CONTACT_RESPONSE",f[f.CF_CUSTOM_MATERIAL_CALLBACK=8]="CF_CUSTOM_MATERIAL_CALLBACK",f[f.CF_CHARACTER_OBJECT=16]="CF_CHARACTER_OBJECT",f[f.CF_DISABLE_VISUALIZE_OBJECT=32]="CF_DISABLE_VISUALIZE_OBJECT",f[f.CF_DISABLE_SPU_COLLISION_PROCESSING=64]="CF_DISABLE_SPU_COLLISION_PROCESSING",f[f.CF_HAS_CONTACT_STIFFNESS_DAMPING=128]="CF_HAS_CONTACT_STIFFNESS_DAMPING",f[f.CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR=256]="CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR",f[f.CF_HAS_FRICTION_ANCHOR=512]="CF_HAS_FRICTION_ANCHOR",f[f.CF_HAS_COLLISION_SOUND_TRIGGER=1024]="CF_HAS_COLLISION_SOUND_TRIGGER";class m extends u._z{constructor(e,t,n){if(super(e),this.plugin=t,this.reuse=n,!n){const e=t.bjsAMMO;this.onDispose((()=>{h===e&&(h=void 0)}))}}}async function p(e){h||(h=await Ammo());const t=new i.bei(void 0,h);return new m(e,t,!0)}function b(e,t,...n){const s=n.length?n:["The Ammo physics engine is not enabled."];(0,o.cW)(h,...s);const i=e.physicsImpostor,a=i.physicsBody;if((0,r.EN)(a))return t({ammo:h,imposter:i,body:a});console.warn(`${e.name} is missing physicsImpostor or physicsBody`)}function g(e,t){const n=e=>e?1:0;b(e,(({ammo:e,body:s})=>{s.setAngularFactor(new e.btVector3(n(t?.x),n(t?.y),n(t?.z)))}),"setRotationAxes is only supported by Ammo.")}function y(e,t){b(e,(({body:e})=>{let n=e.getCollisionFlags();t?n&=~s.CF_NO_CONTACT_RESPONSE:n|=s.CF_NO_CONTACT_RESPONSE,e.setCollisionFlags(n)}),"setTangible is only supported by Ammo.")}function v(e,t,n,s){return n??(n=1),s??(s=4294967295),b(e,(({ammo:e,body:i})=>{const o=e.castObject(i,e.btCollisionObject);if(o.data=t,void 0!==n||void 0!==s){const e=o.getBroadphaseHandle();void 0!==n&&e.set_m_collisionFilterGroup(n),void 0!==s&&e.set_m_collisionFilterMask(s)}return()=>{delete o.data}}))}function w(e,t){b(e,(({ammo:e,body:n})=>{const s=new e.btVector3(0,0,0);n.getCollisionShape().calculateLocalInertia(t,s),n.setMassProps(t,s)}))}const x=new class{constructor(){this.defaultRef="A"}from(e){return this.manifold=e,this.defaultRef="A",this}*getPoints(e){(0,o.cW)(this.manifold);const t=(0,o.vD)(this.manifold.getNumContacts(),0),n="A"===(e??this.defaultRef);for(let e=0;e!t.in(e))))}else u.Vp.addTo(c,...t?.collidesWith??v??w);const l=(0,u.tY)(n,...w);(0,o.BF)(0!==l,`${n.name}'s tags: ${(0,a.bn)((0,u.Fk)(n))}\ndo not intersect with allCollisionTags: ${(0,a.bn)(w)}\nand therefore won't collide.`);const d=(0,u.tY)(c,...w);let f=0;(function(...e){const t=[],n=[...e];for(let e=0;e{f+=1;const i={node:e,collider:s,onStart:t?.onCollisionStart,onEnd:t?.onCollisionEnd};s.physicsImpostor.data=i;const o=(0,h.xY)(s,i,l,d);o&&n.onDisposeObservable.addOnce(o)})),(0,o.vD)(f,0)}const S=c.UH.of(5*-9.81,c.lf);let _;function k(e,t,n){e.name=`${e.name}.μ`,e.material=_,e.isVisible=l.cG.showColliders;const s=n.isTangible??!0;var o,r;o=e,r=new i.Q03(e,t,s?{mass:n?.mass?.value??0,restitution:n?.restitution??0,friction:n?.friction??.5}:{mass:0},n.scene),o.physicsImpostor=r;const a=n.children??[];a.length&&(0,u.ai)(a[0],e);for(const t of a)n.offset&&(t.position=n.offset.scale({factor:-1}).value().addInPlace(t.position)),t.setParent(e);s||(0,h.Sq)(e,!1),n.offset&&(e.position=n.offset.value()),n.parent&&(a.length||(0,u.ai)(n.parent,e),e.setParent(n.parent));const c=n.position;c&&(e.position=new i.Pa4(c.x,c.y,c.z));const d=n.rotation;return d&&e.addRotation(d.x,d.y,d.z),(c||d)&&e.computeWorldMatrix(),e}function C(e){return c.UH.of(e.physicsImpostor.mass,c.ON)}function T(e,t){(0,h.ur)(e,t.value)}function $(e){return k(i.VO7.CreateBox(e.name??"box",{width:e.size.x.value,height:e.size.y.value,depth:e.size.z.value},e.scene),i.Q03.BoxImpostor,e)}function E(e){return k(i.VO7.CreateSphere(e.name??"sphere",{diameter:e.diameter.value},e.scene),i.Q03.SphereImpostor,e)}function O(e){const t=i.VO7.CreateCylinder(e.name??"cylinder",{height:e.height.value,diameter:e.diameter.value},e.scene);return"x"===e?.axis?t.rotationQuaternion=i._fP.FromLookDirectionLH(i.Pa4.Up(),i.Pa4.Right()):"z"===e?.axis&&(t.rotationQuaternion=i._fP.FromLookDirectionLH(i.Pa4.Up(),i.Pa4.Backward())),k(t,i.Q03.CylinderImpostor,e)}function M(e){return k(i.VO7.CreateCapsule(e.name??"capsule",{height:e.height.value,radius:e.diameter.value/2,...e.orientation?{orientation:e.orientation}:{}},e.scene),i.Q03.CapsuleImpostor,e)}function A(e,t){const n=e.physicsImpostor,s=t.physicsImpostor,i=n.friction*s.friction,o=n.mass*e.getScene().gravity.y;return c.UH.of(Math.abs(o*i),c.R2)}function P(e,t,n,s){let o=n;o.unit.label===c.lf.label&&(o=C(e).times(o)),s?.asImpulseOverTime&&(o=o.times(s.asImpulseOverTime));const r=t.normalizeToNew().scale(o.value),l=s?.offsetFromCenterOfMass?.value()??i.Pa4.ZeroReadOnly,u=e.getAbsolutePosition().add(l);void 0!==s?.debug&&(0,a.cM)("applyForce",{label:s?.debug,velocity:(0,f.J)(e),force:r}),o.unit.label===c.ew.label?e.physicsImpostor.applyImpulse(r,u):e.physicsImpostor.applyForce(r,u)}class I extends d._z{constructor(e){super(e),this.scene=e,this.collisions=new Map,this.cycle=0,this.onNotify(e.onAfterPhysicsObservable,(()=>this.checkCollisions())),this.onDispose((()=>this.collisions.clear()))}dispatch(e,t,n,s){const i=`${t.collider.uniqueId}.${n.collider.uniqueId}`,o=this.collisions.get(i);o?.lastSeen===e-1?o.lastSeen=e:(t.onStart?.({self:t,target:n,contact:s})??1)&&(o?o.lastSeen=e:this.collisions.set(i,{primary:t,secondary:n,lastSeen:e}))}checkCollisions(){const e=this.cycle,t=++this.cycle;(0,h.Pb)(this.scene,((e,n,s)=>{(e.onStart||e.onEnd)&&this.dispatch(t,e,n,s),(n.onStart||n.onEnd)&&(s.defaultRef="B",this.dispatch(t,n,e,s))}));for(const[n,s]of this.collisions.entries())s.lastSeen===e&&(s.primary.onEnd?.({self:s.primary,target:s.secondary}),s.lastSeen+60{for(const n of e.meshes)n.material===_&&(n.isVisible=t)})),new I(e),s}},"../../babs/core/lib/render/cameras.js":function(e,t,n){"use strict";n.d(t,{P:function(){return c},v:function(){return a}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/identity.js");const o=Object.freeze(s._fP.RotationAxis(s.RDh.X,0)),r=Object.freeze(s.Pa4.One());class a extends s.V1s{constructor(e,t,n,i){super(e,t.clone(),n,i),this.rotationQuaternion_=o.clone(),this.rotation_=this.rotationQuaternion_.toEulerAngles(),this.viewMatrix_=s.y3G.Zero(),this.rotationDirty_=!1}get rotationQuaternion(){return this.rotationQuaternion_}set rotationQuaternion(e){this.rotationQuaternion_.copyFrom(e),this.rotationDirty_=!0}set rotation(e){this.rotation_.copyFrom(e),s._fP.RotationYawPitchRollToRef(this.rotation_.y,this.rotation_.x,this.rotation_.z,this.rotationQuaternion_),this.rotationDirty_=!1}get rotation(){return this.rotationDirty_&&(this.rotationQuaternion_.toEulerAnglesToRef(this.rotation_),this.rotationDirty_=!1),this.rotation_}_initCache(){super._initCache(),this._cache.rotationQuaternion=new s._fP(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)}_updateCache(e){e||super._updateCache(),this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion_)}_isSynchronizedViewMatrix(){return!!super._isSynchronizedViewMatrix()&&this.rotationQuaternion_.equals(this._cache.rotationQuaternion)}_getViewMatrix(){if(s.RDh.Y.rotateByQuaternionToRef(this.rotationQuaternion_,this.upVector),s.y3G.ComposeToRef(r,this.rotationQuaternion_,this.position,this.viewMatrix_),this.parent){const e=this.parent.getWorldMatrix();this.viewMatrix_.multiplyToRef(e,this.viewMatrix_),this.viewMatrix_.getTranslationToRef(this._globalPosition),this.viewMatrix_.invert(),this._markSyncedWithParent()}else this._globalPosition.copyFrom(this.position),this.viewMatrix_.invert();return this.viewMatrix_}getClassName(){return"DirectionalCamera"}}const c=(0,i.Pn)()({full:4/3,wide:16/9,ultraWide:64/27,superUltraWide:32/9})},"../../babs/core/lib/render/constants.js":function(e,t,n){"use strict";n.d(t,{K2:function(){return a},Of:function(){return u},Yt:function(){return s},vP:function(){return l}});var s,i=n("../../../node_modules/@babylonjs/core/index.js"),o=n("../../babs/core/lib/common/membership.js"),r=n("../../babs/core/lib/common/nodes.js");!function(e){e.prePass=0,e.opaque=1,e.other=2,e.meshDefault=e.opaque}(s||(s={}));const a=new o.Vp("Visible");let c=[a];function l(e){const t=(0,o.tY)(e,...c);(0,r.$U)(e,(e=>e.layerMask=t),{applyToRoot:!0,type:i.x23})}function u(e,...t){const n={};o.Vp.addTo(n,...t);const s=(0,o.tY)(n,...c);e.includeOnlyWithLayerMask=s}},"../../babs/core/lib/render/meshes.js":function(e,t,n){"use strict";n.d(t,{Dh:function(){return f},Tv:function(){return S},Y5:function(){return w},Yw:function(){return p},du:function(){return _},iK:function(){return x},yD:function(){return b},zS:function(){return m}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=(n("../../common/lib/check.js"),n("../../common/lib/core.js"),n("../../common/lib/identity.js")),o=n("../../common/lib/units.js"),r=(n("../../babs/core/lib/common/asset_manager.js"),n("../../babs/core/lib/common/debug_flags.js")),a=n("../../babs/core/lib/common/membership.js"),c=n("../../babs/core/lib/common/nodes.js"),l=n("../../babs/core/lib/common/resource.js"),u=n("../../babs/core/lib/common/units.js"),d=n("../../babs/core/lib/physics/physics.js"),h=n("../../babs/core/lib/render/constants.js");function f(e,t){const n=(0,c.pf)((0,i.V9)(s.x23,t),e);return n.length?n[0]:void 0}function m(e,t,n){if(void 0!==n){const t=function(e,t){const n=(0,c.Ol)((0,i.V9)(s.x23,t),e);return n.length?n[0]:void 0}(e,n);if(!t)return;e=t}if(!e.skeleton)return;const o=e.skeleton.getBoneIndexByName(t);return 0!==o?{mesh:e,bone:e.skeleton.bones[o]}:void 0}function p(e,t){if(t??1){const t=e.getHierarchyBoundingVectors();return{size:u.f.of(t.max.subtract(t.min),o.J4),center:u.w.of(s.Pa4.Center(t.min,t.max),o.J4),minimum:u.w.of(t.min,o.J4),maximum:u.w.of(t.max,o.J4)}}{const t=e.getBoundingInfo();return{size:u.f.of(t.boundingBox.extendSizeWorld,o.J4),center:u.w.of(t.boundingBox.centerWorld,o.J4),minimum:u.w.of(t.boundingBox.minimumWorld,o.J4),maximum:u.w.of(t.boundingBox.maximumWorld,o.J4)}}}function b(e){(0,c.$U)(e,(t=>(0,a.ai)(e,t)))}let g,y,v=0;function w(){return v++}function x(e,t){const n=e.createInstance(t);n.isVisible=e.isVisible,n.layerMask=e.layerMask;for(const t of(0,c.G)(s.Kj0,e)){const e=t.createInstance(t.name);e.isVisible=t.isVisible,e.layerMask=t.layerMask,e.parent=n}return n}let j=s.Wot.Green();function S(e,t){const n=g?.isEnabled??!1,i=t?.enable??!0,o=t?.color??j;if(n)for(const t of(0,c.go)(s.Kj0,e))r.cG.showColliders===(0,d.th)(t)&&(i?g?.addMesh(t,o):g?.removeMesh(t));else y&&(i?y.set(e,o.clone()):y.delete(e))}function _(e,t,n){y=new Map,r.Mz.enableHighlightLayer.onChanged((0,l.U6)(e),(i=>{g||(g=new s.H1p("highlights",e,{renderingGroupId:h.Yt.opaque,camera:t}),g.innerGlow=!1,n&&(j=n)),g.isEnabled=i,g.isEnabled&&(y?.forEach(((e,t)=>S(t,{enable:!0,color:e}))),y?.clear())}),{immediate:!0})}},"../../babs/core/lib/render/scene_asset.js":function(e,t,n){"use strict";n.d(t,{A:function(){return d}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/check.js"),o=n("../../common/lib/identity.js"),r=n("../../babs/core/lib/common/asset.js"),a=n("../../babs/core/lib/common/asset_manager.js"),c=n("../../babs/core/lib/common/membership.js"),l=n("../../babs/core/lib/render/meshes.js"),u=n("../../babs/core/lib/render/shadows.js");class d extends r.x{constructor(e,t,n,s){var i;super(e,t,n),this.options=s??{},(i=this.options).animations??(i.animations={}),this.onDispose((()=>{delete this.scene_}))}clone(e){(0,i.cW)(this.scene_);const t=(0,l.Y5)(),n=this.scene_.instantiateModelsToScene((n=>(0,a.NS)(n,e?.baseName,t))),r=(0,i.$1)(n.rootNodes[0],(0,o.V9)(s.x23)),d=(0,o.I2)(n.animationGroups.map((e=>[e.name,e]))),h=(0,o.Yl)((0,i.ro)(this.options.animations),((n,s)=>{const o=(0,a.NS)((0,a.bk)(this.name,s),e?.baseName,t);return(0,i.ro)(d[o])}));if(e?.animationScope)for(const t of n.animationGroups)e.animationScope.acquire(t);return(0,l.yD)(r),this.options.tags&&c.Vp.addTo(r,...this.options.tags),(0,u.nc)(r.getScene(),r),{mesh:r,animations:h}}share(){(0,i.cW)(this.scene_),this.scene_.addAllToScene();const e=this.scene_.meshes[0],t=(0,o.I2)(this.scene_.animationGroups.map((e=>[e.name,e])));return{mesh:e,animations:(0,o.Yl)((0,i.ro)(this.options.animations),((e,n)=>{const s=(0,a.bk)(this.name,n);return(0,i.ro)(t[s])}))}}setScene(e){this.scene_=e}}},"../../babs/core/lib/render/shadows.js":function(e,t,n){"use strict";n.d(t,{Gh:function(){return u},Rz:function(){return d},a$:function(){return h},nc:function(){return f},tM:function(){return l},u8:function(){return c}});var s=n("../../../node_modules/@babylonjs/core/index.js"),i=n("../../common/lib/identity.js"),o=n("../../babs/core/lib/common/membership.js"),r=n("../../babs/core/lib/common/nodes.js"),a=n("../../babs/core/lib/common/resource.js");function c(e,t){const n=(0,a.V2)(e);n.shadows??(n.shadows=[]),n.shadows.push(t)}function l(e){return(0,a.V2)(e).shadows}function u(e,t){let n;if((0,i.$O)(t,s.Ox3)){const e=new s.RSz(1024,t);e.stabilizeCascades=!0,n=e}else n=new s.uXA(1024,t);n.forceBackFacesOnly=!0,n.transparencyShadow=!0,c(e,n)}const d=new o.Vp("ShadowCaster"),h=new o.Vp("ShadowReceiver");function f(e,...t){const n=l(e);if(n)for(const e of(0,r.go)(s.x23,...t))d.in(e)&&n.forEach((t=>t.addShadowCaster(e))),h.in(e)&&(e.receiveShadows=!0)}},"../../babs/core/lib/render/texture_asset.js":function(e,t,n){"use strict";n.d(t,{X:function(){return o}});var s=n("../../common/lib/check.js"),i=n("../../babs/core/lib/common/asset.js");class o extends i.x{constructor(e,t,n){super(e,t,n),this.onDispose((()=>{delete this.texture_}))}share(){return(0,s.ro)(this.texture_)}clone(){return(0,s.ro)(this.texture_).clone()}setTexture(e){this.texture_=e}}},"../../common/lib/check.js":function(e,t,n){"use strict";n.d(t,{$1:function(){return c},BF:function(){return s.BF},EQ:function(){return a},M1:function(){return l},Yg:function(){return u},cW:function(){return s.cW},iY:function(){return h},ro:function(){return s.ro},vD:function(){return d}});var s=n("../../common/lib/core.js"),i=n("../../common/lib/errors.js"),o=(n("../../common/lib/identity.js"),n("../../common/lib/logging.js"));class r extends i.sH{constructor(){super("Not implemented")}}function a(){throw console.error("Not implemented"),new r}function c(e,t,...n){return(0,s.BF)(t(e),`checkType(value: ${(0,o.Qv)(e)})`,...n),e}function l(e,t,...n){return e!==t?(0,s.Xr)(`checkEqual ${(0,o.bn)(e)} !== ${(0,o.bn)(t)}`,...n):e}function u(e,t,...n){return e===t?(0,s.Xr)(`checkNotEqual ${e} === ${t}`,...n):e}function d(e,t,...n){return e<=t?(0,s.Xr)(`checkGt ${e} <= ${t}`,...n):e}function h(e,t,...n){return function(e,t,n,...i){return en?(0,s.Xr)(`checkRange ${t} <= ${e} <= ${n}`,...i):e}(e,0,t.length-1,...n)}},"../../common/lib/containers.js":function(e,t,n){"use strict";n.d(t,{Od:function(){return r},WQ:function(){return a},_2:function(){return o},tj:function(){return i}});var s=n("../../common/lib/identity.js");function i(e,t,n){let s=e.get(t);return void 0===s&&(s=n(),e.set(t,s)),s}function o(e,t){return(0,s.kJ)(e)?e:void 0!==e?[e]:t}function r(e,t){const n=e.indexOf(t);if(n<0)return!1;const s=e.pop();return nn+t))}},"../../common/lib/core.js":function(e,t,n){"use strict";n.d(t,{A4:function(){return l},BF:function(){return a},Xr:function(){return r},Zo:function(){return d},cW:function(){return u},ro:function(){return c}});var s=n("../../common/lib/errors.js"),i=n("../../common/lib/env.js");class o extends s.sH{}function r(e,...t){const n=[e,...t].map((e=>"string"==typeof e?e:e()));throw i.P||console.info("die with error:",...n),new o(n.join(" "))}function a(e,...t){e||r("check failed.",...t)}function c(e,...t){return void 0===e&&r("checkDefined",...t),e}function l(e,...t){return null==e&&r("checkNonNull",...t),e}function u(e,...t){void 0===e&&r("assertIsDefined",...t)}function d(e){e instanceof Error||r("assertIsError",(()=>`${e}`))}},"../../common/lib/disposable.js":function(e,t,n){"use strict";n.d(t,{v:function(){return l}});var s,i,o,r=n("../../common/lib/check.js"),a=function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},c=function(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n};class l{constructor(){a(l,s,"f",i)?.add(this)}static startTracking(e){c(this,s,e,"f",o),c(this,s,new Set,"f",i)}static stopTracking(){c(this,s,void 0,"f",i)}static snapshot(){return(0,r.cW)(a(this,s,"f",i),"You must call Tracked.startTracking() to begin tracking."),Array.from(a(this,s,"f",i).values())}static get label(){return a(this,s,"f",o)??""}dispose(){return a(l,s,"f",i)?.delete(this),"You must call super.dispose() when overriding Tracked.dispose."}}s=l,i={value:void 0},o={value:void 0}},"../../common/lib/env.js":function(e,t,n){"use strict";n.d(t,{P:function(){return s}});const s=!0},"../../common/lib/errors.js":function(e,t,n){"use strict";n.d(t,{f_:function(){return o},sH:function(){return s}});class s extends Error{constructor(e,t){super(e),this.args=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}}const i=Symbol("Error.cohort");function o(e,t){const n=[];for(const s of e)try{t(s)}catch(e){if(!(e instanceof Error))throw e;n.push(e)}if(n.length){const e=n[0];throw n.length>1&&function(e,...t){e[i]??(e[i]=[]),e[i].push(...t)}(e,...n.slice(1)),e}}},"../../common/lib/identity.js":function(e,t,n){"use strict";n.d(t,{fS:function(){return O},Vl:function(){return T},yR:function(){return k},lG:function(){return x},kJ:function(){return d},jn:function(){return a},$K:function(){return o},mf:function(){return u},$O:function(){return m},V9:function(){return p},hj:function(){return c},Kn:function(){return h},EN:function(){return r},Bv:function(){return f},HD:function(){return l},uc:function(){return E},Yl:function(){return j},QK:function(){return S},I2:function(){return w},Pn:function(){return v},SC:function(){return y},AL:function(){return $}});var s=n("../../common/lib/core.js"),i=n("../../common/lib/errors.js");function o(e){return void 0!==e}function r(e){return null!=e}function a(e){return"boolean"==typeof e}function c(e){return"number"==typeof e}function l(e){return"string"==typeof e}function u(e){return"function"==typeof e}const d=Array.isArray;function h(e){return"object"==typeof e&&null!==e}function f(e){return e}function m(e,t){return e instanceof t}function p(e,t){return n=>n instanceof e&&(t?.(n)??!0)}function b(...e){return e.reduce(((e,t)=>(Object.entries(t).forEach((([t,n])=>{if(void 0!==n){const s=e[t];d(n)?e[t]=n:h(n)&&h(s)?e[t]=b(s,n):e[t]=n}})),e)),{})}class g{constructor(e){this.defaults=e}apply(e){return Object.freeze(b(this.defaults,e))}}function y(){return{withDefaults(e){return new g(e)}}}function v(){return e=>Object.freeze(e)}function w(e){return Object.fromEntries(e)}function x(e){return function(e){const t=w(function(e,t=!1){return(t?Reflect.ownKeys:Object.keys)(e).map((t=>[t,e[t]]))}(e).map((([e,t])=>[t,e])));return Object.freeze({forward:Object.freeze(e),reverse:Object.freeze(t)})}(e)}function j(e,t){return Object.fromEntries(Object.entries(e).map((([e,n])=>[e,t(n,e)])))}function S(e,t){return function(e,t){return Object.defineProperties({},j(e,t))}(e,((e,n)=>({get:t(e,n)})))}class _ extends i.sH{}function k(e){return e}function C(e){const t=[];for(;h(e)&&e!==Object.prototype;)t.push(e),e=Reflect.getPrototypeOf(e);return t}function T(e){return e}function $(e,t,n){let i=function(e,t){for(const n of C(e)){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return{descriptor:e,prototype:n}}}(e,t);void 0===i&&((0,s.BF)(!0===n.allowUndefined,`The object does not have property ${String(t)}. If the property can be undefined, set allowUndefined.`),i={descriptor:{configurable:!0,value:void 0},prototype:e},Object.defineProperty(i.prototype,t,i.descriptor));const o=i.descriptor,r={get:()=>n.get(o.get?o.get.call(e):o.value),set:t=>(t=>o.set?o.set.call(e,t):o.value=t)(n.set(t))};Object.defineProperty(i.prototype,t,r);const a=i.prototype;return()=>{Object.defineProperty(a,t,o)}}function E(e,t){const n=t?.includePrototypes??!1,s=t?.includeInternal??!1,i=t?.prioritizedKeys??[],o=t?.filterTypes??["attribute"],r=[];s||r.push((e=>!e.startsWith("__"))),o.length&&r.push((t=>o.includes(function(e,t){let n=!0;for(const s of C(e)){const e=Object.getOwnPropertyDescriptor(s,t);if(e)return e.get||e.set?"accessor":n?"attribute":"method";n=!1}}(e,t)))),i.length&&r.push((e=>!i.includes(e)));const a=(n?C(e):[e]).map((e=>function(e){return Reflect.ownKeys(e)}(e).filter((e=>l(e)&&r.every((t=>t(e)))))));var c;return a.unshift(i.filter((c=e,e=>e in c))),a.flat()}function O(e,t,n=!1){return e===t||(h(e)&&h(t)&&e.constructor===t.constructor?e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():Object.keys(e).every((s=>s in t&&(n?e[s]===t[s]:O(e[s],t[s]))))&&Object.keys(t).every((t=>t in e)):"number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t))}Symbol("ReadOnlyProxy")},"../../common/lib/iterators.js":function(e,t,n){"use strict";function s(e,t){let n=0;for(const s of e)t(s,n++)}function*i(e,t=0){for(let n=t;n{(0,i.Zo)(t),console.warn(e??"Unexpected error.",t.message,t)}}function h(e){return(0,o.Kn)(e)?e.constructor.name:typeof e}var f;function m(e){let t=`${e.delims[0]} /*`;return void 0!==e.index&&(t+=` ${e.ref?"@":"#"}${e.index}`),void 0!==e.label&&(t+=` ${e.label}`),t+=" */",e.ref&&(t+=` ${e.delims[1]}`),t}!function(e){e[e.Stringify=0]="Stringify",e[e.Custom=1]="Custom"}(f||(f={}));const p=[EventTarget],b=new Array([window,"window"],[document,"document"]).map((([e,t])=>[e,m({delims:"{}",label:t,ref:!0})]));function g(...e){p.push(...e)}function y(e,t={},n){let s;if(t.impl===f.Stringify)s=JSON.stringify(e,void 0,2)??"undefined";else if(void 0===e)s="undefined";else if(null===e)s="null";else if("function"==typeof e)s="function";else if("object"==typeof e){const i=(0,o.kJ)(e),r=i?"[]":"{}";n??(n=new Map(b));const a=n.size-b.length,c=e.constructor?.name;s=m({delims:r,index:a,label:c,ref:!1}),n.set(e,m({delims:r,index:a,label:c,ref:!0}));const l=t.indent??"",u=l+" ";let d;d=i?e:p.some((t=>e instanceof t))?[]:(0,o.uc)(e,t);let h=0;for(const o of d){let r;if(!i&&"symbol"==typeof o&&!t.showSymbolKeys)continue;const a=i?o:e[o];if(r=n.get(a),void 0===r)if(r=y(a,{...t,indent:u},n),i);else if("undefined"===r&&!t.showUndefinedProperties)continue;if(++h>50){s+=`\n${u}…`;break}s+=i?`\n${u}${r}`:`\n${u}${String(o)}: ${r}`}s+=0===h?` ${r[1]}`:`\n${l}${r[1]}`}else s="string"==typeof e?`"${e}"`:"symbol"==typeof e?`${String(e)}`:`${e}`;const i=t.maxTotalLength??10024;return s.length<=i?s:"{"===s[0]?`${s.substr(0,i-2)}…}`:`${s.substr(0,i-1)}…`}function v(e,t=2){return Number(e.toFixed(t)).toString()}var w;!function(e){e[e.Call=0]="Call",e[e.Return=1]="Return",e[e.Both=2]="Both"}(w||(w={}));const x=/\/([^/]+)\)/,j=(new class{constructor(){this.map=new Map}set(e,t){return this.map.set(e,t),this}format(e){return this.map.get(e.constructor)?.(e)}}).set(r.UH,(e=>[`%c${v(e.quantity,2)}%c${e.unit.label}`,u.number,u.subtle]));function S(e,t){j.set(e,t)}function _(e,t=0,n=5){if((0,o.kJ)(e)){if(t>0){const s=[],i=[];for(const o of e){if(n<=0){s.push("%c,…}"),i.push(u.subtle);break}const[e,...r]=_(o,t-1);s.push(e),i.push(u.subtle,...r),n-=1}return[`%c[${s.join("%c, ")}%c]`,...i,u.subtle]}return["%c[…]}",u.subtle]}if((0,o.Kn)(e)){const s=j.format(e);if(s)return s;const i=[],r=[];if(e.constructor!==Object&&(i.push(`%c${e.constructor.name}`),r.push(u.type)),t>0){let s=!0;i.push("%c{"),r.push(u.subtle);for(const a of(0,o.uc)(e,{prioritizedKeys:["id","name"]})){const c=e[a];if(n<=0){i.push("%c, …}"),r.push(u.subtle);break}if(s?s=!1:(i.push(s?"%c{":"%c, "),r.push(u.subtle)),void 0===c)i.push(`%c${String(a)}%c?`),r.push(u.key,u.subtle);else if((0,o.mf)(c))i.push(`%c${String(a)}%c()`),r.push(u.method,u.subtle);else{const[e,...n]=_(c,t-1);i.push(`%c${String(a)}%c: ${e}`),r.push(u.key,u.subtle,...n)}n-=1}i.push("%c}"),r.push(u.subtle)}else i.push("%c{…}"),r.push(u.subtle);return[i.join(""),...r]}return(0,o.mf)(e)?[`%c${e.name}%c()`,u.method,u.subtle]:"number"==typeof e?[`%c${v(e,4)}`,u.number]:"string"==typeof e?e?[`%c${e}`,u.string]:["''"]:["boolean","null","undefined"].includes(typeof e)?[`%c${String(e)}`,u.keyword]:["%o",e]}const k=console.log,C={canSample:()=>!0,didSample:()=>{},skippedSamples:1,log:(e,t,n,...s)=>k(n,...s)};class T{constructor(e){this.lastSample=0,this.lastLog="",this.skippedSamples=0,e.rate?"time"===e.rate.unit.quantity.label?this.minDelay=1e3*e.rate.value:this.minDelay=1e3/e.rate.value:this.minDelay=0,this.omitDuplicates=e.omitDuplicates??!1}static from(e){if(!e?.logId)return(0,s.BF)(void 0===e?.rate&&void 0===e?.omitDuplicates,"logging `rate` and `omitDuplicates` require `logId`"),C;let t=T.stateMap[e.logId];return t||(t=new T(e),T.stateMap[e.logId]=t),t}canSample(){return this.skippedSamples+=1,Date.now()-this.lastSample>=this.minDelay}didSample(){this.skippedSamples=0,this.lastSample=Date.now()}log(e,t,n,...s){if(this.omitDuplicates){const i=[n.slice(e),...s.slice(t)].join("");if(i===this.lastLog)return;this.lastLog=i}this.didSample(),k(n,...s)}}T.stateMap={};const $=(0,o.SC)().withDefaults({density:"inline",defaultStyle:u.default,calleeDepth:2,prettyDepth:2,emitSkips:!0});function E(...e){return e.reduce(((e,t,n)=>{if(0===n)return t;let s=0;for(;s{if("string"==typeof e)return[`%c${e}`,[r]];{const[t,...n]=_(e,a);return[t,n]}}));else{const e=t;l=Object.keys(e).map((t=>{const[n,...s]=_(e[t],a);return[`%c${t}%c:${n}`,[u.highlight,u.subtle,...s]]}))}const d=function(e=1){const t=new Error;if(void 0===t.stack)return;const n=t.stack.split("\n");if(n.length<=e+1)return;const s=n[e+1].match(x);if(!s||s.length<2)return;let[i,o,r]=s[1].split(":");return"?"===i.charAt(i.length-1)&&(i=i.substring(0,i.length-1)),{file:i,line:o,column:r}}(i.calleeDepth);d&&l.push([`%c${d.file}:${d.line}:${d.column}`,[u.callSite]]);const h=[],f=[];let m=0,p=0;if(c>0&&i.emitSkips){const e=`%c${c}%c`;m=e.length+1,h.push(e),p=2,f.push(u.skipCount,r)}if(void 0!==e&&("inline"===i.density?(h.push(`%c${e}%c`),f.push(u.inlineHeader,r)):(h.push(`%c ${e} `.padEnd(80)),f.push(u.groupHeader))),"inline"===i.density)s.log(m,p,E(...h,...l.map((([e])=>e))),...f,...l.flatMap((([e,t])=>t)));else{s.didSample(),"expanded"===i.density?console.group(E(...h),...f):console.groupCollapsed(E(...h),...f);for(const[e,t]of l)k(e,...t);console.groupEnd()}}function M(e,t){t??(t={});const{density:n,defaultStyle:s,calleeDepth:i,prettyDepth:o,logId:a,rate:c,omitDuplicates:l,emitSkips:u,...d}=t;t.logId??(t.logId=Symbol.for(e)),t.rate??(t.rate=r.UH.of(3,r._H)),t.omitDuplicates??(t.omitDuplicates=!0),O(e,d,t)}console.log=console.info=(e,...t)=>O(void 0,[e,...t],{defaultStyle:u.console,calleeDepth:3})},"../../common/lib/math.js":function(e,t,n){"use strict";n.d(t,{Hy:function(){return l},VN:function(){return r},aH:function(){return c},cL:function(){return a},t7:function(){return o},uZ:function(){return i}});var s=n("../../common/lib/units.js");function i(e,t,n){return nn?n:e}function o(e,t,n,s=!0){return s&&(e=i(e,0,1)),t+(n-t)*e}function r(e,t,n,s=!0){let o=(e-t)/(n-t);return s&&(o=i(o,0,1)),o}function a(e,t,n){return Math.abs(t-e)=this.segments.length}addSegment(e,t){this.segments.push({f:e,duration:t})}restart(){this.segmentIndex=0,this.segmentTime=s._H.zero}stop(){this.segmentIndex=this.segments.length,this.segmentTime=s._H.zero}update(e){for(;this.segmentIndex>>18,597399067),n=Math.imul(i^n>>>22,2869860233),s=Math.imul(t^s>>>17,951274213),i=Math.imul(n^i>>>19,2716044179),[(t^n^s^i)>>>0,(n^t)>>>0,(s^t)>>>0,(i^t)>>>0]}(e):"number"==typeof e&&(e=[e]),t??(t=e.length>3?"sfc":"mulberry"),t){case"mulberry":s=e[0],n=()=>{let e=s+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296};break;case"sfc":n=function(e,t,n,s){return()=>{let i=(e>>>=0)+(t>>>=0)|0;return e=t^t>>>9,t=(n>>>=0)+(n<<3)|0,i=i+(s=1+(s>>>=0)|0)|0,n=(n=n<<21|n>>>11)+i|0,(i>>>0)/4294967296}}(e[0],e[1],e[2],e[3])}var s;return{next:n}}function o(e,t=s){return Math.floor(t.next()*e)}function r(e,t,n=s){return n.next()*(t-e)+e}function a(e,t,n=s){const i=Math.ceil(e),o=Math.floor(t);return Math.floor(n.next()*(o-i))+i}function c(e,t=s){const n=e;let i=n.length;for(;0!==i;){const e=Math.floor(t.next()*i);i-=1,[n[i],n[e]]=[n[e],n[i]]}return n}},"../../common/lib/units.js":function(e,t,n){"use strict";n.d(t,{HA:function(){return M},J4:function(){return C},Lm:function(){return B},Lv:function(){return O},ON:function(){return T},P1:function(){return P},R2:function(){return D},TT:function(){return I},T_:function(){return N},UH:function(){return k},XF:function(){return z},_H:function(){return $},ew:function(){return F},gG:function(){return L},lf:function(){return R},wI:function(){return A}});var s,i,o,r,a,c,l,u,d=n("../../common/lib/logging.js");!function(e){e.Dot="⋅",e.One="¹",e.Two="²",e.Neg="⁻",e.NegOne="⁻¹",e.NegTwo="⁻²"}(u||(u={}));class h{constructor(e){this.label=e}toString(){return this.label}}class f extends h{constructor(){super("length"),s.set(this,void 0)}}s=new WeakMap,f.i=new f;class m extends h{constructor(){super("mass"),i.set(this,void 0)}}i=new WeakMap,m.i=new m;class p extends h{constructor(){super("time"),o.set(this,void 0)}}o=new WeakMap,p.i=new p;class b extends h{constructor(){super("rotation"),r.set(this,void 0)}}r=new WeakMap,b.i=new b;class g extends h{constructor(){super("cardinality"),a.set(this,void 0)}}a=new WeakMap,g.i=new g;class y extends h{constructor(){super("ratio"),c.set(this,void 0)}}c=new WeakMap,y.i=new y;class v extends h{constructor(){super("repetitions"),l.set(this,void 0)}}l=new WeakMap,v.i=new v;class w extends h{constructor(e,t,n){super(e),this.numerator=t,this.denominator=n}}class x extends h{constructor(e,t,n){super(e),this.q1=t,this.q2=n}}const j={[`m${u.Dot}s${u.NegOne}${u.Dot}s${u.NegOne}`]:`m${u.Dot}s${u.NegTwo}`,[`kg${u.Dot}m${u.Dot}s${u.NegTwo}`]:"N",[`cyc${u.Dot}s${u.NegOne}`]:"Hz"},S={"length/time":"velocity","velocity/time":"acceleration","mass*acceleration":"force","cycles/time":"frequency"};class _{constructor(e,t,n){this.engineRatio=e,this.label=t,this.quantity=n}static of(e,t,n){return new _(e*t.engineRatio,n,t.quantity)}times(e){const t=this.engineRatio*e.engineRatio;let n=this.label&&e.label?`${this.label}${u.Dot}${e.label}`:this.label?this.label:e.label;for(;n in j;)n=j[n];let s=`${this.quantity.label} * ${e.quantity.label}`;for(;s in S;)s=S[s];return new _(t,n,new x(s,this.quantity,e.quantity))}per(e){const t=this.engineRatio/e.engineRatio;let n=`${this.label}${u.Dot}${e.label}${u.NegOne}`;for(;n in j;)n=j[n];let s=`${this.quantity.label} / ${e.quantity.label}`;for(;s in S;)s=S[s];return new _(t,n,new w(s,this.quantity,e.quantity))}}class k{constructor(e,t){this.quantity=e,this.unit=t}static of(e,t){return new k(e,t)}static from(e,t,n){return e instanceof k?e:k.of(e??t,n)}scale(e){return k.of(this.quantity*e,this.unit)}ratioTo(e){return this.value/e.value}plus(e){return k.of(this.quantity+e.getUnitQuantity(this.unit),this.unit)}minus(e){return k.of(this.quantity-e.getUnitQuantity(this.unit),this.unit)}times(e){return k.of(this.quantity*e.quantity,this.unit.times(e.unit))}per(e){return k.of(this.quantity/e.quantity,this.unit.per(e.unit))}get value(){return this.quantity*this.unit.engineRatio}isEqualTo(e){return this.value===e.value}isCloseTo(e,t){if(this.value===e.value)return!0;const n=e.minus(t),s=e.plus(t);return n.isLessThan(this)&&this.isLessThan(s)}isLessThan(e){return this.value=i)&&Object.keys(o.O).every((function(e){return o.O[e](n[c])}))?n.splice(c--,1):(a=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,s,i]},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=function(e){return Promise.all(Object.keys(o.f).reduce((function(t,n){return o.f[n](e,t),t}),[]))},o.u=function(e){return{46:"scene.ld51-index-ts",338:"scene.template-index-ts",381:"scene.infra-index-ts",782:"scene.demolition-index-ts",868:"scene.unladen-index-ts",893:"scene.roguerally-index-ts",947:"scene.jukebox-index-ts"}[e]+"."+{46:"4a447643b849f26ab97b",338:"43fc4505eac4414eecc7",381:"7dff82a30ac5f68239e4",782:"dd93b0805663f2cf0b15",868:"e409a49a952c78bddb25",893:"a32715e9bda9846e24af",947:"535fcc69331219e798f3"}[e]+".js"},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t={},n="@ld/apps.ludathon:",o.l=function(e,s,i,r){if(t[e])t[e].push(s);else{var a,c;if(void 0!==i)for(var l=document.getElementsByTagName("script"),u=0;u