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.

1 lines 57.2 kB
import{M as e,a7 as t,V as o,i as a,Q as n,aH as s,j as r,L as i,bm as l,O as c,u as h,v as p,R as u,by as m,bJ as w,bI as d}from"./index-Bw2N6w1y.esm.min.js";import{F as f,a as g,b as G,g as k,c as B,d as y}from"./declarationMapper-13w1YGqM.esm.min.js";import{a as _,A as F}from"./objectModelMapping-DX92iJ8M.esm.min.js";function b(e){return"Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e||"Color3"===e||"Color4"===e}function v(e,t,o){const a=t?.getClassName?.()??"";if(b(a)||function(e){return"Matrix"===e||"Matrix2D"===e||"Matrix3D"===e}(a))o[e]={value:t.asArray(),className:a};else if("FlowGraphInteger"===a)o[e]={value:t.value,className:a};else if(a&&(t.id||t.name))o[e]={id:t.id,name:t.name,className:a};else{if("object"==typeof t)throw new Error(`Could not serialize value ${t}`);o[e]=t}}function C(i,l,c,h){const p=l[i];let u;const m=p?.type??p?.className;if(function(e){return"Mesh"===e||"AbstractMesh"===e||"GroundMesh"===e||"InstanceMesh"===e||"LinesMesh"===e||"GoldbergMesh"===e||"GreasedLineMesh"===e||"TrailMesh"===e}(m)){let e=h.meshes.filter((e=>p.id?e.id===p.id:e.name===p.name));0===e.length&&(e=h.transformNodes.filter((e=>p.id?e.id===p.id:e.name===p.name))),u=p.uniqueId?e.find((e=>e.uniqueId===p.uniqueId)):e[0]}else if(b(m))u=function(e,i,l=!1){if("Vector2"===e)return t.FromArray(i);if("Vector3"===e)return l&&(i[2]*=-1),o.FromArray(i);if("Vector4"===e)return a.FromArray(i);if("Quaternion"===e)return l&&(i[2]*=-1,i[3]*=-1),n.FromArray(i);if("Color3"===e)return new s(i[0],i[1],i[2]);if("Color4"===e)return new r(i[0],i[1],i[2],i[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?e.FromArray(p.value):"Matrix2D"===m?new f(p.value):"Matrix3D"===m?new g(p.value):"FlowGraphInteger"===m?G.FromValue(p.value):"number"===m||"string"===m||"boolean"===m?p.value[0]:p&&void 0!==p.value?p.value:Array.isArray(p)?p.reduce(((e,t)=>t.eventData?(e[t.id]={type:k(t.type)},void 0!==t.value&&(e[t.id].value=C("value",t,c,h)),e):e),{}):p;return u}var x,I,T,E;function M(e,t,o,a){switch(t){case"Animation":return a?e.animations.find((e=>e.uniqueId===o))??null:e.animations[o]??null;case"AnimationGroup":return a?e.animationGroups.find((e=>e.uniqueId===o))??null:e.animationGroups[o]??null;case"Mesh":return a?e.meshes.find((e=>e.uniqueId===o))??null:e.meshes[o]??null;case"Material":return a?e.materials.find((e=>e.uniqueId===o))??null:e.materials[o]??null;case"Camera":return a?e.cameras.find((e=>e.uniqueId===o))??null:e.cameras[o]??null;case"Light":return a?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"}(x||(x={})),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"}(I||(I={}));class V{constructor(){this.logToConsole=!1,this.log=[]}addLogItem(e){if(e.time||(e.time=Date.now()),this.log.push(e),this.logToConsole){const t=e.payload?.value;"object"==typeof t&&t.getClassName?i.Log(`[FGLog] ${e.className}:${e.uniqueId.split("-")[0]} ${e.action} - ${JSON.stringify(t.getClassName())}: ${t.toString()}`):i.Log(`[FGLog] ${e.className}:${e.uniqueId.split("-")[0]} ${e.action} - ${JSON.stringify(e.payload)}`)}}getItemsOfType(e){return this.log.filter((t=>t.action===e))}}class O{get enableLogging(){return this._enableLogging}set enableLogging(e){this._enableLogging!==e&&(this._enableLogging=e,this._enableLogging?(this.logger=new V,this.logger.logToConsole=!0):this.logger=null)}constructor(e){this.uniqueId=l(),this._userVariables={},this._executionVariables={},this._globalContextVariables={},this._connectionValues={},this._pendingBlocks=[],this._executionId=0,this.onNodeExecutedObservable=new c,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 M(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}getScene(){return this._configuration.scene}_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}serialize(e={},t=v){e.uniqueId=this.uniqueId,e._userVariables={};for(const o in this._userVariables)t(o,this._userVariables[o],e._userVariables);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"}}h([p()],O.prototype,"uniqueId",void 0),function(e){e[e.Input=0]="Input",e[e.Output=1]="Output"}(T||(T={}));class N{constructor(e,t,o){this._ownerBlock=o,this._connectedPoint=[],this.uniqueId=l(),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),a=e._connectedPoint.indexOf(this);-1!==o&&-1!==a&&(t&&this._connectedPoint.splice(o,1),e._connectedPoint.splice(a,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 j extends N{constructor(e,t,o,a,n=a.defaultValue,s=!1){super(e,t,o),this.richType=a,this._defaultValue=n,this._optional=s,this._isDisabled=!1,this._lastValue=null,this.dataTransformer=null,this.onValueChangedObservable=new c}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)}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,v("defaultValue",this._defaultValue,e)}}u("FlowGraphDataConnection",j);class S{constructor(e){this.config=e,this.uniqueId=l(),this.name=this.config?.name??this.getClassName(),this.dataInputs=[],this.dataOutputs=[]}_updateOutputs(e){}registerDataInput(e,t,o){const a=new j(e,0,this,t,o);return this.dataInputs.push(a),a}registerDataOutput(e,t,o){const a=new j(e,1,this,t,o);return this.dataOutputs.push(a),a}getDataInput(e){return this.dataInputs.find((t=>t.name===e))}getDataOutput(e){return this.dataOutputs.find((t=>t.name===e))}serialize(e={},t=v){if(e.uniqueId=this.uniqueId,e.config={},this.config){const o=this.config,a=Object.keys(o);for(const n of a)t(n,o[n],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 P extends N{constructor(){super(...arguments),this.priority=0}_isSingularConnection(){return!1}connectTo(e){super.connectTo(e),this._connectedPoint.sort(((e,t)=>t.priority-e.priority))}_activateSignal(e){if(e.logger?.addLogItem({action:"ActivateSignal",className:this._ownerBlock.getClassName(),uniqueId:this._ownerBlock.uniqueId,payload:{connectionType:this.connectionType,name:this.name}}),0===this.connectionType)e._notifyExecuteNode(this._ownerBlock),this._ownerBlock._execute(e,this),e._increaseExecutionId();else for(const t of this._connectedPoint)t._activateSignal(e)}}u("FlowGraphSignalConnection",P);class q extends S{constructor(e){super(e),this.priority=0,this.signalInputs=[],this.signalOutputs=[],this.in=this._registerSignalInput("in"),this.error=this._registerSignalOutput("error")}_registerSignalInput(e){const t=new P(e,0,this);return this.signalInputs.push(t),t}_registerSignalOutput(e){const t=new P(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 D{constructor(e){this.onEventTriggeredObservable=new c,this.sceneReadyTriggered=!1,this._pointerUnderMeshState={},this._startingTime=0,this._scene=e,this._initialize()}_initialize(){this._sceneReadyObserver=this._scene.onReadyObservable.add((()=>{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})}),m.POINTERPICK),this._meshUnderPointerObserver=this._scene.onMeshUnderPointerUpdatedObservable.add((e=>{const t=e.pointerId,o=e.mesh,a=this._pointerUnderMeshState[t];!a&&o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:t,mesh:o}}):a&&!o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:t,mesh:a}}):a&&o&&a!==o&&(this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:t,mesh:a,over:o}}),this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:t,mesh:o,out:a}})),this._pointerUnderMeshState[t]=o}),m.POINTERMOVE)}dispose(){this._sceneDisposeObserver?.remove(),this._sceneReadyObserver?.remove(),this._sceneOnBeforeRenderObserver?.remove(),this._meshPickedObserver?.remove(),this._meshUnderPointerObserver?.remove(),this.onEventTriggeredObservable.clear()}}function A(e,t){return!(!e.parent||e.parent!==t&&!A(e.parent,t))}function H(e){if(e.getClassName)return e.getClassName()}function R(e,t){return e===t&&("Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e)}function L(e,t){return e===t&&("Matrix"===e||"Matrix2D"===e||"Matrix3D"===e)}function z(e,t){return"FlowGraphInteger"===e&&"FlowGraphInteger"===t}function $(e,t){const o="number"==typeof e||"number"==typeof e?.value;return o&&!t?!isNaN(U(e)):o}function U(e){return"number"==typeof e?e:e.value}!function(e){e[e.Stopped=0]="Stopped",e[e.Started=1]="Started"}(E||(E={}));class W{get state(){return this._state}set state(e){this._state=e,this.onStateChangedObservable.notifyObservers(e)}constructor(e){this.onStateChangedObservable=new c,this._eventBlocks={SceneReady:[],SceneDispose:[],SceneBeforeRender:[],MeshPick:[],PointerDown:[],PointerUp:[],PointerMove:[],PointerOver:[],PointerOut:[],SceneAfterRender:[],NoTrigger:[]},this._executionContexts=[],this._state=0,this._scene=e.scene,this._sceneEventCoordinator=new D(this._scene),this._coordinator=e.coordinator,this._eventObserver=this._sceneEventCoordinator.onEventTriggeredObservable.add((e=>{for(const t of this._executionContexts){const o=this._getContextualOrder(e.type,t);for(const a of o)if(!a._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);break;case"SceneDispose":this.dispose()}}))}createContext(){const e=new O({scene:this._scene,coordinator:this._coordinator});return this._executionContexts.push(e),e}getContext(e){return this._executionContexts[e]}addEventBlock(e){if("PointerOver"!==e.type&&"PointerOut"!==e.type||(this._scene.constantlyUpdateMeshUnderPointer=!0),"NoTrigger"!==e.type&&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)}))}start(){1!==this.state&&(0===this._executionContexts.length&&this.createContext(),this.onStateChangedObservable.add((e=>{1===e&&(this._startPendingEvents(),this._scene.isReady(!0)&&this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}))})),this.state=1)}_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 a of o){const n=a.asset.getValue(t);let s=0;for(;s<o.length;s++){const e=o[s].asset.getValue(t);if(n&&e&&A(n,e))break}e.splice(s,0,a)}return e}return o}dispose(){if(0!==this.state){this.state=0;for(const e of this._executionContexts)e._clearPendingBlocks();this._executionContexts.length=0;for(const e in this._eventBlocks)this._eventBlocks[e].length=0;this._eventObserver?.remove(),this._sceneEventCoordinator.dispose()}}visitAllBlocks(e){const t=[],o=new Set;for(const e in this._eventBlocks)for(const a of this._eventBlocks[e])t.push(a),o.add(a.uniqueId);for(;t.length>0;){const a=t.pop();e(a);for(const e of a.dataInputs)for(const a of e._connectedPoint)o.has(a._ownerBlock.uniqueId)||(t.push(a._ownerBlock),o.add(a._ownerBlock.uniqueId));if(a instanceof q)for(const e of a.signalOutputs)for(const a of e._connectedPoint)o.has(a._ownerBlock.uniqueId)||(t.push(a._ownerBlock),o.add(a._ownerBlock.uniqueId))}}serialize(e={},t){e.allBlocks=[],this.visitAllBlocks((t=>{const o={};t.serialize(o),e.allBlocks.push(o)})),e.executionContexts=[];for(const o of this._executionContexts){const a={};o.serialize(a,t),e.executionContexts.push(a)}}}class K{constructor(e){this.config=e,this.dispatchEventsSynchronously=!0,this._flowGraphs=[],this._customEventsMap=new Map,this._eventExecutionCounter=new Map,this._executeOnNextFrame=[],this._eventUniqueId=0,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)}}));(K.SceneCoordinators.get(this.config.scene)??[]).push(this)}createGraph(){const e=new W({scene:this.config.scene,coordinator:this});return this._flowGraphs.push(e),e}removeGraph(e){const t=this._flowGraphs.indexOf(e);-1!==t&&(e.dispose(),this._flowGraphs.splice(t,1))}start(){for(const e of this._flowGraphs)e.start()}dispose(){for(const e of this._flowGraphs)e.dispose();this._flowGraphs.length=0,this._disposeObserver?.remove(),this._onBeforeRenderObserver?.remove();const e=K.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 a={};o.serialize(a,t),e._flowGraphs.push(a)}e.dispatchEventsSynchronously=this.dispatchEventsSynchronously}get flowGraphs(){return this._flowGraphs}getCustomEventObservable(e){let t=this._customEventsMap.get(e);return t||(t=new c,this._customEventsMap.set(e,t)),t}notifyCustomEvent(e,t,o=!this.dispatchEventsSynchronously){if(o)return void this._executeOnNextFrame.push({id:e,data:t,uniqueId:this._eventUniqueId++});if(this._eventExecutionCounter.has(e)){const t=this._eventExecutionCounter.get(e);if(this._eventExecutionCounter.set(e,t+1),t>=K.MaxEventTypeExecutionPerFrame)return void(t===K.MaxEventTypeExecutionPerFrame&&i.Warn(`FlowGraphCoordinator: Too many executions of event "${e}".`))}else this._eventExecutionCounter.set(e,1);const a=this._customEventsMap.get(e);a&&a.notifyObservers(t)}}K.MaxEventsPerType=30,K.MaxEventTypeExecutionPerFrame=30,K.SceneCoordinators=new Map;const J={};class Q extends q{constructor(e){super(e),this.out=this._registerSignalOutput("out")}}class Z extends Q{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)}}class X extends Z{constructor(){super(...arguments),this.initPriority=0,this.type="NoTrigger"}_execute(e){e._notifyExecuteNode(this),this.done._activateSignal(e)}}function Y(e,t){for(const o of e)for(const e of o.dataOutputs)if(e.uniqueId===t)return e;throw new Error("Could not find data out connection with unique id "+t)}function ee(e,t){for(const o of e)if(o instanceof q)for(const e of o.signalInputs)if(e.uniqueId===t)return e;throw new Error("Could not find signal in connection with unique id "+t)}async function te(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-DQY9C679.esm.min.js")).FlowGraphPlayAnimationBlock;case"FlowGraphStopAnimationBlock":return async()=>(await import("./flowGraphStopAnimationBlock-CehHE0F4.esm.min.js")).FlowGraphStopAnimationBlock;case"FlowGraphPauseAnimationBlock":return async()=>(await import("./flowGraphPauseAnimationBlock-BBe_0p6n.esm.min.js")).FlowGraphPauseAnimationBlock;case"FlowGraphInterpolationBlock":return async()=>(await import("./flowGraphInterpolationBlock-CJCWGZR-.esm.min.js")).FlowGraphInterpolationBlock;case"FlowGraphSceneReadyEventBlock":return async()=>(await import("./flowGraphSceneReadyEventBlock-8Lic7g25.esm.min.js")).FlowGraphSceneReadyEventBlock;case"FlowGraphSceneTickEventBlock":return async()=>(await import("./flowGraphSceneTickEventBlock-yhz-V9eV.esm.min.js")).FlowGraphSceneTickEventBlock;case"FlowGraphSendCustomEventBlock":return async()=>(await import("./flowGraphSendCustomEventBlock-CPbege4K.esm.min.js")).FlowGraphSendCustomEventBlock;case"FlowGraphReceiveCustomEventBlock":return async()=>(await import("./flowGraphReceiveCustomEventBlock-B1DtpOVl.esm.min.js")).FlowGraphReceiveCustomEventBlock;case"FlowGraphMeshPickEventBlock":return async()=>(await import("./flowGraphMeshPickEventBlock-BMGnOpW9.esm.min.js")).FlowGraphMeshPickEventBlock;case"FlowGraphEBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphEBlock;case"FlowGraphPIBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphPiBlock;case"FlowGraphInfBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphInfBlock;case"FlowGraphNaNBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphNaNBlock;case"FlowGraphRandomBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphRandomBlock;case"FlowGraphAddBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAddBlock;case"FlowGraphSubtractBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSubtractBlock;case"FlowGraphMultiplyBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphMultiplyBlock;case"FlowGraphDivideBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphDivideBlock;case"FlowGraphAbsBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAbsBlock;case"FlowGraphSignBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSignBlock;case"FlowGraphTruncBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphTruncBlock;case"FlowGraphFloorBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphFloorBlock;case"FlowGraphCeilBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphCeilBlock;case"FlowGraphRoundBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphRoundBlock;case"FlowGraphFractBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphFractionBlock;case"FlowGraphNegationBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphNegationBlock;case"FlowGraphModuloBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphModuloBlock;case"FlowGraphMinBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphMinBlock;case"FlowGraphMaxBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphMaxBlock;case"FlowGraphClampBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphClampBlock;case"FlowGraphSaturateBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSaturateBlock;case"FlowGraphMathInterpolationBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphMathInterpolationBlock;case"FlowGraphEqualityBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphEqualityBlock;case"FlowGraphLessThanBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLessThanBlock;case"FlowGraphLessThanOrEqualBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLessThanOrEqualBlock;case"FlowGraphGreaterThanBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphGreaterThanBlock;case"FlowGraphGreaterThanOrEqualBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphGreaterThanOrEqualBlock;case"FlowGraphIsNaNBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphIsNanBlock;case"FlowGraphIsInfBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphIsInfinityBlock;case"FlowGraphDegToRadBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphDegToRadBlock;case"FlowGraphRadToDegBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphRadToDegBlock;case"FlowGraphSinBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSinBlock;case"FlowGraphCosBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphCosBlock;case"FlowGraphTanBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphTanBlock;case"FlowGraphASinBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAsinBlock;case"FlowGraphACosBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAcosBlock;case"FlowGraphATanBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAtanBlock;case"FlowGraphATan2Block":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAtan2Block;case"FlowGraphSinhBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSinhBlock;case"FlowGraphCoshBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphCoshBlock;case"FlowGraphTanhBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphTanhBlock;case"FlowGraphASinhBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAsinhBlock;case"FlowGraphACoshBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAcoshBlock;case"FlowGraphATanhBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphAtanhBlock;case"FlowGraphExponentialBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphExpBlock;case"FlowGraphLogBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLogBlock;case"FlowGraphLog2Block":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLog2Block;case"FlowGraphLog10Block":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLog10Block;case"FlowGraphSquareRootBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphSquareRootBlock;case"FlowGraphPowerBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphPowerBlock;case"FlowGraphCubeRootBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphCubeRootBlock;case"FlowGraphBitwiseAndBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseAndBlock;case"FlowGraphBitwiseOrBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseOrBlock;case"FlowGraphBitwiseNotBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseNotBlock;case"FlowGraphBitwiseXorBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseXorBlock;case"FlowGraphBitwiseLeftShiftBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseLeftShiftBlock;case"FlowGraphBitwiseRightShiftBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphBitwiseRightShiftBlock;case"FlowGraphLengthBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphLengthBlock;case"FlowGraphNormalizeBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphNormalizeBlock;case"FlowGraphDotBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphDotBlock;case"FlowGraphCrossBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphCrossBlock;case"FlowGraphRotate2DBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphRotate2DBlock;case"FlowGraphRotate3DBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphRotate3DBlock;case"FlowGraphTransposeBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphTransposeBlock;case"FlowGraphDeterminantBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphDeterminantBlock;case"FlowGraphInvertMatrixBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphInvertMatrixBlock;case"FlowGraphMatrixMultiplicationBlock":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphMatrixMultiplicationBlock;case"FlowGraphBranchBlock":return async()=>(await import("./flowGraphBranchBlock-CuqzNnuy.esm.min.js")).FlowGraphBranchBlock;case"FlowGraphSetDelayBlock":return async()=>(await import("./flowGraphSetDelayBlock-BI9Z9bYV.esm.min.js")).FlowGraphSetDelayBlock;case"FlowGraphCancelDelayBlock":return async()=>(await import("./flowGraphCancelDelayBlock-BRTwv0_T.esm.min.js")).FlowGraphCancelDelayBlock;case"FlowGraphCallCounterBlock":return async()=>(await import("./flowGraphCounterBlock-BmbZM3bq.esm.min.js")).FlowGraphCallCounterBlock;case"FlowGraphDebounceBlock":return async()=>(await import("./flowGraphDebounceBlock-EdyenxBf.esm.min.js")).FlowGraphDebounceBlock;case"FlowGraphThrottleBlock":return async()=>(await import("./flowGraphThrottleBlock-BaDKjO7R.esm.min.js")).FlowGraphThrottleBlock;case"FlowGraphDoNBlock":return async()=>(await import("./flowGraphDoNBlock-BsVUyF6I.esm.min.js")).FlowGraphDoNBlock;case"FlowGraphFlipFlopBlock":return async()=>(await import("./flowGraphFlipFlopBlock-iQeaMcZV.esm.min.js")).FlowGraphFlipFlopBlock;case"FlowGraphForLoopBlock":return async()=>(await import("./flowGraphForLoopBlock-g6u3OmCj.esm.min.js")).FlowGraphForLoopBlock;case"FlowGraphMultiGateBlock":return async()=>(await import("./flowGraphMultiGateBlock-DNPb_XUL.esm.min.js")).FlowGraphMultiGateBlock;case"FlowGraphSequenceBlock":return async()=>(await import("./flowGraphSequenceBlock-CnU8UA69.esm.min.js")).FlowGraphSequenceBlock;case"FlowGraphSwitchBlock":return async()=>(await import("./flowGraphSwitchBlock-BsaCNVeY.esm.min.js")).FlowGraphSwitchBlock;case"FlowGraphWaitAllBlock":return async()=>(await import("./flowGraphWaitAllBlock-CbPO9HmI.esm.min.js")).FlowGraphWaitAllBlock;case"FlowGraphWhileLoopBlock":return async()=>(await import("./flowGraphWhileLoopBlock-49RiR6ME.esm.min.js")).FlowGraphWhileLoopBlock;case"FlowGraphConsoleLogBlock":return async()=>(await import("./flowGraphConsoleLogBlock-xid_l2aY.esm.min.js")).FlowGraphConsoleLogBlock;case"FlowGraphConditionalBlock":return async()=>(await import("./flowGraphConditionalDataBlock-Ciq6Qsqt.esm.min.js")).FlowGraphConditionalDataBlock;case"FlowGraphConstantBlock":return async()=>(await import("./flowGraphConstantBlock-DeSA-s9b.esm.min.js")).FlowGraphConstantBlock;case"FlowGraphTransformCoordinatesSystemBlock":return async()=>(await import("./flowGraphTransformCoordinatesSystemBlock-BhHd2PkZ.esm.min.js")).FlowGraphTransformCoordinatesSystemBlock;case"FlowGraphGetAssetBlock":return async()=>(await import("./flowGraphGetAssetBlock-Duw_xGP9.esm.min.js")).FlowGraphGetAssetBlock;case"FlowGraphGetPropertyBlock":return async()=>(await import("./flowGraphGetPropertyBlock-B40l-iXi.esm.min.js")).FlowGraphGetPropertyBlock;case"FlowGraphSetPropertyBlock":return async()=>(await import("./flowGraphSetPropertyBlock-VHW7ynWh.esm.min.js")).FlowGraphSetPropertyBlock;case"FlowGraphGetVariableBlock":return async()=>(await import("./flowGraphGetVariableBlock-BW0O5kxP.esm.min.js")).FlowGraphGetVariableBlock;case"FlowGraphSetVariableBlock":return async()=>(await import("./flowGraphSetVariableBlock-VpSIpc6o.esm.min.js")).FlowGraphSetVariableBlock;case"FlowGraphJsonPointerParserBlock":return async()=>(await import("./flowGraphJsonPointerParserBlock-BnFKTvqy.esm.min.js")).FlowGraphJsonPointerParserBlock;case"FlowGraphLeadingZerosBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphLeadingZerosBlock;case"FlowGraphTrailingZerosBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphTrailingZerosBlock;case"FlowGraphOneBitsCounterBlock":return async()=>(await import("./flowGraphMathBlocks-DBYkqOgX.esm.min.js")).FlowGraphOneBitsCounterBlock;case"FlowGraphCombineVector2Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphCombineVector2Block;case"FlowGraphCombineVector3Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphCombineVector3Block;case"FlowGraphCombineVector4Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphCombineVector4Block;case"FlowGraphCombineMatrixBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphCombineMatrixBlock;case"FlowGraphExtractVector2Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphExtractVector2Block;case"FlowGraphExtractVector3Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphExtractVector3Block;case"FlowGraphExtractVector4Block":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphExtractVector4Block;case"FlowGraphExtractMatrixBlock":return async()=>(await import("./flowGraphMathCombineExtractBlocks-DncLLKkQ.esm.min.js")).FlowGraphExtractMatrixBlock;case"FlowGraphTransformVectorBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphTransformBlock;case"FlowGraphTransformCoordinatesBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphTransformCoordinatesBlock;case"FlowGraphConjugateBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphConjugateBlock;case"FlowGraphAngleBetweenBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphAngleBetweenBlock;case"FlowGraphQuaternionFromAxisAngleBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphQuaternionFromAxisAngleBlock;case"FlowGraphAxisAngleFromQuaternionBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphAxisAngleFromQuaternionBlock;case"FlowGraphQuaternionFromDirectionsBlock":return async()=>(await import("./flowGraphVectorMathBlocks-DPooL6gG.esm.min.js")).FlowGraphQuaternionFromDirectionsBlock;case"FlowGraphMatrixDecompose":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphMatrixDecomposeBlock;case"FlowGraphMatrixCompose":return async()=>(await import("./flowGraphMatrixMathBlocks-Dqjn_c2Q.esm.min.js")).FlowGraphMatrixComposeBlock;case"FlowGraphBooleanToFloat":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphBooleanToFloat;case"FlowGraphBooleanToInt":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphBooleanToInt;case"FlowGraphFloatToBoolean":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphFloatToBoolean;case"FlowGraphIntToBoolean":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphIntToBoolean;case"FlowGraphIntToFloat":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphIntToFloat;case"FlowGraphFloatToInt":return async()=>(await import("./flowGraphTypeToTypeBlocks-BqP8acqZ.esm.min.js")).FlowGraphFloatToInt;case"FlowGraphEasingBlock":return async()=>(await import("./flowGraphEasingBlock-Cv_JClOz.esm.min.js")).FlowGraphEasingBlock;case"FlowGraphBezierCurveEasing":return async()=>(await import("./flowGraphBezierCurveEasingBlock-D-3st2z8.esm.min.js")).FlowGraphBezierCurveEasingBlock;case"FlowGraphPointerOverEventBlock":return async()=>(await import("./flowGraphPointerOverEventBlock-BKTAsBIG.esm.min.js")).FlowGraphPointerOverEventBlock;case"FlowGraphPointerOutEventBlock":return async()=>(await import("./flowGraphPointerOutEventBlock-CZPBysdH.esm.min.js")).FlowGraphPointerOutEventBlock;case"FlowGraphContextBlock":return async()=>(await import("./flowGraphContextBlock-DbfjpkBB.esm.min.js")).FlowGraphContextBlock;case"FlowGraphArrayIndexBlock":return async()=>(await import("./flowGraphArrayIndexBlock-DJ0Z0d-L.esm.min.js")).FlowGraphArrayIndexBlock;case"FlowGraphCodeExecutionBlock":return async()=>(await import("./flowGraphCodeExecutionBlock-D_5OCt3a.esm.min.js")).FlowGraphCodeExecutionBlock;case"FlowGraphIndexOfBlock":return async()=>(await import("./flowGraphIndexOfBlock-C1N4dahj.esm.min.js")).FlowGraphIndexOfBlock;case"FlowGraphFunctionReference":return async()=>(await import("./flowGraphFunctionReferenceBlock-B5qSdmdu.esm.min.js")).FlowGraphFunctionReferenceBlock;case"FlowGraphDataSwitchBlock":return async()=>(await import("./flowGraphDataSwitchBlock-Dijx1GfU.esm.min.js")).FlowGraphDataSwitchBlock;default:if(J[e])return J[e];throw new Error(`Unknown block name ${e}`)}}(e.className);return await t()})));return function(e,t,o){const a=t.coordinator.createGraph(),n=[],s=t.valueParseFunction??C;for(let r=0;r<e.allBlocks.length;r++){const i=ae(e.allBlocks[r],{scene:t.coordinator.config.scene,pathConverter:t.pathConverter,assetsContainer:t.coordinator.config.scene,valueParseFunction:s},o[r]);n.push(i),i instanceof X&&a.addEventBlock(i)}for(const e of n){for(const t of e.dataInputs)for(const e of t.connectedPointIds){const o=Y(n,e);t.connectTo(o)}if(e instanceof q)for(const t of e.signalOutputs)for(const e of t.connectedPointIds){const o=ee(n,e);t.connectTo(o)}}for(const t of e.executionContexts)oe(t,{graph:a,valueParseFunction:s},e.rightHanded);return a}(e,t,o)}function oe(e,t,o){const a=t.graph.createContext();e.enableLogging&&(a.enableLogging=!0),a.treatDataAsRightHanded=o||!1;const n=t.valueParseFunction??C;a.uniqueId=e.uniqueId;const s=a.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.")}};a.assetsContext=o}for(const t in e._userVariables){const o=n(t,e._userVariables,a.assetsContext,s);a.userVariables[t]=o}for(const t in e._connectionValues){const o=n(t,e._connectionValues,a.assetsContext,s);a._setConnectionValueByKey(t,o)}return a}function ae(e,t,o){const a={},n=t.valueParseFunction??C;if(e.config)for(const o in e.config)a[o]=n(o,e.config,t.assetsContainer||t.scene,t.scene);if("FlowGraphJsonPointerParserBlock"===e.className){if(!t.pathConverter)throw new Error("Path converter is required for this block");a.pathConverter=t.pathConverter}const s=new o(a);s.uniqueId=e.uniqueId;for(let t=0;t<e.dataInputs.length;t++){const o=s.getDataInput(e.dataInputs[t].name);if(!o)throw new Error("Could not find data input with name "+e.dataInputs[t].name+" in block "+e.className);o.deserialize(e.dataInputs[t])}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 ne={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"}};class se{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._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(ne[e.signature])}_parseDeclarations(){if(this._interactivityGraph.declarations)for(const e of this._interactivityGraph.declarations){const t=B(e);if(!t)throw i.Error(["No mapping found for declaration",e]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:t,fullOperationName:e.extension?e.op+":"+e.extension:e.op})}}_parseVariables(){if(this._interactivityGraph.variables)for(const e of this._interactivityGraph.variables){const t=this._parseVariable(e);this._staticVariables.push(t)}}_parseVariable(e,t){const o=this._types[e.type];if(!o)throw i.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==o.length)throw i.Error(["Invalid value length for variable",e,o]),new Error("Error parsing variables");const a=e.value||[];if(!a.length)switch(o.flowGraphType){case"boolean":a.push(!1);break;case"FlowGraphInteger":a.push(0);break;case"number":a.push(NaN);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"===o.elementType&&"string"==typeof a[0]&&(a[0]=parseFloat(a[0])),{type:o.flowGraphType,value:t?t(a,this):a}}_parseEvents(){if(this._interactivityGraph.events)for(const e of this._interactivityGraph.events){const t={eventId:e.id||"internalEvent_"+this._internalEventsCounter++};e.values&&(t.eventData=Object.keys(e.values).map((t=>{const o=e.values?.[t];if(!o)throw i.Error(["No value found for event key",t]),new Error("Error parsing events");const a=this._types[o.type];if(!a)throw i.Error(["No type found for event value",o]),new Error("Error parsing events");const n=void 0!==o.value?this._parseVariable(o):void 0;return{id:t,type:a.flowGraphType,eventData:!0,value:n}}))),this._events.push(t)}}_parseNodes(){if(this._interactivityGraph.nodes)for(const e of this._interactivityGraph.nodes){if("number"!=typeof e.declaration)throw i.Error(["No declaration found for node",e]),new Error("Error parsing nodes");const t=this._mappings[e.declaration];if(!t)throw i.Error(["No mapping found for node",e]),new Error("Error parsing nodes");if(t.flowGraphMapping.validation){const o=t.flowGraphMapping.validation(e,this._interactivityGraph,this._gltf);if(!o.valid)throw new Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[e.declaration].op} - ${o.error}`)}const o=[];for(const a of t.flowGraphMapping.blocks){const n=this._getEmptyBlock(a,t.fullOperationName);this._parseNodeConfiguration(e,n,t.flowGraphMapping,a),o.push(n)}this._nodes.push({blocks:o,fullOperationName:t.fullOperationName})}}_getEmptyBlock(e,t){return{uniqueId:l(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}}_parseNodeConfiguration(e,t,o,a){const n=t.config;if(e.configuration){const t=Object.keys(e.configuration);for(const s of t){const t=e.configuration?.[s];if(!t)throw i.Error(["No value found for