import{r as l,b as u,ab as b}from"./jwt-decode.esm-Da8x-1xB.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[s]="934ad6f1-1b2f-47a4-85b0-2d44a1bbfb23",a._sentryDebugIdIdentifier="sentry-dbid-934ad6f1-1b2f-47a4-85b0-2d44a1bbfb23")}catch{}})();function p({api:a,fetchTasks:s}){const e=l({state:"idle"}),n=()=>{e.value={state:"idle"}},d=()=>{e.value={state:"creating",name:"My task",payloadCode:`{
    "key": "value"
  }`}},c=async r=>{const t=e.value;if(t.state!=="creating")throw new Error("Payload is required to create a task");if(!o.value)return;const i=JSON.parse(t.payloadCode),f=await a.createTask(t.name,r,i);return await s(),n(),f},o=u(()=>{const r=e.value;if(r.state!=="creating")return!1;try{const t=JSON.parse(r.payloadCode);return b.isObject(t)}catch{return!1}});return{createTask:c,creatingTaskState:e,cancelCreatingTask:n,startCreatingTask:d,isPayloadValid:o}}export{p as T};
//# sourceMappingURL=taskCreator-D9OGKYke.js.map
