import{r as u,c as f,l as y}from"./jwt-decode.esm-BUhVyVlz.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]="6dd568d8-9b2c-42b4-a1b4-47e4d38d2370",e._sentryDebugIdIdentifier="sentry-dbid-6dd568d8-9b2c-42b4-a1b4-47e4d38d2370")}catch{}})();function p({api:e,fetchTasks:s}){const t=u({state:"idle"}),n=()=>{t.value={state:"idle"}},o=()=>{t.value={state:"creating",name:"My task",payloadCode:`{
    "key": "value"
  }`}},c=async r=>{const a=t.value;if(a.state!=="creating")throw new Error("Payload is required to create a task");if(!d.value)return;const i=JSON.parse(a.payloadCode),l=await e.createTask(a.name,r,i);return await s(),n(),l},d=f(()=>{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:c,creatingTaskState:t,cancelCreatingTask:n,startCreatingTask:o,isPayloadValid:d}}export{p as T};
//# sourceMappingURL=taskCreator-Bli5EHlL.js.map
