@membank/dashboard 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as e,B as n}from"./index-O2KJf81b.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),e.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),a=e.forwardRef((t,l)=>e.createElement(n,{ref:l,...t,weights:r}));a.displayName="MagnifyingGlassIcon";const c=a;export{c as f};
1
+ import{r as e,B as n}from"./index-DZxM00o8.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),e.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),a=e.forwardRef((t,l)=>e.createElement(n,{ref:l,...t,weights:r}));a.displayName="MagnifyingGlassIcon";const c=a;export{c as f};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/memories-3VR4rZ5U.js","assets/MagnifyingGlass.es-B8P_LfEH.js","assets/native-select-DqP_P0PQ.js","assets/memories.index-ByQeKvpK.js","assets/memories._id-D3XqSd0M.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/memories-ja38P73o.js","assets/MagnifyingGlass.es-CGxS0MwI.js","assets/native-select-BpuM7pgJ.js","assets/memories.index-DUtHo-Be.js","assets/memories._id-DeaZiiQb.js"])))=>i.map(i=>d[i]);
2
2
  var WE=Object.defineProperty;var O1=e=>{throw TypeError(e)};var eC=(e,t,s)=>t in e?WE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Qu=(e,t,s)=>eC(e,typeof t!="symbol"?t+"":t,s),bp=(e,t,s)=>t.has(e)||O1("Cannot "+s);var E=(e,t,s)=>(bp(e,t,"read from private field"),s?s.call(e):t.get(e)),pe=(e,t,s)=>t.has(e)?O1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ue=(e,t,s,r)=>(bp(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),Ae=(e,t,s)=>(bp(e,t,"access private method"),s);var Nl=(e,t,s,r)=>({set _(o){ue(e,t,o,s)},get _(){return E(e,t,r)}});function tC(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();function ew(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sp={exports:{}},Il={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -78,7 +78,7 @@ Available comparison functions: eq, gt, gte, lt, lte, and, or, not, like, ilike,
78
78
  Instead, use a query builder function:
79
79
  const { data } = useLiveQuery((q) => q.from({ c: myCollection }).select(({ c }) => c))
80
80
 
81
- Or switch to syncMode "eager" if you want all data to sync automatically.`),e.startSyncImmediate(),r.current=e,l.current=e;else if(typeof e=="function"){const S=new Ct,x=e(S);if(x==null)r.current=null;else if(x instanceof vg)x.startSyncImmediate(),r.current=x;else if(x instanceof Ct)r.current=em({query:e,startSync:!0,gcTime:tm});else if(x&&typeof x=="object")r.current=em({startSync:!0,gcTime:tm,...x});else throw new Error(`useLiveQuery callback must return a QueryBuilder, LiveQueryCollectionConfig, Collection, undefined, or null. Got: ${typeof x}`);o.current=[...t]}else r.current=em({startSync:!0,gcTime:tm,...e}),o.current=[...t];h&&(u.current=0,f.current=null);const p=z.useRef(null);(!p.current||h)&&(p.current=S=>{if(!r.current)return()=>{};const x=r.current.subscribeChanges(()=>{u.current+=1,S()});return r.current.status==="ready"&&(u.current+=1,S()),()=>{x.unsubscribe()}});const y=z.useRef(null);(!y.current||h)&&(y.current=()=>{const S=u.current,x=r.current;return(!f.current||f.current.version!==S||f.current.collection!==x)&&(f.current={collection:x,version:S}),f.current});const m=z.useSyncExternalStore(p.current,y.current),b=z.useRef(null),_=z.useRef(null);if(!b.current||b.current.version!==m.version||b.current.collection!==m.collection){if(!m.collection)_.current={state:void 0,data:void 0,collection:void 0,status:"disabled",isLoading:!1,isReady:!0,isIdle:!1,isError:!1,isCleanedUp:!1,isEnabled:!1};else{const S=Array.from(m.collection.entries()),T=m.collection.config.singleResult;let M=null,O=null;_.current={get state(){return M||(M=new Map(S)),M},get data(){return O||(O=S.map(([,R])=>R)),T?O[0]:O},collection:m.collection,status:m.collection.status,isLoading:m.collection.status==="loading",isReady:m.collection.status==="ready",isIdle:m.collection.status==="idle",isError:m.collection.status==="error",isCleanedUp:m.collection.status==="cleaned-up",isEnabled:!0}}b.current=m}return _.current}var Ic=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(){}},io,nr,Ca,VS,_z=(VS=class extends Ic{constructor(){super();pe(this,io);pe(this,nr);pe(this,Ca);ue(this,Ca,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){E(this,nr)||this.setEventListener(E(this,Ca))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,nr))==null||t.call(this),ue(this,nr,void 0))}setEventListener(t){var s;ue(this,Ca,t),(s=E(this,nr))==null||s.call(this),ue(this,nr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,io)!==t&&(ue(this,io,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof E(this,io)=="boolean"?E(this,io):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},io=new WeakMap,nr=new WeakMap,Ca=new WeakMap,VS),Cg=new _z,xz={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},sr,Qm,HS,Ez=(HS=class{constructor(){pe(this,sr,xz);pe(this,Qm,!1)}setTimeoutProvider(e){ue(this,sr,e)}setTimeout(e,t){return E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,Qm=new WeakMap,HS),Yr=new Ez;function Cz(e){setTimeout(e,0)}var Rz=typeof window>"u"||"Deno"in globalThis;function us(){}function Az(e,t){return typeof e=="function"?e(t):e}function Mm(e){return typeof e=="number"&&e>=0&&e!==1/0}function o_(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yr(e,t){return typeof e=="function"?e(t):e}function Kn(e,t){return typeof e=="function"?e(t):e}function pS(e,t){const{type:s="all",exact:r,fetchStatus:o,predicate:l,queryKey:u,stale:f}=e;if(u){if(r){if(t.queryHash!==Rg(u,t.options))return!1}else if(!uc(t.queryKey,u))return!1}if(s!=="all"){const h=t.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||o&&o!==t.state.fetchStatus||l&&!l(t))}function mS(e,t){const{exact:s,status:r,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(s){if(ws(t.options.mutationKey)!==ws(l))return!1}else if(!uc(t.options.mutationKey,l))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Rg(e,t){return((t==null?void 0:t.queryKeyHashFn)||ws)(e)}function ws(e){return JSON.stringify(e,(t,s)=>km(s)?Object.keys(s).sort().reduce((r,o)=>(r[o]=s[o],r),{}):s)}function uc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>uc(e[s],t[s])):!1}var Tz=Object.prototype.hasOwnProperty;function a_(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=gS(e)&&gS(t);if(!r&&!(km(e)&&km(t)))return t;const l=(r?e:Object.keys(e)).length,u=r?t:Object.keys(t),f=u.length,h=r?new Array(f):{};let p=0;for(let y=0;y<f;y++){const m=r?y:u[y],b=e[m],_=t[m];if(b===_){h[m]=b,(r?y<l:Tz.call(e,m))&&p++;continue}if(b===null||_===null||typeof b!="object"||typeof _!="object"){h[m]=_;continue}const v=a_(b,_,s+1);h[m]=v,v===b&&p++}return l===f&&p===l?e:h}function zm(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 gS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function km(e){if(!yS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!yS(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function yS(e){return Object.prototype.toString.call(e)==="[object Object]"}function Oz(e){return new Promise(t=>{Yr.setTimeout(t,e)})}function Dm(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?a_(e,t):t}function Mz(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function zz(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Ag=Symbol();function l_(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ag?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kz(e,t,s){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),r||(r=!0,o.aborted?s():o.addEventListener("abort",s,{once:!0})),o)}),e}var $f=(()=>{let e=()=>Rz;return{isServer(){return e()},setIsServer(t){e=t}}})();function jm(){let e,t;const s=new Promise((o,l)=>{e=o,t=l});s.status="pending",s.catch(()=>{});function r(o){Object.assign(s,o),delete s.resolve,delete s.reject}return s.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},s.reject=o=>{r({status:"rejected",reason:o}),t(o)},s}var Dz=Cz;function jz(){let e=[],t=0,s=f=>{f()},r=f=>{f()},o=Dz;const l=f=>{t?e.push(f):o(()=>{s(f)})},u=()=>{const f=e;e=[],f.length&&o(()=>{r(()=>{f.forEach(h=>{s(h)})})})};return{batch:f=>{let h;t++;try{h=f()}finally{t--,t||u()}return h},batchCalls:f=>(...h)=>{l(()=>{f(...h)})},schedule:l,setNotifyFunction:f=>{s=f},setBatchNotifyFunction:f=>{r=f},setScheduler:f=>{o=f}}}var hn=jz(),Ra,ir,Aa,KS,Nz=(KS=class extends Ic{constructor(){super();pe(this,Ra,!0);pe(this,ir);pe(this,Aa);ue(this,Aa,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(){E(this,ir)||this.setEventListener(E(this,Aa))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,ir))==null||t.call(this),ue(this,ir,void 0))}setEventListener(t){var s;ue(this,Aa,t),(s=E(this,ir))==null||s.call(this),ue(this,ir,t(this.setOnline.bind(this)))}setOnline(t){E(this,Ra)!==t&&(ue(this,Ra,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,Ra)}},Ra=new WeakMap,ir=new WeakMap,Aa=new WeakMap,KS),qf=new Nz;function Iz(e){return Math.min(1e3*2**e,3e4)}function c_(e){return(e??"online")==="online"?qf.isOnline():!0}var Nm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function u_(e){let t=!1,s=0,r;const o=jm(),l=()=>o.status!=="pending",u=S=>{var x;if(!l()){const T=new Nm(S);b(T),(x=e.onCancel)==null||x.call(e,T)}},f=()=>{t=!0},h=()=>{t=!1},p=()=>Cg.isFocused()&&(e.networkMode==="always"||qf.isOnline())&&e.canRun(),y=()=>c_(e.networkMode)&&e.canRun(),m=S=>{l()||(r==null||r(),o.resolve(S))},b=S=>{l()||(r==null||r(),o.reject(S))},_=()=>new Promise(S=>{var x;r=T=>{(l()||p())&&S(T)},(x=e.onPause)==null||x.call(e)}).then(()=>{var S;r=void 0,l()||(S=e.onContinue)==null||S.call(e)}),v=()=>{if(l())return;let S;const x=s===0?e.initialPromise:void 0;try{S=x??e.fn()}catch(T){S=Promise.reject(T)}Promise.resolve(S).then(m).catch(T=>{var L;if(l())return;const M=e.retry??($f.isServer()?0:3),O=e.retryDelay??Iz,R=typeof O=="function"?O(s,T):O,A=M===!0||typeof M=="number"&&s<M||typeof M=="function"&&M(s,T);if(t||!A){b(T);return}s++,(L=e.onFail)==null||L.call(e,s,T),Oz(R).then(()=>p()?void 0:_()).then(()=>{t?b(T):v()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(r==null||r(),o),cancelRetry:f,continueRetry:h,canStart:y,start:()=>(y()?v():_().then(v),o)}}var ro,FS,f_=(FS=class{constructor(){pe(this,ro)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mm(this.gcTime)&&ue(this,ro,Yr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($f.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,ro)!==void 0&&(Yr.clearTimeout(E(this,ro)),ue(this,ro,void 0))}},ro=new WeakMap,FS);function Lz(e){return{onFetch:(t,s)=>{var y,m,b,_,v;const r=t.options,o=(b=(m=(y=t.fetchOptions)==null?void 0:y.meta)==null?void 0:m.fetchMore)==null?void 0:b.direction,l=((_=t.state.data)==null?void 0:_.pages)||[],u=((v=t.state.data)==null?void 0:v.pageParams)||[];let f={pages:[],pageParams:[]},h=0;const p=async()=>{let S=!1;const x=O=>{kz(O,()=>t.signal,()=>S=!0)},T=l_(t.options,t.fetchOptions),M=async(O,R,A)=>{if(S)return Promise.reject(t.signal.reason);if(R==null&&O.pages.length)return Promise.resolve(O);const j=(()=>{const W={client:t.client,queryKey:t.queryKey,pageParam:R,direction:A?"backward":"forward",meta:t.options.meta};return x(W),W})(),D=await T(j),{maxPages:$}=t.options,P=A?zz:Mz;return{pages:P(O.pages,D,$),pageParams:P(O.pageParams,R,$)}};if(o&&l.length){const O=o==="backward",R=O?Bz:vS,A={pages:l,pageParams:u},L=R(r,A);f=await M(A,L,O)}else{const O=e??l.length;do{const R=h===0?u[0]??r.initialPageParam:vS(r,f);if(h>0&&R==null)break;f=await M(f,R),h++}while(h<O)}return f};t.options.persister?t.fetchFn=()=>{var S,x;return(x=(S=t.options).persister)==null?void 0:x.call(S,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=p}}}function vS(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 Bz(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 Ta,oo,Oa,cs,ao,Yt,Cc,lo,Hn,d_,ui,GS,Uz=(GS=class extends f_{constructor(t){super();pe(this,Hn);pe(this,Ta);pe(this,oo);pe(this,Oa);pe(this,cs);pe(this,ao);pe(this,Yt);pe(this,Cc);pe(this,lo);ue(this,lo,!1),ue(this,Cc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,ao,t.client),ue(this,cs,E(this,ao).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,oo,SS(this.options)),this.state=t.state??E(this,oo),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Ta)}get promise(){var t;return(t=E(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Cc),...t},t!=null&&t._type&&ue(this,Ta,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=SS(this.options);s.data!==void 0&&(this.setState(bS(s.data,s.dataUpdatedAt)),ue(this,oo,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,cs).remove(this)}setData(t,s){const r=Dm(this.state.data,t,this.options);return Ae(this,Hn,ui).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t){Ae(this,Hn,ui).call(this,{type:"setState",state:t})}cancel(t){var r,o;const s=(r=E(this,Yt))==null?void 0:r.promise;return(o=E(this,Yt))==null||o.cancel(t),s?s.then(us).catch(us):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,oo)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Kn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ag||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yr(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:!o_(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=E(this,Yt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=E(this,Yt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,cs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(E(this,Yt)&&(E(this,lo)||Ae(this,Hn,d_).call(this)?E(this,Yt).cancel({revert:!0}):E(this,Yt).cancelRetry()),this.scheduleGc()),E(this,cs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Hn,ui).call(this,{type:"invalidate"})}async fetch(t,s){var p,y,m,b,_,v,S,x,T,M,O;if(this.state.fetchStatus!=="idle"&&((p=E(this,Yt))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(E(this,Yt))return E(this,Yt).continueRetry(),E(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(A=>A.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,o=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ue(this,lo,!0),r.signal)})},l=()=>{const R=l_(this.options,s),L=(()=>{const j={client:E(this,ao),queryKey:this.queryKey,meta:this.meta};return o(j),j})();return ue(this,lo,!1),this.options.persister?this.options.persister(R,L,this):R(L)},f=(()=>{const R={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:E(this,ao),state:this.state,fetchFn:l};return o(R),R})(),h=E(this,Ta)==="infinite"?Lz(this.options.pages):this.options.behavior;h==null||h.onFetch(f,this),ue(this,Oa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=f.fetchOptions)==null?void 0:y.meta))&&Ae(this,Hn,ui).call(this,{type:"fetch",meta:(m=f.fetchOptions)==null?void 0:m.meta}),ue(this,Yt,u_({initialPromise:s==null?void 0:s.initialPromise,fn:f.fetchFn,onCancel:R=>{R instanceof Nm&&R.revert&&this.setState({...E(this,Oa),fetchStatus:"idle"}),r.abort()},onFail:(R,A)=>{Ae(this,Hn,ui).call(this,{type:"failed",failureCount:R,error:A})},onPause:()=>{Ae(this,Hn,ui).call(this,{type:"pause"})},onContinue:()=>{Ae(this,Hn,ui).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const R=await E(this,Yt).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(_=(b=E(this,cs).config).onSuccess)==null||_.call(b,R,this),(S=(v=E(this,cs).config).onSettled)==null||S.call(v,R,this.state.error,this),R}catch(R){if(R instanceof Nm){if(R.silent)return E(this,Yt).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw Ae(this,Hn,ui).call(this,{type:"error",error:R}),(T=(x=E(this,cs).config).onError)==null||T.call(x,R,this),(O=(M=E(this,cs).config).onSettled)==null||O.call(M,this.state.data,R,this),R}finally{this.scheduleGc()}}},Ta=new WeakMap,oo=new WeakMap,Oa=new WeakMap,cs=new WeakMap,ao=new WeakMap,Yt=new WeakMap,Cc=new WeakMap,lo=new WeakMap,Hn=new WeakSet,d_=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ui=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,...h_(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...bS(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ue(this,Oa,t.manual?o:void 0),o;case"error":const l=t.error;return{...r,error:l,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),hn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,cs).notify({query:this,type:"updated",action:t})})},GS);function h_(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:c_(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function bS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function SS(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 On,Fe,Rc,vn,co,Ma,di,rr,Ac,za,ka,uo,fo,or,Da,et,Jl,Im,Lm,Bm,Um,Pm,Zm,$m,p_,QS,Pz=(QS=class extends Ic{constructor(t,s){super();pe(this,et);pe(this,On);pe(this,Fe);pe(this,Rc);pe(this,vn);pe(this,co);pe(this,Ma);pe(this,di);pe(this,rr);pe(this,Ac);pe(this,za);pe(this,ka);pe(this,uo);pe(this,fo);pe(this,or);pe(this,Da,new Set);this.options=s,ue(this,On,t),ue(this,rr,null),ue(this,di,jm()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,Fe).addObserver(this),wS(E(this,Fe),this.options)?Ae(this,et,Jl).call(this):this.updateResult(),Ae(this,et,Um).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qm(E(this,Fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qm(E(this,Fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,et,Pm).call(this),Ae(this,et,Zm).call(this),E(this,Fe).removeObserver(this)}setOptions(t){const s=this.options,r=E(this,Fe);if(this.options=E(this,On).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kn(this.options.enabled,E(this,Fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,et,$m).call(this),E(this,Fe).setOptions(this.options),s._defaulted&&!zm(this.options,s)&&E(this,On).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,Fe),observer:this});const o=this.hasListeners();o&&_S(E(this,Fe),r,this.options,s)&&Ae(this,et,Jl).call(this),this.updateResult(),o&&(E(this,Fe)!==r||Kn(this.options.enabled,E(this,Fe))!==Kn(s.enabled,E(this,Fe))||yr(this.options.staleTime,E(this,Fe))!==yr(s.staleTime,E(this,Fe)))&&Ae(this,et,Im).call(this);const l=Ae(this,et,Lm).call(this);o&&(E(this,Fe)!==r||Kn(this.options.enabled,E(this,Fe))!==Kn(s.enabled,E(this,Fe))||l!==E(this,or))&&Ae(this,et,Bm).call(this,l)}getOptimisticResult(t){const s=E(this,On).getQueryCache().build(E(this,On),t),r=this.createResult(s,t);return $z(this,r)&&(ue(this,vn,r),ue(this,Ma,this.options),ue(this,co,E(this,Fe).state)),r}getCurrentResult(){return E(this,vn)}trackResult(t,s){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),s==null||s(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,di).status==="pending"&&E(this,di).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(t){E(this,Da).add(t)}getCurrentQuery(){return E(this,Fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=E(this,On).defaultQueryOptions(t),r=E(this,On).getQueryCache().build(E(this,On),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return Ae(this,et,Jl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,vn)))}createResult(t,s){var $;const r=E(this,Fe),o=this.options,l=E(this,vn),u=E(this,co),f=E(this,Ma),p=t!==r?t.state:E(this,Rc),{state:y}=t;let m={...y},b=!1,_;if(s._optimisticResults){const P=this.hasListeners(),W=!P&&wS(t,s),ce=P&&_S(t,r,s,o);(W||ce)&&(m={...m,...h_(y.data,t.options)}),s._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:v,errorUpdatedAt:S,status:x}=m;_=m.data;let T=!1;if(s.placeholderData!==void 0&&_===void 0&&x==="pending"){let P;l!=null&&l.isPlaceholderData&&s.placeholderData===(f==null?void 0:f.placeholderData)?(P=l.data,T=!0):P=typeof s.placeholderData=="function"?s.placeholderData(($=E(this,ka))==null?void 0:$.state.data,E(this,ka)):s.placeholderData,P!==void 0&&(x="success",_=Dm(l==null?void 0:l.data,P,s),b=!0)}if(s.select&&_!==void 0&&!T)if(l&&_===(u==null?void 0:u.data)&&s.select===E(this,Ac))_=E(this,za);else try{ue(this,Ac,s.select),_=s.select(_),_=Dm(l==null?void 0:l.data,_,s),ue(this,za,_),ue(this,rr,null)}catch(P){ue(this,rr,P)}E(this,rr)&&(v=E(this,rr),_=E(this,za),S=Date.now(),x="error");const M=m.fetchStatus==="fetching",O=x==="pending",R=x==="error",A=O&&M,L=_!==void 0,D={status:x,fetchStatus:m.fetchStatus,isPending:O,isSuccess:x==="success",isError:R,isInitialLoading:A,isLoading:A,data:_,dataUpdatedAt:m.dataUpdatedAt,error:v,errorUpdatedAt:S,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>p.dataUpdateCount||m.errorUpdateCount>p.errorUpdateCount,isFetching:M,isRefetching:M&&!O,isLoadingError:R&&!L,isPaused:m.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:R&&L,isStale:Tg(t,s),refetch:this.refetch,promise:E(this,di),isEnabled:Kn(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=D.data!==void 0,W=D.status==="error"&&!P,ce=re=>{W?re.reject(D.error):P&&re.resolve(D.data)},le=()=>{const re=ue(this,di,D.promise=jm());ce(re)},be=E(this,di);switch(be.status){case"pending":t.queryHash===r.queryHash&&ce(be);break;case"fulfilled":(W||D.data!==be.value)&&le();break;case"rejected":(!W||D.error!==be.reason)&&le();break}}return D}updateResult(){const t=E(this,vn),s=this.createResult(E(this,Fe),this.options);if(ue(this,co,E(this,Fe).state),ue(this,Ma,this.options),E(this,co).data!==void 0&&ue(this,ka,E(this,Fe)),zm(s,t))return;ue(this,vn,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,l=typeof o=="function"?o():o;if(l==="all"||!l&&!E(this,Da).size)return!0;const u=new Set(l??E(this,Da));return this.options.throwOnError&&u.add("error"),Object.keys(E(this,vn)).some(f=>{const h=f;return E(this,vn)[h]!==t[h]&&u.has(h)})};Ae(this,et,p_).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,et,Um).call(this)}},On=new WeakMap,Fe=new WeakMap,Rc=new WeakMap,vn=new WeakMap,co=new WeakMap,Ma=new WeakMap,di=new WeakMap,rr=new WeakMap,Ac=new WeakMap,za=new WeakMap,ka=new WeakMap,uo=new WeakMap,fo=new WeakMap,or=new WeakMap,Da=new WeakMap,et=new WeakSet,Jl=function(t){Ae(this,et,$m).call(this);let s=E(this,Fe).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(us)),s},Im=function(){Ae(this,et,Pm).call(this);const t=yr(this.options.staleTime,E(this,Fe));if($f.isServer()||E(this,vn).isStale||!Mm(t))return;const r=o_(E(this,vn).dataUpdatedAt,t)+1;ue(this,uo,Yr.setTimeout(()=>{E(this,vn).isStale||this.updateResult()},r))},Lm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,Fe)):this.options.refetchInterval)??!1},Bm=function(t){Ae(this,et,Zm).call(this),ue(this,or,t),!($f.isServer()||Kn(this.options.enabled,E(this,Fe))===!1||!Mm(E(this,or))||E(this,or)===0)&&ue(this,fo,Yr.setInterval(()=>{(this.options.refetchIntervalInBackground||Cg.isFocused())&&Ae(this,et,Jl).call(this)},E(this,or)))},Um=function(){Ae(this,et,Im).call(this),Ae(this,et,Bm).call(this,Ae(this,et,Lm).call(this))},Pm=function(){E(this,uo)!==void 0&&(Yr.clearTimeout(E(this,uo)),ue(this,uo,void 0))},Zm=function(){E(this,fo)!==void 0&&(Yr.clearInterval(E(this,fo)),ue(this,fo,void 0))},$m=function(){const t=E(this,On).getQueryCache().build(E(this,On),this.options);if(t===E(this,Fe))return;const s=E(this,Fe);ue(this,Fe,t),ue(this,Rc,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},p_=function(t){hn.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(E(this,vn))}),E(this,On).getQueryCache().notify({query:E(this,Fe),type:"observerResultsUpdated"})})},QS);function Zz(e,t){return Kn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Kn(t.retryOnMount,e)===!1)}function wS(e,t){return Zz(e,t)||e.state.data!==void 0&&qm(e,t,t.refetchOnMount)}function qm(e,t,s){if(Kn(t.enabled,e)!==!1&&yr(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Tg(e,t)}return!1}function _S(e,t,s,r){return(e!==t||Kn(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Tg(e,s)}function Tg(e,t){return Kn(t.enabled,e)!==!1&&e.isStaleByTime(yr(t.staleTime,e))}function $z(e,t){return!zm(e.getCurrentResult(),t)}var Tc,js,dn,ho,Ns,Gi,YS,qz=(YS=class extends f_{constructor(t){super();pe(this,Ns);pe(this,Tc);pe(this,js);pe(this,dn);pe(this,ho);ue(this,Tc,t.client),this.mutationId=t.mutationId,ue(this,dn,t.mutationCache),ue(this,js,[]),this.state=t.state||Vz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,js).includes(t)||(E(this,js).push(t),this.clearGcTimeout(),E(this,dn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,js,E(this,js).filter(s=>s!==t)),this.scheduleGc(),E(this,dn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,js).length||(this.state.status==="pending"?this.scheduleGc():E(this,dn).remove(this))}continue(){var t;return((t=E(this,ho))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var u,f,h,p,y,m,b,_,v,S,x,T,M,O,R,A,L,j;const s=()=>{Ae(this,Ns,Gi).call(this,{type:"continue"})},r={client:E(this,Tc),meta:this.options.meta,mutationKey:this.options.mutationKey};ue(this,ho,u_({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(D,$)=>{Ae(this,Ns,Gi).call(this,{type:"failed",failureCount:D,error:$})},onPause:()=>{Ae(this,Ns,Gi).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,dn).canRun(this)}));const o=this.state.status==="pending",l=!E(this,ho).canStart();try{if(o)s();else{Ae(this,Ns,Gi).call(this,{type:"pending",variables:t,isPaused:l}),E(this,dn).config.onMutate&&await E(this,dn).config.onMutate(t,this,r);const $=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));$!==this.state.context&&Ae(this,Ns,Gi).call(this,{type:"pending",context:$,variables:t,isPaused:l})}const D=await E(this,ho).start();return await((p=(h=E(this,dn).config).onSuccess)==null?void 0:p.call(h,D,t,this.state.context,this,r)),await((m=(y=this.options).onSuccess)==null?void 0:m.call(y,D,t,this.state.context,r)),await((_=(b=E(this,dn).config).onSettled)==null?void 0:_.call(b,D,null,this.state.variables,this.state.context,this,r)),await((S=(v=this.options).onSettled)==null?void 0:S.call(v,D,null,t,this.state.context,r)),Ae(this,Ns,Gi).call(this,{type:"success",data:D}),D}catch(D){try{await((T=(x=E(this,dn).config).onError)==null?void 0:T.call(x,D,t,this.state.context,this,r))}catch($){Promise.reject($)}try{await((O=(M=this.options).onError)==null?void 0:O.call(M,D,t,this.state.context,r))}catch($){Promise.reject($)}try{await((A=(R=E(this,dn).config).onSettled)==null?void 0:A.call(R,void 0,D,this.state.variables,this.state.context,this,r))}catch($){Promise.reject($)}try{await((j=(L=this.options).onSettled)==null?void 0:j.call(L,void 0,D,t,this.state.context,r))}catch($){Promise.reject($)}throw Ae(this,Ns,Gi).call(this,{type:"error",error:D}),D}finally{E(this,dn).runNext(this)}}},Tc=new WeakMap,js=new WeakMap,dn=new WeakMap,ho=new WeakMap,Ns=new WeakSet,Gi=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),hn.batch(()=>{E(this,js).forEach(r=>{r.onMutationUpdate(t)}),E(this,dn).notify({mutation:this,type:"updated",action:t})})},YS);function Vz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hi,Ss,Oc,JS,Hz=(JS=class extends Ic{constructor(t={}){super();pe(this,hi);pe(this,Ss);pe(this,Oc);this.config=t,ue(this,hi,new Set),ue(this,Ss,new Map),ue(this,Oc,0)}build(t,s,r){const o=new qz({client:t,mutationCache:this,mutationId:++Nl(this,Oc)._,options:t.defaultMutationOptions(s),state:r});return this.add(o),o}add(t){E(this,hi).add(t);const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s);r?r.push(t):E(this,Ss).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hi).delete(t)){const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&E(this,Ss).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s),o=r==null?void 0:r.find(l=>l.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const s=cf(t);if(typeof s=="string"){const o=(r=E(this,Ss).get(s))==null?void 0:r.find(l=>l!==t&&l.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){hn.batch(()=>{E(this,hi).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hi).clear(),E(this,Ss).clear()})}getAll(){return Array.from(E(this,hi))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>mS(s,r))}findAll(t={}){return this.getAll().filter(s=>mS(t,s))}notify(t){hn.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return hn.batch(()=>Promise.all(t.map(s=>s.continue().catch(us))))}},hi=new WeakMap,Ss=new WeakMap,Oc=new WeakMap,JS);function cf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Is,XS,Kz=(XS=class extends Ic{constructor(t={}){super();pe(this,Is);this.config=t,ue(this,Is,new Map)}build(t,s,r){const o=s.queryKey,l=s.queryHash??Rg(o,s);let u=this.get(l);return u||(u=new Uz({client:t,queryKey:o,queryHash:l,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(u)),u}add(t){E(this,Is).has(t.queryHash)||(E(this,Is).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=E(this,Is).get(t.queryHash);s&&(t.destroy(),s===t&&E(this,Is).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){hn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Is).get(t)}getAll(){return[...E(this,Is).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>pS(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>pS(t,r)):s}notify(t){hn.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){hn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){hn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Is=new WeakMap,XS),Et,ar,lr,ja,Na,cr,Ia,La,WS,Fz=(WS=class{constructor(e={}){pe(this,Et);pe(this,ar);pe(this,lr);pe(this,ja);pe(this,Na);pe(this,cr);pe(this,Ia);pe(this,La);ue(this,Et,e.queryCache||new Kz),ue(this,ar,e.mutationCache||new Hz),ue(this,lr,e.defaultOptions||{}),ue(this,ja,new Map),ue(this,Na,new Map),ue(this,cr,0)}mount(){Nl(this,cr)._++,E(this,cr)===1&&(ue(this,Ia,Cg.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Et).onFocus())})),ue(this,La,qf.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Et).onOnline())})))}unmount(){var e,t;Nl(this,cr)._--,E(this,cr)===0&&((e=E(this,Ia))==null||e.call(this),ue(this,Ia,void 0),(t=E(this,La))==null||t.call(this),ue(this,La,void 0))}isFetching(e){return E(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,ar).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=E(this,Et).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=E(this,Et).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(yr(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Et).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),o=E(this,Et).get(r.queryHash),l=o==null?void 0:o.state.data,u=Az(t,l);if(u!==void 0)return E(this,Et).build(this,r).setData(u,{...s,manual:!0})}setQueriesData(e,t,s){return hn.batch(()=>E(this,Et).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=E(this,Et).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=E(this,Et);hn.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=E(this,Et);return hn.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=hn.batch(()=>E(this,Et).findAll(e).map(o=>o.cancel(s)));return Promise.all(r).then(us).catch(us)}invalidateQueries(e,t={}){return hn.batch(()=>(E(this,Et).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=hn.batch(()=>E(this,Et).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,s);return s.throwOnError||(l=l.catch(us)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(us)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=E(this,Et).build(this,t);return s.isStaleByTime(yr(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(us).catch(us)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(us).catch(us)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qf.isOnline()?E(this,ar).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Et)}getMutationCache(){return E(this,ar)}getDefaultOptions(){return E(this,lr)}setDefaultOptions(e){ue(this,lr,e)}setQueryDefaults(e,t){E(this,ja).set(ws(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,ja).values()],s={};return t.forEach(r=>{uc(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){E(this,Na).set(ws(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Na).values()],s={};return t.forEach(r=>{uc(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,lr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Rg(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===Ag&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,lr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Et).clear(),E(this,ar).clear()}},Et=new WeakMap,ar=new WeakMap,lr=new WeakMap,ja=new WeakMap,Na=new WeakMap,cr=new WeakMap,Ia=new WeakMap,La=new WeakMap,WS);class _r extends Gn{constructor(t){super(t),this.name="QueryCollectionError"}}class Gz extends _r{constructor(){super("[QueryCollection] queryKey must be provided."),this.name="QueryKeyRequiredError"}}class Qz extends _r{constructor(){super("[QueryCollection] queryFn must be provided."),this.name="QueryFnRequiredError"}}class Yz extends _r{constructor(){super("[QueryCollection] queryClient must be provided."),this.name="QueryClientRequiredError"}}class Jz extends _r{constructor(){super("[QueryCollection] getKey must be provided."),this.name="GetKeyRequiredError"}}class Xz extends _r{constructor(){super("Collection must be in 'ready' state for manual sync operations. Sync not initialized yet."),this.name="SyncNotInitializedError"}}class Wz extends _r{constructor(t){super(`Duplicate key '${t}' found within batch operations`),this.name="DuplicateKeyInBatchError"}}class e3 extends _r{constructor(t){super(`Update operation: Item with key '${t}' does not exist`),this.name="UpdateOperationItemNotFoundError"}}class t3 extends _r{constructor(t){super(`Delete operation: Item with key '${t}' does not exist`),this.name="DeleteOperationItemNotFoundError"}}const Hr=new WeakMap;function n3(e,t){const s=Array.isArray(e)?e:[e],r=[];for(const o of s)if(o.type==="delete"){const l=Array.isArray(o.key)?o.key:[o.key];for(const u of l)r.push({type:"delete",key:u})}else{const l=Array.isArray(o.data)?o.data:[o.data];for(const u of l){let f;if(o.type==="update")f=t.getKey(u);else{const h=t.collection.validateData(u,o.type==="upsert"?"insert":o.type);f=t.getKey(h)}r.push({type:o.type,key:f,data:u})}}return r}function s3(e,t){const s=new Set;for(const r of e){if(s.has(r.key))throw new Wz(r.key);if(s.add(r.key),r.type==="update"){if(!t.collection._state.syncedData.has(r.key))throw new e3(r.key)}else if(r.type==="delete"&&!t.collection._state.syncedData.has(r.key))throw new t3(r.key)}}function Vl(e,t){const s=n3(e,t);s3(s,t),t.begin({immediate:!0});for(const o of s)switch(o.type){case"insert":{const l=t.collection.validateData(o.data,"insert");t.write({type:"insert",value:l});break}case"update":{const u={...t.collection._state.syncedData.get(o.key),...o.data},f=t.collection.validateData(u,"update",o.key);t.write({type:"update",value:f});break}case"delete":{const l=t.collection._state.syncedData.get(o.key);t.write({type:"delete",value:l});break}case"upsert":{const l=t.collection._state.syncedData.has(o.key),u=t.collection.validateData(o.data,l?"update":"insert",o.key);l?t.write({type:"update",value:u}):t.write({type:"insert",value:u});break}}t.commit();const r=Array.from(t.collection._state.syncedData.values());t.updateCacheData?t.updateCacheData(r):t.queryClient.setQueryData(t.queryKey,r)}function i3(e){function t(){const s=e();if(!s)throw new Xz;return s}return{writeInsert(s){const r={type:"insert",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeUpdate(s){const r={type:"update",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeDelete(s){const r={type:"delete",key:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeUpsert(s){const r={type:"upsert",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeBatch(s){const r=t(),o=Hr.get(r);if(o!=null&&o.isActive)throw new Error("Cannot nest writeBatch calls. Complete the current batch before starting a new one.");const l={operations:[],isActive:!0};Hr.set(r,l);try{const u=s();if(u&&typeof u=="object"&&"then"in u&&typeof u.then=="function")throw new Error("writeBatch does not support async callbacks. The callback must be synchronous.");l.operations.length>0&&Vl(l.operations,r)}finally{l.isActive=!1,Hr.delete(r)}}}}function r3(e){var s;if(!e)return;const t={};return e.where&&(t.where=Vm(e.where)),(s=e.orderBy)!=null&&s.length&&(t.orderBy=e.orderBy.map(r=>{const o={expression:Vm(r.expression),direction:r.compareOptions.direction,nulls:r.compareOptions.nulls,stringSort:r.compareOptions.stringSort};return r.compareOptions.stringSort==="locale"?{...o,locale:r.compareOptions.locale,localeOptions:r.compareOptions.localeOptions}:o})),e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset),Object.keys(t).length===0?void 0:JSON.stringify(t)}function Vm(e){if(!e)return null;switch(e.type){case"val":return{type:"val",value:Hm(e.value)};case"ref":return{type:"ref",path:[...e.path]};case"func":return{type:"func",name:e.name,args:e.args.map(t=>Vm(t))};default:return null}}function Hm(e){if(e===void 0)return{__type:"undefined"};if(typeof e=="number"){if(Number.isNaN(e))return{__type:"nan"};if(e===Number.POSITIVE_INFINITY)return{__type:"infinity",sign:1};if(e===Number.NEGATIVE_INFINITY)return{__type:"infinity",sign:-1}}return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:e instanceof Date?{__type:"date",value:e.toJSON()}:Array.isArray(e)?e.map(t=>Hm(t)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,s])=>[t,Hm(s)])):e}const Fi="queryCollection:gc:";class o3{constructor(t,s,r){this.state=t,this.refetchFn=s,this.refetch=s,this.writeInsert=r.writeInsert,this.writeUpdate=r.writeUpdate,this.writeDelete=r.writeDelete,this.writeUpsert=r.writeUpsert,this.writeBatch=r.writeBatch}async clearError(){this.state.lastError=void 0,this.state.errorCount=0,this.state.lastErrorUpdatedAt=0,await this.refetchFn({throwOnError:!0})}get lastError(){return this.state.lastError}get isError(){return!!this.state.lastError}get errorCount(){return this.state.errorCount}get isFetching(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isFetching)}get isRefetching(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isRefetching)}get isLoading(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isLoading)}get dataUpdatedAt(){return Math.max(0,...Array.from(this.state.observers.values()).map(t=>t.getCurrentResult().dataUpdatedAt))}get fetchStatus(){return Array.from(this.state.observers.values()).map(t=>t.getCurrentResult().fetchStatus)}}function m_(e){const{queryKey:t,queryFn:s,select:r,queryClient:o,enabled:l,refetchInterval:u,retry:f,retryDelay:h,staleTime:p,persistedGcTime:y,getKey:m,onInsert:b,onUpdate:_,onDelete:v,meta:S,...x}=e,T=x.syncMode??"eager",M=typeof t=="function"?t({}):t,O=q=>{if(typeof t!="function")return;q.length>=M.length&&M.every((V,ie)=>ds(V,q[ie]))||console.warn(`[QueryCollection] queryKey function must return keys that extend the base key prefix. Base: ${JSON.stringify(M)}, Got: ${JSON.stringify(q)}. This can cause stale cache issues.`)};if(!t)throw new Gz;if(!s)throw new Qz;if(!o)throw new Yz;if(!m)throw new Jz;const R={lastError:void 0,errorCount:0,lastErrorUpdatedAt:0,observers:new Map},A=new Map,L=new Map,j=new Map,D=new Map,$=new Map,P=(q,F)=>{const V=j.get(q)||new Set;V.add(F),j.set(q,V);const ie=L.get(F)||new Set;ie.add(q),L.set(F,ie)},W=(q,F)=>{const V=j.get(q)||new Set;V.delete(F),j.set(q,V);const ie=L.get(F)||new Set;return ie.delete(q),L.set(F,ie),V.size===0},ce=q=>{const{begin:F,write:V,commit:ie,markReady:ve,collection:ye,metadata:oe}=q,Ue=oe;let je=!1,Ne=!1;const Rt=new Set,Xe=new Map,Wt=new Map;let jn=Promise.resolve();const Nn=X=>(oe==null?void 0:oe.row.get(X))??ye._state.syncedMetadata.get(X),cn=X=>{const Se=Nn(X),me=Se==null?void 0:Se.queryCollection;if(!me||typeof me!="object")return new Set;const he=me.owners;return!he||typeof he!="object"?new Set:new Set(Object.keys(he))},St=(X,Se)=>{if(!oe)return;const me={...Nn(X)??{}};if(Se.size===0){delete me.queryCollection,Object.keys(me).length===0?oe.row.delete(X):oe.row.set(X,me);return}oe.row.set(X,{...me,queryCollection:{owners:Object.fromEntries(Array.from(Se.values()).map(he=>[he,!0]))}})},en=(X,Se)=>{if(!X||typeof X!="object")return;const me=X;if(me.queryHash===Se){if(me.mode==="until-revalidated")return{queryHash:Se,mode:"until-revalidated"};if(me.mode==="ttl"&&typeof me.expiresAt=="number"&&Number.isFinite(me.expiresAt))return{queryHash:Se,mode:"ttl",expiresAt:me.expiresAt}}},Es=X=>(jn=jn.then(X,X),jn),vt=X=>{const Se=Wt.get(X);Se&&(clearTimeout(Se),Wt.delete(X))},In=X=>{const Se=L.get(X);if(Se)return new Set(Se);const me=new Set;for(const[he]of ye._state.syncedData.entries()){const ke=cn(he);ke.size!==0&&(j.set(he,new Set(ke)),ke.forEach(Ce=>{const Ie=L.get(Ce)||new Set;Ie.add(he),L.set(Ce,Ie)}),ke.has(X)&&me.add(he))}return me},At=async X=>{const Se=L.get(X);if(Se&&Array.from(Se).every(Ce=>ye.has(Ce))){const Ce=new Map;return Se.forEach(Ie=>{const He=ye.get(Ie),Qe=j.get(Ie);He&&Qe&&Ce.set(Ie,{value:He,owners:new Set(Qe)})}),Ce}const me=Ue==null?void 0:Ue.row.scanPersisted;if(!me){const Ce=new Map;return In(X).forEach(Ie=>{const He=ye.get(Ie),Qe=j.get(Ie);He&&Qe&&Ce.set(Ie,{value:He,owners:new Set(Qe)})}),Ce}const he=new Map;return(await me()).forEach(Ce=>{const Ie=Ce.metadata,He=Ie==null?void 0:Ie.queryCollection;if(!He||typeof He!="object")return;const Qe=He.owners;if(!Qe||typeof Qe!="object")return;const kt=new Set(Object.keys(Qe));kt.size!==0&&(j.set(Ce.key,new Set(kt)),kt.forEach(wt=>{const pt=L.get(wt)||new Set;pt.add(Ce.key),L.set(wt,pt)}),kt.has(X)&&he.set(Ce.key,{value:Ce.value,owners:kt}))}),he},Ge=async X=>{if(!oe)return;const Se=await At(X),me=[];F(),Se.forEach(({value:he,owners:ke},Ce)=>{ke.delete(X),St(Ce,ke),W(Ce,X)&&me.push(he)}),me.forEach(he=>{V({type:"delete",value:he})}),oe.collection.delete(`${Fi}${X}`),ie()},ct=X=>{if(X.mode!=="ttl")return;vt(X.queryHash);const Se=Math.max(0,X.expiresAt-Date.now()),me=setTimeout(()=>{Wt.delete(X.queryHash),Es(async()=>{const he=oe==null?void 0:oe.collection.get(`${Fi}${X.queryHash}`),ke=en(he,X.queryHash);!ke||ke.mode!=="ttl"||ke.expiresAt>Date.now()||await Ge(X.queryHash)})},Se);Wt.set(X.queryHash,me)},_n=async()=>{if(!oe)return;const X=oe.collection.list(Fi),Se=Date.now();for(const{key:me,value:he}of X){const ke=me.slice(Fi.length),Ce=en(he,ke);Ce&&(Ce.mode==="ttl"&&Ce.expiresAt<=Se?await Ge(Ce.queryHash):Ce.mode==="ttl"&&ct(Ce))}},Qn=X=>{if(typeof t=="function")return t(X);if(T==="on-demand"){const Se=r3(X);return Se!==void 0?[...t,Se]:t}else return t},yi=oe==null?void 0:oe.collection.list(Fi),Yn=!yi||yi.length===0?(Ne=!0,Promise.resolve()):Es(async()=>{try{await _n()}finally{Ne=!0}}),vi=(X={},Se=s)=>{var it;if(!Ne)return Yn.then(()=>{const ft=vi(X,Se);return ft===!0?void 0:ft});const me=Qn(X),he=ws(me),ke={...S,loadSubsetOptions:X},Ce=oe==null?void 0:oe.collection.get(`${Fi}${he}`);if(en(Ce,he)!==void 0&&Rt.add(he),vt(he),O(me),R.observers.has(he)){$.set(he,($.get(he)||0)+1);const ft=R.observers.get(he),mn=ft.getCurrentResult();return mn.isSuccess?!0:mn.isError?Promise.reject(mn.error):o.getQueryData(me)!==void 0?!0:new Promise((Cr,ud)=>{const Ka=ft.subscribe(qs=>{queueMicrotask(()=>{qs.isSuccess?(Ka(),Cr()):qs.isError&&(Ka(),ud(qs.error))})})})}const Ie={queryKey:me,queryFn:Se,meta:ke,structuralSharing:!0,notifyOnChangeProps:"all",...l!==void 0&&{enabled:l},...u!==void 0&&{refetchInterval:u},...f!==void 0&&{retry:f},...h!==void 0&&{retryDelay:h},...p!==void 0&&{staleTime:p}},He=new Pz(o,Ie),Qe=(it=o.getQueryCache().find({queryKey:me,exact:!0}))==null?void 0:it.gcTime,kt=y??Qe;if(A.set(he,me),R.observers.set(he,He),kt!==void 0?Xe.set(he,kt):Xe.delete(he),$.set(he,($.get(he)||0)+1),o.getQueryData(me)!==void 0)return(je||ye.subscriberCount>0)&&zt(He,he),!0;const pt=new Promise((ft,mn)=>{const Si=He.subscribe(Cr=>{queueMicrotask(()=>{Cr.isSuccess?(Si(),ft()):Cr.isError&&(Si(),mn(Cr.error))})})});return(je||ye.subscriberCount>0)&&zt(He,he),pt},gs=(X,Se,me)=>{const he=ws(X);if(ye.status==="cleaned-up")return;R.lastError=void 0,R.errorCount=0;const ke=Se.data,Ce=r?r(ke):ke;if(!Array.isArray(Ce)||Ce.some(wt=>typeof wt!="object")){const wt=r?`@tanstack/query-db-collection: select() must return an array of objects. Got: ${typeof Ce} for queryKey ${JSON.stringify(X)}`:`@tanstack/query-db-collection: queryFn must return an array of objects. Got: ${typeof Ce} for queryKey ${JSON.stringify(X)}`;console.error(wt);return}const Ie=new Map(ye._state.syncedData.entries()),He=me!==void 0,Qe=He?new Set(me.keys()):In(he),kt=new Map;Ce.forEach(wt=>{const pt=m(wt);kt.set(pt,wt)}),F(),oe&&oe.collection.delete(`${Fi}${he}`),Qe.forEach(wt=>{var ft;const pt=He?(ft=me.get(wt))==null?void 0:ft.value:Ie.get(wt);if(!pt)return;const it=kt.get(wt);if(it)ds(pt,it)||V({type:"update",value:it});else{const mn=cn(wt);mn.delete(he),St(wt,mn),W(wt,he)&&V({type:"delete",value:pt})}}),kt.forEach((wt,pt)=>{const it=cn(pt);it.has(he)||(it.add(he),St(pt,it)),P(pt,he),Ie.has(pt)||V({type:"insert",value:wt})}),ie(),Rt.delete(he),vt(he),ve()},Us=async(X,Se)=>{const me=ws(X),he=await At(me);ye.status!=="cleaned-up"&&gs(X,Se,he)},Kt=X=>{const Se=ws(X);return he=>{if(he.isSuccess){if(ye.deferDataRefresh){ye.deferDataRefresh.then(()=>{const ke=R.observers.get(Se);ke&&ke.refetch().catch(()=>{})});return}Rt.has(Se)?Us(X,he).catch(ke=>{console.error(`[QueryCollection] Error reconciling query ${String(X)}:`,ke)}):gs(X,he)}else he.isError&&((he.errorUpdatedAt!==R.lastErrorUpdatedAt||he.error!==R.lastError)&&(R.lastError=he.error,R.errorCount++,R.lastErrorUpdatedAt=he.errorUpdatedAt),console.error(`[QueryCollection] Error observing query ${String(X)}:`,he.error),ve())}},Ln=X=>D.has(X),zt=(X,Se)=>{if(!Ln(Se)){const me=A.get(Se),he=Kt(me),ke=X.subscribe(he);D.set(Se,ke);const Ce=X.getCurrentResult();(Ce.isSuccess||Ce.isError)&&he(Ce)}},To=()=>{R.observers.forEach(zt)},bi=()=>{D.forEach(X=>{X()}),D.clear()};je=!0;const Jn=ye.on("subscribers:change",({subscriberCount:X})=>{X>0?To():X===0&&bi()});if(T==="eager"){const X=vi({});X instanceof Promise&&X.catch(()=>{})}else Ne?ve():Yn.then(()=>{ve()});To(),R.observers.forEach((X,Se)=>{const me=A.get(Se);Kt(me)(X.getCurrentResult())});const Ps=X=>{var Ie;(Ie=D.get(X))==null||Ie(),D.delete(X),vt(X),Rt.delete(X);const Se=L.get(X)??new Set,me=new Map,he=[];Se.forEach(He=>{const Qe=j.get(He);if(!Qe)return;const kt=new Set(Qe);kt.delete(X),me.set(He,kt),kt.size===0&&ye.has(He)&&he.push(ye.get(He))});const ke=oe!==void 0&&me.size>0,Ce=ke||he.length>0;Ce&&F(),me.forEach((He,Qe)=>{He.size===0?j.delete(Qe):j.set(Qe,He),ke&&St(Qe,He)}),he.length>0&&he.forEach(He=>{V({type:"delete",value:He})}),Ce&&ie(),R.observers.delete(X),L.delete(X),A.delete(X),$.delete(X),Xe.delete(X)},Zs=X=>{var Ce,Ie;const Se=$.get(X)||0,me=R.observers.get(X),he=Xe.get(X);if(Se<=0&&((Ce=D.get(X))==null||Ce(),D.delete(X)),(me==null?void 0:me.hasListeners())??!1){$.set(X,0);return}if(Se>0&&console.warn(`[cleanupQueryIfIdle] Invariant violation: refcount=${Se} but no listeners. Cleaning up to prevent leak.`,{hashedQueryKey:X}),he!==void 0&&oe&&(Ue!=null&&Ue.row.scanPersisted)){F(),oe.collection.set(`${Fi}${X}`,{queryHash:X,mode:he===Number.POSITIVE_INFINITY?"until-revalidated":"ttl",...he===Number.POSITIVE_INFINITY?{}:{expiresAt:Date.now()+he}}),ie(),he!==Number.POSITIVE_INFINITY&&ct({queryHash:X,mode:"ttl",expiresAt:Date.now()+he}),(Ie=D.get(X))==null||Ie(),D.delete(X),R.observers.delete(X),A.delete(X),$.set(X,0);return}Ps(X)},$s=X=>{Ps(X)},Xn=o.getQueryCache().subscribe(X=>{const Se=X.query.queryHash;X.type==="removed"&&A.has(Se)&&Zs(Se)});return{loadSubset:T==="eager"?void 0:vi,unloadSubset:T==="eager"?void 0:X=>{const Se=Qn(X),me=ws(Se),ke=($.get(me)||0)-1;ke<=0?($.set(me,0),Zs(me)):$.set(me,ke)},cleanup:async()=>{Jn(),bi(),Wt.forEach(me=>{clearTimeout(me)}),Wt.clear();const X=[...A.values()],Se=[...R.observers.keys()];for(const me of Se)$s(me);Xn(),await Promise.all(X.map(async me=>{await o.cancelQueries({queryKey:me,exact:!0}),o.removeQueries({queryKey:me,exact:!0})}))}}},le=async q=>{const V=[...A.values()].map(ie=>R.observers.get(ws(ie)).refetch({throwOnError:q==null?void 0:q.throwOnError}));return Promise.all(V)},be=(q,F)=>{r?o.setQueryData(q,V=>{if(!V||typeof V!="object")return V;if(Array.isArray(V))return F;const ie=r(V);if(Array.isArray(ie)){for(const ve of Object.keys(V))if(V[ve]===ie)return{...V,[ve]:F}}if(Array.isArray(V.data))return{...V,data:F};if(Array.isArray(V.items))return{...V,items:F};if(Array.isArray(V.results))return{...V,results:F};for(const ve of Object.keys(V))if(Array.isArray(V[ve]))return{...V,[ve]:F};return V}):o.setQueryData(q,F)},re=q=>{const F=o.getQueryCache().findAll({queryKey:M});if(F.length>0)for(const V of F)be(V.queryKey,q);else be(M,q)};let N=null;const U=q=>{const{begin:F,write:V,commit:ie,collection:ve}=q,ye=typeof t=="function"?t({}):t;return N={collection:ve,queryClient:o,queryKey:ye,getKey:m,begin:F,write:V,commit:ie,updateCacheData:re},ce(q)},ne=i3(()=>N),de=b?async q=>{const F=await b(q)??{};return F.refetch!==!1&&await le(),F}:void 0,J=_?async q=>{const F=await _(q)??{};return F.refetch!==!1&&await le(),F}:void 0,k=v?async q=>{const F=await v(q)??{};return F.refetch!==!1&&await le(),F}:void 0,Y=new o3(R,le,ne);return{...x,getKey:m,syncMode:T,sync:{sync:U},onInsert:de,onUpdate:J,onDelete:k,utils:Y}}const a3="/api";async function Va(e,t){const s=await fetch(`${a3}${e}`,t);if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return s.json()}function l3(e,t){return Va(`/memories/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}function c3(e){return Va(`/memories/${e}`,{method:"DELETE"})}function u3(){return Va("/projects")}function f3(e,t){return Va(`/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({name:t})})}function fj(e,t){return Va(`/memories/${e}/projects`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:t})})}function dj(e,t){return Va(`/memories/${e}/projects/${t}`,{method:"DELETE"})}const g_=new Fz,d3=rd(m_({queryKey:["memories"],queryFn:async()=>{const e=await fetch("/api/memories");if(!e.ok)throw new Error(`${e.status}`);return e.json()},queryClient:g_,getKey:e=>e.id,onUpdate:async({transaction:e})=>{try{await Promise.all(e.mutations.map(t=>{const s=t.changes;return l3(t.original.id,{content:s.content,tags:s.tags,type:s.type,pinned:s.pinned,needsReview:s.needsReview})}))}catch{Ab.error("Failed to save — changes may not have been stored")}},onDelete:async({transaction:e})=>{try{await Promise.all(e.mutations.map(t=>c3(t.original.id)))}catch{Ab.error("Failed to delete — try again")}}})),hj=rd(m_({queryKey:["projects"],queryFn:u3,queryClient:g_,getKey:e=>e.id,onUpdate:async({transaction:e})=>{await Promise.all(e.mutations.map(t=>{const s=t.changes;return s.name!==void 0?f3(t.original.id,s.name):Promise.resolve()}))}}));function h3(){const{data:e=[],isLoading:t}=wz(s=>s.from({m:d3}),[]);return z.useMemo(()=>{if(t)return null;const s={correction:0,preference:0,decision:0,learning:0,fact:0};let r=0;for(const o of e){const l=o.type;l in s&&s[l]++,o.needsReview&&r++}return{byType:s,total:e.length,needsReview:r}},[e,t])}const Og=$R({component:p3});function p3(){const{theme:e,toggle:t}=h2(),s=h3();return fe.jsxs("div",{className:"flex flex-col h-screen bg-background text-foreground",children:[fe.jsxs("header",{className:"flex items-center gap-4 px-4 py-2.5 border-b border-border shrink-0",children:[fe.jsx(Y4,{}),fe.jsx("div",{className:"flex-1 min-w-0",children:fe.jsx(X4,{stats:s})}),fe.jsx(o6,{variant:"ghost",size:"icon-sm",onClick:t,"aria-label":"Toggle theme",children:e==="dark"?fe.jsx(F4,{weight:"regular"}):fe.jsx(K4,{weight:"regular"})})]}),fe.jsx("div",{className:"flex flex-1 min-h-0",children:fe.jsx(Mw,{})}),fe.jsx(N6,{position:"bottom-right"})]})}const m3="modulepreload",g3=function(e){return"/"+e},xS={},Mg=function(t,s,r){let o=Promise.resolve();if(s&&s.length>0){let u=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=u(s.map(p=>{if(p=g3(p),p in xS)return;xS[p]=!0;const y=p.endsWith(".css"),m=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":m3,y||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),y)return new Promise((_,v)=>{b.addEventListener("load",_),b.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return o.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})};function ae(e,t,s){function r(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);const p=u.prototype,y=Object.keys(p);for(let m=0;m<y.length;m++){const b=y[m];b in f||(f[b]=p[b].bind(f))}}const o=(s==null?void 0:s.Parent)??Object;class l extends o{}Object.defineProperty(l,"name",{value:e});function u(f){var h;const p=s!=null&&s.Parent?new l:this;r(p,f),(h=p._zod).deferred??(h.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>{var h,p;return s!=null&&s.Parent&&f instanceof s.Parent?!0:(p=(h=f==null?void 0:f._zod)==null?void 0:h.traits)==null?void 0:p.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class wa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class y_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const v_={};function yo(e){return v_}function b_(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Km(e,t){return typeof t=="bigint"?t.toString():t}function zg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kg(e){return e==null}function Dg(e){const t=e.startsWith("^")?1:0,s=e.endsWith("$")?e.length-1:e.length;return e.slice(t,s)}const ES=Symbol("evaluating");function st(e,t,s){let r;Object.defineProperty(e,t,{get(){if(r!==ES)return r===void 0&&(r=ES,r=s()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ao(e,t,s){Object.defineProperty(e,t,{value:s,writable:!0,enumerable:!0,configurable:!0})}function xr(...e){const t={};for(const s of e){const r=Object.getOwnPropertyDescriptors(s);Object.assign(t,r)}return Object.defineProperties({},t)}function CS(e){return JSON.stringify(e)}function y3(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const S_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const v3=zg(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function fc(e){if(Vf(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const s=t.prototype;return!(Vf(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function w_(e){return fc(e)?{...e}:Array.isArray(e)?[...e]:e}const b3=new Set(["string","number","symbol"]);function od(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Er(e,t,s){const r=new e._zod.constr(t??e._zod.def);return(!t||s!=null&&s.parent)&&(r._zod.parent=e),r}function Me(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function S3(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function w3(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=xr(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=s.shape[f])}return Ao(this,"shape",u),u},checks:[]});return Er(e,l)}function _3(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=xr(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Ao(this,"shape",u),u},checks:[]});return Er(e,l)}function x3(e,t){if(!fc(t))throw new Error("Invalid input to extend: expected a plain object");const s=e._zod.def.checks;if(s&&s.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=xr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Ao(this,"shape",l),l}});return Er(e,o)}function E3(e,t){if(!fc(t))throw new Error("Invalid input to safeExtend: expected a plain object");const s=xr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ao(this,"shape",r),r}});return Er(e,s)}function C3(e,t){const s=xr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ao(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Er(e,s)}function R3(e,t,s){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=xr(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(s)for(const p in s){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);s[p]&&(h[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)h[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return Ao(this,"shape",h),h},checks:[]});return Er(t,u)}function A3(e,t,s){const r=xr(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(s)for(const u in s){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);s[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Ao(this,"shape",l),l}});return Er(t,r)}function ya(e,t=0){var s;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((s=e.issues[r])==null?void 0:s.continue)!==!0)return!0;return!1}function __(e,t){return t.map(s=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(e),s})}function uf(e){return typeof e=="string"?e:e==null?void 0:e.message}function vo(e,t,s){var o,l,u,f,h,p;const r={...e,path:e.path??[]};if(!e.message){const y=uf((u=(l=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:l.error)==null?void 0:u.call(l,e))??uf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??uf((h=s.customError)==null?void 0:h.call(s,e))??uf((p=s.localeError)==null?void 0:p.call(s,e))??"Invalid input";r.message=y}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function jg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function dc(...e){const[t,s,r]=e;return typeof t=="string"?{message:t,code:"custom",input:s,inst:r}:{...t}}const x_=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Km,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},E_=ae("$ZodError",x_),C_=ae("$ZodError",x_,{Parent:Error});function T3(e,t=s=>s.message){const s={},r=[];for(const o of e.issues)o.path.length>0?(s[o.path[0]]=s[o.path[0]]||[],s[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:s}}function O3(e,t=s=>s.message){const s={_errors:[]},r=o=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u}));else if(l.code==="invalid_key")r({issues:l.issues});else if(l.code==="invalid_element")r({issues:l.issues});else if(l.path.length===0)s._errors.push(t(l));else{let u=s,f=0;for(;f<l.path.length;){const h=l.path[f];f===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return r(e),s}const Ng=e=>(t,s,r,o)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise)throw new wa;if(u.issues.length){const f=new((o==null?void 0:o.Err)??e)(u.issues.map(h=>vo(h,l,yo())));throw S_(f,o==null?void 0:o.callee),f}return u.value},Ig=e=>async(t,s,r,o)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new((o==null?void 0:o.Err)??e)(u.issues.map(h=>vo(h,l,yo())));throw S_(f,o==null?void 0:o.callee),f}return u.value},ad=e=>(t,s,r)=>{const o=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:s,issues:[]},o);if(l instanceof Promise)throw new wa;return l.issues.length?{success:!1,error:new(e??E_)(l.issues.map(u=>vo(u,o,yo())))}:{success:!0,data:l.value}},M3=ad(C_),ld=e=>async(t,s,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:s,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>vo(u,o,yo())))}:{success:!0,data:l.value}},z3=ld(C_),k3=e=>(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ng(e)(t,s,o)},D3=e=>(t,s,r)=>Ng(e)(t,s,r),j3=e=>async(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ig(e)(t,s,o)},N3=e=>async(t,s,r)=>Ig(e)(t,s,r),I3=e=>(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ad(e)(t,s,o)},L3=e=>(t,s,r)=>ad(e)(t,s,r),B3=e=>async(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ld(e)(t,s,o)},U3=e=>async(t,s,r)=>ld(e)(t,s,r),P3=/^[cC][^\s-]{8,}$/,Z3=/^[0-9a-z]+$/,$3=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q3=/^[0-9a-vA-V]{20}$/,V3=/^[A-Za-z0-9]{27}$/,H3=/^[a-zA-Z0-9_-]{21}$/,K3=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F3=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RS=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,G3=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Y3(){return new RegExp(Q3,"u")}const J3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,X3=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,W3=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ek=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tk=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R_=/^[A-Za-z0-9_-]*$/,nk=/^\+[1-9]\d{6,14}$/,A_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sk=new RegExp(`^${A_}$`);function T_(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ik(e){return new RegExp(`^${T_(e)}$`)}function rk(e){const t=T_({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${s.join("|")})`;return new RegExp(`^${A_}T(?:${r})$`)}const ok=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ak=/^(?:true|false)$/i,lk=/^[^A-Z]*$/,ck=/^[^a-z]*$/,Bs=ae("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),uk=ae("$ZodCheckMaxLength",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const u=jg(o);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fk=ae("$ZodCheckMinLength",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const u=jg(o);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dk=ae("$ZodCheckLengthEquals",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,l=o.length;if(l===t.length)return;const u=jg(o),f=l>t.length;r.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),cd=ae("$ZodCheckStringFormat",(e,t)=>{var s,r;Bs.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(s=e._zod).check??(s.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hk=ae("$ZodCheckRegex",(e,t)=>{cd.init(e,t),e._zod.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pk=ae("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lk),cd.init(e,t)}),mk=ae("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ck),cd.init(e,t)}),gk=ae("$ZodCheckIncludes",(e,t)=>{Bs.init(e,t);const s=od(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${s}`:s);t.pattern=r,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),yk=ae("$ZodCheckStartsWith",(e,t)=>{Bs.init(e,t);const s=new RegExp(`^${od(t.prefix)}.*`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),vk=ae("$ZodCheckEndsWith",(e,t)=>{Bs.init(e,t);const s=new RegExp(`.*${od(t.suffix)}$`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bk=ae("$ZodCheckOverwrite",(e,t)=>{Bs.init(e,t),e._zod.check=s=>{s.value=t.tx(s.value)}});class Sk{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
81
+ Or switch to syncMode "eager" if you want all data to sync automatically.`),e.startSyncImmediate(),r.current=e,l.current=e;else if(typeof e=="function"){const S=new Ct,x=e(S);if(x==null)r.current=null;else if(x instanceof vg)x.startSyncImmediate(),r.current=x;else if(x instanceof Ct)r.current=em({query:e,startSync:!0,gcTime:tm});else if(x&&typeof x=="object")r.current=em({startSync:!0,gcTime:tm,...x});else throw new Error(`useLiveQuery callback must return a QueryBuilder, LiveQueryCollectionConfig, Collection, undefined, or null. Got: ${typeof x}`);o.current=[...t]}else r.current=em({startSync:!0,gcTime:tm,...e}),o.current=[...t];h&&(u.current=0,f.current=null);const p=z.useRef(null);(!p.current||h)&&(p.current=S=>{if(!r.current)return()=>{};const x=r.current.subscribeChanges(()=>{u.current+=1,S()});return r.current.status==="ready"&&(u.current+=1,S()),()=>{x.unsubscribe()}});const y=z.useRef(null);(!y.current||h)&&(y.current=()=>{const S=u.current,x=r.current;return(!f.current||f.current.version!==S||f.current.collection!==x)&&(f.current={collection:x,version:S}),f.current});const m=z.useSyncExternalStore(p.current,y.current),b=z.useRef(null),_=z.useRef(null);if(!b.current||b.current.version!==m.version||b.current.collection!==m.collection){if(!m.collection)_.current={state:void 0,data:void 0,collection:void 0,status:"disabled",isLoading:!1,isReady:!0,isIdle:!1,isError:!1,isCleanedUp:!1,isEnabled:!1};else{const S=Array.from(m.collection.entries()),T=m.collection.config.singleResult;let M=null,O=null;_.current={get state(){return M||(M=new Map(S)),M},get data(){return O||(O=S.map(([,R])=>R)),T?O[0]:O},collection:m.collection,status:m.collection.status,isLoading:m.collection.status==="loading",isReady:m.collection.status==="ready",isIdle:m.collection.status==="idle",isError:m.collection.status==="error",isCleanedUp:m.collection.status==="cleaned-up",isEnabled:!0}}b.current=m}return _.current}var Ic=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(){}},io,nr,Ca,VS,_z=(VS=class extends Ic{constructor(){super();pe(this,io);pe(this,nr);pe(this,Ca);ue(this,Ca,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){E(this,nr)||this.setEventListener(E(this,Ca))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,nr))==null||t.call(this),ue(this,nr,void 0))}setEventListener(t){var s;ue(this,Ca,t),(s=E(this,nr))==null||s.call(this),ue(this,nr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,io)!==t&&(ue(this,io,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof E(this,io)=="boolean"?E(this,io):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},io=new WeakMap,nr=new WeakMap,Ca=new WeakMap,VS),Cg=new _z,xz={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},sr,Qm,HS,Ez=(HS=class{constructor(){pe(this,sr,xz);pe(this,Qm,!1)}setTimeoutProvider(e){ue(this,sr,e)}setTimeout(e,t){return E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,Qm=new WeakMap,HS),Yr=new Ez;function Cz(e){setTimeout(e,0)}var Rz=typeof window>"u"||"Deno"in globalThis;function us(){}function Az(e,t){return typeof e=="function"?e(t):e}function Mm(e){return typeof e=="number"&&e>=0&&e!==1/0}function o_(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yr(e,t){return typeof e=="function"?e(t):e}function Kn(e,t){return typeof e=="function"?e(t):e}function pS(e,t){const{type:s="all",exact:r,fetchStatus:o,predicate:l,queryKey:u,stale:f}=e;if(u){if(r){if(t.queryHash!==Rg(u,t.options))return!1}else if(!uc(t.queryKey,u))return!1}if(s!=="all"){const h=t.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||o&&o!==t.state.fetchStatus||l&&!l(t))}function mS(e,t){const{exact:s,status:r,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(s){if(ws(t.options.mutationKey)!==ws(l))return!1}else if(!uc(t.options.mutationKey,l))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Rg(e,t){return((t==null?void 0:t.queryKeyHashFn)||ws)(e)}function ws(e){return JSON.stringify(e,(t,s)=>km(s)?Object.keys(s).sort().reduce((r,o)=>(r[o]=s[o],r),{}):s)}function uc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>uc(e[s],t[s])):!1}var Tz=Object.prototype.hasOwnProperty;function a_(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=gS(e)&&gS(t);if(!r&&!(km(e)&&km(t)))return t;const l=(r?e:Object.keys(e)).length,u=r?t:Object.keys(t),f=u.length,h=r?new Array(f):{};let p=0;for(let y=0;y<f;y++){const m=r?y:u[y],b=e[m],_=t[m];if(b===_){h[m]=b,(r?y<l:Tz.call(e,m))&&p++;continue}if(b===null||_===null||typeof b!="object"||typeof _!="object"){h[m]=_;continue}const v=a_(b,_,s+1);h[m]=v,v===b&&p++}return l===f&&p===l?e:h}function zm(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 gS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function km(e){if(!yS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!yS(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function yS(e){return Object.prototype.toString.call(e)==="[object Object]"}function Oz(e){return new Promise(t=>{Yr.setTimeout(t,e)})}function Dm(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?a_(e,t):t}function Mz(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function zz(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Ag=Symbol();function l_(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ag?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kz(e,t,s){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),r||(r=!0,o.aborted?s():o.addEventListener("abort",s,{once:!0})),o)}),e}var $f=(()=>{let e=()=>Rz;return{isServer(){return e()},setIsServer(t){e=t}}})();function jm(){let e,t;const s=new Promise((o,l)=>{e=o,t=l});s.status="pending",s.catch(()=>{});function r(o){Object.assign(s,o),delete s.resolve,delete s.reject}return s.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},s.reject=o=>{r({status:"rejected",reason:o}),t(o)},s}var Dz=Cz;function jz(){let e=[],t=0,s=f=>{f()},r=f=>{f()},o=Dz;const l=f=>{t?e.push(f):o(()=>{s(f)})},u=()=>{const f=e;e=[],f.length&&o(()=>{r(()=>{f.forEach(h=>{s(h)})})})};return{batch:f=>{let h;t++;try{h=f()}finally{t--,t||u()}return h},batchCalls:f=>(...h)=>{l(()=>{f(...h)})},schedule:l,setNotifyFunction:f=>{s=f},setBatchNotifyFunction:f=>{r=f},setScheduler:f=>{o=f}}}var hn=jz(),Ra,ir,Aa,KS,Nz=(KS=class extends Ic{constructor(){super();pe(this,Ra,!0);pe(this,ir);pe(this,Aa);ue(this,Aa,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(){E(this,ir)||this.setEventListener(E(this,Aa))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,ir))==null||t.call(this),ue(this,ir,void 0))}setEventListener(t){var s;ue(this,Aa,t),(s=E(this,ir))==null||s.call(this),ue(this,ir,t(this.setOnline.bind(this)))}setOnline(t){E(this,Ra)!==t&&(ue(this,Ra,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,Ra)}},Ra=new WeakMap,ir=new WeakMap,Aa=new WeakMap,KS),qf=new Nz;function Iz(e){return Math.min(1e3*2**e,3e4)}function c_(e){return(e??"online")==="online"?qf.isOnline():!0}var Nm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function u_(e){let t=!1,s=0,r;const o=jm(),l=()=>o.status!=="pending",u=S=>{var x;if(!l()){const T=new Nm(S);b(T),(x=e.onCancel)==null||x.call(e,T)}},f=()=>{t=!0},h=()=>{t=!1},p=()=>Cg.isFocused()&&(e.networkMode==="always"||qf.isOnline())&&e.canRun(),y=()=>c_(e.networkMode)&&e.canRun(),m=S=>{l()||(r==null||r(),o.resolve(S))},b=S=>{l()||(r==null||r(),o.reject(S))},_=()=>new Promise(S=>{var x;r=T=>{(l()||p())&&S(T)},(x=e.onPause)==null||x.call(e)}).then(()=>{var S;r=void 0,l()||(S=e.onContinue)==null||S.call(e)}),v=()=>{if(l())return;let S;const x=s===0?e.initialPromise:void 0;try{S=x??e.fn()}catch(T){S=Promise.reject(T)}Promise.resolve(S).then(m).catch(T=>{var L;if(l())return;const M=e.retry??($f.isServer()?0:3),O=e.retryDelay??Iz,R=typeof O=="function"?O(s,T):O,A=M===!0||typeof M=="number"&&s<M||typeof M=="function"&&M(s,T);if(t||!A){b(T);return}s++,(L=e.onFail)==null||L.call(e,s,T),Oz(R).then(()=>p()?void 0:_()).then(()=>{t?b(T):v()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(r==null||r(),o),cancelRetry:f,continueRetry:h,canStart:y,start:()=>(y()?v():_().then(v),o)}}var ro,FS,f_=(FS=class{constructor(){pe(this,ro)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mm(this.gcTime)&&ue(this,ro,Yr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($f.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,ro)!==void 0&&(Yr.clearTimeout(E(this,ro)),ue(this,ro,void 0))}},ro=new WeakMap,FS);function Lz(e){return{onFetch:(t,s)=>{var y,m,b,_,v;const r=t.options,o=(b=(m=(y=t.fetchOptions)==null?void 0:y.meta)==null?void 0:m.fetchMore)==null?void 0:b.direction,l=((_=t.state.data)==null?void 0:_.pages)||[],u=((v=t.state.data)==null?void 0:v.pageParams)||[];let f={pages:[],pageParams:[]},h=0;const p=async()=>{let S=!1;const x=O=>{kz(O,()=>t.signal,()=>S=!0)},T=l_(t.options,t.fetchOptions),M=async(O,R,A)=>{if(S)return Promise.reject(t.signal.reason);if(R==null&&O.pages.length)return Promise.resolve(O);const j=(()=>{const W={client:t.client,queryKey:t.queryKey,pageParam:R,direction:A?"backward":"forward",meta:t.options.meta};return x(W),W})(),D=await T(j),{maxPages:$}=t.options,P=A?zz:Mz;return{pages:P(O.pages,D,$),pageParams:P(O.pageParams,R,$)}};if(o&&l.length){const O=o==="backward",R=O?Bz:vS,A={pages:l,pageParams:u},L=R(r,A);f=await M(A,L,O)}else{const O=e??l.length;do{const R=h===0?u[0]??r.initialPageParam:vS(r,f);if(h>0&&R==null)break;f=await M(f,R),h++}while(h<O)}return f};t.options.persister?t.fetchFn=()=>{var S,x;return(x=(S=t.options).persister)==null?void 0:x.call(S,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=p}}}function vS(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 Bz(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 Ta,oo,Oa,cs,ao,Yt,Cc,lo,Hn,d_,ui,GS,Uz=(GS=class extends f_{constructor(t){super();pe(this,Hn);pe(this,Ta);pe(this,oo);pe(this,Oa);pe(this,cs);pe(this,ao);pe(this,Yt);pe(this,Cc);pe(this,lo);ue(this,lo,!1),ue(this,Cc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,ao,t.client),ue(this,cs,E(this,ao).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,oo,SS(this.options)),this.state=t.state??E(this,oo),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Ta)}get promise(){var t;return(t=E(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Cc),...t},t!=null&&t._type&&ue(this,Ta,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=SS(this.options);s.data!==void 0&&(this.setState(bS(s.data,s.dataUpdatedAt)),ue(this,oo,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,cs).remove(this)}setData(t,s){const r=Dm(this.state.data,t,this.options);return Ae(this,Hn,ui).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t){Ae(this,Hn,ui).call(this,{type:"setState",state:t})}cancel(t){var r,o;const s=(r=E(this,Yt))==null?void 0:r.promise;return(o=E(this,Yt))==null||o.cancel(t),s?s.then(us).catch(us):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,oo)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Kn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ag||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yr(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:!o_(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=E(this,Yt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=E(this,Yt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,cs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(E(this,Yt)&&(E(this,lo)||Ae(this,Hn,d_).call(this)?E(this,Yt).cancel({revert:!0}):E(this,Yt).cancelRetry()),this.scheduleGc()),E(this,cs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Hn,ui).call(this,{type:"invalidate"})}async fetch(t,s){var p,y,m,b,_,v,S,x,T,M,O;if(this.state.fetchStatus!=="idle"&&((p=E(this,Yt))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(E(this,Yt))return E(this,Yt).continueRetry(),E(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(A=>A.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,o=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ue(this,lo,!0),r.signal)})},l=()=>{const R=l_(this.options,s),L=(()=>{const j={client:E(this,ao),queryKey:this.queryKey,meta:this.meta};return o(j),j})();return ue(this,lo,!1),this.options.persister?this.options.persister(R,L,this):R(L)},f=(()=>{const R={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:E(this,ao),state:this.state,fetchFn:l};return o(R),R})(),h=E(this,Ta)==="infinite"?Lz(this.options.pages):this.options.behavior;h==null||h.onFetch(f,this),ue(this,Oa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=f.fetchOptions)==null?void 0:y.meta))&&Ae(this,Hn,ui).call(this,{type:"fetch",meta:(m=f.fetchOptions)==null?void 0:m.meta}),ue(this,Yt,u_({initialPromise:s==null?void 0:s.initialPromise,fn:f.fetchFn,onCancel:R=>{R instanceof Nm&&R.revert&&this.setState({...E(this,Oa),fetchStatus:"idle"}),r.abort()},onFail:(R,A)=>{Ae(this,Hn,ui).call(this,{type:"failed",failureCount:R,error:A})},onPause:()=>{Ae(this,Hn,ui).call(this,{type:"pause"})},onContinue:()=>{Ae(this,Hn,ui).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const R=await E(this,Yt).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(_=(b=E(this,cs).config).onSuccess)==null||_.call(b,R,this),(S=(v=E(this,cs).config).onSettled)==null||S.call(v,R,this.state.error,this),R}catch(R){if(R instanceof Nm){if(R.silent)return E(this,Yt).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw Ae(this,Hn,ui).call(this,{type:"error",error:R}),(T=(x=E(this,cs).config).onError)==null||T.call(x,R,this),(O=(M=E(this,cs).config).onSettled)==null||O.call(M,this.state.data,R,this),R}finally{this.scheduleGc()}}},Ta=new WeakMap,oo=new WeakMap,Oa=new WeakMap,cs=new WeakMap,ao=new WeakMap,Yt=new WeakMap,Cc=new WeakMap,lo=new WeakMap,Hn=new WeakSet,d_=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ui=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,...h_(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...bS(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ue(this,Oa,t.manual?o:void 0),o;case"error":const l=t.error;return{...r,error:l,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),hn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,cs).notify({query:this,type:"updated",action:t})})},GS);function h_(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:c_(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function bS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function SS(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 On,Fe,Rc,vn,co,Ma,di,rr,Ac,za,ka,uo,fo,or,Da,et,Jl,Im,Lm,Bm,Um,Pm,Zm,$m,p_,QS,Pz=(QS=class extends Ic{constructor(t,s){super();pe(this,et);pe(this,On);pe(this,Fe);pe(this,Rc);pe(this,vn);pe(this,co);pe(this,Ma);pe(this,di);pe(this,rr);pe(this,Ac);pe(this,za);pe(this,ka);pe(this,uo);pe(this,fo);pe(this,or);pe(this,Da,new Set);this.options=s,ue(this,On,t),ue(this,rr,null),ue(this,di,jm()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,Fe).addObserver(this),wS(E(this,Fe),this.options)?Ae(this,et,Jl).call(this):this.updateResult(),Ae(this,et,Um).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qm(E(this,Fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qm(E(this,Fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,et,Pm).call(this),Ae(this,et,Zm).call(this),E(this,Fe).removeObserver(this)}setOptions(t){const s=this.options,r=E(this,Fe);if(this.options=E(this,On).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kn(this.options.enabled,E(this,Fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,et,$m).call(this),E(this,Fe).setOptions(this.options),s._defaulted&&!zm(this.options,s)&&E(this,On).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,Fe),observer:this});const o=this.hasListeners();o&&_S(E(this,Fe),r,this.options,s)&&Ae(this,et,Jl).call(this),this.updateResult(),o&&(E(this,Fe)!==r||Kn(this.options.enabled,E(this,Fe))!==Kn(s.enabled,E(this,Fe))||yr(this.options.staleTime,E(this,Fe))!==yr(s.staleTime,E(this,Fe)))&&Ae(this,et,Im).call(this);const l=Ae(this,et,Lm).call(this);o&&(E(this,Fe)!==r||Kn(this.options.enabled,E(this,Fe))!==Kn(s.enabled,E(this,Fe))||l!==E(this,or))&&Ae(this,et,Bm).call(this,l)}getOptimisticResult(t){const s=E(this,On).getQueryCache().build(E(this,On),t),r=this.createResult(s,t);return $z(this,r)&&(ue(this,vn,r),ue(this,Ma,this.options),ue(this,co,E(this,Fe).state)),r}getCurrentResult(){return E(this,vn)}trackResult(t,s){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),s==null||s(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,di).status==="pending"&&E(this,di).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(t){E(this,Da).add(t)}getCurrentQuery(){return E(this,Fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=E(this,On).defaultQueryOptions(t),r=E(this,On).getQueryCache().build(E(this,On),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return Ae(this,et,Jl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,vn)))}createResult(t,s){var $;const r=E(this,Fe),o=this.options,l=E(this,vn),u=E(this,co),f=E(this,Ma),p=t!==r?t.state:E(this,Rc),{state:y}=t;let m={...y},b=!1,_;if(s._optimisticResults){const P=this.hasListeners(),W=!P&&wS(t,s),ce=P&&_S(t,r,s,o);(W||ce)&&(m={...m,...h_(y.data,t.options)}),s._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:v,errorUpdatedAt:S,status:x}=m;_=m.data;let T=!1;if(s.placeholderData!==void 0&&_===void 0&&x==="pending"){let P;l!=null&&l.isPlaceholderData&&s.placeholderData===(f==null?void 0:f.placeholderData)?(P=l.data,T=!0):P=typeof s.placeholderData=="function"?s.placeholderData(($=E(this,ka))==null?void 0:$.state.data,E(this,ka)):s.placeholderData,P!==void 0&&(x="success",_=Dm(l==null?void 0:l.data,P,s),b=!0)}if(s.select&&_!==void 0&&!T)if(l&&_===(u==null?void 0:u.data)&&s.select===E(this,Ac))_=E(this,za);else try{ue(this,Ac,s.select),_=s.select(_),_=Dm(l==null?void 0:l.data,_,s),ue(this,za,_),ue(this,rr,null)}catch(P){ue(this,rr,P)}E(this,rr)&&(v=E(this,rr),_=E(this,za),S=Date.now(),x="error");const M=m.fetchStatus==="fetching",O=x==="pending",R=x==="error",A=O&&M,L=_!==void 0,D={status:x,fetchStatus:m.fetchStatus,isPending:O,isSuccess:x==="success",isError:R,isInitialLoading:A,isLoading:A,data:_,dataUpdatedAt:m.dataUpdatedAt,error:v,errorUpdatedAt:S,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>p.dataUpdateCount||m.errorUpdateCount>p.errorUpdateCount,isFetching:M,isRefetching:M&&!O,isLoadingError:R&&!L,isPaused:m.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:R&&L,isStale:Tg(t,s),refetch:this.refetch,promise:E(this,di),isEnabled:Kn(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=D.data!==void 0,W=D.status==="error"&&!P,ce=re=>{W?re.reject(D.error):P&&re.resolve(D.data)},le=()=>{const re=ue(this,di,D.promise=jm());ce(re)},be=E(this,di);switch(be.status){case"pending":t.queryHash===r.queryHash&&ce(be);break;case"fulfilled":(W||D.data!==be.value)&&le();break;case"rejected":(!W||D.error!==be.reason)&&le();break}}return D}updateResult(){const t=E(this,vn),s=this.createResult(E(this,Fe),this.options);if(ue(this,co,E(this,Fe).state),ue(this,Ma,this.options),E(this,co).data!==void 0&&ue(this,ka,E(this,Fe)),zm(s,t))return;ue(this,vn,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,l=typeof o=="function"?o():o;if(l==="all"||!l&&!E(this,Da).size)return!0;const u=new Set(l??E(this,Da));return this.options.throwOnError&&u.add("error"),Object.keys(E(this,vn)).some(f=>{const h=f;return E(this,vn)[h]!==t[h]&&u.has(h)})};Ae(this,et,p_).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,et,Um).call(this)}},On=new WeakMap,Fe=new WeakMap,Rc=new WeakMap,vn=new WeakMap,co=new WeakMap,Ma=new WeakMap,di=new WeakMap,rr=new WeakMap,Ac=new WeakMap,za=new WeakMap,ka=new WeakMap,uo=new WeakMap,fo=new WeakMap,or=new WeakMap,Da=new WeakMap,et=new WeakSet,Jl=function(t){Ae(this,et,$m).call(this);let s=E(this,Fe).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(us)),s},Im=function(){Ae(this,et,Pm).call(this);const t=yr(this.options.staleTime,E(this,Fe));if($f.isServer()||E(this,vn).isStale||!Mm(t))return;const r=o_(E(this,vn).dataUpdatedAt,t)+1;ue(this,uo,Yr.setTimeout(()=>{E(this,vn).isStale||this.updateResult()},r))},Lm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,Fe)):this.options.refetchInterval)??!1},Bm=function(t){Ae(this,et,Zm).call(this),ue(this,or,t),!($f.isServer()||Kn(this.options.enabled,E(this,Fe))===!1||!Mm(E(this,or))||E(this,or)===0)&&ue(this,fo,Yr.setInterval(()=>{(this.options.refetchIntervalInBackground||Cg.isFocused())&&Ae(this,et,Jl).call(this)},E(this,or)))},Um=function(){Ae(this,et,Im).call(this),Ae(this,et,Bm).call(this,Ae(this,et,Lm).call(this))},Pm=function(){E(this,uo)!==void 0&&(Yr.clearTimeout(E(this,uo)),ue(this,uo,void 0))},Zm=function(){E(this,fo)!==void 0&&(Yr.clearInterval(E(this,fo)),ue(this,fo,void 0))},$m=function(){const t=E(this,On).getQueryCache().build(E(this,On),this.options);if(t===E(this,Fe))return;const s=E(this,Fe);ue(this,Fe,t),ue(this,Rc,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},p_=function(t){hn.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(E(this,vn))}),E(this,On).getQueryCache().notify({query:E(this,Fe),type:"observerResultsUpdated"})})},QS);function Zz(e,t){return Kn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Kn(t.retryOnMount,e)===!1)}function wS(e,t){return Zz(e,t)||e.state.data!==void 0&&qm(e,t,t.refetchOnMount)}function qm(e,t,s){if(Kn(t.enabled,e)!==!1&&yr(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Tg(e,t)}return!1}function _S(e,t,s,r){return(e!==t||Kn(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Tg(e,s)}function Tg(e,t){return Kn(t.enabled,e)!==!1&&e.isStaleByTime(yr(t.staleTime,e))}function $z(e,t){return!zm(e.getCurrentResult(),t)}var Tc,js,dn,ho,Ns,Gi,YS,qz=(YS=class extends f_{constructor(t){super();pe(this,Ns);pe(this,Tc);pe(this,js);pe(this,dn);pe(this,ho);ue(this,Tc,t.client),this.mutationId=t.mutationId,ue(this,dn,t.mutationCache),ue(this,js,[]),this.state=t.state||Vz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,js).includes(t)||(E(this,js).push(t),this.clearGcTimeout(),E(this,dn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,js,E(this,js).filter(s=>s!==t)),this.scheduleGc(),E(this,dn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,js).length||(this.state.status==="pending"?this.scheduleGc():E(this,dn).remove(this))}continue(){var t;return((t=E(this,ho))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var u,f,h,p,y,m,b,_,v,S,x,T,M,O,R,A,L,j;const s=()=>{Ae(this,Ns,Gi).call(this,{type:"continue"})},r={client:E(this,Tc),meta:this.options.meta,mutationKey:this.options.mutationKey};ue(this,ho,u_({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(D,$)=>{Ae(this,Ns,Gi).call(this,{type:"failed",failureCount:D,error:$})},onPause:()=>{Ae(this,Ns,Gi).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,dn).canRun(this)}));const o=this.state.status==="pending",l=!E(this,ho).canStart();try{if(o)s();else{Ae(this,Ns,Gi).call(this,{type:"pending",variables:t,isPaused:l}),E(this,dn).config.onMutate&&await E(this,dn).config.onMutate(t,this,r);const $=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));$!==this.state.context&&Ae(this,Ns,Gi).call(this,{type:"pending",context:$,variables:t,isPaused:l})}const D=await E(this,ho).start();return await((p=(h=E(this,dn).config).onSuccess)==null?void 0:p.call(h,D,t,this.state.context,this,r)),await((m=(y=this.options).onSuccess)==null?void 0:m.call(y,D,t,this.state.context,r)),await((_=(b=E(this,dn).config).onSettled)==null?void 0:_.call(b,D,null,this.state.variables,this.state.context,this,r)),await((S=(v=this.options).onSettled)==null?void 0:S.call(v,D,null,t,this.state.context,r)),Ae(this,Ns,Gi).call(this,{type:"success",data:D}),D}catch(D){try{await((T=(x=E(this,dn).config).onError)==null?void 0:T.call(x,D,t,this.state.context,this,r))}catch($){Promise.reject($)}try{await((O=(M=this.options).onError)==null?void 0:O.call(M,D,t,this.state.context,r))}catch($){Promise.reject($)}try{await((A=(R=E(this,dn).config).onSettled)==null?void 0:A.call(R,void 0,D,this.state.variables,this.state.context,this,r))}catch($){Promise.reject($)}try{await((j=(L=this.options).onSettled)==null?void 0:j.call(L,void 0,D,t,this.state.context,r))}catch($){Promise.reject($)}throw Ae(this,Ns,Gi).call(this,{type:"error",error:D}),D}finally{E(this,dn).runNext(this)}}},Tc=new WeakMap,js=new WeakMap,dn=new WeakMap,ho=new WeakMap,Ns=new WeakSet,Gi=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),hn.batch(()=>{E(this,js).forEach(r=>{r.onMutationUpdate(t)}),E(this,dn).notify({mutation:this,type:"updated",action:t})})},YS);function Vz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hi,Ss,Oc,JS,Hz=(JS=class extends Ic{constructor(t={}){super();pe(this,hi);pe(this,Ss);pe(this,Oc);this.config=t,ue(this,hi,new Set),ue(this,Ss,new Map),ue(this,Oc,0)}build(t,s,r){const o=new qz({client:t,mutationCache:this,mutationId:++Nl(this,Oc)._,options:t.defaultMutationOptions(s),state:r});return this.add(o),o}add(t){E(this,hi).add(t);const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s);r?r.push(t):E(this,Ss).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hi).delete(t)){const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&E(this,Ss).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=cf(t);if(typeof s=="string"){const r=E(this,Ss).get(s),o=r==null?void 0:r.find(l=>l.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const s=cf(t);if(typeof s=="string"){const o=(r=E(this,Ss).get(s))==null?void 0:r.find(l=>l!==t&&l.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){hn.batch(()=>{E(this,hi).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hi).clear(),E(this,Ss).clear()})}getAll(){return Array.from(E(this,hi))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>mS(s,r))}findAll(t={}){return this.getAll().filter(s=>mS(t,s))}notify(t){hn.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return hn.batch(()=>Promise.all(t.map(s=>s.continue().catch(us))))}},hi=new WeakMap,Ss=new WeakMap,Oc=new WeakMap,JS);function cf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Is,XS,Kz=(XS=class extends Ic{constructor(t={}){super();pe(this,Is);this.config=t,ue(this,Is,new Map)}build(t,s,r){const o=s.queryKey,l=s.queryHash??Rg(o,s);let u=this.get(l);return u||(u=new Uz({client:t,queryKey:o,queryHash:l,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(u)),u}add(t){E(this,Is).has(t.queryHash)||(E(this,Is).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=E(this,Is).get(t.queryHash);s&&(t.destroy(),s===t&&E(this,Is).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){hn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Is).get(t)}getAll(){return[...E(this,Is).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>pS(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>pS(t,r)):s}notify(t){hn.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){hn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){hn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Is=new WeakMap,XS),Et,ar,lr,ja,Na,cr,Ia,La,WS,Fz=(WS=class{constructor(e={}){pe(this,Et);pe(this,ar);pe(this,lr);pe(this,ja);pe(this,Na);pe(this,cr);pe(this,Ia);pe(this,La);ue(this,Et,e.queryCache||new Kz),ue(this,ar,e.mutationCache||new Hz),ue(this,lr,e.defaultOptions||{}),ue(this,ja,new Map),ue(this,Na,new Map),ue(this,cr,0)}mount(){Nl(this,cr)._++,E(this,cr)===1&&(ue(this,Ia,Cg.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Et).onFocus())})),ue(this,La,qf.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Et).onOnline())})))}unmount(){var e,t;Nl(this,cr)._--,E(this,cr)===0&&((e=E(this,Ia))==null||e.call(this),ue(this,Ia,void 0),(t=E(this,La))==null||t.call(this),ue(this,La,void 0))}isFetching(e){return E(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,ar).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=E(this,Et).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=E(this,Et).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(yr(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Et).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),o=E(this,Et).get(r.queryHash),l=o==null?void 0:o.state.data,u=Az(t,l);if(u!==void 0)return E(this,Et).build(this,r).setData(u,{...s,manual:!0})}setQueriesData(e,t,s){return hn.batch(()=>E(this,Et).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=E(this,Et).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=E(this,Et);hn.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=E(this,Et);return hn.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=hn.batch(()=>E(this,Et).findAll(e).map(o=>o.cancel(s)));return Promise.all(r).then(us).catch(us)}invalidateQueries(e,t={}){return hn.batch(()=>(E(this,Et).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=hn.batch(()=>E(this,Et).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,s);return s.throwOnError||(l=l.catch(us)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(us)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=E(this,Et).build(this,t);return s.isStaleByTime(yr(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(us).catch(us)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(us).catch(us)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qf.isOnline()?E(this,ar).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Et)}getMutationCache(){return E(this,ar)}getDefaultOptions(){return E(this,lr)}setDefaultOptions(e){ue(this,lr,e)}setQueryDefaults(e,t){E(this,ja).set(ws(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,ja).values()],s={};return t.forEach(r=>{uc(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){E(this,Na).set(ws(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Na).values()],s={};return t.forEach(r=>{uc(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,lr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Rg(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===Ag&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,lr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Et).clear(),E(this,ar).clear()}},Et=new WeakMap,ar=new WeakMap,lr=new WeakMap,ja=new WeakMap,Na=new WeakMap,cr=new WeakMap,Ia=new WeakMap,La=new WeakMap,WS);class _r extends Gn{constructor(t){super(t),this.name="QueryCollectionError"}}class Gz extends _r{constructor(){super("[QueryCollection] queryKey must be provided."),this.name="QueryKeyRequiredError"}}class Qz extends _r{constructor(){super("[QueryCollection] queryFn must be provided."),this.name="QueryFnRequiredError"}}class Yz extends _r{constructor(){super("[QueryCollection] queryClient must be provided."),this.name="QueryClientRequiredError"}}class Jz extends _r{constructor(){super("[QueryCollection] getKey must be provided."),this.name="GetKeyRequiredError"}}class Xz extends _r{constructor(){super("Collection must be in 'ready' state for manual sync operations. Sync not initialized yet."),this.name="SyncNotInitializedError"}}class Wz extends _r{constructor(t){super(`Duplicate key '${t}' found within batch operations`),this.name="DuplicateKeyInBatchError"}}class e3 extends _r{constructor(t){super(`Update operation: Item with key '${t}' does not exist`),this.name="UpdateOperationItemNotFoundError"}}class t3 extends _r{constructor(t){super(`Delete operation: Item with key '${t}' does not exist`),this.name="DeleteOperationItemNotFoundError"}}const Hr=new WeakMap;function n3(e,t){const s=Array.isArray(e)?e:[e],r=[];for(const o of s)if(o.type==="delete"){const l=Array.isArray(o.key)?o.key:[o.key];for(const u of l)r.push({type:"delete",key:u})}else{const l=Array.isArray(o.data)?o.data:[o.data];for(const u of l){let f;if(o.type==="update")f=t.getKey(u);else{const h=t.collection.validateData(u,o.type==="upsert"?"insert":o.type);f=t.getKey(h)}r.push({type:o.type,key:f,data:u})}}return r}function s3(e,t){const s=new Set;for(const r of e){if(s.has(r.key))throw new Wz(r.key);if(s.add(r.key),r.type==="update"){if(!t.collection._state.syncedData.has(r.key))throw new e3(r.key)}else if(r.type==="delete"&&!t.collection._state.syncedData.has(r.key))throw new t3(r.key)}}function Vl(e,t){const s=n3(e,t);s3(s,t),t.begin({immediate:!0});for(const o of s)switch(o.type){case"insert":{const l=t.collection.validateData(o.data,"insert");t.write({type:"insert",value:l});break}case"update":{const u={...t.collection._state.syncedData.get(o.key),...o.data},f=t.collection.validateData(u,"update",o.key);t.write({type:"update",value:f});break}case"delete":{const l=t.collection._state.syncedData.get(o.key);t.write({type:"delete",value:l});break}case"upsert":{const l=t.collection._state.syncedData.has(o.key),u=t.collection.validateData(o.data,l?"update":"insert",o.key);l?t.write({type:"update",value:u}):t.write({type:"insert",value:u});break}}t.commit();const r=Array.from(t.collection._state.syncedData.values());t.updateCacheData?t.updateCacheData(r):t.queryClient.setQueryData(t.queryKey,r)}function i3(e){function t(){const s=e();if(!s)throw new Xz;return s}return{writeInsert(s){const r={type:"insert",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeUpdate(s){const r={type:"update",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeDelete(s){const r={type:"delete",key:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeUpsert(s){const r={type:"upsert",data:s},o=t(),l=Hr.get(o);if(l!=null&&l.isActive){l.operations.push(r);return}Vl(r,o)},writeBatch(s){const r=t(),o=Hr.get(r);if(o!=null&&o.isActive)throw new Error("Cannot nest writeBatch calls. Complete the current batch before starting a new one.");const l={operations:[],isActive:!0};Hr.set(r,l);try{const u=s();if(u&&typeof u=="object"&&"then"in u&&typeof u.then=="function")throw new Error("writeBatch does not support async callbacks. The callback must be synchronous.");l.operations.length>0&&Vl(l.operations,r)}finally{l.isActive=!1,Hr.delete(r)}}}}function r3(e){var s;if(!e)return;const t={};return e.where&&(t.where=Vm(e.where)),(s=e.orderBy)!=null&&s.length&&(t.orderBy=e.orderBy.map(r=>{const o={expression:Vm(r.expression),direction:r.compareOptions.direction,nulls:r.compareOptions.nulls,stringSort:r.compareOptions.stringSort};return r.compareOptions.stringSort==="locale"?{...o,locale:r.compareOptions.locale,localeOptions:r.compareOptions.localeOptions}:o})),e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset),Object.keys(t).length===0?void 0:JSON.stringify(t)}function Vm(e){if(!e)return null;switch(e.type){case"val":return{type:"val",value:Hm(e.value)};case"ref":return{type:"ref",path:[...e.path]};case"func":return{type:"func",name:e.name,args:e.args.map(t=>Vm(t))};default:return null}}function Hm(e){if(e===void 0)return{__type:"undefined"};if(typeof e=="number"){if(Number.isNaN(e))return{__type:"nan"};if(e===Number.POSITIVE_INFINITY)return{__type:"infinity",sign:1};if(e===Number.NEGATIVE_INFINITY)return{__type:"infinity",sign:-1}}return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:e instanceof Date?{__type:"date",value:e.toJSON()}:Array.isArray(e)?e.map(t=>Hm(t)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,s])=>[t,Hm(s)])):e}const Fi="queryCollection:gc:";class o3{constructor(t,s,r){this.state=t,this.refetchFn=s,this.refetch=s,this.writeInsert=r.writeInsert,this.writeUpdate=r.writeUpdate,this.writeDelete=r.writeDelete,this.writeUpsert=r.writeUpsert,this.writeBatch=r.writeBatch}async clearError(){this.state.lastError=void 0,this.state.errorCount=0,this.state.lastErrorUpdatedAt=0,await this.refetchFn({throwOnError:!0})}get lastError(){return this.state.lastError}get isError(){return!!this.state.lastError}get errorCount(){return this.state.errorCount}get isFetching(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isFetching)}get isRefetching(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isRefetching)}get isLoading(){return Array.from(this.state.observers.values()).some(t=>t.getCurrentResult().isLoading)}get dataUpdatedAt(){return Math.max(0,...Array.from(this.state.observers.values()).map(t=>t.getCurrentResult().dataUpdatedAt))}get fetchStatus(){return Array.from(this.state.observers.values()).map(t=>t.getCurrentResult().fetchStatus)}}function m_(e){const{queryKey:t,queryFn:s,select:r,queryClient:o,enabled:l,refetchInterval:u,retry:f,retryDelay:h,staleTime:p,persistedGcTime:y,getKey:m,onInsert:b,onUpdate:_,onDelete:v,meta:S,...x}=e,T=x.syncMode??"eager",M=typeof t=="function"?t({}):t,O=q=>{if(typeof t!="function")return;q.length>=M.length&&M.every((V,ie)=>ds(V,q[ie]))||console.warn(`[QueryCollection] queryKey function must return keys that extend the base key prefix. Base: ${JSON.stringify(M)}, Got: ${JSON.stringify(q)}. This can cause stale cache issues.`)};if(!t)throw new Gz;if(!s)throw new Qz;if(!o)throw new Yz;if(!m)throw new Jz;const R={lastError:void 0,errorCount:0,lastErrorUpdatedAt:0,observers:new Map},A=new Map,L=new Map,j=new Map,D=new Map,$=new Map,P=(q,F)=>{const V=j.get(q)||new Set;V.add(F),j.set(q,V);const ie=L.get(F)||new Set;ie.add(q),L.set(F,ie)},W=(q,F)=>{const V=j.get(q)||new Set;V.delete(F),j.set(q,V);const ie=L.get(F)||new Set;return ie.delete(q),L.set(F,ie),V.size===0},ce=q=>{const{begin:F,write:V,commit:ie,markReady:ve,collection:ye,metadata:oe}=q,Ue=oe;let je=!1,Ne=!1;const Rt=new Set,Xe=new Map,Wt=new Map;let jn=Promise.resolve();const Nn=X=>(oe==null?void 0:oe.row.get(X))??ye._state.syncedMetadata.get(X),cn=X=>{const Se=Nn(X),me=Se==null?void 0:Se.queryCollection;if(!me||typeof me!="object")return new Set;const he=me.owners;return!he||typeof he!="object"?new Set:new Set(Object.keys(he))},St=(X,Se)=>{if(!oe)return;const me={...Nn(X)??{}};if(Se.size===0){delete me.queryCollection,Object.keys(me).length===0?oe.row.delete(X):oe.row.set(X,me);return}oe.row.set(X,{...me,queryCollection:{owners:Object.fromEntries(Array.from(Se.values()).map(he=>[he,!0]))}})},en=(X,Se)=>{if(!X||typeof X!="object")return;const me=X;if(me.queryHash===Se){if(me.mode==="until-revalidated")return{queryHash:Se,mode:"until-revalidated"};if(me.mode==="ttl"&&typeof me.expiresAt=="number"&&Number.isFinite(me.expiresAt))return{queryHash:Se,mode:"ttl",expiresAt:me.expiresAt}}},Es=X=>(jn=jn.then(X,X),jn),vt=X=>{const Se=Wt.get(X);Se&&(clearTimeout(Se),Wt.delete(X))},In=X=>{const Se=L.get(X);if(Se)return new Set(Se);const me=new Set;for(const[he]of ye._state.syncedData.entries()){const ke=cn(he);ke.size!==0&&(j.set(he,new Set(ke)),ke.forEach(Ce=>{const Ie=L.get(Ce)||new Set;Ie.add(he),L.set(Ce,Ie)}),ke.has(X)&&me.add(he))}return me},At=async X=>{const Se=L.get(X);if(Se&&Array.from(Se).every(Ce=>ye.has(Ce))){const Ce=new Map;return Se.forEach(Ie=>{const He=ye.get(Ie),Qe=j.get(Ie);He&&Qe&&Ce.set(Ie,{value:He,owners:new Set(Qe)})}),Ce}const me=Ue==null?void 0:Ue.row.scanPersisted;if(!me){const Ce=new Map;return In(X).forEach(Ie=>{const He=ye.get(Ie),Qe=j.get(Ie);He&&Qe&&Ce.set(Ie,{value:He,owners:new Set(Qe)})}),Ce}const he=new Map;return(await me()).forEach(Ce=>{const Ie=Ce.metadata,He=Ie==null?void 0:Ie.queryCollection;if(!He||typeof He!="object")return;const Qe=He.owners;if(!Qe||typeof Qe!="object")return;const kt=new Set(Object.keys(Qe));kt.size!==0&&(j.set(Ce.key,new Set(kt)),kt.forEach(wt=>{const pt=L.get(wt)||new Set;pt.add(Ce.key),L.set(wt,pt)}),kt.has(X)&&he.set(Ce.key,{value:Ce.value,owners:kt}))}),he},Ge=async X=>{if(!oe)return;const Se=await At(X),me=[];F(),Se.forEach(({value:he,owners:ke},Ce)=>{ke.delete(X),St(Ce,ke),W(Ce,X)&&me.push(he)}),me.forEach(he=>{V({type:"delete",value:he})}),oe.collection.delete(`${Fi}${X}`),ie()},ct=X=>{if(X.mode!=="ttl")return;vt(X.queryHash);const Se=Math.max(0,X.expiresAt-Date.now()),me=setTimeout(()=>{Wt.delete(X.queryHash),Es(async()=>{const he=oe==null?void 0:oe.collection.get(`${Fi}${X.queryHash}`),ke=en(he,X.queryHash);!ke||ke.mode!=="ttl"||ke.expiresAt>Date.now()||await Ge(X.queryHash)})},Se);Wt.set(X.queryHash,me)},_n=async()=>{if(!oe)return;const X=oe.collection.list(Fi),Se=Date.now();for(const{key:me,value:he}of X){const ke=me.slice(Fi.length),Ce=en(he,ke);Ce&&(Ce.mode==="ttl"&&Ce.expiresAt<=Se?await Ge(Ce.queryHash):Ce.mode==="ttl"&&ct(Ce))}},Qn=X=>{if(typeof t=="function")return t(X);if(T==="on-demand"){const Se=r3(X);return Se!==void 0?[...t,Se]:t}else return t},yi=oe==null?void 0:oe.collection.list(Fi),Yn=!yi||yi.length===0?(Ne=!0,Promise.resolve()):Es(async()=>{try{await _n()}finally{Ne=!0}}),vi=(X={},Se=s)=>{var it;if(!Ne)return Yn.then(()=>{const ft=vi(X,Se);return ft===!0?void 0:ft});const me=Qn(X),he=ws(me),ke={...S,loadSubsetOptions:X},Ce=oe==null?void 0:oe.collection.get(`${Fi}${he}`);if(en(Ce,he)!==void 0&&Rt.add(he),vt(he),O(me),R.observers.has(he)){$.set(he,($.get(he)||0)+1);const ft=R.observers.get(he),mn=ft.getCurrentResult();return mn.isSuccess?!0:mn.isError?Promise.reject(mn.error):o.getQueryData(me)!==void 0?!0:new Promise((Cr,ud)=>{const Ka=ft.subscribe(qs=>{queueMicrotask(()=>{qs.isSuccess?(Ka(),Cr()):qs.isError&&(Ka(),ud(qs.error))})})})}const Ie={queryKey:me,queryFn:Se,meta:ke,structuralSharing:!0,notifyOnChangeProps:"all",...l!==void 0&&{enabled:l},...u!==void 0&&{refetchInterval:u},...f!==void 0&&{retry:f},...h!==void 0&&{retryDelay:h},...p!==void 0&&{staleTime:p}},He=new Pz(o,Ie),Qe=(it=o.getQueryCache().find({queryKey:me,exact:!0}))==null?void 0:it.gcTime,kt=y??Qe;if(A.set(he,me),R.observers.set(he,He),kt!==void 0?Xe.set(he,kt):Xe.delete(he),$.set(he,($.get(he)||0)+1),o.getQueryData(me)!==void 0)return(je||ye.subscriberCount>0)&&zt(He,he),!0;const pt=new Promise((ft,mn)=>{const Si=He.subscribe(Cr=>{queueMicrotask(()=>{Cr.isSuccess?(Si(),ft()):Cr.isError&&(Si(),mn(Cr.error))})})});return(je||ye.subscriberCount>0)&&zt(He,he),pt},gs=(X,Se,me)=>{const he=ws(X);if(ye.status==="cleaned-up")return;R.lastError=void 0,R.errorCount=0;const ke=Se.data,Ce=r?r(ke):ke;if(!Array.isArray(Ce)||Ce.some(wt=>typeof wt!="object")){const wt=r?`@tanstack/query-db-collection: select() must return an array of objects. Got: ${typeof Ce} for queryKey ${JSON.stringify(X)}`:`@tanstack/query-db-collection: queryFn must return an array of objects. Got: ${typeof Ce} for queryKey ${JSON.stringify(X)}`;console.error(wt);return}const Ie=new Map(ye._state.syncedData.entries()),He=me!==void 0,Qe=He?new Set(me.keys()):In(he),kt=new Map;Ce.forEach(wt=>{const pt=m(wt);kt.set(pt,wt)}),F(),oe&&oe.collection.delete(`${Fi}${he}`),Qe.forEach(wt=>{var ft;const pt=He?(ft=me.get(wt))==null?void 0:ft.value:Ie.get(wt);if(!pt)return;const it=kt.get(wt);if(it)ds(pt,it)||V({type:"update",value:it});else{const mn=cn(wt);mn.delete(he),St(wt,mn),W(wt,he)&&V({type:"delete",value:pt})}}),kt.forEach((wt,pt)=>{const it=cn(pt);it.has(he)||(it.add(he),St(pt,it)),P(pt,he),Ie.has(pt)||V({type:"insert",value:wt})}),ie(),Rt.delete(he),vt(he),ve()},Us=async(X,Se)=>{const me=ws(X),he=await At(me);ye.status!=="cleaned-up"&&gs(X,Se,he)},Kt=X=>{const Se=ws(X);return he=>{if(he.isSuccess){if(ye.deferDataRefresh){ye.deferDataRefresh.then(()=>{const ke=R.observers.get(Se);ke&&ke.refetch().catch(()=>{})});return}Rt.has(Se)?Us(X,he).catch(ke=>{console.error(`[QueryCollection] Error reconciling query ${String(X)}:`,ke)}):gs(X,he)}else he.isError&&((he.errorUpdatedAt!==R.lastErrorUpdatedAt||he.error!==R.lastError)&&(R.lastError=he.error,R.errorCount++,R.lastErrorUpdatedAt=he.errorUpdatedAt),console.error(`[QueryCollection] Error observing query ${String(X)}:`,he.error),ve())}},Ln=X=>D.has(X),zt=(X,Se)=>{if(!Ln(Se)){const me=A.get(Se),he=Kt(me),ke=X.subscribe(he);D.set(Se,ke);const Ce=X.getCurrentResult();(Ce.isSuccess||Ce.isError)&&he(Ce)}},To=()=>{R.observers.forEach(zt)},bi=()=>{D.forEach(X=>{X()}),D.clear()};je=!0;const Jn=ye.on("subscribers:change",({subscriberCount:X})=>{X>0?To():X===0&&bi()});if(T==="eager"){const X=vi({});X instanceof Promise&&X.catch(()=>{})}else Ne?ve():Yn.then(()=>{ve()});To(),R.observers.forEach((X,Se)=>{const me=A.get(Se);Kt(me)(X.getCurrentResult())});const Ps=X=>{var Ie;(Ie=D.get(X))==null||Ie(),D.delete(X),vt(X),Rt.delete(X);const Se=L.get(X)??new Set,me=new Map,he=[];Se.forEach(He=>{const Qe=j.get(He);if(!Qe)return;const kt=new Set(Qe);kt.delete(X),me.set(He,kt),kt.size===0&&ye.has(He)&&he.push(ye.get(He))});const ke=oe!==void 0&&me.size>0,Ce=ke||he.length>0;Ce&&F(),me.forEach((He,Qe)=>{He.size===0?j.delete(Qe):j.set(Qe,He),ke&&St(Qe,He)}),he.length>0&&he.forEach(He=>{V({type:"delete",value:He})}),Ce&&ie(),R.observers.delete(X),L.delete(X),A.delete(X),$.delete(X),Xe.delete(X)},Zs=X=>{var Ce,Ie;const Se=$.get(X)||0,me=R.observers.get(X),he=Xe.get(X);if(Se<=0&&((Ce=D.get(X))==null||Ce(),D.delete(X)),(me==null?void 0:me.hasListeners())??!1){$.set(X,0);return}if(Se>0&&console.warn(`[cleanupQueryIfIdle] Invariant violation: refcount=${Se} but no listeners. Cleaning up to prevent leak.`,{hashedQueryKey:X}),he!==void 0&&oe&&(Ue!=null&&Ue.row.scanPersisted)){F(),oe.collection.set(`${Fi}${X}`,{queryHash:X,mode:he===Number.POSITIVE_INFINITY?"until-revalidated":"ttl",...he===Number.POSITIVE_INFINITY?{}:{expiresAt:Date.now()+he}}),ie(),he!==Number.POSITIVE_INFINITY&&ct({queryHash:X,mode:"ttl",expiresAt:Date.now()+he}),(Ie=D.get(X))==null||Ie(),D.delete(X),R.observers.delete(X),A.delete(X),$.set(X,0);return}Ps(X)},$s=X=>{Ps(X)},Xn=o.getQueryCache().subscribe(X=>{const Se=X.query.queryHash;X.type==="removed"&&A.has(Se)&&Zs(Se)});return{loadSubset:T==="eager"?void 0:vi,unloadSubset:T==="eager"?void 0:X=>{const Se=Qn(X),me=ws(Se),ke=($.get(me)||0)-1;ke<=0?($.set(me,0),Zs(me)):$.set(me,ke)},cleanup:async()=>{Jn(),bi(),Wt.forEach(me=>{clearTimeout(me)}),Wt.clear();const X=[...A.values()],Se=[...R.observers.keys()];for(const me of Se)$s(me);Xn(),await Promise.all(X.map(async me=>{await o.cancelQueries({queryKey:me,exact:!0}),o.removeQueries({queryKey:me,exact:!0})}))}}},le=async q=>{const V=[...A.values()].map(ie=>R.observers.get(ws(ie)).refetch({throwOnError:q==null?void 0:q.throwOnError}));return Promise.all(V)},be=(q,F)=>{r?o.setQueryData(q,V=>{if(!V||typeof V!="object")return V;if(Array.isArray(V))return F;const ie=r(V);if(Array.isArray(ie)){for(const ve of Object.keys(V))if(V[ve]===ie)return{...V,[ve]:F}}if(Array.isArray(V.data))return{...V,data:F};if(Array.isArray(V.items))return{...V,items:F};if(Array.isArray(V.results))return{...V,results:F};for(const ve of Object.keys(V))if(Array.isArray(V[ve]))return{...V,[ve]:F};return V}):o.setQueryData(q,F)},re=q=>{const F=o.getQueryCache().findAll({queryKey:M});if(F.length>0)for(const V of F)be(V.queryKey,q);else be(M,q)};let N=null;const U=q=>{const{begin:F,write:V,commit:ie,collection:ve}=q,ye=typeof t=="function"?t({}):t;return N={collection:ve,queryClient:o,queryKey:ye,getKey:m,begin:F,write:V,commit:ie,updateCacheData:re},ce(q)},ne=i3(()=>N),de=b?async q=>{const F=await b(q)??{};return F.refetch!==!1&&await le(),F}:void 0,J=_?async q=>{const F=await _(q)??{};return F.refetch!==!1&&await le(),F}:void 0,k=v?async q=>{const F=await v(q)??{};return F.refetch!==!1&&await le(),F}:void 0,Y=new o3(R,le,ne);return{...x,getKey:m,syncMode:T,sync:{sync:U},onInsert:de,onUpdate:J,onDelete:k,utils:Y}}const a3="/api";async function Va(e,t){const s=await fetch(`${a3}${e}`,t);if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return s.json()}function l3(e,t){return Va(`/memories/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}function c3(e){return Va(`/memories/${e}`,{method:"DELETE"})}function u3(){return Va("/projects")}function f3(e,t){return Va(`/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({name:t})})}function fj(e,t){return Va(`/memories/${e}/projects`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:t})})}function dj(e,t){return Va(`/memories/${e}/projects/${t}`,{method:"DELETE"})}const g_=new Fz,d3=rd(m_({queryKey:["memories"],queryFn:async()=>{const e=await fetch("/api/memories");if(!e.ok)throw new Error(`${e.status}`);return e.json()},queryClient:g_,getKey:e=>e.id,onUpdate:async({transaction:e})=>{try{await Promise.all(e.mutations.map(t=>{const s=t.changes;return l3(t.original.id,{content:s.content,tags:s.tags,type:s.type,pinned:s.pinned})}))}catch{Ab.error("Failed to save — changes may not have been stored")}},onDelete:async({transaction:e})=>{try{await Promise.all(e.mutations.map(t=>c3(t.original.id)))}catch{Ab.error("Failed to delete — try again")}}})),hj=rd(m_({queryKey:["projects"],queryFn:u3,queryClient:g_,getKey:e=>e.id,onUpdate:async({transaction:e})=>{await Promise.all(e.mutations.map(t=>{const s=t.changes;return s.name!==void 0?f3(t.original.id,s.name):Promise.resolve()}))}}));function h3(){const{data:e=[],isLoading:t}=wz(s=>s.from({m:d3}),[]);return z.useMemo(()=>{if(t)return null;const s={correction:0,preference:0,decision:0,learning:0,fact:0};let r=0;for(const o of e){const l=o.type;l in s&&s[l]++,o.reviewEvents.length>0&&r++}return{byType:s,total:e.length,needsReview:r}},[e,t])}const Og=$R({component:p3});function p3(){const{theme:e,toggle:t}=h2(),s=h3();return fe.jsxs("div",{className:"flex flex-col h-screen bg-background text-foreground",children:[fe.jsxs("header",{className:"flex items-center gap-4 px-4 py-2.5 border-b border-border shrink-0",children:[fe.jsx(Y4,{}),fe.jsx("div",{className:"flex-1 min-w-0",children:fe.jsx(X4,{stats:s})}),fe.jsx(o6,{variant:"ghost",size:"icon-sm",onClick:t,"aria-label":"Toggle theme",children:e==="dark"?fe.jsx(F4,{weight:"regular"}):fe.jsx(K4,{weight:"regular"})})]}),fe.jsx("div",{className:"flex flex-1 min-h-0",children:fe.jsx(Mw,{})}),fe.jsx(N6,{position:"bottom-right"})]})}const m3="modulepreload",g3=function(e){return"/"+e},xS={},Mg=function(t,s,r){let o=Promise.resolve();if(s&&s.length>0){let u=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=u(s.map(p=>{if(p=g3(p),p in xS)return;xS[p]=!0;const y=p.endsWith(".css"),m=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":m3,y||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),y)return new Promise((_,v)=>{b.addEventListener("load",_),b.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return o.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})};function ae(e,t,s){function r(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);const p=u.prototype,y=Object.keys(p);for(let m=0;m<y.length;m++){const b=y[m];b in f||(f[b]=p[b].bind(f))}}const o=(s==null?void 0:s.Parent)??Object;class l extends o{}Object.defineProperty(l,"name",{value:e});function u(f){var h;const p=s!=null&&s.Parent?new l:this;r(p,f),(h=p._zod).deferred??(h.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>{var h,p;return s!=null&&s.Parent&&f instanceof s.Parent?!0:(p=(h=f==null?void 0:f._zod)==null?void 0:h.traits)==null?void 0:p.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class wa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class y_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const v_={};function yo(e){return v_}function b_(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Km(e,t){return typeof t=="bigint"?t.toString():t}function zg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kg(e){return e==null}function Dg(e){const t=e.startsWith("^")?1:0,s=e.endsWith("$")?e.length-1:e.length;return e.slice(t,s)}const ES=Symbol("evaluating");function st(e,t,s){let r;Object.defineProperty(e,t,{get(){if(r!==ES)return r===void 0&&(r=ES,r=s()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ao(e,t,s){Object.defineProperty(e,t,{value:s,writable:!0,enumerable:!0,configurable:!0})}function xr(...e){const t={};for(const s of e){const r=Object.getOwnPropertyDescriptors(s);Object.assign(t,r)}return Object.defineProperties({},t)}function CS(e){return JSON.stringify(e)}function y3(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const S_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const v3=zg(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function fc(e){if(Vf(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const s=t.prototype;return!(Vf(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function w_(e){return fc(e)?{...e}:Array.isArray(e)?[...e]:e}const b3=new Set(["string","number","symbol"]);function od(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Er(e,t,s){const r=new e._zod.constr(t??e._zod.def);return(!t||s!=null&&s.parent)&&(r._zod.parent=e),r}function Me(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function S3(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function w3(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=xr(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=s.shape[f])}return Ao(this,"shape",u),u},checks:[]});return Er(e,l)}function _3(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=xr(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Ao(this,"shape",u),u},checks:[]});return Er(e,l)}function x3(e,t){if(!fc(t))throw new Error("Invalid input to extend: expected a plain object");const s=e._zod.def.checks;if(s&&s.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=xr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Ao(this,"shape",l),l}});return Er(e,o)}function E3(e,t){if(!fc(t))throw new Error("Invalid input to safeExtend: expected a plain object");const s=xr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ao(this,"shape",r),r}});return Er(e,s)}function C3(e,t){const s=xr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ao(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Er(e,s)}function R3(e,t,s){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=xr(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(s)for(const p in s){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);s[p]&&(h[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)h[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return Ao(this,"shape",h),h},checks:[]});return Er(t,u)}function A3(e,t,s){const r=xr(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(s)for(const u in s){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);s[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Ao(this,"shape",l),l}});return Er(t,r)}function ya(e,t=0){var s;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((s=e.issues[r])==null?void 0:s.continue)!==!0)return!0;return!1}function __(e,t){return t.map(s=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(e),s})}function uf(e){return typeof e=="string"?e:e==null?void 0:e.message}function vo(e,t,s){var o,l,u,f,h,p;const r={...e,path:e.path??[]};if(!e.message){const y=uf((u=(l=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:l.error)==null?void 0:u.call(l,e))??uf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??uf((h=s.customError)==null?void 0:h.call(s,e))??uf((p=s.localeError)==null?void 0:p.call(s,e))??"Invalid input";r.message=y}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function jg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function dc(...e){const[t,s,r]=e;return typeof t=="string"?{message:t,code:"custom",input:s,inst:r}:{...t}}const x_=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Km,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},E_=ae("$ZodError",x_),C_=ae("$ZodError",x_,{Parent:Error});function T3(e,t=s=>s.message){const s={},r=[];for(const o of e.issues)o.path.length>0?(s[o.path[0]]=s[o.path[0]]||[],s[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:s}}function O3(e,t=s=>s.message){const s={_errors:[]},r=o=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u}));else if(l.code==="invalid_key")r({issues:l.issues});else if(l.code==="invalid_element")r({issues:l.issues});else if(l.path.length===0)s._errors.push(t(l));else{let u=s,f=0;for(;f<l.path.length;){const h=l.path[f];f===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return r(e),s}const Ng=e=>(t,s,r,o)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise)throw new wa;if(u.issues.length){const f=new((o==null?void 0:o.Err)??e)(u.issues.map(h=>vo(h,l,yo())));throw S_(f,o==null?void 0:o.callee),f}return u.value},Ig=e=>async(t,s,r,o)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new((o==null?void 0:o.Err)??e)(u.issues.map(h=>vo(h,l,yo())));throw S_(f,o==null?void 0:o.callee),f}return u.value},ad=e=>(t,s,r)=>{const o=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:s,issues:[]},o);if(l instanceof Promise)throw new wa;return l.issues.length?{success:!1,error:new(e??E_)(l.issues.map(u=>vo(u,o,yo())))}:{success:!0,data:l.value}},M3=ad(C_),ld=e=>async(t,s,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:s,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>vo(u,o,yo())))}:{success:!0,data:l.value}},z3=ld(C_),k3=e=>(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ng(e)(t,s,o)},D3=e=>(t,s,r)=>Ng(e)(t,s,r),j3=e=>async(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ig(e)(t,s,o)},N3=e=>async(t,s,r)=>Ig(e)(t,s,r),I3=e=>(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ad(e)(t,s,o)},L3=e=>(t,s,r)=>ad(e)(t,s,r),B3=e=>async(t,s,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ld(e)(t,s,o)},U3=e=>async(t,s,r)=>ld(e)(t,s,r),P3=/^[cC][^\s-]{8,}$/,Z3=/^[0-9a-z]+$/,$3=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q3=/^[0-9a-vA-V]{20}$/,V3=/^[A-Za-z0-9]{27}$/,H3=/^[a-zA-Z0-9_-]{21}$/,K3=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F3=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RS=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,G3=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Y3(){return new RegExp(Q3,"u")}const J3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,X3=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,W3=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ek=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tk=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R_=/^[A-Za-z0-9_-]*$/,nk=/^\+[1-9]\d{6,14}$/,A_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sk=new RegExp(`^${A_}$`);function T_(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ik(e){return new RegExp(`^${T_(e)}$`)}function rk(e){const t=T_({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${s.join("|")})`;return new RegExp(`^${A_}T(?:${r})$`)}const ok=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ak=/^(?:true|false)$/i,lk=/^[^A-Z]*$/,ck=/^[^a-z]*$/,Bs=ae("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),uk=ae("$ZodCheckMaxLength",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const u=jg(o);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fk=ae("$ZodCheckMinLength",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const u=jg(o);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dk=ae("$ZodCheckLengthEquals",(e,t)=>{var s;Bs.init(e,t),(s=e._zod.def).when??(s.when=r=>{const o=r.value;return!kg(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,l=o.length;if(l===t.length)return;const u=jg(o),f=l>t.length;r.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),cd=ae("$ZodCheckStringFormat",(e,t)=>{var s,r;Bs.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(s=e._zod).check??(s.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hk=ae("$ZodCheckRegex",(e,t)=>{cd.init(e,t),e._zod.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pk=ae("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lk),cd.init(e,t)}),mk=ae("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ck),cd.init(e,t)}),gk=ae("$ZodCheckIncludes",(e,t)=>{Bs.init(e,t);const s=od(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${s}`:s);t.pattern=r,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),yk=ae("$ZodCheckStartsWith",(e,t)=>{Bs.init(e,t);const s=new RegExp(`^${od(t.prefix)}.*`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),vk=ae("$ZodCheckEndsWith",(e,t)=>{Bs.init(e,t);const s=new RegExp(`.*${od(t.suffix)}$`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bk=ae("$ZodCheckOverwrite",(e,t)=>{Bs.init(e,t),e._zod.check=s=>{s.value=t.tx(s.value)}});class Sk{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
82
82
  `).filter(u=>u),o=Math.min(...r.map(u=>u.length-u.trimStart().length)),l=r.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,s=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(l=>` ${l}`)];return new t(...s,o.join(`
83
83
  `))}}const wk={major:4,minor:3,patch:6},Pt=ae("$ZodType",(e,t)=>{var o;var s;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wk;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const l of r)for(const u of l._zod.onattach)u(e);if(r.length===0)(s=e._zod).deferred??(s.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const l=(f,h,p)=>{let y=ya(f),m;for(const b of h){if(b._zod.def.when){if(!b._zod.def.when(f))continue}else if(y)continue;const _=f.issues.length,v=b._zod.check(f);if(v instanceof Promise&&(p==null?void 0:p.async)===!1)throw new wa;if(m||v instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await v,f.issues.length!==_&&(y||(y=ya(f,_)))});else{if(f.issues.length===_)continue;y||(y=ya(f,_))}}return m?m.then(()=>f):f},u=(f,h,p)=>{if(ya(f))return f.aborted=!0,f;const y=l(h,r,p);if(y instanceof Promise){if(p.async===!1)throw new wa;return y.then(m=>e._zod.parse(m,p))}return e._zod.parse(y,p)};e._zod.run=(f,h)=>{if(h.skipChecks)return e._zod.parse(f,h);if(h.direction==="backward"){const y=e._zod.parse({value:f.value,issues:[]},{...h,skipChecks:!0});return y instanceof Promise?y.then(m=>u(m,f,h)):u(y,f,h)}const p=e._zod.parse(f,h);if(p instanceof Promise){if(h.async===!1)throw new wa;return p.then(y=>l(y,r,h))}return l(p,r,h)}}st(e,"~standard",()=>({validate:l=>{var u;try{const f=M3(e,l);return f.success?{value:f.data}:{issues:(u=f.error)==null?void 0:u.issues}}catch{return z3(e,l).then(h=>{var p;return h.success?{value:h.data}:{issues:(p=h.error)==null?void 0:p.issues}})}},vendor:"zod",version:1}))}),Lg=ae("$ZodString",(e,t)=>{var s;Pt.init(e,t),e._zod.pattern=[...((s=e==null?void 0:e._zod.bag)==null?void 0:s.patterns)??[]].pop()??ok(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),yt=ae("$ZodStringFormat",(e,t)=>{cd.init(e,t),Lg.init(e,t)}),_k=ae("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=F3),yt.init(e,t)}),xk=ae("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=RS(r))}else t.pattern??(t.pattern=RS());yt.init(e,t)}),Ek=ae("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=G3),yt.init(e,t)}),Ck=ae("$ZodURL",(e,t)=>{yt.init(e,t),e._zod.check=s=>{try{const r=s.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:s.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:s.value,inst:e,continue:!t.abort})),t.normalize?s.value=o.href:s.value=r;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:e,continue:!t.abort})}}}),Rk=ae("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Y3()),yt.init(e,t)}),Ak=ae("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=H3),yt.init(e,t)}),Tk=ae("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=P3),yt.init(e,t)}),Ok=ae("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Z3),yt.init(e,t)}),Mk=ae("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$3),yt.init(e,t)}),zk=ae("$ZodXID",(e,t)=>{t.pattern??(t.pattern=q3),yt.init(e,t)}),kk=ae("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=V3),yt.init(e,t)}),Dk=ae("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=rk(t)),yt.init(e,t)}),jk=ae("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sk),yt.init(e,t)}),Nk=ae("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ik(t)),yt.init(e,t)}),Ik=ae("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=K3),yt.init(e,t)}),Lk=ae("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=J3),yt.init(e,t),e._zod.bag.format="ipv4"}),Bk=ae("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=X3),yt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=s=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:e,continue:!t.abort})}}}),Uk=ae("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=W3),yt.init(e,t)}),Pk=ae("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ek),yt.init(e,t),e._zod.check=s=>{const r=s.value.split("/");try{if(r.length!==2)throw new Error;const[o,l]=r;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:e,continue:!t.abort})}}});function O_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Zk=ae("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tk),yt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=s=>{O_(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:e,continue:!t.abort})}});function $k(e){if(!R_.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),s=t.padEnd(Math.ceil(t.length/4)*4,"=");return O_(s)}const qk=ae("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=R_),yt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=s=>{$k(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:e,continue:!t.abort})}}),Vk=ae("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nk),yt.init(e,t)});function Hk(e,t=null){try{const s=e.split(".");if(s.length!==3)return!1;const[r]=s;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Kk=ae("$ZodJWT",(e,t)=>{yt.init(e,t),e._zod.check=s=>{Hk(s.value,t.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:e,continue:!t.abort})}}),Fk=ae("$ZodBoolean",(e,t)=>{Pt.init(e,t),e._zod.pattern=ak,e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=!!s.value}catch{}const o=s.value;return typeof o=="boolean"||s.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),s}}),Gk=ae("$ZodUnknown",(e,t)=>{Pt.init(e,t),e._zod.parse=s=>s}),Qk=ae("$ZodNever",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:e}),s)});function AS(e,t,s){e.issues.length&&t.issues.push(...__(s,e.issues)),t.value[s]=e.value}const Yk=ae("$ZodArray",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>{const o=s.value;if(!Array.isArray(o))return s.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),s;s.value=Array(o.length);const l=[];for(let u=0;u<o.length;u++){const f=o[u],h=t.element._zod.run({value:f,issues:[]},r);h instanceof Promise?l.push(h.then(p=>AS(p,s,u))):AS(h,s,u)}return l.length?Promise.all(l).then(()=>s):s}});function Hf(e,t,s,r,o){if(e.issues.length){if(o&&!(s in r))return;t.issues.push(...__(s,e.issues))}e.value===void 0?s in r&&(t.value[s]=void 0):t.value[s]=e.value}function M_(e){var r,o,l,u;const t=Object.keys(e.shape);for(const f of t)if(!((u=(l=(o=(r=e.shape)==null?void 0:r[f])==null?void 0:o._zod)==null?void 0:l.traits)!=null&&u.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const s=S3(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function z_(e,t,s,r,o,l){const u=[],f=o.keySet,h=o.catchall._zod,p=h.def.type,y=h.optout==="optional";for(const m in t){if(f.has(m))continue;if(p==="never"){u.push(m);continue}const b=h.run({value:t[m],issues:[]},r);b instanceof Promise?e.push(b.then(_=>Hf(_,s,m,t,y))):Hf(b,s,m,t,y)}return u.length&&s.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>s):s}const Jk=ae("$ZodObject",(e,t)=>{Pt.init(e,t);const s=Object.getOwnPropertyDescriptor(t,"shape");if(!(s!=null&&s.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const h={...f};return Object.defineProperty(t,"shape",{value:h}),h}})}const r=zg(()=>M_(t));st(e._zod,"propValues",()=>{const f=t.shape,h={};for(const p in f){const y=f[p]._zod;if(y.values){h[p]??(h[p]=new Set);for(const m of y.values)h[p].add(m)}}return h});const o=Vf,l=t.catchall;let u;e._zod.parse=(f,h)=>{u??(u=r.value);const p=f.value;if(!o(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const y=[],m=u.shape;for(const b of u.keys){const _=m[b],v=_._zod.optout==="optional",S=_._zod.run({value:p[b],issues:[]},h);S instanceof Promise?y.push(S.then(x=>Hf(x,f,b,p,v))):Hf(S,f,b,p,v)}return l?z_(y,p,f,h,r.value,e):y.length?Promise.all(y).then(()=>f):f}}),Xk=ae("$ZodObjectJIT",(e,t)=>{Jk.init(e,t);const s=e._zod.parse,r=zg(()=>M_(t)),o=b=>{var O;const _=new Sk(["shape","payload","ctx"]),v=r.value,S=R=>{const A=CS(R);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};_.write("const input = payload.value;");const x=Object.create(null);let T=0;for(const R of v.keys)x[R]=`key_${T++}`;_.write("const newResult = {};");for(const R of v.keys){const A=x[R],L=CS(R),j=b[R],D=((O=j==null?void 0:j._zod)==null?void 0:O.optout)==="optional";_.write(`const ${A} = ${S(R)};`),D?_.write(`
84
84
  if (${A}.issues.length) {
@@ -116,4 +116,4 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`),e.st
116
116
 
117
117
  `)}_.write("payload.value = newResult;"),_.write("return payload;");const M=_.compile();return(R,A)=>M(b,R,A)};let l;const u=Vf,f=!v_.jitless,p=f&&v3.value,y=t.catchall;let m;e._zod.parse=(b,_)=>{m??(m=r.value);const v=b.value;return u(v)?f&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(l||(l=o(t.shape)),b=l(b,_),y?z_([],v,b,_,m,e):b):s(b,_):(b.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),b)}});function TS(e,t,s,r){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const o=e.filter(l=>!ya(l));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:s,errors:e.map(l=>l.issues.map(u=>vo(u,r,yo())))}),t)}const Wk=ae("$ZodUnion",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),st(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),st(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),st(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${o.map(l=>Dg(l.source)).join("|")})$`)}});const s=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,l)=>{if(s)return r(o,l);let u=!1;const f=[];for(const h of t.options){const p=h._zod.run({value:o.value,issues:[]},l);if(p instanceof Promise)f.push(p),u=!0;else{if(p.issues.length===0)return p;f.push(p)}}return u?Promise.all(f).then(h=>TS(h,o,e,l)):TS(f,o,e,l)}}),e5=ae("$ZodIntersection",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>{const o=s.value,l=t.left._zod.run({value:o,issues:[]},r),u=t.right._zod.run({value:o,issues:[]},r);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([h,p])=>OS(s,h,p)):OS(s,l,u)}});function Fm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fc(e)&&fc(t)){const s=Object.keys(t),r=Object.keys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of r){const u=Fm(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};o[l]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<e.length;r++){const o=e[r],l=t[r],u=Fm(o,l);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};s.push(u.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function OS(e,t,s){const r=new Map;let o;for(const f of t.issues)if(f.code==="unrecognized_keys"){o??(o=f);for(const h of f.keys)r.has(h)||r.set(h,{}),r.get(h).l=!0}else e.issues.push(f);for(const f of s.issues)if(f.code==="unrecognized_keys")for(const h of f.keys)r.has(h)||r.set(h,{}),r.get(h).r=!0;else e.issues.push(f);const l=[...r].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&o&&e.issues.push({...o,keys:l}),ya(e))return e;const u=Fm(t.value,s.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const t5=ae("$ZodEnum",(e,t)=>{Pt.init(e,t);const s=b_(t.entries),r=new Set(s);e._zod.values=r,e._zod.pattern=new RegExp(`^(${s.filter(o=>b3.has(typeof o)).map(o=>typeof o=="string"?od(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return r.has(u)||o.issues.push({code:"invalid_value",values:s,input:u,inst:e}),o}}),n5=ae("$ZodTransform",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);const o=t.transform(s.value,s);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(s.value=u,s));if(o instanceof Promise)throw new wa;return s.value=o,s}});function MS(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const k_=ae("$ZodOptional",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",st(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),st(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${Dg(s.source)})?$`):void 0}),e._zod.parse=(s,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>MS(l,s.value)):MS(o,s.value)}return s.value===void 0?s:t.innerType._zod.run(s,r)}}),s5=ae("$ZodExactOptional",(e,t)=>{k_.init(e,t),st(e._zod,"values",()=>t.innerType._zod.values),st(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(s,r)=>t.innerType._zod.run(s,r)}),i5=ae("$ZodNullable",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.innerType._zod.optin),st(e._zod,"optout",()=>t.innerType._zod.optout),st(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${Dg(s.source)}|null)$`):void 0}),st(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(s,r)=>s.value===null?s:t.innerType._zod.run(s,r)}),r5=ae("$ZodDefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);if(s.value===void 0)return s.value=t.defaultValue,s;const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>zS(l,t)):zS(o,t)}});function zS(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const o5=ae("$ZodPrefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=t.defaultValue),t.innerType._zod.run(s,r))}),a5=ae("$ZodNonOptional",(e,t)=>{Pt.init(e,t),st(e._zod,"values",()=>{const s=t.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),e._zod.parse=(s,r)=>{const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>kS(l,e)):kS(o,e)}});function kS(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const l5=ae("$ZodCatch",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.innerType._zod.optin),st(e._zod,"optout",()=>t.innerType._zod.optout),st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>(s.value=l.value,l.issues.length&&(s.value=t.catchValue({...s,error:{issues:l.issues.map(u=>vo(u,r,yo()))},input:s.value}),s.issues=[]),s)):(s.value=o.value,o.issues.length&&(s.value=t.catchValue({...s,error:{issues:o.issues.map(l=>vo(l,r,yo()))},input:s.value}),s.issues=[]),s)}}),c5=ae("$ZodPipe",(e,t)=>{Pt.init(e,t),st(e._zod,"values",()=>t.in._zod.values),st(e._zod,"optin",()=>t.in._zod.optin),st(e._zod,"optout",()=>t.out._zod.optout),st(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(s,r)=>{if(r.direction==="backward"){const l=t.out._zod.run(s,r);return l instanceof Promise?l.then(u=>ff(u,t.in,r)):ff(l,t.in,r)}const o=t.in._zod.run(s,r);return o instanceof Promise?o.then(l=>ff(l,t.out,r)):ff(o,t.out,r)}});function ff(e,t,s){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},s)}const u5=ae("$ZodReadonly",(e,t)=>{Pt.init(e,t),st(e._zod,"propValues",()=>t.innerType._zod.propValues),st(e._zod,"values",()=>t.innerType._zod.values),st(e._zod,"optin",()=>{var s,r;return(r=(s=t.innerType)==null?void 0:s._zod)==null?void 0:r.optin}),st(e._zod,"optout",()=>{var s,r;return(r=(s=t.innerType)==null?void 0:s._zod)==null?void 0:r.optout}),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(DS):DS(o)}});function DS(e){return e.value=Object.freeze(e.value),e}const f5=ae("$ZodCustom",(e,t)=>{Bs.init(e,t),Pt.init(e,t),e._zod.parse=(s,r)=>s,e._zod.check=s=>{const r=s.value,o=t.fn(r);if(o instanceof Promise)return o.then(l=>jS(l,s,r,e));jS(o,s,r,e)}});function jS(e,t,s,r){if(!e){const o={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(dc(o))}}var NS;class d5{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...s){const r=s[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const s=this._map.get(t);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(t),this}get(t){const s=t._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function h5(){return new d5}(NS=globalThis).__zod_globalRegistry??(NS.__zod_globalRegistry=h5());const Xl=globalThis.__zod_globalRegistry;function p5(e,t){return new e({type:"string",...Me(t)})}function m5(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Me(t)})}function IS(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Me(t)})}function g5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Me(t)})}function y5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Me(t)})}function v5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Me(t)})}function b5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Me(t)})}function S5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Me(t)})}function w5(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Me(t)})}function _5(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Me(t)})}function x5(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Me(t)})}function E5(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Me(t)})}function C5(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Me(t)})}function R5(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Me(t)})}function A5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Me(t)})}function T5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Me(t)})}function O5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Me(t)})}function M5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Me(t)})}function z5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Me(t)})}function k5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Me(t)})}function D5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Me(t)})}function j5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Me(t)})}function N5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Me(t)})}function I5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Me(t)})}function L5(e,t){return new e({type:"string",format:"date",check:"string_format",...Me(t)})}function B5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Me(t)})}function U5(e,t){return new e({type:"string",format:"duration",check:"string_format",...Me(t)})}function P5(e,t){return new e({type:"boolean",...Me(t)})}function Z5(e){return new e({type:"unknown"})}function $5(e,t){return new e({type:"never",...Me(t)})}function D_(e,t){return new uk({check:"max_length",...Me(t),maximum:e})}function Kf(e,t){return new fk({check:"min_length",...Me(t),minimum:e})}function j_(e,t){return new dk({check:"length_equals",...Me(t),length:e})}function q5(e,t){return new hk({check:"string_format",format:"regex",...Me(t),pattern:e})}function V5(e){return new pk({check:"string_format",format:"lowercase",...Me(e)})}function H5(e){return new mk({check:"string_format",format:"uppercase",...Me(e)})}function K5(e,t){return new gk({check:"string_format",format:"includes",...Me(t),includes:e})}function F5(e,t){return new yk({check:"string_format",format:"starts_with",...Me(t),prefix:e})}function G5(e,t){return new vk({check:"string_format",format:"ends_with",...Me(t),suffix:e})}function Ha(e){return new bk({check:"overwrite",tx:e})}function Q5(e){return Ha(t=>t.normalize(e))}function Y5(){return Ha(e=>e.trim())}function J5(){return Ha(e=>e.toLowerCase())}function X5(){return Ha(e=>e.toUpperCase())}function W5(){return Ha(e=>y3(e))}function eD(e,t,s){return new e({type:"array",element:t,...Me(s)})}function tD(e,t,s){return new e({type:"custom",check:"custom",fn:t,...Me(s)})}function nD(e){const t=sD(s=>(s.addIssue=r=>{if(typeof r=="string")s.issues.push(dc(r,s.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=s.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),s.issues.push(dc(o))}},e(s.value,s)));return t}function sD(e,t){const s=new Bs({check:"custom",...Me(t)});return s._zod.check=e,s}function N_(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Xl,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function ln(e,t,s={path:[],schemaPath:[]}){var y,m;var r;const o=e._zod.def,l=t.seen.get(e);if(l)return l.count++,s.schemaPath.includes(e)&&(l.cycle=s.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:s.path};t.seen.set(e,u);const f=(m=(y=e._zod).toJSONSchema)==null?void 0:m.call(y);if(f)u.schema=f;else{const b={...s,schemaPath:[...s.schemaPath,e],path:s.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,b);else{const v=u.schema,S=t.processors[o.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);S(e,t,v,b)}const _=e._zod.parent;_&&(u.ref||(u.ref=_),ln(_,t,b),t.seen.get(_).isParent=!0)}const h=t.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),t.io==="input"&&yn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((r=u.schema).default??(r.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function I_(e,t){var u,f,h,p;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const y of e.seen.entries()){const m=(u=e.metadataRegistry.get(y[0]))==null?void 0:u.id;if(m){const b=r.get(m);if(b&&b!==y[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,y[0])}}const o=y=>{var S;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const x=(S=e.external.registry.get(y[0]))==null?void 0:S.id,T=e.external.uri??(O=>O);if(x)return{ref:T(x)};const M=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=M,{defId:M,ref:`${T("__shared")}#/${m}/${M}`}}if(y[1]===s)return{ref:"#"};const _=`#/${m}/`,v=y[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:_+v}},l=y=>{if(y[1].schema.$ref)return;const m=y[1],{ref:b,defId:_}=o(y);m.def={...m.schema},_&&(m.defId=_);const v=m.schema;for(const S in v)delete v[S];v.$ref=b};if(e.cycles==="throw")for(const y of e.seen.entries()){const m=y[1];if(m.cycle)throw new Error(`Cycle detected: #/${(f=m.cycle)==null?void 0:f.join("/")}/<root>
118
118
 
119
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const m=y[1];if(t===y[0]){l(y);continue}if(e.external){const _=(h=e.external.registry.get(y[0]))==null?void 0:h.id;if(t!==y[0]&&_){l(y);continue}}if((p=e.metadataRegistry.get(y[0]))==null?void 0:p.id){l(y);continue}if(m.cycle){l(y);continue}if(m.count>1&&e.reused==="ref"){l(y);continue}}}function L_(e,t){var u,f,h;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const y=e.seen.get(p);if(y.ref===null)return;const m=y.def??y.schema,b={...m},_=y.ref;if(y.ref=null,_){r(_);const S=e.seen.get(_),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,b),p._zod.parent===_)for(const M in m)M==="$ref"||M==="allOf"||M in b||delete m[M];if(x.$ref&&S.def)for(const M in m)M==="$ref"||M==="allOf"||M in S.def&&JSON.stringify(m[M])===JSON.stringify(S.def[M])&&delete m[M]}const v=p._zod.parent;if(v&&v!==_){r(v);const S=e.seen.get(v);if(S!=null&&S.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const x in m)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(m[x])===JSON.stringify(S.def[x])&&delete m[x]}e.override({zodSchema:p,jsonSchema:m,path:y.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const p=(f=e.external.registry.get(t))==null?void 0:f.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,s.def??s.schema);const l=((h=e.external)==null?void 0:h.defs)??{};for(const p of e.seen.entries()){const y=p[1];y.def&&y.defId&&(l[y.defId]=y.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ff(t,"input",e.processors),output:Ff(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return yn(r.element,s);if(r.type==="set")return yn(r.valueType,s);if(r.type==="lazy")return yn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return yn(r.innerType,s);if(r.type==="intersection")return yn(r.left,s)||yn(r.right,s);if(r.type==="record"||r.type==="map")return yn(r.keyType,s)||yn(r.valueType,s);if(r.type==="pipe")return yn(r.in,s)||yn(r.out,s);if(r.type==="object"){for(const o in r.shape)if(yn(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(yn(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(yn(o,s))return!0;return!!(r.rest&&yn(r.rest,s))}return!1}const iD=(e,t={})=>s=>{const r=N_({...s,processors:t});return ln(e,r),I_(r,e),L_(r,e)},Ff=(e,t,s={})=>r=>{const{libraryOptions:o,target:l}=r??{},u=N_({...o??{},target:l,io:t,processors:s});return ln(e,u),I_(u,e),L_(u,e)},rD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oD=(e,t,s,r)=>{const o=s;o.type="string";const{minimum:l,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),f&&(o.format=rD[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},aD=(e,t,s,r)=>{s.type="boolean"},lD=(e,t,s,r)=>{s.not={}},cD=(e,t,s,r)=>{},uD=(e,t,s,r)=>{const o=e._zod.def,l=b_(o.entries);l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),s.enum=l},fD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},hD=(e,t,s,r)=>{const o=s,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=ln(l.element,t,{...r,path:[...r.path,"items"]})},pD=(e,t,s,r)=>{var p;const o=s,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const y in u)o.properties[y]=ln(u[y],t,{...r,path:[...r.path,"properties",y]});const f=new Set(Object.keys(u)),h=new Set([...f].filter(y=>{const m=l.shape[y]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));h.size>0&&(o.required=Array.from(h)),((p=l.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=ln(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},mD=(e,t,s,r)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((f,h)=>ln(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",h]}));l?s.oneOf=u:s.anyOf=u},gD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.left,t,{...r,path:[...r.path,"allOf",0]}),u=ln(o.right,t,{...r,path:[...r.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];s.allOf=h},yD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},vD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},bD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.default=JSON.parse(JSON.stringify(o.defaultValue))},SD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=u},_D=(e,t,s,r)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ln(l,t,r);const u=t.seen.get(e);u.ref=l},xD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.readOnly=!0},B_=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},ED=ae("ZodISODateTime",(e,t)=>{Dk.init(e,t),bt.init(e,t)});function CD(e){return I5(ED,e)}const RD=ae("ZodISODate",(e,t)=>{jk.init(e,t),bt.init(e,t)});function AD(e){return L5(RD,e)}const TD=ae("ZodISOTime",(e,t)=>{Nk.init(e,t),bt.init(e,t)});function OD(e){return B5(TD,e)}const MD=ae("ZodISODuration",(e,t)=>{Ik.init(e,t),bt.init(e,t)});function zD(e){return U5(MD,e)}const kD=(e,t)=>{E_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>O3(e,s)},flatten:{value:s=>T3(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Km,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Km,2)}},isEmpty:{get(){return e.issues.length===0}}})},ms=ae("ZodError",kD,{Parent:Error}),DD=Ng(ms),jD=Ig(ms),ND=ad(ms),ID=ld(ms),LD=k3(ms),BD=D3(ms),UD=j3(ms),PD=N3(ms),ZD=I3(ms),$D=L3(ms),qD=B3(ms),VD=U3(ms),Zt=ae("ZodType",(e,t)=>(Pt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ff(e,"input"),output:Ff(e,"output")}}),e.toJSONSchema=iD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(xr(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>Er(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>DD(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>ND(e,s,r),e.parseAsync=async(s,r)=>jD(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>ID(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>LD(e,s,r),e.decode=(s,r)=>BD(e,s,r),e.encodeAsync=async(s,r)=>UD(e,s,r),e.decodeAsync=async(s,r)=>PD(e,s,r),e.safeEncode=(s,r)=>ZD(e,s,r),e.safeDecode=(s,r)=>$D(e,s,r),e.safeEncodeAsync=async(s,r)=>qD(e,s,r),e.safeDecodeAsync=async(s,r)=>VD(e,s,r),e.refine=(s,r)=>e.check(L9(s,r)),e.superRefine=s=>e.check(B9(s)),e.overwrite=s=>e.check(Ha(s)),e.optional=()=>ZS(e),e.exactOptional=()=>E9(e),e.nullable=()=>$S(e),e.nullish=()=>ZS($S(e)),e.nonoptional=s=>M9(e,s),e.array=()=>p9(e),e.or=s=>v9([e,s]),e.and=s=>S9(e,s),e.transform=s=>qS(e,_9(s)),e.default=s=>A9(e,s),e.prefault=s=>O9(e,s),e.catch=s=>k9(e,s),e.pipe=s=>qS(e,s),e.readonly=()=>N9(e),e.describe=s=>{const r=e.clone();return Xl.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){var s;return(s=Xl.get(e))==null?void 0:s.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return Xl.get(e);const r=e.clone();return Xl.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),U_=ae("_ZodString",(e,t)=>{Lg.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>oD(e,r,o);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(q5(...r)),e.includes=(...r)=>e.check(K5(...r)),e.startsWith=(...r)=>e.check(F5(...r)),e.endsWith=(...r)=>e.check(G5(...r)),e.min=(...r)=>e.check(Kf(...r)),e.max=(...r)=>e.check(D_(...r)),e.length=(...r)=>e.check(j_(...r)),e.nonempty=(...r)=>e.check(Kf(1,...r)),e.lowercase=r=>e.check(V5(r)),e.uppercase=r=>e.check(H5(r)),e.trim=()=>e.check(Y5()),e.normalize=(...r)=>e.check(Q5(...r)),e.toLowerCase=()=>e.check(J5()),e.toUpperCase=()=>e.check(X5()),e.slugify=()=>e.check(W5())}),HD=ae("ZodString",(e,t)=>{Lg.init(e,t),U_.init(e,t),e.email=s=>e.check(m5(KD,s)),e.url=s=>e.check(S5(FD,s)),e.jwt=s=>e.check(N5(l9,s)),e.emoji=s=>e.check(w5(GD,s)),e.guid=s=>e.check(IS(BS,s)),e.uuid=s=>e.check(g5(df,s)),e.uuidv4=s=>e.check(y5(df,s)),e.uuidv6=s=>e.check(v5(df,s)),e.uuidv7=s=>e.check(b5(df,s)),e.nanoid=s=>e.check(_5(QD,s)),e.guid=s=>e.check(IS(BS,s)),e.cuid=s=>e.check(x5(YD,s)),e.cuid2=s=>e.check(E5(JD,s)),e.ulid=s=>e.check(C5(XD,s)),e.base64=s=>e.check(k5(r9,s)),e.base64url=s=>e.check(D5(o9,s)),e.xid=s=>e.check(R5(WD,s)),e.ksuid=s=>e.check(A5(e9,s)),e.ipv4=s=>e.check(T5(t9,s)),e.ipv6=s=>e.check(O5(n9,s)),e.cidrv4=s=>e.check(M5(s9,s)),e.cidrv6=s=>e.check(z5(i9,s)),e.e164=s=>e.check(j5(a9,s)),e.datetime=s=>e.check(CD(s)),e.date=s=>e.check(AD(s)),e.time=s=>e.check(OD(s)),e.duration=s=>e.check(zD(s))});function LS(e){return p5(HD,e)}const bt=ae("ZodStringFormat",(e,t)=>{yt.init(e,t),U_.init(e,t)}),KD=ae("ZodEmail",(e,t)=>{Ek.init(e,t),bt.init(e,t)}),BS=ae("ZodGUID",(e,t)=>{_k.init(e,t),bt.init(e,t)}),df=ae("ZodUUID",(e,t)=>{xk.init(e,t),bt.init(e,t)}),FD=ae("ZodURL",(e,t)=>{Ck.init(e,t),bt.init(e,t)}),GD=ae("ZodEmoji",(e,t)=>{Rk.init(e,t),bt.init(e,t)}),QD=ae("ZodNanoID",(e,t)=>{Ak.init(e,t),bt.init(e,t)}),YD=ae("ZodCUID",(e,t)=>{Tk.init(e,t),bt.init(e,t)}),JD=ae("ZodCUID2",(e,t)=>{Ok.init(e,t),bt.init(e,t)}),XD=ae("ZodULID",(e,t)=>{Mk.init(e,t),bt.init(e,t)}),WD=ae("ZodXID",(e,t)=>{zk.init(e,t),bt.init(e,t)}),e9=ae("ZodKSUID",(e,t)=>{kk.init(e,t),bt.init(e,t)}),t9=ae("ZodIPv4",(e,t)=>{Lk.init(e,t),bt.init(e,t)}),n9=ae("ZodIPv6",(e,t)=>{Bk.init(e,t),bt.init(e,t)}),s9=ae("ZodCIDRv4",(e,t)=>{Uk.init(e,t),bt.init(e,t)}),i9=ae("ZodCIDRv6",(e,t)=>{Pk.init(e,t),bt.init(e,t)}),r9=ae("ZodBase64",(e,t)=>{Zk.init(e,t),bt.init(e,t)}),o9=ae("ZodBase64URL",(e,t)=>{qk.init(e,t),bt.init(e,t)}),a9=ae("ZodE164",(e,t)=>{Vk.init(e,t),bt.init(e,t)}),l9=ae("ZodJWT",(e,t)=>{Kk.init(e,t),bt.init(e,t)}),c9=ae("ZodBoolean",(e,t)=>{Fk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>aD(e,s,r)});function US(e){return P5(c9,e)}const u9=ae("ZodUnknown",(e,t)=>{Gk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>cD()});function PS(){return Z5(u9)}const f9=ae("ZodNever",(e,t)=>{Qk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>lD(e,s,r)});function d9(e){return $5(f9,e)}const h9=ae("ZodArray",(e,t)=>{Yk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>hD(e,s,r,o),e.element=t.element,e.min=(s,r)=>e.check(Kf(s,r)),e.nonempty=s=>e.check(Kf(1,s)),e.max=(s,r)=>e.check(D_(s,r)),e.length=(s,r)=>e.check(j_(s,r)),e.unwrap=()=>e.element});function p9(e,t){return eD(h9,e,t)}const m9=ae("ZodObject",(e,t)=>{Xk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>pD(e,s,r,o),st(e,"shape",()=>t.shape),e.keyof=()=>P_(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:PS()}),e.loose=()=>e.clone({...e._zod.def,catchall:PS()}),e.strict=()=>e.clone({...e._zod.def,catchall:d9()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>x3(e,s),e.safeExtend=s=>E3(e,s),e.merge=s=>C3(e,s),e.pick=s=>w3(e,s),e.omit=s=>_3(e,s),e.partial=(...s)=>R3(Z_,e,s[0]),e.required=(...s)=>A3($_,e,s[0])});function g9(e,t){const s={type:"object",shape:e??{},...Me(t)};return new m9(s)}const y9=ae("ZodUnion",(e,t)=>{Wk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>mD(e,s,r,o),e.options=t.options});function v9(e,t){return new y9({type:"union",options:e,...Me(t)})}const b9=ae("ZodIntersection",(e,t)=>{e5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>gD(e,s,r,o)});function S9(e,t){return new b9({type:"intersection",left:e,right:t})}const Gm=ae("ZodEnum",(e,t)=>{t5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>uD(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const l={};for(const u of r)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})},e.exclude=(r,o)=>{const l={...t.entries};for(const u of r)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})}});function P_(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gm({type:"enum",entries:s,...Me(t)})}const w9=ae("ZodTransform",(e,t)=>{n5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>dD(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(dc(l,s.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=s.value),u.inst??(u.inst=e),s.issues.push(dc(u))}};const o=t.transform(s.value,s);return o instanceof Promise?o.then(l=>(s.value=l,s)):(s.value=o,s)}});function _9(e){return new w9({type:"transform",transform:e})}const Z_=ae("ZodOptional",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function ZS(e){return new Z_({type:"optional",innerType:e})}const x9=ae("ZodExactOptional",(e,t)=>{s5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function E9(e){return new x9({type:"optional",innerType:e})}const C9=ae("ZodNullable",(e,t)=>{i5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>yD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function $S(e){return new C9({type:"nullable",innerType:e})}const R9=ae("ZodDefault",(e,t)=>{r5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>bD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function A9(e,t){return new R9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const T9=ae("ZodPrefault",(e,t)=>{o5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>SD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function O9(e,t){return new T9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const $_=ae("ZodNonOptional",(e,t)=>{a5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>vD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function M9(e,t){return new $_({type:"nonoptional",innerType:e,...Me(t)})}const z9=ae("ZodCatch",(e,t)=>{l5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>wD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k9(e,t){return new z9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const D9=ae("ZodPipe",(e,t)=>{c5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>_D(e,s,r,o),e.in=t.in,e.out=t.out});function qS(e,t){return new D9({type:"pipe",in:e,out:t})}const j9=ae("ZodReadonly",(e,t)=>{u5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>xD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function N9(e){return new j9({type:"readonly",innerType:e})}const I9=ae("ZodCustom",(e,t)=>{f5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>fD(e,s)});function L9(e,t={}){return tD(I9,e,t)}function B9(e){return nD(e)}const U9=()=>Mg(()=>import("./memories-3VR4rZ5U.js"),__vite__mapDeps([0,1,2])),P9=g9({search:LS().default("").catch(""),type:P_(d2).optional().catch(void 0),pinned:US().default(!1).catch(!1),needsReview:US().default(!1).catch(!1),projectId:LS().optional().catch(void 0)}),Z9=ed("/memories")({validateSearch:P9,component:ng(U9,"component")}),$9=ed("/")({beforeLoad:()=>{throw aw({to:"/memories"})}}),q9=()=>Mg(()=>import("./memories.index-ByQeKvpK.js"),__vite__mapDeps([3,1])),V9=ed("/memories/")({component:ng(q9,"component")}),H9=()=>Mg(()=>import("./memories._id-D3XqSd0M.js"),__vite__mapDeps([4,2])),K9=ed("/memories/$id")({component:ng(H9,"component")}),Bg=Z9.update({id:"/memories",path:"/memories",getParentRoute:()=>Og}),F9=$9.update({id:"/",path:"/",getParentRoute:()=>Og}),G9=V9.update({id:"/",path:"/",getParentRoute:()=>Bg}),Q9=K9.update({id:"/$id",path:"/$id",getParentRoute:()=>Bg}),Y9={MemoriesIdRoute:Q9,MemoriesIndexRoute:G9},J9=Bg._addFileChildren(Y9),X9={IndexRoute:F9,MemoriesRoute:J9},W9=Og._addFileChildren(X9)._addFileTypes(),ej=e8({routeTree:W9}),q_=document.getElementById("root");if(!q_)throw new Error("No #root element");l8.createRoot(q_).render(fe.jsx(z.StrictMode,{children:fe.jsx(aC,{children:fe.jsx(j4,{children:fe.jsx(s8,{router:ej})})})}));export{ym as $,dC as A,Sr as B,o6 as C,Rb as D,Kl as E,uj as F,D4 as G,s2 as H,G4 as I,n6 as J,oj as K,u2 as L,xw as M,ij as N,wz as O,d3 as P,hj as Q,Z9 as R,d2 as S,nd as T,Mw as U,ob as V,_R as W,yw as X,rC as Y,h8 as Z,f2 as _,ps as a,dj as a0,g_ as a1,Ab as a2,fj as a3,Q4 as a4,g9 as a5,LS as a6,P_ as a7,K9 as a8,Fn as b,Fr as c,td as d,u8 as e,kw as f,b8 as g,mb as h,v8 as i,fe as j,Rw as k,E8 as l,Dw as m,I8 as n,gb as o,p8 as p,zc as q,z as r,aj as s,rj as t,nj as u,lj as v,cj as w,zw as x,cC as y,T8 as z};
119
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const m=y[1];if(t===y[0]){l(y);continue}if(e.external){const _=(h=e.external.registry.get(y[0]))==null?void 0:h.id;if(t!==y[0]&&_){l(y);continue}}if((p=e.metadataRegistry.get(y[0]))==null?void 0:p.id){l(y);continue}if(m.cycle){l(y);continue}if(m.count>1&&e.reused==="ref"){l(y);continue}}}function L_(e,t){var u,f,h;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const y=e.seen.get(p);if(y.ref===null)return;const m=y.def??y.schema,b={...m},_=y.ref;if(y.ref=null,_){r(_);const S=e.seen.get(_),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,b),p._zod.parent===_)for(const M in m)M==="$ref"||M==="allOf"||M in b||delete m[M];if(x.$ref&&S.def)for(const M in m)M==="$ref"||M==="allOf"||M in S.def&&JSON.stringify(m[M])===JSON.stringify(S.def[M])&&delete m[M]}const v=p._zod.parent;if(v&&v!==_){r(v);const S=e.seen.get(v);if(S!=null&&S.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const x in m)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(m[x])===JSON.stringify(S.def[x])&&delete m[x]}e.override({zodSchema:p,jsonSchema:m,path:y.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const p=(f=e.external.registry.get(t))==null?void 0:f.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,s.def??s.schema);const l=((h=e.external)==null?void 0:h.defs)??{};for(const p of e.seen.entries()){const y=p[1];y.def&&y.defId&&(l[y.defId]=y.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ff(t,"input",e.processors),output:Ff(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return yn(r.element,s);if(r.type==="set")return yn(r.valueType,s);if(r.type==="lazy")return yn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return yn(r.innerType,s);if(r.type==="intersection")return yn(r.left,s)||yn(r.right,s);if(r.type==="record"||r.type==="map")return yn(r.keyType,s)||yn(r.valueType,s);if(r.type==="pipe")return yn(r.in,s)||yn(r.out,s);if(r.type==="object"){for(const o in r.shape)if(yn(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(yn(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(yn(o,s))return!0;return!!(r.rest&&yn(r.rest,s))}return!1}const iD=(e,t={})=>s=>{const r=N_({...s,processors:t});return ln(e,r),I_(r,e),L_(r,e)},Ff=(e,t,s={})=>r=>{const{libraryOptions:o,target:l}=r??{},u=N_({...o??{},target:l,io:t,processors:s});return ln(e,u),I_(u,e),L_(u,e)},rD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oD=(e,t,s,r)=>{const o=s;o.type="string";const{minimum:l,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),f&&(o.format=rD[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},aD=(e,t,s,r)=>{s.type="boolean"},lD=(e,t,s,r)=>{s.not={}},cD=(e,t,s,r)=>{},uD=(e,t,s,r)=>{const o=e._zod.def,l=b_(o.entries);l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),s.enum=l},fD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},hD=(e,t,s,r)=>{const o=s,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=ln(l.element,t,{...r,path:[...r.path,"items"]})},pD=(e,t,s,r)=>{var p;const o=s,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const y in u)o.properties[y]=ln(u[y],t,{...r,path:[...r.path,"properties",y]});const f=new Set(Object.keys(u)),h=new Set([...f].filter(y=>{const m=l.shape[y]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));h.size>0&&(o.required=Array.from(h)),((p=l.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=ln(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},mD=(e,t,s,r)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((f,h)=>ln(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",h]}));l?s.oneOf=u:s.anyOf=u},gD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.left,t,{...r,path:[...r.path,"allOf",0]}),u=ln(o.right,t,{...r,path:[...r.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];s.allOf=h},yD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},vD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},bD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.default=JSON.parse(JSON.stringify(o.defaultValue))},SD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=u},_D=(e,t,s,r)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ln(l,t,r);const u=t.seen.get(e);u.ref=l},xD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.readOnly=!0},B_=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},ED=ae("ZodISODateTime",(e,t)=>{Dk.init(e,t),bt.init(e,t)});function CD(e){return I5(ED,e)}const RD=ae("ZodISODate",(e,t)=>{jk.init(e,t),bt.init(e,t)});function AD(e){return L5(RD,e)}const TD=ae("ZodISOTime",(e,t)=>{Nk.init(e,t),bt.init(e,t)});function OD(e){return B5(TD,e)}const MD=ae("ZodISODuration",(e,t)=>{Ik.init(e,t),bt.init(e,t)});function zD(e){return U5(MD,e)}const kD=(e,t)=>{E_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>O3(e,s)},flatten:{value:s=>T3(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Km,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Km,2)}},isEmpty:{get(){return e.issues.length===0}}})},ms=ae("ZodError",kD,{Parent:Error}),DD=Ng(ms),jD=Ig(ms),ND=ad(ms),ID=ld(ms),LD=k3(ms),BD=D3(ms),UD=j3(ms),PD=N3(ms),ZD=I3(ms),$D=L3(ms),qD=B3(ms),VD=U3(ms),Zt=ae("ZodType",(e,t)=>(Pt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ff(e,"input"),output:Ff(e,"output")}}),e.toJSONSchema=iD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(xr(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>Er(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>DD(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>ND(e,s,r),e.parseAsync=async(s,r)=>jD(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>ID(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>LD(e,s,r),e.decode=(s,r)=>BD(e,s,r),e.encodeAsync=async(s,r)=>UD(e,s,r),e.decodeAsync=async(s,r)=>PD(e,s,r),e.safeEncode=(s,r)=>ZD(e,s,r),e.safeDecode=(s,r)=>$D(e,s,r),e.safeEncodeAsync=async(s,r)=>qD(e,s,r),e.safeDecodeAsync=async(s,r)=>VD(e,s,r),e.refine=(s,r)=>e.check(L9(s,r)),e.superRefine=s=>e.check(B9(s)),e.overwrite=s=>e.check(Ha(s)),e.optional=()=>ZS(e),e.exactOptional=()=>E9(e),e.nullable=()=>$S(e),e.nullish=()=>ZS($S(e)),e.nonoptional=s=>M9(e,s),e.array=()=>p9(e),e.or=s=>v9([e,s]),e.and=s=>S9(e,s),e.transform=s=>qS(e,_9(s)),e.default=s=>A9(e,s),e.prefault=s=>O9(e,s),e.catch=s=>k9(e,s),e.pipe=s=>qS(e,s),e.readonly=()=>N9(e),e.describe=s=>{const r=e.clone();return Xl.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){var s;return(s=Xl.get(e))==null?void 0:s.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return Xl.get(e);const r=e.clone();return Xl.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),U_=ae("_ZodString",(e,t)=>{Lg.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>oD(e,r,o);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(q5(...r)),e.includes=(...r)=>e.check(K5(...r)),e.startsWith=(...r)=>e.check(F5(...r)),e.endsWith=(...r)=>e.check(G5(...r)),e.min=(...r)=>e.check(Kf(...r)),e.max=(...r)=>e.check(D_(...r)),e.length=(...r)=>e.check(j_(...r)),e.nonempty=(...r)=>e.check(Kf(1,...r)),e.lowercase=r=>e.check(V5(r)),e.uppercase=r=>e.check(H5(r)),e.trim=()=>e.check(Y5()),e.normalize=(...r)=>e.check(Q5(...r)),e.toLowerCase=()=>e.check(J5()),e.toUpperCase=()=>e.check(X5()),e.slugify=()=>e.check(W5())}),HD=ae("ZodString",(e,t)=>{Lg.init(e,t),U_.init(e,t),e.email=s=>e.check(m5(KD,s)),e.url=s=>e.check(S5(FD,s)),e.jwt=s=>e.check(N5(l9,s)),e.emoji=s=>e.check(w5(GD,s)),e.guid=s=>e.check(IS(BS,s)),e.uuid=s=>e.check(g5(df,s)),e.uuidv4=s=>e.check(y5(df,s)),e.uuidv6=s=>e.check(v5(df,s)),e.uuidv7=s=>e.check(b5(df,s)),e.nanoid=s=>e.check(_5(QD,s)),e.guid=s=>e.check(IS(BS,s)),e.cuid=s=>e.check(x5(YD,s)),e.cuid2=s=>e.check(E5(JD,s)),e.ulid=s=>e.check(C5(XD,s)),e.base64=s=>e.check(k5(r9,s)),e.base64url=s=>e.check(D5(o9,s)),e.xid=s=>e.check(R5(WD,s)),e.ksuid=s=>e.check(A5(e9,s)),e.ipv4=s=>e.check(T5(t9,s)),e.ipv6=s=>e.check(O5(n9,s)),e.cidrv4=s=>e.check(M5(s9,s)),e.cidrv6=s=>e.check(z5(i9,s)),e.e164=s=>e.check(j5(a9,s)),e.datetime=s=>e.check(CD(s)),e.date=s=>e.check(AD(s)),e.time=s=>e.check(OD(s)),e.duration=s=>e.check(zD(s))});function LS(e){return p5(HD,e)}const bt=ae("ZodStringFormat",(e,t)=>{yt.init(e,t),U_.init(e,t)}),KD=ae("ZodEmail",(e,t)=>{Ek.init(e,t),bt.init(e,t)}),BS=ae("ZodGUID",(e,t)=>{_k.init(e,t),bt.init(e,t)}),df=ae("ZodUUID",(e,t)=>{xk.init(e,t),bt.init(e,t)}),FD=ae("ZodURL",(e,t)=>{Ck.init(e,t),bt.init(e,t)}),GD=ae("ZodEmoji",(e,t)=>{Rk.init(e,t),bt.init(e,t)}),QD=ae("ZodNanoID",(e,t)=>{Ak.init(e,t),bt.init(e,t)}),YD=ae("ZodCUID",(e,t)=>{Tk.init(e,t),bt.init(e,t)}),JD=ae("ZodCUID2",(e,t)=>{Ok.init(e,t),bt.init(e,t)}),XD=ae("ZodULID",(e,t)=>{Mk.init(e,t),bt.init(e,t)}),WD=ae("ZodXID",(e,t)=>{zk.init(e,t),bt.init(e,t)}),e9=ae("ZodKSUID",(e,t)=>{kk.init(e,t),bt.init(e,t)}),t9=ae("ZodIPv4",(e,t)=>{Lk.init(e,t),bt.init(e,t)}),n9=ae("ZodIPv6",(e,t)=>{Bk.init(e,t),bt.init(e,t)}),s9=ae("ZodCIDRv4",(e,t)=>{Uk.init(e,t),bt.init(e,t)}),i9=ae("ZodCIDRv6",(e,t)=>{Pk.init(e,t),bt.init(e,t)}),r9=ae("ZodBase64",(e,t)=>{Zk.init(e,t),bt.init(e,t)}),o9=ae("ZodBase64URL",(e,t)=>{qk.init(e,t),bt.init(e,t)}),a9=ae("ZodE164",(e,t)=>{Vk.init(e,t),bt.init(e,t)}),l9=ae("ZodJWT",(e,t)=>{Kk.init(e,t),bt.init(e,t)}),c9=ae("ZodBoolean",(e,t)=>{Fk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>aD(e,s,r)});function US(e){return P5(c9,e)}const u9=ae("ZodUnknown",(e,t)=>{Gk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>cD()});function PS(){return Z5(u9)}const f9=ae("ZodNever",(e,t)=>{Qk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>lD(e,s,r)});function d9(e){return $5(f9,e)}const h9=ae("ZodArray",(e,t)=>{Yk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>hD(e,s,r,o),e.element=t.element,e.min=(s,r)=>e.check(Kf(s,r)),e.nonempty=s=>e.check(Kf(1,s)),e.max=(s,r)=>e.check(D_(s,r)),e.length=(s,r)=>e.check(j_(s,r)),e.unwrap=()=>e.element});function p9(e,t){return eD(h9,e,t)}const m9=ae("ZodObject",(e,t)=>{Xk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>pD(e,s,r,o),st(e,"shape",()=>t.shape),e.keyof=()=>P_(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:PS()}),e.loose=()=>e.clone({...e._zod.def,catchall:PS()}),e.strict=()=>e.clone({...e._zod.def,catchall:d9()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>x3(e,s),e.safeExtend=s=>E3(e,s),e.merge=s=>C3(e,s),e.pick=s=>w3(e,s),e.omit=s=>_3(e,s),e.partial=(...s)=>R3(Z_,e,s[0]),e.required=(...s)=>A3($_,e,s[0])});function g9(e,t){const s={type:"object",shape:e??{},...Me(t)};return new m9(s)}const y9=ae("ZodUnion",(e,t)=>{Wk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>mD(e,s,r,o),e.options=t.options});function v9(e,t){return new y9({type:"union",options:e,...Me(t)})}const b9=ae("ZodIntersection",(e,t)=>{e5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>gD(e,s,r,o)});function S9(e,t){return new b9({type:"intersection",left:e,right:t})}const Gm=ae("ZodEnum",(e,t)=>{t5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>uD(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const l={};for(const u of r)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})},e.exclude=(r,o)=>{const l={...t.entries};for(const u of r)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})}});function P_(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gm({type:"enum",entries:s,...Me(t)})}const w9=ae("ZodTransform",(e,t)=>{n5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>dD(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(dc(l,s.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=s.value),u.inst??(u.inst=e),s.issues.push(dc(u))}};const o=t.transform(s.value,s);return o instanceof Promise?o.then(l=>(s.value=l,s)):(s.value=o,s)}});function _9(e){return new w9({type:"transform",transform:e})}const Z_=ae("ZodOptional",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function ZS(e){return new Z_({type:"optional",innerType:e})}const x9=ae("ZodExactOptional",(e,t)=>{s5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function E9(e){return new x9({type:"optional",innerType:e})}const C9=ae("ZodNullable",(e,t)=>{i5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>yD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function $S(e){return new C9({type:"nullable",innerType:e})}const R9=ae("ZodDefault",(e,t)=>{r5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>bD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function A9(e,t){return new R9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const T9=ae("ZodPrefault",(e,t)=>{o5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>SD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function O9(e,t){return new T9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const $_=ae("ZodNonOptional",(e,t)=>{a5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>vD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function M9(e,t){return new $_({type:"nonoptional",innerType:e,...Me(t)})}const z9=ae("ZodCatch",(e,t)=>{l5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>wD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k9(e,t){return new z9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const D9=ae("ZodPipe",(e,t)=>{c5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>_D(e,s,r,o),e.in=t.in,e.out=t.out});function qS(e,t){return new D9({type:"pipe",in:e,out:t})}const j9=ae("ZodReadonly",(e,t)=>{u5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>xD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function N9(e){return new j9({type:"readonly",innerType:e})}const I9=ae("ZodCustom",(e,t)=>{f5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>fD(e,s)});function L9(e,t={}){return tD(I9,e,t)}function B9(e){return nD(e)}const U9=()=>Mg(()=>import("./memories-ja38P73o.js"),__vite__mapDeps([0,1,2])),P9=g9({search:LS().default("").catch(""),type:P_(d2).optional().catch(void 0),pinned:US().default(!1).catch(!1),needsReview:US().default(!1).catch(!1),projectId:LS().optional().catch(void 0)}),Z9=ed("/memories")({validateSearch:P9,component:ng(U9,"component")}),$9=ed("/")({beforeLoad:()=>{throw aw({to:"/memories"})}}),q9=()=>Mg(()=>import("./memories.index-DUtHo-Be.js"),__vite__mapDeps([3,1])),V9=ed("/memories/")({component:ng(q9,"component")}),H9=()=>Mg(()=>import("./memories._id-DeaZiiQb.js"),__vite__mapDeps([4,2])),K9=ed("/memories/$id")({component:ng(H9,"component")}),Bg=Z9.update({id:"/memories",path:"/memories",getParentRoute:()=>Og}),F9=$9.update({id:"/",path:"/",getParentRoute:()=>Og}),G9=V9.update({id:"/",path:"/",getParentRoute:()=>Bg}),Q9=K9.update({id:"/$id",path:"/$id",getParentRoute:()=>Bg}),Y9={MemoriesIdRoute:Q9,MemoriesIndexRoute:G9},J9=Bg._addFileChildren(Y9),X9={IndexRoute:F9,MemoriesRoute:J9},W9=Og._addFileChildren(X9)._addFileTypes(),ej=e8({routeTree:W9}),q_=document.getElementById("root");if(!q_)throw new Error("No #root element");l8.createRoot(q_).render(fe.jsx(z.StrictMode,{children:fe.jsx(aC,{children:fe.jsx(j4,{children:fe.jsx(s8,{router:ej})})})}));export{ym as $,dC as A,Sr as B,o6 as C,Rb as D,Kl as E,uj as F,D4 as G,s2 as H,G4 as I,n6 as J,oj as K,u2 as L,xw as M,ij as N,wz as O,d3 as P,hj as Q,Z9 as R,d2 as S,nd as T,Mw as U,ob as V,_R as W,yw as X,rC as Y,h8 as Z,f2 as _,ps as a,dj as a0,g_ as a1,Ab as a2,fj as a3,l3 as a4,Q4 as a5,g9 as a6,LS as a7,P_ as a8,K9 as a9,Fn as b,Fr as c,td as d,u8 as e,kw as f,b8 as g,mb as h,v8 as i,fe as j,Rw as k,E8 as l,Dw as m,I8 as n,gb as o,p8 as p,zc as q,z as r,aj as s,rj as t,nj as u,lj as v,cj as w,zw as x,cC as y,T8 as z};