!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 O(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,O,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 l}});var s=n("../../common/lib/core.js"),i=n("../../common/lib/identity.js"),o=n("../../babs/core/lib/common/asset.js");const r=(0,i.SC)().withDefaults({loop:!1,spatial:!1,autoPlay:!1,volumeFactor:1}),a=(0,i.SC)().withDefaults({play:!1});let c=0;class l extends o.x{constructor(e,t,n,s){super(e,t,n),this.settings=r.apply(s??{}),this.onDispose((()=>delete this.sound_))}share(){return(0,s.ro)(this.sound_)}clone(e,t){const n=a.apply(t??{}),i=(0,s.ro)(this.sound_),o=i.clone();if(!o)return;e.acquire(o);const r=n?.baseName??i.name,l=n?.attachToMesh;return l?(o.attachToMesh(l),o.name=`${l.name}.${r}`):o.name=`${r}.${c++}`,n.play&&o?.play(),o}setSound(e){this.sound_=e,this.sound_.setVolume(this.settings.volumeFactor),this.settings.autoPlay&&this.sound_.play()}}},"../../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/gauge.js"),a=n("../../babs/core/lib/common/asset_manager.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 r.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 a.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){e.fetch(t,((n,i)=>{t.setSound(new s.$uU(t.name,n,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,{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}}},"../../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}`)}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<m.length;++n){if("memory"===e)return p??(p=new h),p;if(f(e))return new d(window[e]);if(!t)throw new c(`Storage medium ${e} is not available.`)}throw new c("No storage medium is available")}("localStorage"),n)}static get(e,t){return e.get(function(e){return t=>(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,{Js:function(){return l},Vp:function(){return o},ai:function(){return r},sU:function(){return u},tY:function(){return a}});var s=n("../../common/lib/check.js"),i=(n("../../common/lib/containers.js"),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}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}}function r(e,...t){e._tags??(e._tags={});const n=e._tags;for(const e of t)e._tags=n}function a(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={};class c{constructor(e){this.mask=e}addTo(...e){e.forEach((e=>e.layerMask|=this.mask))}removeFrom(...e){e.forEach((e=>e.layerMask&=this.mask))}replaceOn(...e){e.forEach((e=>e.layerMask=this.mask))}equals(e,t){return t??(t=c.Full),(e.layerMask&t.mask)===this.mask}matches(e){return(e.layerMask&this.mask)===this.mask}allIn(e){return this.matches(e)}someIn(e){return 0!=(e.layerMask&this.mask)}noneIn(e){return 0==(e.layerMask&this.mask)}}c.Empty=Object.freeze(new c(0)),c.Full=Object.freeze(new c(-1));const l=Object.freeze({layerMask:c.Empty.mask});Object.freeze({layerMask:c.Full.mask});class u extends c{constructor(e){const t=(0,s.r0)(u.nextBitIndex++,31);super(1<<t),this.name=e,this.index=t,(0,i.cM)("Bit",{name:e,index:this.index,mask:(0,i.kQ)(this.mask)}),Object.freeze(this)}}u.nextBitIndex=0},"../../babs/core/lib/common/nodes.js":function(e,t,n){"use strict";n.d(t,{$U:function(){return c},G:function(){return d},Ky:function(){return r},Ol:function(){return u},go: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 function(e,...t){return t.flatMap((t=>[...e(t)?[t]:[],...t.getDescendants(!1,e)]))}((0,o.V9)(e),...t)}function u(e,...t){return t.flatMap((t=>t.getDescendants(!0,e)))}function d(e,...t){return u((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 $},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 $?O(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,$)?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 O(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 $ extends _{constructor(e,t){void 0===t&&(0,g.$O)(e,s.NBX)&&(t=e.name),super(t),O(this,e)}static update(e){x($,c,"f",l).forEach((t=>t(e)))}onUpdate(e){"full"===this[j].disposalState||"disposed"===this[j].disposalState||(e?x($,c,"f",l).set(this,e):x($,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($,c,"f",l).delete(this),this[j].disposalState="disposed",Object.freeze(this),!0)}}c=$,l={value:new Map};class E extends ${static from(e){return e.metadata?.scope??new E(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:E.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 ${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 oe},TO:function(){return ie},XT:function(){return de},dA:function(){return he}});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"),O=(n("../../babs/core/lib/audio/audio_manager.js"),n("../../common/lib/containers.js")),$=n("../../babs/core/lib/gui/table.js"),E=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?$.I.content:$.I.disabled,t[2].style=!0===e.value?n.styles.bold:n.styles.normal,t[2].color=$.I.highlight}var A=n("../../babs/core/lib/input/keys.js");n("../../babs/core/lib/input/mouse.js");const P=["ShiftLeft","ShiftRight"],I=["ControlLeft","ControlRight"],R=["MetaLeft","MetaRight"],D=["AltLeft","AltRight"];class F{constructor(){this.onKeysChanged=new s.y$z,this.onStateChanged=new s.y$z,this.keyBindings=new Map}track(e){const t=(0,O.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(t){if(a){if(i&&!o.priority)break;n?r=!0:o.signal.activate()&&(r=!0,this.cancelModifiers(o.config))}}else(n||o.signal.deactivate())&&(r=!0);!n&&r&&this.signalStateChange(o),s||(s=r),i||(i=r&&o.priority)}return s}cancelModifiers(e){const t=[];e.wantShift&&!P.includes(e.code)&&t.push(...P),e.wantCtrl&&!I.includes(e.code)&&t.push(...I),e.wantMeta&&!R.includes(e.code)&&t.push(...R),e.wantAlt&&!D.includes(e.code)&&t.push(...D),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 z extends l.me{constructor(e){super(e,_.II),this.tracker=new F}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=function(e,t){const n=(0,$.W)(e,"table",{columnRatios:[.6,.2,.2]}),s=(0,E.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(s.name);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(),e.onNotify(t.onStateChanged,(t=>{if("boolean"==typeof t.value){const s=n.get(t.name);s[2].text=`${t.value}`,M(t,s,e)}else i.scheduler()})),s}(e.display,this.tracker);e.display.add(t,!1),d.Mz.showKeymap.onChanged(e.display,(n=>e.display.show(t,n)),{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 A.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="MousePrimary";break;case 1:n="MouseTertiary";break;case 2:n="MouseSecondary";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 A.xw(n,t);return d.cG.showKeyEvents&&(0,r.cM)("onMouseEvent",{key:`${o.toString()}`,isDown:i,event:t}),this.tracker.onEvent(o,i,!1)}onFocus(e){d.cG.showKeyEvents&&(0,r.cM)("onFocus",{type:e.type,event:e}),this.tracker.cancelKeySignals()}}z.I=new z(v.fi);var N=n("../../babs/core/lib/common/asset.js");class L extends N.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 B extends l.me{constructor(e){super(e,L)}onProcess(e,t){e.fetchImage(t,(e=>{t.setImage(e)}))}}new B(v.fi),n("../../../node_modules/@babylonjs/loaders/glTF/index.d.ts"),n("../../../node_modules/@babylonjs/loaders/OBJ/index.d.ts");var V=n("../../babs/core/lib/common/nodes.js"),H=n("../../babs/core/lib/render/scene_asset.js");class W extends l.me{constructor(e){super(e,H.A)}onProcess(e,t){const n=t.options?.enablePhysicalLighting??!1;e.fetchScene(t,(e=>{const i=t.options?.scale;for(const t of(0,V.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 G extends l.me{constructor(e){super(e,U.X)}onProcess(e,t){e.fetchTexture(t,(e=>{t.setTexture(e)}))}}new G(v.fi);var q,K,Q,X,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)},Y=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 ee=[C.K2],te=[C.K2];let ne;const se=new g(v.fi,"FovMode",{range:["expand","crop","horizontal","vertical"],defaultValue:"expand",persist:!0});_.II.register(v.fi,"next FovMode",{keys:"Alt+KeyV",valued:se}).onClick(v.fi,(()=>se.next()));const ie=new h.W(v.fi,"CanvasAR",{defaultValue:void 0}),oe=new h.W(v.fi,"CameraAR",{defaultValue:void 0}),re=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:re}).onClick(v.fi,(()=>re.next()));const ae=_.II.register(v.fi,"_freeLookInput",{keys:["W","A","S","D","ArrowUp","ArrowLeft","ArrowDown","ArrowRight"],priority:!0}),ce=(0,_.Qw)(v.fi,"Reset scene","Alt+Backspace");function le(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 ue(e){let t=e.activeCamera;return!t&&e.activeCameras&&e.activeCameras.length&&(t=e.activeCameras[0]),t??void 0}const de=new y(v.fi,"CurrentApp",{persist:!0});class he{constructor(e,t,n){this.params=e,this.loadScope=t,this.defaultApp=n,q.set(this,void 0),K.set(this,[]),Q.set(this,!1),X.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:he.Paused.value},{density:"collapsed"}),this.engine=new s.D4V(this.params.canvas,!1,{adaptToDeviceRatio:!0,stencil:!0})}async loadApp(e){if(Z(this,Q,"f"))return console.log(`Deferring load of ${e}`),void Y(this,X,e,"f");Y(this,Q,!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),Y(this,Q,!1,"f"),void 0!==Z(this,X,"f")&&(e=Z(this,X,"f"),Y(this,X,void 0,"f"),setTimeout((()=>{console.log(`Resuming load of ${e}`),this.loadApp(e)})))}async start(){o.P||(document.title=`<DEV> ${document.title} <DEV>`,document.body.style.backgroundColor="#252526"),window.addEventListener("resize",(()=>{this.maxWidth=this.maxHeight=void 0,this.updateFoV()})),se.onChanged(v.fi,(()=>this.updateFoV())),ie.onChanged(v.fi,(()=>this.updateFoV())),oe.onChanged(v.fi,(()=>this.updateFoV())),re.onChanged(v.fi,(()=>this.updateFoV())),window.addEventListener("deviceorientation",(()=>this.updateOrientation(window.screen.orientation))),this.updateOrientation(window.screen.orientation),he.Paused.onChanged(v.fi,(e=>{(0,r.cM)(e?"Paused.":"Resumed."),Z(this,K,"f").forEach((t=>le(t.scene,e)))})),d.Mz.freeLook.onChanged(v.fi,(e=>{this.freeLook(e),he.Paused.value=e})),ce.onEnabled(v.fi,(()=>{de.value=void 0,this.loadApp(this.defaultApp)}));const e=await this.initializeGlobalScope();this.engine.runRenderLoop((()=>{const t=he.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<Z(this,K,"f").length;++e){const s=Z(this,K,"f")[e];s.scene.isDisposed||(s.scene.render(!0,t),Z(this,K,"f")[n++]=s)}Z(this,K,"f").length=n,e.autoClear=0===Z(this,K,"f").length,e.render()}))}onNextLoop(e){Z(this,J,"f").push(e)}freeLook(e){if((0,r.cM)("freeLook",{enabled:e}),this.restoreFreeLook?.(),delete this.restoreFreeLook,!e)return;if(!Z(this,K,"f").length)return void console.warn("No active scope");const t=Z(this,K,"f")[Z(this,K,"f").length-1].scene,n=ue(t);if(!n)return void console.warn("No active camera");const i=new s.xcu("FreeLook",n.position.clone(),t);i.rotationQuaternion=n.absoluteRotation.clone(),i.fov=n.fov,i.fovMode=n.fovMode,ae.onClick(new v._z(i),(()=>{})),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&&(ne?ne.setTarget(e.pickInfo.pickedMesh.absolutePosition):(ne=new s.YfP("ArcRotate",Math.PI/3,Math.PI/3,10,e.pickInfo.pickedMesh.absolutePosition,t),ne.zoomToMouseLocation=!0,ne.attachControl(),t.activeCamera=ne))}(e,t)));this.restoreFreeLook=()=>{n.isDisposed()||(t.activeCamera=n),i.dispose(),t.onPointerObservable.remove(o),ne&&(ne.dispose(),ne=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(),Y(this,q,{scope:v.fi,scene:e},"f"),o.P||(Z(this,q,"f").diff=new x(Z(this,q,"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,K,"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);he.Paused.value&&le(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,...ee),(0,C.vP)(e))})),n.onNewCameraAddedObservable.add((e=>{m.Vp.addTo(e,...te);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,K,"f").push(a),this.updateFoV(),n}clearScopes(){const e=[...Z(this,K,"f")];Z(this,K,"f").length=0,e.forEach((e=>{e.scene.dispose(),e.scope.disposeResources(),o.P||(Z(this,q,"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===ie.value?e=this.engine.setSize(this.maxWidth,this.maxHeight):(0,a.cL)(i,ie.value,.002)||(e=ie.value<this.maxWidth/this.maxHeight?this.engine.setSize(this.maxHeight*ie.value,this.maxHeight):this.engine.setSize(this.maxWidth,this.maxWidth/ie.value)),e&&(i=this.getCanvasAR(),(0,r.cM)("updateFoV - canvas resize",{width:`${this.engine.getRenderWidth()} [${this.maxWidth}]`,height:`${this.engine.getRenderHeight()} [${this.maxHeight}]`,aspectRatio:i})),re.value){case"default":t=oe.value??i;break;case"16:9":t=16/9;break;case"4:3":t=4/3;break;case"640x512":t=1.25}switch(se.value){case"expand":n=t<1?s.V1s.FOVMODE_HORIZONTAL_FIXED:s.V1s.FOVMODE_VERTICAL_FIXED;break;case"crop":n=t<1?s.V1s.FOVMODE_VERTICAL_FIXED:s.V1s.FOVMODE_HORIZONTAL_FIXED;break;case"horizontal":n=s.V1s.FOVMODE_HORIZONTAL_FIXED;break;case"vertical":n=s.V1s.FOVMODE_VERTICAL_FIXED}for(let e=0;e<Z(this,K,"f").length;++e){const o=ue(Z(this,K,"f")[e].scene);if(!o)continue;(this.fov!==se.value||n!==o.fovMode)&&(o.fovMode=n);const r=i*(o.viewport.width/o.viewport.height);if(!(0,a.cL)(r,t,.002)){let e=t/i;if(e<1){const t=.5*(1-e);o.viewport=new s.l_w(t,0,e,1)}else{e=1/e;const t=.5*(1-e);o.viewport=new s.l_w(0,t,1,e)}}}this.fov=se.value}updateOrientation(e){this.orientationAngle!==e.angle&&((0,r.cM)("Orientation",{angle:e.angle,type:e.type}),this.orientationAngle=e.angle)}}q=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakMap,J=new WeakMap,he.Paused=(0,_.Qw)(v.fi,"paused","Pause",{mode:"stateful"})},"../../babs/core/lib/gui/debug.js":function(e,t,n){"use strict";n.d(t,{iu:function(){return y},Lh:function(){return f}});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("../../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("../../common/lib/env.js");function h(){const e=new i.Ae("perf");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_RIGHT;const t=new i.eL;return t.isVertical=!0,t.adaptWidthToChildren=!0,t.paddingLeftInPixels=t.paddingRightInPixels=4,e.addControl(t),{root:e,add:e=>{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;e<a.length;++e){const t=g[e];let n=a[e].value(o);(0,r.$O)(n,s.zRS)?n=n.current*(a[e].factor??1):n*=a[e].factor??1,u[e].push(n);const i=a[e].units??c.HA;l[e].text=`${t}: ${u[e].value.toFixed(a[e].precision??1)}${i.label}`}})),t=t=>e.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,{sS:function(){return f},x4:function(){return u},Ov:function(){return d}});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=new(n("../../babs/core/lib/common/membership.js").sU)("gui"),l=window.devicePixelRatio;function u(e){return`${Math.ceil(e*l)}px`}function d(e){return Math.ceil(e*l)}function h(e){return{width:e.getRenderWidth(),height:e.getRenderHeight()}}class f 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&&c.addTo(this.adt.layer),this.styles=function(e){const t=(t,n,s="normal")=>{const i=e.createStyle();return i.fontFamily=t,i.fontSize=u(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=f.createDebug();this.adt.addControl(e.root),this.addDebugEntry=t=>e.addEntry(t)}this.onNotify(e.getEngine().onResizeObservable,(e=>{const t=h(e);this.widgets.forEach((e=>e.onResize?.(t)))}));const t=h(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(d(n),d(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(h(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<e.columnCount;++t){const n=t?`${s}.${t}`:s,o=new i.Ae(`${n}.fill`);o.thickness=0,o.background=c,e.addControl(o,r,t);const u=new i.al(n);u.paddingLeft=(0,l.x4)(d.LW),u.color=h.content,u.textHorizontalAlignment=0===t?i.oT.HORIZONTAL_ALIGNMENT_LEFT:i.oT.HORIZONTAL_ALIGNMENT_RIGHT,e.addControl(u,r,t),a.push(u)}return a}(u,a,f,e),g=(e,t)=>{const n=[];for(let s=0;s<u.columnCount;++s){const i=u.getChildrenAt(e,s)??[];n.push(...i.filter(t))}return n};let y,v=!1;const w=new s.FM8,x=(0,r.V9)(i.Ae),j=e=>{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"),!0)}deactivate(){return!!l(this,s,"f")&&(c(this,s,!1,"f"),l(this,i,"f").call(this,"deactivate"),!0)}cancel(){return!!l(this,s,"f")&&(c(this,s,!1,"f"),l(this,i,"f").call(this,"cancel"),!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.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}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=>x(this,b,"m",y).call(this,e))))}updateConnected_(){this.connected_.value=this.onEvent.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){"activate"===e?(j(this,g,x(this,g,"f")+1,"f"),1===x(this,g,"f")&&this.onEvent.notifyObservers("activate")):(j(this,g,x(this,g,"f")-1,"f"),0===x(this,g,"f")&&this.onEvent.notifyObservers("deactivate"),"cancel"!==e&&this.onEvent.notifyObservers("trigger"))}},"../../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<n.length-1;++e)switch(n[e]){case"Shift":t.shiftKey=!0;break;case"Ctrl":t.ctrlKey=!0;break;case"Meta":t.metaKey=!0;break;case"Alt":t.altKey=!0;break;default:throw new TypeError(`Unknown KeyConfig modifier: ${n[e]}`)}const i=n[n.length-1];let o;return o=s.isSymbol(i)?s.symbols.forward[i]:s.isDigit(i)?`Digit${i}`:s.isLetter(i)?`Key${i}`:i,new r(o,t)}static from(e){return"string"==typeof e?r.fromString(e):e}get wantShift(){return 1==(1&this.modifierMask)}get wantCtrl(){return 2==(2&this.modifierMask)}get wantMeta(){return 4==(4&this.modifierMask)}get wantAlt(){return 8==(8&this.modifierMask)}hasSameModifiers(e){return this.modifierMask===e.modifierMask}toString(){const e=[];this.wantShift&&e.push("Shift"),this.wantCtrl&&e.push("Ctrl"),this.wantMeta&&e.push("Meta"),this.wantAlt&&e.push("Alt");const t=s.symbols.reverse[this.code];return t?e.push(t):this.code.startsWith("Key")?e.push(this.code.slice(3)):this.code.startsWith("Digit")?e.push(this.code.slice(5)):e.push(this.code),e.join("+")}}},"../../babs/core/lib/input/mouse.js":function(e,t,n){"use strict";n.d(t,{_B:function(){return a},aF:function(){return d}});var s=n("../../babs/core/lib/common/flag.js"),i=n("../../babs/core/lib/common/resource.js"),o=n("../../babs/core/lib/game/game_engine.js");const r=n("../../babs/core/lib/input/input.js").II.register(i.fi,"_pointerLockingInput",{keys:["MousePrimary","MouseSecondary","MouseTertiary"],priority:!0}),a=new s.W(i.fi,"mouse locked",{defaultValue:!1});let c=!1;function l(e){c||(a.value=e.isPointerLock,c=!0,document.addEventListener("pointerlockchange",(()=>{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 j},K$:function(){return p},xY:function(){return v},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 b(e,(({ammo:i,body:o})=>{const r=i.castObject(o,i.btCollisionObject);if(r.data=t,void 0!==n||void 0!==s){const t=r.getBroadphaseHandle();void 0!==n&&t.set_m_collisionFilterGroup(n),void 0!==s&&t.set_m_collisionFilterMask(s),(0,a.cM)("setCollidable",{collider:e.name,filterGroup:(0,a.kQ)(t.get_m_collisionFilterGroup()),filterMask:(0,a.kQ)(t.get_m_collisionFilterMask())})}return()=>{delete r.data}}))}const w=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;++e){const t=this.manifold.getContactPoint(e),s=n?t.getPositionWorldOnA():t.getPositionWorldOnB();yield new i.Pa4(s.x(),s.y(),s.z()),h?.destroy(s),h?.destroy(t)}}},x=Symbol("forEachCollisionId");function j(e,t){(0,o.cW)(h,"The Ammo physics engine is not enabled.");const n=e.getPhysicsEngine()?.getPhysicsPlugin(),s=n.world.getDispatcher(),i=s.getNumManifolds(),r={empty:0,noCollider:0,sameConstructor:0};let u=0;for(let e=0;e<i;++e){const n=s.getManifoldByIndexInternal(e);if(0===n.getNumContacts()){r.empty+=1;continue}const i=n.getBody0().data,o=n.getBody1().data;i&&o?i.node.constructor===o.node.constructor?r.sameConstructor+=1:(u+=1,t(i,o,w.from(n))):r.noCollider+=1}l.cG.false&&(0,a.cM)("forEachCollision",{numManifolds:i,numCallbacks:u,skips:r},{rate:c.UH.of(3,c._H),logId:x})}},"../../babs/core/lib/physics/kinetics.js":function(e,t,n){"use strict";n.d(t,{J:function(){return i}});var s=n("../../../node_modules/@babylonjs/core/index.js");function i(e,t){t??(t=s.Pa4.Zero());const n=e.physicsImpostor.getLinearVelocity();return n&&t.copyFrom(n),t}},"../../babs/core/lib/physics/physics.js":function(e,t,n){"use strict";n.d(t,{$N:function(){return $},EA:function(){return g},HE:function(){return O},Mi:function(){return k},_2:function(){return _},_t:function(){return C},h1:function(){return E},ln:function(){return v},q2:function(){return T},qR:function(){return w},th:function(){return p},xt:function(){return y},zb:function(){return S}});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/membership.js"),d=n("../../babs/core/lib/common/resource.js"),h=n("../../babs/core/lib/physics/ammo.js"),f=n("../../babs/core/lib/physics/kinetics.js");function m(e){return(0,r.$O)(e,i.x23)&&Boolean(e.physicsImpostor)}function p(e){return m(e)&&e.physicsImpostor.type!==i.Q03.NoImpostor}const b=Symbol("Collidable");class g{constructor(){this[s]=!0}}function y(e){var t;return t=b,class extends e{constructor(){super(...arguments),this[t]=!0}}}function v(e,t){const n=t?.root??e;var s;(0,r.$O)(e,i.YOI)&&(s=e,Object.defineProperty(s,b,{value:!0}));let a=0;(function(...e){const t=[],n=[...e];for(let e=0;e<n.length;++e){const s=n[e];m(s)?t.push(s):n.push(...s.getChildren())}return t})(n).forEach((s=>{a+=1;const i={node:e,collider:s,layerMask:0,onStart:t?.onCollisionStart,onEnd:t?.onCollisionEnd};let r,c;t?.addBits?.addTo(i),s.physicsImpostor.data=i,t?.addBits?((0,o.M1)(t.removeBits,void 0),r=t.addBits.mask):t?.removeBits&&(r=~t.removeBits.mask),t?.collidesWith?((0,o.M1)(t.doesNotCollideWith,void 0),c=t.collidesWith.mask):t?.doesNotCollideWith&&(c=~t.doesNotCollideWith.mask);const l=(0,h.xY)(s,i,r,c);l&&n.onDisposeObservable.addOnce(l)})),(0,o.vD)(a,0)}s=b;const w=c.UH.of(5*-9.81,c.lf);let x;function j(e,t,n){e.name=`${e.name}.μ`,e.material=x,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;let a=!1;for(const t of n.children??[])n.offset&&(t.position=n.offset.scale({factor:-1}).value().addInPlace(t.position)),t.setParent(e),(0,u.ai)(t,e),a=!0;return s||(0,h.Sq)(e,!1),n.offset&&(e.position=n.offset.value()),n.parent&&(e.setParent(n.parent),a||(0,u.ai)(n.parent,e)),e}function S(e){return j(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){return j(i.VO7.CreateSphere(e.name??"sphere",{diameter:e.diameter.value},e.scene),i.Q03.SphereImpostor,e)}function k(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())),j(t,i.Q03.CylinderImpostor,e)}function C(e){return j(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 T(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 O(e,t,n,s){let o=n;o.unit.label===c.lf.label&&(o=function(e){return c.UH.of(e.physicsImpostor.mass,c.ON)}(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):((0,a.cM)("applyForce",{magnitude:o,force:r,contactPoint:u}),e.physicsImpostor.applyForce(r,u))}class $ 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<t&&this.collisions.delete(n))}}async function E(e,t,n){let s;(0,o.BF)(!e.isPhysicsEnabled()),s=(await(0,h.K$)(e)).plugin,n&&(s=n(s)),e.enablePhysics(new i.Pa4(0,t.value,0),s),(0,a.cM)("physics",{engine:"ammo",gravity:t});const r=new i.KuD("collider",e);return r.diffuseColor=i.Wot.Yellow(),r.alpha=.2,r.wireframe=!0,x=r,l.Mz.showColliders.onChanged((0,d.U6)(e),(t=>{for(const n of e.meshes)n.material===x&&(n.isVisible=t)})),new $(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={})),new o.sU("Visible");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,{Tv:function(){return j},Y5:function(){return v},Yw:function(){return m},du:function(){return S},iK:function(){return w},pI:function(){return _},yD:function(){return p},zS:function(){return f}});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,n){if(void 0!==n){const t=(0,c.Ol)((0,i.V9)(s.x23,n),e);if(0===t.length)return;e=t[0]}if(!e.skeleton)return;const o=e.skeleton.getBoneIndexByName(t);return 0!==o?{mesh:e,bone:e.skeleton.bones[o]}:void 0}function m(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 p(e){(0,c.$U)(e,(t=>(0,a.ai)(e,t)))}let b,g,y=0;function v(){return y++}function w(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 x=s.Wot.Green();function j(e,t){const n=b?.isEnabled??!1,i=t?.enable??!0,o=t?.color??x;if(n)for(const t of(0,c.go)(s.Kj0,e))r.cG.showColliders===(0,d.th)(t)&&(i?b?.addMesh(t,o):b?.removeMesh(t));else g&&(i?g.set(e,o.clone()):g.delete(e))}function S(e,t,n){g=new Map,r.Mz.enableHighlightLayer.onChanged((0,l.U6)(e),(i=>{b||(b=new s.H1p("highlights",e,{renderingGroupId:h.Yt.opaque,camera:t}),b.innerGlow=!1,n&&(x=n)),b.isEnabled=i,b.isEnabled&&(g?.forEach(((e,t)=>j(t,{enable:!0,color:e}))),g?.clear())}),{immediate:!0})}function _(e){const t=e.clone(),n=s.Pa4.Cross(e,s.Pa4.UpReadOnly),i=s.Pa4.Cross(t,n);return s.Pa4.RotationFromAxis(n,i,t)}},"../../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},r0: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 e>=t?(0,s.Xr)(`checkLt ${e} >= ${t}`,...n):e}},"../../common/lib/containers.js":function(e,t,n){"use strict";n.d(t,{Od:function(){return r},_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 n<e.length&&(e[n]=s),!0}},"../../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 E},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 $},Yl:function(){return j},QK:function(){return S},I2:function(){return w},Pn:function(){return v},SC:function(){return y},AL:function(){return O}});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 O(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,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 E(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]:E(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<e;++n)yield n}function*o(e,t){for(const n of e)yield t(n)}function*r(e,t){let n=0;for(const s of e)t(s,n++)&&(yield s)}n.d(t,{Ed:function(){return s},Hb:function(){return i},NT:function(){return r},lT:function(){return o}}),n("../../common/lib/check.js")},"../../common/lib/logging.js":function(e,t,n){"use strict";n.d(t,{AM:function(){return _},B$:function(){return u},H:function(){return d},OS:function(){return v},QF:function(){return A},Qv:function(){return h},bn:function(){return y},cM:function(){return M},hX:function(){return g},kQ:function(){return w}});var s=n("../../common/lib/check.js"),i=n("../../common/lib/core.js"),o=n("../../common/lib/identity.js"),r=n("../../common/lib/units.js");function a(...e){return e.join("; ")}const c=["font-weight: normal","font-size: 12px","font-family: Calibri"],l=[...c,"display: inline-block","color: #ddd","background-color: #003366"],u={default:a(...c),inlineHeader:a(...l,"padding: 1px 5px 1px 5px","background-color: #000"),groupHeader:a(...l,"padding: 1px 300px 1px 5px","background-color: #000"),skipCount:a("font-size: 11px","font-family: Calibri","color: black","background-color: #5db0d7","border-radius: 8px","padding: 0px 3px 0px 3px","text-decoration: line-through"),keyword:a(...c,"color: #569cd6"),key:a(...c,"color: #9cdcfe"),method:a(...c,"color: #9cdcfe","font-style: italic"),value:a(...c),subtle:a(...c,"color: #777"),number:a(...c,"color: #b5cea8"),string:a(...c,"color: #ce9178"),type:a(...c,"color: #4ec9b0"),comment:a(...c,"color: #297"),highlight:a(...c,"color: #9cdcfe"),console:a(...c,"color: #297"),callSite:a(...c,"display: inline-block","color: #555","padding-left: 0.5em","margin-left: 0.5em","border-left: 1px solid #333")};function d(e){return t=>{(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()}function w(e){return`0x${(e>>>0).toString(16)}`}var x;!function(e){e[e.Call=0]="Call",e[e.Return=1]="Return",e[e.Both=2]="Both"}(x||(x={}));const j=/\/([^/]+)\)/,S=(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 _(e,t){S.set(e,t)}function k(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]=k(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=S.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]=k(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 C=console.log,T={canSample:()=>!0,didSample:()=>{},skippedSamples:1,log:(e,t,n,...s)=>C(n,...s)};class O{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`"),T;let t=O.stateMap[e.logId];return t||(t=new O(e),O.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(),C(n,...s)}}O.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<t.length&&"%"===t[s];)s+=2;return s<t.length&&"\b"===t[s]?e.concat(t.slice(0,s),t.slice(s+1)):e.concat(" ",t)}))}function M(e,t,n){const s=O.from(n);if(!s.canSample())return;const i=$.apply(n??{}),{defaultStyle:r}=i,a=i.prettyDepth-1,c=s.skippedSamples-1;let l;if(void 0===t)l=[];else if((0,o.kJ)(t))l=t.map((e=>{if("string"==typeof e)return[`%c${e}`,[r]];{const[t,...n]=k(e,a);return[t,n]}}));else{const e=t;l=Object.keys(e).map((t=>{const[n,...s]=k(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(j);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)C(e,...t);console.groupEnd()}}function A(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),M(e,d,t)}console.log=console.info=(e,...t)=>M(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 n<t&&([t,n]=[n,t]),e<t?t:e>n?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)<n}class c{constructor(e,t,n){this.velocity=0,this.value=e,this.c0=t,this.c1=n??2*Math.sqrt(t)}update(e,t){const n=t-this.value,s=this.c0*n-this.c1*this.velocity;return this.velocity+=s*e.value,this.value+=this.velocity*e.value,this.value}}class l{constructor(e=0){this.defaultValue=e,this.segmentIndex=0,this.segmentTime=s._H.zero,this.segments=[]}get isDone(){return this.segmentIndex>=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<this.segments.length;){this.segmentTime=this.segmentTime.plus(e);const t=this.segments[this.segmentIndex],n=this.segmentTime.ratioTo(t.duration);if(n<=1)return t.f(n);this.segmentTime=this.segmentTime.minus(t.duration),this.segmentIndex+=1}return this.segmentTime=s._H.zero,this.segments.length?this.segments[this.segments.length-1].f(1):this.defaultValue}}},"../../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 E},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 O},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<e.value}isLessThanOrEqualTo(e){return this.value<=e.value}to(e){return e===this.unit?this:k.of(this.getUnitQuantity(e),e)}valueOf(){throw new TypeError(`Measure does not allow implicit conversion. Use 'this.value' instead. Current value: ${this.toString()}`)}toString(){return`${(0,d.OS)(this.quantity)}${this.unit.label}`}getUnitQuantity(e){return e===this.unit?this.quantity:this.quantity*this.unit.engineRatio/e.engineRatio}}Object.defineProperty(_.prototype,"zero",{get:function(){return k.of(0,this)}}),Object.defineProperty(_.prototype,"one",{get:function(){return k.of(1,this)}});const C=new _(1,"m",f.i),T=(_.of(1e3,C,"km"),_.of(.3048,C,"ft"),new _(1,"kg",m.i)),O=(_.of(.001,T,"g"),_.of(.453592,T,"lb"),new _(1,"s",p.i)),$=_.of(60,O,"min"),E=_.of(60,$,"hr"),M=(_.of(24,E,"d"),_.of(.001,O,"ms")),A=(_.of(1e-6,O,"μs"),_.of(1e-9,O,"ns"),new _(1,"rad",b.i)),P=_.of(Math.PI/180,A,"°"),I=C.per(O),R=I.per(O),D=T.times(R),F=D.times(O),z=new _(1,"",g.i),N=(z.one.per(O.one),new _(1,"",y.i)),L=new _(.01,"%",y.i),B=new _(1,"cyc",v.i).per(O)}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,exports:{}};return s[e](n,n.exports,o),n.exports}o.m=s,e=[],o.O=function(t,n,s,i){if(!n){var r=1/0;for(u=0;u<e.length;u++){n=e[u][0],s=e[u][1],i=e[u][2];for(var a=!0,c=0;c<n.length;c++)(!1&i||r>=i)&&Object.keys(o.O).every((function(e){return o.O[e](n[c])}))?n.splice(c--,1):(a=!1,i<r&&(r=i));if(a){e.splice(u--,1);var l=s();void 0!==l&&(t=l)}}return t}i=i||0;for(var u=e.length;u>0&&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:"2454edc660c04851d34d",338:"43fc4505eac4414eecc7",381:"7dff82a30ac5f68239e4",782:"900e7fbff2c02c51fe77",868:"de100af1d9f08ead9274",893:"b4add596df3a347e321f",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<l.length;u++){var d=l[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+i){a=d;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",n+i),a.src=e),t[e]=[s];var h=function(n,s){a.onerror=a.onload=null,clearTimeout(f);var i=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((function(e){return e(s)})),n)return n(s)},f=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),c&&document.head.appendChild(a)}},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e}(),function(){var e={179:0};o.f.j=function(t,n){var s=o.o(e,t)?e[t]:void 0;if(0!==s)if(s)n.push(s[2]);else{var i=new Promise((function(n,i){s=e[t]=[n,i]}));n.push(s[2]=i);var r=o.p+o.u(t),a=new Error;o.l(r,(function(n){if(o.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var i=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",a.name="ChunkLoadError",a.type=i,a.request=r,s[1](a)}}),"chunk-"+t,t)}},o.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,r=n[0],a=n[1],c=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(s in a)o.o(a,s)&&(o.m[s]=a[s]);if(c)var u=c(o)}for(t&&t(n);l<r.length;l++)i=r[l],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(u)},n=self.webpackChunk_ld_apps_ludathon=self.webpackChunk_ld_apps_ludathon||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}(),o.nc=void 0;var r=o.O(void 0,[297],(function(){return o("./src/index.ts")}));r=o.O(r)}();