@kb-labs/workflow-entry 2.105.0 → 2.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/widgets/117.js +1 -2
  2. package/dist/widgets/165.js +1 -2
  3. package/dist/widgets/326.js +1 -2
  4. package/dist/widgets/370.js +1 -2
  5. package/dist/widgets/405.js +1 -2
  6. package/dist/widgets/46.js +1 -2
  7. package/dist/widgets/50.js +1 -2
  8. package/dist/widgets/546.js +1 -2
  9. package/dist/widgets/62.js +1 -2
  10. package/dist/widgets/648.js +1 -2
  11. package/dist/widgets/669.js +1 -2
  12. package/dist/widgets/707.js +1 -2
  13. package/dist/widgets/716.js +1 -2
  14. package/dist/widgets/733.js +1 -2
  15. package/dist/widgets/775.js +1 -2
  16. package/dist/widgets/78.js +1 -2
  17. package/dist/widgets/945.js +1 -2
  18. package/dist/widgets/968.js +1 -2
  19. package/dist/widgets/__federation_expose_Crons.js +1 -2
  20. package/dist/widgets/__federation_expose_Dashboard.js +1 -2
  21. package/dist/widgets/__federation_expose_DefinitionDetail.js +1 -2
  22. package/dist/widgets/__federation_expose_Definitions.js +1 -2
  23. package/dist/widgets/__federation_expose_Jobs.js +1 -2
  24. package/dist/widgets/__federation_expose_RunDetail.js +2 -3
  25. package/dist/widgets/__federation_expose_Runs.js +1 -2
  26. package/dist/widgets/mf-manifest.json +5 -5
  27. package/dist/widgets/mf-stats.json +10 -9
  28. package/dist/widgets/remoteEntry.js +2 -3
  29. package/package.json +5 -5
  30. package/dist/widgets/117.js.map +0 -1
  31. package/dist/widgets/165.js.map +0 -1
  32. package/dist/widgets/326.js.map +0 -1
  33. package/dist/widgets/370.js.map +0 -1
  34. package/dist/widgets/405.js.map +0 -1
  35. package/dist/widgets/46.js.map +0 -1
  36. package/dist/widgets/50.js.map +0 -1
  37. package/dist/widgets/546.js.map +0 -1
  38. package/dist/widgets/62.js.map +0 -1
  39. package/dist/widgets/648.js.map +0 -1
  40. package/dist/widgets/669.js.map +0 -1
  41. package/dist/widgets/707.js.map +0 -1
  42. package/dist/widgets/716.js.map +0 -1
  43. package/dist/widgets/733.js.map +0 -1
  44. package/dist/widgets/775.js.map +0 -1
  45. package/dist/widgets/78.js.map +0 -1
  46. package/dist/widgets/945.js.map +0 -1
  47. package/dist/widgets/968.js.map +0 -1
  48. package/dist/widgets/__federation_expose_Crons.js.map +0 -1
  49. package/dist/widgets/__federation_expose_Dashboard.js.map +0 -1
  50. package/dist/widgets/__federation_expose_DefinitionDetail.js.map +0 -1
  51. package/dist/widgets/__federation_expose_Definitions.js.map +0 -1
  52. package/dist/widgets/__federation_expose_Jobs.js.map +0 -1
  53. package/dist/widgets/__federation_expose_RunDetail.js.map +0 -1
  54. package/dist/widgets/__federation_expose_Runs.js.map +0 -1
  55. package/dist/widgets/remoteEntry.js.map +0 -1
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[78],{453(t,e,s){let r,i,n,a,u,o,h;s.r(e),s.d(e,{CancelledError:()=>Y,HydrationBoundary:()=>t5,InfiniteQueryObserver:()=>tp,IsRestoringProvider:()=>tk,Mutation:()=>ty,MutationCache:()=>tv,MutationObserver:()=>tg,QueriesObserver:()=>tR,Query:()=>ts,QueryCache:()=>tC,QueryClient:()=>tQ,QueryClientContext:()=>tD,QueryClientProvider:()=>tF,QueryErrorResetBoundary:()=>tK,QueryObserver:()=>ta,dataTagErrorSymbol:()=>tP,dataTagSymbol:()=>tw,defaultScheduler:()=>W,defaultShouldDehydrateMutation:()=>_,defaultShouldDehydrateQuery:()=>G,dehydrate:()=>z,environmentManager:()=>K,experimental_streamedQuery:()=>tS,focusManager:()=>l,hashKey:()=>Q,hydrate:()=>B,infiniteQueryOptions:()=>t3,isCancelledError:()=>Z,isServer:()=>p,keepPreviousData:()=>F,matchMutation:()=>R,matchQuery:()=>O,mutationOptions:()=>t6,noop:()=>y,notifyManager:()=>$,onlineManager:()=>J,partialMatchKey:()=>S,queryOptions:()=>t1,replaceEqualDeep:()=>P,shouldThrowError:()=>U,skipToken:()=>k,timeoutManager:()=>f,unsetMarker:()=>tq,useInfiniteQuery:()=>et,useIsFetching:()=>t2,useIsMutating:()=>t4,useIsRestoring:()=>tx,useMutation:()=>t9,useMutationState:()=>t8,usePrefetchInfiniteQuery:()=>t0,usePrefetchQuery:()=>tZ,useQueries:()=>tW,useQuery:()=>tJ,useQueryClient:()=>tI,useQueryErrorResetBoundary:()=>tj,useSuspenseInfiniteQuery:()=>tX,useSuspenseQueries:()=>tY,useSuspenseQuery:()=>tV});var c=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},l=new class extends c{#t;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}},d={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},f=new class{#r=d;#i=!1;setTimeoutProvider(t){this.#r=t}setTimeout(t,e){return this.#r.setTimeout(t,e)}clearTimeout(t){this.#r.clearTimeout(t)}setInterval(t,e){return this.#r.setInterval(t,e)}clearInterval(t){this.#r.clearInterval(t)}},p="u"<typeof window||"Deno"in globalThis;function y(){}function m(t){return"number"==typeof t&&t>=0&&t!==1/0}function v(t,e){return Math.max(t+(e||0)-Date.now(),0)}function b(t,e){return"function"==typeof t?t(e):t}function g(t,e){return"function"==typeof t?t(e):t}function O(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==C(a,e.options))return!1}else if(!S(e.queryKey,a))return!1}if("all"!==s){let t=e.isActive();if("active"===s&&!t||"inactive"===s&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function R(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Q(e.options.mutationKey)!==Q(n))return!1}else if(!S(e.options.mutationKey,n))return!1}return(!r||e.state.status===r)&&(!i||!!i(e))}function C(t,e){return(e?.queryKeyHashFn||Q)(t)}function Q(t){return JSON.stringify(t,(t,e)=>M(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function S(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(s=>S(t[s],e[s]))}var w=Object.prototype.hasOwnProperty;function P(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=E(t)&&E(e);if(!r&&!(M(t)&&M(e)))return e;let i=(r?t:Object.keys(t)).length,n=r?e:Object.keys(e),a=n.length,u=r?Array(a):{},o=0;for(let h=0;h<a;h++){let a=r?h:n[h],c=t[a],l=e[a];if(c===l){u[a]=c,(r?h<i:w.call(t,a))&&o++;continue}if(null===c||null===l||"object"!=typeof c||"object"!=typeof l){u[a]=l;continue}let d=P(c,l,s+1);u[a]=d,d===c&&o++}return i===a&&o===i?t:u}function q(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}function E(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function M(t){if(!D(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!D(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?P(t,e):e}function F(t){return t}function T(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}function x(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var k=Symbol();function A(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==k?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function U(t,e){return"function"==typeof t?t(...e):!!t}function j(t,e,s){let r,i=!1;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var K=(r=()=>p,{isServer:()=>r(),setIsServer(t){r=t}});function H(){let t,e,s=new Promise((s,r)=>{t=s,e=r});function r(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{r({status:"fulfilled",value:e}),t(e)},s.reject=t=>{r({status:"rejected",reason:t}),e(t)},s}function L(t){return t}function _(t){return t.state.isPaused}function G(t){return"success"===t.state.status}function N(t){return!0}function z(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??_,r=t.getMutationCache().getAll().flatMap(t=>s(t)?[{mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}]:[]),i=e.shouldDehydrateQuery??t.getDefaultOptions().dehydrate?.shouldDehydrateQuery??G,n=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??N,a=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??L;return{mutations:r,queries:t.getQueryCache().getAll().flatMap(t=>{let e;return i(t)?[{dehydratedAt:Date.now(),state:{...t.state,...void 0!==t.state.data&&{data:a(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,..."pending"===t.state.status&&{promise:(e=t.promise?.then(a).catch(t=>n(t)?Promise.reject(Error("redacted")):Promise.reject(t)),e?.catch(y),e)},...t.meta&&{meta:t.meta}}]:[]})}}function B(t,e,s){if("object"!=typeof e||null===e)return;let r=t.getMutationCache(),i=t.getQueryCache(),n=s?.defaultOptions?.deserializeData??t.getDefaultOptions().hydrate?.deserializeData??L,a=e.mutations||[],u=e.queries||[];a.forEach(({state:e,...i})=>{r.build(t,{...t.getDefaultOptions().hydrate?.mutations,...s?.defaultOptions?.mutations,...i},e)}),u.forEach(({queryKey:e,state:r,queryHash:a,meta:u,promise:o,dehydratedAt:h})=>{let c=o?function(t){let e;if(t.then(t=>(e=t,t),y)?.catch(y),void 0!==e)return{data:e}}(o):void 0,l=void 0===r.data?c?.data:r.data,d=void 0===l?l:n(l),f=i.get(a),p=f?.state.status==="pending",m=f?.state.fetchStatus==="fetching";if(f){let t=c&&void 0!==h&&h>f.state.dataUpdatedAt;if(r.dataUpdatedAt>f.state.dataUpdatedAt||t){let{fetchStatus:t,...e}=r;f.setState({...e,data:d})}}else f=i.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:e,queryHash:a,meta:u},{...r,data:d,fetchStatus:"idle",status:void 0!==d?"success":r.status});o&&!p&&!m&&(void 0===h||h>f.state.dataUpdatedAt)&&f.fetch(void 0,{initialPromise:Promise.resolve(o).then(n)}).catch(y)})}var W=function(t){setTimeout(t,0)},$=(i=[],n=0,a=t=>{t()},u=t=>{t()},o=W,{batch:t=>{let e;n++;try{e=t()}finally{let t;--n||(t=i,i=[],t.length&&o(()=>{u(()=>{t.forEach(t=>{a(t)})})}))}return e},batchCalls:t=>(...e)=>{h(()=>{t(...e)})},schedule:h=t=>{n?i.push(t):o(()=>{a(t)})},setNotifyFunction:t=>{a=t},setBatchNotifyFunction:t=>{u=t},setScheduler:t=>{o=t}}),J=new class extends c{#n=!0;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&window.addEventListener){let e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#n!==t&&(this.#n=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#n}};function V(t){return Math.min(1e3*2**t,3e4)}function X(t){return(t??"online")!=="online"||J.isOnline()}var Y=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Z(t){return t instanceof Y}function tt(t){let e,s=!1,r=0,i=H(),n=()=>l.isFocused()&&("always"===t.networkMode||J.isOnline())&&t.canRun(),a=()=>X(t.networkMode)&&t.canRun(),u=t=>{"pending"===i.status&&(e?.(),i.resolve(t))},o=t=>{"pending"===i.status&&(e?.(),i.reject(t))},h=()=>new Promise(s=>{e=t=>{("pending"!==i.status||n())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===i.status&&t.onContinue?.()}),c=()=>{let e;if("pending"!==i.status)return;let a=0===r?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(u).catch(e=>{if("pending"!==i.status)return;let a=t.retry??3*!K.isServer(),u=t.retryDelay??V,l="function"==typeof u?u(r,e):u,d=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,e);s||!d?o(e):(r++,t.onFail?.(r,e),new Promise(t=>{f.setTimeout(t,l)}).then(()=>n()?void 0:h()).then(()=>{s?o(e):c()}))})};return{promise:i,status:()=>i.status,cancel:e=>{if("pending"===i.status){let s=new Y(e);o(s),t.onCancel?.(s)}},continue:()=>(e?.(),i),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:a,start:()=>(a()?c():h().then(c),i)}}var te=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#a=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(K.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(f.clearTimeout(this.#a),this.#a=void 0)}},ts=class extends te{#u;#o;#h;#c;#l;#d;#f;constructor(t){super(),this.#f=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#c=t.client,this.#h=this.#c.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#u=tn(this.options),this.state=t.state??this.#u,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=tn(this.options);void 0!==t.data&&(this.setState(ti(t.data,t.dataUpdatedAt)),this.#u=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(t,e){let s=I(this.state.data,t,this.options);return this.#p({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#p({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#l?.promise;return this.#l?.cancel(t),e?e.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#u}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>!1!==g(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===b(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!v(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#l&&(this.#f||this.#y()?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#y(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(t,e){let s;if("idle"!==this.state.fetchStatus&&this.#l?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},n=()=>{let t,s=A(this.options,e),r=(i(t={client:this.#c,queryKey:this.queryKey,meta:this.meta}),t);return(this.#f=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},a=(i(s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:n}),s);this.options.behavior?.onFetch(a,this),this.#o=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#p({type:"fetch",meta:a.fetchOptions?.meta}),this.#l=tt({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:t=>{t instanceof Y&&t.revert&&this.setState({...this.#o,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let t=await this.#l.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#h.config.onSuccess?.(t,this),this.#h.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof Y){if(t.silent)return this.#l.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#p({type:"error",error:t}),this.#h.config.onError?.(t,this),this.#h.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#p(t){let e=e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...tr(e.data,this.options),fetchMeta:t.meta??null};case"success":let s={...e,...ti(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?s:void 0,s;case"error":let r=t.error;return{...e,error:r,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),$.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#h.notify({query:this,type:"updated",action:t})})}};function tr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function ti(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function tn(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,r=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var ta=class extends c{constructor(t,e){super(),this.options=e,this.#c=t,this.#m=null,this.#v=H(),this.bindMethods(),this.setOptions(e)}#c;#b=void 0;#g=void 0;#O=void 0;#R;#C;#v;#m;#Q;#S;#w;#P;#q;#E;#M=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),tu(this.#b,this.options)?this.#D():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return to(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return to(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#F(),this.#T(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof g(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#b.setOptions(this.options),e._defaulted&&!q(this.options,e)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&th(this.#b,s,this.options,e)&&this.#D(),this.updateResult(),r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||b(this.options.staleTime,this.#b)!==b(e.staleTime,this.#b))&&this.#k();let i=this.#A();r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||i!==this.#E)&&this.#U(i)}getOptimisticResult(t){var e,s;let r=this.#c.getQueryCache().build(this.#c,t),i=this.createResult(r,t);return e=this,s=i,q(e.getCurrentResult(),s)||(this.#O=i,this.#C=this.options,this.#R=this.#b.state),i}getCurrentResult(){return this.#O}trackResult(t,e){return new Proxy(t,{get:(t,s)=>(this.trackProp(s),e?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,s))})}trackProp(t){this.#M.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#c.defaultQueryOptions(t),s=this.#c.getQueryCache().build(this.#c,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#D({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#O))}#D(t){this.#x();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(y)),e}#k(){this.#F();let t=b(this.options.staleTime,this.#b);if(K.isServer()||this.#O.isStale||!m(t))return;let e=v(this.#O.dataUpdatedAt,t);this.#P=f.setTimeout(()=>{this.#O.isStale||this.updateResult()},e+1)}#A(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(t){this.#T(),this.#E=t,!K.isServer()&&!1!==g(this.options.enabled,this.#b)&&m(this.#E)&&0!==this.#E&&(this.#q=f.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#D()},this.#E))}#I(){this.#k(),this.#U(this.#A())}#F(){void 0!==this.#P&&(f.clearTimeout(this.#P),this.#P=void 0)}#T(){void 0!==this.#q&&(f.clearInterval(this.#q),this.#q=void 0)}createResult(t,e){let s,r=this.#b,i=this.options,n=this.#O,a=this.#R,u=this.#C,o=t!==r?t.state:this.#g,{state:h}=t,c={...h},l=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&tu(t,e),a=s&&th(t,r,e,i);(n||a)&&(c={...c,...tr(h.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;s=c.data;let y=!1;if(void 0!==e.placeholderData&&void 0===s&&"pending"===p){let t;n?.isPlaceholderData&&e.placeholderData===u?.placeholderData?(t=n.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(p="success",s=I(n?.data,t,e),l=!0)}if(e.select&&void 0!==s&&!y)if(n&&s===a?.data&&e.select===this.#Q)s=this.#S;else try{this.#Q=e.select,s=e.select(s),s=I(n?.data,s,e),this.#S=s,this.#m=null}catch(t){this.#m=t}this.#m&&(d=this.#m,s=this.#S,f=Date.now(),p="error");let m="fetching"===c.fetchStatus,v="pending"===p,b="error"===p,O=v&&m,R=void 0!==s,C={status:p,fetchStatus:c.fetchStatus,isPending:v,isSuccess:"success"===p,isError:b,isInitialLoading:O,isLoading:O,data:s,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:m,isRefetching:m&&!v,isLoadingError:b&&!R,isPaused:"paused"===c.fetchStatus,isPlaceholderData:l,isRefetchError:b&&R,isStale:tc(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==g(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=void 0!==C.data,s="error"===C.status&&!e,i=t=>{s?t.reject(C.error):e&&t.resolve(C.data)},n=()=>{i(this.#v=C.promise=H())},a=this.#v;switch(a.status){case"pending":t.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let t=this.#O,e=this.createResult(this.#b,this.options);if(this.#R=this.#b.state,this.#C=this.options,void 0!==this.#R.data&&(this.#w=this.#b),q(e,t))return;this.#O=e;let s=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,s="function"==typeof e?e():e;if("all"===s||!s&&!this.#M.size)return!0;let r=new Set(s??this.#M);return this.options.throwOnError&&r.add("error"),Object.keys(this.#O).some(e=>this.#O[e]!==t[e]&&r.has(e))};this.#j({listeners:s()})}#x(){let t=this.#c.getQueryCache().build(this.#c,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#g=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#j(t){$.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#O)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function tu(t,e){return!1!==g(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&to(t,e,e.refetchOnMount)}function to(t,e,s){if(!1!==g(e.enabled,t)&&"static"!==b(e.staleTime,t)){let r="function"==typeof s?s(t):s;return"always"===r||!1!==r&&tc(t,e)}return!1}function th(t,e,s,r){return(t!==e||!1===g(r.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&tc(t,s)}function tc(t,e){return!1!==g(e.enabled,t)&&t.isStaleByTime(b(e.staleTime,t))}function tl(t){return{onFetch:(e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],a=e.state.data?.pageParams||[],u={pages:[],pageParams:[]},o=0,h=async()=>{let s=!1,h=A(e.options,e.fetchOptions),c=async(t,r,i)=>{let n;if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let a=(j(n={client:e.client,queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta},()=>e.signal,()=>s=!0),n),u=await h(a),{maxPages:o}=e.options,c=i?x:T;return{pages:c(t.pages,u,o),pageParams:c(t.pageParams,r,o)}};if(i&&n.length){let t="backward"===i,e={pages:n,pageParams:a},s=(t?tf:td)(r,e);u=await c(e,s,t)}else{let e=t??n.length;do{let t=0===o?a[0]??r.initialPageParam:td(r,u);if(o>0&&null==t)break;u=await c(u,t),o++}while(o<e)}return u};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function td(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}function tf(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var tp=class extends ta{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:tl()})}getOptimisticResult(t){return t.behavior=tl(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var s,r;let{state:i}=t,n=super.createResult(t,e),{isFetching:a,isRefetching:u,isError:o,isRefetchError:h}=n,c=i.fetchMeta?.fetchMore?.direction,l=o&&"forward"===c,d=a&&"forward"===c,f=o&&"backward"===c,p=a&&"backward"===c;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:!!(s=i.data)&&null!=td(e,s),hasPreviousPage:!!(r=i.data)&&!!e.getPreviousPageParam&&null!=tf(e,r),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:h&&!l&&!f,isRefetching:u&&!d&&!p}}},ty=class extends te{#c;#K;#H;#l;constructor(t){super(),this.#c=t.client,this.mutationId=t.mutationId,this.#H=t.mutationCache,this.#K=[],this.state=t.state||tm(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#K.includes(t)||(this.#K.push(t),this.clearGcTimeout(),this.#H.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#K=this.#K.filter(e=>e!==t),this.scheduleGc(),this.#H.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#K.length||("pending"===this.state.status?this.scheduleGc():this.#H.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#p({type:"continue"})},s={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=tt({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#H.canRun(this)});let r="pending"===this.state.status,i=!this.#l.canStart();try{if(r)e();else{this.#p({type:"pending",variables:t,isPaused:i}),this.#H.config.onMutate&&await this.#H.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#p({type:"pending",context:e,variables:t,isPaused:i})}let n=await this.#l.start();return await this.#H.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#H.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#p({type:"success",data:n}),n}catch(e){try{await this.#H.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#H.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#p({type:"error",error:e}),e}finally{this.#H.runNext(this)}}#p(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),$.batch(()=>{this.#K.forEach(e=>{e.onMutationUpdate(t)}),this.#H.notify({mutation:this,type:"updated",action:t})})}};function tm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tv=class extends c{constructor(t={}){super(),this.config=t,this.#L=new Set,this.#_=new Map,this.#G=0}#L;#_;#G;build(t,e,s){let r=new ty({client:t,mutationCache:this,mutationId:++this.#G,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#L.add(t);let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);s?s.push(t):this.#_.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#L.delete(t)){let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#_.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=tb(t);if("string"!=typeof e)return!0;{let s=this.#_.get(e),r=s?.find(t=>"pending"===t.state.status);return!r||r===t}}runNext(t){let e=tb(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#_.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){$.batch(()=>{this.#L.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#L.clear(),this.#_.clear()})}getAll(){return Array.from(this.#L)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>R(e,t))}findAll(t={}){return this.getAll().filter(e=>R(t,e))}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return $.batch(()=>Promise.all(t.map(t=>t.continue().catch(y))))}};function tb(t){return t.options.scope?.id}var tg=class extends c{#c;#O=void 0;#N;#z;constructor(t,e){super(),this.#c=t,this.setOptions(e),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#c.defaultMutationOptions(t),q(this.options,e)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#N,observer:this}),e?.mutationKey&&this.options.mutationKey&&Q(e.mutationKey)!==Q(this.options.mutationKey)?this.reset():this.#N?.state.status==="pending"&&this.#N.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#N?.removeObserver(this)}onMutationUpdate(t){this.#B(),this.#j(t)}getCurrentResult(){return this.#O}reset(){this.#N?.removeObserver(this),this.#N=void 0,this.#B(),this.#j()}mutate(t,e){return this.#z=e,this.#N?.removeObserver(this),this.#N=this.#c.getMutationCache().build(this.#c,this.options),this.#N.addObserver(this),this.#N.execute(t)}#B(){let t=this.#N?.state??tm();this.#O={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#j(t){$.batch(()=>{if(this.#z&&this.hasListeners()){let e=this.#O.variables,s=this.#O.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#z.onSuccess?.(t.data,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(t.data,null,e,s,r)}catch(t){Promise.reject(t)}}else if(t?.type==="error"){try{this.#z.onError?.(t.error,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(void 0,t.error,e,s,r)}catch(t){Promise.reject(t)}}}this.listeners.forEach(t=>{t(this.#O)})})}};function tO(t,e){let s=new Set(e);return t.filter(t=>!s.has(t))}var tR=class extends c{#c;#W;#$;#J;#K;#V;#X;#Y;#Z;#tt=[];constructor(t,e,s){super(),this.#c=t,this.#J=s,this.#$=[],this.#K=[],this.#W=[],this.setQueries(e)}onSubscribe(){1===this.listeners.size&&this.#K.forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#K.forEach(t=>{t.destroy()})}setQueries(t,e){this.#$=t,this.#J=e,$.batch(()=>{let t=this.#K,e=this.#ts(this.#$);e.forEach(t=>t.observer.setOptions(t.defaultedQueryOptions));let s=e.map(t=>t.observer),r=s.map(t=>t.getCurrentResult()),i=t.length!==s.length,n=s.some((e,s)=>e!==t[s]),a=i||n,u=!!a||r.some((t,e)=>{let s=this.#W[e];return!s||!q(t,s)});(a||u)&&(a&&(this.#tt=e,this.#K=s),this.#W=r,this.hasListeners()&&(a&&(tO(t,s).forEach(t=>{t.destroy()}),tO(s,t).forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})),this.#j()))})}getCurrentResult(){return this.#W}getQueries(){return this.#K.map(t=>t.getCurrentQuery())}getObservers(){return this.#K}getOptimisticResult(t,e){let s=this.#ts(t),r=s.map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions)),i=s.map(t=>t.defaultedQueryOptions.queryHash);return[r,t=>this.#tr(t??r,e,i),()=>this.#ti(r,s)]}#ti(t,e){return e.map((s,r)=>{let i=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,t=>{e.forEach(e=>{e.observer.trackProp(t)})})})}#tr(t,e,s){if(e){let r=this.#Z,i=void 0!==s&&void 0!==r&&(r.length!==s.length||s.some((t,e)=>t!==r[e]));return(!this.#V||this.#W!==this.#Y||i||e!==this.#X)&&(this.#X=e,this.#Y=this.#W,void 0!==s&&(this.#Z=s),this.#V=P(this.#V,e(t))),this.#V}return t}#ts(t){let e=new Map;this.#K.forEach(t=>{let s=t.options.queryHash;if(!s)return;let r=e.get(s);r?r.push(t):e.set(s,[t])});let s=[];return t.forEach(t=>{let r=this.#c.defaultQueryOptions(t),i=e.get(r.queryHash)?.shift()??new ta(this.#c,r);s.push({defaultedQueryOptions:r,observer:i})}),s}#te(t,e){let s=this.#K.indexOf(t);if(-1!==s){var r;let t;this.#W=(r=this.#W,(t=r.slice(0))[s]=e,t),this.#j()}}#j(){if(this.hasListeners()){let t=this.#V,e=this.#ti(this.#W,this.#tt);t!==this.#tr(e,this.#J?.combine)&&$.batch(()=>{this.listeners.forEach(t=>{t(this.#W)})})}}},tC=class extends c{constructor(t={}){super(),this.config=t,this.#$=new Map}#$;build(t,e,s){let r=e.queryKey,i=e.queryHash??C(r,e),n=this.get(i);return n||(n=new ts({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#$.has(t.queryHash)||(this.#$.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#$.get(t.queryHash);e&&(t.destroy(),e===t&&this.#$.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#$.get(t)}getAll(){return[...this.#$.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>O(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>O(t,e)):e}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){$.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tQ=class{#tn;#H;#d;#ta;#tu;#to;#th;#tc;constructor(t={}){this.#tn=t.queryCache||new tC,this.#H=t.mutationCache||new tv,this.#d=t.defaultOptions||{},this.#ta=new Map,this.#tu=new Map,this.#to=0}mount(){this.#to++,1===this.#to&&(this.#th=l.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onFocus())}),this.#tc=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onOnline())}))}unmount(){this.#to--,0===this.#to&&(this.#th?.(),this.#th=void 0,this.#tc?.(),this.#tc=void 0)}isFetching(t){return this.#tn.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#H.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#tn.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#tn.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),i=this.#tn.get(r.queryHash),n=i?.state.data,a="function"==typeof e?e(n):e;if(void 0!==a)return this.#tn.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return $.batch(()=>this.#tn.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state}removeQueries(t){let e=this.#tn;$.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#tn;return $.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all($.batch(()=>this.#tn.findAll(t).map(t=>t.cancel(s)))).then(y).catch(y)}invalidateQueries(t,e={}){return $.batch(()=>(this.#tn.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all($.batch(()=>this.#tn.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(y)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(y)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#tn.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(y).catch(y)}fetchInfiniteQuery(t){return t.behavior=tl(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(y).catch(y)}ensureInfiniteQueryData(t){return t.behavior=tl(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return J.isOnline()?this.#H.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#tn}getMutationCache(){return this.#H}getDefaultOptions(){return this.#d}setDefaultOptions(t){this.#d=t}setQueryDefaults(t,e){this.#ta.set(Q(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#ta.values()],s={};return e.forEach(e=>{S(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#tu.set(Q(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#tu.values()],s={};return e.forEach(e=>{S(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#d.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=C(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===k&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#d.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#tn.clear(),this.#H.clear()}};function tS({streamFn:t,refetchMode:e="reset",reducer:s=(t,e)=>T(t,e),initialValue:r=[]}){return async i=>{let n=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),a=!!n&&n.isFetched();a&&"reset"===e&&n.setState({...n.resetState,fetchStatus:"fetching"});let u=r,o=!1,h=j({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>o=!0),c=await t(h),l=a&&"replace"===e;for await(let t of c){if(o)break;l?u=s(u,t):i.client.setQueryData(i.queryKey,e=>s(void 0===e?r:e,t))}return l&&!o&&i.client.setQueryData(i.queryKey,u),i.client.getQueryData(i.queryKey)??r}}var tw=Symbol("dataTagSymbol"),tP=Symbol("dataTagErrorSymbol"),tq=Symbol("unsetMarker"),tE=s(92),tM=s(4552),tD=tE.createContext(void 0),tI=t=>{let e=tE.useContext(tD);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},tF=({client:t,children:e})=>(tE.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,tM.jsx)(tD.Provider,{value:t,children:e})),tT=tE.createContext(!1),tx=()=>tE.useContext(tT),tk=tT.Provider;function tA(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var tU=tE.createContext(tA()),tj=()=>tE.useContext(tU),tK=({children:t})=>{let[e]=tE.useState(()=>tA());return(0,tM.jsx)(tU.Provider,{value:e,children:"function"==typeof t?t(e):t})},tH=(t,e,s)=>{let r=s?.state.error&&"function"==typeof t.throwOnError?U(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&!e.isReset()&&(t.retryOnMount=!1)},tL=t=>{tE.useEffect(()=>{t.clearReset()},[t])},t_=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&void 0===t.data||U(s,[t.error,r])),tG=(t,e)=>void 0===e.state.data,tN=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),s=t.staleTime;t.staleTime="function"==typeof s?(...t)=>e(s(...t)):e(s),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},tz=(t,e)=>t?.suspense&&e.isPending,tB=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tW({queries:t,...e},s){let r=tI(s),i=tx(),n=tj(),a=tE.useMemo(()=>t.map(t=>{let e=r.defaultQueryOptions(t);return e._optimisticResults=i?"isRestoring":"optimistic",e}),[t,r,i]);a.forEach(t=>{tN(t);let e=r.getQueryCache().get(t.queryHash);tH(t,n,e)}),tL(n);let[u]=tE.useState(()=>new tR(r,a,e)),[o,h,c]=u.getOptimisticResult(a,e.combine),l=!i&&!1!==e.subscribed;tE.useSyncExternalStore(tE.useCallback(t=>l?u.subscribe($.batchCalls(t)):y,[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),tE.useEffect(()=>{u.setQueries(a,e)},[a,e,u]);let d=o.some((t,e)=>tz(a[e],t))?o.flatMap((t,e)=>{let s=a[e];if(s&&tz(s,t)){let t=new ta(r,s);return tB(s,t,n)}return[]}):[];if(d.length>0)throw Promise.all(d);let f=o.find((t,e)=>{let s=a[e];return s&&t_({result:t,errorResetBoundary:n,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense})});if(f?.error)throw f.error;return h(c())}function t$(t,e,s){let r=tx(),i=tj(),n=tI(s),a=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(a);let u=n.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",tN(a),tH(a,i,u),tL(i);let o=!n.getQueryCache().get(a.queryHash),[h]=tE.useState(()=>new e(n,a)),c=h.getOptimisticResult(a),l=!r&&!1!==t.subscribed;if(tE.useSyncExternalStore(tE.useCallback(t=>{let e=l?h.subscribe($.batchCalls(t)):y;return h.updateResult(),e},[h,l]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),tE.useEffect(()=>{h.setOptions(a)},[a,h]),tz(a,c))throw tB(a,h,i);if(t_({result:c,errorResetBoundary:i,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw c.error;if(n.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!K.isServer()&&c.isLoading&&c.isFetching&&!r){let t=o?tB(a,h,i):u?.promise;t?.catch(y).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?c:h.trackResult(c)}function tJ(t,e){return t$(t,ta,e)}function tV(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG,placeholderData:void 0},ta,e)}function tX(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG},tp,e)}function tY(t,e){return tW({...t,queries:t.queries.map(t=>({...t,suspense:!0,throwOnError:tG,enabled:!0,placeholderData:void 0}))},e)}function tZ(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchQuery(t)}function t0(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchInfiniteQuery(t)}function t1(t){return t}function t3(t){return t}var t5=({children:t,options:e={},state:s,queryClient:r})=>{let i=tI(r),n=tE.useRef(e);tE.useEffect(()=>{n.current=e});let a=tE.useMemo(()=>{if(s){if("object"!=typeof s)return;let t=i.getQueryCache(),e=s.queries||[],r=[],a=[];for(let s of e){let e=t.get(s.queryHash);e?(s.state.dataUpdatedAt>e.state.dataUpdatedAt||s.promise&&"pending"!==e.state.status&&"fetching"!==e.state.fetchStatus&&void 0!==s.dehydratedAt&&s.dehydratedAt>e.state.dataUpdatedAt)&&a.push(s):r.push(s)}if(r.length>0&&B(i,{queries:r},n.current),a.length>0)return a}},[i,s]);return tE.useEffect(()=>{a&&B(i,{queries:a},n.current)},[i,a]),t};function t2(t,e){let s=tI(e),r=s.getQueryCache();return tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>s.isFetching(t),()=>s.isFetching(t))}function t4(t,e){let s=tI(e);return t8({filters:{...t,status:"pending"}},s).length}function t7(t,e){return t.findAll(e.filters).map(t=>e.select?e.select(t):t.state)}function t8(t={},e){let s=tI(e).getMutationCache(),r=tE.useRef(t),i=tE.useRef(null);return null===i.current&&(i.current=t7(s,t)),tE.useEffect(()=>{r.current=t}),tE.useSyncExternalStore(tE.useCallback(t=>s.subscribe(()=>{let e=P(i.current,t7(s,r.current));i.current!==e&&(i.current=e,$.schedule(t))}),[s]),()=>i.current,()=>i.current)}function t9(t,e){let s=tI(e),[r]=tE.useState(()=>new tg(s,t));tE.useEffect(()=>{r.setOptions(t)},[r,t]);let i=tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=tE.useCallback((t,e)=>{r.mutate(t,e).catch(y)},[r]);if(i.error&&U(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}function t6(t){return t}function et(t,e){return t$(t,tp,e)}}}]);
2
- //# sourceMappingURL=78.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[78],{453(t,e,s){let r,i,n,a,u,o,h;s.r(e),s.d(e,{CancelledError:()=>Y,HydrationBoundary:()=>t5,InfiniteQueryObserver:()=>tp,IsRestoringProvider:()=>tk,Mutation:()=>ty,MutationCache:()=>tv,MutationObserver:()=>tg,QueriesObserver:()=>tR,Query:()=>ts,QueryCache:()=>tC,QueryClient:()=>tQ,QueryClientContext:()=>tD,QueryClientProvider:()=>tF,QueryErrorResetBoundary:()=>tK,QueryObserver:()=>ta,dataTagErrorSymbol:()=>tP,dataTagSymbol:()=>tw,defaultScheduler:()=>W,defaultShouldDehydrateMutation:()=>_,defaultShouldDehydrateQuery:()=>G,dehydrate:()=>z,environmentManager:()=>K,experimental_streamedQuery:()=>tS,focusManager:()=>l,hashKey:()=>Q,hydrate:()=>B,infiniteQueryOptions:()=>t3,isCancelledError:()=>Z,isServer:()=>p,keepPreviousData:()=>F,matchMutation:()=>R,matchQuery:()=>O,mutationOptions:()=>t6,noop:()=>y,notifyManager:()=>$,onlineManager:()=>J,partialMatchKey:()=>S,queryOptions:()=>t1,replaceEqualDeep:()=>P,shouldThrowError:()=>U,skipToken:()=>k,timeoutManager:()=>f,unsetMarker:()=>tq,useInfiniteQuery:()=>et,useIsFetching:()=>t2,useIsMutating:()=>t4,useIsRestoring:()=>tx,useMutation:()=>t9,useMutationState:()=>t8,usePrefetchInfiniteQuery:()=>t0,usePrefetchQuery:()=>tZ,useQueries:()=>tW,useQuery:()=>tJ,useQueryClient:()=>tI,useQueryErrorResetBoundary:()=>tj,useSuspenseInfiniteQuery:()=>tX,useSuspenseQueries:()=>tY,useSuspenseQuery:()=>tV});var c=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},l=new class extends c{#t;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}},d={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},f=new class{#r=d;#i=!1;setTimeoutProvider(t){this.#r=t}setTimeout(t,e){return this.#r.setTimeout(t,e)}clearTimeout(t){this.#r.clearTimeout(t)}setInterval(t,e){return this.#r.setInterval(t,e)}clearInterval(t){this.#r.clearInterval(t)}},p="u"<typeof window||"Deno"in globalThis;function y(){}function m(t){return"number"==typeof t&&t>=0&&t!==1/0}function v(t,e){return Math.max(t+(e||0)-Date.now(),0)}function b(t,e){return"function"==typeof t?t(e):t}function g(t,e){return"function"==typeof t?t(e):t}function O(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==C(a,e.options))return!1}else if(!S(e.queryKey,a))return!1}if("all"!==s){let t=e.isActive();if("active"===s&&!t||"inactive"===s&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function R(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Q(e.options.mutationKey)!==Q(n))return!1}else if(!S(e.options.mutationKey,n))return!1}return(!r||e.state.status===r)&&(!i||!!i(e))}function C(t,e){return(e?.queryKeyHashFn||Q)(t)}function Q(t){return JSON.stringify(t,(t,e)=>M(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function S(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(s=>S(t[s],e[s]))}var w=Object.prototype.hasOwnProperty;function P(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=E(t)&&E(e);if(!r&&!(M(t)&&M(e)))return e;let i=(r?t:Object.keys(t)).length,n=r?e:Object.keys(e),a=n.length,u=r?Array(a):{},o=0;for(let h=0;h<a;h++){let a=r?h:n[h],c=t[a],l=e[a];if(c===l){u[a]=c,(r?h<i:w.call(t,a))&&o++;continue}if(null===c||null===l||"object"!=typeof c||"object"!=typeof l){u[a]=l;continue}let d=P(c,l,s+1);u[a]=d,d===c&&o++}return i===a&&o===i?t:u}function q(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}function E(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function M(t){if(!D(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!D(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?P(t,e):e}function F(t){return t}function T(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}function x(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var k=Symbol();function A(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==k?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function U(t,e){return"function"==typeof t?t(...e):!!t}function j(t,e,s){let r,i=!1;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var K=(r=()=>p,{isServer:()=>r(),setIsServer(t){r=t}});function H(){let t,e,s=new Promise((s,r)=>{t=s,e=r});function r(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{r({status:"fulfilled",value:e}),t(e)},s.reject=t=>{r({status:"rejected",reason:t}),e(t)},s}function L(t){return t}function _(t){return t.state.isPaused}function G(t){return"success"===t.state.status}function N(t){return!0}function z(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??_,r=t.getMutationCache().getAll().flatMap(t=>s(t)?[{mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}]:[]),i=e.shouldDehydrateQuery??t.getDefaultOptions().dehydrate?.shouldDehydrateQuery??G,n=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??N,a=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??L;return{mutations:r,queries:t.getQueryCache().getAll().flatMap(t=>{let e;return i(t)?[{dehydratedAt:Date.now(),state:{...t.state,...void 0!==t.state.data&&{data:a(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,..."pending"===t.state.status&&{promise:(e=t.promise?.then(a).catch(t=>n(t)?Promise.reject(Error("redacted")):Promise.reject(t)),e?.catch(y),e)},...t.meta&&{meta:t.meta}}]:[]})}}function B(t,e,s){if("object"!=typeof e||null===e)return;let r=t.getMutationCache(),i=t.getQueryCache(),n=s?.defaultOptions?.deserializeData??t.getDefaultOptions().hydrate?.deserializeData??L,a=e.mutations||[],u=e.queries||[];a.forEach(({state:e,...i})=>{r.build(t,{...t.getDefaultOptions().hydrate?.mutations,...s?.defaultOptions?.mutations,...i},e)}),u.forEach(({queryKey:e,state:r,queryHash:a,meta:u,promise:o,dehydratedAt:h})=>{let c=o?function(t){let e;if(t.then(t=>(e=t,t),y)?.catch(y),void 0!==e)return{data:e}}(o):void 0,l=void 0===r.data?c?.data:r.data,d=void 0===l?l:n(l),f=i.get(a),p=f?.state.status==="pending",m=f?.state.fetchStatus==="fetching";if(f){let t=c&&void 0!==h&&h>f.state.dataUpdatedAt;if(r.dataUpdatedAt>f.state.dataUpdatedAt||t){let{fetchStatus:t,...e}=r;f.setState({...e,data:d})}}else f=i.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:e,queryHash:a,meta:u},{...r,data:d,fetchStatus:"idle",status:void 0!==d?"success":r.status});o&&!p&&!m&&(void 0===h||h>f.state.dataUpdatedAt)&&f.fetch(void 0,{initialPromise:Promise.resolve(o).then(n)}).catch(y)})}var W=function(t){setTimeout(t,0)},$=(i=[],n=0,a=t=>{t()},u=t=>{t()},o=W,{batch:t=>{let e;n++;try{e=t()}finally{let t;--n||(t=i,i=[],t.length&&o(()=>{u(()=>{t.forEach(t=>{a(t)})})}))}return e},batchCalls:t=>(...e)=>{h(()=>{t(...e)})},schedule:h=t=>{n?i.push(t):o(()=>{a(t)})},setNotifyFunction:t=>{a=t},setBatchNotifyFunction:t=>{u=t},setScheduler:t=>{o=t}}),J=new class extends c{#n=!0;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&window.addEventListener){let e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#n!==t&&(this.#n=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#n}};function V(t){return Math.min(1e3*2**t,3e4)}function X(t){return(t??"online")!=="online"||J.isOnline()}var Y=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Z(t){return t instanceof Y}function tt(t){let e,s=!1,r=0,i=H(),n=()=>l.isFocused()&&("always"===t.networkMode||J.isOnline())&&t.canRun(),a=()=>X(t.networkMode)&&t.canRun(),u=t=>{"pending"===i.status&&(e?.(),i.resolve(t))},o=t=>{"pending"===i.status&&(e?.(),i.reject(t))},h=()=>new Promise(s=>{e=t=>{("pending"!==i.status||n())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===i.status&&t.onContinue?.()}),c=()=>{let e;if("pending"!==i.status)return;let a=0===r?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(u).catch(e=>{if("pending"!==i.status)return;let a=t.retry??3*!K.isServer(),u=t.retryDelay??V,l="function"==typeof u?u(r,e):u,d=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,e);s||!d?o(e):(r++,t.onFail?.(r,e),new Promise(t=>{f.setTimeout(t,l)}).then(()=>n()?void 0:h()).then(()=>{s?o(e):c()}))})};return{promise:i,status:()=>i.status,cancel:e=>{if("pending"===i.status){let s=new Y(e);o(s),t.onCancel?.(s)}},continue:()=>(e?.(),i),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:a,start:()=>(a()?c():h().then(c),i)}}var te=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#a=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(K.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(f.clearTimeout(this.#a),this.#a=void 0)}},ts=class extends te{#u;#o;#h;#c;#l;#d;#f;constructor(t){super(),this.#f=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#c=t.client,this.#h=this.#c.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#u=tn(this.options),this.state=t.state??this.#u,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=tn(this.options);void 0!==t.data&&(this.setState(ti(t.data,t.dataUpdatedAt)),this.#u=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(t,e){let s=I(this.state.data,t,this.options);return this.#p({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#p({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#l?.promise;return this.#l?.cancel(t),e?e.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#u}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>!1!==g(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===b(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!v(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#l&&(this.#f||this.#y()?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#y(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(t,e){let s;if("idle"!==this.state.fetchStatus&&this.#l?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},n=()=>{let t,s=A(this.options,e),r=(i(t={client:this.#c,queryKey:this.queryKey,meta:this.meta}),t);return(this.#f=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},a=(i(s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:n}),s);this.options.behavior?.onFetch(a,this),this.#o=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#p({type:"fetch",meta:a.fetchOptions?.meta}),this.#l=tt({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:t=>{t instanceof Y&&t.revert&&this.setState({...this.#o,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let t=await this.#l.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#h.config.onSuccess?.(t,this),this.#h.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof Y){if(t.silent)return this.#l.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#p({type:"error",error:t}),this.#h.config.onError?.(t,this),this.#h.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#p(t){let e=e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...tr(e.data,this.options),fetchMeta:t.meta??null};case"success":let s={...e,...ti(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?s:void 0,s;case"error":let r=t.error;return{...e,error:r,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),$.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#h.notify({query:this,type:"updated",action:t})})}};function tr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function ti(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function tn(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,r=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var ta=class extends c{constructor(t,e){super(),this.options=e,this.#c=t,this.#m=null,this.#v=H(),this.bindMethods(),this.setOptions(e)}#c;#b=void 0;#g=void 0;#O=void 0;#R;#C;#v;#m;#Q;#S;#w;#P;#q;#E;#M=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),tu(this.#b,this.options)?this.#D():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return to(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return to(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#F(),this.#T(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof g(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#b.setOptions(this.options),e._defaulted&&!q(this.options,e)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&th(this.#b,s,this.options,e)&&this.#D(),this.updateResult(),r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||b(this.options.staleTime,this.#b)!==b(e.staleTime,this.#b))&&this.#k();let i=this.#A();r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||i!==this.#E)&&this.#U(i)}getOptimisticResult(t){var e,s;let r=this.#c.getQueryCache().build(this.#c,t),i=this.createResult(r,t);return e=this,s=i,q(e.getCurrentResult(),s)||(this.#O=i,this.#C=this.options,this.#R=this.#b.state),i}getCurrentResult(){return this.#O}trackResult(t,e){return new Proxy(t,{get:(t,s)=>(this.trackProp(s),e?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,s))})}trackProp(t){this.#M.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#c.defaultQueryOptions(t),s=this.#c.getQueryCache().build(this.#c,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#D({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#O))}#D(t){this.#x();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(y)),e}#k(){this.#F();let t=b(this.options.staleTime,this.#b);if(K.isServer()||this.#O.isStale||!m(t))return;let e=v(this.#O.dataUpdatedAt,t);this.#P=f.setTimeout(()=>{this.#O.isStale||this.updateResult()},e+1)}#A(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(t){this.#T(),this.#E=t,!K.isServer()&&!1!==g(this.options.enabled,this.#b)&&m(this.#E)&&0!==this.#E&&(this.#q=f.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#D()},this.#E))}#I(){this.#k(),this.#U(this.#A())}#F(){void 0!==this.#P&&(f.clearTimeout(this.#P),this.#P=void 0)}#T(){void 0!==this.#q&&(f.clearInterval(this.#q),this.#q=void 0)}createResult(t,e){let s,r=this.#b,i=this.options,n=this.#O,a=this.#R,u=this.#C,o=t!==r?t.state:this.#g,{state:h}=t,c={...h},l=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&tu(t,e),a=s&&th(t,r,e,i);(n||a)&&(c={...c,...tr(h.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;s=c.data;let y=!1;if(void 0!==e.placeholderData&&void 0===s&&"pending"===p){let t;n?.isPlaceholderData&&e.placeholderData===u?.placeholderData?(t=n.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(p="success",s=I(n?.data,t,e),l=!0)}if(e.select&&void 0!==s&&!y)if(n&&s===a?.data&&e.select===this.#Q)s=this.#S;else try{this.#Q=e.select,s=e.select(s),s=I(n?.data,s,e),this.#S=s,this.#m=null}catch(t){this.#m=t}this.#m&&(d=this.#m,s=this.#S,f=Date.now(),p="error");let m="fetching"===c.fetchStatus,v="pending"===p,b="error"===p,O=v&&m,R=void 0!==s,C={status:p,fetchStatus:c.fetchStatus,isPending:v,isSuccess:"success"===p,isError:b,isInitialLoading:O,isLoading:O,data:s,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:m,isRefetching:m&&!v,isLoadingError:b&&!R,isPaused:"paused"===c.fetchStatus,isPlaceholderData:l,isRefetchError:b&&R,isStale:tc(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==g(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=void 0!==C.data,s="error"===C.status&&!e,i=t=>{s?t.reject(C.error):e&&t.resolve(C.data)},n=()=>{i(this.#v=C.promise=H())},a=this.#v;switch(a.status){case"pending":t.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let t=this.#O,e=this.createResult(this.#b,this.options);if(this.#R=this.#b.state,this.#C=this.options,void 0!==this.#R.data&&(this.#w=this.#b),q(e,t))return;this.#O=e;let s=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,s="function"==typeof e?e():e;if("all"===s||!s&&!this.#M.size)return!0;let r=new Set(s??this.#M);return this.options.throwOnError&&r.add("error"),Object.keys(this.#O).some(e=>this.#O[e]!==t[e]&&r.has(e))};this.#j({listeners:s()})}#x(){let t=this.#c.getQueryCache().build(this.#c,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#g=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#j(t){$.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#O)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function tu(t,e){return!1!==g(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&to(t,e,e.refetchOnMount)}function to(t,e,s){if(!1!==g(e.enabled,t)&&"static"!==b(e.staleTime,t)){let r="function"==typeof s?s(t):s;return"always"===r||!1!==r&&tc(t,e)}return!1}function th(t,e,s,r){return(t!==e||!1===g(r.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&tc(t,s)}function tc(t,e){return!1!==g(e.enabled,t)&&t.isStaleByTime(b(e.staleTime,t))}function tl(t){return{onFetch:(e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],a=e.state.data?.pageParams||[],u={pages:[],pageParams:[]},o=0,h=async()=>{let s=!1,h=A(e.options,e.fetchOptions),c=async(t,r,i)=>{let n;if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let a=(j(n={client:e.client,queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta},()=>e.signal,()=>s=!0),n),u=await h(a),{maxPages:o}=e.options,c=i?x:T;return{pages:c(t.pages,u,o),pageParams:c(t.pageParams,r,o)}};if(i&&n.length){let t="backward"===i,e={pages:n,pageParams:a},s=(t?tf:td)(r,e);u=await c(e,s,t)}else{let e=t??n.length;do{let t=0===o?a[0]??r.initialPageParam:td(r,u);if(o>0&&null==t)break;u=await c(u,t),o++}while(o<e)}return u};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function td(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}function tf(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var tp=class extends ta{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:tl()})}getOptimisticResult(t){return t.behavior=tl(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var s,r;let{state:i}=t,n=super.createResult(t,e),{isFetching:a,isRefetching:u,isError:o,isRefetchError:h}=n,c=i.fetchMeta?.fetchMore?.direction,l=o&&"forward"===c,d=a&&"forward"===c,f=o&&"backward"===c,p=a&&"backward"===c;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:!!(s=i.data)&&null!=td(e,s),hasPreviousPage:!!(r=i.data)&&!!e.getPreviousPageParam&&null!=tf(e,r),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:h&&!l&&!f,isRefetching:u&&!d&&!p}}},ty=class extends te{#c;#K;#H;#l;constructor(t){super(),this.#c=t.client,this.mutationId=t.mutationId,this.#H=t.mutationCache,this.#K=[],this.state=t.state||tm(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#K.includes(t)||(this.#K.push(t),this.clearGcTimeout(),this.#H.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#K=this.#K.filter(e=>e!==t),this.scheduleGc(),this.#H.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#K.length||("pending"===this.state.status?this.scheduleGc():this.#H.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#p({type:"continue"})},s={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=tt({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#H.canRun(this)});let r="pending"===this.state.status,i=!this.#l.canStart();try{if(r)e();else{this.#p({type:"pending",variables:t,isPaused:i}),this.#H.config.onMutate&&await this.#H.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#p({type:"pending",context:e,variables:t,isPaused:i})}let n=await this.#l.start();return await this.#H.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#H.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#p({type:"success",data:n}),n}catch(e){try{await this.#H.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#H.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#p({type:"error",error:e}),e}finally{this.#H.runNext(this)}}#p(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),$.batch(()=>{this.#K.forEach(e=>{e.onMutationUpdate(t)}),this.#H.notify({mutation:this,type:"updated",action:t})})}};function tm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tv=class extends c{constructor(t={}){super(),this.config=t,this.#L=new Set,this.#_=new Map,this.#G=0}#L;#_;#G;build(t,e,s){let r=new ty({client:t,mutationCache:this,mutationId:++this.#G,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#L.add(t);let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);s?s.push(t):this.#_.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#L.delete(t)){let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#_.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=tb(t);if("string"!=typeof e)return!0;{let s=this.#_.get(e),r=s?.find(t=>"pending"===t.state.status);return!r||r===t}}runNext(t){let e=tb(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#_.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){$.batch(()=>{this.#L.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#L.clear(),this.#_.clear()})}getAll(){return Array.from(this.#L)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>R(e,t))}findAll(t={}){return this.getAll().filter(e=>R(t,e))}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return $.batch(()=>Promise.all(t.map(t=>t.continue().catch(y))))}};function tb(t){return t.options.scope?.id}var tg=class extends c{#c;#O=void 0;#N;#z;constructor(t,e){super(),this.#c=t,this.setOptions(e),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#c.defaultMutationOptions(t),q(this.options,e)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#N,observer:this}),e?.mutationKey&&this.options.mutationKey&&Q(e.mutationKey)!==Q(this.options.mutationKey)?this.reset():this.#N?.state.status==="pending"&&this.#N.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#N?.removeObserver(this)}onMutationUpdate(t){this.#B(),this.#j(t)}getCurrentResult(){return this.#O}reset(){this.#N?.removeObserver(this),this.#N=void 0,this.#B(),this.#j()}mutate(t,e){return this.#z=e,this.#N?.removeObserver(this),this.#N=this.#c.getMutationCache().build(this.#c,this.options),this.#N.addObserver(this),this.#N.execute(t)}#B(){let t=this.#N?.state??tm();this.#O={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#j(t){$.batch(()=>{if(this.#z&&this.hasListeners()){let e=this.#O.variables,s=this.#O.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#z.onSuccess?.(t.data,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(t.data,null,e,s,r)}catch(t){Promise.reject(t)}}else if(t?.type==="error"){try{this.#z.onError?.(t.error,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(void 0,t.error,e,s,r)}catch(t){Promise.reject(t)}}}this.listeners.forEach(t=>{t(this.#O)})})}};function tO(t,e){let s=new Set(e);return t.filter(t=>!s.has(t))}var tR=class extends c{#c;#W;#$;#J;#K;#V;#X;#Y;#Z;#tt=[];constructor(t,e,s){super(),this.#c=t,this.#J=s,this.#$=[],this.#K=[],this.#W=[],this.setQueries(e)}onSubscribe(){1===this.listeners.size&&this.#K.forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#K.forEach(t=>{t.destroy()})}setQueries(t,e){this.#$=t,this.#J=e,$.batch(()=>{let t=this.#K,e=this.#ts(this.#$);e.forEach(t=>t.observer.setOptions(t.defaultedQueryOptions));let s=e.map(t=>t.observer),r=s.map(t=>t.getCurrentResult()),i=t.length!==s.length,n=s.some((e,s)=>e!==t[s]),a=i||n,u=!!a||r.some((t,e)=>{let s=this.#W[e];return!s||!q(t,s)});(a||u)&&(a&&(this.#tt=e,this.#K=s),this.#W=r,this.hasListeners()&&(a&&(tO(t,s).forEach(t=>{t.destroy()}),tO(s,t).forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})),this.#j()))})}getCurrentResult(){return this.#W}getQueries(){return this.#K.map(t=>t.getCurrentQuery())}getObservers(){return this.#K}getOptimisticResult(t,e){let s=this.#ts(t),r=s.map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions)),i=s.map(t=>t.defaultedQueryOptions.queryHash);return[r,t=>this.#tr(t??r,e,i),()=>this.#ti(r,s)]}#ti(t,e){return e.map((s,r)=>{let i=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,t=>{e.forEach(e=>{e.observer.trackProp(t)})})})}#tr(t,e,s){if(e){let r=this.#Z,i=void 0!==s&&void 0!==r&&(r.length!==s.length||s.some((t,e)=>t!==r[e]));return(!this.#V||this.#W!==this.#Y||i||e!==this.#X)&&(this.#X=e,this.#Y=this.#W,void 0!==s&&(this.#Z=s),this.#V=P(this.#V,e(t))),this.#V}return t}#ts(t){let e=new Map;this.#K.forEach(t=>{let s=t.options.queryHash;if(!s)return;let r=e.get(s);r?r.push(t):e.set(s,[t])});let s=[];return t.forEach(t=>{let r=this.#c.defaultQueryOptions(t),i=e.get(r.queryHash)?.shift()??new ta(this.#c,r);s.push({defaultedQueryOptions:r,observer:i})}),s}#te(t,e){let s=this.#K.indexOf(t);if(-1!==s){var r;let t;this.#W=(r=this.#W,(t=r.slice(0))[s]=e,t),this.#j()}}#j(){if(this.hasListeners()){let t=this.#V,e=this.#ti(this.#W,this.#tt);t!==this.#tr(e,this.#J?.combine)&&$.batch(()=>{this.listeners.forEach(t=>{t(this.#W)})})}}},tC=class extends c{constructor(t={}){super(),this.config=t,this.#$=new Map}#$;build(t,e,s){let r=e.queryKey,i=e.queryHash??C(r,e),n=this.get(i);return n||(n=new ts({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#$.has(t.queryHash)||(this.#$.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#$.get(t.queryHash);e&&(t.destroy(),e===t&&this.#$.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#$.get(t)}getAll(){return[...this.#$.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>O(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>O(t,e)):e}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){$.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tQ=class{#tn;#H;#d;#ta;#tu;#to;#th;#tc;constructor(t={}){this.#tn=t.queryCache||new tC,this.#H=t.mutationCache||new tv,this.#d=t.defaultOptions||{},this.#ta=new Map,this.#tu=new Map,this.#to=0}mount(){this.#to++,1===this.#to&&(this.#th=l.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onFocus())}),this.#tc=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onOnline())}))}unmount(){this.#to--,0===this.#to&&(this.#th?.(),this.#th=void 0,this.#tc?.(),this.#tc=void 0)}isFetching(t){return this.#tn.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#H.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#tn.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#tn.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),i=this.#tn.get(r.queryHash),n=i?.state.data,a="function"==typeof e?e(n):e;if(void 0!==a)return this.#tn.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return $.batch(()=>this.#tn.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state}removeQueries(t){let e=this.#tn;$.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#tn;return $.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all($.batch(()=>this.#tn.findAll(t).map(t=>t.cancel(s)))).then(y).catch(y)}invalidateQueries(t,e={}){return $.batch(()=>(this.#tn.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all($.batch(()=>this.#tn.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(y)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(y)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#tn.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(y).catch(y)}fetchInfiniteQuery(t){return t.behavior=tl(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(y).catch(y)}ensureInfiniteQueryData(t){return t.behavior=tl(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return J.isOnline()?this.#H.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#tn}getMutationCache(){return this.#H}getDefaultOptions(){return this.#d}setDefaultOptions(t){this.#d=t}setQueryDefaults(t,e){this.#ta.set(Q(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#ta.values()],s={};return e.forEach(e=>{S(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#tu.set(Q(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#tu.values()],s={};return e.forEach(e=>{S(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#d.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=C(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===k&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#d.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#tn.clear(),this.#H.clear()}};function tS({streamFn:t,refetchMode:e="reset",reducer:s=(t,e)=>T(t,e),initialValue:r=[]}){return async i=>{let n=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),a=!!n&&n.isFetched();a&&"reset"===e&&n.setState({...n.resetState,fetchStatus:"fetching"});let u=r,o=!1,h=j({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>o=!0),c=await t(h),l=a&&"replace"===e;for await(let t of c){if(o)break;l?u=s(u,t):i.client.setQueryData(i.queryKey,e=>s(void 0===e?r:e,t))}return l&&!o&&i.client.setQueryData(i.queryKey,u),i.client.getQueryData(i.queryKey)??r}}var tw=Symbol("dataTagSymbol"),tP=Symbol("dataTagErrorSymbol"),tq=Symbol("unsetMarker"),tE=s(92),tM=s(4552),tD=tE.createContext(void 0),tI=t=>{let e=tE.useContext(tD);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},tF=({client:t,children:e})=>(tE.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,tM.jsx)(tD.Provider,{value:t,children:e})),tT=tE.createContext(!1),tx=()=>tE.useContext(tT),tk=tT.Provider;function tA(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var tU=tE.createContext(tA()),tj=()=>tE.useContext(tU),tK=({children:t})=>{let[e]=tE.useState(()=>tA());return(0,tM.jsx)(tU.Provider,{value:e,children:"function"==typeof t?t(e):t})},tH=(t,e,s)=>{let r=s?.state.error&&"function"==typeof t.throwOnError?U(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&!e.isReset()&&(t.retryOnMount=!1)},tL=t=>{tE.useEffect(()=>{t.clearReset()},[t])},t_=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&void 0===t.data||U(s,[t.error,r])),tG=(t,e)=>void 0===e.state.data,tN=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),s=t.staleTime;t.staleTime="function"==typeof s?(...t)=>e(s(...t)):e(s),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},tz=(t,e)=>t?.suspense&&e.isPending,tB=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tW({queries:t,...e},s){let r=tI(s),i=tx(),n=tj(),a=tE.useMemo(()=>t.map(t=>{let e=r.defaultQueryOptions(t);return e._optimisticResults=i?"isRestoring":"optimistic",e}),[t,r,i]);a.forEach(t=>{tN(t);let e=r.getQueryCache().get(t.queryHash);tH(t,n,e)}),tL(n);let[u]=tE.useState(()=>new tR(r,a,e)),[o,h,c]=u.getOptimisticResult(a,e.combine),l=!i&&!1!==e.subscribed;tE.useSyncExternalStore(tE.useCallback(t=>l?u.subscribe($.batchCalls(t)):y,[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),tE.useEffect(()=>{u.setQueries(a,e)},[a,e,u]);let d=o.some((t,e)=>tz(a[e],t))?o.flatMap((t,e)=>{let s=a[e];if(s&&tz(s,t)){let t=new ta(r,s);return tB(s,t,n)}return[]}):[];if(d.length>0)throw Promise.all(d);let f=o.find((t,e)=>{let s=a[e];return s&&t_({result:t,errorResetBoundary:n,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense})});if(f?.error)throw f.error;return h(c())}function t$(t,e,s){let r=tx(),i=tj(),n=tI(s),a=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(a);let u=n.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",tN(a),tH(a,i,u),tL(i);let o=!n.getQueryCache().get(a.queryHash),[h]=tE.useState(()=>new e(n,a)),c=h.getOptimisticResult(a),l=!r&&!1!==t.subscribed;if(tE.useSyncExternalStore(tE.useCallback(t=>{let e=l?h.subscribe($.batchCalls(t)):y;return h.updateResult(),e},[h,l]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),tE.useEffect(()=>{h.setOptions(a)},[a,h]),tz(a,c))throw tB(a,h,i);if(t_({result:c,errorResetBoundary:i,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw c.error;if(n.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!K.isServer()&&c.isLoading&&c.isFetching&&!r){let t=o?tB(a,h,i):u?.promise;t?.catch(y).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?c:h.trackResult(c)}function tJ(t,e){return t$(t,ta,e)}function tV(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG,placeholderData:void 0},ta,e)}function tX(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG},tp,e)}function tY(t,e){return tW({...t,queries:t.queries.map(t=>({...t,suspense:!0,throwOnError:tG,enabled:!0,placeholderData:void 0}))},e)}function tZ(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchQuery(t)}function t0(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchInfiniteQuery(t)}function t1(t){return t}function t3(t){return t}var t5=({children:t,options:e={},state:s,queryClient:r})=>{let i=tI(r),n=tE.useRef(e);tE.useEffect(()=>{n.current=e});let a=tE.useMemo(()=>{if(s){if("object"!=typeof s)return;let t=i.getQueryCache(),e=s.queries||[],r=[],a=[];for(let s of e){let e=t.get(s.queryHash);e?(s.state.dataUpdatedAt>e.state.dataUpdatedAt||s.promise&&"pending"!==e.state.status&&"fetching"!==e.state.fetchStatus&&void 0!==s.dehydratedAt&&s.dehydratedAt>e.state.dataUpdatedAt)&&a.push(s):r.push(s)}if(r.length>0&&B(i,{queries:r},n.current),a.length>0)return a}},[i,s]);return tE.useEffect(()=>{a&&B(i,{queries:a},n.current)},[i,a]),t};function t2(t,e){let s=tI(e),r=s.getQueryCache();return tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>s.isFetching(t),()=>s.isFetching(t))}function t4(t,e){let s=tI(e);return t8({filters:{...t,status:"pending"}},s).length}function t7(t,e){return t.findAll(e.filters).map(t=>e.select?e.select(t):t.state)}function t8(t={},e){let s=tI(e).getMutationCache(),r=tE.useRef(t),i=tE.useRef(null);return null===i.current&&(i.current=t7(s,t)),tE.useEffect(()=>{r.current=t}),tE.useSyncExternalStore(tE.useCallback(t=>s.subscribe(()=>{let e=P(i.current,t7(s,r.current));i.current!==e&&(i.current=e,$.schedule(t))}),[s]),()=>i.current,()=>i.current)}function t9(t,e){let s=tI(e),[r]=tE.useState(()=>new tg(s,t));tE.useEffect(()=>{r.setOptions(t)},[r,t]);let i=tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=tE.useCallback((t,e)=>{r.mutate(t,e).catch(y)},[r]);if(i.error&&U(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}function t6(t){return t}function et(t,e){return t$(t,tp,e)}}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[945],{6026(e,r){var o=Symbol.for("react.transitional.element");function n(e,r,n){var s=null;if(void 0!==n&&(s=""+n),void 0!==r.key&&(s=""+r.key),"key"in r)for(var t in n={},r)"key"!==t&&(n[t]=r[t]);else n=r;return{$$typeof:o,type:e,key:s,ref:void 0!==(r=n.ref)?r:null,props:n}}r.Fragment=Symbol.for("react.fragment"),r.jsx=n,r.jsxs=n},4552(e,r,o){e.exports=o(6026)}}]);
2
- //# sourceMappingURL=945.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[945],{6026(e,r){var o=Symbol.for("react.transitional.element");function n(e,r,n){var s=null;if(void 0!==n&&(s=""+n),void 0!==r.key&&(s=""+r.key),"key"in r)for(var t in n={},r)"key"!==t&&(n[t]=r[t]);else n=r;return{$$typeof:o,type:e,key:s,ref:void 0!==(r=n.ref)?r:null,props:n}}r.Fragment=Symbol.for("react.fragment"),r.jsx=n,r.jsxs=n},4552(e,r,o){e.exports=o(6026)}}]);
@@ -6,5 +6,4 @@ ${p(e,m)}
6
6
  .dark {
7
7
  ${p(r,b)}
8
8
  }
9
- `.trim()}a.d(r,{colors:()=>t,darkSemanticColors:()=>b,darkTheme:()=>c,generateCSSVars:()=>p,generateThemeCSS:()=>d,lightSemanticColors:()=>m,lightTheme:()=>f,radius:()=>o,shadows:()=>i,spacing:()=>s,typography:()=>n})}}]);
10
- //# sourceMappingURL=968.js.map
9
+ `.trim()}a.d(r,{colors:()=>t,darkSemanticColors:()=>b,darkTheme:()=>c,generateCSSVars:()=>p,generateThemeCSS:()=>d,lightSemanticColors:()=>m,lightTheme:()=>f,radius:()=>o,shadows:()=>i,spacing:()=>s,typography:()=>n})}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[772],{6026(e,t){var n=Symbol.for("react.transitional.element");function a(e,t,a){var r=null;if(void 0!==a&&(r=""+a),void 0!==t.key&&(r=""+t.key),"key"in t)for(var s in a={},t)"key"!==s&&(a[s]=t[s]);else a=t;return{$$typeof:n,type:e,key:r,ref:void 0!==(t=a.ref)?t:null,props:a}}t.Fragment=Symbol.for("react.fragment"),t.jsx=a,t.jsxs=a},4552(e,t,n){e.exports=n(6026)},1597(e,t,n){n.r(t);var a=n(4552);n(92);var r=n(5155),s=n(4519);function l(){var e,t,n,l=(0,s.useData)("/exec/api/v1/crons"),i=l.data,o=l.isLoading,c=function(e){return e?new Date(e).toLocaleString():"-"},d=[{title:"Cron ID",dataIndex:"id",key:"id",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",strong:!0,children:e})}},{title:"Schedule",dataIndex:"schedule",key:"schedule",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",code:!0,children:e})]})}},{title:"Job Type",dataIndex:"jobType",key:"jobType",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",children:e})}},{title:"Timezone",dataIndex:"timezone",key:"timezone",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:e||"UTC"})}},{title:"Status",dataIndex:"enabled",key:"enabled",render:function(e){return(0,a.jsx)(r.UIBadge,{variant:e?"success":"default",children:e?"Enabled":"Disabled"})}},{title:"Last Run",dataIndex:"lastRun",key:"lastRun",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]})}},{title:"Next Run",dataIndex:"nextRun",key:"nextRun",render:function(e){return e?(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-info"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",render:function(e){return e?(0,a.jsx)(r.UITag,{color:"blue",children:e}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}],y=(null==i||null==(e=i.crons)?void 0:e.filter(function(e){return e.enabled}).length)||0,p=(null==i||null==(t=i.crons)?void 0:t.filter(function(e){return!e.enabled}).length)||0;return(0,a.jsxs)(r.UIPage,{width:"full",children:[(0,a.jsx)(r.UIPageHeader,{title:"Cron Jobs",description:"Scheduled recurring tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Crons"}]}),(0,a.jsx)(r.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,a.jsxs)(r.UISpace,{className:"gap-section",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Total Cron Jobs"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:(null==i||null==(n=i.crons)?void 0:n.length)||0})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Enabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title text-success",children:y})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Disabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:p})})]})]})}),(0,a.jsx)(r.UICard,{children:(0,a.jsx)(r.UITable,{dataSource:(null==i?void 0:i.crons)||[],columns:d,loading:o,rowKey:"id",pagination:{pageSize:20}})})]})}n.d(t,{default:()=>l})}}]);
2
- //# sourceMappingURL=__federation_expose_Crons.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[772],{6026(e,t){var n=Symbol.for("react.transitional.element");function a(e,t,a){var r=null;if(void 0!==a&&(r=""+a),void 0!==t.key&&(r=""+t.key),"key"in t)for(var s in a={},t)"key"!==s&&(a[s]=t[s]);else a=t;return{$$typeof:n,type:e,key:r,ref:void 0!==(t=a.ref)?t:null,props:a}}t.Fragment=Symbol.for("react.fragment"),t.jsx=a,t.jsxs=a},4552(e,t,n){e.exports=n(6026)},1597(e,t,n){n.r(t);var a=n(4552);n(92);var r=n(5155),s=n(4519);function l(){var e,t,n,l=(0,s.useData)("/exec/api/v1/crons"),i=l.data,o=l.isLoading,c=function(e){return e?new Date(e).toLocaleString():"-"},d=[{title:"Cron ID",dataIndex:"id",key:"id",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",strong:!0,children:e})}},{title:"Schedule",dataIndex:"schedule",key:"schedule",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",code:!0,children:e})]})}},{title:"Job Type",dataIndex:"jobType",key:"jobType",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",children:e})}},{title:"Timezone",dataIndex:"timezone",key:"timezone",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:e||"UTC"})}},{title:"Status",dataIndex:"enabled",key:"enabled",render:function(e){return(0,a.jsx)(r.UIBadge,{variant:e?"success":"default",children:e?"Enabled":"Disabled"})}},{title:"Last Run",dataIndex:"lastRun",key:"lastRun",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]})}},{title:"Next Run",dataIndex:"nextRun",key:"nextRun",render:function(e){return e?(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-info"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",render:function(e){return e?(0,a.jsx)(r.UITag,{color:"blue",children:e}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}],y=(null==i||null==(e=i.crons)?void 0:e.filter(function(e){return e.enabled}).length)||0,p=(null==i||null==(t=i.crons)?void 0:t.filter(function(e){return!e.enabled}).length)||0;return(0,a.jsxs)(r.UIPage,{width:"full",children:[(0,a.jsx)(r.UIPageHeader,{title:"Cron Jobs",description:"Scheduled recurring tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Crons"}]}),(0,a.jsx)(r.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,a.jsxs)(r.UISpace,{className:"gap-section",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Total Cron Jobs"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:(null==i||null==(n=i.crons)?void 0:n.length)||0})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Enabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title text-success",children:y})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Disabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:p})})]})]})}),(0,a.jsx)(r.UICard,{children:(0,a.jsx)(r.UITable,{dataSource:(null==i?void 0:i.crons)||[],columns:d,loading:o,rowKey:"id",pagination:{pageSize:20}})})]})}n.d(t,{default:()=>l})}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[685],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(92),a=r(5155);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,l=e.value,i=e.onChange,s=(0,n.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(a.UISwitch,{checked:void 0!==l?!!l:null!=(t=o.default)&&t,onChange:i})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInputNumber,{style:{width:"100%"},value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:i})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInput,{value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return i(e)}})]})}function u(e){var t,r,l=e.open,u=e.onClose,p=e.onRun,d=e.loading,y="workflows"in e&&Array.isArray(e.workflows),f=y?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],x=h[1],g=s(o.useState("{}"),2),v=g[0],j=g[1],I=s(o.useState(null),2),b=I[0],w=I[1],U=s(o.useState({}),2),T=U[0],k=U[1],S=y?null!=(t=f.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,N=null==S?void 0:S.inputs,O=!!N&&Object.keys(N).length>0;o.useEffect(function(){if(l)if(j("{}"),w(null),y||x(void 0),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),c=i[0],u=i[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[l,null==S?void 0:S.id,N,y]),o.useEffect(function(){if(y&&m)if(j("{}"),w(null),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),i=l[0],c=l[1];void 0!==c.default&&(e[i]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[m,N,y]);var C=(0,n.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(a.UIButton,{onClick:u,disabled:d,children:"Cancel"}),(0,n.jsx)(a.UIButton,{variant:"primary",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:d,disabled:!S||!O&&!!b,onClick:function(){if(S)if(O)p(S.id,T);else{var e=v.trim();if(!e||"{}"===e)return void p(S.id,{});try{var t=JSON.parse(e);p(S.id,t)}catch(e){w("Invalid JSON")}}},children:"Run"})]}),A=S?"Run Workflow: ".concat(S.name):"Run Workflow";return(0,n.jsxs)(a.UIModal,{open:l,title:(0,n.jsxs)(a.UISpace,{className:"gap-item",children:[(0,n.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:C,maskClosable:!d,children:[y&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return x(e)},showSearch:!0,options:f.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),S&&O&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(N).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:T[r],onChange:function(e){return k(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i(e,t,r[t])})}return e}({},t),o=null!=(o=i({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),S&&!O&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(a.UIInputTextArea,{value:v,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void w(null);try{JSON.parse(t),w(null)}catch(e){w("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},5484(e,t,r){r.r(t),r.d(t,{default:()=>g});var n=r(4552),o=r(92),a=r(7493),l=r(5155),i=r(4519);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){var t=e.runId,r=e.onSuccess,o=u((0,l.useUIMessage)(),2),a=o[0],s=o[1],p=(0,i.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,n.jsxs)(n.Fragment,{children:[s,(0,n.jsx)(l.UIButton,{variant:"text",size:"small",danger:!0,icon:(0,n.jsx)(l.UIIcon,{name:"StopOutlined"}),loading:p.isLoading,onClick:function(e){var n;return(n=function(){var n;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var c=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:e.preventDefault(),e.stopPropagation(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,p.mutateAsync()];case 2:return o.sent(),a.success("Run ".concat(t.slice(0,8)," cancelled")),r(),[3,4];case 3:return n=o.sent(),a.error("Failed to cancel: ".concat(n.message)),[3,4];case 4:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function l(e){c(a,r,o,l,i,"next",e)}function i(e){c(a,r,o,l,i,"throw",e)}l(void 0)})})()},children:"Cancel"})]})}function d(){var e=u((0,l.useUIMessage)(),2),t=(e[0],e[1]),r=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}),o=r.data,s=r.isLoading,c=r.refetch,d=(null==o?void 0:o.activeExecutions)||[],y=d.length>0,f=d.some(function(e){return"waiting_approval"===e.status}),h=function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")};return(0,n.jsxs)(n.Fragment,{children:[t,f&&(0,n.jsx)(l.UIAlert,{variant:"warning",message:"Waiting for your approval",description:"One or more workflow steps require your decision.",showIcon:!0,style:{marginBottom:"var(--spacing-card)"}}),(0,n.jsx)(l.UICard,{title:(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-card-title",children:["Active Runs (",d.length,")"]}),(0,n.jsx)(l.UIButton,{variant:"text",size:"small",icon:(0,n.jsx)(l.UIIcon,{name:"ReloadOutlined",spin:s}),onClick:function(){return c()}})]}),style:{marginBottom:"var(--spacing-section)"},children:y?(0,n.jsx)(l.UIList,{dataSource:d,renderItem:function(e){return(0,n.jsxs)(l.UIListItem,{actions:[(0,n.jsx)(p,{runId:e.id,onSuccess:function(){return c()}},"cancel")],children:[(0,n.jsx)(l.UIListItemMeta,{title:(0,n.jsx)(a.Link,{to:"/p/workflows/runs/".concat(e.id),style:{color:"inherit",textDecoration:"none"},children:(0,n.jsxs)(l.UISpace,{children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",style:{color:"var(--color-link)"},children:e.workflowName||e.type}),void 0!==e.progress&&(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[e.progress,"%"]})]})}),description:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",style:{width:"100%"},children:[e.progressMessage&&(0,n.jsx)(l.UITypographyText,{className:"typo-description",children:e.progressMessage}),(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsx)(l.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-secondary",children:h(e.durationMs)}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",children:["ID: ",e.id.slice(0,8)]})]})]})}),void 0!==e.progress&&(0,n.jsx)(l.UIProgress,{percent:e.progress,size:"small",status:"active",style:{width:120}})]})}}):(0,n.jsx)(l.UITypographyText,{className:"typo-description text-secondary",children:"No active runs"})})]})}var y=r(6631);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={completed:(0,n.jsx)(l.UIIcon,{name:"CheckCircleOutlined",className:"text-success"}),failed:(0,n.jsx)(l.UIIcon,{name:"CloseCircleOutlined",className:"text-error"}),cancelled:(0,n.jsx)(l.UIIcon,{name:"StopOutlined",className:"text-warning"})},x={completed:"success",failed:"error",cancelled:"warning"};function g(){var e,t=(0,a.useNavigate)(),r=h((0,l.useUIMessage)(),2),s=r[0],c=r[1],u=h(o.useState(!1),2),p=u[0],f=u[1],g=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}).data,v=(0,i.useData)("/exec/api/v1/workflows",{params:{limit:100}}).data,j=(0,i.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return e.input}}),I=(null==g?void 0:g.recentActivity)||[],b=[{title:"Time",dataIndex:"finishedAt",key:"finishedAt",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:function(e){var t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/6e4);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");var n=Math.floor(r/60);if(n<24)return"".concat(n,"h ago");var o=Math.floor(n/24);return"".concat(o,"d ago")}(e)})}},{title:"Workflow / Job",dataIndex:"workflowName",key:"workflowName",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{overflow:"hidden"},children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e||t.type},style:{display:"block"},children:e||t.type}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:t.id},style:{display:"block"},children:[t.id.slice(0,16),"..."]})]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){return(0,n.jsx)(l.UITag,{icon:m[e],color:x[e],children:e.toUpperCase()})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}(e)})}},{title:"Error",dataIndex:"error",key:"error",render:function(e){return e?(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(l.UIPage,{width:"full",children:[c,(0,n.jsx)(l.UIPageHeader,{title:"Workflows",description:"Monitor workflows, jobs, and scheduled tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows"}],actions:(0,n.jsx)(l.UIButton,{variant:"primary",icon:(0,n.jsx)(l.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){f(!0)},children:"Run Workflow"})}),(0,n.jsx)(d,{}),(0,n.jsx)(l.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(l.UIRow,{gutter:16,children:[(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Total Workflows"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.workflows.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.workflows.active)||0," active"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.workflows.inactive)||0," inactive"]})]})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Running"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-info",children:(null==g?void 0:g.jobs.running)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.jobs.pending)||0," pending"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Completed"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-success",children:(null==g?void 0:g.jobs.completed)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-error",children:[(null==g?void 0:g.jobs.failed)||0," failed"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Cron Jobs"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.crons.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.crons.enabled)||0," enabled"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.crons.disabled)||0," disabled"]})]})]})})]})}),(0,n.jsx)(l.UICard,{title:(0,n.jsx)(l.UITypographyText,{className:"typo-card-title",children:"Recent Activity"}),style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsx)(l.UITable,{dataSource:I,columns:b,rowKey:"id",scroll:{x:760},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return t("/p/workflows/runs/".concat(e.id))}}}})}),(0,n.jsx)(y.y,{open:p,workflows:null!=(e=null==v?void 0:v.workflows)?e:[],loading:j.isLoading,onClose:function(){return f(!1)},onRun:function(e,r){j.mutate({workflowId:e,input:r},{onSuccess:function(e){f(!1),t("/p/workflows/runs/".concat(e.runId))},onError:function(t){s.error('Failed to start workflow "'.concat(e,'": ').concat(t.message))}})}})]})}}}]);
2
- //# sourceMappingURL=__federation_expose_Dashboard.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[685],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(92),a=r(5155);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,l=e.value,i=e.onChange,s=(0,n.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(a.UISwitch,{checked:void 0!==l?!!l:null!=(t=o.default)&&t,onChange:i})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInputNumber,{style:{width:"100%"},value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:i})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInput,{value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return i(e)}})]})}function u(e){var t,r,l=e.open,u=e.onClose,p=e.onRun,d=e.loading,y="workflows"in e&&Array.isArray(e.workflows),f=y?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],x=h[1],g=s(o.useState("{}"),2),v=g[0],j=g[1],I=s(o.useState(null),2),b=I[0],w=I[1],U=s(o.useState({}),2),T=U[0],k=U[1],S=y?null!=(t=f.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,N=null==S?void 0:S.inputs,O=!!N&&Object.keys(N).length>0;o.useEffect(function(){if(l)if(j("{}"),w(null),y||x(void 0),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),c=i[0],u=i[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[l,null==S?void 0:S.id,N,y]),o.useEffect(function(){if(y&&m)if(j("{}"),w(null),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),i=l[0],c=l[1];void 0!==c.default&&(e[i]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[m,N,y]);var C=(0,n.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(a.UIButton,{onClick:u,disabled:d,children:"Cancel"}),(0,n.jsx)(a.UIButton,{variant:"primary",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:d,disabled:!S||!O&&!!b,onClick:function(){if(S)if(O)p(S.id,T);else{var e=v.trim();if(!e||"{}"===e)return void p(S.id,{});try{var t=JSON.parse(e);p(S.id,t)}catch(e){w("Invalid JSON")}}},children:"Run"})]}),A=S?"Run Workflow: ".concat(S.name):"Run Workflow";return(0,n.jsxs)(a.UIModal,{open:l,title:(0,n.jsxs)(a.UISpace,{className:"gap-item",children:[(0,n.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:C,maskClosable:!d,children:[y&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return x(e)},showSearch:!0,options:f.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),S&&O&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(N).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:T[r],onChange:function(e){return k(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i(e,t,r[t])})}return e}({},t),o=null!=(o=i({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),S&&!O&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(a.UIInputTextArea,{value:v,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void w(null);try{JSON.parse(t),w(null)}catch(e){w("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},5484(e,t,r){r.r(t),r.d(t,{default:()=>g});var n=r(4552),o=r(92),a=r(7493),l=r(5155),i=r(4519);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){var t=e.runId,r=e.onSuccess,o=u((0,l.useUIMessage)(),2),a=o[0],s=o[1],p=(0,i.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,n.jsxs)(n.Fragment,{children:[s,(0,n.jsx)(l.UIButton,{variant:"text",size:"small",danger:!0,icon:(0,n.jsx)(l.UIIcon,{name:"StopOutlined"}),loading:p.isLoading,onClick:function(e){var n;return(n=function(){var n;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var c=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:e.preventDefault(),e.stopPropagation(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,p.mutateAsync()];case 2:return o.sent(),a.success("Run ".concat(t.slice(0,8)," cancelled")),r(),[3,4];case 3:return n=o.sent(),a.error("Failed to cancel: ".concat(n.message)),[3,4];case 4:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function l(e){c(a,r,o,l,i,"next",e)}function i(e){c(a,r,o,l,i,"throw",e)}l(void 0)})})()},children:"Cancel"})]})}function d(){var e=u((0,l.useUIMessage)(),2),t=(e[0],e[1]),r=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}),o=r.data,s=r.isLoading,c=r.refetch,d=(null==o?void 0:o.activeExecutions)||[],y=d.length>0,f=d.some(function(e){return"waiting_approval"===e.status}),h=function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")};return(0,n.jsxs)(n.Fragment,{children:[t,f&&(0,n.jsx)(l.UIAlert,{variant:"warning",message:"Waiting for your approval",description:"One or more workflow steps require your decision.",showIcon:!0,style:{marginBottom:"var(--spacing-card)"}}),(0,n.jsx)(l.UICard,{title:(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-card-title",children:["Active Runs (",d.length,")"]}),(0,n.jsx)(l.UIButton,{variant:"text",size:"small",icon:(0,n.jsx)(l.UIIcon,{name:"ReloadOutlined",spin:s}),onClick:function(){return c()}})]}),style:{marginBottom:"var(--spacing-section)"},children:y?(0,n.jsx)(l.UIList,{dataSource:d,renderItem:function(e){return(0,n.jsxs)(l.UIListItem,{actions:[(0,n.jsx)(p,{runId:e.id,onSuccess:function(){return c()}},"cancel")],children:[(0,n.jsx)(l.UIListItemMeta,{title:(0,n.jsx)(a.Link,{to:"/p/workflows/runs/".concat(e.id),style:{color:"inherit",textDecoration:"none"},children:(0,n.jsxs)(l.UISpace,{children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",style:{color:"var(--color-link)"},children:e.workflowName||e.type}),void 0!==e.progress&&(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[e.progress,"%"]})]})}),description:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",style:{width:"100%"},children:[e.progressMessage&&(0,n.jsx)(l.UITypographyText,{className:"typo-description",children:e.progressMessage}),(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsx)(l.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-secondary",children:h(e.durationMs)}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",children:["ID: ",e.id.slice(0,8)]})]})]})}),void 0!==e.progress&&(0,n.jsx)(l.UIProgress,{percent:e.progress,size:"small",status:"active",style:{width:120}})]})}}):(0,n.jsx)(l.UITypographyText,{className:"typo-description text-secondary",children:"No active runs"})})]})}var y=r(6631);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={completed:(0,n.jsx)(l.UIIcon,{name:"CheckCircleOutlined",className:"text-success"}),failed:(0,n.jsx)(l.UIIcon,{name:"CloseCircleOutlined",className:"text-error"}),cancelled:(0,n.jsx)(l.UIIcon,{name:"StopOutlined",className:"text-warning"})},x={completed:"success",failed:"error",cancelled:"warning"};function g(){var e,t=(0,a.useNavigate)(),r=h((0,l.useUIMessage)(),2),s=r[0],c=r[1],u=h(o.useState(!1),2),p=u[0],f=u[1],g=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}).data,v=(0,i.useData)("/exec/api/v1/workflows",{params:{limit:100}}).data,j=(0,i.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return e.input}}),I=(null==g?void 0:g.recentActivity)||[],b=[{title:"Time",dataIndex:"finishedAt",key:"finishedAt",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:function(e){var t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/6e4);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");var n=Math.floor(r/60);if(n<24)return"".concat(n,"h ago");var o=Math.floor(n/24);return"".concat(o,"d ago")}(e)})}},{title:"Workflow / Job",dataIndex:"workflowName",key:"workflowName",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{overflow:"hidden"},children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e||t.type},style:{display:"block"},children:e||t.type}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:t.id},style:{display:"block"},children:[t.id.slice(0,16),"..."]})]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){return(0,n.jsx)(l.UITag,{icon:m[e],color:x[e],children:e.toUpperCase()})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}(e)})}},{title:"Error",dataIndex:"error",key:"error",render:function(e){return e?(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(l.UIPage,{width:"full",children:[c,(0,n.jsx)(l.UIPageHeader,{title:"Workflows",description:"Monitor workflows, jobs, and scheduled tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows"}],actions:(0,n.jsx)(l.UIButton,{variant:"primary",icon:(0,n.jsx)(l.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){f(!0)},children:"Run Workflow"})}),(0,n.jsx)(d,{}),(0,n.jsx)(l.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(l.UIRow,{gutter:16,children:[(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Total Workflows"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.workflows.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.workflows.active)||0," active"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.workflows.inactive)||0," inactive"]})]})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Running"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-info",children:(null==g?void 0:g.jobs.running)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.jobs.pending)||0," pending"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Completed"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-success",children:(null==g?void 0:g.jobs.completed)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-error",children:[(null==g?void 0:g.jobs.failed)||0," failed"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Cron Jobs"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.crons.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.crons.enabled)||0," enabled"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.crons.disabled)||0," disabled"]})]})]})})]})}),(0,n.jsx)(l.UICard,{title:(0,n.jsx)(l.UITypographyText,{className:"typo-card-title",children:"Recent Activity"}),style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsx)(l.UITable,{dataSource:I,columns:b,rowKey:"id",scroll:{x:760},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return t("/p/workflows/runs/".concat(e.id))}}}})}),(0,n.jsx)(y.y,{open:p,workflows:null!=(e=null==v?void 0:v.workflows)?e:[],loading:j.isLoading,onClose:function(){return f(!1)},onRun:function(e,r){j.mutate({workflowId:e,input:r},{onSuccess:function(e){f(!1),t("/p/workflows/runs/".concat(e.runId))},onError:function(t){s.error('Failed to start workflow "'.concat(e,'": ').concat(t.message))}})}})]})}}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[777],{6026(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},4552(e,t,n){e.exports=n(6026)},6631(e,t,n){var r=n(4552),o=n(92),a=n(5155);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,n=e.name,o=e.schema,i=e.value,l=e.onChange,s=(0,r.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,r.jsxs)(a.UITypographyText,{className:"typo-label",children:[n,o.required&&(0,r.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)("div",{children:(0,r.jsx)(a.UISwitch,{checked:void 0!==i?!!i:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInputNumber,{style:{width:"100%"},value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInput,{value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,n,i=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),g=h[0],m=h[1],v=s(o.useState("{}"),2),x=v[0],j=v[1],w=s(o.useState(null),2),I=w[0],b=w[1],k=s(o.useState({}),2),U=k[0],S=k[1],T=f?null!=(t=y.find(function(e){return e.id===g}))?t:null:null!=(n=e.workflow)?n:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(i)if(j("{}"),b(null),f||m(void 0),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[i,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&g)if(j("{}"),b(null),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),l=i[0],c=i[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[g,O,f]);var N=(0,r.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,r.jsx)(a.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,r.jsx)(a.UIButton,{variant:"primary",icon:(0,r.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!I,onClick:function(){if(T)if(C)d(T.id,U);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){b("Invalid JSON")}}},children:"Run"})]}),P=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,r.jsxs)(a.UIModal,{open:i,title:(0,r.jsxs)(a.UISpace,{className:"gap-item",children:[(0,r.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,r.jsx)("span",{children:P})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,r.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:g,onChange:function(e){return m(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,r.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),n=t[0],o=t[1];return(0,r.jsx)(c,{name:n,schema:o,value:U[n],onChange:function(e){return S(function(t){var r,o;return r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){l(e,t,n[t])})}return e}({},t),o=null!=(o=l({},n,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})}},n)})}),T&&!C&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,r.jsx)(a.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void b(null);try{JSON.parse(t),b(null)}catch(e){b("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:I?"error":void 0}),I&&(0,r.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:I}),(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,r.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}n.d(t,{y:()=>u})},3887(e,t,n){n.r(t);var r=n(4552),o=n(92),a=n(7493),i=n(5155),l=n(4519),s=n(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d={queued:"default",running:"processing",success:"success",failed:"error",cancelled:"warning",skipped:"default",waiting_approval:"gold"};function p(e){var t=e.runId,n=e.onSuccess,o=(0,l.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,r.jsx)(i.UIButton,{variant:"link",size:"small",danger:!0,icon:(0,r.jsx)(i.UIIcon,{name:"StopOutlined"}),loading:o.isLoading,onClick:function(e){e.stopPropagation(),o.mutateAsync().then(n).catch(function(){})},children:"Cancel"})}function f(){var e,t,n=(0,a.useParams)().workflowId,c=(0,a.useNavigate)(),f=u((0,i.useUIMessage)(),2),y=f[0],h=f[1],g=n?decodeURIComponent(n):"",m=u(o.useState(!1),2),v=m[0],x=m[1],j=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g)):"/exec/api/v1/workflows/__none__",{enabled:!!g}),w=j.data,I=j.isLoading,b=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs"):"/exec/api/v1/workflows/__none__/runs",{enabled:!!g,pollingMs:5e3,params:{limit:50}}),k=b.data,U=b.isLoading,S=b.refetch,T=(0,l.useMutateData)("/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs")),O=[{title:"Run ID",dataIndex:"id",key:"id",width:200,render:function(e){return(0,r.jsxs)(i.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{cursor:"pointer",color:"var(--color-link)"},onClick:function(t){t.stopPropagation(),c("/p/workflows/runs/".concat(e))},children:[e.slice(0,16),"..."]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){var t;return(0,r.jsx)(i.UITag,{color:null!=(t=d[e])?t:"default",children:e.toUpperCase()})}},{title:"Triggered By",dataIndex:"trigger",key:"user",width:160,render:function(e){var t;return(0,r.jsx)(i.UITypographyText,{className:"typo-caption text-secondary",children:null!=(t=null==e?void 0:e.user)?t:"-"})}},{title:"Started At",dataIndex:"startedAt",key:"startedAt",width:180,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var n=Math.floor(t/60);if(n<60)return"".concat(n,"m ").concat(t%60,"s");var r=Math.floor(n/60);return"".concat(r,"h ").concat(n%60,"m")}(e)})}},{title:"Actions",key:"actions",width:100,fixed:"right",render:function(e,t){return"running"!==t.status&&"pending"!==t.status?null:(0,r.jsx)(p,{runId:t.id,onSuccess:function(){S()}})}}];return I?(0,r.jsx)(i.UIPage,{children:(0,r.jsx)("div",{style:{textAlign:"center",padding:"80px 0"},children:(0,r.jsx)(i.UISpin,{size:"large"})})}):w?(0,r.jsxs)(i.UIPage,{children:[h,(0,r.jsx)(i.UIPageHeader,{title:w.name,description:w.description,breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions",href:"/p/workflows/definitions"},{title:w.name}],actions:(0,r.jsx)(i.UIButton,{variant:"primary",icon:(0,r.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){return x(!0)},children:"Run"})}),(0,r.jsx)(i.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,r.jsx)(i.UIDescriptions,{column:3,items:[{key:"id",label:"ID",children:(0,r.jsx)(i.UITypographyText,{code:!0,className:"typo-caption",children:w.id})},{key:"source",label:"Source",children:(0,r.jsx)(i.UITag,{color:"manifest"===w.source?"blue":"green",children:"manifest"===w.source?"Plugin":"Standalone"})},{key:"status",label:"Status",children:w.status?(0,r.jsx)(i.UITag,{color:"active"===w.status?"success":"default",children:w.status.toUpperCase()}):"-"},{key:"plugin",label:"Plugin",children:(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:null!=(e=w.pluginId)?e:"-"})},{key:"tags",label:"Tags",span:2,children:w.tags&&w.tags.length>0?(0,r.jsx)(i.UISpace,{className:"gap-tight",children:w.tags.map(function(e){return(0,r.jsx)(i.UITag,{children:e},e)})}):"-"}]})}),(0,r.jsx)(i.UICard,{title:(0,r.jsx)(i.UITypographyText,{className:"typo-card-title",children:"Recent Runs"}),children:(0,r.jsx)(i.UITable,{dataSource:null!=(t=null==k?void 0:k.runs)?t:[],columns:O,loading:U,rowKey:"id",scroll:{x:900},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return c("/p/workflows/runs/".concat(e.id))}}}})}),(0,r.jsx)(s.y,{open:v,workflow:w,loading:T.isLoading,onClose:function(){return x(!1)},onRun:function(e,t){T.mutate(t,{onSuccess:function(e){x(!1),c("/p/workflows/runs/".concat(e.runId))},onError:function(e){y.error('Failed to start workflow "'.concat(g,'": ').concat(e.message))}})}})]}):(0,r.jsx)(i.UIPage,{children:(0,r.jsx)(i.UIEmptyState,{description:'Workflow "'.concat(g,'" not found'),action:(0,r.jsx)(i.UIButton,{onClick:function(){return c("/p/workflows/definitions")},children:"Back to Definitions"})})})}n.d(t,{default:()=>f})}}]);
2
- //# sourceMappingURL=__federation_expose_DefinitionDetail.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[777],{6026(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},4552(e,t,n){e.exports=n(6026)},6631(e,t,n){var r=n(4552),o=n(92),a=n(5155);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,n=e.name,o=e.schema,i=e.value,l=e.onChange,s=(0,r.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,r.jsxs)(a.UITypographyText,{className:"typo-label",children:[n,o.required&&(0,r.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)("div",{children:(0,r.jsx)(a.UISwitch,{checked:void 0!==i?!!i:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInputNumber,{style:{width:"100%"},value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInput,{value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,n,i=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),g=h[0],m=h[1],v=s(o.useState("{}"),2),x=v[0],j=v[1],w=s(o.useState(null),2),I=w[0],b=w[1],k=s(o.useState({}),2),U=k[0],S=k[1],T=f?null!=(t=y.find(function(e){return e.id===g}))?t:null:null!=(n=e.workflow)?n:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(i)if(j("{}"),b(null),f||m(void 0),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[i,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&g)if(j("{}"),b(null),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),l=i[0],c=i[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[g,O,f]);var N=(0,r.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,r.jsx)(a.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,r.jsx)(a.UIButton,{variant:"primary",icon:(0,r.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!I,onClick:function(){if(T)if(C)d(T.id,U);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){b("Invalid JSON")}}},children:"Run"})]}),P=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,r.jsxs)(a.UIModal,{open:i,title:(0,r.jsxs)(a.UISpace,{className:"gap-item",children:[(0,r.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,r.jsx)("span",{children:P})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,r.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:g,onChange:function(e){return m(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,r.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),n=t[0],o=t[1];return(0,r.jsx)(c,{name:n,schema:o,value:U[n],onChange:function(e){return S(function(t){var r,o;return r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){l(e,t,n[t])})}return e}({},t),o=null!=(o=l({},n,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})}},n)})}),T&&!C&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,r.jsx)(a.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void b(null);try{JSON.parse(t),b(null)}catch(e){b("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:I?"error":void 0}),I&&(0,r.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:I}),(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,r.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}n.d(t,{y:()=>u})},3887(e,t,n){n.r(t);var r=n(4552),o=n(92),a=n(7493),i=n(5155),l=n(4519),s=n(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d={queued:"default",running:"processing",success:"success",failed:"error",cancelled:"warning",skipped:"default",waiting_approval:"gold"};function p(e){var t=e.runId,n=e.onSuccess,o=(0,l.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,r.jsx)(i.UIButton,{variant:"link",size:"small",danger:!0,icon:(0,r.jsx)(i.UIIcon,{name:"StopOutlined"}),loading:o.isLoading,onClick:function(e){e.stopPropagation(),o.mutateAsync().then(n).catch(function(){})},children:"Cancel"})}function f(){var e,t,n=(0,a.useParams)().workflowId,c=(0,a.useNavigate)(),f=u((0,i.useUIMessage)(),2),y=f[0],h=f[1],g=n?decodeURIComponent(n):"",m=u(o.useState(!1),2),v=m[0],x=m[1],j=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g)):"/exec/api/v1/workflows/__none__",{enabled:!!g}),w=j.data,I=j.isLoading,b=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs"):"/exec/api/v1/workflows/__none__/runs",{enabled:!!g,pollingMs:5e3,params:{limit:50}}),k=b.data,U=b.isLoading,S=b.refetch,T=(0,l.useMutateData)("/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs")),O=[{title:"Run ID",dataIndex:"id",key:"id",width:200,render:function(e){return(0,r.jsxs)(i.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{cursor:"pointer",color:"var(--color-link)"},onClick:function(t){t.stopPropagation(),c("/p/workflows/runs/".concat(e))},children:[e.slice(0,16),"..."]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){var t;return(0,r.jsx)(i.UITag,{color:null!=(t=d[e])?t:"default",children:e.toUpperCase()})}},{title:"Triggered By",dataIndex:"trigger",key:"user",width:160,render:function(e){var t;return(0,r.jsx)(i.UITypographyText,{className:"typo-caption text-secondary",children:null!=(t=null==e?void 0:e.user)?t:"-"})}},{title:"Started At",dataIndex:"startedAt",key:"startedAt",width:180,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var n=Math.floor(t/60);if(n<60)return"".concat(n,"m ").concat(t%60,"s");var r=Math.floor(n/60);return"".concat(r,"h ").concat(n%60,"m")}(e)})}},{title:"Actions",key:"actions",width:100,fixed:"right",render:function(e,t){return"running"!==t.status&&"pending"!==t.status?null:(0,r.jsx)(p,{runId:t.id,onSuccess:function(){S()}})}}];return I?(0,r.jsx)(i.UIPage,{children:(0,r.jsx)("div",{style:{textAlign:"center",padding:"80px 0"},children:(0,r.jsx)(i.UISpin,{size:"large"})})}):w?(0,r.jsxs)(i.UIPage,{children:[h,(0,r.jsx)(i.UIPageHeader,{title:w.name,description:w.description,breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions",href:"/p/workflows/definitions"},{title:w.name}],actions:(0,r.jsx)(i.UIButton,{variant:"primary",icon:(0,r.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){return x(!0)},children:"Run"})}),(0,r.jsx)(i.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,r.jsx)(i.UIDescriptions,{column:3,items:[{key:"id",label:"ID",children:(0,r.jsx)(i.UITypographyText,{code:!0,className:"typo-caption",children:w.id})},{key:"source",label:"Source",children:(0,r.jsx)(i.UITag,{color:"manifest"===w.source?"blue":"green",children:"manifest"===w.source?"Plugin":"Standalone"})},{key:"status",label:"Status",children:w.status?(0,r.jsx)(i.UITag,{color:"active"===w.status?"success":"default",children:w.status.toUpperCase()}):"-"},{key:"plugin",label:"Plugin",children:(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:null!=(e=w.pluginId)?e:"-"})},{key:"tags",label:"Tags",span:2,children:w.tags&&w.tags.length>0?(0,r.jsx)(i.UISpace,{className:"gap-tight",children:w.tags.map(function(e){return(0,r.jsx)(i.UITag,{children:e},e)})}):"-"}]})}),(0,r.jsx)(i.UICard,{title:(0,r.jsx)(i.UITypographyText,{className:"typo-card-title",children:"Recent Runs"}),children:(0,r.jsx)(i.UITable,{dataSource:null!=(t=null==k?void 0:k.runs)?t:[],columns:O,loading:U,rowKey:"id",scroll:{x:900},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return c("/p/workflows/runs/".concat(e.id))}}}})}),(0,r.jsx)(s.y,{open:v,workflow:w,loading:T.isLoading,onClose:function(){return x(!1)},onRun:function(e,t){T.mutate(t,{onSuccess:function(e){x(!1),c("/p/workflows/runs/".concat(e.runId))},onError:function(e){y.error('Failed to start workflow "'.concat(g,'": ').concat(e.message))}})}})]}):(0,r.jsx)(i.UIPage,{children:(0,r.jsx)(i.UIEmptyState,{description:'Workflow "'.concat(g,'" not found'),action:(0,r.jsx)(i.UIButton,{onClick:function(){return c("/p/workflows/definitions")},children:"Back to Definitions"})})})}n.d(t,{default:()=>f})}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[55],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(92),i=r(5155);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,a=e.value,l=e.onChange,s=(0,n.jsxs)(i.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(i.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(i.UISwitch,{checked:void 0!==a?!!a:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInputNumber,{style:{width:"100%"},value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInput,{value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,r,a=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],v=h[1],g=s(o.useState("{}"),2),x=g[0],w=g[1],j=s(o.useState(null),2),b=j[0],I=j[1],k=s(o.useState({}),2),S=k[0],U=k[1],T=f?null!=(t=y.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(a)if(w("{}"),I(null),f||v(void 0),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[a,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&m)if(w("{}"),I(null),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=s(o.value,2),l=a[0],c=a[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[m,O,f]);var N=(0,n.jsxs)(i.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(i.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,n.jsx)(i.UIButton,{variant:"primary",icon:(0,n.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!b,onClick:function(){if(T)if(C)d(T.id,S);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){I("Invalid JSON")}}},children:"Run"})]}),A=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,n.jsxs)(i.UIModal,{open:a,title:(0,n.jsxs)(i.UISpace,{className:"gap-item",children:[(0,n.jsx)(i.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(i.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return v(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:S[r],onChange:function(e){return U(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},t),o=null!=(o=l({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),T&&!C&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(i.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(w(t),!t.trim()||"{}"===t.trim())return void I(null);try{JSON.parse(t),I(null)}catch(e){I("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(i.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},8792(e,t,r){r.r(t);var n=r(4552),o=r(92),i=r(7493),a=r(5155),l=r(4519),s=r(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(){var e=(0,i.useNavigate)(),t=u((0,a.useUIMessage)(),2),r=t[0],c=t[1],d=u(o.useState(null),2),p=d[0],f=d[1],y=(0,l.useData)("/exec/api/v1/workflows",{params:{limit:100}}),h=y.data,m=y.isLoading,v=(0,l.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return{inputs:e.input}}}),g=[{title:"Workflow",dataIndex:"name",key:"name",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{width:"100%",overflow:"hidden"},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-body",strong:!0,style:{display:"block"},children:e}),t.description&&(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",ellipsis:{tooltip:t.description},style:{display:"block"},children:t.description})]})}},{title:"ID",dataIndex:"id",key:"id",width:220,render:function(e){return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:e},children:e})}},{title:"Source",dataIndex:"source",key:"source",width:120,render:function(e){return(0,n.jsx)(a.UITag,{color:"manifest"===e?"blue":"green",children:"manifest"===e?"Plugin":"Standalone"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",width:200,render:function(e){return e?(0,n.jsx)(a.UITypographyText,{className:"typo-caption",children:e}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Version",dataIndex:"version",key:"version",width:100,render:function(e,t){if(!e)return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"});var r=(null==t?void 0:t.updatedAt)?"Updated ".concat(new Date(t.updatedAt).toLocaleString()):void 0;return(0,n.jsxs)(a.UITypographyText,{className:"typo-caption",code:!0,title:r,children:["v",e]})}},{title:"Status",dataIndex:"status",key:"status",width:100,render:function(e){return e?(0,n.jsx)(a.UITag,{color:"active"===e?"success":"default",children:e.toUpperCase()}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Actions",key:"actions",width:160,fixed:"right",render:function(t,r){return(0,n.jsxs)(a.UISpace,{className:"gap-tight",children:[(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"EyeOutlined"}),onClick:function(t){t.stopPropagation(),e("/p/workflows/definitions/".concat(encodeURIComponent(r.id)))},children:"View"}),(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(e){e.stopPropagation(),f(r)},children:"Run"})]})}}];return(0,n.jsxs)(a.UIPage,{width:"full",children:[c,(0,n.jsx)(a.UIPageHeader,{title:"Workflow Definitions",description:"All registered workflow definitions",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions"}]}),(0,n.jsx)(a.UICard,{children:(0,n.jsx)(a.UITable,{dataSource:(null==h?void 0:h.workflows)||[],columns:g,loading:m,rowKey:"id",scroll:{x:1210},pagination:{pageSize:20},onRow:function(t){return{style:{cursor:"pointer"},onClick:function(){return e("/p/workflows/definitions/".concat(encodeURIComponent(t.id)))}}}})}),(0,n.jsx)(s.y,{open:!!p,workflow:p,loading:v.isLoading,onClose:function(){return f(null)},onRun:function(t,n){v.mutate({workflowId:t,input:n},{onSuccess:function(t){f(null),e("/p/workflows/runs/".concat(t.runId))},onError:function(e){r.error('Failed to start workflow "'.concat(t,'": ').concat(e.message))}})}})]})}r.d(t,{default:()=>d})}}]);
2
- //# sourceMappingURL=__federation_expose_Definitions.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[55],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(92),i=r(5155);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,a=e.value,l=e.onChange,s=(0,n.jsxs)(i.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(i.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(i.UISwitch,{checked:void 0!==a?!!a:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInputNumber,{style:{width:"100%"},value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInput,{value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,r,a=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],v=h[1],g=s(o.useState("{}"),2),x=g[0],w=g[1],j=s(o.useState(null),2),b=j[0],I=j[1],k=s(o.useState({}),2),S=k[0],U=k[1],T=f?null!=(t=y.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(a)if(w("{}"),I(null),f||v(void 0),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[a,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&m)if(w("{}"),I(null),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=s(o.value,2),l=a[0],c=a[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[m,O,f]);var N=(0,n.jsxs)(i.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(i.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,n.jsx)(i.UIButton,{variant:"primary",icon:(0,n.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!b,onClick:function(){if(T)if(C)d(T.id,S);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){I("Invalid JSON")}}},children:"Run"})]}),A=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,n.jsxs)(i.UIModal,{open:a,title:(0,n.jsxs)(i.UISpace,{className:"gap-item",children:[(0,n.jsx)(i.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(i.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return v(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:S[r],onChange:function(e){return U(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},t),o=null!=(o=l({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),T&&!C&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(i.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(w(t),!t.trim()||"{}"===t.trim())return void I(null);try{JSON.parse(t),I(null)}catch(e){I("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(i.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},8792(e,t,r){r.r(t);var n=r(4552),o=r(92),i=r(7493),a=r(5155),l=r(4519),s=r(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(){var e=(0,i.useNavigate)(),t=u((0,a.useUIMessage)(),2),r=t[0],c=t[1],d=u(o.useState(null),2),p=d[0],f=d[1],y=(0,l.useData)("/exec/api/v1/workflows",{params:{limit:100}}),h=y.data,m=y.isLoading,v=(0,l.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return{inputs:e.input}}}),g=[{title:"Workflow",dataIndex:"name",key:"name",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{width:"100%",overflow:"hidden"},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-body",strong:!0,style:{display:"block"},children:e}),t.description&&(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",ellipsis:{tooltip:t.description},style:{display:"block"},children:t.description})]})}},{title:"ID",dataIndex:"id",key:"id",width:220,render:function(e){return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:e},children:e})}},{title:"Source",dataIndex:"source",key:"source",width:120,render:function(e){return(0,n.jsx)(a.UITag,{color:"manifest"===e?"blue":"green",children:"manifest"===e?"Plugin":"Standalone"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",width:200,render:function(e){return e?(0,n.jsx)(a.UITypographyText,{className:"typo-caption",children:e}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Version",dataIndex:"version",key:"version",width:100,render:function(e,t){if(!e)return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"});var r=(null==t?void 0:t.updatedAt)?"Updated ".concat(new Date(t.updatedAt).toLocaleString()):void 0;return(0,n.jsxs)(a.UITypographyText,{className:"typo-caption",code:!0,title:r,children:["v",e]})}},{title:"Status",dataIndex:"status",key:"status",width:100,render:function(e){return e?(0,n.jsx)(a.UITag,{color:"active"===e?"success":"default",children:e.toUpperCase()}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Actions",key:"actions",width:160,fixed:"right",render:function(t,r){return(0,n.jsxs)(a.UISpace,{className:"gap-tight",children:[(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"EyeOutlined"}),onClick:function(t){t.stopPropagation(),e("/p/workflows/definitions/".concat(encodeURIComponent(r.id)))},children:"View"}),(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(e){e.stopPropagation(),f(r)},children:"Run"})]})}}];return(0,n.jsxs)(a.UIPage,{width:"full",children:[c,(0,n.jsx)(a.UIPageHeader,{title:"Workflow Definitions",description:"All registered workflow definitions",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions"}]}),(0,n.jsx)(a.UICard,{children:(0,n.jsx)(a.UITable,{dataSource:(null==h?void 0:h.workflows)||[],columns:g,loading:m,rowKey:"id",scroll:{x:1210},pagination:{pageSize:20},onRow:function(t){return{style:{cursor:"pointer"},onClick:function(){return e("/p/workflows/definitions/".concat(encodeURIComponent(t.id)))}}}})}),(0,n.jsx)(s.y,{open:!!p,workflow:p,loading:v.isLoading,onClose:function(){return f(null)},onRun:function(t,n){v.mutate({workflowId:t,input:n},{onSuccess:function(t){f(null),e("/p/workflows/runs/".concat(t.runId))},onError:function(e){r.error('Failed to start workflow "'.concat(t,'": ').concat(e.message))}})}})]})}r.d(t,{default:()=>d})}}]);
@@ -1,2 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[97],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var a=null;if(void 0!==n&&(a=""+n),void 0!==t.key&&(a=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:a,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},9012(e,t,r){r.r(t);var n=r(4552),a=r(92),o=r(5155),l=r(4519);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var p={pending:"default",running:"processing",completed:"success",failed:"error",cancelled:"warning"};function u(){var e,t=function(e){if(Array.isArray(e))return e}(e=a.useState({limit:50}))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(t=n.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e)||function(e){if(e){if("string"==typeof e)return i(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=t[0],u=t[1],y=(0,l.useData)("/exec/api/v1/jobs",{params:r}),d=y.data,f=y.isLoading,h=function(e,t){if(!e)return"-";var r=new Date(e).getTime(),n=Math.floor(((t?new Date(t).getTime():Date.now())-r)/1e3);if(n<60)return"".concat(n,"s");var a=Math.floor(n/60);if(a<60)return"".concat(a,"m ").concat(n%60,"s");var o=Math.floor(a/60);return"".concat(o,"h ").concat(a%60,"m")},g=[{title:"Job ID",dataIndex:"id",key:"id",width:180,render:function(e){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{whiteSpace:"nowrap"},children:[e.slice(0,16),"..."]})}},{title:"Type",dataIndex:"type",key:"type",width:260,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e},style:{display:"block"},children:e})}},{title:"Status",dataIndex:"status",key:"status",width:130,render:function(e,t){return(0,n.jsxs)(o.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(o.UITag,{color:p[e]||"default",children:e.toUpperCase()}),void 0!==t.progress&&"running"===e&&(0,n.jsxs)(o.UITypographyText,{className:"typo-caption text-secondary",children:[t.progress,"%",t.progressMessage&&" \xb7 ".concat(t.progressMessage)]})]})}},{title:"Created",dataIndex:"createdAt",key:"createdAt",width:220,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",key:"duration",width:100,render:function(e,t){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",children:h(t.startedAt,t.finishedAt)})}},{title:"Attempts",key:"attempts",width:90,render:function(e,t){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",children:[t.attempt||0," / ",t.maxRetries||3]})}},{title:"Error",dataIndex:"error",key:"error",width:260,render:function(e){return e?(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(o.UIPage,{width:"full",children:[(0,n.jsx)(o.UIPageHeader,{title:"Background Jobs",description:"Monitor background job execution and status",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Jobs"}]}),(0,n.jsx)(o.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(o.UIRow,{gutter:16,children:[(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Status"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All statuses",allowClear:!0,value:r.status,onChange:function(e){return u(c(s({},r),{status:e}))},options:[{label:"Pending",value:"pending"},{label:"Running",value:"running"},{label:"Completed",value:"completed"},{label:"Failed",value:"failed"},{label:"Cancelled",value:"cancelled"}]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Type"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All types",allowClear:!0,showSearch:!0,value:r.type,onChange:function(e){return u(c(s({},r),{type:e}))},options:[]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Limit"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},value:r.limit||50,onChange:function(e){return u(c(s({},r),{limit:e}))},options:[{label:"25",value:25},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]})]})]})}),(0,n.jsx)(o.UICard,{children:(0,n.jsx)(o.UITable,{dataSource:(null==d?void 0:d.jobs)||[],columns:g,loading:f,rowKey:"id",scroll:{x:1240},pagination:{pageSize:20}})})]})}r.d(t,{default:()=>u})}}]);
2
- //# sourceMappingURL=__federation_expose_Jobs.js.map
1
+ "use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[97],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var a=null;if(void 0!==n&&(a=""+n),void 0!==t.key&&(a=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:a,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},9012(e,t,r){r.r(t);var n=r(4552),a=r(92),o=r(5155),l=r(4519);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var p={pending:"default",running:"processing",completed:"success",failed:"error",cancelled:"warning"};function u(){var e,t=function(e){if(Array.isArray(e))return e}(e=a.useState({limit:50}))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(t=n.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e)||function(e){if(e){if("string"==typeof e)return i(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=t[0],u=t[1],y=(0,l.useData)("/exec/api/v1/jobs",{params:r}),d=y.data,f=y.isLoading,h=function(e,t){if(!e)return"-";var r=new Date(e).getTime(),n=Math.floor(((t?new Date(t).getTime():Date.now())-r)/1e3);if(n<60)return"".concat(n,"s");var a=Math.floor(n/60);if(a<60)return"".concat(a,"m ").concat(n%60,"s");var o=Math.floor(a/60);return"".concat(o,"h ").concat(a%60,"m")},g=[{title:"Job ID",dataIndex:"id",key:"id",width:180,render:function(e){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{whiteSpace:"nowrap"},children:[e.slice(0,16),"..."]})}},{title:"Type",dataIndex:"type",key:"type",width:260,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e},style:{display:"block"},children:e})}},{title:"Status",dataIndex:"status",key:"status",width:130,render:function(e,t){return(0,n.jsxs)(o.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(o.UITag,{color:p[e]||"default",children:e.toUpperCase()}),void 0!==t.progress&&"running"===e&&(0,n.jsxs)(o.UITypographyText,{className:"typo-caption text-secondary",children:[t.progress,"%",t.progressMessage&&" \xb7 ".concat(t.progressMessage)]})]})}},{title:"Created",dataIndex:"createdAt",key:"createdAt",width:220,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",key:"duration",width:100,render:function(e,t){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",children:h(t.startedAt,t.finishedAt)})}},{title:"Attempts",key:"attempts",width:90,render:function(e,t){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",children:[t.attempt||0," / ",t.maxRetries||3]})}},{title:"Error",dataIndex:"error",key:"error",width:260,render:function(e){return e?(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(o.UIPage,{width:"full",children:[(0,n.jsx)(o.UIPageHeader,{title:"Background Jobs",description:"Monitor background job execution and status",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Jobs"}]}),(0,n.jsx)(o.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(o.UIRow,{gutter:16,children:[(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Status"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All statuses",allowClear:!0,value:r.status,onChange:function(e){return u(c(s({},r),{status:e}))},options:[{label:"Pending",value:"pending"},{label:"Running",value:"running"},{label:"Completed",value:"completed"},{label:"Failed",value:"failed"},{label:"Cancelled",value:"cancelled"}]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Type"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All types",allowClear:!0,showSearch:!0,value:r.type,onChange:function(e){return u(c(s({},r),{type:e}))},options:[]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Limit"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},value:r.limit||50,onChange:function(e){return u(c(s({},r),{limit:e}))},options:[{label:"25",value:25},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]})]})]})}),(0,n.jsx)(o.UICard,{children:(0,n.jsx)(o.UITable,{dataSource:(null==d?void 0:d.jobs)||[],columns:g,loading:f,rowKey:"id",scroll:{x:1240},pagination:{pageSize:20}})})]})}r.d(t,{default:()=>u})}}]);