import{e as a,i as o,g as u}from"./KHR_interactivity-BRnQ0PPJ.js";import{R as c}from"./declarationMapper-YJJdbZ_c.js";import{R as l}from"./index-T8LZyOXI.js";import"./index-BkylzejB.js";import"./objectModelMapping-D1pI71RW.js";class r extends a{constructor(t){super(t),this.config=t,this.default=this._registerSignalOutput("default"),this._caseToOutputFlow=new Map,this.case=this.registerDataInput("case",c);const e=this.config.cases||[];for(const s of e)this._caseToOutputFlow.set(s,this._registerSignalOutput(`out_${s}`))}_execute(t,e){const s=this.case.getValue(t);let i;o(s)?i=this._getOutputFlowForCase(u(s)):i=this._getOutputFlowForCase(s),i?i._activateSignal(t):this.default._activateSignal(t)}addCase(t){this.config.cases.includes(t)||(this.config.cases.push(t),this._caseToOutputFlow.set(t,this._registerSignalOutput(`out_${t}`)))}removeCase(t){if(!this.config.cases.includes(t))return;const e=this.config.cases.indexOf(t);this.config.cases.splice(e,1),this._caseToOutputFlow.delete(t)}_getOutputFlowForCase(t){return this._caseToOutputFlow.get(t)}getClassName(){return"FlowGraphSwitchBlock"}serialize(t){super.serialize(t),t.cases=this.config.cases}}l("FlowGraphSwitchBlock",r);export{r as FlowGraphSwitchBlock};
