var Me=e=>{throw TypeError(e)};var ae=(e,t,s)=>t.has(e)||Me("Cannot "+s);var i=(e,t,s)=>(ae(e,t,"read from private field"),s?s.call(e):t.get(e)),d=(e,t,s)=>t.has(e)?Me("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),c=(e,t,s,r)=>(ae(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),E=(e,t,s)=>(ae(e,t,"access private method"),s);var re=(e,t,s,r)=>({set _(a){c(e,t,a,s)},get _(){return i(e,t,r)}});function vs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ue={exports:{}},Gt={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Fe;function ms(){if(Fe)return Gt;Fe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,a,o){var l=null;if(o!==void 0&&(l=""+o),a.key!==void 0&&(l=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:o}}return Gt.Fragment=t,Gt.jsx=s,Gt.jsxs=s,Gt}var Ae;function gs(){return Ae||(Ae=1,ue.exports=ms()),ue.exports}var bs=gs(),oe={exports:{}},p={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ie;function Es(){if(Ie)return p;Ie=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),M=Symbol.iterator;function g(n){return n===null||typeof n!="object"?null:(n=M&&n[M]||n["@@iterator"],typeof n=="function"?n:null)}var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,C={};function O(n,u,v){this.props=n,this.context=u,this.refs=C,this.updater=v||Q}O.prototype.isReactComponent={},O.prototype.setState=function(n,u){if(typeof n!="object"&&typeof n!="function"&&n!=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,n,u,"setState")},O.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function q(){}q.prototype=O.prototype;function A(n,u,v){this.props=n,this.context=u,this.refs=C,this.updater=v||Q}var f=A.prototype=new q;f.constructor=A,R(f,O.prototype),f.isPureReactComponent=!0;var k=Array.isArray;function H(){}var P={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function D(n,u,v){var y=v.ref;return{$$typeof:e,type:n,key:u,ref:y!==void 0?y:null,props:v}}function N(n,u){return D(n.type,u,n.props)}function Z(n){return typeof n=="object"&&n!==null&&n.$$typeof===e}function Mt(n){var u={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(v){return u[v]})}var $t=/\/+/g;function ot(n,u){return typeof n=="object"&&n!==null&&n.key!=null?Mt(""+n.key):u.toString(36)}function Ft(n){switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:switch(typeof n.status=="string"?n.then(H,H):(n.status="pending",n.then(function(u){n.status==="pending"&&(n.status="fulfilled",n.value=u)},function(u){n.status==="pending"&&(n.status="rejected",n.reason=u)})),n.status){case"fulfilled":return n.value;case"rejected":throw n.reason}}throw n}function At(n,u,v,y,_){var x=typeof n;(x==="undefined"||x==="boolean")&&(n=null);var j=!1;if(n===null)j=!0;else switch(x){case"bigint":case"string":case"number":j=!0;break;case"object":switch(n.$$typeof){case e:case t:j=!0;break;case T:return j=n._init,At(j(n._payload),u,v,y,_)}}if(j)return _=_(n),j=y===""?"."+ot(n,0):y,k(_)?(v="",j!=null&&(v=j.replace($t,"$&/")+"/"),At(_,u,v,"",function(ys){return ys})):_!=null&&(Z(_)&&(_=N(_,v+(_.key==null||n&&n.key===_.key?"":(""+_.key).replace($t,"$&/")+"/")+j)),u.push(_)),1;j=0;var et=y===""?".":y+":";if(k(n))for(var Y=0;Y<n.length;Y++)y=n[Y],x=et+ot(y,Y),j+=At(y,u,v,x,_);else if(Y=g(n),typeof Y=="function")for(n=Y.call(n),Y=0;!(y=n.next()).done;)y=y.value,x=et+ot(y,Y++),j+=At(y,u,v,x,_);else if(x==="object"){if(typeof n.then=="function")return At(Ft(n),u,v,y,_);throw u=String(n),Error("Objects are not valid as a React child (found: "+(u==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":u)+"). If you meant to render a collection of children, use an array instead.")}return j}function se(n,u,v){if(n==null)return n;var y=[],_=0;return At(n,y,"","",function(x){return u.call(v,x,_++)}),y}function ds(n){if(n._status===-1){var u=n._result;u=u(),u.then(function(v){(n._status===0||n._status===-1)&&(n._status=1,n._result=v)},function(v){(n._status===0||n._status===-1)&&(n._status=2,n._result=v)}),n._status===-1&&(n._status=0,n._result=u)}if(n._status===1)return n._result.default;throw n._result}var _e=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},ps={map:se,forEach:function(n,u,v){se(n,function(){u.apply(this,arguments)},v)},count:function(n){var u=0;return se(n,function(){u++}),u},toArray:function(n){return se(n,function(u){return u})||[]},only:function(n){if(!Z(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};return p.Activity=m,p.Children=ps,p.Component=O,p.Fragment=s,p.Profiler=a,p.PureComponent=A,p.StrictMode=r,p.Suspense=b,p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,p.__COMPILER_RUNTIME={__proto__:null,c:function(n){return P.H.useMemoCache(n)}},p.cache=function(n){return function(){return n.apply(null,arguments)}},p.cacheSignal=function(){return null},p.cloneElement=function(n,u,v){if(n==null)throw Error("The argument must be a React element, but you passed "+n+".");var y=R({},n.props),_=n.key;if(u!=null)for(x in u.key!==void 0&&(_=""+u.key),u)!I.call(u,x)||x==="key"||x==="__self"||x==="__source"||x==="ref"&&u.ref===void 0||(y[x]=u[x]);var x=arguments.length-2;if(x===1)y.children=v;else if(1<x){for(var j=Array(x),et=0;et<x;et++)j[et]=arguments[et+2];y.children=j}return D(n.type,_,y)},p.createContext=function(n){return n={$$typeof:l,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider=n,n.Consumer={$$typeof:o,_context:n},n},p.createElement=function(n,u,v){var y,_={},x=null;if(u!=null)for(y in u.key!==void 0&&(x=""+u.key),u)I.call(u,y)&&y!=="key"&&y!=="__self"&&y!=="__source"&&(_[y]=u[y]);var j=arguments.length-2;if(j===1)_.children=v;else if(1<j){for(var et=Array(j),Y=0;Y<j;Y++)et[Y]=arguments[Y+2];_.children=et}if(n&&n.defaultProps)for(y in j=n.defaultProps,j)_[y]===void 0&&(_[y]=j[y]);return D(n,x,_)},p.createRef=function(){return{current:null}},p.forwardRef=function(n){return{$$typeof:h,render:n}},p.isValidElement=Z,p.lazy=function(n){return{$$typeof:T,_payload:{_status:-1,_result:n},_init:ds}},p.memo=function(n,u){return{$$typeof:w,type:n,compare:u===void 0?null:u}},p.startTransition=function(n){var u=P.T,v={};P.T=v;try{var y=n(),_=P.S;_!==null&&_(v,y),typeof y=="object"&&y!==null&&typeof y.then=="function"&&y.then(H,_e)}catch(x){_e(x)}finally{u!==null&&v.types!==null&&(u.types=v.types),P.T=u}},p.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},p.use=function(n){return P.H.use(n)},p.useActionState=function(n,u,v){return P.H.useActionState(n,u,v)},p.useCallback=function(n,u){return P.H.useCallback(n,u)},p.useContext=function(n){return P.H.useContext(n)},p.useDebugValue=function(){},p.useDeferredValue=function(n,u){return P.H.useDeferredValue(n,u)},p.useEffect=function(n,u){return P.H.useEffect(n,u)},p.useEffectEvent=function(n){return P.H.useEffectEvent(n)},p.useId=function(){return P.H.useId()},p.useImperativeHandle=function(n,u,v){return P.H.useImperativeHandle(n,u,v)},p.useInsertionEffect=function(n,u){return P.H.useInsertionEffect(n,u)},p.useLayoutEffect=function(n,u){return P.H.useLayoutEffect(n,u)},p.useMemo=function(n,u){return P.H.useMemo(n,u)},p.useOptimistic=function(n,u){return P.H.useOptimistic(n,u)},p.useReducer=function(n,u,v){return P.H.useReducer(n,u,v)},p.useRef=function(n){return P.H.useRef(n)},p.useState=function(n){return P.H.useState(n)},p.useSyncExternalStore=function(n,u,v){return P.H.useSyncExternalStore(n,u,v)},p.useTransition=function(){return P.H.useTransition()},p.version="19.2.5",p}var xe;function Rs(){return xe||(xe=1,oe.exports=Es()),oe.exports}var W=Rs();const nr=vs(W);var ee=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(){}},Et,ht,It,Ge,Cs=(Ge=class extends ee{constructor(){super();d(this,Et);d(this,ht);d(this,It);c(this,It,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,ht)||this.setEventListener(i(this,It))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,ht))==null||t.call(this),c(this,ht,void 0))}setEventListener(t){var s;c(this,It,t),(s=i(this,ht))==null||s.call(this),c(this,ht,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,Et)!==t&&(c(this,Et,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof i(this,Et)=="boolean"?i(this,Et):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Et=new WeakMap,ht=new WeakMap,It=new WeakMap,Ge),we=new Cs,Ss={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},lt,Se,Ye,ws=(Ye=class{constructor(){d(this,lt,Ss);d(this,Se,!1)}setTimeoutProvider(e){c(this,lt,e)}setTimeout(e,t){return i(this,lt).setTimeout(e,t)}clearTimeout(e){i(this,lt).clearTimeout(e)}setInterval(e,t){return i(this,lt).setInterval(e,t)}clearInterval(e){i(this,lt).clearInterval(e)}},lt=new WeakMap,Se=new WeakMap,Ye),bt=new ws;function Ps(e){setTimeout(e,0)}var Os=typeof window>"u"||"Deno"in globalThis;function z(){}function Ts(e,t){return typeof e=="function"?e(t):e}function ce(e){return typeof e=="number"&&e>=0&&e!==1/0}function es(e,t){return Math.max(e+(t||0)-Date.now(),0)}function gt(e,t){return typeof e=="function"?e(t):e}function X(e,t){return typeof e=="function"?e(t):e}function Qe(e,t){const{type:s="all",exact:r,fetchStatus:a,predicate:o,queryKey:l,stale:h}=e;if(l){if(r){if(t.queryHash!==Pe(l,t.options))return!1}else if(!zt(t.queryKey,l))return!1}if(s!=="all"){const b=t.isActive();if(s==="active"&&!b||s==="inactive"&&b)return!1}return!(typeof h=="boolean"&&t.isStale()!==h||a&&a!==t.state.fetchStatus||o&&!o(t))}function je(e,t){const{exact:s,status:r,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(s){if(Bt(t.options.mutationKey)!==Bt(o))return!1}else if(!zt(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Pe(e,t){return((t==null?void 0:t.queryKeyHashFn)||Bt)(e)}function Bt(e){return JSON.stringify(e,(t,s)=>le(s)?Object.keys(s).sort().reduce((r,a)=>(r[a]=s[a],r),{}):s)}function zt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>zt(e[s],t[s])):!1}var _s=Object.prototype.hasOwnProperty;function ss(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=De(e)&&De(t);if(!r&&!(le(e)&&le(t)))return t;const o=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),h=l.length,b=r?new Array(h):{};let w=0;for(let T=0;T<h;T++){const m=r?T:l[T],M=e[m],g=t[m];if(M===g){b[m]=M,(r?T<o:_s.call(e,m))&&w++;continue}if(M===null||g===null||typeof M!="object"||typeof g!="object"){b[m]=g;continue}const Q=ss(M,g,s+1);b[m]=Q,Q===M&&w++}return o===h&&w===o?e:b}function he(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function De(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function le(e){if(!Ue(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Ue(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ue(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ms(e){return new Promise(t=>{bt.setTimeout(t,e)})}function fe(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?ss(e,t):t}function Fs(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function As(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Oe=Symbol();function rs(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Oe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function is(e,t){return typeof e=="function"?e(...t):!!e}function Is(e,t,s){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?s():a.addEventListener("abort",s,{once:!0})),a)}),e}var Jt=(()=>{let e=()=>Os;return{isServer(){return e()},setIsServer(t){e=t}}})();function de(){let e,t;const s=new Promise((a,o)=>{e=a,t=o});s.status="pending",s.catch(()=>{});function r(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},s.reject=a=>{r({status:"rejected",reason:a}),t(a)},s}var xs=Ps;function Qs(){let e=[],t=0,s=h=>{h()},r=h=>{h()},a=xs;const o=h=>{t?e.push(h):a(()=>{s(h)})},l=()=>{const h=e;e=[],h.length&&a(()=>{r(()=>{h.forEach(b=>{s(b)})})})};return{batch:h=>{let b;t++;try{b=h()}finally{t--,t||l()}return b},batchCalls:h=>(...b)=>{o(()=>{h(...b)})},schedule:o,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{r=h},setScheduler:h=>{a=h}}}var K=Qs(),xt,ft,Qt,Be,js=(Be=class extends ee{constructor(){super();d(this,xt,!0);d(this,ft);d(this,Qt);c(this,Qt,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,ft)||this.setEventListener(i(this,Qt))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,ft))==null||t.call(this),c(this,ft,void 0))}setEventListener(t){var s;c(this,Qt,t),(s=i(this,ft))==null||s.call(this),c(this,ft,t(this.setOnline.bind(this)))}setOnline(t){i(this,xt)!==t&&(c(this,xt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,xt)}},xt=new WeakMap,ft=new WeakMap,Qt=new WeakMap,Be),ne=new js;function Ds(e){return Math.min(1e3*2**e,3e4)}function ns(e){return(e??"online")==="online"?ne.isOnline():!0}var pe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function as(e){let t=!1,s=0,r;const a=de(),o=()=>a.status!=="pending",l=R=>{var C;if(!o()){const O=new pe(R);M(O),(C=e.onCancel)==null||C.call(e,O)}},h=()=>{t=!0},b=()=>{t=!1},w=()=>we.isFocused()&&(e.networkMode==="always"||ne.isOnline())&&e.canRun(),T=()=>ns(e.networkMode)&&e.canRun(),m=R=>{o()||(r==null||r(),a.resolve(R))},M=R=>{o()||(r==null||r(),a.reject(R))},g=()=>new Promise(R=>{var C;r=O=>{(o()||w())&&R(O)},(C=e.onPause)==null||C.call(e)}).then(()=>{var R;r=void 0,o()||(R=e.onContinue)==null||R.call(e)}),Q=()=>{if(o())return;let R;const C=s===0?e.initialPromise:void 0;try{R=C??e.fn()}catch(O){R=Promise.reject(O)}Promise.resolve(R).then(m).catch(O=>{var H;if(o())return;const q=e.retry??(Jt.isServer()?0:3),A=e.retryDelay??Ds,f=typeof A=="function"?A(s,O):A,k=q===!0||typeof q=="number"&&s<q||typeof q=="function"&&q(s,O);if(t||!k){M(O);return}s++,(H=e.onFail)==null||H.call(e,s,O),Ms(f).then(()=>w()?void 0:g()).then(()=>{t?M(O):Q()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:h,continueRetry:b,canStart:T,start:()=>(T()?Q():g().then(Q),a)}}var Rt,ze,us=(ze=class{constructor(){d(this,Rt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ce(this.gcTime)&&c(this,Rt,bt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jt.isServer()?1/0:300*1e3))}clearGcTimeout(){i(this,Rt)!==void 0&&(bt.clearTimeout(i(this,Rt)),c(this,Rt,void 0))}},Rt=new WeakMap,ze),Ct,jt,V,St,L,Wt,wt,J,os,nt,Je,Us=(Je=class extends us{constructor(t){super();d(this,J);d(this,Ct);d(this,jt);d(this,V);d(this,St);d(this,L);d(this,Wt);d(this,wt);c(this,wt,!1),c(this,Wt,t.defaultOptions),this.setOptions(t.options),this.observers=[],c(this,St,t.client),c(this,V,i(this,St).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,c(this,Ct,ke(this.options)),this.state=t.state??i(this,Ct),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=i(this,L))==null?void 0:t.promise}setOptions(t){if(this.options={...i(this,Wt),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=ke(this.options);s.data!==void 0&&(this.setState(qe(s.data,s.dataUpdatedAt)),c(this,Ct,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,V).remove(this)}setData(t,s){const r=fe(this.state.data,t,this.options);return E(this,J,nt).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t,s){E(this,J,nt).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,a;const s=(r=i(this,L))==null?void 0:r.promise;return(a=i(this,L))==null||a.cancel(t),s?s.then(z).catch(z):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return i(this,Ct)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>X(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>gt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!es(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,L))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,L))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,V).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(i(this,L)&&(i(this,wt)||E(this,J,os).call(this)?i(this,L).cancel({revert:!0}):i(this,L).cancelRetry()),this.scheduleGc()),i(this,V).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||E(this,J,nt).call(this,{type:"invalidate"})}async fetch(t,s){var b,w,T,m,M,g,Q,R,C,O,q,A;if(this.state.fetchStatus!=="idle"&&((b=i(this,L))==null?void 0:b.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,L))return i(this,L).continueRetry(),i(this,L).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(k=>k.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,a=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(c(this,wt,!0),r.signal)})},o=()=>{const f=rs(this.options,s),H=(()=>{const P={client:i(this,St),queryKey:this.queryKey,meta:this.meta};return a(P),P})();return c(this,wt,!1),this.options.persister?this.options.persister(f,H,this):f(H)},h=(()=>{const f={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:i(this,St),state:this.state,fetchFn:o};return a(f),f})();(w=this.options.behavior)==null||w.onFetch(h,this),c(this,jt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((T=h.fetchOptions)==null?void 0:T.meta))&&E(this,J,nt).call(this,{type:"fetch",meta:(m=h.fetchOptions)==null?void 0:m.meta}),c(this,L,as({initialPromise:s==null?void 0:s.initialPromise,fn:h.fetchFn,onCancel:f=>{f instanceof pe&&f.revert&&this.setState({...i(this,jt),fetchStatus:"idle"}),r.abort()},onFail:(f,k)=>{E(this,J,nt).call(this,{type:"failed",failureCount:f,error:k})},onPause:()=>{E(this,J,nt).call(this,{type:"pause"})},onContinue:()=>{E(this,J,nt).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const f=await i(this,L).start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),(g=(M=i(this,V).config).onSuccess)==null||g.call(M,f,this),(R=(Q=i(this,V).config).onSettled)==null||R.call(Q,f,this.state.error,this),f}catch(f){if(f instanceof pe){if(f.silent)return i(this,L).promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw E(this,J,nt).call(this,{type:"error",error:f}),(O=(C=i(this,V).config).onError)==null||O.call(C,f,this),(A=(q=i(this,V).config).onSettled)==null||A.call(q,this.state.data,f,this),f}finally{this.scheduleGc()}}},Ct=new WeakMap,jt=new WeakMap,V=new WeakMap,St=new WeakMap,L=new WeakMap,Wt=new WeakMap,wt=new WeakMap,J=new WeakSet,os=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},nt=function(t){const s=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...cs(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...qe(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return c(this,jt,t.manual?a:void 0),a;case"error":const o=t.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),K.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,V).notify({query:this,type:"updated",action:t})})},Je);function cs(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ns(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ke(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var B,S,Zt,G,Pt,Dt,at,dt,Vt,Ut,qt,Ot,Tt,pt,kt,F,Yt,ye,ve,me,ge,be,Ee,Re,hs,We,qs=(We=class extends ee{constructor(t,s){super();d(this,F);d(this,B);d(this,S);d(this,Zt);d(this,G);d(this,Pt);d(this,Dt);d(this,at);d(this,dt);d(this,Vt);d(this,Ut);d(this,qt);d(this,Ot);d(this,Tt);d(this,pt);d(this,kt,new Set);this.options=s,c(this,B,t),c(this,dt,null),c(this,at,de()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,S).addObserver(this),He(i(this,S),this.options)?E(this,F,Yt).call(this):this.updateResult(),E(this,F,ge).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ce(i(this,S),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ce(i(this,S),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,E(this,F,be).call(this),E(this,F,Ee).call(this),i(this,S).removeObserver(this)}setOptions(t){const s=this.options,r=i(this,S);if(this.options=i(this,B).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof X(this.options.enabled,i(this,S))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");E(this,F,Re).call(this),i(this,S).setOptions(this.options),s._defaulted&&!he(this.options,s)&&i(this,B).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,S),observer:this});const a=this.hasListeners();a&&Le(i(this,S),r,this.options,s)&&E(this,F,Yt).call(this),this.updateResult(),a&&(i(this,S)!==r||X(this.options.enabled,i(this,S))!==X(s.enabled,i(this,S))||gt(this.options.staleTime,i(this,S))!==gt(s.staleTime,i(this,S)))&&E(this,F,ye).call(this);const o=E(this,F,ve).call(this);a&&(i(this,S)!==r||X(this.options.enabled,i(this,S))!==X(s.enabled,i(this,S))||o!==i(this,pt))&&E(this,F,me).call(this,o)}getOptimisticResult(t){const s=i(this,B).getQueryCache().build(i(this,B),t),r=this.createResult(s,t);return Hs(this,r)&&(c(this,G,r),c(this,Dt,this.options),c(this,Pt,i(this,S).state)),r}getCurrentResult(){return i(this,G)}trackResult(t,s){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),s==null||s(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,at).status==="pending"&&i(this,at).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){i(this,kt).add(t)}getCurrentQuery(){return i(this,S)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=i(this,B).defaultQueryOptions(t),r=i(this,B).getQueryCache().build(i(this,B),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return E(this,F,Yt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,G)))}createResult(t,s){var D;const r=i(this,S),a=this.options,o=i(this,G),l=i(this,Pt),h=i(this,Dt),w=t!==r?t.state:i(this,Zt),{state:T}=t;let m={...T},M=!1,g;if(s._optimisticResults){const N=this.hasListeners(),Z=!N&&He(t,s),Mt=N&&Le(t,r,s,a);(Z||Mt)&&(m={...m,...cs(T.data,t.options)}),s._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:Q,errorUpdatedAt:R,status:C}=m;g=m.data;let O=!1;if(s.placeholderData!==void 0&&g===void 0&&C==="pending"){let N;o!=null&&o.isPlaceholderData&&s.placeholderData===(h==null?void 0:h.placeholderData)?(N=o.data,O=!0):N=typeof s.placeholderData=="function"?s.placeholderData((D=i(this,qt))==null?void 0:D.state.data,i(this,qt)):s.placeholderData,N!==void 0&&(C="success",g=fe(o==null?void 0:o.data,N,s),M=!0)}if(s.select&&g!==void 0&&!O)if(o&&g===(l==null?void 0:l.data)&&s.select===i(this,Vt))g=i(this,Ut);else try{c(this,Vt,s.select),g=s.select(g),g=fe(o==null?void 0:o.data,g,s),c(this,Ut,g),c(this,dt,null)}catch(N){c(this,dt,N)}i(this,dt)&&(Q=i(this,dt),g=i(this,Ut),R=Date.now(),C="error");const q=m.fetchStatus==="fetching",A=C==="pending",f=C==="error",k=A&&q,H=g!==void 0,I={status:C,fetchStatus:m.fetchStatus,isPending:A,isSuccess:C==="success",isError:f,isInitialLoading:k,isLoading:k,data:g,dataUpdatedAt:m.dataUpdatedAt,error:Q,errorUpdatedAt:R,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>w.dataUpdateCount||m.errorUpdateCount>w.errorUpdateCount,isFetching:q,isRefetching:q&&!A,isLoadingError:f&&!H,isPaused:m.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:f&&H,isStale:Te(t,s),refetch:this.refetch,promise:i(this,at),isEnabled:X(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=I.data!==void 0,Z=I.status==="error"&&!N,Mt=Ft=>{Z?Ft.reject(I.error):N&&Ft.resolve(I.data)},$t=()=>{const Ft=c(this,at,I.promise=de());Mt(Ft)},ot=i(this,at);switch(ot.status){case"pending":t.queryHash===r.queryHash&&Mt(ot);break;case"fulfilled":(Z||I.data!==ot.value)&&$t();break;case"rejected":(!Z||I.error!==ot.reason)&&$t();break}}return I}updateResult(){const t=i(this,G),s=this.createResult(i(this,S),this.options);if(c(this,Pt,i(this,S).state),c(this,Dt,this.options),i(this,Pt).data!==void 0&&c(this,qt,i(this,S)),he(s,t))return;c(this,G,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!i(this,kt).size)return!0;const l=new Set(o??i(this,kt));return this.options.throwOnError&&l.add("error"),Object.keys(i(this,G)).some(h=>{const b=h;return i(this,G)[b]!==t[b]&&l.has(b)})};E(this,F,hs).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&E(this,F,ge).call(this)}},B=new WeakMap,S=new WeakMap,Zt=new WeakMap,G=new WeakMap,Pt=new WeakMap,Dt=new WeakMap,at=new WeakMap,dt=new WeakMap,Vt=new WeakMap,Ut=new WeakMap,qt=new WeakMap,Ot=new WeakMap,Tt=new WeakMap,pt=new WeakMap,kt=new WeakMap,F=new WeakSet,Yt=function(t){E(this,F,Re).call(this);let s=i(this,S).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(z)),s},ye=function(){E(this,F,be).call(this);const t=gt(this.options.staleTime,i(this,S));if(Jt.isServer()||i(this,G).isStale||!ce(t))return;const r=es(i(this,G).dataUpdatedAt,t)+1;c(this,Ot,bt.setTimeout(()=>{i(this,G).isStale||this.updateResult()},r))},ve=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,S)):this.options.refetchInterval)??!1},me=function(t){E(this,F,Ee).call(this),c(this,pt,t),!(Jt.isServer()||X(this.options.enabled,i(this,S))===!1||!ce(i(this,pt))||i(this,pt)===0)&&c(this,Tt,bt.setInterval(()=>{(this.options.refetchIntervalInBackground||we.isFocused())&&E(this,F,Yt).call(this)},i(this,pt)))},ge=function(){E(this,F,ye).call(this),E(this,F,me).call(this,E(this,F,ve).call(this))},be=function(){i(this,Ot)!==void 0&&(bt.clearTimeout(i(this,Ot)),c(this,Ot,void 0))},Ee=function(){i(this,Tt)!==void 0&&(bt.clearInterval(i(this,Tt)),c(this,Tt,void 0))},Re=function(){const t=i(this,B).getQueryCache().build(i(this,B),this.options);if(t===i(this,S))return;const s=i(this,S);c(this,S,t),c(this,Zt,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},hs=function(t){K.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(i(this,G))}),i(this,B).getQueryCache().notify({query:i(this,S),type:"observerResultsUpdated"})})},We);function ks(e,t){return X(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function He(e,t){return ks(e,t)||e.state.data!==void 0&&Ce(e,t,t.refetchOnMount)}function Ce(e,t,s){if(X(t.enabled,e)!==!1&&gt(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Te(e,t)}return!1}function Le(e,t,s,r){return(e!==t||X(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Te(e,s)}function Te(e,t){return X(t.enabled,e)!==!1&&e.isStaleByTime(gt(t.staleTime,e))}function Hs(e,t){return!he(e.getCurrentResult(),t)}function Ne(e){return{onFetch:(t,s)=>{var T,m,M,g,Q;const r=t.options,a=(M=(m=(T=t.fetchOptions)==null?void 0:T.meta)==null?void 0:m.fetchMore)==null?void 0:M.direction,o=((g=t.state.data)==null?void 0:g.pages)||[],l=((Q=t.state.data)==null?void 0:Q.pageParams)||[];let h={pages:[],pageParams:[]},b=0;const w=async()=>{let R=!1;const C=A=>{Is(A,()=>t.signal,()=>R=!0)},O=rs(t.options,t.fetchOptions),q=async(A,f,k)=>{if(R)return Promise.reject();if(f==null&&A.pages.length)return Promise.resolve(A);const P=(()=>{const Z={client:t.client,queryKey:t.queryKey,pageParam:f,direction:k?"backward":"forward",meta:t.options.meta};return C(Z),Z})(),I=await O(P),{maxPages:D}=t.options,N=k?As:Fs;return{pages:N(A.pages,I,D),pageParams:N(A.pageParams,f,D)}};if(a&&o.length){const A=a==="backward",f=A?Ls:Ke,k={pages:o,pageParams:l},H=f(r,k);h=await q(k,H,A)}else{const A=e??o.length;do{const f=b===0?l[0]??r.initialPageParam:Ke(r,h);if(b>0&&f==null)break;h=await q(h,f),b++}while(b<A)}return h};t.options.persister?t.fetchFn=()=>{var R,C;return(C=(R=t.options).persister)==null?void 0:C.call(R,w,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=w}}}function Ke(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function Ls(e,{pages:t,pageParams:s}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,s[0],s):void 0}var Xt,st,$,_t,rt,ct,Ze,Ns=(Ze=class extends us{constructor(t){super();d(this,rt);d(this,Xt);d(this,st);d(this,$);d(this,_t);c(this,Xt,t.client),this.mutationId=t.mutationId,c(this,$,t.mutationCache),c(this,st,[]),this.state=t.state||Ks(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){i(this,st).includes(t)||(i(this,st).push(t),this.clearGcTimeout(),i(this,$).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){c(this,st,i(this,st).filter(s=>s!==t)),this.scheduleGc(),i(this,$).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,st).length||(this.state.status==="pending"?this.scheduleGc():i(this,$).remove(this))}continue(){var t;return((t=i(this,_t))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,h,b,w,T,m,M,g,Q,R,C,O,q,A,f,k,H,P;const s=()=>{E(this,rt,ct).call(this,{type:"continue"})},r={client:i(this,Xt),meta:this.options.meta,mutationKey:this.options.mutationKey};c(this,_t,as({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(I,D)=>{E(this,rt,ct).call(this,{type:"failed",failureCount:I,error:D})},onPause:()=>{E(this,rt,ct).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,$).canRun(this)}));const a=this.state.status==="pending",o=!i(this,_t).canStart();try{if(a)s();else{E(this,rt,ct).call(this,{type:"pending",variables:t,isPaused:o}),i(this,$).config.onMutate&&await i(this,$).config.onMutate(t,this,r);const D=await((h=(l=this.options).onMutate)==null?void 0:h.call(l,t,r));D!==this.state.context&&E(this,rt,ct).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const I=await i(this,_t).start();return await((w=(b=i(this,$).config).onSuccess)==null?void 0:w.call(b,I,t,this.state.context,this,r)),await((m=(T=this.options).onSuccess)==null?void 0:m.call(T,I,t,this.state.context,r)),await((g=(M=i(this,$).config).onSettled)==null?void 0:g.call(M,I,null,this.state.variables,this.state.context,this,r)),await((R=(Q=this.options).onSettled)==null?void 0:R.call(Q,I,null,t,this.state.context,r)),E(this,rt,ct).call(this,{type:"success",data:I}),I}catch(I){try{await((O=(C=i(this,$).config).onError)==null?void 0:O.call(C,I,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((A=(q=this.options).onError)==null?void 0:A.call(q,I,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((k=(f=i(this,$).config).onSettled)==null?void 0:k.call(f,void 0,I,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((P=(H=this.options).onSettled)==null?void 0:P.call(H,void 0,I,t,this.state.context,r))}catch(D){Promise.reject(D)}throw E(this,rt,ct).call(this,{type:"error",error:I}),I}finally{i(this,$).runNext(this)}}},Xt=new WeakMap,st=new WeakMap,$=new WeakMap,_t=new WeakMap,rt=new WeakSet,ct=function(t){const s=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),K.batch(()=>{i(this,st).forEach(r=>{r.onMutationUpdate(t)}),i(this,$).notify({mutation:this,type:"updated",action:t})})},Ze);function Ks(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ut,tt,te,Ve,$s=(Ve=class extends ee{constructor(t={}){super();d(this,ut);d(this,tt);d(this,te);this.config=t,c(this,ut,new Set),c(this,tt,new Map),c(this,te,0)}build(t,s,r){const a=new Ns({client:t,mutationCache:this,mutationId:++re(this,te)._,options:t.defaultMutationOptions(s),state:r});return this.add(a),a}add(t){i(this,ut).add(t);const s=ie(t);if(typeof s=="string"){const r=i(this,tt).get(s);r?r.push(t):i(this,tt).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(i(this,ut).delete(t)){const s=ie(t);if(typeof s=="string"){const r=i(this,tt).get(s);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&i(this,tt).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=ie(t);if(typeof s=="string"){const r=i(this,tt).get(s),a=r==null?void 0:r.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const s=ie(t);if(typeof s=="string"){const a=(r=i(this,tt).get(s))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){K.batch(()=>{i(this,ut).forEach(t=>{this.notify({type:"removed",mutation:t})}),i(this,ut).clear(),i(this,tt).clear()})}getAll(){return Array.from(i(this,ut))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>je(s,r))}findAll(t={}){return this.getAll().filter(s=>je(t,s))}notify(t){K.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return K.batch(()=>Promise.all(t.map(s=>s.continue().catch(z))))}},ut=new WeakMap,tt=new WeakMap,te=new WeakMap,Ve);function ie(e){var t;return(t=e.options.scope)==null?void 0:t.id}var it,Xe,Gs=(Xe=class extends ee{constructor(t={}){super();d(this,it);this.config=t,c(this,it,new Map)}build(t,s,r){const a=s.queryKey,o=s.queryHash??Pe(a,s);let l=this.get(o);return l||(l=new Us({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){i(this,it).has(t.queryHash)||(i(this,it).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,it).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,it).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){K.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,it).get(t)}getAll(){return[...i(this,it).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>Qe(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>Qe(t,r)):s}notify(t){K.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){K.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){K.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},it=new WeakMap,Xe),U,yt,vt,Ht,Lt,mt,Nt,Kt,ts,ar=(ts=class{constructor(e={}){d(this,U);d(this,yt);d(this,vt);d(this,Ht);d(this,Lt);d(this,mt);d(this,Nt);d(this,Kt);c(this,U,e.queryCache||new Gs),c(this,yt,e.mutationCache||new $s),c(this,vt,e.defaultOptions||{}),c(this,Ht,new Map),c(this,Lt,new Map),c(this,mt,0)}mount(){re(this,mt)._++,i(this,mt)===1&&(c(this,Nt,we.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,U).onFocus())})),c(this,Kt,ne.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,U).onOnline())})))}unmount(){var e,t;re(this,mt)._--,i(this,mt)===0&&((e=i(this,Nt))==null||e.call(this),c(this,Nt,void 0),(t=i(this,Kt))==null||t.call(this),c(this,Kt,void 0))}isFetching(e){return i(this,U).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,yt).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,U).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,U).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(gt(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,U).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),a=i(this,U).get(r.queryHash),o=a==null?void 0:a.state.data,l=Ts(t,o);if(l!==void 0)return i(this,U).build(this,r).setData(l,{...s,manual:!0})}setQueriesData(e,t,s){return K.batch(()=>i(this,U).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,U).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=i(this,U);K.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,U);return K.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=K.batch(()=>i(this,U).findAll(e).map(a=>a.cancel(s)));return Promise.all(r).then(z).catch(z)}invalidateQueries(e,t={}){return K.batch(()=>(i(this,U).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},r=K.batch(()=>i(this,U).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,s);return s.throwOnError||(o=o.catch(z)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(z)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,U).build(this,t);return s.isStaleByTime(gt(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(z).catch(z)}fetchInfiniteQuery(e){return e.behavior=Ne(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(z).catch(z)}ensureInfiniteQueryData(e){return e.behavior=Ne(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ne.isOnline()?i(this,yt).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,U)}getMutationCache(){return i(this,yt)}getDefaultOptions(){return i(this,vt)}setDefaultOptions(e){c(this,vt,e)}setQueryDefaults(e,t){i(this,Ht).set(Bt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,Ht).values()],s={};return t.forEach(r=>{zt(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,Lt).set(Bt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,Lt).values()],s={};return t.forEach(r=>{zt(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,vt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Pe(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===Oe&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...i(this,vt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,U).clear(),i(this,yt).clear()}},U=new WeakMap,yt=new WeakMap,vt=new WeakMap,Ht=new WeakMap,Lt=new WeakMap,mt=new WeakMap,Nt=new WeakMap,Kt=new WeakMap,ts),ls=W.createContext(void 0),Ys=e=>{const t=W.useContext(ls);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ur=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),bs.jsx(ls.Provider,{value:e,children:t})),fs=W.createContext(!1),Bs=()=>W.useContext(fs);fs.Provider;function zs(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Js=W.createContext(zs()),Ws=()=>W.useContext(Js),Zs=(e,t,s)=>{const r=s!=null&&s.state.error&&typeof e.throwOnError=="function"?is(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Vs=e=>{W.useEffect(()=>{e.clearReset()},[e])},Xs=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||is(s,[e.error,r])),tr=e=>{if(e.suspense){const s=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>s(r(...a)):s(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},er=(e,t)=>e.isLoading&&e.isFetching&&!t,sr=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,$e=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function rr(e,t,s){var M,g,Q,R;const r=Bs(),a=Ws(),o=Ys(),l=o.defaultQueryOptions(e);(g=(M=o.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||g.call(M,l);const h=o.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",tr(l),Zs(l,a,h),Vs(a);const b=!o.getQueryCache().get(l.queryHash),[w]=W.useState(()=>new t(o,l)),T=w.getOptimisticResult(l),m=!r&&e.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(C=>{const O=m?w.subscribe(K.batchCalls(C)):z;return w.updateResult(),O},[w,m]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),W.useEffect(()=>{w.setOptions(l)},[l,w]),sr(l,T))throw $e(l,w,a);if(Xs({result:T,errorResetBoundary:a,throwOnError:l.throwOnError,query:h,suspense:l.suspense}))throw T.error;if((R=(Q=o.getDefaultOptions().queries)==null?void 0:Q._experimental_afterQuery)==null||R.call(Q,l,T),l.experimental_prefetchInRender&&!Jt.isServer()&&er(T,r)){const C=b?$e(l,w,a):h==null?void 0:h.promise;C==null||C.catch(z).finally(()=>{w.updateResult()})}return l.notifyOnChangeProps?T:w.trackResult(T)}function or(e,t){return rr(e,qs)}export{ar as Q,W as a,ur as b,bs as j,nr as o,Rs as r,or as u};
