import{r as l,b as u,aa as y}from"./jwt-decode.esm-BYfS37aG.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="7951c2c3-8385-4026-83f0-ff25fb215030",e._sentryDebugIdIdentifier="sentry-dbid-7951c2c3-8385-4026-83f0-ff25fb215030")}catch{}})();function b({api:e,fetchTasks:s}){const t=l({state:"idle"}),n=()=>{t.value={state:"idle"}},c=()=>{t.value={state:"creating",name:"My task",payloadCode:`{
    "key": "value"
  }`}},d=async r=>{const a=t.value;if(a.state!=="creating")throw new Error("Payload is required to create a task");if(!o.value)return;const i=JSON.parse(a.payloadCode),f=await e.createTask(a.name,r,i);return await s(),n(),f},o=u(()=>{const r=t.value;if(r.state!=="creating")return!1;try{const a=JSON.parse(r.payloadCode);return y.isObject(a)}catch{return!1}});return{createTask:d,creatingTaskState:t,cancelCreatingTask:n,startCreatingTask:c,isPayloadValid:o}}export{b as T};
//# sourceMappingURL=taskCreator-Bg9N8sUR.js.map
