var rt=i=>{throw TypeError(i)};var K=(i,t,s)=>t.has(i)||rt("Cannot "+s);var e=(i,t,s)=>(K(i,t,"read from private field"),s?s.call(i):t.get(i)),b=(i,t,s)=>t.has(i)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),u=(i,t,s,n)=>(K(i,t,"write to private field"),n?n.call(i,s):t.set(i,s),s),f=(i,t,s)=>(K(i,t,"access private method"),s);import{a2 as mt,a3 as O,a4 as N,a5 as k,a6 as yt,a7 as nt,a8 as ht,a9 as Rt,aa as z,ab as gt,ac as Ot,ad as ot,ae as St,af as Ct,A as wt,z as H,ag as Qt,ah as It,h as Ft,ai as Dt,aj as lt,ak as ut,al as Ut,am as Et}from"./index-DjHCcdXI.js";import{u as Mt}from"./PropertyCard.vue_vue_type_script_setup_true_lang-rIfStzMl.js";var m,r,B,y,F,P,w,W,T,L,D,U,I,x,o,j,G,J,X,Y,Z,$,q,pt,ft,Pt=(ft=class extends mt{constructor(t,s){super();b(this,o);b(this,m);b(this,r);b(this,B);b(this,y);b(this,F);b(this,P);b(this,w);b(this,W);b(this,T);b(this,L);b(this,D);b(this,U);b(this,I);b(this,x,new Set);this.options=s,u(this,m,t),u(this,w,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(e(this,r).addObserver(this),ct(e(this,r),this.options)?f(this,o,j).call(this):this.updateResult(),f(this,o,Y).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tt(e(this,r),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tt(e(this,r),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,f(this,o,Z).call(this),f(this,o,$).call(this),e(this,r).removeObserver(this)}setOptions(t){const s=this.options,n=e(this,r);if(this.options=e(this,m).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof O(this.options.enabled,e(this,r))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");f(this,o,q).call(this),e(this,r).setOptions(this.options),s._defaulted&&!N(this.options,s)&&e(this,m).getQueryCache().notify({type:"observerOptionsUpdated",query:e(this,r),observer:this});const h=this.hasListeners();h&&dt(e(this,r),n,this.options,s)&&f(this,o,j).call(this),this.updateResult(),h&&(e(this,r)!==n||O(this.options.enabled,e(this,r))!==O(s.enabled,e(this,r))||k(this.options.staleTime,e(this,r))!==k(s.staleTime,e(this,r)))&&f(this,o,G).call(this);const a=f(this,o,J).call(this);h&&(e(this,r)!==n||O(this.options.enabled,e(this,r))!==O(s.enabled,e(this,r))||a!==e(this,I))&&f(this,o,X).call(this,a)}getOptimisticResult(t){const s=e(this,m).getQueryCache().build(e(this,m),t),n=this.createResult(s,t);return Lt(this,n)&&(u(this,y,n),u(this,P,this.options),u(this,F,e(this,r).state)),n}getCurrentResult(){return e(this,y)}trackResult(t,s){return new Proxy(t,{get:(n,h)=>(this.trackProp(h),s==null||s(h),Reflect.get(n,h))})}trackProp(t){e(this,x).add(t)}getCurrentQuery(){return e(this,r)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=e(this,m).defaultQueryOptions(t),n=e(this,m).getQueryCache().build(e(this,m),s);let h=()=>{},a;const c=new Promise(v=>{a=v,h=e(this,m).getQueryCache().subscribe(g=>{g.type==="updated"&&g.query.queryHash===n.queryHash&&n.state.data!==void 0&&(h(),v(this.createResult(n,s)))})});return Promise.race([n.fetch().then(()=>{const v=this.createResult(n,s);return a==null||a(v),v}).finally(()=>{h()}),c])}fetch(t){return f(this,o,j).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),e(this,y)))}createResult(t,s){var at;const n=e(this,r),h=this.options,a=e(this,y),c=e(this,F),v=e(this,P),g=t!==n?t.state:e(this,B),{state:_}=t;let p={..._},A=!1,d;if(s._optimisticResults){const C=this.hasListeners(),bt=!C&&ct(t,s),vt=C&&dt(t,n,s,h);(bt||vt)&&(p={...p,...Ot(_.data,t.options)}),s._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:l,errorUpdatedAt:S,status:R}=p;d=p.data;let Q=!1;if(s.placeholderData!==void 0&&d===void 0&&R==="pending"){let C;a!=null&&a.isPlaceholderData&&s.placeholderData===(v==null?void 0:v.placeholderData)?(C=a.data,Q=!0):C=typeof s.placeholderData=="function"?s.placeholderData((at=e(this,L))==null?void 0:at.state.data,e(this,L)):s.placeholderData,C!==void 0&&(R="success",d=ot(a==null?void 0:a.data,C,s),A=!0)}if(s.select&&d!==void 0&&!Q)if(a&&d===(c==null?void 0:c.data)&&s.select===e(this,W))d=e(this,T);else try{u(this,W,s.select),d=s.select(d),d=ot(a==null?void 0:a.data,d,s),u(this,T,d),u(this,w,null)}catch(C){u(this,w,C)}else d===void 0&&u(this,w,null);e(this,w)&&(l=e(this,w),d=e(this,T),S=Date.now(),R="error",A=!1);const E=p.fetchStatus==="fetching",M=R==="pending",V=R==="error",st=M&&E,it=d!==void 0;return{status:R,fetchStatus:p.fetchStatus,isPending:M,isSuccess:R==="success",isError:V,isInitialLoading:st,isLoading:st,data:d,dataUpdatedAt:p.dataUpdatedAt,error:l,errorUpdatedAt:S,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>g.dataUpdateCount||p.errorUpdateCount>g.errorUpdateCount,isFetching:E,isRefetching:E&&!M,isLoadingError:V&&!it,isPaused:p.fetchStatus==="paused",isPlaceholderData:A,isRefetchError:V&&it,isStale:et(t,s),refetch:this.refetch,isEnabled:O(s.enabled,t)!==!1}}updateResult(){const t=e(this,y),s=this.createResult(e(this,r),this.options);if(u(this,F,e(this,r).state),u(this,P,this.options),e(this,F).data!==void 0&&u(this,L,e(this,r)),N(s,t))return;u(this,y,s);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:h}=this.options,a=typeof h=="function"?h():h;if(a==="all"||!a&&!e(this,x).size)return!0;const c=new Set(a??e(this,x));return this.options.throwOnError&&c.add("error"),Object.keys(e(this,y)).some(v=>{const g=v;return e(this,y)[g]!==t[g]&&c.has(g)})};f(this,o,pt).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&f(this,o,Y).call(this)}},m=new WeakMap,r=new WeakMap,B=new WeakMap,y=new WeakMap,F=new WeakMap,P=new WeakMap,w=new WeakMap,W=new WeakMap,T=new WeakMap,L=new WeakMap,D=new WeakMap,U=new WeakMap,I=new WeakMap,x=new WeakMap,o=new WeakSet,j=function(t){f(this,o,q).call(this);let s=e(this,r).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(yt)),s},G=function(){f(this,o,Z).call(this);const t=k(this.options.staleTime,e(this,r));if(nt.isServer()||e(this,y).isStale||!ht(t))return;const s=Rt(e(this,y).dataUpdatedAt,t)+1;u(this,D,z.setTimeout(()=>{e(this,y).isStale||this.updateResult()},s))},J=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(e(this,r)):this.options.refetchInterval)??!1},X=function(t){f(this,o,$).call(this),u(this,I,t),!(nt.isServer()||O(this.options.enabled,e(this,r))===!1||!ht(e(this,I))||e(this,I)===0)&&u(this,U,z.setInterval(()=>{(this.options.refetchIntervalInBackground||gt.isFocused())&&f(this,o,j).call(this)},e(this,I)))},Y=function(){f(this,o,G).call(this),f(this,o,X).call(this,f(this,o,J).call(this))},Z=function(){e(this,D)!==void 0&&(z.clearTimeout(e(this,D)),u(this,D,void 0))},$=function(){e(this,U)!==void 0&&(z.clearInterval(e(this,U)),u(this,U,void 0))},q=function(){const t=e(this,m).getQueryCache().build(e(this,m),this.options);if(t===e(this,r))return;const s=e(this,r);u(this,r,t),u(this,B,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},pt=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(e(this,y))}),e(this,m).getQueryCache().notify({query:e(this,r),type:"observerResultsUpdated"})})},ft);function Tt(i,t){return O(t.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&O(t.retryOnMount,i)===!1)}function ct(i,t){return Tt(i,t)||i.state.data!==void 0&&tt(i,t,t.refetchOnMount)}function tt(i,t,s){if(O(t.enabled,i)!==!1&&k(t.staleTime,i)!=="static"){const n=typeof s=="function"?s(i):s;return n==="always"||n!==!1&&et(i,t)}return!1}function dt(i,t,s,n){return(i!==t||O(n.enabled,i)===!1)&&(!s.suspense||i.state.status!=="error")&&et(i,s)}function et(i,t){return O(t.enabled,i)!==!1&&i.isStaleByTime(k(t.staleTime,i))}function Lt(i,t){return!N(i.getCurrentResult(),t)}function xt(i,t,s){const n=Mt(),h=Ft(()=>{var Q;let l=t;typeof l=="function"&&(l=l());const S=Ut(l);typeof S.enabled=="function"&&(S.enabled=S.enabled());const R=n.defaultQueryOptions(S);return R._optimisticResults=(Q=n.isRestoring)!=null&&Q.value?"isRestoring":"optimistic",R}),a=new i(n,h.value),c=h.value.shallow?Ct(a.getCurrentResult()):wt(a.getCurrentResult());let v=()=>{};n.isRestoring&&H(n.isRestoring,l=>{l||(v(),v=a.subscribe(S=>{ut(c,S)}))},{immediate:!0});const g=()=>{a.setOptions(h.value),ut(c,a.getCurrentResult())};H(h,g),Et(()=>{v()});const _=(...l)=>(g(),c.refetch(...l)),p=()=>new Promise((l,S)=>{let R=()=>{};const Q=()=>{if(h.value.enabled!==!1){a.setOptions(h.value);const E=a.getOptimisticResult(h.value);E.isStale?(R(),a.fetchOptimistic(h.value).then(l,M=>{lt(h.value.throwOnError,[M,a.getCurrentQuery()])?S(M):l(a.getCurrentResult())})):(R(),l(E))}};Q(),R=H(h,Q)});H(()=>c.error,l=>{if(c.isError&&!c.isFetching&&lt(h.value.throwOnError,[l,a.getCurrentQuery()]))throw l});const A=h.value.shallow?Qt(c):It(c),d=Dt(A);for(const l in c)typeof c[l]=="function"&&(d[l]=c[l]);return d.suspense=p,d.refetch=_,d}function Bt(i,t){return xt(Pt,i)}export{Bt as u};