UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines 86.9 kB
import{y as e,M as t,b3 as o,V as n,bc as a,aD as s,i as r,b1 as i,l,v as c,O as h,q as p,s as u,cI as m,by as d,cd as w,aY as f,A as g,bY as k,C as y,bo as G,bp as _}from"./index-OM-TXt9s.esm.min.js";import{F as B,R as v,G as b,A as F}from"./objectModelMapping-DA3c5cv8.esm.min.js";import{F as C,j as x,g as E,q as I,r as O}from"./declarationMapper-sl3auZpG.esm.min.js";function T(e){return"Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e||"Color3"===e||"Color4"===e}function M(e,t){if(!e||!e.id&&!e.name)return;const o=t.getNodes().filter(t=>e.id?t.id===e.id:t.name===e.name);if(0===o.length)return;const n=e.type??e.className,a=n?o.filter(e=>e.getClassName()===n):[],s=a.length>0?a:o;return(e.uniqueId?s.find(t=>t.uniqueId===e.uniqueId):void 0)??s[0]}function S(t,o,n){const a=o?.getClassName?.()??"";if(T(a)||function(e){return"Matrix"===e||"Matrix2D"===e||"Matrix3D"===e}(a))n[t]={value:o.asArray(),className:a};else if("FlowGraphInteger"===a)n[t]={value:o.value,className:a};else if(a&&(o.id||o.name))n[t]={id:o.id,name:o.name,className:a,uniqueId:o.uniqueId};else if("object"!=typeof o||null===o)n[t]=o;else{if("pathConverter"===t)return;if(Object.values(o).some(e=>"function"==typeof e))return;try{n[t]=JSON.parse(JSON.stringify(o))}catch{e.Warn(`FlowGraph serialization: value for key "${t}" is not JSON-serializable and was skipped.`)}}}function P(e,l,c,h){const p=l[e];let u;const m=p?.type??p?.className,d=M(p,h);if(d)u=d;else if(T(m))u=function(e,t,l=!1){if("Vector2"===e)return o.FromArray(t);if("Vector3"===e)return l&&(t[2]*=-1),n.FromArray(t);if("Vector4"===e)return a.FromArray(t);if("Quaternion"===e)return l&&(t[2]*=-1,t[3]*=-1),s.FromArray(t);if("Color3"===e)return new r(t[0],t[1],t[2]);if("Color4"===e)return new i(t[0],t[1],t[2],t[3]);throw new Error(`Unknown vector class name ${e}`)}(m,p.value);else if(function(e){return"AnimationGroup"===e}(m)){const e=h.animationGroups.filter(e=>e.name===p.name);u=1===e.length?e[0]:e.find(e=>e.uniqueId===p.uniqueId)}else u="Matrix"===m?t.FromArray(p.value):"Matrix2D"===m?new C(p.value):"Matrix3D"===m?new x(p.value):"FlowGraphInteger"===m?B.FromValue(p.value):"number"===m||"string"===m||"boolean"===m?p.value[0]:p&&void 0!==p.value?p.value:Array.isArray(p)&&p.length>0&&"object"==typeof p[0]&&null!==p[0]&&"eventData"in p[0]?p.reduce((e,t)=>t.eventData?(e[t.id]={type:E(t.type)},void 0!==t.value&&(e[t.id].value=P("value",t,c,h)),e):e,{}):p;return u}var V,j;function N(e,t,o,n){switch(t){case"Animation":return n?e.animations.find(e=>e.uniqueId===o)??null:e.animations[o]??null;case"AnimationGroup":return n?e.animationGroups.find(e=>e.uniqueId===o)??null:e.animationGroups[o]??null;case"Mesh":return n?e.meshes.find(e=>e.uniqueId===o)??null:e.meshes[o]??null;case"Material":return n?e.materials.find(e=>e.uniqueId===o)??null:e.materials[o]??null;case"Camera":return n?e.cameras.find(e=>e.uniqueId===o)??null:e.cameras[o]??null;case"Light":return n?e.lights.find(e=>e.uniqueId===o)??null:e.lights[o]??null;default:return null}}!function(e){e.Animation="Animation",e.AnimationGroup="AnimationGroup",e.Mesh="Mesh",e.Material="Material",e.Camera="Camera",e.Light="Light"}(V||(V={})),function(e){e.ExecuteBlock="ExecuteBlock",e.ExecuteEvent="ExecuteEvent",e.TriggerConnection="TriggerConnection",e.ContextVariableSet="ContextVariableSet",e.GlobalVariableSet="GlobalVariableSet",e.GlobalVariableDelete="GlobalVariableDelete",e.GlobalVariableGet="GlobalVariableGet",e.AddConnection="AddConnection",e.GetConnectionValue="GetConnectionValue",e.SetConnectionValue="SetConnectionValue",e.ActivateSignal="ActivateSignal",e.ContextVariableGet="ContextVariableGet"}(j||(j={}));class A{constructor(){this.logToConsole=!1,this.log=[]}addLogItem(t){if(t.time||(t.time=Date.now()),this.log.push(t),this.logToConsole){const o=t.payload?.value;"object"==typeof o&&o.getClassName?e.Log(`[FGLog] ${t.className}:${t.uniqueId.split("-")[0]} ${t.action} - ${JSON.stringify(o.getClassName())}: ${o.toString()}`):e.Log(`[FGLog] ${t.className}:${t.uniqueId.split("-")[0]} ${t.action} - ${JSON.stringify(t.payload)}`)}}getItemsOfType(e){return this.log.filter(t=>t.action===e)}}let R=(()=>{var e;let t,o,n=[],a=[],s=[],r=[];return e=class{get enableLogging(){return this._enableLogging}set enableLogging(e){this._enableLogging!==e&&(this._enableLogging=e,this._enableLogging?(this.logger=new A,this.logger.logToConsole=!0):this.logger=null)}constructor(e){this.uniqueId=l(this,n,c()),this.name=(l(this,a),l(this,s,"")),this._userVariables=(l(this,r),{}),this._variableTypes={},this._executionVariables={},this._globalContextVariables={},this._connectionValues={},this._pendingBlocks=[],this._executionId=0,this.onNodeExecutedObservable=new h,this.onBreakpointHitObservable=new h,this.breakpointPredicate=null,this._pendingActivation=null,this._stepMode=!1,this._skipBreakpointForBlockId=null,this.treatDataAsRightHanded=!1,this._enableLogging=!1,this._configuration=e,this.assetsContext=e.assetsContext??e.scene}hasVariable(e){return e in this._userVariables}setVariable(e,t){this._userVariables[e]=t,this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableSet",payload:{name:e,value:t}})}getAsset(e,t){return N(this.assetsContext,e,t)}getVariable(e){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableGet",payload:{name:e,value:this._userVariables[e]}}),this._userVariables[e]}get userVariables(){return this._userVariables}setVariableType(e,t){this._variableTypes[e]=t}getVariableType(e){return this._variableTypes[e]}get variableTypes(){return this._variableTypes}getScene(){return this._configuration.scene}getEventReference(e){return this._configuration.coordinator._getEventReference(e)}decodeIndexReference(e){return this._configuration.coordinator.config.hostResolver?.decodeIndexReference?.(e)}getObjectReference(e,t){return this._configuration.coordinator.config.hostResolver?.getObjectReference?.(e,t)}_getUniqueIdPrefixedName(e,t){return`${e.uniqueId}_${t}`}_getGlobalContextVariable(e,t){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableGet",payload:{name:e,defaultValue:t,possibleValue:this._globalContextVariables[e]}}),this._hasGlobalContextVariable(e)?this._globalContextVariables[e]:t}_setGlobalContextVariable(e,t){this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableSet",payload:{name:e,value:t}}),this._globalContextVariables[e]=t}_deleteGlobalContextVariable(e){this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableDelete",payload:{name:e}}),delete this._globalContextVariables[e]}_hasGlobalContextVariable(e){return e in this._globalContextVariables}_setExecutionVariable(e,t,o){this._executionVariables[this._getUniqueIdPrefixedName(e,t)]=o}_getExecutionVariable(e,t,o){return this._hasExecutionVariable(e,t)?this._executionVariables[this._getUniqueIdPrefixedName(e,t)]:o}_deleteExecutionVariable(e,t){delete this._executionVariables[this._getUniqueIdPrefixedName(e,t)]}_hasExecutionVariable(e,t){return this._getUniqueIdPrefixedName(e,t)in this._executionVariables}_hasConnectionValue(e){return e.uniqueId in this._connectionValues}_setConnectionValue(e,t){this._connectionValues[e.uniqueId]=t,this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"SetConnectionValue",payload:{connectionPointId:e.uniqueId,value:t}})}_setConnectionValueByKey(e,t){this._connectionValues[e]=t}_getConnectionValue(e){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GetConnectionValue",payload:{connectionPointId:e.uniqueId,value:this._connectionValues[e.uniqueId]}}),this._connectionValues[e.uniqueId]}get configuration(){return this._configuration}get hasPendingBlocks(){return this._pendingBlocks.length>0}_addPendingBlock(e){this._pendingBlocks.includes(e)||(this._pendingBlocks.push(e),this._pendingBlocks.sort((e,t)=>e.priority-t.priority))}_removePendingBlock(e){const t=this._pendingBlocks.indexOf(e);-1!==t&&this._pendingBlocks.splice(t,1)}_clearPendingBlocks(){for(const e of this._pendingBlocks)e._cancelPendingTasks(this);this._pendingBlocks.length=0}_notifyExecuteNode(e){this.onNodeExecutedObservable.notifyObservers(e),this.logger?.addLogItem({time:Date.now(),className:e.getClassName(),uniqueId:e.uniqueId,action:"ExecuteBlock"})}_notifyOnTick(e){this._setGlobalContextVariable("timeSinceStart",e.timeSinceStart),this._setGlobalContextVariable("deltaTime",e.deltaTime);for(const e of this._pendingBlocks)e._executeOnTick?.(this)}_increaseExecutionId(){this._executionId++}get executionId(){return this._executionId}_shouldBreak(e,t){return this._skipBreakpointForBlockId===e.uniqueId?(this._skipBreakpointForBlockId=null,!1):!!this._pendingActivation||(this._stepMode?(this._stepMode=!1,this._pendingActivation={block:e,context:this,signal:t},this.onBreakpointHitObservable.notifyObservers(this._pendingActivation),!0):!(!this.breakpointPredicate||!this.breakpointPredicate(e))&&(this._pendingActivation={block:e,context:this,signal:t},this.onBreakpointHitObservable.notifyObservers(this._pendingActivation),!0))}get pendingActivation(){return this._pendingActivation}continueExecution(){const e=this._pendingActivation;e&&(this._pendingActivation=null,this._skipBreakpointForBlockId=e.block.uniqueId,e.signal._activateSignal(this),this._skipBreakpointForBlockId=null)}stepExecution(){const e=this._pendingActivation;e&&(this._pendingActivation=null,this._stepMode=!0,this._skipBreakpointForBlockId=e.block.uniqueId,e.signal._activateSignal(this),this._stepMode=!1,this._skipBreakpointForBlockId=null)}_clearPendingActivation(){this._pendingActivation=null,this._stepMode=!1,this._skipBreakpointForBlockId=null}serialize(e={},t=S){e.uniqueId=this.uniqueId,e.name=this.name,e._userVariables={};for(const o in this._userVariables)t(o,this._userVariables[o],e._userVariables);Object.keys(this._variableTypes).length>0&&(e._variableTypes={...this._variableTypes}),e._connectionValues={};for(const o in this._connectionValues)t(o,this._connectionValues[o],e._connectionValues);this.assetsContext!==this.getScene()&&(e._assetsContext={meshes:this.assetsContext.meshes.map(e=>e.id),materials:this.assetsContext.materials.map(e=>e.id),textures:this.assetsContext.textures.map(e=>e.name),animations:this.assetsContext.animations.map(e=>e.name),lights:this.assetsContext.lights.map(e=>e.id),cameras:this.assetsContext.cameras.map(e=>e.id),sounds:this.assetsContext.sounds?.map(e=>e.name),skeletons:this.assetsContext.skeletons.map(e=>e.id),particleSystems:this.assetsContext.particleSystems.map(e=>e.name),geometries:this.assetsContext.geometries.map(e=>e.id),multiMaterials:this.assetsContext.multiMaterials.map(e=>e.id),transformNodes:this.assetsContext.transformNodes.map(e=>e.id)})}getClassName(){return"FlowGraphContext"}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[u()],o=[u()],p(null,null,t,{kind:"field",name:"uniqueId",static:!1,private:!1,access:{has:e=>"uniqueId"in e,get:e=>e.uniqueId,set:(e,t)=>{e.uniqueId=t}},metadata:i},n,a),p(null,null,o,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:i},s,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();var D;!function(e){e[e.Input=0]="Input",e[e.Output=1]="Output"}(D||(D={}));class q{constructor(e,t,o){this._ownerBlock=o,this._connectedPoint=[],this.uniqueId=c(),this.connectedPointIds=[],this.name=e,this._connectionType=t}get connectionType(){return this._connectionType}_isSingularConnection(){return!0}isConnected(){return this._connectedPoint.length>0}connectTo(e){if(this._connectionType===e._connectionType)throw new Error(`Cannot connect two points of type ${this.connectionType}`);if(this._isSingularConnection()&&this._connectedPoint.length>0||e._isSingularConnection()&&e._connectedPoint.length>0)throw new Error("Max number of connections for point reached");this._connectedPoint.push(e),e._connectedPoint.push(this)}disconnectFrom(e,t=!0){const o=this._connectedPoint.indexOf(e),n=e._connectedPoint.indexOf(this);-1!==o&&-1!==n&&(t&&this._connectedPoint.splice(o,1),e._connectedPoint.splice(n,1))}disconnectFromAll(){for(const e of this._connectedPoint)this.disconnectFrom(e,!1);this._connectedPoint.length=0}dispose(){for(const e of this._connectedPoint)this.disconnectFrom(e)}serialize(e={}){e.uniqueId=this.uniqueId,e.name=this.name,e._connectionType=this._connectionType,e.connectedPointIds=[],e.className=this.getClassName();for(const t of this._connectedPoint)e.connectedPointIds.push(t.uniqueId)}getClassName(){return"FGConnection"}deserialize(e){this.uniqueId=e.uniqueId,this.name=e.name,this._connectionType=e._connectionType,this.connectedPointIds=e.connectedPointIds}}class L extends q{constructor(e,t,o,n,a=n.defaultValue,s=!1){super(e,t,o),this.richType=n,this._defaultValue=a,this._optional=s,this._isDisabled=!1,this._lastValue=null,this.dataTransformer=null,this.onValueChangedObservable=new h}get optional(){return this._optional}get isDisabled(){return this._isDisabled}set isDisabled(e){this._isDisabled!==e&&(this._isDisabled=e,this._isDisabled&&this.disconnectFromAll())}_isSingularConnection(){return 0===this.connectionType}setValue(e,t){t._getConnectionValue(this)!==e&&(t._setConnectionValue(this,e),this.onValueChangedObservable.notifyObservers(e))}resetToDefaultValue(e){e._setConnectionValue(this,this._defaultValue)}_reresolveDefaultValueForScene(e){const t=this._defaultValue;if(!t||"object"!=typeof t)return;let o;if("function"==typeof t.getClassName&&"function"==typeof t.getScene){if(t.getScene()===e)return;o={id:t.id,name:t.name,className:t.getClassName(),uniqueId:t.uniqueId}}else{if("string"!=typeof t.className||!t.id&&!t.name||void 0!==t.value)return;o=t}const n=M(o,e);n&&(this._defaultValue=n)}connectTo(e){this._isDisabled||super.connectTo(e)}_getValueOrDefault(e){const t=e._getConnectionValue(this)??this._defaultValue;return this.dataTransformer?this.dataTransformer(t):t}getValue(e){if(1===this.connectionType){e._notifyExecuteNode(this._ownerBlock),this._ownerBlock._updateOutputs(e);const t=this._getValueOrDefault(e);return this._lastValue=t,this.richType.typeTransformer?this.richType.typeTransformer(t):t}const t=this.isConnected()?this._connectedPoint[0].getValue(e):this._getValueOrDefault(e);return this._lastValue=t,this.richType.typeTransformer?this.richType.typeTransformer(t):t}_getLastValue(){return this._lastValue}getClassName(){return"FlowGraphDataConnection"}serialize(e={}){super.serialize(e),e.richType={},this.richType.serialize(e.richType),e.optional=this._optional,S("defaultValue",this._defaultValue,e)}}class ${constructor(e){this.config=e,this.uniqueId=c(),this.name=this.config?.name??this.getClassName(),this.dataInputs=[],this.dataOutputs=[]}_updateOutputs(e){}registerDataInput(e,t,o){const n=new L(e,0,this,t,o);return this.dataInputs.push(n),n}registerDataOutput(e,t,o){const n=new L(e,1,this,t,o);return this.dataOutputs.push(n),n}getDataInput(e){return this.dataInputs.find(t=>t.name===e)}getDataOutput(e){return this.dataOutputs.find(t=>t.name===e)}serialize(e={},t=S){if(e.uniqueId=this.uniqueId,e.config={},this.config){const o=this.config,n=Object.keys(o);for(const a of n)t(a,o[a],e.config)}e.dataInputs=[],e.dataOutputs=[],e.className=this.getClassName();for(const t of this.dataInputs){const o={};t.serialize(o),e.dataInputs.push(o)}for(const t of this.dataOutputs){const o={};t.serialize(o),e.dataOutputs.push(o)}}deserialize(e){}_log(e,t,o){e.logger?.addLogItem({action:t,payload:o,className:this.getClassName(),uniqueId:this.uniqueId})}getClassName(){return"FlowGraphBlock"}}class H extends q{constructor(){super(...arguments),this.priority=0,this._lastActivationTime=-1}_isSingularConnection(){return!1}connectTo(e){super.connectTo(e),this._connectedPoint.sort((e,t)=>t.priority-e.priority)}_activateSignal(e){if(this._lastActivationTime=performance.now(),e.logger?.addLogItem({action:"ActivateSignal",className:this._ownerBlock.getClassName(),uniqueId:this._ownerBlock.uniqueId,payload:{connectionType:this.connectionType,name:this.name}}),0===this.connectionType){if(e._shouldBreak(this._ownerBlock,this))return;e._increaseExecutionId(),e._notifyExecuteNode(this._ownerBlock);const t=performance.now();this._ownerBlock._execute(e,this),this._ownerBlock._lastExecutionTime=performance.now()-t}else for(const t of this._connectedPoint)t._activateSignal(e)}}class K extends ${constructor(e){super(e),this.priority=0,this._lastExecutionTime=-1,this.signalInputs=[],this.signalOutputs=[],this.in=this._registerSignalInput("in"),this.error=this._registerSignalOutput("error")}_registerSignalInput(e){const t=new H(e,0,this);return this.signalInputs.push(t),t}_registerSignalOutput(e){const t=new H(e,1,this);return this.signalOutputs.push(t),t}_unregisterSignalInput(e){const t=this.signalInputs.findIndex(t=>t.name===e);-1!==t&&(this.signalInputs[t].dispose(),this.signalInputs.splice(t,1))}_unregisterSignalOutput(e){const t=this.signalOutputs.findIndex(t=>t.name===e);-1!==t&&(this.signalOutputs[t].dispose(),this.signalOutputs.splice(t,1))}_reportError(e,t){this.error.payload="string"==typeof t?new Error(t):t,this.error._activateSignal(e)}getSignalInput(e){return this.signalInputs.find(t=>t.name===e)}getSignalOutput(e){return this.signalOutputs.find(t=>t.name===e)}serialize(e={}){super.serialize(e),e.signalInputs=[],e.signalOutputs=[];for(const t of this.signalInputs){const o={};t.serialize(o),e.signalInputs.push(o)}for(const t of this.signalOutputs){const o={};t.serialize(o),e.signalOutputs.push(o)}}deserialize(e){for(let t=0;t<e.signalInputs.length;t++){const o=this.getSignalInput(e.signalInputs[t].name);if(!o)throw new Error("Could not find signal input with name "+e.signalInputs[t].name+" in block "+e.className);o.deserialize(e.signalInputs[t])}for(let t=0;t<e.signalOutputs.length;t++){const o=this.getSignalOutput(e.signalOutputs[t].name);if(!o)throw new Error("Could not find signal output with name "+e.signalOutputs[t].name+" in block "+e.className);o.deserialize(e.signalOutputs[t])}}getClassName(){return"FlowGraphExecutionBlock"}}class z extends K{constructor(e){super(e),this.out=this._registerSignalOutput("out")}}class W extends z{constructor(e,t){if(super(e),this._eventsSignalOutputs={},this.done=this._registerSignalOutput("done"),t)for(const e of t)this._eventsSignalOutputs[e]=this._registerSignalOutput(e+"Event")}_executeOnTick(e){}_startPendingTasks(e){e._getExecutionVariable(this,"_initialized",!1)&&(this._cancelPendingTasks(e),this._resetAfterCanceled(e)),this._preparePendingTasks(e),e._addPendingBlock(this),this.out._activateSignal(e),e._setExecutionVariable(this,"_initialized",!0)}_resetAfterCanceled(e){e._deleteExecutionVariable(this,"_initialized"),e._removePendingBlock(this)}}const U=m()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);function Q(e,t){return!(!e.parent||e.parent!==t&&!Q(e.parent,t))}function J(e){if(e.getClassName)return e.getClassName()}function Y(e,t){return e===t&&("Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e)}function Z(e,t){return e===t&&("Matrix"===e||"Matrix2D"===e||"Matrix3D"===e)}function X(e,t){return"FlowGraphInteger"===e&&"FlowGraphInteger"===t}function ee(e,t){const o="number"==typeof e||"number"==typeof e?.value;return o&&!t?!isNaN(te(e)):o}function te(e){return"number"==typeof e?e:e.value}class oe{constructor(e){this.onEventTriggeredObservable=new h,this.sceneReadyTriggered=!1,this._pointerUnderMeshState={},this._onBlurHandler=null,this.pressedKeys=new Set,this._startingTime=0,this._scene=e,this._initialize()}_initialize(){this._sceneReadyObserver=this._scene.onReadyObservable.addOnce(()=>{this.sceneReadyTriggered||(this.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}),this.sceneReadyTriggered=!0)}),this._sceneDisposeObserver=this._scene.onDisposeObservable.add(()=>{this.onEventTriggeredObservable.notifyObservers({type:"SceneDispose"})}),this._sceneOnBeforeRenderObserver=this._scene.onBeforeRenderObservable.add(()=>{const e=this._scene.getEngine().getDeltaTime()/1e3;this.onEventTriggeredObservable.notifyObservers({type:"SceneBeforeRender",payload:{timeSinceStart:this._startingTime,deltaTime:e}}),this._startingTime+=e}),this._meshPickedObserver=this._scene.onPointerObservable.add(e=>{this.onEventTriggeredObservable.notifyObservers({type:"MeshPick",payload:e})},d.POINTERPICK),this._pointerDownObserver=this._scene.onPointerObservable.add(e=>{this.onEventTriggeredObservable.notifyObservers({type:"PointerDown",payload:e})},d.POINTERDOWN),this._pointerUpObserver=this._scene.onPointerObservable.add(e=>{this.onEventTriggeredObservable.notifyObservers({type:"PointerUp",payload:e})},d.POINTERUP),this._pointerMoveObserver=this._scene.onPointerObservable.add(e=>{this.onEventTriggeredObservable.notifyObservers({type:"PointerMove",payload:e})},d.POINTERMOVE),this._meshUnderPointerObserver=this._scene.onMeshUnderPointerUpdatedObservable.add(e=>{const t=e.pointerId,o=e.mesh,n=this._pointerUnderMeshState[t];!n&&o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:t,mesh:o}}):n&&!o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:t,mesh:n}}):n&&o&&n!==o&&(this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:t,mesh:n,over:o}}),this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:t,mesh:o,out:n}})),this._pointerUnderMeshState[t]=o},d.POINTERMOVE),this._keyDownObserver=this._scene.onKeyboardObservable.add(e=>{const t=e.event.code;this.pressedKeys.add(t),oe._COMMAND_OR_CTRL_CODES.has(t)&&this.pressedKeys.add("CommandOrControl"),this.onEventTriggeredObservable.notifyObservers({type:"KeyDown",payload:e})},w.KEYDOWN),this._keyUpObserver=this._scene.onKeyboardObservable.add(e=>{const t=e.event.code;if(this.pressedKeys.delete(t),oe._COMMAND_OR_CTRL_CODES.has(t)){let e=!1;for(const o of Array.from(oe._COMMAND_OR_CTRL_CODES))if(o!==t&&this.pressedKeys.has(o)){e=!0;break}e||this.pressedKeys.delete("CommandOrControl")}this.onEventTriggeredObservable.notifyObservers({type:"KeyUp",payload:e})},w.KEYUP);const e=this._scene.getEngine().getRenderingCanvas();e&&(this._onBlurHandler=()=>this.pressedKeys.clear(),e.addEventListener("blur",this._onBlurHandler))}dispose(){if(this._sceneDisposeObserver?.remove(),this._sceneReadyObserver?.remove(),this._sceneOnBeforeRenderObserver?.remove(),this._meshPickedObserver?.remove(),this._meshUnderPointerObserver?.remove(),this._pointerDownObserver?.remove(),this._pointerUpObserver?.remove(),this._pointerMoveObserver?.remove(),this._keyDownObserver?.remove(),this._keyUpObserver?.remove(),this._onBlurHandler){const e=this._scene.getEngine().getRenderingCanvas();e?.removeEventListener("blur",this._onBlurHandler),this._onBlurHandler=null}this.pressedKeys.clear(),this.onEventTriggeredObservable.clear()}}oe._COMMAND_OR_CTRL_CODES=U?new Set(["MetaLeft","MetaRight"]):new Set(["ControlLeft","ControlRight"]);class ne extends W{constructor(e){super(e),this.initPriority=0,this.type="NoTrigger",this._unregisterSignalInput("in")}deserialize(e){const t={...e};t.signalInputs=(e.signalInputs??[]).filter(e=>"in"!==e.name),super.deserialize(t)}_execute(e){e._notifyExecuteNode(this),this.done._activateSignal(e),this.out._activateSignal(e)}_startPendingTasks(e){e._getExecutionVariable(this,"_initialized",!1)&&(this._cancelPendingTasks(e),this._resetAfterCanceled(e)),this._preparePendingTasks(e),e._addPendingBlock(this),e._setExecutionVariable(this,"_initialized",!0)}}var ae;!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning"}(ae||(ae={}));const se=new Set(["number","FlowGraphInteger","boolean"]),re=new Set(["Vector4","Quaternion"]),ie=new Set(["Color3","Color4"]);function le(e,t){return e===t||("any"===e||"any"===t||(!(!se.has(e)||!se.has(t))||(!(!re.has(e)||!re.has(t))||!(!ie.has(e)||!ie.has(t)))))}function ce(e){const t=[],o=new Map,n=e=>{if(t.push(e),e.block){let t=o.get(e.block.uniqueId);t||(t=[],o.set(e.block.uniqueId,t)),t.push(e)}},a=[];e.visitAllBlocks(e=>{a.push(e)});const s=function(e){const t=[];for(const o in e._eventBlocks)for(const n of e._eventBlocks[o])t.push(n);return t}(e);0===s.length&&n({severity:0,message:"Graph has no event blocks — nothing will trigger execution."});for(const e of a)for(const t of e.dataInputs)t.optional||t.isDisabled||t.isConnected()||n({severity:1,message:`"${t.name}" is not connected and will use its default value.`,block:e,connectionName:t.name});for(const e of a)if(e instanceof K){if(he(e))continue;const t=e.signalInputs.find(e=>"in"===e.name);t&&!t.isConnected()&&n({severity:0,message:"Execution block has no incoming signal — it will never execute.",block:e,connectionName:"in"})}for(const e of a)for(const t of e.dataInputs){if(!t.isConnected())continue;const o=t._connectedPoint[0],a=o.richType?.typeName,s=t.richType?.typeName;if(a&&s&&!le(a,s)){if(void 0!==o.richType.typeTransformer||void 0!==t.richType.typeTransformer)continue;n({severity:1,message:`Type mismatch: "${o._ownerBlock.name}.${o.name}" (${a}) → "${e.name}.${t.name}" (${s}).`,block:e,connectionName:t.name})}}const r=new Set;return e.visitAllBlocks(e=>{r.add(e.uniqueId)}),function(e,t){const o=0,n=1,a=2,s=new Map;for(const t of e)s.set(t.uniqueId,o);const r=new Map;for(const t of e)r.set(t.uniqueId,t);const i=new Set;function l(e){s.set(e.uniqueId,n);for(const a of e.dataInputs)if(a.isConnected())for(const r of a._connectedPoint){const a=r._ownerBlock;if(a instanceof K)continue;const c=s.get(a.uniqueId);if(c===n)return i.has(e.uniqueId)||(i.add(e.uniqueId),t({severity:0,message:"Data dependency cycle detected — getValue() will recurse infinitely.",block:e})),i.has(a.uniqueId)||(i.add(a.uniqueId),t({severity:0,message:"Data dependency cycle detected — getValue() will recurse infinitely.",block:a})),!0;c===o&&l(a)}return s.set(e.uniqueId,a),!1}for(const t of e)s.get(t.uniqueId)===o&&l(t)}(a,n),t.sort((e,t)=>e.severity-t.severity),{isValid:t.every(e=>0!==e.severity),issues:t,errorCount:t.filter(e=>0===e.severity).length,warningCount:t.filter(e=>1===e.severity).length,issuesByBlock:o}}function he(e){return e instanceof ne}var pe;!function(e){e[e.Stopped=0]="Stopped",e[e.Started=1]="Started",e[e.Paused=2]="Paused"}(pe||(pe={}));class ue{_getGlobalFlowGraphEditor(){if("undefined"!=typeof FLOWGRAPHEDITOR){if(FLOWGRAPHEDITOR.FlowGraphEditor)return FLOWGRAPHEDITOR;if(FLOWGRAPHEDITOR.default?.FlowGraphEditor)return FLOWGRAPHEDITOR.default}if("undefined"!=typeof BABYLON&&void 0!==BABYLON.FlowGraphEditor)return BABYLON}get scene(){return this._scene}get coordinator(){return this._coordinator}get sceneEventCoordinator(){return this._sceneEventCoordinator}get state(){return this._state}set state(e){this._state=e,this.onStateChangedObservable.notifyObservers(e)}constructor(e){this._BJSFLOWGRAPHEDITOR=this._getGlobalFlowGraphEditor(),this.onStateChangedObservable=new h,this._eventBlocks={SceneReady:[],SceneDispose:[],SceneBeforeRender:[],MeshPick:[],PointerDown:[],PointerUp:[],PointerMove:[],PointerOver:[],PointerOut:[],KeyDown:[],KeyUp:[],SceneAfterRender:[],NoTrigger:[]},this._allBlocks=[],this._executionContexts=[],this._state=0,this._scene=e.scene,this._sceneEventCoordinator=new oe(this._scene),this._coordinator=e.coordinator,this.name=e.name??"Graph",this.uniqueId=e.uniqueId??c()}_attachEventObserver(){this._eventObserver||(this._eventObserver=this._sceneEventCoordinator.onEventTriggeredObservable.add(e=>{if("SceneDispose"!==e.type){if(1===this.state){for(const t of this._executionContexts){const o=this._getContextualOrder(e.type,t);for(const n of o)if(!n._executeEvent(t,e.payload))break}switch(e.type){case"SceneReady":this._sceneEventCoordinator.sceneReadyTriggered=!0;break;case"SceneBeforeRender":for(const t of this._executionContexts)t._notifyOnTick(e.payload)}}}else this.dispose()}))}_detachEventObserver(){this._eventObserver?.remove(),this._eventObserver=null}setScene(e){if(e!==this._scene){1===this.state&&this.stop(),this._detachEventObserver(),this._sceneEventCoordinator.dispose(),this._executionContexts.length=0,this._scene=e,this._scene.constantlyUpdateMeshUnderPointer=!0;for(const t of this._allBlocks)for(const o of t.dataInputs)o._reresolveDefaultValueForScene(e);this._sceneEventCoordinator=new oe(this._scene),this._attachEventObserver()}}createContext(){const e=new R({scene:this._scene,coordinator:this._coordinator,sceneEventCoordinator:this._sceneEventCoordinator});return this._executionContexts.push(e),e}getContext(e){return this._executionContexts[e]}get contextCount(){return this._executionContexts.length}removeContext(e){if(e<0||e>=this._executionContexts.length)return;const[t]=this._executionContexts.splice(e,1);return t._clearPendingBlocks(),t}getAllBlocks(){return this._allBlocks}addBlock(e){-1===this._allBlocks.indexOf(e)&&this._allBlocks.push(e)}removeBlock(e){const t=this._allBlocks.indexOf(e);if(-1!==t&&this._allBlocks.splice(t,1),e instanceof K&&"type"in e){const t=e,o=this._eventBlocks[t.type];if(o){const e=o.indexOf(t);-1!==e&&o.splice(e,1)}}if(e instanceof W)for(const t of this._executionContexts)e._cancelPendingTasks(t),e._resetAfterCanceled(t);for(const t of e.dataInputs)t.disconnectFromAll();for(const t of e.dataOutputs)t.disconnectFromAll();if(e instanceof K){for(const t of e.signalInputs)t.disconnectFromAll();for(const t of e.signalOutputs)t.disconnectFromAll()}}addEventBlock(e){if(this.addBlock(e),"PointerOver"!==e.type&&"PointerOut"!==e.type||(this._scene.constantlyUpdateMeshUnderPointer=!0),this._eventBlocks[e.type].push(e),1===this.state)for(const t of this._executionContexts)e._startPendingTasks(t);else this.onStateChangedObservable.addOnce(t=>{if(1===t)for(const t of this._executionContexts)e._startPendingTasks(t)})}stop(){if(0!==this.state){this._detachEventObserver(),this.state=0;for(const e of this._executionContexts)e._clearPendingBlocks(),e._clearPendingActivation();this._executionContexts.length=0}}pause(){if(1===this.state){this._detachEventObserver(),this.state=2;for(const e of this._executionContexts)e._clearPendingBlocks()}}start(){if(1===this.state)return;const e=2===this.state;0===this._executionContexts.length&&this.createContext(),this._attachEventObserver(),this.state=1,this._startPendingEvents(),e||(this._sceneEventCoordinator.sceneReadyTriggered=!1,this._scene.isReady(!0)?(this._sceneEventCoordinator.sceneReadyTriggered=!0,this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({type:"SceneReady"})):this._scene.executeWhenReady(()=>{1!==this.state||this._sceneEventCoordinator.sceneReadyTriggered||(this._sceneEventCoordinator.sceneReadyTriggered=!0,this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}))},!0))}_startPendingEvents(){for(const e of this._executionContexts)for(const t in this._eventBlocks){const o=this._getContextualOrder(t,e);for(const t of o)t._startPendingTasks(e)}}_getContextualOrder(e,t){const o=this._eventBlocks[e].sort((e,t)=>t.initPriority-e.initPriority);if("MeshPick"===e){const e=[];for(const n of o){const a=n.asset.getValue(t);let s=0;for(;s<o.length;s++){const e=o[s].asset.getValue(t);if(a&&e&&Q(a,e))break}e.splice(s,0,n)}return e}return o}dispose(){if(this._detachEventObserver(),this._sceneEventCoordinator.dispose(),0!==this.state){this.state=0;for(const e of this._executionContexts)e._clearPendingBlocks(),e._clearPendingActivation();this._executionContexts.length=0;for(const e in this._eventBlocks)this._eventBlocks[e].length=0;this._allBlocks.length=0}}visitAllBlocks(e){const t=[],o=new Set;for(const e in this._eventBlocks)for(const n of this._eventBlocks[e])t.push(n),o.add(n.uniqueId);for(;t.length>0;){const n=t.pop();e(n);for(const e of n.dataInputs)for(const n of e._connectedPoint)o.has(n._ownerBlock.uniqueId)||(t.push(n._ownerBlock),o.add(n._ownerBlock.uniqueId));if(n instanceof K)for(const e of n.signalOutputs)for(const n of e._connectedPoint)o.has(n._ownerBlock.uniqueId)||(t.push(n._ownerBlock),o.add(n._ownerBlock.uniqueId))}}validate(){return function(e,t){const o=ce(e),n=new Set;e.visitAllBlocks(e=>{n.add(e.uniqueId)});for(const e of t)if(!n.has(e.uniqueId)){const t={severity:1,message:"Block is unreachable from any event block.",block:e};o.issues.push(t),o.warningCount++;let n=o.issuesByBlock.get(e.uniqueId);n||(n=[],o.issuesByBlock.set(e.uniqueId,n)),n.push(t);for(const t of e.dataInputs)if(!t.optional&&!t.isDisabled&&!t.isConnected()){const a={severity:1,message:`"${t.name}" is not connected and will use its default value.`,block:e,connectionName:t.name};o.issues.push(a),o.warningCount++,n.push(a)}if(e instanceof K&&!he(e)){const t=e.signalInputs.find(e=>"in"===e.name);if(t&&!t.isConnected()){const t={severity:0,message:"Execution block has no incoming signal — it will never execute.",block:e,connectionName:"in"};o.issues.push(t),o.errorCount++,n.push(t)}}}return o.isValid=o.issues.every(e=>0!==e.severity),o.issues.sort((e,t)=>e.severity-t.severity),o}(this,this._allBlocks)}serialize(e={},t){e.name=this.name,e.uniqueId=this.uniqueId,e.allBlocks=[];const o=new Set,n=t=>{if(o.has(t.uniqueId))return;o.add(t.uniqueId);const n={};t.serialize(n),e.allBlocks.push(n)};this.visitAllBlocks(n);for(const e of this._allBlocks)n(e);e.executionContexts=[];for(const o of this._executionContexts){const n={};o.serialize(n,t),e.executionContexts.push(n)}}async edit(e){return await new Promise(t=>{if(this._BJSFLOWGRAPHEDITOR=this._BJSFLOWGRAPHEDITOR||this._getGlobalFlowGraphEditor(),void 0===this._BJSFLOWGRAPHEDITOR){const o=e&&e.editorURL?e.editorURL:ue.EditorURL;f.LoadBabylonScript(o,()=>{this._BJSFLOWGRAPHEDITOR=this._BJSFLOWGRAPHEDITOR||this._getGlobalFlowGraphEditor(),this._createFlowGraphEditor(e?.flowGraphEditorConfig),t()})}else this._createFlowGraphEditor(e?.flowGraphEditorConfig),t()})}_createFlowGraphEditor(e){const t={flowGraph:this,hostScene:this._scene,attachToLiveScene:!0,...e};this._BJSFLOWGRAPHEDITOR.FlowGraphEditor.Show(t)}}ue.EditorURL=`${f._DefaultCdnUrl}/v${g.Version}/flowGraphEditor/babylon.flowGraphEditor.js`;const me="flowgraph://events/";function de(e){return e.startsWith(me)?e.substring(19):void 0}class we{static get OnFlowGraphAddedObservable(){return this._OnFlowGraphAddedObservable}static get OnFlowGraphRemovedObservable(){return this._OnFlowGraphRemovedObservable}constructor(e){this.config=e,this.dispatchEventsSynchronously=!0,this._flowGraphs=[],this._customEventsMap=new Map,this._eventExecutionCounter=new Map,this._executeOnNextFrame=[],this._eventUniqueId=0,this._eventDispatchStack=[],this._disposeObserver=this.config.scene.onDisposeObservable.add(()=>{this.dispose()}),this._onBeforeRenderObserver=this.config.scene.onBeforeRenderObservable.add(()=>{this._eventExecutionCounter.clear();const e=this._executeOnNextFrame.slice(0);if(e.length)for(const t of e){this.notifyCustomEvent(t.id,t.data,!1);const e=this._executeOnNextFrame.findIndex(e=>e.uniqueId===t.uniqueId);-1!==e&&this._executeOnNextFrame.splice(e,1)}});let t=we.SceneCoordinators.get(this.config.scene);t||(t=[],we.SceneCoordinators.set(this.config.scene,t)),t.push(this)}createGraph(e){const t=e??`Graph ${this._flowGraphs.length+1}`,o=new ue({scene:this.config.scene,coordinator:this,name:t});return this._flowGraphs.push(o),we._OnFlowGraphAddedObservable.notifyObservers(o),o}removeGraph(e){const t=this._flowGraphs.indexOf(e);-1!==t&&(e.dispose(),this._flowGraphs.splice(t,1),we._OnFlowGraphRemovedObservable.notifyObservers(e))}start(){for(const e of this._flowGraphs)e.start()}dispose(){for(const e of this._flowGraphs)e.dispose(),we._OnFlowGraphRemovedObservable.notifyObservers(e);this._flowGraphs.length=0,this._disposeObserver?.remove(),this._onBeforeRenderObserver?.remove();const e=we.SceneCoordinators.get(this.config.scene)??[],t=e.indexOf(this);-1!==t&&e.splice(t,1)}serialize(e,t){e._flowGraphs=[];for(const o of this._flowGraphs){const n={};o.serialize(n,t),e._flowGraphs.push(n)}e.dispatchEventsSynchronously=this.dispatchEventsSynchronously}get flowGraphs(){return this._flowGraphs}getCustomEventObservable(e){let t=this._customEventsMap.get(e);return t||(t=new h,this._customEventsMap.set(e,t)),t}notifyCustomEvent(t,o,n=!this.dispatchEventsSynchronously){if(n)return void this._executeOnNextFrame.push({id:t,data:o,uniqueId:this._eventUniqueId++});if(this._eventExecutionCounter.has(t)){const o=this._eventExecutionCounter.get(t);if(this._eventExecutionCounter.set(t,o+1),o>=we.MaxEventTypeExecutionPerFrame)return void(o===we.MaxEventTypeExecutionPerFrame&&e.Warn(`FlowGraphCoordinator: Too many executions of event "${t}".`))}else this._eventExecutionCounter.set(t,1);const a=this._customEventsMap.get(t);a&&a.notifyObservers(o)}_beginEventDispatch(e,t){this._eventDispatchStack.push({eventId:e,state:t})}_endEventDispatch(){this._eventDispatchStack.pop()}stopEventPropagation(e,t){if("string"!=typeof e||!t)return;const o=(this.config.hostResolver?.decodeEventReference??de)(e);if(void 0!==o)for(let e=this._eventDispatchStack.length-1;e>=0;e--)if(this._eventDispatchStack[e].eventId===o)return void(this._eventDispatchStack[e].state.skipNextObservers=!0)}_getEventReference(e){const t=this.config.hostResolver?.encodeEventReference;return t?t(e):function(e){return me+e}(e)}}we.MaxEventsPerType=30,we.MaxEventTypeExecutionPerFrame=30,we.SceneCoordinators=new Map,we._OnFlowGraphAddedObservable=new h,we._OnFlowGraphRemovedObservable=new h;const fe={},ge={};async function ke(e,t){const o=await Promise.all(e.allBlocks.map(async e=>{const t=function(e){switch(e){case"FlowGraphPlayAnimationBlock":return async()=>(await import("./flowGraphPlayAnimationBlock-Cl0EzIf_.esm.min.js")).FlowGraphPlayAnimationBlock;case"FlowGraphStopAnimationBlock":return async()=>(await import("./flowGraphStopAnimationBlock-DSJUd2wm.esm.min.js")).FlowGraphStopAnimationBlock;case"FlowGraphPauseAnimationBlock":return async()=>(await import("./flowGraphPauseAnimationBlock-CfZvktuy.esm.min.js")).FlowGraphPauseAnimationBlock;case"FlowGraphInterpolationBlock":return async()=>(await import("./flowGraphInterpolationBlock-Bor0V7Ps.esm.min.js")).FlowGraphInterpolationBlock;case"FlowGraphSceneReadyEventBlock":return async()=>(await import("./flowGraphSceneReadyEventBlock-m61_AdSg.esm.min.js")).FlowGraphSceneReadyEventBlock;case"FlowGraphSceneTickEventBlock":return async()=>(await import("./flowGraphSceneTickEventBlock-fKzCxM94.esm.min.js")).FlowGraphSceneTickEventBlock;case"FlowGraphSendCustomEventBlock":return async()=>(await import("./flowGraphSendCustomEventBlock-DbAD5DRk.esm.min.js")).FlowGraphSendCustomEventBlock;case"FlowGraphReceiveCustomEventBlock":return async()=>(await import("./flowGraphReceiveCustomEventBlock-CGpodvWk.esm.min.js")).FlowGraphReceiveCustomEventBlock;case"FlowGraphStopEventPropagationBlock":return async()=>(await import("./flowGraphStopEventPropagationBlock-B693CP6n.esm.min.js")).FlowGraphStopEventPropagationBlock;case"FlowGraphMeshPickEventBlock":return async()=>(await import("./flowGraphMeshPickEventBlock-wtrpFUVY.esm.min.js")).FlowGraphMeshPickEventBlock;case"FlowGraphEBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphEBlock;case"FlowGraphPIBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphPiBlock;case"FlowGraphTauBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphTauBlock;case"FlowGraphInfBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphInfBlock;case"FlowGraphNaNBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphNaNBlock;case"FlowGraphRandomBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphRandomBlock;case"FlowGraphAddBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAddBlock;case"FlowGraphSubtractBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSubtractBlock;case"FlowGraphMultiplyBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMultiplyBlock;case"FlowGraphDivideBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphDivideBlock;case"FlowGraphAbsBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAbsBlock;case"FlowGraphSignBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSignBlock;case"FlowGraphTruncBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphTruncBlock;case"FlowGraphFloorBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphFloorBlock;case"FlowGraphCeilBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphCeilBlock;case"FlowGraphRoundBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphRoundBlock;case"FlowGraphFractBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphFractionBlock;case"FlowGraphNegationBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphNegationBlock;case"FlowGraphModuloBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphModuloBlock;case"FlowGraphMinBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMinBlock;case"FlowGraphMaxBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMaxBlock;case"FlowGraphClampBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphClampBlock;case"FlowGraphSaturateBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSaturateBlock;case"FlowGraphMathInterpolationBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMathInterpolationBlock;case"FlowGraphMathSlerpBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMathSlerpBlock;case"FlowGraphSmoothStepBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphMathSmoothStepBlock;case"FlowGraphRGBToOkLChBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphRGBToOkLChBlock;case"FlowGraphRGBFromOkLChBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphRGBFromOkLChBlock;case"FlowGraphEqualityBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphEqualityBlock;case"FlowGraphLessThanBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLessThanBlock;case"FlowGraphLessThanOrEqualBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLessThanOrEqualBlock;case"FlowGraphGreaterThanBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphGreaterThanBlock;case"FlowGraphGreaterThanOrEqualBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphGreaterThanOrEqualBlock;case"FlowGraphIsNaNBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphIsNanBlock;case"FlowGraphIsInfBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphIsInfinityBlock;case"FlowGraphDegToRadBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphDegToRadBlock;case"FlowGraphRadToDegBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphRadToDegBlock;case"FlowGraphSinBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSinBlock;case"FlowGraphCosBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphCosBlock;case"FlowGraphTanBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphTanBlock;case"FlowGraphASinBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAsinBlock;case"FlowGraphACosBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAcosBlock;case"FlowGraphATanBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAtanBlock;case"FlowGraphATan2Block":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAtan2Block;case"FlowGraphSinhBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSinhBlock;case"FlowGraphCoshBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphCoshBlock;case"FlowGraphTanhBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphTanhBlock;case"FlowGraphASinhBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAsinhBlock;case"FlowGraphACoshBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAcoshBlock;case"FlowGraphATanhBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphAtanhBlock;case"FlowGraphExponentialBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphExpBlock;case"FlowGraphLogBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLogBlock;case"FlowGraphLog2Block":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLog2Block;case"FlowGraphLog10Block":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLog10Block;case"FlowGraphSquareRootBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphSquareRootBlock;case"FlowGraphPowerBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphPowerBlock;case"FlowGraphCubeRootBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphCubeRootBlock;case"FlowGraphBitwiseAndBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseAndBlock;case"FlowGraphBitwiseOrBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseOrBlock;case"FlowGraphBitwiseNotBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseNotBlock;case"FlowGraphBitwiseXorBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseXorBlock;case"FlowGraphBitwiseLeftShiftBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseLeftShiftBlock;case"FlowGraphBitwiseRightShiftBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphBitwiseRightShiftBlock;case"FlowGraphLengthBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphLengthBlock;case"FlowGraphNormalizeBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphNormalizeBlock;case"FlowGraphDotBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphDotBlock;case"FlowGraphCrossBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphCrossBlock;case"FlowGraphRotate2DBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphRotate2DBlock;case"FlowGraphRotate3DBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphRotate3DBlock;case"FlowGraphTransposeBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphTransposeBlock;case"FlowGraphDeterminantBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphDeterminantBlock;case"FlowGraphInvertMatrixBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphInvertMatrixBlock;case"FlowGraphMatrixMultiplicationBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphMatrixMultiplicationBlock;case"FlowGraphBranchBlock":return async()=>(await import("./flowGraphBranchBlock-ldPZTnrK.esm.min.js")).FlowGraphBranchBlock;case"FlowGraphSetDelayBlock":return async()=>(await import("./flowGraphSetDelayBlock-DsMKKjQN.esm.min.js")).FlowGraphSetDelayBlock;case"FlowGraphCancelDelayBlock":return async()=>(await import("./flowGraphCancelDelayBlock-CfxuQ0nN.esm.min.js")).FlowGraphCancelDelayBlock;case"FlowGraphCallCounterBlock":return async()=>(await import("./flowGraphCounterBlock-DdP0jL23.esm.min.js")).FlowGraphCallCounterBlock;case"FlowGraphDebounceBlock":return async()=>(await import("./flowGraphDebounceBlock-CMSKiHBZ.esm.min.js")).FlowGraphDebounceBlock;case"FlowGraphThrottleBlock":return async()=>(await import("./flowGraphThrottleBlock-ChRhZVC2.esm.min.js")).FlowGraphThrottleBlock;case"FlowGraphDoNBlock":return async()=>(await import("./flowGraphDoNBlock-CWF93Kc-.esm.min.js")).FlowGraphDoNBlock;case"FlowGraphFlipFlopBlock":return async()=>(await import("./flowGraphFlipFlopBlock-Cy2bXXYy.esm.min.js")).FlowGraphFlipFlopBlock;case"FlowGraphForLoopBlock":return async()=>(await import("./flowGraphForLoopBlock-CxJD0voe.esm.min.js")).FlowGraphForLoopBlock;case"FlowGraphMultiGateBlock":return async()=>(await import("./flowGraphMultiGateBlock-EBDfvfb9.esm.min.js")).FlowGraphMultiGateBlock;case"FlowGraphSequenceBlock":return async()=>(await import("./flowGraphSequenceBlock-CCzQbaye.esm.min.js")).FlowGraphSequenceBlock;case"FlowGraphSwitchBlock":return async()=>(await import("./flowGraphSwitchBlock-BUugW9_V.esm.min.js")).FlowGraphSwitchBlock;case"FlowGraphWaitAllBlock":return async()=>(await import("./flowGraphWaitAllBlock-muhfkXz6.esm.min.js")).FlowGraphWaitAllBlock;case"FlowGraphWhileLoopBlock":return async()=>(await import("./flowGraphWhileLoopBlock-CxGqW0KG.esm.min.js")).FlowGraphWhileLoopBlock;case"FlowGraphConsoleLogBlock":return async()=>(await import("./flowGraphConsoleLogBlock-6ibgNHyb.esm.min.js")).FlowGraphConsoleLogBlock;case"FlowGraphConditionalBlock":return async()=>(await import("./flowGraphConditionalDataBlock-DXm5UHjQ.esm.min.js")).FlowGraphConditionalDataBlock;case"FlowGraphConstantBlock":return async()=>(await import("./flowGraphConstantBlock-CCVDOOzP.esm.min.js")).FlowGraphConstantBlock;case"FlowGraphTransformCoordinatesSystemBlock":return async()=>(await import("./flowGraphTransformCoordinatesSystemBlock-Dcu7ZX5X.esm.min.js")).FlowGraphTransformCoordinatesSystemBlock;case"FlowGraphGetAssetBlock":return async()=>(await import("./flowGraphGetAssetBlock-hHsexA9h.esm.min.js")).FlowGraphGetAssetBlock;case"FlowGraphGetPropertyBlock":return async()=>(await import("./flowGraphGetPropertyBlock-Bj4WPGTJ.esm.min.js")).FlowGraphGetPropertyBlock;case"FlowGraphSetPropertyBlock":return async()=>(await import("./flowGraphSetPropertyBlock-BIEJUs35.esm.min.js")).FlowGraphSetPropertyBlock;case"FlowGraphGetVariableBlock":return async()=>(await import("./flowGraphGetVariableBlock--sdJ1VG7.esm.min.js")).FlowGraphGetVariableBlock;case"FlowGraphSetVariableBlock":return async()=>(await import("./flowGraphSetVariableBlock-CQFx9m6o.esm.min.js")).FlowGraphSetVariableBlock;case"FlowGraphJsonPointerParserBlock":return async()=>(await import("./flowGraphJsonPointerParserBlock-CpPYFKl0.esm.min.js")).FlowGraphJsonPointerParserBlock;case"FlowGraphLeadingZerosBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphLeadingZerosBlock;case"FlowGraphTrailingZerosBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphTrailingZerosBlock;case"FlowGraphOneBitsCounterBlock":return async()=>(await import("./flowGraphMathBlocks-DtSBwx8p.esm.min.js")).FlowGraphOneBitsCounterBlock;case"FlowGraphCombineVector2Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineVector2Block;case"FlowGraphCombineVector3Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineVector3Block;case"FlowGraphCombineVector4Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineVector4Block;case"FlowGraphCombineMatrixBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineMatrixBlock;case"FlowGraphCombineMatrix2DBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineMatrix2DBlock;case"FlowGraphCombineMatrix3DBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphCombineMatrix3DBlock;case"FlowGraphExtractVector2Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractVector2Block;case"FlowGraphExtractVector3Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractVector3Block;case"FlowGraphExtractVector4Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractVector4Block;case"FlowGraphExtractMatrixBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractMatrixBlock;case"FlowGraphExtractMatrix2DBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractMatrix2DBlock;case"FlowGraphExtractMatrix3DBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-BR2O6bNx.esm.min.js")).FlowGraphExtractMatrix3DBlock;case"FlowGraphTransformVectorBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphTransformBlock;case"FlowGraphTransformCoordinatesBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphTransformCoordinatesBlock;case"FlowGraphConjugateBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphConjugateBlock;case"FlowGraphAngleBetweenBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphAngleBetweenBlock;case"FlowGraphQuaternionFromAxisAngleBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphQuaternionFromAxisAngleBlock;case"FlowGraphAxisAngleFromQuaternionBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphAxisAngleFromQuaternionBlock;case"FlowGraphQuaternionFromDirectionsBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphQuaternionFromDirectionsBlock;case"FlowGraphQuaternionFromUpForwardBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphQuaternionFromUpForwardBlock;case"FlowGraphQuaternionFromAnglesBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphQuaternionFromAnglesBlock;case"FlowGraphVectorSlerpBlock":return async()=>(await import("./flowGraphVectorMathBlocks-B74i8mHY.esm.min.js")).FlowGraphVectorSlerpBlock;case"FlowGraphMatrixDecompose":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphMatrixDecomposeBlock;case"FlowGraphMatrixCompose":return async()=>(await import("./flowGraphMatrixMathBlocks-DMz2stO3.esm.min.js")).FlowGraphMatrixComposeBlock;case"FlowGraphBooleanToFloat":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphBooleanToFloat;case"FlowGraphBooleanToInt":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphBooleanToInt;case"FlowGraphFloatToBoolean":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphFloatToBoolean;case"FlowGraphIntToBoolean":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphIntToBoolean;case"FlowGraphIntToFloat":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphIntToFloat;case"FlowGraphFloatToInt":return async()=>(await import("./flowGraphTypeToTypeBlocks-BJqksZAd.esm.min.js")).FlowGraphFloatToInt;case"FlowGraphEasingBlock":return async()=>(await import("./flowGraphEasingBlock-D4LrUVGs.esm.min.js")).FlowGraphEasingBlock;case"FlowGraphBezierCurveEasing":return async()=>(await import("./flowGraphBezierCurveEasingBlock-Ca4OvWNG.esm.min.js")).FlowGraphBezierCurveEasingBlock;case"FlowGraphPointerOverEventBlock":return async()=>(await import("./flowGraphPointerOverEventBlock-BpYQ4lfC.esm.min.js")).FlowGraphPointerOverEventBlock;case"FlowGraphPointerOutEventBlock":return async()=>(await import("./flowGraphPointerOutEventBlock-DbBiL1JG.esm.min.js")).FlowGraphPointerOutEventBlock;case"FlowGraphPointerDownEventBlock":return async()=>(await import("./flowGraphPointerDownEventBlock-DCRSCaKY.esm.min.js")).FlowGraphPointerDownEventBlock;case"FlowGraphPointerUpEventBlock":return async()=>(await import("./flowGraphPointerUpEventBlock-bcQh27bG.esm.min.js")).FlowGraphPointerUpEventBlock;case"FlowGraphPointerMoveEventBlock":return async()=>(await import("./flowGraphPointerMoveEventBlock-ki_00Rth.esm.min.js")).FlowGraphPointerMoveEventBlock;case"FlowGraphKeyDownEventBlock":return async()=>(await import("./flowGraphKeyDownEventBlock-Cng8Cn-f.esm.min.js")).FlowGraphKeyDownEventBlock;case"FlowGraphKeyUpEventBlock":return async()=>(await import("./flowGraphKeyUpEventBlock-6t9v-UZ0.esm.min.js")).FlowGraphKeyUpEventBlock;case"FlowGraphIsKeyPressedBlock":return async()=>(await import("./flowGraphIsKeyPressedBlock-C1sd8Qp5.esm.min.js")).FlowGraphIsKeyPressedBlock;case"FlowGraphContextBlock":return async()=>(await import("./flowGraphContextBlock-DkLHfjt6.esm.min.js")).FlowGraphContextBlock;case"FlowGraphArrayIndexBlock":return async()=>(await import("./flowGraphArrayIndexBlock-ByUj4L9X.esm.min.js")).FlowGraphArrayIndexBlock;case"FlowGraphCodeExecutionBlock":return async()=>(await import("./flowGraphCodeExecutionBlock-CY7ST2JA.esm.min.js")).FlowGraphCodeExecutionBlock;case"FlowGraphIndexOfBlock":return async()=>(await import("./flowGraphIndexOfBlock-BrAQyosD.esm.min.js")).FlowGraphIndexOfBlock;case"FlowGraphFunctionReference":return async()=>(await import("./flowGraphFunctionReferenceBlock-DA2Jqa9g.esm.min.js")).FlowGraphFunctionReferenceBlock;case"FlowGraphDataSwitchBlock":return async()=>(await import("./flowGraphDataSwitchBlock-B2RjOYNq.esm.min.js")).FlowGraphDataSwitchBlock;case"FlowGraphDebugBlock":return async()=>(await import("./flowGraphDebugBlock-dgaslJKX.esm.min.js")).FlowGraphDebugBlock;case"FlowGraphPhysicsCollisionEventBlock":return async()=>(await import("./flowGraphPhysicsCollisionEventBlock-BcssqIvq.esm.min.js")).FlowGraphPhysicsCollisionEventBlock;case"FlowGraphApplyForceBlock":return async()=>(await import("./flowGraphApplyForceBlock-BI1s9sME.esm.min.js")).FlowGraphApplyForceBlock;case"FlowGraphApplyImpulseBlock":return async()=>(await import("./flowGraphApplyImpulseBlock-B-Uccu80.esm.min.js")).FlowGraphApplyImpulseBlock;case"FlowGraphSetLinearVelocityBlock":return async()=>(await import("./flowGraphSetLinearVelocityBlock-B2Oamtyq.esm.min.js")).FlowGraphSetLinearVelocityBlock;case"FlowGraphSetAngularVelocityBlock":return async()=>(await import("./flowGraphSetAngularVelocityBlock-YurQmiLO.esm.min.js")).FlowGraphSetAngularVelocityBlock;case"FlowGraphSetPhysicsMotionTypeBlock":return async()=>(await import("./flowGraphSetPhysicsMotionTypeBlock-QY5IXH_r.esm.min.js")).FlowGraphSetPhysicsMotionTypeBlock;case"FlowGraphGetLinearVelocityBlock":return async()=>(await import("./flowGraphGetLinearVelocityBlock-BUFynrD3.esm.min.js")).FlowGraphGetLinearVelocityBlock;case"FlowGraphGetAngularVelocityBlock":return async()=>(await import("./flowGraphGetAngularVelocityBlock-Da6sr1ir.esm.min.js")).FlowGraphGetAngularVelocityBlock;case"FlowGraphGetPhysicsMassPropertiesBlock":return async()=>(await import("./flowGraphGetPhysicsMassPropertiesBlock-BLk3aP94.esm.min.js")).FlowGraphGetPhysicsMassPropertiesBlock;case"FlowGraphPlaySoundBlock":return async()=>(await import("./flowGraphPlaySoundBlock-DxPKIICg.esm.min.js")).FlowGraphPlaySoundBlock;case"FlowGraphStopSoundBlock":return async()=>(await import("./flowGraphStopSoundBlock-bcUY_-6_.esm.min.js")).FlowGraphStopSoundBlock;case"FlowGraphPauseSoundBlock":return async()=>(await import("./flowGraphPauseSoundBlock-BxpP7zdx.esm.min.js")).FlowGraphPauseSoundBlock;case"FlowGraphSetSoundVolumeBlock":return async()=>(await import("./flowGraphSetSoundVolumeBlock-DoGBSGLG.esm.min.js")).FlowGraphSetSoundVolumeBlock;case"FlowGraphSoundEndedEventBlock":return async()=>(await import("./flowGraphSoundEndedEventBlock-DcfBau-O.esm.min.js")).FlowGraphSoundEndedEventBlock;case"FlowGraphGetSoundVolumeBlock":return async()=>(await import("./flowGraphGetSoundVolumeBlock-QIK_VLf8.esm.min.js")).FlowGraphGetSoundVolumeBlock;case"FlowGraphIsSoundPlayingBlock":return async()=>(await import("./flowGraphIsSoundPlayingBlock-BeSBPQ87.esm.min.js")).FlowGraphIsSoundPlayingBlock;default:if(fe[e])return fe[e];if(!e.includes("/")){const t=ge[e];if(t&&fe[t])return fe[t]}throw new Error(`Unknown block name ${e}`)}}(e.className);return await t()}));return function(e,t,o){const n=t.coordinator.createGraph();e.name&&(n.name=e.name);e.uniqueId&&(n.uniqueId=e.uniqueId);const a=[],s=t.valueParseFunction??P;for(let r=0;r<e.allBlocks.length;r++){const i=Ge(e.allBlocks[r],{scene:t.coordinator.config.scene,pathConverter:t.pathConverter,assetsContainer:t.coordinator.config.scene,valueParseFunction:s},o[r]);a.push(i),n.addBlock(i),i instanceof ne&&n.addEventBlock(i)}const r=new Map,i=new Map,l=new Map,c=new Map;for(const e of a){for(const t of e.dataInputs)r.set(t.uniqueId,t);for(const t of e.dataOutputs)i.set(t.uniqueId,t);if(e instanceof K){for(const t of e.signalInputs)l.set(t.uniqueId,t);for(const t of e.signalOutputs)c.set(t.uniqueId,t)}}const h=(e,t)=>{-1===e._connectedPoint.indexOf(t)&&e.connectTo(t)};for(const e of a){for(const t of e.dataInputs)for(const e of t.connectedPointIds){const o=i.get(e);if(!o)throw new Error("Could not find data out connection with unique id "+e);h(t,o)}for(const t of e.dataOutputs)for(const e of t.connectedPointIds){const o=r.get(e);if(!o)throw new Error("Could not find data in connection with unique id "+e);h(t,o)}if(e instanceof K){for(const t of e.signalOutputs)for(const e of t.connectedPointIds){const o=l.get(e);if(!o)throw new Error("Could not find signal in connection with unique id "+e);h(t,o)}for(const t of e.signalInputs)for(const e of t.connectedPointIds){const o=c.get(e);if(!o)throw new Error("Could not find signal out connection with unique id "+e);h(o,t)}}}for(const t of e.executionContexts??[])ye(t,{graph:n,valueParseFunction:s},e.rightHanded);return n}(e,t,o)}function ye(e,t,o){const n=t.graph.createContext();e.enableLogging&&(n.enableLogging=!0),n.treatDataAsRightHanded=o||!1;const a=t.valueParseFunction??P;n.uniqueId=e.uniqueId,n.name=e.name??"";const s=n.getScene();if(e._assetsContext){const t=e._assetsContext,o={meshes:t.meshes?.map(e=>s.getMeshById(e)),lights:t.lights?.map(e=>s.getLightByName(e)),cameras:t.cameras?.map(e=>s.getCameraByName(e)),materials:t.materials?.map(e=>s.getMaterialById(e)),textures:t.textures?.map(e=>s.getTextureByName(e)),animations:t.animations?.map(e=>s.animations.find(t=>t.name===e)),skeletons:t.skeletons?.map(e=>s.getSkeletonByName(e)),particleSystems:t.particleSystems?.map(e=>s.getParticleSystemById(e)),animationGroups:t.animationGroups?.map(e=>s.getAnimationGroupByName(e)),transformNodes:t.transformNodes?.map(e=>s.getTransformNodeById(e)),rootNodes:[],multiMaterials:[],morphTargetManagers:[],geometries:[],actionManagers:[],environmentTexture:null,postProcesses:[],sounds:null,effectLayers:[],layers:[],reflectionProbes:[],lensFlareSystems:[],proceduralTextures:[],getNodes:function(){throw new Error("Function not implemented.")}};n.assetsContext=o}for(const t in e._userVariables){const o=a(t,e._userVariables,n.assetsContext,s);n.userVariables[t]=o}if(e._variableTypes)for(const t in e._variableTypes)n.setVariableType(t,e._variableTypes[t]);for(const t in e._connectionValues){const o=a(t,e._connectionValues,n.assetsContext,s);n._setConnectionValueByKey(t,o)}return n}function Ge(e,t,o){const n={},a=t.valueParseFunction??P;if(e.config)for(const o in e.config)n[o]=a(o,e.config,t.assetsContainer||t.scene,t.scene);if("FlowGraphJsonPointerParserBlock"===e.className){if(!t.pathConverter)throw new Error("Block "+e.className+" requires a path converter to be provided in parse options.");n.pathConverter=t.pathConverter}const s=new o(n);s.uniqueId=e.uniqueId;for(let o=0;o<e.dataInputs.length;o++){const n=s.getDataInput(e.dataInputs[o].name);if(!n)throw new Error("Could not find data input with name "+e.dataInputs[o].name+" in block "+e.className);n.deserialize(e.dataInputs[o]),void 0!==e.dataInputs[o].defaultValue&&(n._defaultValue=a("defaultValue",e.dataInputs[o],t.assetsContainer||t.scene,t.scene))}for(let t=0;t<e.dataOutputs.length;t++){const o=s.getDataOutput(e.dataOutputs[t].name);if(!o)throw new Error("Could not find data output with name "+e.dataOutputs[t].name+" in block "+e.className);o.deserialize(e.dataOutputs[t])}return s.metadata=e.metadata,s.deserialize&&s.deserialize(e),s}const _e={float:{length:1,flowGraphType:"number",elementType:"number"},bool:{length:1,flowGraphType:"boolean",elementType:"boolean"},float2:{length:2,flowGraphType:"Vector2",elementType:"number"},float3:{length:3,flowGraphType:"Vector3",elementType:"number"},float4:{length:4,flowGraphType:"Vector4",elementType:"number"},float4x4:{length:16,flowGraphType:"Matrix",elementType:"number"},float2x2:{length:4,flowGraphType:"Matrix2D",elementType:"number"},float3x3:{length:9,flowGraphType:"Matrix3D",elementType:"number"},int:{length:1,flowGraphType:"FlowGraphInteger",elementType:"number"},ref:{length:1,flowGraphType:"string",elementType:"string"}};class Be{constructor(e,t,o=60){this._interactivityGraph=e,this._gltf=t,this._animationTargetFps=o,this._types=[],this._mappings=[],this._staticVariables=[],this._events=[],this._internalEventsCounter=0,this._nodes=[],this._insertedBlocks=[],this._parseTypes(),this._parseDeclarations(),this._parseVariables(),this._parseEvents(),this._parseNodes()}get arrays(){return{types:this._types,mappings:this._mappings,staticVariables:this._staticVariables,events:this._events,nodes:this._nodes}}_parseTypes(){if(this._interactivityGraph.types)for(const e of this._interactivityGraph.types)this._types.push(_e[e.signature])}_parseDeclarations(){if(this._interactivityGraph.declarations)for(const t of this._interactivityGraph.declarations){const o=I(t);if(!o)throw e.Error(["No mapping found for declaration",t]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:o,fullOperationName:t.extension?t.op+":"+t.extension:t.op})}}_parseVariables(){if(this._interactivityGraph.variables)for(const e of this._interactivityGraph.variables){const t=this._parseVariable(e);this._staticVariables.push(t)}}_parseVariable(t,o){const n=this._types[t.type];if(!n)throw e.Error(["No type found for variable",t]),new Error("Error parsing variables");if(t.value&&t.value.length!==n.length)throw e.Error(["Invalid value length for variable",t,n]),new Error("Error parsing variables");const a=t.value||[];if(!a.length)switch(n.flowGraphType){case"boolean":a.push(!1);break;case"FlowGraphInteger":a.push(0);break;case"number":a.push(NaN);break;case"string":a.push("");break;case"Vector2":a.push(NaN,NaN);break;case"Vector3":a.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":a.fill(NaN,0,4);break;case"Matrix":a.fill(NaN,0,16);break;case"Matrix3D":a.fill(NaN,0,9)}return"number"===n.elementType&&"string"==typeof a[0]&&(a[0]=parseFloat(a[0])),{type:n.flowGraphType,value:o?o(a,this):a}}_parseEvents(){if(this._interactivityGraph.events)for(const t of this._interactivityGraph.events){const o={eventId:t.id||"internalEvent_"+this._internalEventsCounter++};t.values&&(o.eventData=Object.keys(t.values).map(o=>{const n=t.values?.[o];if(!n)throw e.Error(["No value found for event key",o]),new Error("Error parsing events");const a=this._types[n.type];if(!a)throw e.Error(["No type found for event value",n]),new Error("Error parsing events");const s=void 0!==n.value?this._parseVariable(n):void 0;return{id:o,type:a.flowGraphType,eventData:!0,value:s}})),this._events.push(o)}}_parseNodes(){if(this._interactivityGraph.nodes)for(const t of this._interactivityGraph.nodes){if("number"!=typeof t.declaration)throw e.Error(["No declaration found for node",t]),new Error("Error parsing nodes");const o=this._mappings[t.declaration];if(!o)throw e.Error(["No mapping found for node",t]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation){const e=o.flowGraphMapping.validation(t,this._interactivityGraph,this._gltf);if(!e.valid)throw new Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[t.declaration].op} - ${e.error}`)}const n=[];for(const e of o.flowGraphMapping.blocks){const a=this._getEmptyBlock(e,o.fullOperationName);this._parseNodeConfiguration(t,a,o.flowGraphMapping,e),n.push(a)}this._nodes.push({blocks:n,fullOperationName:o.fullOperationName})}}_getEmptyBlock(e,t){return{uniqueId:c(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}}_parseNodeConfiguration(t,o,n,a){const s=t.configuration;if(s)for(const t in s){const r=s[t];if(!r)throw new Error("Error parsing node configuration");const i=n.configuration?.[t];if(i&&i.toBlock?i.toBlock===a:0===n.blocks.indexOf(a)){let n=i?.defaultValue;r?.value&&(n=r.value),i?.isArray||(1!==n.length&&e.Warn(`Invalid non-array value length: ${n.length}`),n=n[0]),i?.dataTransformer&&(n=i.dataTransformer(n,this)),void 0!==n&&(o.config[i?.name||t]={value:n})}}}_parseNodeConnections(t){for(let o=0;o<this._nodes.length;o++){const n=this._interactivityGraph.nodes?.[o];if(!n)throw e.Error(["No node found for interactivity node",this._nodes[o]]),new Error("Error parsing node connections");const a=this._nodes[o],s=this._mappings[n.declaration];if(!s)throw e.Error(["No mapping found for node",n]),new Error("Error parsing node connections");if(0===a.blocks.length){e.Warn(`Skipping connections for no-op node #${o} (unsupported operation: ${a.fullOperationName})`);continue}const r=n.flows||{},i=Object.keys(r).sort();for(const t of i){const n=r[t],i=s.flowGraphMapping.outputs?.flows?.[t],l=i?.name||t,c=n.node,h=this._nodes[c];if(!h)throw e.Error(["No node found for input node id",c]),new Error("Error parsing node connections");if(0===h.blocks.length){e.Warn(`Dropping flow connection from node #${o} "${t}" to no-op node #${c} (unsupported operation: ${h.fullOperationName})`);continue}const p=this._createNewSocketConnection(l,!0);(i&&i.toBlock&&a.blocks.find(e=>e.className===i.toBlock)||a.blocks[0]).signalOutputs.push(p);const u=O(h.fullOperationName);if(!u)throw e.Error(["No mapping found for input node",h]),new Error("Error parsing node connections");let m=u.inputs?.flows?.[n.socket||"in"],d=!1;if(!m)for(const e in u.inputs?.flows)e.startsWith("[")&&e.endsWith("]")&&(d=!0,m=u.inputs?.flows?.[e]);const w=m?d?m.name.replace("$1",n.socket||""):m.name:n.socket||"in",f=m&&m.toBlock&&h.blocks.find(e=>e.className===m.toBlock)||h.blocks[0];let g=f.signalInputs.find(e=>e.name===w);g||(g=this._createNewSocketConnection(w),f.signalInputs.push(g)),g.connectedPointIds.push(p.uniqueId),p.connectedPointIds.push(g.uniqueId)}const l=n.values||{},c=Object.keys(l);for(const n of c){const r=l[n];let i=s.flowGraphMapping.inputs?.values?.[n],c=!1;if(!i)for(const e in s.flowGraphMapping.inputs?.values)e.startsWith("[")&&e.endsWith("]")&&(c=!0,i=s.flowGraphMapping.inputs?.values?.[e]);const h=i?c?i.name.replace("$1",n):i.name:n,p=this._createNewSocketConnection(h);(i&&i.toBlock&&a.blocks.find(e=>e.className===i.toBlock)||a.blocks[0]).dataInputs.push(p);const u=!!i?.convertConnectedTimeToFrames;if(void 0!==r.value){const e=this._parseVariable(r,i&&i.dataTransformer);t._connectionValues[p.uniqueId]=e}else{if(void 0===r.node)throw e.Error(["Invalid value for value connection",r]),new Error("Error parsing node connections");{const a=r.node,s=r.socket||"value",i=this._nodes[a];if(!i)throw e.Error(["No node found for output socket reference",r]),new Error("Error parsing node connections");if(0===i.blocks.length){e.Warn(`Dropping value connection from no-op node #${a} (unsupported operation: ${i.fullOperationName}) into node #${o} "${n}"; consumer will use type-default value`);continue}const l=O(i.fullOperationName);if(!l)throw e.Error(["No mapping found for output socket reference",r]),new Error("Error parsing node connections");let c=l.outputs?.values?.[s],h=!1;if(!c)for(const e in l.outputs?.values)e.startsWith("[")&&e.endsWith("]")&&(h=!0,c=l.outputs?.values?.[e]);const m=c?h?c.name.replace("$1",s):c?.name:s,d=c&&c.toBlock&&i.blocks.find(e=>e.className===c.toBlock)||i.blocks[0];let w=d.dataOutputs.find(e=>e.name===m);w||(w=this._createNewSocketConnection(m,!0),d.dataOutputs.push(w)),u?this._connectWithSecondsToFramesConversion(t,w,p):(p.connectedPointIds.push(w.uniqueId),w.connectedPointIds.push(p.uniqueId))}}}if(s.flowGraphMapping.interBlockConnectors)for(const e of s.flowGraphMapping.interBlockConnectors){const t=e.input,o=e.output,n=e.isVariable;this._connectFlowGraphNodes(t,o,a.blocks[e.inputBlockIndex],a.blocks[e.outputBlockIndex],n)}if(s.flowGraphMapping.extraProcessor){const o=this._interactivityGraph.declarations?.[n.declaration];if(!o)throw e.Error(["No declaration found for extra processor",n]),new Error("Error parsing node connections");a.blocks=s.flowGraphMapping.extraProcessor(n,o,s.flowGraphMapping,this,a.blocks,t,this._gltf)}}}_createNewSocketConnection(e,t){return{uniqueId:c(),name:e,_connectionType:t?1:0,connectedPointIds:[]}}_connectWithSecondsToFramesConversion(e,t,o){const n=this._getEmptyBlock("FlowGraphMultiplyBlock","FlowGraphMultiplyBlock");n.config={type:"number"};const a=this._createNewSocketConnection("a"),s=this._createNewSocketConnection("b"),r=this._createNewSocketConnection("value",!0);n.dataInputs.push(a,s),n.dataOutputs.push(r),e._connectionValues[s.uniqueId]={type:"number",value:[this._animationTargetFps]},a.connectedPointIds.push(t.uniqueId),t.connectedPointIds.push(a.uniqueId),o.connectedPointIds.push(r.uniqueId),r.connectedPointIds.push(o.uniqueId),this._insertedBlocks.push(n)}_connectFlowGraphNodes(e,t,o,n,a){const s=a?o.dataInputs:o.signalInputs,r=a?n.dataOutputs:n.signalOutputs,i=s.find(t=>t.name===e)||this._createNewSocketConnection(e),l=r.find(e=>e.name===t)||this._createNewSocketConnection(t,!0);s.find(t=>t.name===e)||s.push(i),r.find(e=>e.name===t)||r.push(l),i.connectedPointIds.push(l.uniqueId),l.connectedPointIds.push(i.uniqueId)}getVariableName(e){return"staticVariable_"+e}serializeToFlowGraph(){const e={uniqueId:c(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(let t=0;t<this._staticVariables.length;t++){const o=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=o}return{rightHanded:!0,allBlocks:this._nodes.reduce((e,t)=>e.concat(t.blocks),[]).concat(this._insertedBlocks),executionContexts:[e]}}}class ve{constructor(e,t){this._prefixes=e,this._fallback=t}addPrefix(e){this._prefixes.unshift(e)}convert(e){for(const{prefix:t,converter:o}of this._prefixes)if(e.startsWith(t))return o.convert(e);return this._fallback.convert(e)}}const be="/extensions/BABYLON_scene_objects/";class Fe{constructor(e,t){this._scene=e,this._tree=t}convert(e){if(!e.startsWith(be))throw new Error(`BabylonScenePathToObjectConverter: path "${e}" does not start with the expected prefix "${be}".`);const t=e.slice(34).split("/").filter(e=>e.length>0);if(0===t.length)throw new Error(`BabylonScenePathToObjectConverter: path "${e}" is missing a collection name.`);const o=t[0],n=this._tree[o];if(!n)throw new Error(`BabylonScenePathToObjectConverter: unknown collection "${o}" in path "${e}".`);if(2===t.length&&"length"===t[1]){return{object:this._getCollectionArray(o),info:n.length}}if(t.length<2)throw new Error(`BabylonScenePathToObjectConverter: path "${e}" is missing an instance id.`);if(!/^\d+$/.test(t[1]))throw new Error(`BabylonScenePathToObjectConverter: invalid uniqueId "${t[1]}" in path "${e}".`);const a=parseInt(t[1],10);if(!Number.isFinite(a)||a<0)throw new Error(`BabylonScenePathToObjectConverter: invalid uniqueId "${t[1]}" in path "${e}".`);const s=this._lookupInstanceByUniqueId(o,a);if(!s)throw new Error(`BabylonScenePathToObjectConverter: no ${o} instance found with uniqueId ${a} (path "${e}").`);if(2===t.length)return{object:s,info:this._buildIdentityAccessor(s)};if(t.length>3)throw new Error(`BabylonScenePathToObjectConverter: nested property paths are not yet supported (path "${e}").`);const r=t[2],i=n.__array__[r];if(!i||"boolean"==typeof i)throw new Error(`BabylonScenePathToObjectConverter: property "${r}" is not registered on ${o} (path "${e}").`);return{object:s,info:i}}_getCollectionArray(e){switch(e){case"transformNodes":return this._scene.transformNodes;case"meshes":return this._scene.meshes;case"materials":return this._scene.materials;default:return[]}}_lookupInstanceByUniqueId(e,t){switch(e){case"transformNodes":{const e=this._scene.transformNodes.find(e=>e.uniqueId===t);return e||this._scene.meshes.find(e=>e.uniqueId===t)}case"meshes":return this._scene.meshes.find(e=>e.uniqueId===t);case"materials":return this._scene.materials.find(e=>e.uniqueId===t);default:return}}_buildIdentityAccessor(e){return{type:"object",get:()=>e,getTarget:()=>e,isReadOnly:!0}}}v();const Ce="/extensions/KHR_interactivity/events/",xe="/extensions/KHR_interactivity/delays/";function Ee(e){return"string"==typeof(t=e)&&t.startsWith(Ce)?e.substring(37):void 0;var t}const Ie="activeDelayIndices";function Oe(e,t){(function(e){let t=e._getGlobalContextVariable(Ie,null);return t||(t=new Set,e._setGlobalContextVariable(Ie,t)),t})(e).add(t)}function Te(e,t){e._getGlobalContextVariable(Ie,null)?.delete(t)}function Me(e,t){return e._getGlobalContextVariable(Ie,null)?.has(t)??!1}const Se={isKhrInteractivityRef:!0};class Pe{convert(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.startsWith(Ce)){const e=t.substring(37);return{object:Se,info:{type:"object",isReadOnly:!0,get:()=>e.length>0?t:void 0,getTarget:()=>Se}}}const o=t.substring(37),n=/^\d+$/.test(o)?parseInt(o,10):NaN;return{object:Se,info:{type:"object",isReadOnly:!0,get:(e,t,o)=>{const a=o;if(!(!a||isNaN(n)||n<0))return Me(a,n)?new B(n):void 0},getTarget:()=>Se}}}}const Ve="/extensions/KHR_interactivity/asset/",je="/extensions/KHR_interactivity/limits/",Ne={major:2,minor:0},Ae=2147483647,Re={maxActiveAnimations:Ae,maxActiveDelays:Ae,maxActivePropertyInterpolations:Ae,maxActiveVariableInterpolations:Ae},De={isKhrInteractivityAssetCapability:!0};class qe{constructor(e,t){this._gltf=e,this._isExtensionEnabled=t}convert(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.startsWith(je)){const o=Re[t.substring(37)];if(void 0===o)throw new Error(`Path ${e} is invalid`);return this._createAccessor("number",()=>o)}const o=t.substring(36);if("majorVersion"===o||"minorVersion"===o)return this._createAccessor("number",()=>function(e){const[t,o]=(e??"").split("."),n=parseInt(t,10),a=parseInt(o,10);return isNaN(n)?Ne:n!==Ne.major?n<Ne.major?{major:n,minor:isNaN(a)?0:a}:Ne:{major:n,minor:Math.min(isNaN(a)?0:a,Ne.minor)}}(this._gltf.asset?.version)["majorVersion"===o?"major":"minor"]);const n=o.split("/");if(3===n.length&&"extensions"===n[0]&&"enabled"===n[2]){const e=n[1];return this._createAccessor("boolean",()=>this._isExtensionEnabled(e))}throw new Error(`Path ${e} is invalid`)}_createAccessor(e,t){return{object:De,info:{type:e,isReadOnly:!0,get:t,getTarget:()=>De}}}}class Le{encodeEventReference(e){return function(e){return Ce+e}(e)}decodeEventReference(e){return Ee(e)}decodeIndexReference(e){if(0===e.length||"/"!==e[0])return;const t=e.substring(e.lastIndexOf("/")+1);return/^(0|[1-9]\d*)$/.test(t)?parseInt(t,10):void 0}getObjectReference(e,t){const o=e._internalMetadata?.gltf?.pointers;if(!Array.isArray(o))return;const n=o.filter(e=>"string"==typeof e);if(0!==n.length){if(t){const e=n.find(e=>e.split("/")[1]===t);if(e)return e}return n[0]}}}const $e="KHR_interactivity";let He=class{constructor(e){this._loader=e,this.name=$e,this.enabled=this._loader.isExtensionUsed($e),this._gltfPathConverter=b(this._loader.gltf);const t=e.babylonScene;if(this._gltfPathConverter){const e=[];t&&e.push({prefix:be,converter:new Fe(t,{transformNodes:{length:{type:"number",get:e=>e.length,getTarget:e=>e},__array__:{__target__:!0,name:{type:"string",get:e=>e.name,set:(e,t)=>{t.name=e},getTarget:e=>e},translation:{type:"Vector3",get:e=>e.position,set:(e,t)=>t.position.copyFrom(e),getTarget:e=>e},rotation:{type:"Quaternion",get:e=>e.rotationQuaternion??s.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z),set:(e,t)=>{t.rotationQuaternion?t.rotationQuaternion.copyFrom(e):t.rotationQuaternion=e.clone()},getTarget:e=>e},scale:{type:"Vector3",get:e=>e.scaling,set:(e,t)=>t.scaling.copyFrom(e),getTarget:e=>e},matrix:{type:"Matrix",get:e=>e.computeWorldMatrix(!1),getTarget:e=>e,isReadOnly:!0},globalMatrix:{type:"Matrix",get:e=>e.computeWorldMatrix(!0),getTarget:e=>e,isReadOnly:!0}}},meshes:{length:{type:"number",get:e=>e.length,getTarget:e=>e},__array__:{__target__:!0,name:{type:"string",get:e=>e.name,set:(e,t)=>{t.name=e},getTarget:e=>e},visible:{type:"boolean",get:e=>e.isVisible,set:(e,t)=>{t.isVisible=e},getTarget:e=>e}}},materials:{length:{type:"number",get:e=>e.length,getTarget:e=>e},__array__:{__target__:!0,name:{type:"string",get:e=>e.name,set:(e,t)=>{t.name=e},getTarget:e=>e}}}})});const o=new Pe;e.push({prefix:Ce,converter:o}),e.push({prefix:xe,converter:o});const n=new Set((this._loader.gltf.extensionsUsed??[]).filter(e=>k.has(e)&&!1!==this._loader.parent.extensionOptions[e]?.enabled)),a=new qe(this._loader.gltf,e=>n.has(e));e.push({prefix:Ve,converter:a}),e.push({prefix:je,converter:a}),this._pathConverter=new ve(e,this._gltfPathConverter)}e._skipStartAnimationStep=!0,t&&Ke(t)}dispose(){this._loader=null,delete this._gltfPathConverter,delete this._pathConverter}async onReady(){if(!this._loader.babylonScene||!this._pathConverter)return;const t=this._loader.babylonScene,o=this._loader.gltf.extensions?.KHR_interactivity;o&&await Promise.all(o.graphs.map(async(o,n)=>{const a=new we({scene:t,hostResolver:new Le});a.dispatchEventsSynchronously=!1;try{const e=new Be(o,this._loader.gltf,this._loader.parent.targetFps);await ke(e.serializeToFlowGraph(),{coordinator:a,pathConverter:this._pathConverter}),a.start()}catch(t){e.Error(`KHR_interactivity: rejecting behavior graph #${n}: ${t?.message??t}`),a.dispose()}}))}};function Ke(e){F("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:()=>{if(!e.activeCamera)return new s(NaN,NaN,NaN,NaN);const t=s.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/position",{get:()=>{if(!e.activeCamera)return new n(NaN,NaN,NaN);const t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:()=>e.activeCamera});const t=t=>{const o=e.activeCamera;return o&&o.mode!==y.ORTHOGRAPHIC_CAMERA?t(o):NaN},o=t=>{const o=e.activeCamera;return o&&o.mode===y.ORTHOGRAPHIC_CAMERA?t(o):NaN};F("/extensions/KHR_interactivity/?/activeCamera/perspective/aspectRatio",{get:()=>t(e=>e.getEngine().getAspectRatio(e)),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/perspective/yfov",{get:()=>t(e=>{if(e.fovMode===y.FOVMODE_VERTICAL_FIXED)return e.fov;const t=e.getEngine().getAspectRatio(e);return t?2*Math.atan(Math.tan(e.fov/2)/t):e.fov}),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/perspective/znear",{get:()=>t(e=>e.minZ),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/perspective/zfar",{get:()=>t(e=>0===e.maxZ?1/0:e.maxZ),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/orthographic/xmag",{get:()=>o(e=>{const t=e.getEngine().getRenderWidth()/2;return((e.orthoRight??t)-(e.orthoLeft??-t))/2}),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/orthographic/ymag",{get:()=>o(e=>{const t=e.getEngine().getRenderHeight()/2;return((e.orthoTop??t)-(e.orthoBottom??-t))/2}),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/orthographic/znear",{get:()=>o(e=>e.minZ),type:"number",getTarget:()=>e.activeCamera}),F("/extensions/KHR_interactivity/?/activeCamera/orthographic/zfar",{get:()=>o(e=>e.maxZ),type:"number",getTarget:()=>e.activeCamera}),F("/animations/{}/extensions/KHR_interactivity/isPlaying",{get:e=>e._babylonAnimationGroup?.isPlaying??!1,type:"boolean",getTarget:e=>e._babylonAnimationGroup}),F("/animations/{}/extensions/KHR_interactivity/minTime",{get:e=>(e._babylonAnimationGroup?.from??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),F("/animations/{}/extensions/KHR_interactivity/maxTime",{get:e=>(e._babylonAnimationGroup?.to??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),F("/animations/{}/extensions/KHR_interactivity/playhead",{get:e=>(e._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),F("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:e=>(e._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup})}let ze=!1;function We(){ze||(ze=!0,function(e,t,o){const n=`${e}/${t}`;fe[n]=o,ge[t]=n}($e,"FlowGraphGLTFDataProvider",async()=>(await import("./flowGraphGLTFDataProvider-CM_6x0ns.esm.min.js")).FlowGraphGLTFDataProvider),G($e),_($e,!0,e=>new He(e)))}We();var Ue=Object.freeze({__proto__:null,KHR_interactivity:He,RegisterKHR_interactivity:We,_AddInteractivityObjectModel:Ke});export{$ as F,N as G,Me as I,Ue as K,Te as M,U as _,ne as a,W as b,z as c,we as d,Q as e,K as f,te as g,S as h,ee as i,J as j,Y as k,Z as l,X as m,Oe as n};
//# sourceMappingURL=KHR_interactivity-BMn2G2LI.esm.min.js.map