1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,10955,e=>{"use strict";let t,r,s,i,n,a,o,u,l;var c,h,f,d,p=e.i(24345),y=e.i(97539),m=y.createContext(void 0),b=e=>{let t=y.useContext(m);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},g=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,p.jsx)(m.Provider,{value:e,children:t}));function v(e){let t={subscribe(t){let r=null,s=!1,i=!1,n=!1;function a(){if(null===r){n=!0;return}!i&&(i=!0,"function"==typeof r?r():r&&r.unsubscribe())}return r=e({next(e){s||t.next?.(e)},error(e){s||(s=!0,t.error?.(e),a())},complete(){s||(s=!0,t.complete?.(),a())}}),n&&a(),{unsubscribe:a}},pipe:(...e)=>e.reduce(w,t)};return t}function w(e,t){return t(e)}function O(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}Symbol();let R="function"==typeof Symbol&&!!Symbol.asyncIterator;"u"<typeof window||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||globalThis.process?.env?.JEST_WORKER_ID||globalThis.process?.env?.VITEST_WORKER_ID;let C=()=>{},q=e=>{Object.freeze&&Object.freeze(e)},Q=e=>(function e(t,r,s){let i=r.join(".");return(f=s)[d=i]??(f[d]=new Proxy(C,{get(i,n){if("string"==typeof n&&"then"!==n)return e(t,[...r,n],s)},apply(e,s,i){let n=r[r.length-1],a={args:i,path:r};return"call"===n?a={args:i.length>=2?[i[1]]:[],path:r.slice(0,-1)}:"apply"===n&&(a={args:i.length>=2?i[1]:[],path:r.slice(0,-1)}),q(a.args),q(a.path),t(a)}})),s[i]})(e,[],Object.create(null)),P=e=>new Proxy(C,{get(t,r){if("string"==typeof r&&"then"!==r)return e(r)}}),S={input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}};class E extends Error{static from(e,t={}){return e instanceof E||e instanceof Error&&"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):O(e)&&O(e.error)&&"number"==typeof e.error.code&&"string"==typeof e.error.message?new E(e.error.message,{...t,result:e}):new E("string"==typeof e?e:O(e)&&"string"==typeof e.message?e.message:"Unknown error",{...t,cause:e})}constructor(e,t){const r=t?.cause;super(e,{cause:r}),this.meta=t?.meta,this.cause=r,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,E.prototype)}}class x{$request(e){var t;return(t={links:this.links,op:{...e,context:e.context??{},id:++this.requestId}},v(e=>(function e(r=0,s=t.op){let i=t.links[r];if(!i)throw Error("No more links to execute - did you forget to add an ending link?");return i({op:s,next:t=>e(r+1,t)})})().subscribe(e))).pipe(e=>{let t=0,r=null,s=[];return v(i=>(t++,s.push(i),r||(r=e.subscribe({next(e){for(let t of s)t.next?.(e)},error(e){for(let t of s)t.error?.(e)},complete(){for(let e of s)e.complete?.()}})),{unsubscribe(){if(0==--t&&r){let e=r;r=null,e.unsubscribe()}let e=s.findIndex(e=>e===i);e>-1&&s.splice(e,1)}}))})}async requestAsPromise(e){try{let t,r=this.$request(e);return(await (t=new AbortController,new Promise((e,s)=>{let i=!1;function n(){i||(i=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{s(t.signal.reason)});let a=r.subscribe({next(t){i=!0,e(t),n()},error(e){s(e)},complete(){t.abort(),n()}})}))).result.data}catch(e){throw E.from(e)}}query(e,t,r){return this.requestAsPromise({type:"query",path:e,input:t,context:r?.context,signal:r?.signal})}mutation(e,t,r){return this.requestAsPromise({type:"mutation",path:e,input:t,context:r?.context,signal:r?.signal})}subscription(e,t,r){return this.$request({type:"subscription",path:e,input:t,context:r?.context,signal:r.signal}).subscribe({next(e){"started"===e.result.type?r.onStarted?.({context:e.context}):"stopped"===e.result.type?r.onStopped?.():r.onData?.(e.result.data)},error(e){r.onError?.(e)},complete(){r.onComplete?.()}})}constructor(e){this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}}let I={query:"query",mutate:"mutation",subscribe:"subscription"},D=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function M(e){let t=null,r=null;function s(){let s=function(t){let r=[[]],s=0;for(;;){let i=t[s];if(!i)break;let n=r[r.length-1];if(i.aborted){i.reject?.(Error("Aborted")),s++;continue}if(e.validate(n.concat(i).map(e=>e.key))){n.push(i),s++;continue}if(0===n.length){i.reject?.(Error("Input is too big for a single dispatch")),s++;continue}r.push([])}return r}(t);for(let i of(clearTimeout(r),r=null,t=null,s)){if(!i.length)continue;let t={items:i};for(let e of i)e.batch=t;e.fetch(t.items.map(e=>e.key)).then(async e=>{for(let r of(await Promise.all(e.map(async(e,r)=>{let s=t.items[r];try{let t=await Promise.resolve(e);s.resolve?.(t)}catch(e){s.reject?.(e)}s.batch=null,s.reject=null,s.resolve=null})),t.items))r.reject?.(Error("Missing result")),r.batch=null}).catch(e=>{for(let r of t.items)r.reject?.(e),r.batch=null})}}return{load:function(e){let i={aborted:!1,key:e,batch:null,resolve:D,reject:D},n=new Promise((e,r)=>{i.reject=r,i.resolve=e,t||(t=[]),t.push(i)});return r||(r=setTimeout(s)),n}}}let T={query:"GET",mutation:"POST",subscription:"PATCH"};function j(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){let t={};for(let r=0;r<e.length;r++){let s=e[r];t[r]=s}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}let k=e=>{let t=e.url.split("?"),r=t[0].replace(/\/$/,"")+"/"+e.path,s=[];if(t[1]&&s.push(t[1]),"inputs"in e&&s.push("batch=1"),"query"===e.type||"subscription"===e.type){let t=j(e);void 0!==t&&"POST"!==e.methodOverride&&s.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return s.length&&(r+="?"+s.join("&")),r},A=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;let t=j(e);return void 0!==t?JSON.stringify(t):void 0};
1class F extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}async function U(e){var t=e.signal;if(t?.aborted){if(t.throwIfAborted?.(),"u">typeof DOMException)throw new DOMException("AbortError","AbortError");throw new F}let r=e.getUrl(e),s=e.getBody(e),{type:i}=e,n=await (async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),a={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,...n};return(function(e){if(e)return e;if("u">typeof window&&"function"==typeof window.fetch)return window.fetch;if("u">typeof globalThis&&"function"==typeof globalThis.fetch)return globalThis.fetch;throw Error("No fetch implementation found")})(e.fetch)(r,{method:e.methodOverride??T[i],signal:e.signal,body:s,headers:a})}function K(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}let z=Symbol();function L(){let e=null,t=K(),r=!1;return{readable:new ReadableStream({start(t){e=t},cancel(){t.resolve(z),r=!0}}
1),controller:e,cancelledPromise:t.promise,cancelled:()=>r}}class _ extends Error{constructor(e){super("Invalid response or stream interrupted",{cause:e})}}class N extends Error{constructor(e){super("Received error from server"),this.data=e}}async function H(e){var t;let r,s,i,n,{deserialize:a=e=>e}=e,o=(r="getReader"in(t=e.from)?t.getReader():({getReader(){let{readable:e,controller:r}=L();return t.on("data",e=>{r.enqueue(e)}),t.on("end",()=>{r.close()}),t.on("error",e=>{r.error(e)}),e.getReader()}}).getReader(),s="",i=new ReadableStream({async pull(e){let{done:t,value:s}=await r.read();t?e.close():e.enqueue(s)},cancel:()=>r.cancel()}).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform(e,t){let r=(s+=e).split("\n");for(let e of(s=r.pop()??"",r))t.enqueue(e)}})),n=!1,i.pipeThrough(new TransformStream({transform(e,t){if(n){let r=JSON.parse(e);t.enqueue(r)}else{let r=JSON.parse(e);t.enqueue(r),n=!0}}})));a&&(o=o.pipeThrough(new TransformStream({transform(e,t){t.enqueue(a(e))}})));let u=K(),l=new Map,c=new Map,h=()=>{0===l.size&&Array.from(c.values()).every(e=>e.returned)&&e.abortController?.abort()},f=e=>{let t=new _(e);
1for(let e of(u?.reject(t),l.values()))e.reject(t);for(let{controller:e}of(l.clear(),c.values()))e.enqueue(t),e.close();c.clear()};return o.pipeTo(new WritableStream({async write(t){if(u){for(let[r,s]of Object.entries(t)){let i=function t(r){let[[s],...i]=r;for(let r of i){let[i]=r,n=function(r){let[s,i,n]=r,{readable:a,controller:o}=L(),u={controller:o,returned:!1};c.set(n,u);let f=l.get(n);switch(f&&(f.resolve(u),l.delete(n)),i){case 0:return new Promise((r,s)=>{a.getReader().read().then(i=>{if(i.done)return void s(Error("Promise chunk ended without value"));if(i.value instanceof _)return void s(i.value);let[n,a,o]=i.value;switch(a){case 0:r(t(o));break;case 1:s(e.formatError?.({error:o})??new N(o))}}).catch(s).finally(()=>{c.delete(n),h()})});case 1:return{[Symbol.asyncIterator]:()=>{let r=a.getReader();return{next:async()=>{let{done:s,value:i}=await r.read();if(i instanceof _)throw i;if(s)return c.delete(n),h(),{done:!0,value:void 0};let[a,o,u]=i;switch(o){case 1:return{done:!1,value:t(u)};case 0:return c.delete(n),h(),{done:!0,value:t(u)};case 2:throw c.delete(n),h(),e.formatError?.({error:u})??new N(u)}},return:async()=>(u.returned=!0,h(),{done:!0,value:void 0})}}}}}(r);if(null===i)return n;s[i]=n}return s}(s);t[r]=i}u.resolve(t),u=null;return}let[r]=t,s=c.get(r);if(!s){let e=l.get(r);e||(e=K(),l.set(r,e)),s=await e.promise}s.controller.enqueue(t)},close:f,abort:f})).catch(t=>{e.onError?.({error:t}),f(t)}),[await u.promise,{controllers:c}]}Symbol();let B={query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},V={query:["\x1b[30;46m","\x1b[97;46m"],mutation:["\x1b[30;45m","\x1b[97;45m"],subscription:["\x1b[30;42m","\x1b[97;42m"]},G={query:["\x1b[1;30;46m","\x1b[1;97;46m"],mutation:["\x1b[1;30;45m","\x1b[1;97;45m"],subscription:["\x1b[1;30;42m","\x1b[1;97;42m"]};var $="u"<typeof window||"Deno"in globalThis;function W(){}function J(e){return"number"==typeof e&&e>=0&&e!==1/0}function X(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Y(e,t){return"function"==typeof e?e(t):e}function Z(e,t){return"function"==typeof e?e(t):e}function ee(e,t){let{type:r="all",exact:s,fetchStatus:i,predicate:n,queryKey:a,stale:o}=e;if(a){if(s){if(t.queryHash!==er(a,t.options))return!1}else if(!ei(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!i||i===t.state.fetchStatus)&&(!n||!!n(t))}function et(e,t){let{exact:r,status:s,predicate:i,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(r){if(es(t.options.mutationKey)!==es(n))return!1}else if(!ei(t.options.mutationKey,n))return!1}return(!s||t.state.status===s)&&(!i||!!i(t))}function er(e,t){return(t?.queryKeyHashFn||es)(e)}function es(e){return JSON.stringify(e,(e,t)=>eu(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function ei(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>ei(e[r],t[r]))}function en(e,t){if(e===t)return e;let r=eo(e)&&eo(t);if(r||eu(e)&&eu(t)){let s=r?e:Object.keys(e),i=s.length,n=r?t:Object.keys(t),a=n.length,o=r?[]:{},u=0;for(let i=0;i<a;i++){let a=r?i:n[i];(!r&&s.includes(a)||r)&&void 0===e[a]&&void 0===t[a]?(o[a]=void 0,u++):(o[a]=en(e[a],t[a]),o[a]===e[a]&&void 0!==e[a]&&u++)}return i===a&&u===i?e:o}return t}function ea(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function eo(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eu(e){if(!el(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!el(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function el(e){return"[object Object]"===Object.prototype.toString.call(e)}function ec(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?en(e,t):t}function eh(e,t,r=0){let s=[...e,t];return r&&s.length>r?s.slice(1):s}function ef(e,t,r=0){let s=[t,...e];return r&&s.length>r?s.slice(0,-1):s}var ed=Symbol();function ep(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==ed?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function ey(e,t,r){let s=e.flatMap(e=>e.split("."));if(!t&&(!r||"any"===r))return s.length?[s]:[];
1if("infinite"===r&&O(t)&&("direction"in t||"cursor"in t)){let{cursor:e,direction:r,...i}=t;return[s,{input:i,type:"infinite"}]}return[s,{...void 0!==t&&t!==ed&&{input:t},...r&&"any"!==r&&{type:r}}]}function em(e){return ey(e,void 0,"any")}let eb=["client","ssrContext","ssrState","abortOnUnmount"],eg=y.createContext?.(null);var ev=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(){}},ew=new class extends ev{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!$&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?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"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}},eO=(t=[],r=0,s=e=>{e()},i=e=>{e()},n=e=>setTimeout(e,0),{batch:e=>{let a;r++;try{a=e()}finally{let e;--r||(e=t,t=[],e.length&&n(()=>{i(()=>{e.forEach(e=>{s(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{r?t.push(e):n(()=>{s(e)})},setNotifyFunction:e=>{s=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{n=e}}),eR=new class extends ev{#s=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!$&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function eC(){let e,t,r=new Promise((r,s)=>{e=r,t=s});function s(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{s({status:"fulfilled",value:t}),e(t)},r.reject=e=>{s({status:"rejected",reason:e}),t(e)},r}function eq(e){return Math.min(1e3*2**e,3e4)}function eQ(e){return(e??"online")!=="online"||eR.isOnline()}var eP=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function eS(e){return e instanceof eP}function eE(e){let t,r=!1,s=0,i=!1,n=eC(),a=()=>ew.isFocused()&&("always"===e.networkMode||eR.isOnline())&&e.canRun(),o=()=>eQ(e.networkMode)&&e.canRun(),u=r=>{i||(i=!0,e.onSuccess?.(r),t?.(),n.resolve(r))},l=r=>{i||(i=!0,e.onError?.(r),t?.(),n.reject(r))},c=()=>new Promise(r=>{t=e=>{(i||a())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,i||e.onContinue?.()}),h=()=>{let t;if(i)return;let n=0===s?e.initialPromise:void 0;try{t=n??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(u).catch(t=>{if(i)return;let n=e.retry??3*!$,o=e.retryDelay??eq,u="function"==typeof o?o(s,t):o,f=!0===n||"number"==typeof n&&s<n||"function"==typeof n&&n(s,t);r||!f?l(t):(s++,e.onFail?.(s,t),new Promise(e=>{setTimeout(e,u)}).then(()=>a()?void 0:c()).then(()=>{r?l(t):h()}))})};return{promise:n,cancel:t=>{i||(l(new eP(t)),e.abort?.())},continue:()=>(t?.(),n),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?h():c().then(h),n)}}var ex=class{#i;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),J(this.gcTime)&&(this.#i=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($?1/0:3e5))}clearGcTimeout(){this.#i&&(clearTimeout(this.#i),this.#i=void 0)}},eI=class extends ex{#n;#a;#o;#u;#l;#c;#h;constructor(e){super(),this.#h=!1,this.#c=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#u=e.client,this.#o=this.#u.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#n=function(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,
1s=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#n,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(e){this.options={...this.#c,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#o.remove(this)}setData(e,t){let r=ec(this.state.data,e,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#l?.promise;return this.#l?.cancel(e),t?t.then(W).catch(W):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#n)}isActive(){return this.observers.some(e=>!1!==Z(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ed||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!X(this.state.dataUpdatedAt,e)}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#l&&(this.#h?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#o.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,s=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,r.signal)})},i=()=>{let e=ep(this.options,t),r={client:this.#u,queryKey:this.queryKey,meta:this.meta};return(s(r),this.#h=!1,this.options.persister)?this.options.persister(e,r,this):e(r)},n={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:i};s(n),this.options.behavior?.onFetch(n,this),this.#a=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==n.fetchOptions?.meta)&&this.#f({type:"fetch",meta:n.fetchOptions?.meta});let a=e=>{eS(e)&&e.silent||this.#f({type:"error",error:e}),eS(e)||(this.#o.config.onError?.(e,this),this.#o.config.onSettled?.(this.state.data,e,this)),this.scheduleGc()};return this.#l=eE({initialPromise:t?.initialPromise,fn:n.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e)return void a(Error(`${this.queryHash} data is undefined`));try{this.setData(e)}catch(e){a(e);return}this.#o.config.onSuccess?.(e,this),this.#o.config.onSettled?.(e,this.state.error,this),this.scheduleGc()},onError:a,onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:n.options.retry,retryDelay:n.options.retryDelay,networkMode:n.options.networkMode,canRun:()=>!0}),this.#l.start()}#f(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,...eD(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;if(eS(r)&&r.revert&&this.#a)return{...this.#a,fetchStatus:"idle"};
1return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),eO.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#o.notify({query:this,type:"updated",action:e})})}};function eD(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eQ(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var eM=class extends ev{constructor(e,t){super(),this.options=t,this.#u=e,this.#d=null,this.#p=eC(),this.options.experimental_prefetchInRender||this.#p.reject(Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#u;#y=void 0;#m=void 0;#b=void 0;#g;#v;#p;#d;#w;#O;#R;#C;#q;#Q;#P=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#y.addObserver(this),eT(this.#y,this.options)?this.#S():this.updateResult(),this.#E())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ej(this.#y,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ej(this.#y,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#I(),this.#y.removeObserver(this)}setOptions(e){let t=this.options,r=this.#y;if(this.options=this.#u.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof Z(this.options.enabled,this.#y))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#D(),this.#y.setOptions(this.options),t._defaulted&&!ea(this.options,t)&&this.#u.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#y,observer:this});let s=this.hasListeners();s&&ek(this.#y,r,this.options,t)&&this.#S(),this.updateResult(),s&&(this.#y!==r||Z(this.options.enabled,this.#y)!==Z(t.enabled,this.#y)||Y(this.options.staleTime,this.#y)!==Y(t.staleTime,this.#y))&&this.#M();let i=this.#T();s&&(this.#y!==r||Z(this.options.enabled,this.#y)!==Z(t.enabled,this.#y)||i!==this.#Q)&&this.#j(i)}getOptimisticResult(e){var t,r;let s=this.#u.getQueryCache().build(this.#u,e),i=this.createResult(s,e);return t=this,r=i,ea(t.getCurrentResult(),r)||(this.#b=i,this.#v=this.options,this.#g=this.#y.state),i}getCurrentResult(){return this.#b}trackResult(e,t){let r={};return Object.keys(e).forEach(s=>{Object.defineProperty(r,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),t?.(s),e[s])})}),r}trackProp(e){this.#P.add(e)}getCurrentQuery(){return this.#y}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#u.defaultQueryOptions(e),r=this.#u.getQueryCache().build(this.#u,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#S({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#b))}#S(e){this.#D();let t=this.#y.fetch(this.options,e);return e?.throwOnError||(t=t.catch(W)),t}#M(){this.#x();let e=Y(this.options.staleTime,this.#y);if($||this.#b.isStale||!J(e))return;let t=X(this.#b.dataUpdatedAt,e);this.#C=setTimeout(()=>{this.#b.isStale||this.updateResult()},t+1)}#T(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#y):this.options.refetchInterval)??!1}#j(e){this.#I(),this.#Q=e,!$&&!1!==Z(this.options.enabled,this.#y)&&J(this.#Q)&&0!==this.#Q&&(this.#q=setInterval(()=>{(this.options.refetchIntervalInBackground||ew.isFocused())&&this.#S()},this.#Q))}#E(){this.#M(),this.#j(this.#T())}#x(){this.#C&&(clearTimeout(this.#C),this.#C=void 0)}#I(){this.#q&&(clearInterval(this.#q),this.#q=void 0)}createResult(e,t){let r,s=this.#y,i=this.options,n=this.#b,a=this.#g,o=this.#v,u=e!==s?e.state:this.#m,{state:l}=e,c={...l},h=!1;if(t._optimisticResults){let r=this.hasListeners(),n=!r&&eT(e,t),a=r&&ek(e,s,t,i);(n||a)&&(c={...c,...eD(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:d,status:p}=c;r=c.data;let y=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===p){let e;n?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=n.data,y=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#R?.state.data,this.#R):t.placeholderData,void 0!==e&&(p="success",r=ec(n?.data,e,t),h=!0)}if(t.select&&void 0!==r&&!y)if(n&&r===a?.data&&t.select===this.#w)r=this.#O;else try{this.#w=t.select,r=t.select(r),r=ec(n?.data,r,t),this.#O=r,this.#d=null}catch(e){this.#d=e}this.#d&&(f=this.#d,r=this.#O,d=Date.now(),p="error");let m="fetching"===c.fetchStatus,b="pending"===p,g="error"===p,v=b&&m,w=void 0!==r,O={status:p,fetchStatus:c.fetchStatus,isPending:b,isSuccess:"success"===p,isError:g,isInitialLoading:v,isLoading:v,data:r,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdate
1Count:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!b,isLoadingError:g&&!w,isPaused:"paused"===c.fetchStatus,isPlaceholderData:h,isRefetchError:g&&w,isStale:eA(e,t),refetch:this.refetch,promise:this.#p};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===O.status?e.reject(O.error):void 0!==O.data&&e.resolve(O.data)},r=()=>{t(this.#p=O.promise=eC())},i=this.#p;switch(i.status){case"pending":e.queryHash===s.queryHash&&t(i);break;case"fulfilled":("error"===O.status||O.data!==i.value)&&r();break;case"rejected":("error"!==O.status||O.error!==i.reason)&&r()}}return O}updateResult(){let e=this.#b,t=this.createResult(this.#y,this.options);if(this.#g=this.#y.state,this.#v=this.options,void 0!==this.#g.data&&(this.#R=this.#y),ea(t,e))return;this.#b=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#P.size)return!0;let s=new Set(r??this.#P);return this.options.throwOnError&&s.add("error"),Object.keys(this.#b).some(t=>this.#b[t]!==e[t]&&s.has(t))};this.#k({listeners:r()})}#D(){let e=this.#u.getQueryCache().build(this.#u,this.options);if(e===this.#y)return;let t=this.#y;this.#y=e,this.#m=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#E()}#k(e){eO.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#b)}),this.#u.getQueryCache().notify({query:this.#y,type:"observerResultsUpdated"})})}};function eT(e,t){return!1!==Z(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&ej(e,t,t.refetchOnMount)}function ej(e,t,r){if(!1!==Z(t.enabled,e)){let s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&eA(e,t)}return!1}function ek(e,t,r,s){return(e!==t||!1===Z(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&eA(e,r)}function eA(e,t){return!1!==Z(t.enabled,e)&&e.isStaleByTime(Y(t.staleTime,e))}var eF=y.createContext((o=!1,{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}));function eU(e,t){return"function"==typeof e?e(...t):!!e}function eK(){}var ez=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&!t.isReset()&&(e.retryOnMount=!1)},eL=e=>{y.useEffect(()=>{e.clearReset()},[e])},e_=({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&void 0===e.data||eU(r,[e.error,s])),eN=y.createContext(!1);eN.Provider;var eH=(e,t)=>void 0===t.state.data,eB=e=>{let t=e.staleTime;e.suspense&&(e.staleTime="function"==typeof t?(...e)=>Math.max(t(...e),1e3):Math.max(t??1e3,1e3),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3)))},eV=(e,t)=>e.isLoading&&e.isFetching&&!t,eG=(e,t)=>e?.suspense&&t.isPending,e$=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function eW(e,t,r){let s=b(r),i=y.useContext(eN),n=y.useContext(eF),a=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",eB(a),ez(a,n),eL(n);let o=!s.getQueryCache().get(a.queryHash),[u]=y.useState(()=>new t(s,a)),l=u.getOptimisticResult(a),c=!i&&!1!==e.subscribed;if(y.useSyncExternalStore(y.useCallback(e=>{let t=c?u.subscribe(eO.batchCalls(e)):eK;return u.updateResult(),t},[u,c]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),y.useEffect(()=>{u.setOptions(a)},[a,u]),eG(a,l))throw e$(a,u,n);if(e_({result:l,errorResetBoundary:n,throwOnError:a.throwOnError,query:s.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw l.error;if(s.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!$&&eV(l,i)){let e=o?e$(a,u,n):s.getQueryCache().get(a.queryHash)?.promise;e?.catch(eK).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?l:u.trackResult(l)}var eJ=class extends ex{#A;#F;#l;constructor(e){super(),this.mutationId=e.mutationId,this.#F=e.mutationCache,this.#A=[],this.state=e.state||eX(),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.#A.includes(e)||(this.#A.push(e),this.clearGcTimeout(),this.#F.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#A=this.#A.filter(t=>t!==e),this.scheduleGc(),this.#F.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#A.length||("pending"===this.state.status?this.scheduleGc():this.#F.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#f({type:"continue"})};this.#l=eE({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#F.canRun(this)});let r="pending"===this.state.status,s=!this.#l.canStart();try{if(r)t();else{this.#f({type:"pending",variables:e,isPaused:s}),await this.#F.config.onMutate?.(e,this);let t=await this.options.onMutate?.(e);t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:s})}let i=await this.#l.start();return await this.#F.config.onSuccess?.(i,e,this.state.context,this),await this.options.onSuccess?.(i,e,this.state.context),await this.#F.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,e,this.state.context),this.#f({type:"success",data:i}),i}catch(t){try{throw await this.#F.config.onError?.(t,e,this.state.context,this),await this.options.onError?.(t,e,this.state.context),await this.#F.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,t,e,this.state.context),t}finally{this.#f({type:"error",error:t})}}finally{this.#F.runNext(this)}}#f(e){this.state=(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};
1case"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),eO.batch(()=>{this.#A.forEach(t=>{t.onMutationUpdate(e)}),this.#F.notify({mutation:this,type:"updated",action:e})})}};function eX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var eY=class extends ev{#u;#b=void 0;#U;#K;constructor(e,t){super(),this.#u=e,this.setOptions(t),this.bindMethods(),this.#z()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#u.defaultMutationOptions(e),ea(this.options,t)||this.#u.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#U,observer:this}),t?.mutationKey&&this.options.mutationKey&&es(t.mutationKey)!==es(this.options.mutationKey)?this.reset():this.#U?.state.status==="pending"&&this.#U.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#U?.removeObserver(this)}onMutationUpdate(e){this.#z(),this.#k(e)}getCurrentResult(){return this.#b}reset(){this.#U?.removeObserver(this),this.#U=void 0,this.#z(),this.#k()}mutate(e,t){return this.#K=t,this.#U?.removeObserver(this),this.#U=this.#u.getMutationCache().build(this.#u,this.options),this.#U.addObserver(this),this.#U.execute(e)}#z(){let e=this.#U?.state??eX();this.#b={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#k(e){eO.batch(()=>{if(this.#K&&this.hasListeners()){let t=this.#b.variables,r=this.#b.context;e?.type==="success"?(this.#K.onSuccess?.(e.data,t,r),this.#K.onSettled?.(e.data,null,t,r)):e?.type==="error"&&(this.#K.onError?.(e.error,t,r),this.#K.onSettled?.(void 0,e.error,t,r))}this.listeners.forEach(e=>{e(this.#b)})})}};function eZ(e){return{onFetch:(t,r)=>{let s=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,n=t.state.data?.pages||[],a=t.state.data?.pageParams||[],o={pages:[],pageParams:[]},u=0,l=async()=>{let r=!1,l=ep(t.options,t.fetchOptions),c=async(e,s,i)=>{if(r)return Promise.reject();if(null==s&&e.pages.length)return Promise.resolve(e);let n={client:t.client,queryKey:t.queryKey,pageParam:s,direction:i?"backward":"forward",meta:t.options.meta};Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)});let a=await l(n),{maxPages:o}=t.options,u=i?ef:eh;return{pages:u(e.pages,a,o),pageParams:u(e.pageParams,s,o)}};if(i&&n.length){let e="backward"===i,t={pages:n,pageParams:a},r=(e?e1:e0)(s,t);o=await c(t,r,e)}else{let t=e??n.length;do{let e=0===u?a[0]??s.initialPageParam:e0(s,o);if(u>0&&null==e)break;o=await c(o,e),u++}while(u<t)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function e0(e,{pages:t,pageParams:r}){let s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,r[s],r):void 0}function e1(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var e3=class extends eM{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:eZ()})}getOptimisticResult(e){return e.behavior=eZ(),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){var r,s;let{state:i}=e,n=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:u,isRefetchError:l}
1=n,c=i.fetchMeta?.fetchMore?.direction,h=u&&"forward"===c,f=a&&"forward"===c,d=u&&"backward"===c,p=a&&"backward"===c;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:!!(r=i.data)&&null!=e0(t,r),hasPreviousPage:!!(s=i.data)&&!!t.getPreviousPageParam&&null!=e1(t,s),isFetchNextPageError:h,isFetchingNextPage:f,isFetchPreviousPageError:d,isFetchingPreviousPage:p,isRefetchError:l&&!h&&!d,isRefetching:o&&!f&&!p}}};function e4(e,t){return e.filter(e=>!t.includes(e))}var e2=class extends ev{#u;#L;#_;#N;#A;#H;#B;#V;#G=[];constructor(e,t,r){super(),this.#u=e,this.#N=r,this.#_=[],this.#A=[],this.#L=[],this.setQueries(t)}onSubscribe(){1===this.listeners.size&&this.#A.forEach(e=>{e.subscribe(t=>{this.#$(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#A.forEach(e=>{e.destroy()})}setQueries(e,t){this.#_=e,this.#N=t,eO.batch(()=>{let e=this.#A,t=this.#W(this.#_);this.#G=t,t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let r=t.map(e=>e.observer),s=r.map(e=>e.getCurrentResult()),i=r.some((t,r)=>t!==e[r]);e.length===r.length&&!i||(this.#A=r,this.#L=s,this.hasListeners()&&(e4(e,r).forEach(e=>{e.destroy()}),e4(r,e).forEach(e=>{e.subscribe(t=>{this.#$(e,t)})}),this.#k()))})}getCurrentResult(){return this.#L}getQueries(){return this.#A.map(e=>e.getCurrentQuery())}getObservers(){return this.#A}getOptimisticResult(e,t){let r=this.#W(e),s=r.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[s,e=>this.#J(e??s,t),()=>this.#X(s,r)]}#X(e,t){return t.map((r,s)=>{let i=e[s];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#J(e,t){return t?(this.#H&&this.#L===this.#V&&t===this.#B||(this.#B=t,this.#V=this.#L,this.#H=en(this.#H,t(e))),this.#H):e}#W(e){let t=new Map(this.#A.map(e=>[e.options.queryHash,e])),r=[];return e.forEach(e=>{let s=this.#u.defaultQueryOptions(e),i=t.get(s.queryHash);i?r.push({defaultedQueryOptions:s,observer:i}):r.push({defaultedQueryOptions:s,observer:new eM(this.#u,s)})}),r}#$(e,t){let r=this.#A.indexOf(e);if(-1!==r){var s;let e;this.#L=(s=this.#L,(e=s.slice(0))[r]=t,e),this.#k()}}#k(){if(this.hasListeners()){let e=this.#H,t=this.#X(this.#L,this.#G);e!==this.#J(t,this.#N?.combine)&&eO.batch(()=>{this.listeners.forEach(e=>{e(this.#L)})})}}};function e9({queries:e,...t},r){let s=b(r),i=y.useContext(eN),n=y.useContext(eF),a=y.useMemo(()=>e.map(e=>{let t=s.defaultQueryOptions(e);return t._optimisticResults=i?"isRestoring":"optimistic",t}),[e,s,i]);a.forEach(e=>{eB(e),ez(e,n)}),eL(n);let[o]=y.useState(()=>new e2(s,a,t)),[u,l,c]=o.getOptimisticResult(a,t.combine),h=!i&&!1!==t.subscribed;y.useSyncExternalStore(y.useCallback(e=>h?o.subscribe(eO.batchCalls(e)):eK,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),y.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);let f=u.some((e,t)=>eG(a[t],e))?u.flatMap((e,t)=>{let r=a[t];if(r){let t=new eM(s,r);if(eG(r,e))return e$(r,t,n);eV(e,i)&&e$(r,t,n)}return[]}):[];if(f.length>0)throw Promise.all(f);let d=u.find((e,t)=>{let r=a[t];return r&&e_({result:e,errorResetBoundary:n,throwOnError:r.throwOnError,query:s.getQueryCache().get(r.queryHash),suspense:r.suspense})});if(d?.error)throw d.error;return l(c())}function e5(e,t,r){let s=e[0],i=e[1]?.input;return r&&(i={...i??{},...r.pageParam?{cursor:r.pageParam}:{},direction:r.direction}),[s.join("."),i,t?.trpc]}function e6(e){let t=e.path.join(".");return y.useMemo(()=>({path:t}),[t])}function e7(e){return Q(t=>{let r=t.path,s=r.join("."),[i,n]=t.args;return{queryKey:ey(r,i,"query"),queryFn:()=>e.query(s,i,n?.trpc),...n}})}class e8{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class te{constructor(e){this.generateIdentifier=e,this.kv=new e8}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class tt extends te{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){"object"==typeof t?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function tr(e,t){Object.entries(e).forEach(([e,r])=>t(r,e))}function ts(e,t){return -1!==e.indexOf(t)}function ti(e,t){for(let r=0;r<e.length;r++){let s=e[r];if(t(s))return s}}class tn{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return function(e,t){let r=function(e){if("values"in Object)return Object.values(e);let t=[];for(let r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}(e);if("find"in r)return r.find(t);for(let e=0;e<r.length;e++){let s=r[e];if(t(s))return s}}(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}}let ta=e=>void 0===e,to=e=>"object"==typeof e&&null!==e&&e!==Object.prototype&&(null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===Object.prototype),tu=e=>to(e)&&0===Object.keys(e).length,tl=e=>Array.isArray(e),tc=e=>e instanceof Map,th=e=>e instanceof Set,tf=e=>"Symbol"===Object.prototype.toString.call(e).slice(8,-1),td=e=>"number"==typeof e&&isNaN(e),tp=e=>e.replace(/\./g,"\\."),ty=e=>e.map(String).map(tp).join("."),tm=e=>{let t=[],r="";for(let s=0;s<e.length;s++){let i=e.charAt(s);if("\\"===i&&"."===e.charAt(s+1)){r+=".",s++;continue}
1if("."===i){t.push(r),r="";continue}r+=i}let s=r;return t.push(s),t};function tb(e,t,r,s){return{isApplicable:e,annotation:t,transform:r,untransform:s}}let tg=[tb(ta,"undefined",()=>null,()=>void 0),tb(e=>"bigint"==typeof e,"bigint",e=>e.toString(),e=>"u">typeof BigInt?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),tb(e=>e instanceof Date&&!isNaN(e.valueOf()),"Date",e=>e.toISOString(),e=>new Date(e)),tb(e=>e instanceof Error,"Error",(e,t)=>{let r={name:e.name,message:e.message};return t.allowedErrorProps.forEach(t=>{r[t]=e[t]}),r},(e,t)=>{let r=Error(e.message);return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(t=>{r[t]=e[t]}),r}),tb(e=>e instanceof RegExp,"regexp",e=>""+e,e=>new RegExp(e.slice(1,e.lastIndexOf("/")),e.slice(e.lastIndexOf("/")+1))),tb(th,"set",e=>[...e.values()],e=>new Set(e)),tb(tc,"map",e=>[...e.entries()],e=>new Map(e)),tb(e=>td(e)||e===1/0||e===-1/0,"number",e=>td(e)?"NaN":e>0?"Infinity":"-Infinity",Number),tb(e=>0===e&&1/e==-1/0,"number",()=>"-0",Number),tb(e=>e instanceof URL,"URL",e=>e.toString(),e=>new URL(e))];function tv(e,t,r,s){return{isApplicable:e,annotation:t,transform:r,untransform:s}}let tw=tv((e,t)=>!!tf(e)&&!!t.symbolRegistry.getIdentifier(e),(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{let s=r.symbolRegistry.getValue(t[1]);if(!s)throw Error("Trying to deserialize unknown symbol");return s}),tO=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),tR=tv(e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{let r=tO[t[1]];if(!r)throw Error("Trying to deserialize unknown typed array");return new r(e)});function tC(e,t){return!!e?.constructor&&!!t.classRegistry.getIdentifier(e.constructor)}let tq=tv(tC,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};let s={};return r.forEach(t=>{s[t]=e[t]}),s},(e,t,r)=>{let s=r.classRegistry.getValue(t[1]);if(!s)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(s.prototype),e)}),tQ=tv((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{let s=r.customTransformerRegistry.findByName(t[1]);if(!s)throw Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),tP=[tq,tw,tQ,tR],tS=(e,t)=>{let r=ti(tP,r=>r.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};let s=ti(tg,r=>r.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},tE={};tg.forEach(e=>{tE[e.annotation]=e});let tx=(e,t)=>{if(t>e.size)throw Error("index out of bounds");let r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function tI(e){if(ts(e,"__proto__"))throw Error("__proto__ is not allowed as a property");if(ts(e,"prototype"))throw Error("prototype is not allowed as a property");if(ts(e,"constructor"))throw Error("constructor is not allowed as a property")}let tD=(e,t,r)=>{if(tI(t),0===t.length)return r(e);let s=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(tl(s))s=s[+r];else if(to(s))s=s[r];else if(th(s))s=tx(s,+r);else if(tc(s)){if(e===t.length-2)break;let i=+r,n=0==+t[++e]?"key":"value",a=tx(s,i);switch(n){case"key":s=a;break;case"value":s=s.get(a)}}}let i=t[t.length-1];if(tl(s)?s[+i]=r(s[+i]):to(s)&&(s[i]=r(s[i])),th(s)){let e=tx(s,+i),t=r(e);e!==t&&(s.delete(e),s.add(t))}if(tc(s)){let e=tx(s,+t[t.length-2]);switch(0==+i?"key":"value"){case"key":{let t=r(e);s.set(t,s.get(e)),t!==e&&s.delete(e);break}case"value":s.set(e,r(s.get(e)))}}return e},tM=(e,t,r,s,i=[],n=[],a=new Map)=>{let o=(e=>"boolean"==typeof e||null===e||ta(e)||"number"==typeof e&&!isNaN(e)||"string"==typeof e||tf(e))(e);if(!o){let r;(r=t.get(e))?r.push(i):t.set(e,[i]);let n=a.get(e);if(n)return s?{transformedValue:null}:n}if(!(to(e)||tl(e)||tc(e)||th(e)||tC(e,r))){let t=tS(e,r),s=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return o||a.set(e,s),s}if(ts(n,e))return{transformedValue:null};let u=tS(e,r),l=u?.value??e,c=tl(l)?[]:{},h={};tr(l,(o,u)=>{if("__proto__"===u||"constructor"===u||"prototype"===u)throw Error(`Detected property ${u}. This is a prototype pollution risk, please remove it from your object.`);let l=tM(o,t,r,s,[...i,u],[...n,e],a);c[u]=l.transformedValue,tl(l.annotations)?h[u]=l.annotations:to(l.annotations)&&tr(l.annotations,(e,t)=>{h[tp(u)+"."+t]=e})});let f=tu(h)?{transformedValue:c,annotations:u?[u.type]:void 0}:{transformedValue:c,annotations:u?[u.type,h]:h};return o||a.set(e,f),f};function tT(e){return Object.prototype.toString.call(e).slice(8,-1)}function tj(e){return"Array"===tT(e)}class tk{constructor({dedupe:e=!1}={}){this.classRegistry=new tt,this.symbolRegistry=new te(e=>e.description??""),this.customTransformerRegistry=new tn,this.allowedErrorProps=[],this.dedupe=e}serialize(e){var t;let r,s,i=new Map,n=tM(e,i,this,this.dedupe),a={json:n.transformedValue};n.annotations&&(a.meta={...a.meta,values:n.annotations});let o=(t=this.dedupe,r={}
1,(i.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[i,...n]=e;0===i.length?s=n.map(ty):r[ty(i)]=n.map(ty)}),s)?tu(r)?[s]:[s,r]:tu(r)?void 0:r);return o&&(a.meta={...a.meta,referentialEqualities:o}),a}deserialize(e){var t,r,s;let{json:i,meta:n}=e,a=function e(t,r={}){return tj(t)?t.map(t=>e(t,r)):!function(e){if("Object"!==tT(e))return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}(t)?t:[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].reduce((s,i)=>{var n;let a;if(tj(r.props)&&!r.props.includes(i))return s;let o=e(t[i],r);return n=r.nonenumerable,"enumerable"==(a=({}).propertyIsEnumerable.call(t,i)?"enumerable":"nonenumerable")&&(s[i]=o),n&&"nonenumerable"===a&&Object.defineProperty(s,i,{value:o,enumerable:!1,writable:!0,configurable:!0}),s},{})}(i);return n?.values&&(t=a,r=n.values,s=this,function e(t,r,s=[]){if(!t)return;if(!tl(t))return void tr(t,(t,i)=>e(t,r,[...s,...tm(i)]));let[i,n]=t;n&&tr(n,(t,i)=>{e(t,r,[...s,...tm(i)])}),r(i,s)}(r,(e,r)=>{t=tD(t,r,t=>((e,t,r)=>{if(tl(t))switch(t[0]){case"symbol":return tw.untransform(e,t,r);case"class":return tq.untransform(e,t,r);case"custom":return tQ.untransform(e,t,r);case"typed-array":return tR.untransform(e,t,r);default:throw Error("Unknown transformation: "+t)}{let s=tE[t];if(!s)throw Error("Unknown transformation: "+t);return s.untransform(e,r)}})(t,e,s))}),a=t),n?.referentialEqualities&&(a=function(e,t){function r(t,r){let s=((e,t)=>{tI(t);for(let r=0;r<t.length;r++){let s=t[r];if(th(e))e=tx(e,+s);
1else if(tc(e)){let i=+s,n=0==+t[++r]?"key":"value",a=tx(e,i);switch(n){case"key":e=a;break;case"value":e=e.get(a)}}else e=e[s]}return e})(e,tm(r));t.map(tm).forEach(t=>{e=tD(e,t,()=>s)})}if(tl(t)){let[s,i]=t;s.forEach(t=>{e=tD(e,tm(t),()=>e)}),i&&tr(i,r)}else tr(t,r);return e}(a,n.referentialEqualities)),a}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}tk.defaultInstance=new tk,tk.serialize=tk.defaultInstance.serialize.bind(tk.defaultInstance),tk.deserialize=tk.defaultInstance.deserialize.bind(tk.defaultInstance),tk.stringify=tk.defaultInstance.stringify.bind(tk.defaultInstance),tk.parse=tk.defaultInstance.parse.bind(tk.defaultInstance),tk.registerClass=tk.defaultInstance.registerClass.bind(tk.defaultInstance),tk.registerSymbol=tk.defaultInstance.registerSymbol.bind(tk.defaultInstance),tk.registerCustom=tk.defaultInstance.registerCustom.bind(tk.defaultInstance),tk.allowErrorProps=tk.defaultInstance.allowErrorProps.bind(tk.defaultInstance),tk.serialize,tk.deserialize,tk.stringify,tk.parse,tk.registerClass,tk.registerCustom,tk.registerSymbol,tk.allowErrorProps;var tA=class extends ev{constructor(e={}){super(),this.config=e,this.#_=new Map}#_;build(e,t,r){let s=t.queryKey,i=t.queryHash??er(s,t),n=this.get(i);return n||(n=new eI({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(n)),n}add(e){this.#_.has(e.queryHash)||(this.#_.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#_.get(e.queryHash);t&&(e.destroy(),t===e&&this.#_.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){eO.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#_.get(e)}getAll(){return[...this.#_.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ee(e,t)):t}notify(e){eO.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){eO.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){eO.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},tF=class extends ev{constructor(e={}){super(),this.config=e,this.#Y=new Set,this.#Z=new Map,this.#ee=0}#Y;#Z;#ee;build(e,t,r){let s=new eJ({mutationCache:this,mutationId:++this.#ee,options:e.defaultMutationOptions(t),state:r});return this.add(s),s}add(e){this.#Y.add(e);let t=tU(e);if("string"==typeof t){let r=this.#Z.get(t);r?r.push(e):this.#Z.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#Y.delete(e)){let t=tU(e);if("string"==typeof t){let r=this.#Z.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#Z.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=tU(e);if("string"!=typeof t)return!0;{let r=this.#Z.get(t),s=r?.find(e=>"pending"===e.state.status);return!s||s===e}}runNext(e){let t=tU(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#Z.get(t)?.find(t=>
vendor: 4,666 bytes, line 1
1t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){eO.batch(()=>{this.#Y.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#Y.clear(),this.#Z.clear()})}getAll(){return Array.from(this.#Y)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>et(t,e))}findAll(e={}){return this.getAll().filter(t=>et(e,t))}notify(e){eO.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return eO.batch(()=>Promise.all(e.map(e=>e.continue().catch(W))))}};function tU(e){return e.options.scope?.id}var tK=class{#et;#F;#c;#er;#es;#ei;#en;#ea;constructor(e={}){this.#et=e.queryCache||new tA,this.#F=e.mutationCache||new tF,this.#c=e.defaultOptions||{},this.#er=new Map,this.#es=new Map,this.#ei=0}mount(){this.#ei++,1===this.#ei&&(this.#en=ew.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#et.onFocus())}),this.#ea=eR.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#et.onOnline())}))}unmount(){this.#ei--,0===this.#ei&&(this.#en?.(),this.#en=void 0,this.#ea?.(),this.#ea=void 0)}isFetching(e){return this.#et.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#F.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#et.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#et.build(this,t),s=r.state.data;return void 0===s?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Y(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#et.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let s=this.defaultQueryOptions({queryKey:e}),i=this.#et.get(s.queryHash),n=i?.state.data,a="function"==typeof t?t(n):t;if(void 0!==a)return this.#et.build(this,s).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return eO.batch(()=>this.#et.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#et.get(t.queryHash)?.state}removeQueries(e){let t=this.#et;eO.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#et;return eO.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(eO.batch(()=>this.#et.findAll(e).map(e=>e.cancel(r)))).then(W).catch(W)}invalidateQueries(e,t={}){return eO.batch(()=>(this.#et.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 r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(eO.batch(()=>this.#et.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(W)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(W)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#et.build(this,t);return r.isStaleByTime(Y(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(W).catch(W)}fetchInfiniteQuery(e){return e.behavior=eZ(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(W).catch(W)}ensureInfiniteQueryData(e){return e.behavior=eZ(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eR.isOnline()?this.#F.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#et}getMutationCache(){return this.#F}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#er.set(es(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#er.values()],r={};return t.forEach(t=>{ei(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#es.set(es(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#es.values()],r={};return t.forEach(t=>{ei(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=er(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ed&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#et.clear(),this.#F.clear()}};
1let tz=(h=c=function(e){let t=e?.overrides?.useMutation?.onSuccess??(e=>e.originalFn()),r=e?.context??eg;function s(){let e=y.useContext(r);if(!e)throw Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return e}function i(e,t){let{queryClient:r,ssrState:i}=s();return i&&"mounted"!==i&&r.getQueryCache().find({queryKey:e})?.state.status==="error"?{retryOnMount:!1,...t}:t}return{Provider:e=>{let{abortOnUnmount:t=!1,client:s,queryClient:i,ssrContext:n}=e,[a,o]=y.useState(e.ssrState??!1),u=y.useMemo(()=>(function(e){let{client:t,queryClient:r}=e,s=t instanceof x?t:t.__untypedClient;return{fetchQuery:(e,t)=>r.fetchQuery({...t,queryKey:e,queryFn:()=>s.query(...e5(e,t))}),fetchInfiniteQuery:(e,t)=>r.fetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r,direction:i})=>s.query(...e5(e,t,{pageParam:r,direction:i})),initialPageParam:t?.initialCursor??null}),prefetchQuery:(e,t)=>r.prefetchQuery({...t,queryKey:e,queryFn:()=>s.query(...e5(e,t))}),prefetchInfiniteQuery:(e,t)=>r.prefetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r,direction:i})=>s.query(...e5(e,t,{pageParam:r,direction:i})),initialPageParam:t?.initialCursor??null}),ensureQueryData:(e,t)=>r.ensureQueryData({...t,queryKey:e,queryFn:()=>s.query(...e5(e,t))}),invalidateQueries:(e,t,s)=>r.invalidateQueries({...t,queryKey:e},s),resetQueries:(e,t,s)=>r.resetQueries({...t,queryKey:e},s),refetchQueries:(e,t,s)=>r.refetchQueries({...t,queryKey:e},s),cancelQuery:(e,t)=>r.cancelQueries({queryKey:e},t),setQueryData:(e,t,s)=>r.setQueryData(e,t,s),setQueriesData:(e,t,s,i)=>r.setQueriesData({...t,queryKey:e},s,i),getQueryData:e=>r.getQueryData(e),setInfiniteQueryData:(e,t,s)=>r.setQueryData(e,t,s),getInfiniteQueryData:e=>r.getQueryData(e),setMutationDefaults:(t,i)=>{let n=t[0];return r.setMutationDefaults(t,"function"==typeof i?i({canonicalMutationFn:t=>s.mutation(...e5([n,{input:t}],e))}):i)},getMutationDefaults:e=>r.getMutationDefaults(e),isMutating:e=>r.isMutating({...e,exact:!0})}})({client:s,queryClient:i}),[s,i]),l=y.useMemo(()=>({abortOnUnmount:t,queryClient:i,client:s,ssrContext:n??null,ssrState:a,...u}),[t,s,u,i,n,a]);return y.useEffect(()=>{o(e=>!!e&&"mounted")},[]),y.createElement(r.Provider,{value:l},e.children)},createClient:e=>new x(e),useContext:s,useUtils:s,useQuery:function(t,r,n){let{abortOnUnmount:a,client:o,ssrState:u,queryClient:l,prefetchQuery:c}=s(),h=ey(t,r,"query"),f=l.getQueryDefaults(h),d=r===ed;!("u"<typeof window)||"prepass"!==u||n?.trpc?.ssr===!1||(n?.enabled??f?.enabled)===!1||d||l.getQueryCache().find({queryKey:h})||c(h,n);let p=i(h,{...f,...n}),y=n?.trpc?.abortOnUnmount??e?.abortOnUnmount??a,m=eW({...p,queryKey:h,queryFn:d?r:async e=>{let t={...p,trpc:{...p?.trpc,...y?{signal:e.signal}:{signal:null}}},r=await o.query(...e5(h,t));if(R&&O(r)&&Symbol.asyncIterator in r){let e=l.getQueryCache().build(l,{queryKey:h});e.setState({data:[],status:"success"});let t=[];for await(let s of r)t.push(s),e.setState({data:[...t]});return t}return r}},eM,l);return m.trpc=e6({path:t}),m},usePrefetchQuery:function(t,r,i){var n;let a,o=s(),u=ey(t,r,"query"),l=r===ed,c=i?.trpc?.abortOnUnmount??e?.abortOnUnmount??o.abortOnUnmount;n={...i,queryKey:u,queryFn:l?r:e=>{let t={trpc:{...c?{signal:e.signal}:{}}};return o.client.query(...e5(u,t))}},(a=b(void 0)).getQueryState(n.queryKey)||a.prefetchQuery(n)},useSuspenseQuery:function(t,r,i){var n,a;let o=s(),u=ey(t,r,"query"),l=i?.trpc?.abortOnUnmount??e?.abortOnUnmount??o.abortOnUnmount,c=(n={...i,queryKey:u,queryFn:e=>{let t={trpc:{...l?{signal:e.signal}:{signal:null}}};return o.client.query(...e5(u,t))}},a=o.queryClient,eW({...n,enabled:!0,suspense:!0,throwOnError:eH,placeholderData:void 0},eM,a));return c.trpc=e6({path:t}),[c.data,c]},useQueries:e=>{let{ssrState:t,queryClient:r,prefetchQuery:i,client:n}=s(),a=e(e7(n));if("u"<typeof window&&"prepass"===t)for(let e of a)e.trpc?.ssr===!1||r.getQueryCache().find({queryKey:e.queryKey})||i(e.queryKey,e);return e9({queries:a.map(e=>({...e,queryKey:e.queryKey}))},r)},useSuspenseQueries:e=>{var t;let{queryClient:r,client:i}=s(),n=(t={queries:e(e7(i)).map(e=>({...e,queryKey:e.queryKey}))},e9({...t,queries:t.queries.map(e=>({...e,suspense:!0,throwOnError:eH,enabled:!0,placeholderData:void 0}))},r));return[n.map(e=>e.data),n]},useMutation:function(e,r){let{client:i,queryClient:n}=s(),a=em(e),o=n.defaultMutationOptions(n.getMutationDefaults(a)),u=function(e,t){let r=b
1(t),[s]=y.useState(()=>new eY(r,e));y.useEffect(()=>{s.setOptions(e)},[s,e]);let i=y.useSyncExternalStore(y.useCallback(e=>s.subscribe(eO.batchCalls(e)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),n=y.useCallback((e,t)=>{s.mutate(e,t).catch(eK)},[s]);if(i.error&&eU(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}({...r,mutationKey:a,mutationFn:t=>i.mutation(...e5([e,{input:t}],r)),onSuccess:(...e)=>t({originalFn:()=>r?.onSuccess?.(...e)??o?.onSuccess?.(...e),queryClient:n,meta:r?.meta??o?.meta??{}})},n);return u.trpc=e6({path:e}),u},useSubscription:function(e,t,r){let i=r?.enabled??t!==ed,n=es(ey(e,t,"any")),{client:a}=s(),o=y.useRef(r);o.current=r,y.useEffect(()=>{if(!i)return;let r=!1,s=a.subscription(e.join("."),t??void 0,{onStarted:()=>{r||o.current.onStarted?.()},onData:e=>{r||o.current.onData(e)},onError:e=>{r||o.current.onError?.(e)}});return()=>{r=!0,s.unsubscribe()}},[n,i])},useInfiniteQuery:function(e,t,r){let{client:n,ssrState:a,prefetchInfiniteQuery:o,queryClient:u,abortOnUnmount:l}=s(),c=ey(e,t,"infinite"),h=u.getQueryDefaults(c),f=t===ed;!("u"<typeof window)||"prepass"!==a||r?.trpc?.ssr===!1||(r?.enabled??h?.enabled)===!1||f||u.getQueryCache().find({queryKey:c})||o(c,{...h,...r});let d=i(c,{...h,...r}),p=r?.trpc?.abortOnUnmount??l,y=eW({...d,initialPageParam:r.initialCursor??null,persister:r.persister,queryKey:c,queryFn:f?t:e=>{let t={...d,trpc:{...d?.trpc,...p?{signal:e.signal}:{signal:null}}};return n.query(...e5(c,t,{pageParam:e.pageParam??r.initialCursor,direction:e.direction}))}},e3,u);return y.trpc=e6({path:e}),y},usePrefetchInfiniteQuery:function(e,t,r){var n;let a,o=s(),u=ey(e,t,"infinite"),l=o.queryClient.getQueryDefaults(u),c=t===ed,h=i(u,{...l,...r}),f=r?.trpc?.abortOnUnmount??o.abortOnUnmount;n={...r,initialPageParam:r.initialCursor??null,queryKey:u,queryFn:c?t:e=>{let t={...h,trpc:{...h?.trpc,...f?{signal:e.signal}:{}}};return o.client.query(...e5(u,t,{pageParam:e.pageParam??r.initialCursor,direction:e.direction}))}},(a=b(void 0)).getQueryState(n.queryKey)||a.prefetchInfiniteQuery(n)},useSuspenseInfiniteQuery:function(e,t,r){var n,a;let o=s(),u=ey(e,t,"infinite"),l=o.queryClient.getQueryDefaults(u),c=i(u,{...l,...r}),h=r?.trpc?.abortOnUnmount??o.abortOnUnmount,f=(n={...r,initialPageParam:r.initialCursor??null,queryKey:u,queryFn:e=>{let t={...c,trpc:{...c?.trpc,...h?{signal:e.signal}:{}}};return o.client.query(...e5(u,t,{pageParam:e.pageParam??r.initialCursor,direction:e.direction}))}},a=o.queryClient,eW({...n,enabled:!0,suspense:!0,throwOnError:eH},e3,a));return f.trpc=e6({path:e}),[f.data,f]}}}(void 0),l=Q(({path:e,args:t})=>{let r=[...e],s=r.pop();if("useMutation"===s)return h[s](r,...t);if("_def"===s)return{path:r};let[i,...n]=t,a=n[0]||{};return h[s](r,i,a)}),P(e=>"useContext"===e||"useUtils"===e?()=>{let e=c.useUtils();return y.useMemo(()=>{var t;let r,s,i;return t=e.client,r=Q(({path:e,args:r})=>{let s=[...e],i=I[s.pop()],n=s.join(".");return t[i](n,...r)}),s=P(e=>t.hasOwnProperty(e)?t[e]:"__untypedClient"===e?t:r[e]),i=Q(t=>{let r=[...t.path],s=r.pop(),i=[...t.args],n=i.shift(),a=ey(r,n,(e=>{switch(e){case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}})(s));return({fetch:()=>e.fetchQuery(a,...i),fetchInfinite:()=>e.fetchInfiniteQuery(a,i[0]),prefetch:()=>e.prefetchQuery(a,...i),prefetchInfinite:()=>e.prefetchInfiniteQuery(a,i[0]),ensureData:()=>e.ensureQueryData(a,...i),invalidate:()=>e.invalidateQueries(a,...i),reset:()=>e.resetQueries(a,...i),refetch:()=>e.refetchQueries(a,...i),cancel:()=>e.cancelQuery(a,...i),setData:()=>{e.setQueryData(a,i[0],i[1])},setQueriesData:()=>e.setQueriesData(a,i[0],i[1],i[2]),setInfiniteData:()=>{e.setInfiniteQueryData(a,i[0],i[1])},getData:()=>e.getQueryData(a),getInfiniteData:()=>e.getInfiniteQueryData(a),setMutationDefaults:()=>e.setMutationDefaults(em(r),n),getMutationDefaults:()=>e.getMutationDefaults(em(r)),isMutating:()=>e.isMutating({mutationKey:em(r)})})[s]()}),P(t=>"client"===t?s:eb.includes(t)?e[t]:i[t])},[e])}:c.hasOwnProperty(e)?c[e]:l[e]));e.s(["TRPCReactProvider",0,function(e){let t=u??=new tK({defaultOptions:{queries:{staleTime:3e4},dehydrate:{serializeData:tk.serialize,shouldDehydrateQuery:e=>"success"===e.state.status||"pending"===e.state.status},hydrate:{deserializeData:tk.deserialize}}}),[r]=(0,y.useState)(()=>{var e,t,r;let s,i,n;return tz.createClient({links:[function(e={}){let{enabled:t=()=>!0}=e,r=e.colorMode??("u"<typeof window?"ansi":"css"),s=e.withContext??"css"===r,{logger:i=(({c:e=console,colorMode:t="css",withContext:r})=>s=>{let i=s.input,n=!("u"<typeof FormData)&&i instanceof FormData?Object.fromEntries(i):i,{parts:a,args:o}=function(e){let{direction:t,type:r,withContext:s,path:i,id:n,input:a}=e,o=[],u=[];
1if("none"===e.colorMode)o.push("up"===t?">>":"<<",r,`#${n}`,i);else if("ansi"===e.colorMode){let[e,s]=V[r],[a,u]=G[r];o.push("up"===t?e:s,"up"===t?">>":"<<",r,"up"===t?a:u,`#${n}`,i,"\x1b[0m")}else{let[e,s]=B[r],a=` 2 background-color: #${"up"===t?e:s}; 3 color: ${"up"===t?"black":"white"}; 4 padding: 2px; 5 `;o.push("%c","up"===t?">>":"<<",r,`#${n}`,`%c${i}%c`,"%O"),u.push(a,`${a}; font-weight: bold;`,`${a}; font-weight: normal;`)}return"up"===t?u.push(s?{input:a,context:e.context}:{input:a}):u.push({input:a,result:e.result,elapsedMs:e.elapsedMs,...s&&{context:e.context}}),{parts:o,args:u}}({...s,colorMode:t,input:n,withContext:r});e["down"===s.direction&&s.result&&(s.result instanceof Error||"error"in s.result.result)?"error":"log"].apply(null,[a.join(" ")].concat(o))})({c:e.console,colorMode:r,withContext:s})}=e;return()=>({op:e,next:r})=>v(s=>{var n;t({...e,direction:"up"})&&i({...e,direction:"up"});let a=Date.now();function o(r){let s=Date.now()-a;t({...e,direction:"down",result:r})&&i({...e,direction:"down",elapsedMs:s,result:r})}return r(e).pipe((n={next(e){o(e)},error(e){o(e)}},e=>v(t=>e.subscribe({next(e){n.next?.(e),t.next(e)},error(e){n.error?.(e),t.error(e)},complete(){n.complete?.(),t.complete()}})))).subscribe(s)})}({enabled:e=>"down"===e.direction&&e.result instanceof Error}),(s={url:(t=e={transformer:tk,url:window.location.origin+"/api/trpc",headers:()=>{let e=new Headers;return e.set("x-trpc-source","nextjs-react"),e}}).url.toString(),fetch:t.fetch,transformer:(r=t.transformer)?"input"in r?r:{input:r,output:r}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}},methodOverride:t.methodOverride},i=e.maxURLLength??1/0,n=e.maxItems??1/0,()=>{let t=t=>({validate(e){if(i===1/0&&n===1/0)return!0;if(e.length>n)return!1;let r=e.map(e=>e.path).join(","),a=e.map(e=>e.input);return k({...s,type:t,path:r,inputs:a,signal:null}).length<=i},async fetch(r){let i=r.map(e=>e.path).join(","),n=r.map(e=>e.input),a=function(...e){let t=new AbortController,r=e.length,s=0,i=()=>{++s===r&&t.abort()};for(let t of e)t?.aborted?i():t?.addEventListener("abort",i,{once:!0});return t.signal}(...r.map(e=>e.signal)),o=new AbortController,u=U({...s,signal:function(...e){let t=new AbortController;for(let r of e)r?.aborted?t.abort():r?.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}(a,o.signal),type:t,contentTypeHeader:"application/json",trpcAcceptHeader:"application/jsonl",getUrl:k,getBody:A,inputs:n,path:i,headers:()=>e.headers?"function"==typeof e.headers?e.headers({opList:r}):e.headers:{}}),l=await u,[c]=await H({from:l.body,deserialize:s.transformer.output.deserialize,formatError(e){let t=e.error;return E.from({error:t})},abortController:o});return Object.keys(r).map(async e=>{let t=await Promise.resolve(c[e]);if("result"in t){let e=await Promise.resolve(t.result);t={result:{data:await Promise.resolve(e.data)}}}return{json:t,meta:{response:l}}})}}),r={query:M(t("query")),mutation:M(t("mutation"))};return({op:e})=>v(t=>{let s;if("subscription"===e.type)throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");return r[e.type].load(e).then(e=>{if(s=e,"error"in e.json)return void t.error(E.from(e.json,{meta:e.meta}));if("result"in e.json){t.next({context:e.meta,result:e.json.result}),t.complete();return}t.complete()}).catch(e=>{t.error(E.from(e,{meta:s?.meta}))}),()=>{}})})]})});return(0,p.jsx)(g,{client:t,children:(0,p.jsx)(tz.Provider,{client:r,queryClient:t,children:e.children})})},"api",0,tz],10955)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.