import{aa as p,ab as h}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{s as T}from"./machine.-tangy-colts-beg-869.js";import{a as d,h as i,c as C}from"./commonut-tangy-colts-beg-402.js";import{f as l,a as r,b as E,c as s}from"./machineh-tangy-colts-beg-290.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(n,e){return this.cache.has(n)?this.cache.get(n):(this.cache.set(n,e),e)}};function c(n){return n==null||n===""}const R=p(({helpers:n})=>({states:{components:[C(n),{componentName:n.componentName.select,helperText:o("Select the owner of the issue"),id:"owner",label:o("Owner"),onChange:"SELECT_OWNER",onRefetch:"REFETCH_OWNER",optionFilterProp:"label",options:[],path:"owner",placeholder:o("Select  Owner"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.select,helperText:o("Select a repository of the issue"),id:"repository",label:o("Repository"),onChange:"SELECT_REPOSITORY",onRefetch:"REFETCH_REPOSITORY",optionFilterProp:"label",options:[],path:"repository",placeholder:o("Select a Repository"),render:"IS_OWNER_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.mixInput,helperText:o("Write the title of the issue"),id:"title",label:o("Title"),onChange:"HANDLE_TITLE",path:"title",placeholder:o("Enter Title"),render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:n.componentName.mixInput,helperText:o("Write the body content of the issue"),id:"body",label:o("Body"),onChange:"HANDLE_BODY",path:"body",placeholder:o("Enter Body"),render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:n.componentName.select,helperText:o("Select an assignee of the issue"),id:"assignee",label:o("Assignee"),onChange:"SET_ASSIGNEE",onRefetch:"REFETCH_ASSIGNEE",optionFilterProp:"label",options:[],path:"assignee",placeholder:o("Select Assignee"),render:"IS_OWNER_AND_REPOSITORY_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.select,helperText:o("Select the label of the issue"),id:"label",label:o("Label"),onChange:"SET_LABEL",onRefetch:"REFETCH_LABEL",optionFilterProp:"label",options:[],path:"label",placeholder:o("Select Label"),render:"IS_OWNER_AND_REPOSITORY_SELECTED",showSearch:!0,value:void 0}]},actions:{IF_CONNECTION_SELECTED:({$:e})=>{var t;return h((t=e.getComponent("connection-id"))==null?void 0:t.value)},IS_OWNER_AND_REPOSITORY_SELECTED:({$:e})=>{var t,a;return!c((t=e.getComponent("owner"))==null?void 0:t.value)&&!c((a=e.getComponent("repository"))==null?void 0:a.value)},IS_OWNER_SELECTED:({$:e})=>{var t;return!c((t=e.getComponent("owner"))==null?void 0:t.value)},ON_MACHINE_LOAD:async({$:e})=>{T(e,[{db:"connectionId",id:"connection-id"},{db:"ownerDb",id:"owner"},{db:"repositoryDb",id:"repository"},{db:"assigneeDb",id:"assignee"},{db:"titleDb",id:"title"},{db:"labelDb",id:"label"},{db:"bodyDb",id:"body"}]),await Promise.all([l(e),r(e),s(e),E(e)])},HANDLE_BODY:i("bodyDb"),HANDLE_TITLE:i("titleDb"),REFETCH_ASSIGNEE:({$:e})=>s(e),REFETCH_LABEL:({$:e})=>E(e),REFETCH_OWNER:({$:e})=>r(e),REFETCH_REPOSITORY:({$:e})=>l(e),SET_ASSIGNEE:i("assigneeDb"),SET_LABEL:i("labelDb"),SELECT_OWNER:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.ownerDb=t}),await Promise.all([s(e),E(e),l(e)])},SELECT_REPOSITORY:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.repositoryDb=t}),await Promise.all([s(e),E(e)])},SET_CONNECTION:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.connectionId=t}),await Promise.all([r(e),l(e)])},CONNECTION_ADD_CHANGE:d}}));export{R as default};
