@adonis-agora/durable 0.46.0 → 0.46.1
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.
- package/CHANGELOG.md +6 -0
- package/dist/assets/spa/assets/{index-Cxg7WNCV.js → index-CL6q2kMB.js} +2 -2
- package/dist/assets/spa/assets/index-CL6q2kMB.js.map +1 -0
- package/dist/assets/spa/index.html +1 -1
- package/dist/src/dashboard/index.d.ts +1 -1
- package/dist/src/dashboard/index.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +2 -2
- package/dist/assets/spa/assets/index-Cxg7WNCV.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function I(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var L=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function R(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,L)}catch(e){L(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function z(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else R(z.bind(null,e))}var B={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=B,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=z,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=R,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),f=o(((e,t)=>{t.exports=d()})),p=c(u(),1),m=f(),h=p.createContext(void 0),g=e=>{let t=p.useContext(h);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,m.jsx)(h.Provider,{value:e,children:t})),v={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#e=v;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function b(e){setTimeout(e,0)}var x=typeof window>`u`||`Deno`in globalThis;function S(){}function C(e,t){return typeof e==`function`?e(t):e}function w(e){return typeof e==`number`&&e>=0&&e!==1/0}function T(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==k(o,t.options))return!1}else if(!j(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function O(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(A(t.options.mutationKey)!==A(a))return!1}else if(!j(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function k(e,t){return(t?.queryKeyHashFn||A)(e)}function A(e){return JSON.stringify(e,(e,t)=>I(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function j(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!j(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!j(e[r],t[r]))return!1;return!0}return!1}var M=Object.prototype.hasOwnProperty;function N(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=F(e)&&F(t);if(!r&&!(I(e)&&I(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:M.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=N(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function F(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function I(e){if(!L(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!L(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function L(e){return Object.prototype.toString.call(e)===`[object Object]`}function R(e){return new Promise(t=>{y.setTimeout(t,e)})}function z(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:N(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function V(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var H=Symbol();function U(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===H?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ee(e,t){return typeof e==`function`?e(...t):!!e}function te(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var ne=()=>x,W=()=>ne(),re=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},G=new class extends re{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},K=b;function ie(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=K,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ae=ie(),oe=new class extends re{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function ce(e){return(e??`online`)!==`online`||oe.isOnline()}var le=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ue(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(S);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new le(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>G.isFocused()&&(e.networkMode===`always`||oe.isOnline())&&e.canRun(),p=()=>ce(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(W()?0:3),a=e.retryDelay??se,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),R(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var de=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(W()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function fe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{te(e,()=>t.signal,()=>n=!0)},u=U(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?V:B;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?me:pe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:pe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function pe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function me(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function he(e,t){return t?pe(e,t)!=null:!1}function ge(e,t){return!t||!e.getPreviousPageParam?!1:me(e,t)!=null}var _e=class extends de{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=be(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=be(this.options);e.data!==void 0&&(this.setState(ye(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=z(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>E(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===H||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!T(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=U(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?fe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ue({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof le&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof le){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ve(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ye(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ae.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ve(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ce(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ye(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function be(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var xe=class extends re{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ce(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return we(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return we(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof E(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Te(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return P(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#h(e){return!W()&&E(this.options.enabled,this.#t)!==!1&&w(e)}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=T(this.#r.dataUpdatedAt,e)+1;this.#u=y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return E(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=y.setInterval(()=>{(this.options.refetchIntervalInBackground||G.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(y.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(y.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ce(e,t),o=i&&Te(e,n,t,r);(a||o)&&(l={...l,...ve(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=z(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=z(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ee(e,t),refetch:this.refetch,isEnabled:E(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),P(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();ae.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Se(e,t){return E(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||E(t.retryOnMount,e)!==!1)}function Ce(e,t){return Se(e,t)||e.state.data!==void 0&&we(e,t,t.refetchOnMount)}function we(e,t,n){if(E(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=E(n,e);return r===`always`||r!==!1&&Ee(e,t)}return!1}function Te(e,t,n,r){return(e!==t||E(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ee(e,n)}function Ee(e,t){return E(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}var De=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Oe=class extends de{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ke(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ue({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ae.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ke(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ae=class extends re{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Oe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ae.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>O(t,e))}findAll(e={}){return this.getAll().filter(t=>O(e,t))}notify(e){ae.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ae.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function je(e){return e.options.scope?.id}var Me=class extends re{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),P(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&A(t.mutationKey)!==A(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ke();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ae.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ne(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Pe=class extends re{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ae.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!P(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ne(e,n).forEach(e=>{e.destroy()}),Ne(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=N(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new xe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&ae.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Fe=class extends re{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??k(r,t),a=this.get(i);return a||(a=new _e({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ae.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>D(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>D(e,t)):t}notify(e){ae.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ae.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ae.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ie=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fe,this.#t=e.mutationCache||new Ae,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=G.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=oe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(E(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=C(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ae.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ae.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ae.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=ae.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return ae.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ae.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(E(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return oe.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(A(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{j(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(A(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{j(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=k(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===H&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Le=p.createContext(!1),Re=()=>p.useContext(Le);Le.Provider;function ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Be=p.createContext(ze()),Ve=()=>p.useContext(Be),He=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ee(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ue=e=>{p.useEffect(()=>{e.clearReset()},[e])},We=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ee(n,[e.error,r])),Ge=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ke=(e,t)=>e?.suspense&&t.isPending,qe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Je({queries:e,...t},n){let r=g(n),i=Re(),a=Ve(),o=t.subscribed!==!1,s=p.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Ge(e);let t=r.getQueryCache().get(e.queryHash);He(e,a,t)}),Ue(a);let[c]=p.useState(()=>new Pe(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;p.useSyncExternalStore(p.useCallback(e=>f?c.subscribe(ae.batchCalls(e)):S,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),p.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let m=l.some((e,t)=>Ke(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Ke(n,e)?qe(n,new xe(r,n),a):[]}):[];if(m.length>0)throw Promise.all(m);let h=l.find((e,t)=>{let n=s[t];return n&&We({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function Ye(e,t,n){let r=Re(),i=Ve(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ge(o),He(o,i,s),Ue(i);let[l]=p.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(p.useSyncExternalStore(p.useCallback(e=>{let t=d?l.subscribe(ae.batchCalls(e)):S;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),p.useEffect(()=>{l.setOptions(o)},[o,l]),Ke(o,u))throw qe(o,l,i);if(We({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Xe(e,t){return Ye(e,xe,t)}function Ze(e,t){let n=g(t),[r]=p.useState(()=>new Me(n,e));p.useEffect(()=>{r.setOptions(e)},[r,e]);let i=p.useSyncExternalStore(p.useCallback(e=>r.subscribe(ae.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=p.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(S)},[r]);if(i.error&&ee(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Qe(e,t){return Ye(e,De,t)}var $e=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),et=o(((e,t)=>{t.exports=$e()})),tt=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),nt=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=tt()})),rt=o((e=>{var t=et(),n=u(),r=nt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),R=Symbol.for(`react.lazy`),z=Symbol.for(`react.activity`),B=Symbol.for(`react.legacy_hidden`),V=Symbol.for(`react.memo_cache_sentinel`),H=Symbol.for(`react.view_transition`),U=Symbol.for(`react.recoverable`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function W(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case z:return`Activity`;case H:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?W(e.type)||`Memo`:t;case R:t=e._payload,e=e._init;try{return W(e(t))}catch{}}return null}var re=Array.isArray,G=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function le(e,t){oe++,ae[oe]=e.current,e.current=t}var ue=se(null),de=se(null),fe=se(null),pe=se(null);function me(e,t){switch(le(fe,t),le(de,e),le(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(ue),le(ue,e)}function he(){ce(ue),ce(de),ce(fe)}function ge(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,le(pe,e)),t=ue.current;var n=fp(t,e.type);t!==n&&(le(de,e),le(ue,n))}function _e(e){de.current===e&&(ce(ue),ce(de)),pe.current===e&&(ce(pe),ch._currentValue=ie)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function I(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var L=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function R(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,L)}catch(e){L(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function z(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else R(z.bind(null,e))}var B={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=B,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=z,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=R,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),f=o(((e,t)=>{t.exports=d()})),p=c(u(),1),m=f(),h=p.createContext(void 0),g=e=>{let t=p.useContext(h);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,m.jsx)(h.Provider,{value:e,children:t})),v={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#e=v;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function b(e){setTimeout(e,0)}var x=typeof window>`u`||`Deno`in globalThis;function S(){}function C(e,t){return typeof e==`function`?e(t):e}function w(e){return typeof e==`number`&&e>=0&&e!==1/0}function T(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==k(o,t.options))return!1}else if(!j(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function O(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(A(t.options.mutationKey)!==A(a))return!1}else if(!j(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function k(e,t){return(t?.queryKeyHashFn||A)(e)}function A(e){return JSON.stringify(e,(e,t)=>I(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function j(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!j(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!j(e[r],t[r]))return!1;return!0}return!1}var M=Object.prototype.hasOwnProperty;function N(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=F(e)&&F(t);if(!r&&!(I(e)&&I(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:M.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=N(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function F(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function I(e){if(!L(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!L(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function L(e){return Object.prototype.toString.call(e)===`[object Object]`}function R(e){return new Promise(t=>{y.setTimeout(t,e)})}function z(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:N(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function V(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var H=Symbol();function U(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===H?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ee(e,t){return typeof e==`function`?e(...t):!!e}function te(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var ne=()=>x,W=()=>ne(),re=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},G=new class extends re{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},K=b;function ie(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=K,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ae=ie(),oe=new class extends re{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function ce(e){return(e??`online`)!==`online`||oe.isOnline()}var le=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ue(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(S);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new le(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>G.isFocused()&&(e.networkMode===`always`||oe.isOnline())&&e.canRun(),p=()=>ce(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(W()?0:3),a=e.retryDelay??se,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),R(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var de=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(W()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function fe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{te(e,()=>t.signal,()=>n=!0)},u=U(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?V:B;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?me:pe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:pe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function pe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function me(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function he(e,t){return t?pe(e,t)!=null:!1}function ge(e,t){return!t||!e.getPreviousPageParam?!1:me(e,t)!=null}var _e=class extends de{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=be(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=be(this.options);e.data!==void 0&&(this.setState(ye(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=z(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>E(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===H||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!T(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=U(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?fe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ue({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof le&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof le){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ve(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ye(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ae.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ve(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ce(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ye(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function be(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var xe=class extends re{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ce(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return we(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return we(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof E(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Te(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return P(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#h(e){return!W()&&E(this.options.enabled,this.#t)!==!1&&w(e)}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=T(this.#r.dataUpdatedAt,e)+1;this.#u=y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return E(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=y.setInterval(()=>{(this.options.refetchIntervalInBackground||G.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(y.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(y.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ce(e,t),o=i&&Te(e,n,t,r);(a||o)&&(l={...l,...ve(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=z(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=z(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ee(e,t),refetch:this.refetch,isEnabled:E(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),P(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();ae.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Se(e,t){return E(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||E(t.retryOnMount,e)!==!1)}function Ce(e,t){return Se(e,t)||e.state.data!==void 0&&we(e,t,t.refetchOnMount)}function we(e,t,n){if(E(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=E(n,e);return r===`always`||r!==!1&&Ee(e,t)}return!1}function Te(e,t,n,r){return(e!==t||E(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ee(e,n)}function Ee(e,t){return E(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}var De=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Oe=class extends de{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ke(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ue({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ae.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ke(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ae=class extends re{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Oe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ae.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>O(t,e))}findAll(e={}){return this.getAll().filter(t=>O(e,t))}notify(e){ae.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ae.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function je(e){return e.options.scope?.id}var Me=class extends re{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),P(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&A(t.mutationKey)!==A(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ke();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ae.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ne(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Pe=class extends re{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ae.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!P(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ne(e,n).forEach(e=>{e.destroy()}),Ne(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=N(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new xe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&ae.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Fe=class extends re{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??k(r,t),a=this.get(i);return a||(a=new _e({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ae.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>D(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>D(e,t)):t}notify(e){ae.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ae.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ae.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ie=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fe,this.#t=e.mutationCache||new Ae,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=G.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=oe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(E(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=C(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ae.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ae.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ae.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=ae.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return ae.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ae.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(E(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return oe.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(A(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{j(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(A(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{j(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=k(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===H&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Le=p.createContext(!1),Re=()=>p.useContext(Le);Le.Provider;function ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Be=p.createContext(ze()),Ve=()=>p.useContext(Be),He=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?ee(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ue=e=>{p.useEffect(()=>{e.clearReset()},[e])},We=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ee(n,[e.error,r])),Ge=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ke=(e,t)=>e?.suspense&&t.isPending,qe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Je({queries:e,...t},n){let r=g(n),i=Re(),a=Ve(),o=t.subscribed!==!1,s=p.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Ge(e);let t=r.getQueryCache().get(e.queryHash);He(e,a,t)}),Ue(a);let[c]=p.useState(()=>new Pe(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;p.useSyncExternalStore(p.useCallback(e=>f?c.subscribe(ae.batchCalls(e)):S,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),p.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let m=l.some((e,t)=>Ke(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Ke(n,e)?qe(n,new xe(r,n),a):[]}):[];if(m.length>0)throw Promise.all(m);let h=l.find((e,t)=>{let n=s[t];return n&&We({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function Ye(e,t,n){let r=Re(),i=Ve(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ge(o),He(o,i,s),Ue(i);let[l]=p.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(p.useSyncExternalStore(p.useCallback(e=>{let t=d?l.subscribe(ae.batchCalls(e)):S;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),p.useEffect(()=>{l.setOptions(o)},[o,l]),Ke(o,u))throw qe(o,l,i);if(We({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Xe(e,t){return Ye(e,xe,t)}function Ze(e,t){let n=g(t),[r]=p.useState(()=>new Me(n,e));p.useEffect(()=>{r.setOptions(e)},[r,e]);let i=p.useSyncExternalStore(p.useCallback(e=>r.subscribe(ae.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=p.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(S)},[r]);if(i.error&&ee(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Qe(e,t){return Ye(e,De,t)}var $e=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),et=o(((e,t)=>{t.exports=$e()})),tt=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),nt=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=tt()})),rt=o((e=>{var t=et(),n=u(),r=nt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),R=Symbol.for(`react.lazy`),z=Symbol.for(`react.activity`),B=Symbol.for(`react.legacy_hidden`),V=Symbol.for(`react.memo_cache_sentinel`),H=Symbol.for(`react.view_transition`),U=Symbol.for(`react.recoverable`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function W(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case z:return`Activity`;case H:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?W(e.type)||`Memo`:t;case R:t=e._payload,e=e._init;try{return W(e(t))}catch{}}return null}var re=Array.isArray,G=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function le(e,t){oe++,ae[oe]=e.current,e.current=t}var ue=se(null),de=se(null),fe=se(null),pe=se(null);function me(e,t){switch(le(fe,t),le(de,e),le(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(ue),le(ue,e)}function he(){ce(ue),ce(de),ce(fe)}function ge(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,le(pe,e)),t=ue.current;var n=fp(t,e.type);t!==n&&(le(de,e),le(ue,n))}function _e(e){de.current===e&&(ce(ue),ce(de)),pe.current===e&&(ce(pe),ch._currentValue=ie)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
2
2
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
3
|
`+ve+e+ye}var xe=!1;function Se(e,t){if(!e||xe)return``;xe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
4
|
`),l=s.split(`
|
|
@@ -13,4 +13,4 @@ Error generating stack: `+e.message+`
|
|
|
13
13
|
+`).split(`
|
|
14
14
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,p.useEffect)(()=>{let n=t?.target??vE,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&ZC(e))return!1;let n=xE(e.code,s);if(a.current.add(e[n]),bE(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=xE(e.code,s);bE(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function bE(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function xE(e,t){return t.includes(e)?`code`:`key`}var SE=()=>{let e=GT();return(0,p.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=LC(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return MC(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=NC(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function CE(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)wE(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function wE(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function TE(e,t){return CE(e,t)}function EE(e,t){return CE(e,t)}function DE(e,t){return{id:e,type:`select`,selected:t}}function OE(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(DE(a.id,e)))}return r}function kE({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function AE(e){return{id:e.id,type:`remove`}}var jE=AC(`React Flow`,`https://reactflow.dev/`);function ME(e,t,n={}){return uw(e,t,{...n,onError:n.onError??jE})}var NE=e=>iC(e),PE=e=>rC(e);function FE(e){return(0,p.forwardRef)(e)}var IE=typeof window<`u`?p.useLayoutEffect:p.useEffect;function LE(e){let[t,n]=(0,p.useState)(BigInt(0)),[r]=(0,p.useState)(()=>RE(()=>n(e=>e+BigInt(1))));return IE(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function RE(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var zE=(0,p.createContext)(null);function BE({children:e}){let t=GT(),n=LE((0,p.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=kE({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=LE((0,p.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(kE({items:s,lookup:o}))},[])),i=(0,p.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,m.jsx)(zE.Provider,{value:i,children:e})}function VE(){let e=(0,p.useContext)(zE);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var HE=e=>!!e.panZoom;function UE(){let e=SE(),t=GT(),n=VE(),r=WT(HE),i=(0,p.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=NE(e)?e:n.get(e.id),a=i.parentId?HC(i.position,i.measured,i.parentId,n,r):i.position;return CC({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&NE(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&PE(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await mC({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(AE);o?.(f),c(e)}if(m){let e=d.map(AE);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=OC(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=CC(s?r:a),l=DC(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=OC(e)?e:a(e);if(!r)return!1;let i=DC(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return sC(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??WC();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,p.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var WE=e=>e.selected,GE=typeof window<`u`?window:void 0;function KE({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=GT(),{deleteElements:r}=UE(),i=yE(e,{actInsideInputWithModifier:!1}),a=yE(t,{target:GE});(0,p.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(WE),edges:e.filter(WE)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,p.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function qE(e){let t=GT();(0,p.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=JC(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,KS.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var JE={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},YE=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function XE({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=ZS.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:g=!0,children:_,noWheelClassName:v,noPanClassName:y,onViewportChange:b,isControlledViewport:x,paneClickDistance:S,selectionOnDrag:C}){let w=GT(),T=(0,p.useRef)(null),{userSelectionActive:E,lib:D,connectionInProgress:O}=WT(YE,BT),k=yE(h),A=(0,p.useRef)();qE(T);let j=(0,p.useCallback)(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),x||w.setState({transform:e})},[b,x]);return(0,p.useEffect)(()=>{if(T.current){A.current=yT({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>w.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=w.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=w.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=w.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=A.current.getViewport();return w.setState({panZoom:A.current,transform:[e,t,n],domNode:T.current.closest(`.react-flow`)}),()=>{A.current?.destroy()}}},[]),(0,p.useEffect)(()=>{A.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:k,preventScrolling:g,noPanClassName:y,userSelectionActive:E,noWheelClassName:v,lib:D,onTransformChange:j,connectionInProgress:O,selectionOnDrag:C,paneClickDistance:S})},[e,t,n,r,i,a,o,s,c,k,g,y,E,v,D,j,O,C,S]),(0,m.jsx)(`div`,{className:`react-flow__renderer`,ref:T,style:JE,children:_})}var ZE=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function QE(){let{userSelectionActive:e,userSelectionRect:t}=WT(ZE,BT);return e&&t?(0,m.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var $E=(e,t)=>n=>{n.target===t.current&&e?.(n)},eD=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tD({isSelecting:e,selectionKeyPressed:t,selectionMode:n=QS.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:g,children:_}){let v=(0,p.useRef)(0),y=GT(),{userSelectionActive:b,elementsSelectable:x,dragging:S,panBy:C,autoPanSpeed:w}=WT(eD,BT),T=x&&(e||b),E=(0,p.useRef)(null),D=(0,p.useRef)(),O=(0,p.useRef)(new Set),k=(0,p.useRef)(new Set),A=(0,p.useRef)(!1),j=(0,p.useRef)(!1),M=(0,p.useRef)({x:0,y:0}),N=(0,p.useRef)(!1),P=e=>{j.current||A.current||y.getState().connection.inProgress?(j.current=!1,A.current=!1):(l?.(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1}))},F=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},I=d?e=>d(e):void 0,L=e=>{j.current&&=(e.stopPropagation(),!1)},R=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=y.getState();if(D.current=i?.getBoundingClientRect(),!D.current)return;let s=n.target===E.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),j.current=!1;let{x:c,y:l}=$C(n.nativeEvent,D.current),u=MC({x:c,y:l},a);y.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function z(e,t){let{userSelectionRect:r}=y.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=y.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=NC(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=O.current,g=k.current;O.current=new Set(lC(a,m,i,n===QS.Partial,!0).map(e=>e.id)),k.current=new Set;let _=u?.selectable??!0;for(let e of O.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??_)&&k.current.add(e)}}UC(h,O.current)||c(OE(a,O.current,!0)),UC(g,k.current)||l(OE(o,k.current)),y.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function B(){if(!i||!D.current)return;let[e,t]=yC(M.current,D.current,w);C({x:e,y:t}).then(e=>{if(!j.current||!e){v.current=requestAnimationFrame(B);return}let{x:t,y:n}=M.current;z(t,n),v.current=requestAnimationFrame(B)})}let V=()=>{cancelAnimationFrame(v.current),v.current=0,N.current=!1};(0,p.useEffect)(()=>()=>V(),[]);let H=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=y.getState();if(!D.current||!n)return;let{x:o,y:c}=$C(e.nativeEvent,D.current);M.current={x:o,y:c};let l=NC({x:n.startX,y:n.startY},r);if(!j.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}j.current=!0,N.current||=(B(),!0),z(o,c)},U=e=>{T?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&y.getState().userSelectionRect&&P?.(e),y.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(c?.(e),y.setState({nodesSelectionActive:O.current.size>0})),V()):e.target===E.current&&y.getState().connection.inProgress&&(A.current=!0)},ee=e=>{e.target?.releasePointerCapture?.(e.pointerId),V()},te=r===!0||Array.isArray(r)&&r.includes(0);return(0,m.jsxs)(`div`,{className:l_([`react-flow__pane`,{draggable:te,dragging:S,selection:e}]),onClick:T?void 0:$E(P,E),onContextMenu:$E(F,E),onWheel:$E(I,E),onPointerEnter:T?void 0:f,onPointerMove:T?H:h,onPointerUp:U,onPointerCancel:T?ee:void 0,onPointerDownCapture:T?R:void 0,onClickCapture:T?L:void 0,onPointerLeave:g,ref:E,style:JE,children:[_,(0,m.jsx)(QE,{})]})}function nD({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,KS.error012(e))}function rD({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=GT(),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)();return(0,p.useEffect)(()=>{if(!t)return u.current=Jw({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{nD({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,p.useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var iD=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function aD(){let e=GT();return(0,p.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=iD(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=jC(t,i));let{position:a,positionAbsolute:s}=pC({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var oD=(0,p.createContext)(null),sD=oD.Provider;oD.Consumer;var cD=()=>(0,p.useContext)(oD),lD=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uD=(0,p.createContext)(null);function dD({children:e}){let t=WT(lD,BT);return(0,m.jsx)(uD.Provider,{value:t,children:e})}function fD(){let e=(0,p.useContext)(uD);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var pD={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},mD=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return pD;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===XS.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function hD({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let h=o||null,g=e===`target`,_=GT(),v=cD(),{connectOnClick:y,noPanClassName:b,rfId:x}=fD(),{connectingFrom:S,connectingTo:C,clickConnecting:w,isPossibleEndHandle:T,connectionInProcess:E,clickConnectionInProcess:D,valid:O}=WT(mD(v,h,e),BT);v||_.getState().onError?.(`010`,KS.error010());let k=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=_.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=_.getState();t(ME(i,e,{onError:n}))}n?.(i),s?.(i)},A=e=>{if(!v)return;let t=QC(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=_.getState();iT.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:g,handleId:h,nodeId:v,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>_.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:k,isValidConnection:n||((...e)=>_.getState().isValidConnection?.(...e)??!0),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,m.jsx)(`div`,{"data-handleid":h,"data-nodeid":v,"data-handlepos":t,"data-id":`${x}-${v}-${h}-${e}`,className:l_([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,b,l,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:a,clickconnecting:w,connectingfrom:S,connectingto:C,valid:O,connectionindicator:r&&(!E||T)&&(E||D?a:i)}]),onMouseDown:A,onTouchStart:A,onClick:y?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=_.getState();if(!v||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:v,handleId:h,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:v,type:e,id:h}});return}let p=YC(t.target),m=n||c,{connection:g,isValid:y}=iT.isValid(t.nativeEvent,{handle:{nodeId:v,id:h,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:m,flowId:u,doc:p,lib:l,nodeLookup:d});y&&g&&k(g);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),_.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var gD=(0,p.memo)(FE(hD));function _D({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,m.jsxs)(m.Fragment,{children:[e?.label,(0,m.jsx)(gD,{type:`source`,position:n,isConnectable:t})]})}function vD({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(gD,{type:`target`,position:n,isConnectable:t}),e?.label,(0,m.jsx)(gD,{type:`source`,position:r,isConnectable:t})]})}function yD(){return null}function bD({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(gD,{type:`target`,position:n,isConnectable:t}),e?.label]})}var xD={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SD={input:_D,default:vD,output:bD,group:yD};function CD(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var wD=e=>{let{width:t,height:n,x:r,y:i}=cC(e.nodeLookup,{filter:e=>!!e.selected});return{width:kC(t)?t:null,height:kC(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function TD({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=GT(),{width:i,height:a,transformString:o,userSelectionActive:s}=WT(wD,BT),c=aD(),l=(0,p.useRef)(null);(0,p.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(rD({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,m.jsx)(`div`,{className:l_([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,m.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(xD,e.key)&&(e.preventDefault(),c({direction:xD[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var ED=typeof window<`u`?window:void 0,DD=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function OD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:h,panActivationKeyCode:g,zoomActivationKeyCode:_,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:T,autoPanOnSelection:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F,onViewportChange:I,isControlledViewport:L}){let{nodesSelectionActive:R,userSelectionActive:z}=WT(DD,BT),B=yE(l,{target:ED}),V=yE(g,{target:ED}),H=V||T,U=V||x,ee=u&&H!==!0,te=B||z||ee;return KE({deleteKeyCode:c,multiSelectionKeyCode:h}),(0,m.jsx)(XE,{onPaneContextMenu:a,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:U,panActivationKeyPressed:V,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:!B&&H,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:_,preventScrolling:j,noWheelClassName:N,noPanClassName:P,onViewportChange:I,isControlledViewport:L,paneClickDistance:s,selectionOnDrag:ee,children:(0,m.jsxs)(tD,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:H,autoPanOnSelection:E,isSelecting:!!te,selectionMode:d,selectionKeyPressed:B,paneClickDistance:s,selectionOnDrag:ee,children:[e,R&&(0,m.jsx)(TD,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})]})})}OD.displayName=`FlowRenderer`;var kD=(0,p.memo)(OD),AD=e=>t=>e?lC(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function jD(e){return WT((0,p.useCallback)(AD(e),[e]),BT)}var MD=e=>e.updateNodeInternals;function ND(){let e=WT(MD),[t]=(0,p.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,p.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function PD({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=GT(),a=(0,p.useRef)(null),o=(0,p.useRef)(null),s=(0,p.useRef)(e.sourcePosition),c=(0,p.useRef)(e.targetPosition),l=(0,p.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,p.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,p.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,p.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function FD({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:h,rfId:g,nodeTypes:_,nodeClickDistance:v,onError:y}){let{node:b,internals:x,isParent:S}=WT(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},BT),C=b.type||`default`,w=_?.[C]||SD[C];w===void 0&&(y?.(`003`,KS.error003(C)),C=`default`,w=_?.default||SD.default);let T=!!(b.draggable||s&&b.draggable===void 0),E=!!(b.selectable||c&&b.selectable===void 0),D=!!(b.connectable||l&&b.connectable===void 0),O=!!(b.focusable||u&&b.focusable===void 0),k=GT(),A=VC(b),j=PD({node:b,nodeType:C,hasDimensions:A,resizeObserver:d}),M=rD({nodeRef:j,disabled:b.hidden||!T,noDragClassName:f,handleSelector:b.dragHandle,nodeId:e,isSelectable:E,nodeClickDistance:v}),N=aD();if(b.hidden)return null;let P=BC(b),F=CD(b),I=E||T||t||n||r||i,L=n?e=>n(e,{...x.userNode}):void 0,R=r?e=>r(e,{...x.userNode}):void 0,z=i?e=>i(e,{...x.userNode}):void 0,B=a?e=>a(e,{...x.userNode}):void 0,V=o?e=>o(e,{...x.userNode}):void 0,H=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=k.getState();E&&(!r||!T||i>0)&&nD({id:e,store:k,nodeRef:j}),t&&t(n,{...x.userNode})},U=t=>{if(!(ZC(t.nativeEvent)||h)){if(JS.includes(t.key)&&E){let n=t.key===`Escape`;nD({id:e,store:k,unselect:n,nodeRef:j})}else if(T&&b.selected&&Object.prototype.hasOwnProperty.call(xD,t.key)){t.preventDefault();let{ariaLabelConfig:e}=k.getState();k.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),N({direction:xD[t.key],factor:t.shiftKey?4:1})}}},ee=()=>{if(h||!j.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=k.getState();i&&(lC(new Map([[e,b]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(b.position.x+P.width/2,b.position.y+P.height/2,{zoom:t[2]}))};return(0,m.jsx)(`div`,{className:l_([`react-flow__node`,`react-flow__node-${C}`,{[p]:T},b.className,{selected:b.selected,selectable:E,parent:S,draggable:T,dragging:M}]),ref:j,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:I?`all`:`none`,visibility:A?`visible`:`hidden`,...b.style,...F},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:R,onMouseLeave:z,onContextMenu:B,onClick:H,onDoubleClick:V,onKeyDown:O?U:void 0,tabIndex:O?0:void 0,onFocus:O?ee:void 0,role:b.ariaRole??(O?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":h?void 0:`${JT}-${g}`,"aria-label":b.ariaLabel,...b.domAttributes,children:(0,m.jsx)(sD,{value:e,children:(0,m.jsx)(w,{id:e,data:b.data,type:C,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:b.selected??!1,selectable:E,draggable:T,deletable:b.deletable??!0,isConnectable:D,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:M,dragHandle:b.dragHandle,zIndex:x.z,parentId:b.parentId,...P})})})}var ID=(0,p.memo)(FD),LD=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function RD(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=WT(LD,BT),a=jD(e.onlyRenderVisibleElements),o=ND();return(0,m.jsx)(`div`,{className:`react-flow__nodes`,style:JE,children:a.map(a=>(0,m.jsx)(ID,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}RD.displayName=`NodeRenderer`;var zD=(0,p.memo)(RD);function BD(e){return WT((0,p.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&sw({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),BT)}var VD=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,m.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},HD=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,m.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},UD={[tC.Arrow]:VD,[tC.ArrowClosed]:HD};function WD(e){let t=GT();return(0,p.useMemo)(()=>Object.prototype.hasOwnProperty.call(UD,e)?UD[e]:(t.getState().onError?.(`009`,KS.error009(e)),null),[e])}var GD=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=WD(t);return c?(0,m.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,m.jsx)(c,{color:n,strokeWidth:o})}):null},KD=({defaultColor:e,rfId:t})=>{let n=WT(e=>e.edges),r=WT(e=>e.defaultEdgeOptions),i=(0,p.useMemo)(()=>ww(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,m.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,m.jsx)(`defs`,{children:i.map(e=>(0,m.jsx)(GD,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};KD.displayName=`MarkerDefinitions`;var qD=(0,p.memo)(KD);function JD({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,p.useState)({x:1,y:0,width:0,height:0}),h=l_([`react-flow__edge-textwrapper`,l]),g=(0,p.useRef)(null);return(0,p.useEffect)(()=>{if(g.current){let e=g.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,m.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,m.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,m.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:g,style:r,children:n}),c]}):null}JD.displayName=`EdgeText`;var YD=(0,p.memo)(JD);function XD({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{...u,d:e,fill:`none`,className:l_([`react-flow__edge-path`,u.className])}),l?(0,m.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&kC(t)&&kC(n)?(0,m.jsx)(YD,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function ZD({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function QD({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=ZD({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=ZD({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=tw({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function $D(e){return(0,p.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:_,interactionWidth:v})=>{let[y,b,x]=QD({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),S=e.isInternal?void 0:t;return(0,m.jsx)(XD,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:_,interactionWidth:v})})}var eO=$D({isInternal:!1}),tO=$D({isInternal:!0});eO.displayName=`SimpleBezierEdge`,tO.displayName=`SimpleBezierEdgeInternal`;function nO(e){return(0,p.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:h=$.Top,markerEnd:g,markerStart:_,pathOptions:v,interactionWidth:y})=>{let[b,x,S]=_w({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:h,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),C=e.isInternal?void 0:t;return(0,m.jsx)(XD,{id:C,path:b,labelX:x,labelY:S,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:_,interactionWidth:y})})}var rO=nO({isInternal:!1}),iO=nO({isInternal:!0});rO.displayName=`SmoothStepEdge`,iO.displayName=`SmoothStepEdgeInternal`;function aO(e){return(0,p.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,m.jsx)(rO,{...n,id:r,pathOptions:(0,p.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var oO=aO({isInternal:!1}),sO=aO({isInternal:!0});oO.displayName=`StepEdge`,sO.displayName=`StepEdgeInternal`;function cO(e){return(0,p.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:h,interactionWidth:g})=>{let[_,v,y]=dw({sourceX:n,sourceY:r,targetX:i,targetY:a}),b=e.isInternal?void 0:t;return(0,m.jsx)(XD,{id:b,path:_,labelX:v,labelY:y,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:h,interactionWidth:g})})}var lO=cO({isInternal:!1}),uO=cO({isInternal:!0});lO.displayName=`StraightEdge`,uO.displayName=`StraightEdgeInternal`;function dO(e){return(0,p.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:_,pathOptions:v,interactionWidth:y})=>{let[b,x,S]=iw({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:v?.curvature}),C=e.isInternal?void 0:t;return(0,m.jsx)(XD,{id:C,path:b,labelX:x,labelY:S,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:_,interactionWidth:y})})}var fO=dO({isInternal:!1}),pO=dO({isInternal:!0});fO.displayName=`BezierEdge`,pO.displayName=`BezierEdgeInternal`;var mO={default:pO,straight:uO,step:sO,smoothstep:iO,simplebezier:tO},hO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},gO=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,_O=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,vO=`react-flow__edgeupdater`;function yO({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,m.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:l_([vO,`${vO}-${s}`]),cx:gO(t,r,e),cy:_O(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function bO({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let h=GT(),g=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:m,rfId:g,panBy:_,updateConnection:v}=h.getState(),y=t.type===`target`;iT.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>h.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>h.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>h.getState().transform,getFromHandle:()=>h.getState().connection.fromHandle,dragThreshold:h.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},_=e=>g(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),v=e=>g(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),y=()=>p(!0),b=()=>p(!1);return(0,m.jsxs)(m.Fragment,{children:[(e===!0||e===`source`)&&(0,m.jsx)(yO,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:_,onMouseEnter:y,onMouseOut:b,type:`source`}),(e===!0||e===`target`)&&(0,m.jsx)(yO,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:b,type:`target`})]})}function xO({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:_,noPanClassName:v,onError:y,disableKeyboardA11y:b}){let x=WT(t=>t.edgeLookup.get(e)),S=WT(e=>e.defaultEdgeOptions);x=S?{...S,...x}:x;let C=x.type||`default`,w=_?.[C]||mO[C];w===void 0&&(y?.(`011`,KS.error011(C)),C=`default`,w=_?.default||mO.default);let T=!!(x.focusable||t&&x.focusable===void 0),E=d!==void 0&&(x.reconnectable||n&&x.reconnectable===void 0),D=!!(x.selectable||r&&x.selectable===void 0),O=(0,p.useRef)(null),[k,A]=(0,p.useState)(!1),[j,M]=(0,p.useState)(!1),N=GT(),{zIndex:P=x.zIndex,sourceX:F,sourceY:I,targetX:L,targetY:R,sourcePosition:z,targetPosition:B}=WT((0,p.useCallback)(t=>{let n=t.nodeLookup.get(x.source),r=t.nodeLookup.get(x.target);if(!n||!r)return hO;let i=yw({id:e,sourceNode:n,targetNode:r,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:t.connectionMode,onError:y}),a=ow({selected:x.selected,zIndex:x.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||hO,zIndex:a}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex,y]),BT),V=(0,p.useMemo)(()=>x.markerStart?`url('#${Cw(x.markerStart,g)}')`:void 0,[x.markerStart,g]),H=(0,p.useMemo)(()=>x.markerEnd?`url('#${Cw(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||F===null||I===null||L===null||R===null)return null;let U=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=N.getState();D&&(N.setState({nodesSelectionActive:!1}),x.selected&&a?(r({nodes:[],edges:[x]}),O.current?.blur()):n([e])),i&&i(t,x)},ee=a?e=>{a(e,{...x})}:void 0,te=o?e=>{o(e,{...x})}:void 0,ne=s?e=>{s(e,{...x})}:void 0,W=c?e=>{c(e,{...x})}:void 0,re=l?e=>{l(e,{...x})}:void 0;return(0,m.jsx)(`svg`,{style:{zIndex:P},children:(0,m.jsxs)(`g`,{className:l_([`react-flow__edge`,`react-flow__edge-${C}`,x.className,v,{selected:x.selected,animated:x.animated,inactive:!D&&!i,updating:k,selectable:D}]),onClick:U,onDoubleClick:ee,onContextMenu:te,onMouseEnter:ne,onMouseMove:W,onMouseLeave:re,onKeyDown:T?t=>{if(!b&&JS.includes(t.key)&&D){let{unselectNodesAndEdges:n,addSelectedEdges:r}=N.getState();t.key===`Escape`?(O.current?.blur(),n({edges:[x]})):r([e])}}:void 0,tabIndex:T?0:void 0,role:x.ariaRole??(T?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":T?`${YT}-${g}`:void 0,ref:O,...x.domAttributes,children:[!j&&(0,m.jsx)(w,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:D,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:F,sourceY:I,targetX:L,targetY:R,sourcePosition:z,targetPosition:B,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:V,markerEnd:H,pathOptions:`pathOptions`in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),E&&(0,m.jsx)(bO,{edge:x,isReconnectable:E,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,sourceX:F,sourceY:I,targetX:L,targetY:R,sourcePosition:z,targetPosition:B,setUpdateHover:A,setReconnecting:M})]})})}var SO=(0,p.memo)(xO),CO=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function wO({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:h,disableKeyboardA11y:g}){let{edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,onError:b}=WT(CO,BT),x=BD(t);return(0,m.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,m.jsx)(qD,{defaultColor:e,rfId:n}),x.map(e=>(0,m.jsx)(SO,{id:e,edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:h,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:g},e))]})}wO.displayName=`EdgeRenderer`;var TO=(0,p.memo)(wO),EO=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function DO({children:e}){let t=GT(),n=(0,p.useRef)(null),[r]=(0,p.useState)(()=>t.getState().transform);return IE(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=EO(r)))};return r(),t.subscribe(r)},[t]),(0,m.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:EO(r)},children:e})}function OO(e){let t=UE(),n=(0,p.useRef)(!1);(0,p.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var kO=e=>e.panZoom?.syncViewport;function AO(e){let t=WT(kO),n=GT();return(0,p.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jO(e){return e.connection.inProgress?{...e.connection,to:MC(e.connection.to,e.transform)}:{...e.connection}}function MO(e){return e?t=>e(jO(t)):jO}function NO(e){return WT(MO(e),BT)}var PO=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FO({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=WT(PO,BT);return a&&i&&c?(0,m.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,m.jsx)(`g`,{className:l_([`react-flow__connection`,KC(s)]),children:(0,m.jsx)(IO,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var IO=({style:e,type:t=eC.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=NO();if(!i)return;if(n)return(0,m.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:KC(r),toNode:u,toHandle:d,pointer:p});let h=``,g={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case eC.Bezier:[h]=iw(g);break;case eC.SimpleBezier:[h]=QD(g);break;case eC.Step:[h]=_w({...g,borderRadius:0});break;case eC.SmoothStep:[h]=_w(g);break;default:[h]=dw(g)}return(0,m.jsx)(`path`,{d:h,fill:`none`,className:`react-flow__connection-path`,style:e})};IO.displayName=`ConnectionLine`;var LO={};function RO(e=LO){(0,p.useRef)(e),GT(),(0,p.useEffect)(()=>{},[e])}function zO(){GT(),(0,p.useRef)(!1),(0,p.useEffect)(()=>{},[])}function BO({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:h,connectionLineStyle:g,connectionLineComponent:_,connectionLineContainerStyle:v,selectionKeyCode:y,selectionOnDrag:b,selectionMode:x,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,deleteKeyCode:T,onlyRenderVisibleElements:E,elementsSelectable:D,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:F,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:z,panOnDrag:B,autoPanOnSelection:V,onPaneClick:H,onPaneMouseEnter:U,onPaneMouseMove:ee,onPaneMouseLeave:te,onPaneScroll:ne,onPaneContextMenu:W,paneClickDistance:re,nodeClickDistance:G,onEdgeContextMenu:K,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:se,onReconnect:ce,onReconnectStart:le,onReconnectEnd:ue,noDragClassName:de,noWheelClassName:fe,noPanClassName:pe,disableKeyboardA11y:me,nodeExtent:he,rfId:ge,viewport:_e,onViewportChange:ve,nodesDraggable:ye}){return RO(e),RO(t),zO(),OO(n),AO(_e),(0,m.jsx)(kD,{onPaneClick:H,onPaneMouseEnter:U,onPaneMouseMove:ee,onPaneMouseLeave:te,onPaneContextMenu:W,onPaneScroll:ne,paneClickDistance:re,deleteKeyCode:T,selectionKeyCode:y,selectionOnDrag:b,selectionMode:x,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,elementsSelectable:D,zoomOnScroll:P,zoomOnPinch:F,zoomOnDoubleClick:z,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:R,panOnDrag:B,autoPanOnSelection:V,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:de,noWheelClassName:fe,noPanClassName:pe,disableKeyboardA11y:me,onViewportChange:ve,isControlledViewport:!!_e,children:(0,m.jsxs)(DO,{children:[(0,m.jsx)(TO,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ce,onReconnectStart:le,onReconnectEnd:ue,onlyRenderVisibleElements:E,onEdgeContextMenu:K,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:se,defaultMarkerColor:N,noPanClassName:pe,disableKeyboardA11y:me,rfId:ge}),(0,m.jsx)(FO,{style:g,type:h,component:_,containerStyle:v}),(0,m.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,m.jsx)(zD,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:G,onlyRenderVisibleElements:E,noPanClassName:pe,noDragClassName:de,disableKeyboardA11y:me,nodeExtent:he,rfId:ge,nodesDraggable:ye}),(0,m.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}BO.displayName=`GraphView`;var VO=(0,p.memo)(BO),HO=AC(`React Flow`,`https://reactflow.dev/`),UO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??qS;Hw(h,g,_);let{nodesInitialized:x}=Nw(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=LC(cC(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:qS,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:XS.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...$S},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:HO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:YS,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},WO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>zT((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await fC({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...UO({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=Nw(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();Hw(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=zw(e,n,r,i,a,o,l);d&&(Aw(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=xw(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Rw(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(TE(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(EE(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>DE(e,!0))):(i(OE(r,new Set([...e]),!0)),a(OE(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>DE(e,!0))):(a(OE(n,new Set([...e]))),i(OE(r,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(DE(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(DE(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,DE(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,DE(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(Nw(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Bw({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...$S}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...UO()})}},Object.is);function GO({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:h}){let[g]=(0,p.useState)(()=>WO({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,m.jsx)(HT,{value:g,children:(0,m.jsx)(BE,{children:(0,m.jsx)(dD,{children:h})})})}function KO({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h}){return(0,p.useContext)(VT)?(0,m.jsx)(m.Fragment,{children:e}):(0,m.jsx)(GO,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:e})}var qO={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function JO({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:_,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:w,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onSelectionChange:j,onSelectionDragStart:M,onSelectionDrag:N,onSelectionDragStop:P,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:L,onBeforeDelete:R,connectionMode:z,connectionLineType:B=eC.Bezier,connectionLineStyle:V,connectionLineComponent:H,connectionLineContainerStyle:U,deleteKeyCode:ee=`Backspace`,selectionKeyCode:te=`Shift`,selectionOnDrag:ne=!1,selectionMode:W=QS.Full,panActivationKeyCode:re=`Space`,multiSelectionKeyCode:G=RC()?`Meta`:`Control`,zoomActivationKeyCode:K=RC()?`Meta`:`Control`,snapToGrid:ie,snapGrid:ae,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:se,nodesDraggable:ce,autoPanOnNodeFocus:le,nodesConnectable:ue,nodesFocusable:de,nodeOrigin:fe=uE,edgesFocusable:pe,edgesReconnectable:me,elementsSelectable:he=!0,defaultViewport:ge=dE,minZoom:_e=.5,maxZoom:ve=2,translateExtent:ye=qS,preventScrolling:be=!0,nodeExtent:xe,defaultMarkerColor:Se=`#b1b1b7`,zoomOnScroll:Ce=!0,zoomOnPinch:we=!0,panOnScroll:Te=!1,panOnScrollSpeed:Ee=.5,panOnScrollMode:De=ZS.Free,zoomOnDoubleClick:Oe=!0,panOnDrag:ke=!0,onPaneClick:Ae,onPaneMouseEnter:je,onPaneMouseMove:Me,onPaneMouseLeave:Ne,onPaneScroll:Pe,onPaneContextMenu:Fe,paneClickDistance:Ie=1,nodeClickDistance:Le=0,children:Re,onReconnect:ze,onReconnectStart:Be,onReconnectEnd:Ve,onEdgeContextMenu:He,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:Ge,onEdgeMouseLeave:Ke,reconnectRadius:qe=10,onNodesChange:Je,onEdgesChange:Ye,noDragClassName:Xe=`nodrag`,noWheelClassName:Ze=`nowheel`,noPanClassName:Qe=`nopan`,fitView:$e,fitViewOptions:et,connectOnClick:tt,attributionPosition:nt,proOptions:rt,defaultEdgeOptions:it,elevateNodesOnSelect:at=!0,elevateEdgesOnSelect:ot=!1,disableKeyboardA11y:st=!1,autoPanOnConnect:ct,autoPanOnNodeDrag:lt,autoPanOnSelection:ut=!0,autoPanSpeed:dt,connectionRadius:ft,isValidConnection:pt,onError:mt,style:ht,id:gt,nodeDragThreshold:_t,connectionDragThreshold:vt,viewport:yt,onViewportChange:bt,width:xt,height:St,colorMode:Ct=`light`,debug:wt,onScroll:Tt,ariaLabelConfig:Et,zIndexMode:Dt=`basic`,...Ot},kt){let At=gt||`1`,jt=_E(Ct),Mt=(0,p.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Tt?.(e)},[Tt]);return(0,m.jsx)(`div`,{"data-testid":`rf__wrapper`,...Ot,onScroll:Mt,style:{...ht,...qO},ref:kt,className:l_([`react-flow`,i,jt]),id:gt,role:`application`,children:(0,m.jsxs)(KO,{nodes:e,edges:t,width:xt,height:St,fitView:$e,fitViewOptions:et,minZoom:_e,maxZoom:ve,nodeOrigin:fe,nodeExtent:xe,zIndexMode:Dt,children:[(0,m.jsx)(hE,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:_,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:ce,autoPanOnNodeFocus:le,nodesConnectable:ue,nodesFocusable:de,edgesFocusable:pe,edgesReconnectable:me,elementsSelectable:he,elevateNodesOnSelect:at,elevateEdgesOnSelect:ot,minZoom:_e,maxZoom:ve,nodeExtent:xe,onNodesChange:Je,onEdgesChange:Ye,snapToGrid:ie,snapGrid:ae,connectionMode:z,translateExtent:ye,connectOnClick:tt,defaultEdgeOptions:it,fitView:$e,fitViewOptions:et,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onSelectionDrag:N,onSelectionDragStart:M,onSelectionDragStop:P,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Qe,nodeOrigin:fe,rfId:At,autoPanOnConnect:ct,autoPanOnNodeDrag:lt,autoPanSpeed:dt,onError:mt,connectionRadius:ft,isValidConnection:pt,selectNodesOnDrag:se,nodeDragThreshold:_t,connectionDragThreshold:vt,onBeforeDelete:R,debug:wt,ariaLabelConfig:Et,zIndexMode:Dt}),(0,m.jsx)(VO,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:w,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:V,connectionLineComponent:H,connectionLineContainerStyle:U,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:W,deleteKeyCode:ee,multiSelectionKeyCode:G,panActivationKeyCode:re,zoomActivationKeyCode:K,onlyRenderVisibleElements:oe,defaultViewport:ge,translateExtent:ye,minZoom:_e,maxZoom:ve,preventScrolling:be,zoomOnScroll:Ce,zoomOnPinch:we,zoomOnDoubleClick:Oe,panOnScroll:Te,panOnScrollSpeed:Ee,panOnScrollMode:De,panOnDrag:ke,autoPanOnSelection:ut,onPaneClick:Ae,onPaneMouseEnter:je,onPaneMouseMove:Me,onPaneMouseLeave:Ne,onPaneScroll:Pe,onPaneContextMenu:Fe,paneClickDistance:Ie,nodeClickDistance:Le,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:L,onReconnect:ze,onReconnectStart:Be,onReconnectEnd:Ve,onEdgeContextMenu:He,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:Ge,onEdgeMouseLeave:Ke,reconnectRadius:qe,defaultMarkerColor:Se,noDragClassName:Xe,noWheelClassName:Ze,noPanClassName:Qe,rfId:At,disableKeyboardA11y:st,nodeExtent:xe,viewport:yt,onViewportChange:bt,nodesDraggable:ce}),(0,m.jsx)(lE,{onSelectionChange:j}),Re,(0,m.jsx)(rE,{proOptions:rt,position:nt}),(0,m.jsx)(eE,{rfId:At,disableKeyboardA11y:st})]})})}var YO=FE(JO);KS.error014();function XO({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,m.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:l_([`react-flow__background-pattern`,n,r])})}function ZO({radius:e,className:t}){return(0,m.jsx)(`circle`,{cx:e,cy:e,r:e,className:l_([`react-flow__background-pattern`,`dots`,t])})}var QO;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(QO||={});var $O={[QO.Dots]:1,[QO.Lines]:1,[QO.Cross]:6},ek=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tk({id:e,variant:t=QO.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,p.useRef)(null),{transform:f,patternId:h}=WT(ek,BT),g=r||$O[t],_=t===QO.Dots,v=t===QO.Cross,y=Array.isArray(n)?n:[n,n],b=[y[0]*f[2]||1,y[1]*f[2]||1],x=g*f[2],S=Array.isArray(a)?a:[a,a],C=v?[x,x]:b,w=[S[0]*f[2]+C[0]/2,S[1]*f[2]+C[1]/2],T=`${h}${e||``}`;return(0,m.jsxs)(`svg`,{className:l_([`react-flow__background`,l]),style:{...c,...JE,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,m.jsx)(`pattern`,{id:T,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${w[0]},-${w[1]})`,children:_?(0,m.jsx)(ZO,{radius:x/2,className:u}):(0,m.jsx)(XO,{dimensions:C,lineWidth:i,variant:t,className:u})}),(0,m.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${T})`})]})}tk.displayName=`Background`;var nk=(0,p.memo)(tk);function rk(){return(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,m.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function ik(){return(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,m.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function ak(){return(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,m.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function ok(){return(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,m.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function sk(){return(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,m.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function ck({children:e,className:t,...n}){return(0,m.jsx)(`button`,{type:`button`,className:l_([`react-flow__controls-button`,t]),...n,children:e})}var lk=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function uk({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let h=GT(),{isInteractive:g,minZoomReached:_,maxZoomReached:v,ariaLabelConfig:y}=WT(lk,BT),{zoomIn:b,zoomOut:x,fitView:S}=UE();return(0,m.jsxs)(tE,{className:l_([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??y[`controls.ariaLabel`],children:[t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(ck,{onClick:()=>{b(),a?.()},className:`react-flow__controls-zoomin`,title:y[`controls.zoomIn.ariaLabel`],"aria-label":y[`controls.zoomIn.ariaLabel`],disabled:v,children:(0,m.jsx)(rk,{})}),(0,m.jsx)(ck,{onClick:()=>{x(),o?.()},className:`react-flow__controls-zoomout`,title:y[`controls.zoomOut.ariaLabel`],"aria-label":y[`controls.zoomOut.ariaLabel`],disabled:_,children:(0,m.jsx)(ik,{})})]}),n&&(0,m.jsx)(ck,{className:`react-flow__controls-fitview`,onClick:()=>{S(i),s?.()},title:y[`controls.fitView.ariaLabel`],"aria-label":y[`controls.fitView.ariaLabel`],children:(0,m.jsx)(ak,{})}),r&&(0,m.jsx)(ck,{className:`react-flow__controls-interactive`,onClick:()=>{h.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c?.(!g)},title:y[`controls.interactive.ariaLabel`],"aria-label":y[`controls.interactive.ariaLabel`],children:g?(0,m.jsx)(sk,{}):(0,m.jsx)(ok,{})}),u]})}uk.displayName=`Controls`;var dk=(0,p.memo)(uk);function fk({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:h,backgroundColor:g}=a||{},_=o||h||g;return(0,m.jsx)(`rect`,{className:l_([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:_,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var pk=(0,p.memo)(fk),mk=e=>e.nodes.map(e=>e.id),hk=e=>e instanceof Function?e:()=>e;function gk({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=pk,onClick:o}){let s=WT(mk,BT),c=hk(t),l=hk(e),u=hk(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,m.jsx)(m.Fragment,{children:s.map(e=>(0,m.jsx)(vk,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function _k({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=WT(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=BC(r);return{node:r,x:i,y:a,width:o,height:s}},BT);return!l||l.hidden||!VC(l)?null:(0,m.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var vk=(0,p.memo)(_k),yk=(0,p.memo)(gk),bk=200,xk=150,Sk=e=>!e.hidden,Ck=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?TC(cC(e.nodeLookup,{filter:Sk}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},wk=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Tk=(e,t)=>wk(e.viewBB,t.viewBB)&&wk(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,Ek=`react-flow__minimap-desc`;function Dk({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:h,onNodeClick:g,pannable:_=!1,zoomable:v=!1,ariaLabel:y,inversePan:b,zoomStep:x=1,offsetScale:S=5}){let C=GT(),w=(0,p.useRef)(null),{boundingRect:T,panZoom:E,viewBB:D,rfId:O,translateExtent:k,flowWidth:A,flowHeight:j,ariaLabelConfig:M}=WT(Ck,Tk),N=e?.width??bk,P=e?.height??xk,F=T.width/N,I=T.height/P,L=Math.max(F,I),R=L*N,z=L*P,B=S*L,V=T.x-(R-T.width)/2-B,H=T.y-(z-T.height)/2-B,U=R+B*2,ee=z+B*2,te=`${Ek}-${O}`,ne=(0,p.useRef)(0),W=(0,p.useRef)();ne.current=L,(0,p.useEffect)(()=>{let e=C.getState().panZoom;if(w.current&&e)return W.current=aT({domNode:w.current,panZoom:e,getTransform:()=>C.getState().transform,getViewScale:()=>ne.current}),()=>{W.current?.destroy()}},[E]),(0,p.useEffect)(()=>{W.current?.update({translateExtent:k,width:A,height:j,inversePan:b,pannable:_,zoomStep:x,zoomable:v})},[_,v,b,x,k,A,j]);let re=h?e=>{let[t,n]=W.current?.pointer(e)||[0,0];h(e,{x:t,y:n})}:void 0,G=(0,p.useCallback)((e,t)=>{let n=C.getState().nodeLookup.get(t).internals.userNode;g?.(e,n)},[g]),K=g?G:void 0,ie=y??M[`minimap.ariaLabel`];return(0,m.jsx)(tE,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*L:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:l_([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,m.jsxs)(`svg`,{width:N,height:P,viewBox:`${V} ${H} ${U} ${ee}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":te,ref:w,onClick:re,children:[ie&&(0,m.jsx)(`title`,{id:te,children:ie}),(0,m.jsx)(yk,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,m.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${V-B},${H-B}h${U+B*2}v${ee+B*2}h${-U-B*2}z
|
|
15
15
|
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Dk.displayName=`MiniMap`,(0,p.memo)(Dk);var Ok=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,kk={[bT.Line]:`right`,[bT.Handle]:`bottom-right`};function Ak({nodeId:e,position:t,variant:n=bT.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:_,onResize:v,onResizeEnd:y}){let b=cD(),x=typeof e==`string`?e:b,S=GT(),C=(0,p.useRef)(null),w=n===bT.Handle,T=WT((0,p.useCallback)(Ok(w&&h),[w,h]),BT),E=(0,p.useRef)(null),D=t??kk[n];(0,p.useEffect)(()=>{if(C.current&&x)return E.current||=jT({domNode:C.current,nodeId:x,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=S.getState(),o=[],s={x:e.x,y:e.y},c=r.get(x);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Rw([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...HC({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:x,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:x,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:x,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}}),E.current.update({controlPosition:D,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:_,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{E.current?.destroy()}},[D,s,c,l,u,d,_,v,y,g]);let O=D.split(`-`);return(0,m.jsx)(`div`,{className:l_([`react-flow__resize-control`,`nodrag`,...O,n,r]),ref:C,style:{...i,scale:T,...o&&{[w?`backgroundColor`:`borderColor`]:o}},children:a})}(0,p.memo)(Ak);var jk=new Set;function Mk(e){return e.startsWith(`signal:child:`)}function Nk(e){let t=g(),n=(()=>{let n=new Set(e),r=[...e];for(;r.length>0;){let e=r.shift();if(e===void 0)continue;let i=t.getQueryData([`run`,e]);if(i!==void 0)for(let e of i.timeline){let t=dh(e);t!==void 0&&!n.has(t)&&(n.add(t),r.push(t))}}return[...n].sort()})(),r=Je({queries:n.map(e=>({queryKey:[`run`,e],queryFn:()=>lr.run(e)}))}),i={};return n.forEach((e,t)=>{let n=r[t]?.data;n&&(i[e]=n)}),i}function Pk({data:e}){let t=e.status===`failed`,n=e.status===`pending`||e.status===`running`,r=!!e.childRunId,i=!!e.collapsed,a=r&&!i,o=a?kr:jr(e.kind),s=t?{rail:`bg-red-400`,badge:`bg-red-500/15 text-red-300`,pill:`bg-red-500/20 text-red-300`}:n?{rail:`bg-live`,badge:`bg-live/15 text-live`,pill:`bg-live/20 text-live`}:{rail:`bg-emerald-400`,badge:`bg-emerald-500/15 text-emerald-300`,pill:`bg-emerald-500/20 text-emerald-300`};return(0,m.jsxs)(`div`,{title:a?Mr.child:Mr[e.kind]??e.kind,className:`group relative w-[208px] cursor-pointer overflow-hidden rounded-xl border bg-panel/95 shadow-lg backdrop-blur transition-all duration-150 hover:-translate-y-0.5 ${e.selected?`border-brand/60 ring-2 ring-brand/30`:t?`border-red-500/40 hover:border-red-400/60`:a?`border-indigo-500/40 hover:border-indigo-400/60`:`border-line hover:border-zinc-600`}`,children:[(0,m.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-[3px] ${s.rail} ${n?`animate-pulse`:``}`}),(0,m.jsx)(gD,{type:`target`,position:$.Left,className:`!border-0 !bg-zinc-600`}),(0,m.jsxs)(`div`,{className:`py-2.5 pl-3.5 pr-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`grid h-5 w-5 shrink-0 place-items-center rounded ${s.badge}`,children:(0,m.jsx)(o,{width:12,height:12})}),(0,m.jsx)(`span`,{className:`truncate text-[13px] font-medium text-zinc-100`,children:e.name}),(0,m.jsx)(`span`,{className:`ml-auto grid h-4 w-4 shrink-0 place-items-center rounded-full ${s.pill} ${n?`animate-pulse`:``}`,children:t?(0,m.jsx)(Sr,{width:9,height:9}):n?(0,m.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-current`}):(0,m.jsx)(xr,{width:9,height:9})})]}),(0,m.jsxs)(`div`,{className:`mono mt-1.5 flex items-center gap-1.5 text-[10px] text-zinc-500`,children:[r?(0,m.jsxs)(`span`,{className:`flex items-center gap-1`,children:[!i&&(0,m.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.childRunId&&e.onToggleChild?.(e.childRunId)},title:e.childExpanded?`Collapse child flow`:`Expand child flow inline`,className:`grid h-4 w-4 place-items-center rounded border border-indigo-500/30 bg-indigo-500/10 text-indigo-300 transition-colors hover:border-indigo-400/60 hover:bg-indigo-500/20 hover:text-indigo-200`,children:(0,m.jsx)(`span`,{className:`inline-block text-[9px] transition-transform`,style:{transform:e.childExpanded?`rotate(90deg)`:`rotate(0deg)`},children:`▸`})}),(0,m.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.childRunId&&e.onOpenRun?.(e.childRunId)},title:`Open the child run`,className:`rounded border border-indigo-500/30 bg-indigo-500/10 px-1 text-indigo-300 transition-colors hover:border-indigo-400/60 hover:bg-indigo-500/20 hover:text-indigo-200`,children:`child ↗`})]}):(0,m.jsx)(`span`,{className:`rounded border border-line px-1 text-zinc-400`,children:e.kind}),e.attempts>1&&(0,m.jsxs)(`span`,{className:`flex items-center gap-0.5 text-amber-300`,children:[(0,m.jsx)(Tr,{width:9,height:9}),e.attempts]}),e.workerGroup&&(0,m.jsxs)(`span`,{className:`truncate`,children:[`@`,e.workerGroup]}),(0,m.jsxs)(`span`,{className:`tnum ml-auto text-zinc-400`,children:[`#`,e.seq,e.duration&&(0,m.jsxs)(`span`,{className:`text-zinc-600`,children:[` · `,e.duration]})]})]}),e.subs&&(0,m.jsxs)(`div`,{className:`mono mt-1.5 flex items-center gap-2 border-t border-line pt-1.5 text-[10px]`,children:[e.subs.ok>0&&(0,m.jsxs)(`span`,{className:`text-emerald-300`,children:[e.subs.ok,` ok`]}),e.subs.failed>0&&(0,m.jsxs)(`span`,{className:`text-red-300`,children:[e.subs.failed,` failed`]}),e.subs.skipped>0&&(0,m.jsxs)(`span`,{className:`text-amber-300`,children:[e.subs.skipped,` skipped`]})]})]}),(0,m.jsx)(gD,{type:`source`,position:$.Right,className:`!border-0 !bg-zinc-600`})]})}function Fk({data:e}){let t=e.status===`running`||e.status===`awaiting`;return(0,m.jsxs)(`div`,{className:`s-${e.status} flex items-center gap-2 rounded-full border border-current/30 bg-panel px-3.5 py-1.5`,children:[(0,m.jsx)(gD,{type:`target`,position:$.Left,className:`!border-0 !bg-zinc-600`}),(0,m.jsx)(`span`,{className:`dot ${t?`pulse`:``}`}),(0,m.jsx)(`span`,{className:`mono text-[11px] uppercase tracking-wider`,children:e.label}),(0,m.jsx)(gD,{type:`source`,position:$.Right,className:`!border-0 !bg-zinc-600`})]})}var Ik={step:Pk,terminal:Fk};function Lk(e){let t=e.events?.filter(e=>e.status);if(t&&t.length!==0)return{ok:t.filter(e=>e.status===`ok`).length,failed:t.filter(e=>e.status===`failed`).length,skipped:t.filter(e=>e.status===`skipped`).length}}function Rk({run:e,timeline:t,endStatus:n,selectedKey:r,onSelect:i,onOpenRun:a,fmtDuration:o,expanded:s,onToggleChild:c}){let l=s??jk,u=Nk((0,p.useMemo)(()=>{let e=new Set(l);for(let n of t){let t=dh(n);t!==void 0&&e.add(t)}return e},[l,t])),{nodes:d,edges:f}=(()=>{let i=[],s=[],d=e.status===`running`||e.status===`suspended`,f=(e,t,n)=>({id:`${e}->${t}`,source:e,target:t,style:{stroke:n?`#f87171`:`var(--line)`,strokeWidth:1.5}}),p=(e,t)=>({id:`${e}=>${t}`,source:e,target:t,style:{stroke:`#818cf8`,strokeWidth:1.5,strokeDasharray:`4 3`}});function m(e,t,n,d,f,m){let g=`${f}s${e.seq}`,_=dh(e),v=_===void 0?void 0:u[_],y=v!==void 0&&v.timeline.length===1&&v.timeline[0]?{step:v.timeline[0],run:v.run}:void 0,b=y!==void 0,x=!b&&_!==void 0&&l.has(_),S=y?y.step:e,C=y?y.run:m,w=y?y.step.name:_===void 0?mh(e):v?.run.workflow??`child workflow`,T=S.status===`failed`;i.push({id:g,type:`step`,draggable:!1,position:{x:t,y:n},data:{seq:S.seq,name:w,kind:S.kind,status:S.status,workerGroup:S.workerGroup,attempts:S.attempts,duration:o(S.startedAt,S.finishedAt),subs:Lk(S),selected:r===`${S.runId}#${S.seq}`,childRunId:_,onOpenRun:a,childExpanded:x,onToggleChild:c,collapsed:b,depth:d,step:S,laneRun:C}});let E=x?v:void 0;if(E){let r=h(E.timeline,d+1,t+248,n+150,`${_}:`,E.run);for(let e of r.firstIds)s.push(p(g,e));return{id:g,exits:Mk(e.name)&&r.connectors.length>0?r.connectors:[{id:g,failed:T}],nextX:Math.max(t+248,r.nextX),bottomY:Math.max(n,r.bottomY)}}return{id:g,exits:[{id:g,failed:T}],nextX:t+248,bottomY:n}}function h(e,t,n,r,i,a){let o=n,c=[],l=[],u=r;for(let n of _h(e)){let e=n.kind===`single`?[n.step]:n.steps,d=c.length===0,p=[],h=r,g=o;for(let n of e){let e=m(n,o,h,t,i,a);d&&c.push(e.id);for(let t of l)s.push(f(t.id,e.id,t.failed));p.push(...e.exits),g=Math.max(g,e.nextX),h=e.bottomY+96}l=p,o=g,u=Math.max(u,h-96)}return{firstIds:c,connectors:l,nextX:o,bottomY:u}}i.push({id:`start`,type:`terminal`,position:{x:0,y:0},draggable:!1,data:{status:`running`,label:e.workflow}});let g=h(t,0,248,0,``,e);for(let e of g.firstIds)s.push({id:`start->${e}`,source:`start`,target:e});let _=n??Xn(e,t);i.push({id:`end`,type:`terminal`,position:{x:Math.max(g.nextX,248),y:0},draggable:!1,data:{status:_,label:_}});let v=g.connectors.length>0?g.connectors:[{id:`start`,failed:!1}];for(let e of v)s.push({id:`${e.id}->end`,source:e.id,target:`end`,animated:d,style:{stroke:d?`var(--live)`:`var(--line)`,strokeWidth:d?2:1.5}});return{nodes:i,edges:s}})(),h=(0,p.useCallback)((e,t)=>{if(t.type!==`step`)return;let n=t.data;n.step&&n.laneRun&&i(n.step,n.laneRun)},[i]);return(0,m.jsxs)(YO,{nodes:d,edges:f,nodeTypes:Ik,onNodeClick:h,fitView:!0,fitViewOptions:{padding:.3,maxZoom:1.1},proOptions:{hideAttribution:!0},nodesConnectable:!1,nodesDraggable:!1,panOnScroll:!0,minZoom:.3,children:[(0,m.jsx)(nk,{variant:QO.Dots,gap:22,size:1,color:`#1c1c22`}),(0,m.jsx)(dk,{showInteractive:!1,position:`bottom-right`})]})}function zk({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,role:`img`,"aria-label":`durable`,children:[(0,m.jsx)(`title`,{children:`durable`}),(0,m.jsx)(`path`,{d:`M12 2.5 21.5 12 12 21.5 2.5 12z`,opacity:.35}),(0,m.jsx)(`circle`,{cx:`6.4`,cy:`12`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`17.6`,cy:`12`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`path`,{d:`M8.1 12h2.2M13.7 12h2.2`})]})}var Bk=[`pending`,`running`,`suspended`,`blocked`,`completed`,`failed`,`cancelled`,`dead`],Vk=100;function Hk(e){let t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function Uk(e,t){let n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function Wk({status:e}){return(0,m.jsx)(`span`,{className:`dot s-${e} ${e===`running`||e===`awaiting`?`pulse`:``}`,"aria-hidden":!0})}function Gk({status:e}){return(0,m.jsxs)(fa,{variant:`status`,className:`s-${e} text-[11px]`,children:[(0,m.jsx)(Wk,{status:e}),e]})}function Kk({onOpenRun:e}){let[t,n]=(0,p.useState)(``),[r,i]=(0,p.useState)(!1),a=Ze({mutationFn:e=>lr.run(e),onSuccess:t=>{n(``),i(!1),e(t.run.id)},onError:()=>i(!0)});return(0,m.jsxs)(`form`,{className:`relative`,onSubmit:e=>{e.preventDefault();let n=t.trim();n&&a.mutate(n)},children:[(0,m.jsx)(ha,{glyph:(0,m.jsx)(Dr,{width:12,height:12}),value:t,onChange:e=>{n(e.target.value),i(!1)},onClear:()=>{n(``),i(!1)},clearLabel:`clear run id`,placeholder:`open run id…`,"aria-label":`open run by id`,containerClassName:`w-44`}),r&&(0,m.jsx)(`span`,{className:`mono absolute left-0 top-full z-20 mt-1 whitespace-nowrap rounded border border-bad/25 bg-panel-2 px-1.5 py-0.5 text-[10px] text-bad`,children:`no run with that id`})]})}function qk(){return(0,m.jsxs)(gm,{children:[(0,m.jsx)(_m,{render:(0,m.jsx)(Y,{variant:`quiet`,size:`icon`,"aria-label":`session menu`,title:`Session`,children:(0,m.jsx)(Or,{width:13,height:13})})}),(0,m.jsx)(vm,{className:`w-36`,children:(0,m.jsx)(`a`,{href:er(),className:`mono block px-2.5 py-2 text-[11px] text-zinc-300 hover:bg-zinc-800/50 hover:text-zinc-100`,children:`Logout`})})]})}function Jk({scope:e,filter:t,onFilter:n,onOpenRun:r,view:i,onView:a}){let{data:o=[]}=Xe({queryKey:[`run-values`,`status`,e],queryFn:()=>lr.values(`status`,e),refetchInterval:5e3}),s={};for(let e of o)e.value!==null&&(s[e.value]=e.count);let c=Object.values(s).reduce((e,t)=>e+t,0),l=(e,r,i)=>(0,m.jsxs)(Y,{variant:`ghost`,size:`chip`,"aria-pressed":t===e,onClick:()=>n(e),className:ua(`rounded-md`,t===e&&`border-zinc-600 bg-zinc-900 text-zinc-100 hover:text-zinc-100`),children:[e!==`all`&&(0,m.jsx)(Wk,{status:e}),(0,m.jsx)(`span`,{className:`uppercase tracking-wide`,children:r}),(0,m.jsx)(`span`,{className:`mono tnum text-zinc-600`,children:i})]},e),{data:u}=Xe({queryKey:[`topology`],queryFn:()=>lr.topology(),staleTime:1/0}),d=u?.role===`tenant`,f=u?d?u.tenant?`tenant · ${u.tenant}`:`tenant`:`control plane`:``;return(0,m.jsxs)(`header`,{className:`z-10 flex items-center gap-4 border-b border-line px-5 py-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,m.jsx)(`div`,{className:`grid h-7 w-7 place-items-center rounded-md border border-brand/30 bg-brand/10`,children:(0,m.jsx)(zk,{className:`h-4 w-4 text-brand`})}),(0,m.jsxs)(`div`,{className:`leading-none`,children:[(0,m.jsx)(`div`,{className:`text-sm font-semibold tracking-tight`,children:`durable`}),(0,m.jsx)(`div`,{className:`mono text-[10px] uppercase tracking-[0.2em] ${d?`text-amber-400/80`:`text-zinc-600`}`,title:d?`Tenant deployment — partition ${u?.tenant??`(unnamed)`}`:`Control-plane deployment`,children:f})]})]}),(0,m.jsx)(`nav`,{"aria-label":`console views`,className:`ml-2 flex items-center gap-1`,children:[`runs`,...d?[]:[`schedules`]].map(e=>(0,m.jsx)(Y,{variant:`ghost`,size:`chip`,"aria-pressed":i===e,onClick:()=>a(e),className:ua(`rounded-md uppercase tracking-wide`,i===e&&`border-zinc-600 bg-zinc-900 text-zinc-100 hover:text-zinc-100`),children:e},e))}),i===`runs`&&(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[l(`all`,`all`,c),Bk.map(e=>l(e,e,s[e]??0))]}),(0,m.jsx)(Kk,{onOpenRun:r}),(0,m.jsx)(Qk,{onOpenRun:r}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-zinc-500`,children:[(0,m.jsx)(`span`,{className:`dot s-completed pulse`,"aria-hidden":!0}),`live`]}),(0,m.jsx)(qk,{})]})}function Yk(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;let n=Math.round(t/60);if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function Xk({status:e}){let t=e?.concurrency;if(!e||!t)return(0,m.jsx)(`span`,{className:`mono text-[9px] text-zinc-600`,children:`no status`});let n=t.limit>0&&e.inFlight>=t.limit*.8;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsxs)(`div`,{className:`mono flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px] text-zinc-500`,children:[(0,m.jsx)(`span`,{className:`shrink-0 rounded border px-1 text-[9px] uppercase tracking-wider ${t.mode===`adaptive`?`border-sky-500/40 bg-sky-500/10 text-sky-300`:`border-zinc-600/50 bg-zinc-800/60 text-zinc-400`}`,children:t.mode===`adaptive`?`adaptive ${t.min??1}–${t.max??32}`:`fixed`}),(0,m.jsxs)(`span`,{className:n?`text-amber-300`:`text-zinc-400`,children:[`in-flight`,` `,(0,m.jsxs)(`span`,{className:`tnum`,children:[e.inFlight,`/`,t.limit]})]}),typeof e.rssPct==`number`&&(0,m.jsxs)(`span`,{className:e.rssPct>=85?`text-rose-300`:``,children:[`ram `,(0,m.jsxs)(`span`,{className:`tnum`,children:[Math.round(e.rssPct),`%`]})]}),typeof e.cpuPct==`number`&&(0,m.jsxs)(`span`,{children:[`cpu `,(0,m.jsxs)(`span`,{className:`tnum`,children:[Math.round(e.cpuPct),`%`]})]}),typeof e.throughputPerMin==`number`&&(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:`tnum`,children:Math.round(e.throughputPerMin)}),`/min`]}),typeof e.p95Ms==`number`&&(0,m.jsxs)(`span`,{children:[`p95 `,(0,m.jsxs)(`span`,{className:`tnum`,children:[Math.round(e.p95Ms),`ms`]})]})]}),e.lastAdjust&&(0,m.jsxs)(`div`,{className:`mono text-[10px] text-zinc-500`,children:[e.lastAdjust.reason,` `,(0,m.jsxs)(`span`,{className:`tnum text-zinc-400`,children:[e.lastAdjust.from,`→`,e.lastAdjust.to]}),` `,Yk(e.lastAdjust.at)]})]})}function Zk({workers:e}){return(0,m.jsx)(`div`,{className:`flex flex-col divide-y divide-line-soft`,children:e.map(e=>(0,m.jsxs)(`div`,{className:`flex flex-col gap-1 px-2.5 py-2`,children:[(0,m.jsx)(`span`,{className:`mono truncate text-[10px] text-zinc-400`,children:e.instanceId}),(0,m.jsx)(Xk,{status:e.status})]},e.instanceId))})}function Qk({onOpenRun:e}){let{data:t}=Xe({queryKey:[`workers`],queryFn:()=>lr.workers(),refetchInterval:1e4}),{data:n}=Xe({queryKey:[`compat`],queryFn:()=>lr.compat(),refetchInterval:15e3,retry:!1}),[r,i]=(0,p.useState)(`workers`),a=(n?.incompatibleCount??0)+(n?.blockedCount??0);if((!t||t.length===0)&&a===0)return null;let o=t??[],s=hr(o),c={workers:`pods`,partitions:`parts`,alerts:`alerts`,compat:`compat`};return(0,m.jsxs)(t_,{value:r,onValueChange:e=>i(e),className:`ml-auto flex flex-nowrap items-center gap-1.5`,children:[(0,m.jsx)(n_,{children:[`workers`,`partitions`,`alerts`,`compat`].map(e=>(0,m.jsxs)(r_,{value:e,children:[c[e],e===`alerts`&&s.starved.length>0&&(0,m.jsx)(`span`,{className:`tnum ml-1 rounded bg-rose-500/80 px-1 text-[9px] text-white`,children:s.starved.length}),e===`compat`&&a>0&&(0,m.jsx)(`span`,{className:`tnum ml-1 rounded bg-rose-500/80 px-1 text-[9px] text-white`,children:a})]},e))}),(0,m.jsxs)(`div`,{className:`flex w-[300px] flex-nowrap items-center justify-end gap-1.5`,children:[(0,m.jsx)(i_,{value:`workers`,className:`flex flex-nowrap items-center gap-1.5`,children:(0,m.jsx)(nA,{workers:mr(o)})}),(0,m.jsx)(i_,{value:`partitions`,className:`flex flex-nowrap items-center gap-1.5`,children:(0,m.jsx)(rA,{groups:o})}),(0,m.jsx)(i_,{value:`alerts`,className:`flex flex-nowrap items-center gap-1.5`,children:(0,m.jsx)(iA,{summary:s})}),(0,m.jsx)(i_,{value:`compat`,className:`flex flex-nowrap items-center gap-1.5`,children:(0,m.jsx)(lh,{compat:n,onOpenRun:e})})]})]})}var $k=`__overflow__`;function eA(e){let t=e.status?.concurrency;return e.status&&t?`${e.status.inFlight}/${t.limit}`:void 0}function tA({w:e}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`px-2.5 py-2`,children:(0,m.jsx)(Xk,{status:e.status})}),(0,m.jsxs)(`div`,{className:`max-h-48 overflow-auto border-t border-line-soft px-2.5 py-1.5`,children:[(0,m.jsxs)(`div`,{className:`mono mb-1 text-[9px] uppercase tracking-wider text-zinc-600`,children:[e.handlers.length,` handlers`]}),e.handlers.map(e=>(0,m.jsx)(`div`,{className:`mono truncate text-[10px] text-zinc-400`,children:e},e))]})]})}function nA({workers:e}){let[t,n]=(0,p.useState)(void 0),[r,i]=(0,p.useState)(void 0),a=e.slice(0,2),o=e.slice(2),s=t===$k;return(0,m.jsxs)(m.Fragment,{children:[a.map(e=>{let r=t===e.instanceId,i=eA(e);return(0,m.jsxs)(gm,{open:r,onOpenChange:t=>n(t?e.instanceId:void 0),children:[(0,m.jsx)(ih,{suppressed:r,label:`${e.instanceId}\n${e.handlers.length} handlers · ${e.partition}${i?` · ${i} in-flight`:``}`,children:(0,m.jsx)(_m,{render:(0,m.jsxs)(Y,{variant:`chip`,size:`xs`,className:ua(`mono max-w-[120px] gap-1`,r&&`border-zinc-500 bg-zinc-800 text-zinc-200`),children:[(0,m.jsx)(`span`,{className:`dot ${e.status?`s-completed`:``}`,"aria-hidden":!0}),(0,m.jsx)(`span`,{className:`truncate`,children:e.instanceId}),e.partition!=="default"&&(0,m.jsxs)(`span`,{className:`shrink-0 text-zinc-500`,children:[`@`,e.partition]}),(0,m.jsxs)(`span`,{className:`tnum shrink-0 text-zinc-500`,children:[e.handlers.length,`h`,i?` · ${i}`:``]})]})})}),(0,m.jsxs)(vm,{children:[(0,m.jsxs)(`div`,{className:`mono flex items-center justify-between gap-2 border-b border-line px-2.5 py-1.5 text-[10px] text-zinc-500`,children:[(0,m.jsx)(`span`,{className:`truncate text-zinc-300`,children:e.instanceId}),(0,m.jsxs)(`span`,{className:`shrink-0`,children:[e.runtime??`node`,` · `,e.partition]})]}),(0,m.jsx)(tA,{w:e})]})]},e.instanceId)}),o.length>0&&(0,m.jsxs)(gm,{open:s,onOpenChange:e=>{n(e?$k:void 0),i(void 0)},children:[(0,m.jsx)(_m,{render:(0,m.jsxs)(Y,{variant:`chip`,size:`xs`,className:ua(`mono shrink-0`,s&&`border-zinc-500 bg-zinc-800 text-zinc-200`),children:[`+`,o.length]})}),(0,m.jsxs)(vm,{children:[(0,m.jsxs)(`div`,{className:`mono border-b border-line px-2.5 py-1.5 text-[9px] uppercase tracking-wider text-zinc-600`,children:[o.length,` more `,o.length===1?`pod`:`pods`]}),(0,m.jsx)(`div`,{className:`max-h-80 divide-y divide-line-soft overflow-auto`,children:o.map(e=>{let t=eA(e),n=r===e.instanceId;return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`button`,{type:`button`,onClick:()=>i(n?void 0:e.instanceId),className:ua(`mono flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-left text-[10px] hover:bg-zinc-800/50`,n?`bg-zinc-800/40 text-zinc-200`:`text-zinc-300`),children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,m.jsx)(`span`,{className:`dot ${e.status?`s-completed`:``}`,"aria-hidden":!0}),(0,m.jsx)(`span`,{className:`truncate`,children:e.instanceId})]}),(0,m.jsxs)(`span`,{className:`tnum shrink-0 text-zinc-500`,children:[e.partition==="default"?``:`@${e.partition} · `,e.handlers.length,`h`,t?` · ${t}`:``]})]}),n&&(0,m.jsx)(`div`,{className:`border-t border-line-soft bg-zinc-900/40`,children:(0,m.jsx)(tA,{w:e})})]},e.instanceId)})})]})]})]})}function rA({groups:e}){let[t,n]=(0,p.useState)(void 0),r=fr(e);function i(t){let n=new Map;for(let r of e)if(ur(r.group)===t)for(let e of r.liveWorkers)n.has(e.instanceId)||n.set(e.instanceId,e);return[...n.values()]}return(0,m.jsx)(m.Fragment,{children:r.map(e=>{let r=e.starvedCount>0,a=t===e.partition;return(0,m.jsxs)(gm,{open:a&&e.workerCount>0,onOpenChange:t=>n(t?e.partition:void 0),children:[(0,m.jsx)(ih,{suppressed:a,label:`${e.partition}\n${e.workerCount} workers · ${e.handlerCount} handlers · ${e.totalDepth} queued${r?` · ${e.starvedCount} starved`:``}`,children:(0,m.jsx)(_m,{render:(0,m.jsxs)(Y,{variant:`chip`,size:`xs`,disabled:e.workerCount===0,className:ua(`mono gap-1`,r&&`border-rose-500/50 bg-rose-500/15 text-rose-300`,!r&&a&&`border-zinc-500 bg-zinc-800 text-zinc-200`,e.workerCount>0?`cursor-pointer`:`cursor-default`),children:[(0,m.jsx)(`span`,{className:`dot ${r?`s-failed`:e.workerCount>0?`s-completed`:``}`,"aria-hidden":!0}),e.partition,(0,m.jsxs)(`span`,{className:`tnum text-zinc-500`,children:[e.workerCount,`w `,e.handlerCount,`h`,e.totalDepth>0?` ${e.totalDepth}q`:``,r?` ${e.starvedCount}!`:``]})]})})}),(0,m.jsxs)(vm,{children:[(0,m.jsxs)(`div`,{className:`mono flex items-center justify-between border-b border-line px-2.5 py-1.5 text-[10px] text-zinc-500`,children:[(0,m.jsx)(`span`,{className:`text-zinc-300`,children:e.partition}),(0,m.jsxs)(`span`,{className:`tnum`,children:[e.workerCount,` worker(s) · `,e.totalDepth,` queued`]})]}),(0,m.jsx)(Zk,{workers:i(e.partition)})]})]},e.partition)})})}function iA({summary:e}){let t=(e,t)=>`${e} ${e===1?t:`${t}s`}`;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(ih,{label:`Route-by-handler: each @Workflow & @Step is served as its own queue.\n${e.queueCount} queues across ${t(e.workerCount,`worker`)}.`,children:(0,m.jsxs)(`span`,{className:`mono tnum text-[10px] text-zinc-500`,children:[t(e.workflowCount,`workflow`),` · `,t(e.stepCount,`step`),` ·`,` `,t(e.workerCount,`worker`),` ·`,` `,e.allDraining?(0,m.jsx)(`span`,{className:`text-good`,children:`all draining`}):(0,m.jsxs)(`span`,{className:`text-rose-300`,children:[e.starved.length,` starved`]})]})}),e.starved.map(e=>(0,m.jsx)(ih,{label:`${e.group}\n${e.depth} queued, no worker consuming`,children:(0,m.jsxs)(fa,{variant:`danger`,className:`mono gap-1 border-rose-500/50 bg-rose-500/15 py-0.5`,children:[(0,m.jsx)(`span`,{className:`dot s-failed`,"aria-hidden":!0}),(0,m.jsx)(`span`,{className:`max-w-[180px] truncate`,children:e.group}),(0,m.jsxs)(`span`,{className:`tnum shrink-0`,children:[e.depth,`q · 0w`]})]})},e.group))]})}function aA(){return(0,m.jsx)(`ul`,{className:`divide-y divide-line-soft`,"aria-hidden":!0,children:[0,1,2,3,4,5].map(e=>(0,m.jsxs)(`li`,{className:`flex flex-col gap-2 px-4 py-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,m.jsx)(`div`,{className:`h-3.5 w-32 animate-pulse rounded bg-zinc-800`}),(0,m.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-zinc-800/70`})]}),(0,m.jsx)(`div`,{className:`h-2.5 w-48 animate-pulse rounded bg-zinc-800/50`})]},e))})}function oA({r:e,allRuns:t,health:n,selected:r,onSelect:i,onSelectTag:a,onSelectNamespace:o,onSelectOrigin:s}){let c=Yn(e,{runs:t,health:n}),l=e.namespace&&e.namespace!=="default"?e.namespace:void 0,u=bn(e.origin);return(0,m.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:`flex w-full flex-col gap-1 px-4 py-3 text-left transition-colors ${r===e.id?`bg-zinc-900`:`hover:bg-zinc-900/50`}`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`truncate text-sm font-medium text-zinc-200`,children:e.workflow}),l&&(0,m.jsx)(fa,{variant:`tenant`,className:`mono shrink-0 cursor-pointer px-1 text-[9px] hover:border-sky-400/60 hover:text-sky-200`,title:`Tenant / worker-pool partition — click to show only ${l}`,onClick:e=>{e.stopPropagation(),o(l)},children:l}),u&&(0,m.jsx)(fa,{variant:`origin`,className:`mono shrink-0 cursor-pointer px-1 text-[9px] hover:border-teal-400/60 hover:text-teal-200`,title:`Declared by ${u} — click to show only this library's runs`,onClick:e=>{e.stopPropagation(),s({kind:`origin`,origin:u})},children:Sn(u)}),e.id.startsWith(`dlq:`)&&(0,m.jsx)(fa,{variant:`danger`,className:`mono shrink-0 px-1 text-[9px] uppercase tracking-wider`,children:`dlq`})]}),(0,m.jsx)(Gk,{status:c.status})]}),c.detail&&(0,m.jsx)(`div`,{className:`mono truncate text-[11px] s-${c.status}`,children:c.detail}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,m.jsx)(`span`,{className:`mono truncate text-[11px] text-zinc-600`,children:e.id}),(0,m.jsx)(`span`,{className:`shrink-0 text-[11px] text-zinc-600`,children:Hk(e.updatedAt)})]}),e.tags&&e.tags.length>0&&(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.map(e=>(0,m.jsxs)(`span`,{onClick:t=>{t.stopPropagation(),a(e)},className:ua(da({variant:`outline`}),`mono cursor-pointer hover:border-zinc-500 hover:text-zinc-200`),children:[`#`,e]},e))})]})}var sA=88;function cA({runs:e,allRuns:t,health:n,loading:r,selected:i,onSelect:a,onSelectTag:o,onSelectNamespace:s,onSelectOrigin:c,emptyNotice:l,hasMore:u,loadingMore:d,onLoadMore:f}){let h=(0,p.useRef)(null),g=(0,p.useCallback)(t=>e[t]?.id??t,[e]),_=Gt({count:e.length,getScrollElement:()=>h.current,estimateSize:()=>sA,getItemKey:g,overscan:10,initialRect:{width:340,height:480}}),v=_.getVirtualItems(),y=v.length>0?v[v.length-1]?.index??-1:-1;return(0,p.useEffect)(()=>{e.length!==0&&(y<e.length-1||u&&!d&&f?.())},[y,e.length,u,d,f]),r&&e.length===0?(0,m.jsx)(aA,{}):e.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-start gap-2 p-6 text-sm text-zinc-600`,children:[(0,m.jsx)(`span`,{children:l.message}),l.unclassified!==void 0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:`text-[11px] text-zinc-500`,children:[l.unclassified,` run`,l.unclassified===1?``:`s`,` here`,` `,l.unclassified===1?`has`:`have`,` no recorded origin, so no package filter can match `,l.unclassified===1?`it`:`them`,`.`]}),(0,m.jsx)(Y,{variant:`chip`,size:`xs`,className:`mono rounded`,title:`Runs with no recorded origin: started before origins were stamped, or registered through a path whose declaring package could not be resolved. Not attributed to any library.`,onClick:()=>c({kind:`unknown`}),children:`show unclassified`})]})]}):(0,m.jsxs)(`div`,{ref:h,className:`h-full overflow-auto`,"data-testid":`runs-list-scroll`,children:[(0,m.jsx)(`ul`,{className:`relative divide-y divide-line-soft`,style:{height:_.getTotalSize()},children:v.map(r=>{let l=e[r.index];return l?(0,m.jsx)(`li`,{ref:_.measureElement,"data-index":r.index,className:`absolute inset-x-0 top-0`,style:{transform:`translateY(${r.start}px)`},children:(0,m.jsx)(oA,{r:l,allRuns:t,health:n,selected:i,onSelect:a,onSelectTag:o,onSelectNamespace:s,onSelectOrigin:c})},l.id):null})}),d&&(0,m.jsx)(`div`,{className:`mono px-4 py-2 text-center text-[11px] text-zinc-600`,children:`loading more…`})]})}function lA({compensations:e,selKey:t,onSelect:n}){return(0,m.jsxs)(`div`,{className:`shrink-0 border-t border-amber-500/20 bg-black/20 px-7 py-3`,children:[(0,m.jsx)(`div`,{className:`mono mb-2 text-[10px] uppercase tracking-[0.18em] text-amber-400/80`,children:`compensation · unwind order`}),(0,m.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>{let r=`${e.runId}#${e.seq}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`mono flex w-full items-center gap-2 rounded-md border px-2.5 py-1.5 text-left text-[11.5px] transition-colors ${r===t?`border-amber-500/50 bg-amber-500/15`:`border-amber-500/20 bg-amber-500/5 hover:border-amber-500/40`}`,children:[(0,m.jsx)(Wk,{status:e.status}),(0,m.jsx)(`span`,{className:`truncate text-amber-100`,children:jn(e.name)}),(0,m.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] uppercase tracking-wider text-amber-400/70`,children:e.status})]})},r)})})]})}function uA({id:e,onOpenRun:t}){let n=g(),{data:r}=Xe({queryKey:[`run`,e],queryFn:async()=>pr(n.getQueryData([`run`,e]),await lr.run(e)),refetchInterval:e=>{let t=e.state.data?.run.status;return t===`running`||t===`suspended`?1500:!1}}),{data:i=[]}=Xe({queryKey:[`workers`],queryFn:()=>lr.workers(),refetchInterval:5e3}),{data:a=[]}=Xe({queryKey:[`runs`,``,``],queryFn:()=>lr.runs(),refetchInterval:3e3}),{data:o}=Xe({queryKey:[`topology`],queryFn:()=>lr.topology(),staleTime:1/0}),s=o?.role===`tenant`,c=r?.run.status===`dead`?`dlq:${e}`:void 0,{data:l}=Xe({queryKey:[`run`,c],queryFn:()=>lr.run(c),enabled:!!c,retry:!1}),u=()=>{n.invalidateQueries({queryKey:[`run`,e]}),n.invalidateQueries({queryKey:[`runs`]})},d=r?.run.status,f=d===`running`||d===`suspended`;(0,p.useEffect)(()=>{if(f)return lr.streamRun(e,t=>{if(t.type===`step.progress`&&t.event&&t.seq!=null){let r=t.seq,i=t.event;n.setQueryData([`run`,e],e=>e&&{...e,timeline:e.timeline.map(e=>e.seq===r?{...e,events:[...e.events??[],i]}:e)})}else n.invalidateQueries({queryKey:[`run`,e]})})},[e,f,n]);let h=Ze({mutationFn:()=>lr.retry(e),onSuccess:u}),_=Ze({mutationFn:t=>lr.cancel(e,t===void 0?{}:{compensate:t}),onSuccess:u}),v=Ze({mutationFn:()=>lr.continue(e),onSuccess:u}),y=Ze({mutationFn:()=>lr.redispatch(e),onSuccess:u}),b=Ze({mutationFn:t=>lr.retryWithInput(e,t),onSuccess:e=>{n.invalidateQueries({queryKey:[`runs`]}),t(e.runId)}}),[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(),D=()=>{w(JSON.stringify(r?.run.input??{},null,2)),E(void 0),S(!0)},O=()=>{let e;try{e=JSON.parse(C)}catch(e){E(e instanceof Error?e.message:`Invalid JSON`);return}S(!1),b.mutate(e)},[k,A]=(0,p.useState)(),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(new Set),[F,I]=(0,p.useState)(240);function L(e){e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e=>I(t=>Math.max(120,Math.min(720,t-e.movementY))),n=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n)}function R(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}if(!r)return(0,m.jsx)(`div`,{className:`p-8 text-sm text-zinc-600`,children:`Loading run…`});let{run:z,timeline:B}=r,{body:V,compensations:H}=Mn(B),U=Nn(H),ee=z.id.startsWith(`dlq:`),te=ee?{id:z.id.slice(4),title:`Dead-letter handler`,subtitle:`started because run ${z.id.slice(4)} was dead-lettered`,cta:`open dead run →`}:l?{id:`dlq:${z.id}`,title:`Dead-lettered`,subtitle:`this run exceeded recovery and was routed to a DLQ handler`,cta:`open DLQ handler →`}:void 0,ne=H.length>0?(()=>{let e=U.failed>0?` ${U.failed} undo${U.failed===1?``:`s`} failed after retries — check ${U.failed===1?`it`:`them`} below.`:``;return U.pending>0?{title:`Compensating`,subtitle:`undoing completed steps in reverse (${U.done} of ${U.total} done).${e}`}:z.status===`cancelled`?{title:`Cancelled with compensation`,subtitle:`completed steps were undone before cancelling.${e}`}:{title:`Saga compensated`,subtitle:`the run failed and its ${U.total} completed step${U.total===1?``:`s`} were undone in reverse.${e}`}})():void 0,W=z.status===`failed`||z.status===`suspended`,re=z.status===`running`||z.status===`suspended`,G=z.status===`suspended`||z.status===`running`,K=V.some(e=>e.status===`pending`&&e.kind===`signal`&&e.name.startsWith(`breakpoint`)),ie=k?`${k.step.runId}#${k.step.seq}`:void 0,ae=Yn(z,{runs:a,health:i,timeline:V}),oe=z.namespace&&z.namespace!=="default"?z.namespace:void 0,se=bn(z.origin),ce=a.find(e=>e.id===z.id)?.waiting,le=z.status===`suspended`?Bn(V,ce):[];return(0,m.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-line px-7 py-5`,children:[(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:z.workflow}),qh(z.id)!==void 0&&(0,m.jsx)(Y,{variant:`alt`,size:`xs`,onClick:()=>t(qh(z.id)),className:`mono uppercase tracking-wider`,title:`Open the parent run (${qh(z.id)}) — the macro view this child belongs to`,children:`↑ parent`}),Kh(z.id)!==void 0&&(0,m.jsx)(Y,{variant:`chip`,size:`xs`,onClick:()=>t(Kh(z.id)),className:`mono uppercase tracking-wider text-zinc-300`,title:`This is a retry-with-input of ${Kh(z.id)} — open the original run`,children:`↩ original`}),ee&&(0,m.jsx)(fa,{variant:`danger`,className:`mono py-0.5 uppercase tracking-wider`,children:`dlq`}),(0,m.jsx)(Gk,{status:ae.status}),ae.detail&&(0,m.jsx)(`span`,{className:`mono text-[11px] s-${ae.status}`,children:ae.detail}),oe&&(0,m.jsx)(fa,{variant:`tenant`,className:`mono py-0.5`,title:`Tenant / worker-pool partition this run belongs to`,children:oe}),se?(0,m.jsx)(fa,{variant:`origin`,className:`mono py-0.5`,title:`Declared by ${se}`,children:Sn(se)}):(0,m.jsxs)(fa,{variant:`origin-unknown`,className:`mono py-0.5`,title:Dn,children:[`origin `,yn]}),H.length>0&&(0,m.jsx)(fa,{variant:`warn`,className:ua(`mono py-0.5 uppercase tracking-wider`,U.pending>0&&`pulse`),title:U.pending>0?`compensating: ${U.done} of ${U.total} undone`:`${U.total} step${U.total===1?``:`s`} compensated`,children:U.pending>0?`compensating`:`compensated`}),(0,m.jsxs)(fa,{className:`mono bg-transparent py-0.5 text-zinc-500`,children:[`v`,z.workflowVersion]}),(0,m.jsxs)(`span`,{className:`mono tnum text-[11px] text-zinc-600`,children:[V.length,` `,V.length===1?`step`:`steps`]})]}),(0,m.jsx)(`div`,{className:`mono mt-1 truncate text-[11px] text-zinc-600`,children:z.id}),z.tags&&z.tags.length>0&&(0,m.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:z.tags.map(e=>(0,m.jsxs)(fa,{className:`mono`,children:[`#`,e]},e))}),z.searchAttributes&&Object.keys(z.searchAttributes).length>0&&(0,m.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:Object.entries(z.searchAttributes).map(([e,t])=>(0,m.jsxs)(fa,{variant:`attr`,className:`mono`,title:`search attribute`,children:[e,`=`,String(t)]},e))}),r?.children?.length?(0,m.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1`,children:[(0,m.jsx)(`span`,{className:`text-[10px] text-zinc-600`,children:`children:`}),r.children?.map(e=>(0,m.jsx)(Y,{variant:`chip`,size:`xs`,onClick:()=>t(e),className:`mono px-1.5 py-0`,children:e},e))]}):null]}),(0,m.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,m.jsx)(Y,{onClick:()=>M(!0),className:`mono px-2.5 normal-case tracking-normal text-zinc-400`,title:`Run input / output`,children:`{ }`}),K&&(0,m.jsxs)(Y,{variant:`warn`,disabled:v.isPending||s,onClick:()=>v.mutate(),title:s?`Not available on a tenant deployment — resuming a breakpoint needs the control plane.`:void 0,children:[(0,m.jsx)(Er,{width:12,height:12}),`Continue`]}),(0,m.jsxs)(Y,{variant:`brand`,disabled:!W||h.isPending,onClick:()=>h.mutate(),children:[(0,m.jsx)(wr,{width:12,height:12}),`Retry`]}),G&&(0,m.jsxs)(Y,{variant:`info`,disabled:y.isPending,onClick:()=>y.mutate(),title:"Re-dispatch stuck `pending` remote steps — recovery for a lost step dispatch (crashed worker or dropped job)",children:[(0,m.jsx)(Tr,{width:12,height:12}),`Re-dispatch`]}),(z.status===`dead`||z.status===`failed`)&&(0,m.jsxs)(Y,{variant:`alt`,disabled:b.isPending||s,onClick:D,title:s?`Not available on a tenant deployment — fix & replay needs the control plane.`:`Edit the input and re-run as a fresh linked run`,children:[(0,m.jsx)(wr,{width:12,height:12}),`Fix & replay`]}),re&&(0,m.jsxs)(Y,{variant:`warn`,disabled:_.isPending,onClick:()=>_.mutate(!0),title:`Cancel and run saga compensations (undo completed steps in reverse)`,className:`bg-transparent`,children:[(0,m.jsx)(wr,{width:12,height:12}),`Cancel + Undo`]}),(0,m.jsxs)(Y,{className:`border-zinc-700`,disabled:!re||_.isPending,onClick:()=>_.mutate(!1),children:[(0,m.jsx)(Sr,{width:12,height:12}),`Cancel`]})]})]}),te&&(0,m.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-rose-500/30 bg-rose-500/10 px-7 py-3`,children:[(0,m.jsx)(`span`,{className:`grid h-7 w-7 shrink-0 place-items-center rounded-md border border-rose-500/40 bg-rose-500/15 text-sm text-rose-300`,"aria-hidden":!0,children:`⚠`}),(0,m.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,m.jsx)(`div`,{className:`text-[13px] font-medium text-rose-200`,children:te.title}),(0,m.jsx)(`div`,{className:`mono truncate text-[11px] text-rose-300/70`,children:te.subtitle})]}),(0,m.jsx)(Y,{variant:`danger`,onClick:()=>t(te.id),className:`mono shrink-0 border-rose-500/40 bg-rose-500/15 px-2.5 text-[11px] normal-case tracking-normal text-rose-200 enabled:hover:bg-rose-500/25`,children:te.cta})]}),le.length>0&&(0,m.jsx)(c_,{runId:z.id,targets:le,tenantPod:s,onDelivered:u}),ne&&(0,m.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-amber-500/30 bg-amber-500/10 px-7 py-3`,children:[(0,m.jsx)(`span`,{className:`grid h-7 w-7 shrink-0 place-items-center rounded-md border border-amber-500/40 bg-amber-500/15 text-sm text-amber-300`,"aria-hidden":!0,children:`↺`}),(0,m.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,m.jsx)(`div`,{className:`text-[13px] font-medium text-amber-200`,children:ne.title}),(0,m.jsx)(`div`,{className:`mono truncate text-[11px] text-amber-300/70`,children:ne.subtitle})]})]}),(0,m.jsxs)(`div`,{className:`relative grid min-h-0 flex-1`,style:{gridTemplateRows:V.length>0?`1fr ${F}px`:`1fr`},children:[(0,m.jsxs)(`div`,{className:`relative min-h-0`,children:[V.length===0?(0,m.jsx)(`div`,{className:`grid h-full place-items-center text-sm text-zinc-600`,children:`No steps recorded yet.`}):(0,m.jsx)(Rk,{run:z,timeline:V,endStatus:ae.status,selectedKey:ie,onSelect:(e,t)=>A({step:e,run:t}),onOpenRun:t,fmtDuration:Uk,expanded:N,onToggleChild:R}),(z.status===`failed`||z.status===`cancelled`)&&z.error&&(0,m.jsx)(`div`,{className:`mono absolute inset-x-6 bottom-6 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-300 backdrop-blur`,children:z.error.message})]}),V.length>0&&(0,m.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden border-t border-line bg-black/20`,children:[(0,m.jsx)(`div`,{onPointerDown:L,className:`absolute inset-x-0 top-0 z-10 h-1.5 -translate-y-1/2 cursor-row-resize hover:bg-brand/40`,title:`Drag to resize`}),(0,m.jsx)(kh,{run:z,timeline:V,selectedKey:ie,onSelect:(e,t)=>A({step:e,run:t}),onOpenRun:t,expanded:N,onToggleChild:R})]}),k&&(0,m.jsx)(Wh,{step:k.step,run:k.run,onClose:()=>A(void 0),onOpenRun:t}),j&&(0,m.jsx)(Gh,{run:z,onClose:()=>M(!1)})]}),H.length>0&&(0,m.jsx)(lA,{compensations:H,selKey:ie,onSelect:e=>A({step:e,run:z})}),(0,m.jsxs)(Sg,{open:x,onOpenChange:S,title:`Fix & replay`,subtitle:`re-runs ${z.id} as a fresh linked run`,footer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Y,{onClick:()=>S(!1),children:`Cancel`}),(0,m.jsx)(Y,{variant:`alt`,disabled:b.isPending,onClick:O,children:`Replay`})]}),children:[(0,m.jsx)(`label`,{className:`mono mb-1.5 block text-[10px] uppercase tracking-[0.18em] text-zinc-500`,htmlFor:`fix-replay-input`,children:`input`}),(0,m.jsx)(`textarea`,{id:`fix-replay-input`,value:C,spellCheck:!1,onChange:e=>{w(e.target.value),E(void 0)},className:`mono h-64 w-full resize-y rounded-lg border border-line bg-black/40 p-3 text-[11.5px] leading-relaxed text-zinc-300 focus:border-zinc-600 focus:outline-none`}),T&&(0,m.jsx)(`p`,{className:`mono mt-2 rounded border border-bad/25 bg-bad/10 px-2 py-1 text-[11px] text-bad`,children:T})]})]})}function dA(){if(typeof window>`u`)return;let e=window.location.hash.match(/^#\/run\/(.+)$/)?.[1];return e?decodeURIComponent(e):void 0}function fA(){let[e,t]=(0,p.useState)(`all`),[n,r]=(0,p.useState)([]),[i,a]=(0,p.useState)([]),[o,s]=(0,p.useState)([]),[c,l]=(0,p.useState)([]),[u,d]=(0,p.useState)(vn),[f,h]=(0,p.useState)(()=>dA()),[_,v]=(0,p.useState)(`runs`),y=(0,p.useCallback)(e=>{if(h(e),typeof window>`u`)return;let t=e?`#/run/${encodeURIComponent(e)}`:``,n=t||window.location.pathname+window.location.search;window.location.hash!==t&&window.history.pushState(null,``,n)},[]),b=(0,p.useCallback)(e=>{v(`runs`),y(e)},[y]);(0,p.useEffect)(()=>{let e=()=>h(dA());return window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[]);let x=g(),S=o,{data:C,isPending:w,fetchNextPage:T,hasNextPage:E,isFetchingNextPage:D}=Qe({queryKey:[`runs`,e,n,i,S.join(`|`),c],queryFn:({pageParam:t})=>lr.runsPage(e===`all`?void 0:e,i.length?i:void 0,S.length?S:void 0,{namespace:c.length?c:void 0,workflow:n.length?n:void 0},{page:t,size:Vk}),initialPageParam:1,getNextPageParam:e=>{let{page:t,size:n,count:r}=e.meta;return r===n?t+1:void 0},refetchInterval:3e3}),O=(0,p.useMemo)(()=>C?.pages.flatMap(e=>e.runs)??[],[C]),{data:k=[]}=Xe({queryKey:[`workers`],queryFn:()=>lr.workers(),refetchInterval:5e3}),[A,j]=(0,p.useState)(void 0),[M,N]=(0,p.useState)(void 0),P=Ze({mutationFn:t=>lr.bulk(t,{status:e===`all`?void 0:e,workflow:n.length?n:void 0,tag:i.length?i:void 0,attr:S.length?S:void 0,namespace:c.length?c:void 0,origin:u.kind===`origin`?u.origin:void 0}),onSuccess:(e,t)=>{N({action:t,...e}),x.invalidateQueries({queryKey:[`runs`]})}});(0,p.useEffect)(()=>{if(!M||M.matched>=500)return;let e=setTimeout(()=>N(void 0),6e3);return()=>clearTimeout(e)},[M]);let F=En(O,u),I=kn(O),L=e!==`all`||n.length>0||i.length>0||c.length>0||S.length>0||u.kind!==`all`,R=e===`all`?void 0:e,z=(0,p.useMemo)(()=>({status:R,tag:i,namespace:c,attr:o}),[R,i,c,o]),B=(0,p.useMemo)(()=>({status:R,workflow:n,namespace:c,attr:o}),[R,n,c,o]),V=(0,p.useMemo)(()=>({status:R,workflow:n,tag:i,attr:o}),[R,n,i,o]),H=(0,p.useMemo)(()=>({status:R,workflow:n,tag:i,namespace:c}),[R,n,i,c]),U=(0,p.useMemo)(()=>({workflow:n,tag:i,namespace:c,attr:o}),[n,i,c,o]),ee=(0,p.useCallback)(e=>{a(t=>t.includes(e)?t:[...t,e])},[]),te=(0,p.useCallback)(e=>{l(t=>t.includes(e)?t:[...t,e])},[]),ne=u.kind===`unknown`?`Bulk actions cannot be scoped to unclassified runs — runs with no origin have no server-side filter. Retry or cancel them from their own run view.`:void 0,W=[...new Set(O.filter(e=>Yn(e,{runs:O,health:k}).status===`no-worker`).map(e=>e.workflow))],re=`${e}|${n.join(`|`)}|${i.join(`|`)}|${S.join(`,`)}|${c.join(`|`)}|${wn(u)}`,G=[e===`all`?void 0:`status ${e}`,n.length>0?`workflow ${n.join(`, `)}`:void 0,i.length>0?`tag ${i.join(`, `)}`:void 0,c.length>0?`tenant ${c.join(`, `)}`:void 0,S.length>0?`attr ${S.join(` · `)}`:void 0,u.kind===`origin`?`origin ${Sn(u.origin)}`:void 0].filter(e=>e!==void 0).join(` · `)||`no filter — every run`;return(0,m.jsxs)(eh,{children:[(0,m.jsx)(`div`,{className:`app-bg`}),(0,m.jsxs)(`div`,{className:`relative z-10 flex h-full flex-col`,children:[(0,m.jsx)(Jk,{scope:U,filter:e,onFilter:t,onOpenRun:b,view:_,onView:v}),W.length>0&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-amber-500/30 bg-amber-500/10 px-4 py-1.5 text-[11px] text-amber-200`,children:[(0,m.jsx)(`span`,{className:`s-no-worker inline-flex items-center gap-1.5`,children:(0,m.jsx)(`span`,{className:`dot s-no-worker`,"aria-hidden":!0})}),(0,m.jsxs)(`span`,{children:[`Runs waiting on handlers with no live worker:`,` `,(0,m.jsx)(`span`,{className:`mono text-amber-100`,children:W.join(`, `)}),`. Start a worker to unblock.`]})]}),_===`schedules`?(0,m.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,m.jsx)($h,{onOpenRun:b})}):(0,m.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(300px,360px)_1fr]`,children:[(0,m.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-r border-line`,children:[(0,m.jsxs)(`div`,{className:`border-b border-line p-2`,children:[(0,m.jsx)(Dm,{field:`workflow`,scope:z,glyph:`ƒ`,label:`filter by workflow`,placeholder:`filter by workflow…`,value:n,onChange:r,title:`Workflow handler names (WorkflowRun.workflow). Several match ANY of them.`}),(0,m.jsx)(`div`,{className:`mt-1.5`,children:(0,m.jsx)(Dm,{field:`tag`,scope:B,glyph:`#`,label:`filter by tag`,placeholder:`filter by tag…`,value:i,onChange:a,title:`Tags carried by a run (WorkflowRun.tags). Several match ANY of them.`})}),(0,m.jsx)(`div`,{className:`mt-1.5`,children:(0,m.jsx)(Dm,{field:`namespace`,scope:V,glyph:`@`,label:`filter by tenant`,placeholder:`filter by tenant / namespace…`,value:c,onChange:l,title:`Tenant / worker-pool partition (WorkflowRun.namespace). None selected shows every tenant.`})}),(0,m.jsx)(jm,{value:o,onChange:s,scope:H})]}),(0,m.jsx)(uh,{runs:O,value:u,onChange:d}),L&&F.length>0&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-1.5`,children:[(0,m.jsxs)(`span`,{className:`mono text-[10px] text-zinc-500`,children:[F.length,` `,e===`all`?``:e,` `,n.length>0&&`ƒ${n.join(`, `)}`,i.length>0&&` #${i.join(`, `)}`,c.length>0&&` @${c.join(`, `)}`,u.kind===`origin`&&` ⬡${Sn(u.origin)}`,u.kind===`unknown`&&` ⬡unknown`,S.length>0&&` ⛃${S.length}`]}),(0,m.jsx)(Y,{variant:`brand`,size:`xs`,disabled:P.isPending||ne!==void 0,title:ne,onClick:()=>j(`retry`),className:`mono ml-auto rounded`,children:`retry all`}),(0,m.jsx)(Y,{variant:`danger`,size:`xs`,disabled:P.isPending||ne!==void 0,title:ne,onClick:()=>j(`cancel`),className:`mono rounded`,children:`cancel all`})]}),(0,m.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,m.jsx)(cA,{runs:F,allRuns:O,health:k,loading:w,selected:f,onSelect:y,onSelectTag:ee,onSelectNamespace:te,onSelectOrigin:d,hasMore:E,loadingMore:D,onLoadMore:T,emptyNotice:An({anyFilter:L,origin:u,unknownCount:I})},re)})]}),(0,m.jsx)(`main`,{className:`min-h-0`,children:f?(0,m.jsx)(uA,{id:f,onOpenRun:b},f):(0,m.jsx)(`div`,{className:`grid h-full place-items-center text-center`,children:(0,m.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,m.jsx)(zk,{className:`h-10 w-10 text-zinc-800`}),(0,m.jsx)(`p`,{className:`mt-3 text-sm text-zinc-600`,children:`Select a run to see its timeline.`})]})})})]})]}),(0,m.jsx)(Sg,{open:A!==void 0,onOpenChange:e=>{e||j(void 0)},title:A===`cancel`?`Cancel all matching runs`:`Retry all matching runs`,subtitle:G,footer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Y,{onClick:()=>j(void 0),children:`Back`}),(0,m.jsx)(Y,{variant:A===`cancel`?`danger`:`brand`,disabled:P.isPending,onClick:()=>{A&&P.mutate(A),j(void 0)},children:A===`cancel`?`cancel all`:`retry all`})]}),children:(0,m.jsxs)(`p`,{className:`text-[12.5px] leading-relaxed text-zinc-400`,children:[`This `,A===`cancel`?`cancels`:`retries`,` `,(0,m.jsx)(`em`,{children:`every`}),` run matching the filter above on the server — including matches beyond the rows loaded on screen. The server acts on at most `,(0,m.jsx)(`span`,{className:`mono tnum text-zinc-300`,children:500}),` `,`matches per call.`]})}),M&&(0,m.jsxs)(`output`,{className:`rise fixed bottom-4 right-4 z-50 flex max-w-sm items-start gap-3 rounded-lg border border-line bg-panel-2 px-4 py-3 text-left shadow-2xl`,children:[(0,m.jsxs)(`div`,{className:`min-w-0 flex-1 text-[12px]`,children:[(0,m.jsxs)(`div`,{className:`text-zinc-200`,children:[`Bulk `,M.action,`: `,(0,m.jsx)(`span`,{className:`mono tnum`,children:M.applied}),` of`,` `,(0,m.jsx)(`span`,{className:`mono tnum`,children:M.matched}),` matched`,` `,M.matched===1?`run`:`runs`,` `,M.action===`cancel`?`cancelled`:`retried`,`.`]}),M.matched>=500&&(0,m.jsxs)(`div`,{className:`mt-1 text-[11px] text-amber-300`,children:[`Matched the `,500,`-run server cap — only the first `,500,` were affected. Run the action again to continue.`]})]}),(0,m.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`dismiss`,onClick:()=>N(void 0),className:`h-5 w-5`,children:(0,m.jsx)(Sr,{width:12,height:12})})]})]})}var pA=new Ie({defaultOptions:{queries:{refetchInterval:2e3,refetchOnWindowFocus:!1}}});(0,ot.createRoot)(document.getElementById(`root`)).render((0,m.jsx)(p.StrictMode,{children:(0,m.jsx)(_,{client:pA,children:(0,m.jsx)(fA,{})})}));
|
|
16
|
-
//# sourceMappingURL=index-
|
|
16
|
+
//# sourceMappingURL=index-CL6q2kMB.js.map
|