import{r as u,b as f,ac as y}from"./jwt-decode.esm-CzNJpMna.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]="7ee16654-fae2-437b-adc9-1cb09d2496c0",e._sentryDebugIdIdentifier="sentry-dbid-7ee16654-fae2-437b-adc9-1cb09d2496c0")}catch{}})();function p({api:e,fetchTasks:s}){const a=u({state:"idle"}),n=()=>{a.value={state:"idle"}},c=()=>{a.value={state:"creating",name:"My task",payloadCode:`{
    "key": "value"
  }`}},d=async r=>{const t=a.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),l=await e.createTask(t.name,r,i);return await s(),n(),l},o=f(()=>{const r=a.value;if(r.state!=="creating")return!1;try{const t=JSON.parse(r.payloadCode);return y.isObject(t)}catch{return!1}});return{createTask:d,creatingTaskState:a,cancelCreatingTask:n,startCreatingTask:c,isPayloadValid:o}}export{p as T};
//# sourceMappingURL=taskCreator-CFSNyDS8.js.map
