2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
|
var St=s=>{throw TypeError(s)};var nt=(s,t,e)=>t.has(s)||St("Cannot "+e);var i=(s,t,e)=>(nt(s,t,"read from private field"),e?e.call(s):t.get(s)),l=(s,t,e)=>t.has(s)?St("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),o=(s,t,e,r)=>(nt(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),d=(s,t,e)=>(nt(s,t,"access private method"),e);import{S as vt,i as J,r as y,s as at,c as G,a as ot,d as wt,t as Dt,e as et,f as Ct,n as Qt,b as _t,u as jt}from"./QueryClientProvider-D7wSf7Op.js";import{r as C}from"./index-JhL3uwfD.js";import"./jsx-runtime-D_zvdyIk.js";var Q,I,j,Tt,Nt=(Tt=class extends vt{constructor(){super();l(this,Q);l(this,I);l(this,j);o(this,j,t=>{if(!J&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){i(this,I)||this.setEventListener(i(this,j))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,I))==null||t.call(this),o(this,I,void 0))}setEventListener(t){var e;o(this,j,t),(e=i(this,I))==null||e.call(this),o(this,I,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,Q)!==t&&(o(this,Q,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return typeof i(this,Q)=="boolean"?i(this,Q):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Q=new WeakMap,I=new WeakMap,j=new WeakMap,Tt),kt=new Nt;function Ot(){let s,t;const e=new Promise((n,c)=>{s=n,t=c});e.status="pending",e.catch(()=>{});function r(n){Object.assign(e,n),delete e.resolve,delete e.reject}return e.resolve=n=>{r({status:"fulfilled",value:n}),s(n)},e.reject=n=>{r({status:"rejected",reason:n}),t(n)},e}var N,F,k,xt,Bt=(xt=class extends vt{constructor(){super();l(this,N,!0);l(this,F);l(this,k);o(this,k,t=>{if(!J&&window.addEventListener){const e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,F)||this.setEventListener(i(this,k))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,F))==null||t.call(this),o(this,F,void 0))}setEventListener(t){var e;o(this,k,t),(e=i(this,F))==null||e.call(this),o(this,F,t(this.setOnline.bind(this)))}setOnline(t){i(this,N)!==t&&(o(this,N,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,N)}},N=new WeakMap,F=new WeakMap,k=new WeakMap,xt),At=new Bt;function Ht(s){return(s??"online")==="online"?At.isOnline():!0}function zt(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ht(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}var g,a,X,v,_,B,w,M,Y,A,H,U,P,T,z,h,K,ht,ct,ut,lt,dt,ft,pt,Ut,Lt,Wt=(Lt=class extends vt{constructor(t,e){super();l(this,h);l(this,g);l(this,a);l(this,X);l(this,v);l(this,_);l(this,B);l(this,w);l(this,M);l(this,Y);l(this,A);l(this,H);l(this,U);l(this,P);l(this,T);l(this,z,new Set);this.options=e,o(this,g,t),o(this,M,null),o(this,w,Ot()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),It(i(this,a),this.options)?d(this,h,K).call(this):this.updateResult(),d(this,h,lt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bt(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bt(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,d(this,h,dt).call(this),d(this,h,ft).call(this),i(this,a).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,a);if(this.options=i(this,g).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof y(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");d(this,h,pt).call(this),i(this,a).setOptions(this.opt
|