import{b as g}from"./KHR_interactivity-BtMudStn.js";import{R as o}from"./declarationMapper-Lanf6XPr.js";import{L as l,R as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class h extends g{constructor(e){if(super(e),this.message=this.registerDataInput("message",o),this.logType=this.registerDataInput("logType",o,"log"),e?.messageTemplate){const t=this._getTemplateMatches(e.messageTemplate);for(const s of t)this.registerDataInput(s,o)}}_execute(e){const t=this.logType.getValue(e),s=this._getMessageValue(e);t==="warn"?l.Warn(s):t==="error"?l.Error(s):l.Log(s),this.out._activateSignal(e)}getClassName(){return"FlowGraphConsoleLogBlock"}_getMessageValue(e){if(this.config?.messageTemplate){let t=this.config.messageTemplate;const s=this._getTemplateMatches(t);for(const a of s){const r=this.getDataInput(a)?.getValue(e);r!==void 0&&(t=t.replace(new RegExp(`\\{${a}\\}`,"g"),r.toString()))}return t}else return this.message.getValue(e)}_getTemplateMatches(e){const t=/\{([^}]+)\}/g,s=[];let a;for(;(a=t.exec(e))!==null;)s.push(a[1]);return s}}i("FlowGraphConsoleLogBlock",h);export{h as FlowGraphConsoleLogBlock};
