vendor: 9,098 bytes, line 1
1var ve=e=>{throw TypeError(e)};var Xt=(e,t,s)=>t.has(e)||ve("Cannot "+s);var i=(e,t,s)=>(Xt(e,t,"read from private field"),s?s.call(e):t.get(e)),l=(e,t,s)=>t.has(e)?ve("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),o=(e,t,s,r)=>(Xt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),v=(e,t,s)=>(Xt(e,t,"access private method"),s);var Wt=(e,t,s,r)=>({set _(n){o(e,t,n,s)},get _(){return i(e,t,r)}});import{r as R,j as u,u as Ue}from"./index-BZW6QQdn.js";import{c as es}from"./index-BqMYdFqI.js";import{c as Ne}from"./createLucideIcon-Dn09qe3H.js";var Tt=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(){}},Ct=typeof window>"u"||"Deno"in globalThis;function q(){}function ss(e,t){return typeof e=="function"?e(t):e}function Zt(e){return typeof e=="number"&&e>=0&&e!==1/0}function Le(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ct(e,t){return typeof e=="function"?e(t):e}function H(e,t){return typeof e=="function"?e(t):e}function be(e,t){const{type:s="all",exact:r,fetchStatus:n,predicate:a,queryKey:h,stale:c}=e;if(h){if(r){if(t.queryHash!==fe(h,t.options))return!1}else if(!Nt(t.queryKey,h))return!1}if(s!=="all"){const f=t.isActive();if(s==="active"&&!f||s==="inactive"&&f)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||n&&n!==t.state.fetchStatus||a&&!a(t))}function ge(e,t){const{exact:s,status:r,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(s){if(wt(t.options.mutationKey)!==wt(a))return!1}else if(!Nt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||n&&!n(t))}function fe(e,t){return((t==null?void 0:t.queryKeyHashFn)||wt)(e)}function wt(e){return JSON.stringify(e,(t,s)=>te(s)?Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{}):s)}function Nt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>Nt(e[s],t[s])):!1}function Ke(e,t){if(e===t)return e;const s=xe(e)&&xe(t);if(s||te(e)&&te(t)){const r=s?e:Object.keys(e),n=r.length,a=s?t:Object.keys(t),h=a.length,c=s?[]:{},f=new Set(r);let x=0;for(let w=0;w<h;w++){const d=s?w:a[w];(!s&&f.has(d)||s)&&e[d]===void 0&&t[d]===void 0?(c[d]=void 0,x++):(c[d]=Ke(e[d],t[d]),c[d]===e[d]&&e[d]!==void 0&&x++)}return n===h&&x===n?e:c}return t}function zt(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 xe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function te(e){if(!Ce(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Ce(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ce(e){return Object.prototype.toString.call(e)==="[object Object]"}function is(e){return new Promise(t=>{setTimeout(t,e)})}function ee(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Ke(e,t):t}function rs(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function ns(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var ye=Symbol();function He(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ye?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _e(e,t){return typeof e=="function"?e(...t):!!e}var dt,tt,St,Pe,as=(Pe=class extends Tt{constructor(){super();l(this,dt);l(this,tt);l(this,St);o(this,St,t=>{if(!Ct&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,tt)||this.setEventListener(i(this,St))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,tt))==null||t.call(this),o(this,tt,void 0))}setEventListener(t){var s;o(this,St,t),(s=i(this,tt))==null||s.call(this),o(this,tt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,dt)!==t&&(o(this,dt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof i(this,dt)=="boolean"?i(this,dt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dt=new WeakMap,tt=new WeakMap,St=new WeakMap,Pe),pe=new as,Ot,et,Rt,Ee,os=(Ee=class extends Tt{constructor(){super();l(this,Ot,!0);l(this,et);l(this,Rt);o(this,Rt,t=>{if(!Ct&&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(){i(this,et)||this.setEventListener(i(this,Rt))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,et))==null||t.call(this),o(this,et,void 0))}setEventListener(t){var s;o(this,Rt,t),(s=i(this,et))==null||s.call(this),o(this,et,t(this.setOnline.bind(this)))}setOnline(t){i(this,Ot)!==t&&(o(this,Ot,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,Ot)}},Ot=new WeakMap,et=new WeakMap,Rt=new WeakMap,Ee),Vt=new os;function se(){let e,t;const s=new Promise((n,a)=>{e=n,t=a});s.status="pending",s.catch(()=>{});function r(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{r({status:"fulfilled",value:n}),e(n)},s.reject=n=>{r({status:"rejected",reason:n}),t(n)},s}function us(e){return Math.min(1e3*2**e,3e4)}function Ge(e){return(e??"online")==="online"?Vt.isOnline():!0}var We=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Jt(e){return e instanceof We}function Be(e){let t=!1,s=0,r=!1,n;const a=se(),h=y=>{var p;r||(m(new We(y)),(p=e.abort)==null||p.call(e))},c=()=>{t=!0},f=()=>{t=!1},x=()=>pe.isFocused()&&(e.networkMode==="always"||Vt.isOnline())&&e.canRun(),w=()=>Ge(e.networkMode)&&e.canRun(),d=y=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,y),n==null||n(),a.resolve(y))},m=y=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,y),n==null||n(),a.reject(y))},b=()=>new Promise(y=>{var p;n=F=>{(r||x())&&y(F)},(p=e.onPause)==null||p.call(e)}).then(()=>{var y;n=void 0,r||(y=e.onContinue)==null||y.call(e)}),j=()=>{if(r)return;let y;const p=s===0?e.initialPromise:void 0;try{y=p??e.fn()}catch(F){y=Promise.reject(F)}Promise.resolve(y).then(d).catch(F=>{var _;if(r)return;const k=e.retry??(Ct?0:3),S=e.retryDelay??us,Q=typeof S=="function"?S(s,F):S,L=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,F);if(t||!L){m(F);return}s++,(_=e.onFail)==null||_.call(e,s,F),is(Q).then(()=>x()?void 0:b()).then(()=>{t?m(F):j()})})};return{promise:a,cancel:h,continue:()=>(n==null||n(),a),cancelRetry:c,continueRetry:f,canStart:w,start:()=>(w()?j():b().then(j),a)}}var hs=e=>setTimeout(e,0);function cs(){let e=[],t=0,s=c=>{c()},r=c=>{c()},n=hs;const a=c=>{t?e.push(c):n(()=>{s(c)})},h=()=>{const c=e;e=[],c.length&&n(()=>{r(()=>{c.forEach(f=>{s(f)})})})};return{batch:c=>{let f;t++;try{f=c()}finally{t--,t||h()}return f},batchCalls:c=>(...f)=>{a(()=>{c(...f)})},schedule:a,setNotifyFunction:c=>{s=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{n=c}}}var M=cs(),ft,Me,$e=(Me=class{constructor(){l(this,ft)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zt(this.gcTime)&&o(this,ft,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ct?1/0:300*1e3))}clearGcTimeout(){i(this,ft)&&(clearTimeout(i(this,ft)),o(this,ft,void 0))}},ft=new WeakMap,Me),Ft,yt,K,pt,D,Lt,mt,G,V,Qe,ls=(Qe=class extends $e{constructor(t){super();l(this,G);l(this,Ft);l(this,yt);l(this,K);l(this,pt);l(this,D);l(this,Lt);l(this,mt);o(this,mt,!1),o(this,Lt,t.defaultOptions),this.setOptions(t.options),this.observers=[],o(this,pt,t.client),o(this,K,i(this,pt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,o(this,Ft,ds(this.options)),this.state=t.state??i(this,Ft),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=i(this,D))==null?void 0:t.promise}setOptions(t){this.options={...i(this,Lt),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,K).remove(this)}setData(t,s){const r=ee(this.state.data,t,this.options);return v(this,G,V).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t,s){v(this,G,V).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,n;const s=(r=i(this,D))==null?void 0:r.promise;return(n=i(this,D))==null||n.cancel(t),s?s.then(q).catch(q):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,Ft))}isActive(){return this.observers.some(t=>H(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ye||this.state.dataUpdateCount+this.state.errorUpdate
1Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ct(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:!Le(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,D))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,D))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,K).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(i(this,D)&&(i(this,mt)?i(this,D).cancel({revert:!0}):i(this,D).cancelRetry()),this.scheduleGc()),i(this,K).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||v(this,G,V).call(this,{type:"invalidate"})}fetch(t,s){var x,w,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,D))return i(this,D).continueRetry(),i(this,D).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(b=>b.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,n=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(o(this,mt,!0),r.signal)})},a=()=>{const m=He(this.options,s),j=(()=>{const y={client:i(this,pt),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return o(this,mt,!1),this.options.persister?this.options.persister(m,j,this):m(j)},c=(()=>{const m={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:i(this,pt),state:this.state,fetchFn:a};return n(m),m})();(x=this.options.behavior)==null||x.onFetch(c,this),o(this,yt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((w=c.fetchOptions)==null?void 0:w.meta))&&v(this,G,V).call(this,{type:"fetch",meta:(d=c.fetchOptions)==null?void 0:d.meta});const f=m=>{var b,j,y,p;Jt(m)&&m.silent||v(this,G,V).call(this,{type:"error",error:m}),Jt(m)||((j=(b=i(this,K).config).onError)==null||j.call(b,m,this),(p=(y=i(this,K).config).onSettled)==null||p.call(y,this.state.data,m,this)),this.scheduleGc()};return o(this,D,Be({initialPromise:s==null?void 0:s.initialPromise,fn:c.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var b,j,y,p;if(m===void 0){f(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(F){f(F);return}(j=(b=i(this,K).config).onSuccess)==null||j.call(b,m,this),(p=(y=i(this,K).config).onSettled)==null||p.call(y,m,this.state.error,this),this.scheduleGc()},onError:f,onFail:(m,b)=>{v(this,G,V).call(this,{type:"failed",failureCount:m,error:b})},onPause:()=>{v(this,G,V).call(this,{type:"pause"})},onContinue:()=>{v(this,G,V).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0})),i(this,D).start()}},Ft=new WeakMap,yt=new WeakMap,K=new WeakMap,pt=new WeakMap,D=new WeakMap,Lt=new WeakMap,mt=new WeakMap,G=new WeakSet,V=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,...ze(r.data,this.options),fetchMeta:t.meta??null};case"success":return o(this,yt,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=t.error;return Jt(n)&&n.revert&&i(this,yt)?{...i(this,yt),fetchStatus:"idle"}
vendor: 5,033 bytes, line 1
1:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),M.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,K).notify({query:this,type:"updated",action:t})})},Qe);function ze(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ge(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ds(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 B,De,fs=(De=class extends Tt{constructor(t={}){super();l(this,B);this.config=t,o(this,B,new Map)}build(t,s,r){const n=s.queryKey,a=s.queryHash??fe(n,s);let h=this.get(a);return h||(h=new ls({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(h)),h}add(t){i(this,B).has(t.queryHash)||(i(this,B).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,B).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,B).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){M.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,B).get(t)}getAll(){return[...i(this,B).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>be(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>be(t,r)):s}notify(t){M.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){M.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){M.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},B=new WeakMap,De),$,A,vt,z,Z,ke,ys=(ke=class extends $e{constructor(t){super();l(this,z);l(this,$);l(this,A);l(this,vt);this.mutationId=t.mutationId,o(this,A,t.mutationCache),o(this,$,[]),this.state=t.state||Ve(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){i(this,$).includes(t)||(i(this,$).push(t),this.clearGcTimeout(),i(this,A).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){o(this,$,i(this,$).filter(s=>s!==t)),this.scheduleGc(),i(this,A).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,$).length||(this.state.status==="pending"?this.scheduleGc():i(this,A).remove(this))}continue(){var t;return((t=i(this,vt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,h,c,f,x,w,d,m,b,j,y,p,F,k,S,Q,L,_,qt,I;const s=()=>{v(this,z,Z).call(this,{type:"continue"})};o(this,vt,Be({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,E)=>{v(this,z,Z).call(this,{type:"failed",failureCount:P,error:E})},onPause:()=>{v(this,z,Z).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,A).canRun(this)}));const r=this.state.status==="pending",n=!i(this,vt).canStart();try{if(r)s();else{v(this,z,Z).call(this,{type:"pending",variables:t,isPaused:n}),await((h=(a=i(this,A).config).onMutate)==null?void 0:h.call(a,t,this));const E=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t));E!==this.state.context&&v(this,z,Z).call(this,{type:"pending",context:E,variables:t,isPaused:n})}const P=await i(this,vt).start();return await((w=(x=i(this,A).config).onSuccess)==null?void 0:w.call(x,P,t,this.state.context,this)),await((m=(d=this.options).onSuccess)==null?void 0:m.call(d,P,t,this.state.context)),await((j=(b=i(this,A).config).onSettled)==null?void 0:j.call(b,P,null,this.state.variables,this.state.context,this)),await((p=(y=this.options).onSettled)==null?void 0:p.call(y,P,null,t,this.state.context)),v(this,z,Z).call(this,{type:"success",data:P}),P}catch(P){try{throw await((k=(F=i(this,A).config).onError)==null?void 0:k.call(F,P,t,this.state.context,this)),await((Q=(S=this.options).onError)==null?void 0:Q.call(S,P,t,this.state.context)),await((_=(L=i(this,A).config).onSettled)==null?void 0:_.call(L,void 0,P,this.state.variables,this.state.context,this)),await((I=(qt=this.options).onSettled)==null?void 0:I.call(qt,void 0,P,t,this.state.context)),P}finally{v(this,z,Z).call(this,{type:"error",error:P})}}finally{i(this,A).runNext(this)}}},$=new WeakMap,A=new WeakMap,vt=new WeakMap,z=new WeakSet,Z=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};
1case"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),M.batch(()=>{i(this,$).forEach(r=>{r.onMutationUpdate(t)}),i(this,A).notify({mutation:this,type:"updated",action:t})})},ke);function Ve(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var X,W,Kt,Ie,ps=(Ie=class extends Tt{constructor(t={}){super();l(this,X);l(this,W);l(this,Kt);this.config=t,o(this,X,new Set),o(this,W,new Map),o(this,Kt,0)}build(t,s,r){const n=new ys({mutationCache:this,mutationId:++Wt(this,Kt)._,options:t.defaultMutationOptions(s),state:r});return this.add(n),n}add(t){i(this,X).add(t);const s=Bt(t);if(typeof s=="string"){const r=i(this,W).get(s);r?r.push(t):i(this,W).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(i(this,X).delete(t)){const s=Bt(t);if(typeof s=="string"){const r=i(this,W).get(s);if(r)if(r.length>1){const n=r.indexOf(t);n!==-1&&r.splice(n,1)}else r[0]===t&&i(this,W).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=Bt(t);if(typeof s=="string"){const r=i(this,W).get(s),n=r==null?void 0:r.find(a=>a.state.status==="pending");return!n||n===t}else return!0}runNext(t){var r;const s=Bt(t);if(typeof s=="string"){const n=(r=i(this,W).get(s))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){M.batch(()=>{i(this,X).forEach(t=>{this.notify({type:"removed",mutation:t})}),i(this,X).clear(),i(this,W).clear()})}getAll(){return Array.from(i(this,X))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>ge(s,r))}findAll(t={}){return this.getAll().filter(s=>ge(t,s))}notify(t){M.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return M.batch(()=>Promise.all(t.map(s=>s.continue().catch(q))))}},X=new WeakMap,W=new WeakMap,Kt=new WeakMap,Ie);function Bt(e){var t;return(t=e.options.scope)==null?void 0:t.id}function we(e){return{onFetch:(t,s)=>{var w,d,m,b,j;const r=t.options,n=(m=(d=(w=t.fetchOptions)==null?void 0:w.meta)==null?void 0:d.fetchMore)==null?void 0:m.direction,a=((b=t.state.data)==null?void 0:b.pages)||[],h=((j=t.state.data)==null?void 0:j.pageParams)||[];let c={pages:[],pageParams:[]},f=0;const x=async()=>{let y=!1;const p=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},F=He(t.options,t.fetchOptions),k=async(S,Q,L)=>{if(y)return Promise.reject();if(Q==null&&S.pages.length)return Promise.resolve(S);const qt=(()=>{const lt={client:t.client,queryKey:t.queryKey,pageParam:Q,direction:L?"backward":"forward",meta:t.options.meta};return p(lt),lt})(),I=await F(qt),{maxPages:P}=t.options,E=L?ns:rs;return{pages:E(S.pages,I,P),pageParams:E(S.pageParams,Q,P)}};if(n&&a.length){const S=n==="backward",Q=S?ms:je,L={pages:a,pageParams:h},_=Q(r,L);c=await k(L,_,S)}else{const S=e??a.length;do{const Q=f===0?h[0]??r.initialPageParam:je(r,c);if(f>0&&Q==null)break;c=await k(c,Q),f++}while(f<S)}return c};t.options.persister?t.fetchFn=()=>{var y,p;return(p=(y=t.options).persister)==null?void 0:p.call(y,x,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=x}}}function je(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 ms(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 O,st,it,Pt,Et,rt,Mt,Qt,Ae,vs=(Ae=class{constructor(e={}){l(this,O);l(this,st);l(this,it);l(this,Pt);l(this,Et);l(this,rt);l(this,Mt);l(this,Qt);o(this,O,e.queryCache||new fs),o(this,st,e.mutationCache||new ps),o(this,it,e.defaultOptions||{}),o(this,Pt,new Map),o(this,Et,new Map),o(this,rt,0)}mount(){Wt(this,rt)._++,i(this,rt)===1&&(o(this,Mt,pe.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,O).onFocus())})),o(this,Qt,Vt.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,O).onOnline())})))}unmount(){var e,t;Wt(this,rt)._--,i(this,rt)===0&&((e=i(this,Mt))==null||e.call(this),o(this,Mt,void 0),(t=i(this,Qt))==null||t.call(this),o(this,Qt,void 0))}isFetching(e){return i(this,O).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,st).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,O).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,O).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(ct(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,O).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),n=i(this,O).get(r.queryHash),a=n==null?void 0:n.state.data,h=ss(t,a);if(h!==void 0)return i(this,O).build(this,r).setData(h,{...s,manual:!0})}
1setQueriesData(e,t,s){return M.batch(()=>i(this,O).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,O).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=i(this,O);M.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,O);return M.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=M.batch(()=>i(this,O).findAll(e).map(n=>n.cancel(s)));return Promise.all(r).then(q).catch(q)}invalidateQueries(e,t={}){return M.batch(()=>(i(this,O).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=M.batch(()=>i(this,O).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(q)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(q)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,O).build(this,t);return s.isStaleByTime(ct(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(q).catch(q)}
vendor: 14,892 bytes, lines 1-11
1fetchInfiniteQuery(e){return e.behavior=we(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(q).catch(q)}ensureInfiniteQueryData(e){return e.behavior=we(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vt.isOnline()?i(this,st).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,O)}getMutationCache(){return i(this,st)}getDefaultOptions(){return i(this,it)}setDefaultOptions(e){o(this,it,e)}setQueryDefaults(e,t){i(this,Pt).set(wt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,Pt).values()],s={};return t.forEach(r=>{Nt(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,Et).set(wt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,Et).values()],s={};return t.forEach(r=>{Nt(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,it).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fe(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===ye&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...i(this,it).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,O).clear(),i(this,st).clear()}},O=new WeakMap,st=new WeakMap,it=new WeakMap,Pt=new WeakMap,Et=new WeakMap,rt=new WeakMap,Mt=new WeakMap,Qt=new WeakMap,Ae),U,g,Ht,T,bt,Dt,nt,at,_t,kt,It,gt,xt,ot,At,C,Ut,ie,re,ne,ae,oe,ue,he,Xe,Te,bs=(Te=class extends Tt{constructor(t,s){super();l(this,C);l(this,U);l(this,g);l(this,Ht);l(this,T);l(this,bt);l(this,Dt);l(this,nt);l(this,at);l(this,_t);l(this,kt);l(this,It);l(this,gt);l(this,xt);l(this,ot);l(this,At,new Set);this.options=s,o(this,U,t),o(this,at,null),o(this,nt,se()),this.options.experimental_prefetchInRender||i(this,nt).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,g).addObserver(this),Se(i(this,g),this.options)?v(this,C,Ut).call(this):this.updateResult(),v(this,C,ae).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ce(i(this,g),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ce(i(this,g),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,v(this,C,oe).call(this),v(this,C,ue).call(this),i(this,g).removeObserver(this)}setOptions(t){const s=this.options,r=i(this,g);if(this.options=i(this,U).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof H(this.options.enabled,i(this,g))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");v(this,C,he).call(this),i(this,g).setOptions(this.options),s._defaulted&&!zt(this.options,s)&&i(this,U).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,g),observer:this});const n=this.hasListeners();n&&Oe(i(this,g),r,this.options,s)&&v(this,C,Ut).call(this),this.updateResult(),n&&(i(this,g)!==r||H(this.options.enabled,i(this,g))!==H(s.enabled,i(this,g))||ct(this.options.staleTime,i(this,g))!==ct(s.staleTime,i(this,g)))&&v(this,C,ie).call(this);const a=v(this,C,re).call(this);n&&(i(this,g)!==r||H(this.options.enabled,i(this,g))!==H(s.enabled,i(this,g))||a!==i(this,ot))&&v(this,C,ne).call(this,a)}getOptimisticResult(t){const s=i(this,U).getQueryCache().build(i(this,U),t),r=this.createResult(s,t);return xs(this,r)&&(o(this,T,r),o(this,Dt,this.options),o(this,bt,i(this,g).state)),r}getCurrentResult(){return i(this,T)}trackResult(t,s){return new Proxy(t,{get:(r,n)=>(this.trackProp(n),s==null||s(n),Reflect.get(r,n))})}trackProp(t){i(this,At).add(t)}getCurrentQuery(){return i(this,g)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=i(this,U).defaultQueryOptions(t),r=i(this,U).getQueryCache().build(i(this,U),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return v(this,C,Ut).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,T)))}createResult(t,s){var P;const r=i(this,g),n=this.options,a=i(this,T),h=i(this,bt),c=i(this,Dt),x=t!==r?t.state:i(this,Ht),{state:w}=t;let d={...w},m=!1,b;if(s._optimisticResults){const E=this.hasListeners(),lt=!E&&Se(t,s),jt=E&&Oe(t,r,s,n);(lt||jt)&&(d={...d,...ze(w.data,t.options)}),s._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:j,errorUpdatedAt:y,status:p}=d;b=d.data;let F=!1;if(s.placeholderData!==void 0&&b===void 0&&p==="pending"){let E;a!=null&&a.isPlaceholderData&&s.placeholderData===(c==null?void 0:c.placeholderData)?(E=a.data,F=!0):E=typeof s.placeholderData=="function"?s.placeholderData((P=i(this,It))==null?void 0:P.state.data,i(this,It)):s.placeholderData,E!==void 0&&(p="success",b=ee(a==null?void 0:a.data,E,s),m=!0)}if(s.select&&b!==void 0&&!F)if(a&&b===(h==null?void 0:h.data)&&s.select===i(this,_t))b=i(this,kt);else try{o(this,_t,s.select),b=s.select(b),b=ee(a==null?void 0:a.data,b,s),o(this,kt,b),o(this,at,null)}catch(E){o(this,at,E)}i(this,at)&&(j=i(this,at),b=i(this,kt),y=Date.now(),p="error");const k=d.fetchStatus==="fetching",S=p==="pending",Q=p==="error",L=S&&k,_=b!==void 0,I={status:p,fetchStatus:d.fetchStatus,isPending:S,isSuccess:p==="success",isError:Q,isInitialLoading:L,isLoading:L,data:b,dataUpdatedAt:d.dataUpdatedAt,error:j,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>x.dataUpdateCount||d.errorUpdateCount>x.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:Q&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:Q&&_,isStale:me(t,s),refetch:this.refetch,promise:i(this,nt),isEnabled:H(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const E=Gt=>{I.status==="error"?Gt.reject(I.error):I.data!==void 0&&Gt.resolve(I.data)},lt=()=>{const Gt=o(this,nt,I.promise=se());E(Gt)},jt=i(this,nt);switch(jt.status){case"pending":t.queryHash===r.queryHash&&E(jt);break;case"fulfilled":(I.status==="error"||I.data!==jt.value)&<();break;case"rejected":(I.status!=="error"||I.error!==jt.reason)&<();break}}return I}updateResult(){const t=i(this,T),s=this.createResult(i(this,g),this.options);if(o(this,bt,i(this,g).state),o(this,Dt,this.options),i(this,bt).data!==void 0&&o(this,It,i(this,g)),zt(s,t))return;o(this,T,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!i(this,At).size)return!0;const h=new Set(a??i(this,At));return this.options.throwOnError&&h.add("error"),Object.keys(i(this,T)).some(c=>{const f=c;return i(this,T)[f]!==t[f]&&h.has(f)})};v(this,C,Xe).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&v(this,C,ae).call(this)}},U=new WeakMap,g=new WeakMap,Ht=new WeakMap,T=new WeakMap,bt=new WeakMap,Dt=new WeakMap,nt=new WeakMap,at=new WeakMap,_t=new WeakMap,kt=new WeakMap,It=new WeakMap,gt=new WeakMap,xt=new WeakMap,ot=new WeakMap,At=new WeakMap,C=new WeakSet,Ut=function(t){v(this,C,he).call(this);let s=i(this,g).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(q)),s},ie=function(){v(this,C,oe).call(this);const t=ct(this.options.staleTime,i(this,g));if(Ct||i(this,T).isStale||!Zt(t))return;const r=Le(i(this,T).dataUpdatedAt,t)+1;o(this,gt,setTimeout(()=>{i(this,T).isStale||this.updateResult()},r))},re=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,g)):this.options.refetchInterval)??!1},ne=function(t){v(this,C,ue).call(this),o(this,ot,t),!(Ct||H(this.options.enabled,i(this,g))===!1||!Zt(i(this,ot))||i(this,ot)===0)&&o(this,xt,setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&v(this,C,Ut).call(this)},i(this,ot)))},ae=function(){v(this,C,ie).call(this),v(this,C,ne).call(this,v(this,C,re).call(this))},oe=function(){i(this,gt)&&(clearTimeout(i(this,gt)),o(this,gt,void 0))},ue=function(){i(this,xt)&&(clearInterval(i(this,xt)),o(this,xt,void 0))},he=function(){const t=i(this,U).getQueryCache().build(i(this,U),this.options);if(t===i(this,g))return;const s=i(this,g);o(this,g,t),o(this,Ht,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Xe=function(t){M.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(i(this,T))}),i(this,U).getQueryCache().notify({query:i(this,g),type:"observerResultsUpdated"})})},Te);function gs(e,t){return H(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Se(e,t){return gs(e,t)||e.state.data!==void 0&&ce(e,t,t.refetchOnMount)}function ce(e,t,s){if(H(t.enabled,e)!==!1&&ct(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&me(e,t)}return!1}function Oe(e,t,s,r){return(e!==t||H(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&me(e,s)}function me(e,t){return H(t.enabled,e)!==!1&&e.isStaleByTime(ct(t.staleTime,e))}function xs(e,t){return!zt(e.getCurrentResult(),t)}var ut,ht,N,J,Y,$t,le,qe,Cs=(qe=class extends Tt{constructor(t,s){super();l(this,Y);l(this,ut);l(this,ht);l(this,N);l(this,J);o(this,ut,t),this.setOptions(s),this.bindMethods(),v(this,Y,$t).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=i(this,ut).defaultMutationOptions(t),zt(this.options,s)||i(this,ut).getMutationCache().notify({type:"observerOptionsUpdated",mutation:i(this,N),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&wt(s.mutationKey)!==wt(this.options.mutationKey)?this.reset():((r=i(this,N))==null?void 0:r.state.status)==="pending"&&i(this,N).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=i(this,N))==null||t.removeObserver(this)}onMutationUpdate(t){v(this,Y,$t).call(this),v(this,Y,le).call(this,t)}getCurrentResult(){return i(this,ht)}reset(){var t;(t=i(this,N))==null||t.removeObserver(this),o(this,N,void 0),v(this,Y,$t).call(this),v(this,Y,le).call(this)}mutate(t,s){var r;return o(this,J,s),(r=i(this,N))==null||r.removeObserver(this),o(this,N,i(this,ut).getMutationCache().build(i(this,ut),this.options)),i(this,N).addObserver(this),i(this,N).execute(t)}},ut=new WeakMap,ht=new WeakMap,N=new WeakMap,J=new WeakMap,Y=new WeakSet,$t=function(){var s;const t=((s=i(this,N))==null?void 0:s.state)??Ve();o(this,ht,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},le=function(t){M.batch(()=>{var s,r,n,a,h,c,f,x;if(i(this,J)&&this.hasListeners()){const w=i(this,ht).variables,d=i(this,ht).context;(t==null?void 0:t.type)==="success"?((r=(s=i(this,J)).onSuccess)==null||r.call(s,t.data,w,d),(a=(n=i(this,J)).onSettled)==null||a.call(n,t.data,null,w,d)):(t==null?void 0:t.type)==="error"&&((c=(h=i(this,J)).onError)==null||c.call(h,t.error,w,d),(x=(f=i(this,J)).onSettled)==null||x.call(f,void 0,t.error,w,d))}this.listeners.forEach(w=>{w(i(this,ht))})})},qe),Je=R.createContext(void 0),Ye=e=>{const t=R.useContext(Je);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ws=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Je.Provider,{value:e,children:t})),Ze=R.createContext(!1),js=()=>R.useContext(Ze);Ze.Provider;function Ss(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Os=R.createContext(Ss()),Rs=()=>R.useContext(Os),Fs=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ps=e=>{R.useEffect(()=>{e.clearReset()},[e])},Es=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(n&&e.data===void 0||_e(s,[e.error,r])),Ms=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>t(s(...r)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Qs=(e,t)=>e.isLoading&&e.isFetching&&!t,Ds=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Re=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function ks(e,t,s){var d,m,b,j,y;const r=js(),n=Rs(),a=Ye(),h=a.defaultQueryOptions(e);(m=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||m.call(d,h),h._optimisticResults=r?"isRestoring":"optimistic",Ms(h),Fs(h,n),Ps(n);const c=!a.getQueryCache().get(h.queryHash),[f]=R.useState(()=>new t(a,h)),x=f.getOptimisticResult(h),w=!r&&e.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(p=>{const F=w?f.subscribe(M.batchCalls(p)):q;return f.updateResult(),F},[f,w]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),R.useEffect(()=>{f.setOptions(h)},[h,f]),Ds(h,x))throw Re(h,f,n);if(Es({result:x,errorResetBoundary:n,throwOnError:h.throwOnError,query:a.getQueryCache().get(h.queryHash),suspense:h.suspense}))throw x.error;if((j=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||j.call(b,h,x),h.experimental_prefetchInRender&&!Ct&&Qs(x,r)){const p=c?Re(h,f,n):(y=a.getQueryCache().get(h.queryHash))==null?void 0:y.promise;p==null||p.catch(q).finally(()=>{f.updateResult()})}return h.notifyOnChangeProps?x:f.trackResult(x)}function Is(e,t){return ks(e,bs)}function Yt(e,t){const s=Ye(),[r]=R.useState(()=>new Cs(s,e));R.useEffect(()=>{r.setOptions(e)},[r,e]);const n=R.useSyncExternalStore(R.useCallback(h=>r.subscribe(M.batchCalls(h)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=R.useCallback((h,c)=>{r.mutate(h,c).catch(q)},[r]);if(n.error&&_e(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}/** 2 * @license lucide-react v0.468.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const As=Ne("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** 7 * @license lucide-react v0.468.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ts=Ne("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
11],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]),de=es(),qs=new vs;function Us(){const[e,t]=R.useState([]);return R.useEffect(()=>(t(de.getWallets()),de.subscribe(s=>t(s))),[]),e}function Ns(){const e=Us(),[t,s]=R.useState([]),r=R.useCallback(n=>{const a=[];n.accounts&&a.push(`Accounts: ${n.accounts.map(ts).join(", ")}`),n.chains&&a.push(`Chains: ${n.chains.join(", ")}`);const h=a.join(" | ");s(c=>[h,...c].slice(0,10))},[]);return u.jsx(ws,{client:qs,children:u.jsxs("div",{className:"border border-gray-200 rounded-md p-4 flex flex-col gap-8",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("div",{className:"flex flex-row justify-between",children:[u.jsx("h1",{className:"text-2xl font-bold",children:"Wallets"}),u.jsx("button",{className:"border active:bg-gray-200/10 px-2 py-1 rounded-md",type:"button",onClick:()=>de._refreshInjectedWallets(),children:u.jsx(As,{})})]}),u.jsx("div",{className:"flex flex-col gap-2 pt-4",children:e.map(n=>u.jsx(Ls,{wallet:n,addEvent:r},n.name))})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("div",{className:"flex flex-row justify-between",children:[u.jsx("h1",{className:"text-2xl font-bold",children:"Events"}),u.jsx("button",{className:"border active:bg-gray-200/10 px-2 py-1 rounded-md",type:"button",onClick:()=>s([]),children:u.jsx(Ts,{})})]}),u.jsx("div",{className:"flex flex-col gap-2 pt-4",children:t.map((n,a)=>u.jsx("p",{className:"text-sm text-gray-500",children:n},a))})]})]})})}function Ls({wallet:e,addEvent:t}){const{data:s}=Is({queryKey:["wallet",e.name],queryFn:()=>e.features["starknet:walletApi"].request({type:"wallet_getPermissions"})}),{mutate:r}=Yt({mutationKey:["wallet",e.name,"connect"],mutationFn:()=>e.features["standard:connect"].connect({silent:!1})}),{mutate:n}=Yt({mutationKey:["wallet",e.name,"connectSilent"],mutationFn:()=>e.features["standard:connect"].connect({silent:!0})}),{mutate:a}=Yt({mutationKey:["wallet",e.name,"disconnect"],mutationFn:()=>e.features["standard:disconnect"].disconnect()});R.useEffect(()=>e.features["standard:events"].on("change",t),[e,t]);const h=e.accounts.length>0?e.accounts.map(ts).join(", "):"Not connected";return u.jsxs("div",{className:"border border-gray-200 p-2 rounded-md flex flex-col gap-1",children:[u.jsxs("div",{className:"flex flex-row justify-between",children:[u.jsx("p",{className:"text-md",children:e.name}),u.jsx("p",{className:"text-sm text-gray-500",children:JSON.stringify(s)})]}),u.jsx("div",{className:"flex flex-row justify-between",children:u.jsxs("p",{className:"text-sm text-gray-500",children:["Accounts: ",u.jsx("span",{className:"font-bold",children:h})]})}),u.jsxs("div",{className:"flex flex-row gap-4 justify-between",children:[u.jsx("button",{className:"border active:bg-gray-200/10 w-full px-2 py-1 rounded-md",type:"button",onClick:()=>r(),children:"Connect"}),u.jsx("button",{className:"border active:bg-gray-200/10 w-full px-2 py-1 rounded-md",type:"button",onClick:()=>n(),children:"Connect Silent"}),u.jsx("button",{className:"border active:bg-gray-200/10 w-full px-2 py-1 rounded-md",type:"button",onClick:()=>a(),children:"Disconnect"})]})]})}function ts({address:e,chains:t}){return`${e.slice(0,6)}...${e.slice(-4)} on ${t.join(", ")}`}const Ws={title:"Wallet Discovery",description:"undefined"};function Fe(e){const t={a:"a",code:"code",div:"div",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",ul:"ul",...Ue(),...e.components};return u.jsxs(u.Fragment,{children:[u.jsx(t.header,{children:u.jsxs(t.h1,{id:"wallet-discovery",children:["Wallet Discovery",u.jsx(t.a,{"aria-hidden":"true",tabIndex:"-1",href:"#wallet-discovery",children:u.jsx(t.div,{"data-autolink-icon":!0})})]})}),` 12`,u.jsxs(t.p,{children:["This demo shows how to use ",u.jsx(t.code,{children:"@starknet-io/get-starknet-discovery"}),` to discover 13wallets that support Starknet.`]}),` 14`,u.jsxs(t.h2,{id:"goal",children:["Goal",u.jsx(t.a,{"aria-hidden":"true",tabIndex:"-1",href:"#goal",children:u.jsx(t.div,{"data-autolink-icon":!0})})]}),` 15`,u.jsxs(t.ul,{children:[` 16`,u.jsx(t.li,{children:"Injected wallets are discovered and displayed."}),`
17`,u.jsxs(t.li,{children:["Can connect and disconnect wallets (",u.jsx(t.code,{children:"standard:connect"}),` and 18`,u.jsx(t.code,{children:"standard:disconnect"})," features)."]}),` 19`,u.jsxs(t.li,{children:["Events are listened for and displayed (",u.jsx(t.code,{children:"standard:events"})," feature)."]}),` 20`]}),` 21`,u.jsxs(t.h2,{id:"how-to-use",children:["How to use",u.jsx(t.a,{"aria-hidden":"true",tabIndex:"-1",href:"#how-to-use",children:u.jsx(t.div,{"data-autolink-icon":!0})})]}),` 22`,u.jsxs(t.ul,{children:[` 23`,u.jsx(t.li,{children:"Have at least one Starknet wallet installed."}),` 24`,u.jsx(t.li,{children:`Click the refresh button to discover wallets (if the wallet doesn't implement 25the Wallet Standard discovery mechanism).`}),` 26`,u.jsx(t.li,{children:`Click the "Connect Silent" button and verify that the wallet doesn't ask for 27permission.`}),` 28`,u.jsx(t.li,{children:'Click the "Connect" button to connect the wallet.'}),` 29`,u.jsx(t.li,{children:"Check that the wallet address and chain are displayed."}),` 30`,u.jsx(t.li,{children:"Check that the events are displayed."}),` 31`,u.jsx(t.li,{children:"Change the chain and/or account from the wallet interface."}),` 32`,u.jsx(t.li,{children:"Check that the events are displayed and the ui updates."}),`
33`,u.jsx(t.li,{children:'Click the "Disconnect" button to disconnect the wallet.'}),` 34`,u.jsx(t.li,{children:"Check that the wallet address and chain are no longer displayed."}),` 35`,u.jsx(t.li,{children:"Check that the events show the wallet being disconnected."}),` 36`]}),` 37`,u.jsxs(t.h2,{id:"demo",children:["Demo",u.jsx(t.a,{"aria-hidden":"true",tabIndex:"-1",href:"#demo",children:u.jsx(t.div,{"data-autolink-icon":!0})})]}),` 38`,u.jsx(Ns,{})]})}function Bs(e={}){const{wrapper:t}={...Ue(),...e.components};return t?u.jsx(t,{...e,children:u.jsx(Fe,{...e})}):Fe(e)}export{Bs as default,Ws as frontmatter};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.