import{aa as n,ab as c}from"./_applist-tangy-colts-beg-36.js";import{aR as r,_ as s}from"./main-tangy-colts-beg.js";import{s as h}from"./machine.-tangy-colts-beg-869.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const l=async()=>r("pro_fluent-forms/get-forms");globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const i=async o=>{o.setComponent("form-id",t=>{t.loading=!0});const{data:e,status:a}=await l();if(a==="error"){o.setComponent("form-id",t=>{o.util.isSelectComponent(t)&&(t.status=a,t.loading=!1,t.invalidMessage=e)});return}o.setComponent("form-id",t=>{o.util.isSelectComponent(t)&&(t.options=e,t.loading=!1,t.status=void 0)})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const p=n(({helpers:o})=>({states:{components:[{componentName:o.componentName.select,fieldType:"config",id:"form-id",label:s("Forms"),onChange:"SELECT_FORM",onRefetch:"REFETCH_FORMS",optionFilterProp:"label",options:[],placeholder:s("Select a form"),render:!0,showSearch:!0,value:void 0},{componentName:o.componentName.hookListener,fieldType:"config",id:"hook-listener",label:s("Listen Hook"),render:({$:e})=>{var a;return c((a=e.getComponent("form-id"))==null?void 0:a.value)}}]},actions:{ON_MACHINE_LOAD:async({$:e})=>{h(e,[{db:"formId",id:"form-id"}]),await i(e)},REFETCH_FORMS:async({$:e})=>i(e),SELECT_FORM:async({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb({formId:a})}}}));export{p as default};
