var F=r=>{throw TypeError(r)};var L=(r,e,s)=>e.has(r)||F("Cannot "+s);var i=(r,e,s)=>(L(r,e,"read from private field"),s?s.call(r):e.get(r)),b=(r,e,s)=>e.has(r)?F("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,s),c=(r,e,s,t)=>(L(r,e,"write to private field"),t?t.call(r,s):e.set(r,s),s),y=(r,e,s)=>(L(r,e,"access private method"),s);import{jR as X,jS as B,jT as Y,jU as Z,jV as V,ai as $,jW as G,jX as N,r as j,jY as W,jZ as ee,j_ as se,j$ as te,k0 as I,k1 as _,k2 as re,k3 as ne,k4 as ie,h as ue,x as oe,jJ as ae,jO as he}from"./index-E0AVXOTn.js";function J(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function ce(r,e,s){const t=r.slice(0);return t[e]=s,t}var E,f,w,Q,p,g,q,k,x,h,H,A,T,U,z,K,le=(K=class extends X{constructor(e,s,t){super();b(this,h);b(this,E);b(this,f);b(this,w);b(this,Q);b(this,p);b(this,g);b(this,q);b(this,k);b(this,x,[]);c(this,E,e),c(this,Q,t),c(this,w,[]),c(this,p,[]),c(this,f,[]),this.setQueries(s)}onSubscribe(){this.listeners.size===1&&i(this,p).forEach(e=>{e.subscribe(s=>{y(this,h,U).call(this,e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,i(this,p).forEach(e=>{e.destroy()})}setQueries(e,s){c(this,w,e),c(this,Q,s),B.batch(()=>{const t=i(this,p),u=y(this,h,T).call(this,i(this,w));c(this,x,u),u.forEach(a=>a.observer.setOptions(a.defaultedQueryOptions));const n=u.map(a=>a.observer),o=n.map(a=>a.getCurrentResult()),d=t.length!==n.length,C=n.some((a,m)=>a!==t[m]),R=d||C,P=R?!0:o.some((a,m)=>{const S=i(this,f)[m];return!S||!Y(a,S)});!R&&!P||(R&&c(this,p,n),c(this,f,o),this.hasListeners()&&(R&&(J(t,n).forEach(a=>{a.destroy()}),J(n,t).forEach(a=>{a.subscribe(m=>{y(this,h,U).call(this,a,m)})})),y(this,h,z).call(this)))})}getCurrentResult(){return i(this,f)}getQueries(){return i(this,p).map(e=>e.getCurrentQuery())}getObservers(){return i(this,p)}getOptimisticResult(e,s){const t=y(this,h,T).call(this,e),u=t.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions));return[u,n=>y(this,h,A).call(this,n??u,s),()=>y(this,h,H).call(this,u,t)]}},E=new WeakMap,f=new WeakMap,w=new WeakMap,Q=new WeakMap,p=new WeakMap,g=new WeakMap,q=new WeakMap,k=new WeakMap,x=new WeakMap,h=new WeakSet,H=function(e,s){return s.map((t,u)=>{const n=e[u];return t.defaultedQueryOptions.notifyOnChangeProps?n:t.observer.trackResult(n,o=>{s.forEach(d=>{d.observer.trackProp(o)})})})},A=function(e,s){return s?((!i(this,g)||i(this,f)!==i(this,k)||s!==i(this,q))&&(c(this,q,s),c(this,k,i(this,f)),c(this,g,Z(i(this,g),s(e)))),i(this,g)):e},T=function(e){const s=new Map(i(this,p).map(u=>[u.options.queryHash,u])),t=[];return e.forEach(u=>{const n=i(this,E).defaultQueryOptions(u),o=s.get(n.queryHash);o?t.push({defaultedQueryOptions:n,observer:o}):t.push({defaultedQueryOptions:n,observer:new V(i(this,E),n)})}),t},U=function(e,s){const t=i(this,p).indexOf(e);t!==-1&&(c(this,f,ce(i(this,f),t,s)),y(this,h,z).call(this))},z=function(){var e;if(this.hasListeners()){const s=i(this,g),t=y(this,h,H).call(this,i(this,f),i(this,x)),u=y(this,h,A).call(this,t,(e=i(this,Q))==null?void 0:e.combine);s!==u&&B.batch(()=>{this.listeners.forEach(n=>{n(i(this,f))})})}},K);function fe({queries:r,...e},s){const t=$(s),u=G(),n=N(),o=j.useMemo(()=>r.map(l=>{const v=t.defaultQueryOptions(l);return v._optimisticResults=u?"isRestoring":"optimistic",v}),[r,t,u]);o.forEach(l=>{W(l),ee(l,n)}),se(n);const[d]=j.useState(()=>new le(t,o,e)),[C,R,P]=d.getOptimisticResult(o,e.combine),a=!u&&e.subscribed!==!1;j.useSyncExternalStore(j.useCallback(l=>a?d.subscribe(B.batchCalls(l)):te,[d,a]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),j.useEffect(()=>{d.setQueries(o,e)},[o,e,d]);const S=C.some((l,v)=>I(o[v],l))?C.flatMap((l,v)=>{const O=o[v];if(O){const D=new V(t,O);if(I(O,l))return _(O,D,n);re(l,u)&&_(O,D,n)}return[]}):[];if(S.length>0)throw Promise.all(S);const M=C.find((l,v)=>{const O=o[v];return O&&ne({result:l,errorResetBoundary:n,throwOnError:O.throwOnError,query:t.getQueryCache().get(O.queryHash),suspense:O.suspense})});if(M!=null&&M.error)throw M.error;return R(P())}function be(r,e){return fe({...r,queries:r.queries.map(s=>({...s,suspense:!0,throwOnError:ie,enabled:!0,placeholderData:void 0}))},e)}const ye=({eventKey:r,searchParams:e,options:s})=>{const[t]=ue(),u=t.get("preview")==="true",n={...e,preview:u};return oe({queryKey:ae.detail(r,n),queryFn:async()=>{const{data:o}=await he.getEvent(r,n);return o},...s})};export{ye as a,be as u};