import{r as M,j as mt,a as vt}from"./mantine-PZICIGS6.js";var U=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(){}},q=typeof window>"u"||"Deno"in globalThis;function O(){}function St(e,n){return typeof e=="function"?e(n):e}function de(e){return typeof e=="number"&&e>=0&&e!==1/0}function je(e,n){return Math.max(e+(n||0)-Date.now(),0)}function H(e,n){return typeof e=="function"?e(n):e}function b(e,n){return typeof e=="function"?e(n):e}function Ie(e,n){const{type:t="all",exact:s,fetchStatus:i,predicate:r,queryKey:o,stale:l}=e;if(o){if(s){if(n.queryHash!==ye(o,n.options))return!1}else if(!N(n.queryKey,o))return!1}if(t!=="all"){const u=n.isActive();if(t==="active"&&!u||t==="inactive"&&u)return!1}return!(typeof l=="boolean"&&n.isStale()!==l||i&&i!==n.state.fetchStatus||r&&!r(n))}function Oe(e,n){const{exact:t,status:s,predicate:i,mutationKey:r}=e;if(r){if(!n.options.mutationKey)return!1;if(t){if(k(n.options.mutationKey)!==k(r))return!1}else if(!N(n.options.mutationKey,r))return!1}return!(s&&n.state.status!==s||i&&!i(n))}function ye(e,n){return(n?.queryKeyHashFn||k)(e)}function k(e){return JSON.stringify(e,(n,t)=>he(t)?Object.keys(t).sort().reduce((s,i)=>(s[i]=t[i],s),{}):t)}function N(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(t=>N(e[t],n[t])):!1}var Ct=Object.prototype.hasOwnProperty;function Ue(e,n){if(e===n)return e;const t=$e(e)&&$e(n);if(!t&&!(he(e)&&he(n)))return n;const i=(t?e:Object.keys(e)).length,r=t?n:Object.keys(n),o=r.length,l=t?new Array(o):{};let u=0;for(let c=0;c{setTimeout(n,e)})}function ge(e,n,t){return typeof t.structuralSharing=="function"?t.structuralSharing(e,n):t.structuralSharing!==!1?Ue(e,n):n}function Wn(e){return e}function Rt(e,n,t=0){const s=[...e,n];return t&&s.length>t?s.slice(1):s}function yt(e,n,t=0){const s=[n,...e];return t&&s.length>t?s.slice(0,-1):s}var Fe=Symbol();function Qe(e,n){return!e.queryFn&&n?.initialPromise?()=>n.initialPromise:!e.queryFn||e.queryFn===Fe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Be(e,n){return typeof e=="function"?e(...n):!!e}var Ft=class extends U{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!q&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},_e=new Ft,_t=class extends U{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!q&&window.addEventListener){const n=()=>e(!0),t=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#t}},ee=new _t;function fe(){let e,n;const t=new Promise((i,r)=>{e=i,n=r});t.status="pending",t.catch(()=>{});function s(i){Object.assign(t,i),delete t.resolve,delete t.reject}return t.resolve=i=>{s({status:"fulfilled",value:i}),e(i)},t.reject=i=>{s({status:"rejected",reason:i}),n(i)},t}function Mt(e){return Math.min(1e3*2**e,3e4)}function Ne(e){return(e??"online")==="online"?ee.isOnline():!0}var pe=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ke(e){let n=!1,t=0,s;const i=fe(),r=()=>i.status!=="pending",o=f=>{if(!r()){const v=new pe(f);d(v),e.onCancel?.(v)}},l=()=>{n=!0},u=()=>{n=!1},c=()=>_e.isFocused()&&(e.networkMode==="always"||ee.isOnline())&&e.canRun(),h=()=>Ne(e.networkMode)&&e.canRun(),p=f=>{r()||(s?.(),i.resolve(f))},d=f=>{r()||(s?.(),i.reject(f))},a=()=>new Promise(f=>{s=v=>{(r()||c())&&f(v)},e.onPause?.()}).then(()=>{s=void 0,r()||e.onContinue?.()}),g=()=>{if(r())return;let f;const v=t===0?e.initialPromise:void 0;try{f=v??e.fn()}catch(m){f=Promise.reject(m)}Promise.resolve(f).then(p).catch(m=>{if(r())return;const w=e.retry??(q?0:3),R=e.retryDelay??Mt,_=typeof R=="function"?R(t,m):R,y=w===!0||typeof w=="number"&&tc()?void 0:a()).then(()=>{n?d(m):g()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(s?.(),i),cancelRetry:l,continueRetry:u,canStart:h,start:()=>(h()?g():a().then(g),i)}}var xt=e=>setTimeout(e,0);function Et(){let e=[],n=0,t=l=>{l()},s=l=>{l()},i=xt;const r=l=>{n?e.push(l):i(()=>{t(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{s(()=>{l.forEach(u=>{t(u)})})})};return{batch:l=>{let u;n++;try{u=l()}finally{n--,n||o()}return u},batchCalls:l=>(...u)=>{r(()=>{l(...u)})},schedule:r,setNotifyFunction:l=>{t=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{i=l}}}var x=Et(),We=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),de(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(q?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Pt=class extends We{#t;#e;#n;#s;#i;#o;#l;constructor(e){super(),this.#l=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=It(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,n){const t=ge(this.state.data,e,this.options);return this.#r({data:t,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),t}setState(e,n){this.#r({type:"setState",state:e,setStateOptions:n})}cancel(e){const n=this.#i?.promise;return this.#i?.cancel(e),n?n.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>b(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>H(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!je(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(this.#i&&(this.#l?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}async fetch(e,n){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(u=>u.options.queryFn);l&&this.setOptions(l.options)}const t=new AbortController,s=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#l=!0,t.signal)})},i=()=>{const l=Qe(this.options,n),c=(()=>{const h={client:this.#s,queryKey:this.queryKey,meta:this.meta};return s(h),h})();return this.#l=!1,this.options.persister?this.options.persister(l,c,this):l(c)},o=(()=>{const l={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:i};return s(l),l})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#r({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=Ke({initialPromise:n?.initialPromise,fn:o.fetchFn,onCancel:l=>{l instanceof pe&&l.revert&&this.setState({...this.#e,fetchStatus:"idle"}),t.abort()},onFail:(l,u)=>{this.#r({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const l=await this.#i.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#n.config.onSuccess?.(l,this),this.#n.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof pe){if(l.silent)return this.#i.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#r({type:"error",error:l}),this.#n.config.onError?.(l,this),this.#n.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#r(e){const n=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...Xe(t.data,this.options),fetchMeta:e.meta??null};case"success":const s={...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?s:void 0,s;case"error":const i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=n(this.state),x.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Xe(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ne(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function It(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,t=n!==void 0,s=t?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:t?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ot=class extends U{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,n,t){const s=n.queryKey,i=n.queryHash??ye(s,n);let r=this.get(i);return r||(r=new Pt({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:t,defaultOptions:e.getQueryDefaults(s)}),this.add(r)),r}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=this.#t.get(e.queryHash);n&&(e.destroy(),n===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const n={exact:!0,...e};return this.getAll().find(t=>Ie(n,t))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(t=>Ie(e,t)):n}notify(e){x.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$t=class extends We{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||Ye(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(n=>n!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){const n=()=>{this.#s({type:"continue"})};this.#n=Ke({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(i,r)=>{this.#s({type:"failed",failureCount:i,error:r})},onPause:()=>{this.#s({type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",s=!this.#n.canStart();try{if(t)n();else{this.#s({type:"pending",variables:e,isPaused:s}),await this.#e.config.onMutate?.(e,this);const r=await this.options.onMutate?.(e);r!==this.state.context&&this.#s({type:"pending",context:r,variables:e,isPaused:s})}const i=await this.#n.start();return await this.#e.config.onSuccess?.(i,e,this.state.context,this),await this.options.onSuccess?.(i,e,this.state.context),await this.#e.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,e,this.state.context),this.#s({type:"success",data:i}),i}catch(i){try{throw await this.#e.config.onError?.(i,e,this.state.context,this),await this.options.onError?.(i,e,this.state.context),await this.#e.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,i,e,this.state.context),i}finally{this.#s({type:"error",error:i})}}finally{this.#e.runNext(this)}}#s(e){const n=t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function Ye(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bt=class extends U{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,n,t){const s=new $t({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(n),state:t});return this.add(s),s}add(e){this.#t.add(e);const n=W(e);if(typeof n=="string"){const t=this.#e.get(n);t?t.push(e):this.#e.set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const n=W(e);if(typeof n=="string"){const t=this.#e.get(n);if(t)if(t.length>1){const s=t.indexOf(e);s!==-1&&t.splice(s,1)}else t[0]===e&&this.#e.delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=W(e);if(typeof n=="string"){const s=this.#e.get(n)?.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){const n=W(e);return typeof n=="string"?this.#e.get(n)?.find(s=>s!==e&&s.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const n={exact:!0,...e};return this.getAll().find(t=>Oe(n,t))}findAll(e={}){return this.getAll().filter(n=>Oe(e,n))}notify(e){x.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return x.batch(()=>Promise.all(e.map(n=>n.continue().catch(O))))}};function W(e){return e.options.scope?.id}function Ve(e){return{onFetch:(n,t)=>{const s=n.options,i=n.fetchOptions?.meta?.fetchMore?.direction,r=n.state.data?.pages||[],o=n.state.data?.pageParams||[];let l={pages:[],pageParams:[]},u=0;const c=async()=>{let h=!1;const p=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(n.signal.aborted?h=!0:n.signal.addEventListener("abort",()=>{h=!0}),n.signal)})},d=Qe(n.options,n.fetchOptions),a=async(g,f,v)=>{if(h)return Promise.reject();if(f==null&&g.pages.length)return Promise.resolve(g);const w=(()=>{const F={client:n.client,queryKey:n.queryKey,pageParam:f,direction:v?"backward":"forward",meta:n.options.meta};return p(F),F})(),R=await d(w),{maxPages:_}=n.options,y=v?yt:Rt;return{pages:y(g.pages,R,_),pageParams:y(g.pageParams,f,_)}};if(i&&r.length){const g=i==="backward",f=g?Vt:De,v={pages:r,pageParams:o},m=f(s,v);l=await a(v,m,g)}else{const g=e??r.length;do{const f=u===0?o[0]??s.initialPageParam:De(s,l);if(u>0&&f==null)break;l=await a(l,f),u++}while(un.options.persister?.(c,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},t):n.fetchFn=c}}}function De(e,{pages:n,pageParams:t}){const s=n.length-1;return n.length>0?e.getNextPageParam(n[s],n,t[s],t):void 0}function Vt(e,{pages:n,pageParams:t}){return n.length>0?e.getPreviousPageParam?.(n[0],n,t[0],t):void 0}var Xn=class{#t;#e;#n;#s;#i;#o;#l;#r;constructor(e={}){this.#t=e.queryCache||new Ot,this.#e=e.mutationCache||new bt,this.#n=e.defaultOptions||{},this.#s=new Map,this.#i=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#l=_e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#r=ee.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#l?.(),this.#l=void 0,this.#r?.(),this.#r=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const n=this.defaultQueryOptions({queryKey:e});return this.#t.get(n.queryHash)?.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),t=this.#t.build(this,n),s=t.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&t.isStaleByTime(H(n.staleTime,t))&&this.prefetchQuery(n),Promise.resolve(s))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:n,state:t})=>{const s=t.data;return[n,s]})}setQueryData(e,n,t){const s=this.defaultQueryOptions({queryKey:e}),r=this.#t.get(s.queryHash)?.state.data,o=St(n,r);if(o!==void 0)return this.#t.build(this,s).setData(o,{...t,manual:!0})}setQueriesData(e,n,t){return x.batch(()=>this.#t.findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,n,t)]))}getQueryState(e){const n=this.defaultQueryOptions({queryKey:e});return this.#t.get(n.queryHash)?.state}removeQueries(e){const n=this.#t;x.batch(()=>{n.findAll(e).forEach(t=>{n.remove(t)})})}resetQueries(e,n){const t=this.#t;return x.batch(()=>(t.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const t={revert:!0,...n},s=x.batch(()=>this.#t.findAll(e).map(i=>i.cancel(t)));return Promise.all(s).then(O).catch(O)}invalidateQueries(e,n={}){return x.batch(()=>(this.#t.findAll(e).forEach(t=>{t.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},n)))}refetchQueries(e,n={}){const t={...n,cancelRefetch:n.cancelRefetch??!0},s=x.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let r=i.fetch(void 0,t);return t.throwOnError||(r=r.catch(O)),i.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(s).then(O)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const t=this.#t.build(this,n);return t.isStaleByTime(H(n.staleTime,t))?t.fetch(n):Promise.resolve(t.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e.behavior=Ve(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=Ve(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ee.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,n){this.#s.set(k(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...this.#s.values()],t={};return n.forEach(s=>{N(e,s.queryKey)&&Object.assign(t,s.defaultOptions)}),t}setMutationDefaults(e,n){this.#i.set(k(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...this.#i.values()],t={};return n.forEach(s=>{N(e,s.mutationKey)&&Object.assign(t,s.defaultOptions)}),t}defaultQueryOptions(e){if(e._defaulted)return e;const n={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=ye(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===Fe&&(n.enabled=!1),n}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Dt=class extends U{constructor(e,n){super(),this.options=n,this.#t=e,this.#r=null,this.#l=fe(),this.bindMethods(),this.setOptions(n)}#t;#e=void 0;#n=void 0;#s=void 0;#i;#o;#l;#r;#p;#h;#g;#a;#c;#u;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ae(this.#e,this.options)?this.#d():this.updateResult(),this.#C())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return me(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return me(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#R(),this.#e.removeObserver(this)}setOptions(e){const n=this.options,t=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof b(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#y(),this.#e.setOptions(this.options),n._defaulted&&!Z(this.options,n)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const s=this.hasListeners();s&&ze(this.#e,t,this.options,n)&&this.#d(),this.updateResult(),s&&(this.#e!==t||b(this.options.enabled,this.#e)!==b(n.enabled,this.#e)||H(this.options.staleTime,this.#e)!==H(n.staleTime,this.#e))&&this.#m();const i=this.#v();s&&(this.#e!==t||b(this.options.enabled,this.#e)!==b(n.enabled,this.#e)||i!==this.#u)&&this.#S(i)}getOptimisticResult(e){const n=this.#t.getQueryCache().build(this.#t,e),t=this.createResult(n,e);return zt(this,t)&&(this.#s=t,this.#o=this.options,this.#i=this.#e.state),t}getCurrentResult(){return this.#s}trackResult(e,n){return new Proxy(e,{get:(t,s)=>(this.trackProp(s),n?.(s),s==="promise"&&!this.options.experimental_prefetchInRender&&this.#l.status==="pending"&&this.#l.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(t,s))})}trackProp(e){this.#f.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#t.defaultQueryOptions(e),t=this.#t.getQueryCache().build(this.#t,n);return t.fetch().then(()=>this.createResult(t,n))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#y();let n=this.#e.fetch(this.options,e);return e?.throwOnError||(n=n.catch(O)),n}#m(){this.#w();const e=H(this.options.staleTime,this.#e);if(q||this.#s.isStale||!de(e))return;const t=je(this.#s.dataUpdatedAt,e)+1;this.#a=setTimeout(()=>{this.#s.isStale||this.updateResult()},t)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#S(e){this.#R(),this.#u=e,!(q||b(this.options.enabled,this.#e)===!1||!de(this.#u)||this.#u===0)&&(this.#c=setInterval(()=>{(this.options.refetchIntervalInBackground||_e.isFocused())&&this.#d()},this.#u))}#C(){this.#m(),this.#S(this.#v())}#w(){this.#a&&(clearTimeout(this.#a),this.#a=void 0)}#R(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}createResult(e,n){const t=this.#e,s=this.options,i=this.#s,r=this.#i,o=this.#o,u=e!==t?e.state:this.#n,{state:c}=e;let h={...c},p=!1,d;if(n._optimisticResults){const E=this.hasListeners(),D=!E&&Ae(e,n),z=E&&ze(e,t,n,s);(D||z)&&(h={...h,...Xe(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:a,errorUpdatedAt:g,status:f}=h;d=h.data;let v=!1;if(n.placeholderData!==void 0&&d===void 0&&f==="pending"){let E;i?.isPlaceholderData&&n.placeholderData===o?.placeholderData?(E=i.data,v=!0):E=typeof n.placeholderData=="function"?n.placeholderData(this.#g?.state.data,this.#g):n.placeholderData,E!==void 0&&(f="success",d=ge(i?.data,E,n),p=!0)}if(n.select&&d!==void 0&&!v)if(i&&d===r?.data&&n.select===this.#p)d=this.#h;else try{this.#p=n.select,d=n.select(d),d=ge(i?.data,d,n),this.#h=d,this.#r=null}catch(E){this.#r=E}this.#r&&(a=this.#r,d=this.#h,g=Date.now(),f="error");const m=h.fetchStatus==="fetching",w=f==="pending",R=f==="error",_=w&&m,y=d!==void 0,P={status:f,fetchStatus:h.fetchStatus,isPending:w,isSuccess:f==="success",isError:R,isInitialLoading:_,isLoading:_,data:d,dataUpdatedAt:h.dataUpdatedAt,error:a,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!w,isLoadingError:R&&!y,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:R&&y,isStale:Me(e,n),refetch:this.refetch,promise:this.#l,isEnabled:b(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const E=G=>{P.status==="error"?G.reject(P.error):P.data!==void 0&&G.resolve(P.data)},D=()=>{const G=this.#l=P.promise=fe();E(G)},z=this.#l;switch(z.status){case"pending":e.queryHash===t.queryHash&&E(z);break;case"fulfilled":(P.status==="error"||P.data!==z.value)&&D();break;case"rejected":(P.status!=="error"||P.error!==z.reason)&&D();break}}return P}updateResult(){const e=this.#s,n=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#o=this.options,this.#i.data!==void 0&&(this.#g=this.#e),Z(n,e))return;this.#s=n;const t=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!this.#f.size)return!0;const r=new Set(i??this.#f);return this.options.throwOnError&&r.add("error"),Object.keys(this.#s).some(o=>{const l=o;return this.#s[l]!==e[l]&&r.has(l)})};this.#F({listeners:t()})}#y(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const n=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#C()}#F(e){x.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#s)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function At(e,n){return b(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function Ae(e,n){return At(e,n)||e.state.data!==void 0&&me(e,n,n.refetchOnMount)}function me(e,n,t){if(b(n.enabled,e)!==!1&&H(n.staleTime,e)!=="static"){const s=typeof t=="function"?t(e):t;return s==="always"||s!==!1&&Me(e,n)}return!1}function ze(e,n,t,s){return(e!==n||b(s.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&Me(e,t)}function Me(e,n){return b(n.enabled,e)!==!1&&e.isStaleByTime(H(n.staleTime,e))}function zt(e,n){return!Z(e.getCurrentResult(),n)}var Lt=class extends U{#t;#e=void 0;#n;#s;constructor(e,n){super(),this.#t=e,this.setOptions(n),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#t.defaultMutationOptions(e),Z(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&k(n.mutationKey)!==k(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#o(e)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#o()}mutate(e,n){return this.#s=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){const e=this.#n?.state??Ye();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#o(e){x.batch(()=>{if(this.#s&&this.hasListeners()){const n=this.#e.variables,t=this.#e.context;e?.type==="success"?(this.#s.onSuccess?.(e.data,n,t),this.#s.onSettled?.(e.data,null,n,t)):e?.type==="error"&&(this.#s.onError?.(e.error,n,t),this.#s.onSettled?.(void 0,e.error,n,t))}this.listeners.forEach(n=>{n(this.#e)})})}},Je=M.createContext(void 0),Ze=e=>{const n=M.useContext(Je);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},Yn=({client:e,children:n})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),mt.jsx(Je.Provider,{value:e,children:n})),et=M.createContext(!1),Ht=()=>M.useContext(et);et.Provider;function Tt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Gt=M.createContext(Tt()),qt=()=>M.useContext(Gt),kt=(e,n)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(n.isReset()||(e.retryOnMount=!1))},jt=e=>{M.useEffect(()=>{e.clearReset()},[e])},Ut=({result:e,errorResetBoundary:n,throwOnError:t,query:s,suspense:i})=>e.isError&&!n.isReset()&&!e.isFetching&&s&&(i&&e.data===void 0||Be(t,[e.error,s])),Qt=e=>{if(e.suspense){const t=i=>i==="static"?i:Math.max(i??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...i)=>t(s(...i)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Bt=(e,n)=>e.isLoading&&e.isFetching&&!n,Nt=(e,n)=>e?.suspense&&n.isPending,Le=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function Kt(e,n,t){const s=Ht(),i=qt(),r=Ze(),o=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=s?"isRestoring":"optimistic",Qt(o),kt(o,i),jt(i);const l=!r.getQueryCache().get(o.queryHash),[u]=M.useState(()=>new n(r,o)),c=u.getOptimisticResult(o),h=!s&&e.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(p=>{const d=h?u.subscribe(x.batchCalls(p)):O;return u.updateResult(),d},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),M.useEffect(()=>{u.setOptions(o)},[o,u]),Nt(o,c))throw Le(o,u,i);if(Ut({result:c,errorResetBoundary:i,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw c.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(o,c),o.experimental_prefetchInRender&&!q&&Bt(c,s)&&(l?Le(o,u,i):r.getQueryCache().get(o.queryHash)?.promise)?.catch(O).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?c:u.trackResult(c)}function Jn(e,n){return Kt(e,Dt)}function Zn(e,n){const t=Ze(),[s]=M.useState(()=>new Lt(t,e));M.useEffect(()=>{s.setOptions(e)},[s,e]);const i=M.useSyncExternalStore(M.useCallback(o=>s.subscribe(x.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),r=M.useCallback((o,l)=>{s.mutate(o,l).catch(O)},[s]);if(i.error&&Be(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:r,mutateAsync:i.mutate}}function j(e,n,t){let s=t.initialDeps??[],i,r=!0;function o(){var l,u,c;let h;t.key&&((l=t.debug)!=null&&l.call(t))&&(h=Date.now());const p=e();if(!(p.length!==s.length||p.some((g,f)=>s[f]!==g)))return i;s=p;let a;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(a=Date.now()),i=n(...p),t.key&&((c=t.debug)!=null&&c.call(t))){const g=Math.round((Date.now()-h)*100)/100,f=Math.round((Date.now()-a)*100)/100,v=f/16,m=(w,R)=>{for(w=String(w);w.length{s=l},o}function He(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Wt=(e,n)=>Math.abs(e-n)<1.01,tt=(e,n,t)=>{let s;return function(...i){e.clearTimeout(s),s=e.setTimeout(()=>n.apply(this,i),t)}},Te=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Xt=e=>e,Yt=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let i=n;i<=t;i++)s.push(i);return s},Jt=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const i=o=>{const{width:l,height:u}=o;n({width:Math.round(l),height:Math.round(u)})};if(i(Te(t)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(o=>{const l=()=>{const u=o[0];if(u?.borderBoxSize){const c=u.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Te(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},K={passive:!0},Zt=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=()=>{n({width:t.innerWidth,height:t.innerHeight})};return s(),t.addEventListener("resize",s,K),()=>{t.removeEventListener("resize",s)}},te=typeof window>"u"?!0:"onscrollend"in window,en=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;let i=0;const r=e.options.useScrollendEvent&&te?()=>{}:tt(s,()=>{n(i,!1)},e.options.isScrollingResetDelay),o=h=>()=>{const{horizontal:p,isRtl:d}=e.options;i=p?t.scrollLeft*(d&&-1||1):t.scrollTop,r(),n(i,h)},l=o(!0),u=o(!1);t.addEventListener("scroll",l,K);const c=e.options.useScrollendEvent&&te;return c&&t.addEventListener("scrollend",u,K),()=>{t.removeEventListener("scroll",l),c&&t.removeEventListener("scrollend",u)}},tn=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;let i=0;const r=e.options.useScrollendEvent&&te?()=>{}:tt(s,()=>{n(i,!1)},e.options.isScrollingResetDelay),o=h=>()=>{i=t[e.options.horizontal?"scrollX":"scrollY"],r(),n(i,h)},l=o(!0),u=o(!1);t.addEventListener("scroll",l,K);const c=e.options.useScrollendEvent&&te;return c&&t.addEventListener("scrollend",u,K),()=>{t.removeEventListener("scroll",l),c&&t.removeEventListener("scrollend",u)}},nn=(e,n,t)=>{if(n?.borderBoxSize){const s=n.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},sn=(e,{adjustments:n=0,behavior:t},s)=>{var i,r;const o=e+n;(r=(i=s.scrollElement)==null?void 0:i.scrollTo)==null||r.call(i,{[s.options.horizontal?"left":"top"]:o,behavior:t})},rn=(e,{adjustments:n=0,behavior:t},s)=>{var i,r;const o=e+n;(r=(i=s.scrollElement)==null?void 0:i.scrollTo)==null||r.call(i,{[s.options.horizontal?"left":"top"]:o,behavior:t})};class on{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,s,i;return((i=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:i.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(i=>{i.forEach(r=>{const o=()=>{const l=r.target,u=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(l,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=s())==null||i.disconnect(),t=null},observe:i=>{var r;return(r=s())==null?void 0:r.observe(i,{box:"border-box"})},unobserve:i=>{var r;return(r=s())==null?void 0:r.unobserve(i)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([s,i])=>{typeof i>"u"&&delete t[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Xt,rangeExtractor:Yt,onChange:()=>{},measureElement:nn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var s,i;(i=(s=this.options).onChange)==null||i.call(s,this,t)},this.maybeNotify=j(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,s)=>{const i=new Map,r=new Map;for(let o=s-1;o>=0;o--){const l=t[o];if(i.has(l.lane))continue;const u=r.get(l.lane);if(u==null||l.end>u.end?r.set(l.lane,l):l.endo.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=j(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,s,i,r,o,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:s,scrollMargin:i,getItemKey:r,enabled:o,lanes:l}),{key:!1}),this.getMeasurements=j(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:s,scrollMargin:i,getItemKey:r,enabled:o,lanes:l},u)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const d of this.laneAssignments.keys())d>=t&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,c),p=new Array(l).fill(void 0);for(let d=0;d1){f=g;const _=p[f],y=_!==void 0?h[_]:void 0;v=y?y.end+this.options.gap:s+i}else{const _=this.options.lanes===1?h[d-1]:this.getFurthestMeasurement(h,d);v=_?_.end+this.options.gap:s+i,f=_?_.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,f)}const m=u.get(a),w=typeof m=="number"?m:this.options.estimateSize(d),R=v+w;h[d]={index:d,start:v,size:w,end:R,key:a,lane:f},p[f]=d}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=j(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,i,r)=>this.range=t.length>0&&s>0?ln({measurements:t,outerSize:s,scrollOffset:i,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=j(()=>{let t=null,s=null;const i=this.calculateRange();return i&&(t=i.startIndex,s=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,i,r,o)=>r===null||o===null?[]:t({startIndex:r,endIndex:o,overscan:s,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,i=t.getAttribute(s);return i?parseInt(i,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(i!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-r),l=Math.min(this.options.count-1,i+r);return t>=o&&t<=l}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,l)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(l))});return}const s=this.indexFromElement(t),i=this.options.getItemKey(s),r=this.elementsCache.get(i);r!==t&&(r&&this.observer.unobserve(r),this.observer.observe(t),this.elementsCache.set(i,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var i;const r=this.measurementsCache[t];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,l=s-o;l!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,l,this):r.start[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const i=[];for(let r=0,o=t.length;rthis.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length!==0)return He(s[nt(0,s.length-1,i=>He(s[i]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,s,i=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=t>=o+r?"end":"start"),s==="center"?t+=(i-r)/2:s==="end"&&(t-=r);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getSize(),r=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(s==="auto")if(o.end>=r+i-this.options.scrollPaddingEnd)s="end";else if(o.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,o.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:i="auto"}={})=>{const r=this.getOffsetForAlignment(t,s),o=this.now();this.scrollState={index:null,align:s,behavior:i,startedAt:o,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:i="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.getOffsetForIndex(t,s);if(!r)return;const[o,l]=r,u=this.now();this.scrollState={index:t,align:l,behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const i=this.getScrollOffset()+t,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let i;if(s.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((t=s[s.length-1])==null?void 0:t.end)??0;else{const r=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&r.some(l=>l===null);){const l=s[o];r[l.lane]===null&&(r[l.lane]=l.end),o--}i=Math.max(...r.filter(l=>l!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:s,behavior:i})=>{this.options.scrollToFn(t,{behavior:i,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(n)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=s?s[0]:this.scrollState.lastTargetOffset,r=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&Wt(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const nt=(e,n,t,s)=>{for(;e<=n;){const i=(e+n)/2|0,r=t(i);if(rs)n=i-1;else return i}return e>0?e-1:0};function ln({measurements:e,outerSize:n,scrollOffset:t,lanes:s}){const i=e.length-1,r=u=>e[u].start;if(e.length<=s)return{startIndex:0,endIndex:i};let o=nt(0,i,r,t),l=o;if(s===1)for(;l1){const u=Array(s).fill(0);for(;lh=0&&c.some(h=>h>=t);){const h=e[o];c[h.lane]=h.start,o--}o=Math.max(0,o-o%s),l=Math.min(i,l+(s-1-l%s))}return{startIndex:o,endIndex:l}}const Ge=typeof document<"u"?M.useLayoutEffect:M.useEffect;function st({useFlushSync:e=!0,...n}){const t=M.useReducer(()=>({}),{})[1],s={...n,onChange:(r,o)=>{var l;e&&o?vt.flushSync(t):t(),(l=n.onChange)==null||l.call(n,r,o)}},[i]=M.useState(()=>new on(s));return i.setOptions(s),Ge(()=>i._didMount(),[]),Ge(()=>i._willUpdate()),i}function es(e){return st({observeElementRect:Jt,observeElementOffset:en,scrollToFn:rn,...e})}function ts(e){return st({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:Zt,observeElementOffset:tn,scrollToFn:sn,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}function L(e,n){return typeof e=="function"?e(n):e}function $(e,n){return t=>{n.setState(s=>({...s,[e]:L(t,s[e])}))}}function ne(e){return e instanceof Function}function un(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function it(e,n){const t=[],s=i=>{i.forEach(r=>{t.push(r);const o=n(r);o!=null&&o.length&&s(o)})};return s(e),t}function S(e,n,t){let s=[],i;return r=>{let o;t.key&&t.debug&&(o=Date.now());const l=e(r);if(!(l.length!==s.length||l.some((h,p)=>s[p]!==h)))return i;s=l;let c;if(t.key&&t.debug&&(c=Date.now()),i=n(...l),t==null||t.onChange==null||t.onChange(i),t.key&&t.debug&&t!=null&&t.debug()){const h=Math.round((Date.now()-o)*100)/100,p=Math.round((Date.now()-c)*100)/100,d=p/16,a=(g,f)=>{for(g=String(g);g.length{var i;return(i=e?.debugAll)!=null?i:e[n]},key:!1,onChange:s}}function an(e,n,t,s){const i=()=>{var o;return(o=r.getValue())!=null?o:e.options.renderFallbackValue},r={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(s),renderValue:i,getContext:S(()=>[e,t,n,r],(o,l,u,c)=>({table:o,column:l,row:u,cell:c,getValue:c.getValue,renderValue:c.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(r,t,n,e)},{}),r}function cn(e,n,t,s){var i,r;const l={...e._getDefaultColumnDef(),...n},u=l.accessorKey;let c=(i=(r=l.id)!=null?r:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof l.header=="string"?l.header:void 0,h;if(l.accessorFn?h=l.accessorFn:u&&(u.includes(".")?h=d=>{let a=d;for(const f of u.split(".")){var g;a=(g=a)==null?void 0:g[f]}return a}:h=d=>d[l.accessorKey]),!c)throw new Error;let p={id:`${String(c)}`,accessorFn:h,parent:s,depth:t,columnDef:l,columns:[],getFlatColumns:S(()=>[!0],()=>{var d;return[p,...(d=p.columns)==null?void 0:d.flatMap(a=>a.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],d=>{var a;if((a=p.columns)!=null&&a.length){let g=p.columns.flatMap(f=>f.getLeafColumns());return d(g)}return[p]},C(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(p,e);return p}const I="debugHeaders";function qe(e,n,t){var s;let r={id:(s=t.id)!=null?s:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),o.push(u)};return l(r),o},getContext:()=>({table:e,header:r,column:n})};return e._features.forEach(o=>{o.createHeader==null||o.createHeader(r,e)}),r}const dn={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,i)=>{var r,o;const l=(r=s?.map(p=>t.find(d=>d.id===p)).filter(Boolean))!=null?r:[],u=(o=i?.map(p=>t.find(d=>d.id===p)).filter(Boolean))!=null?o:[],c=t.filter(p=>!(s!=null&&s.includes(p.id))&&!(i!=null&&i.includes(p.id)));return X(n,[...l,...c,...u],e)},C(e.options,I)),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,i)=>(t=t.filter(r=>!(s!=null&&s.includes(r.id))&&!(i!=null&&i.includes(r.id))),X(n,t,e,"center")),C(e.options,I)),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,s)=>{var i;const r=(i=s?.map(o=>t.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return X(n,r,e,"left")},C(e.options,I)),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,s)=>{var i;const r=(i=s?.map(o=>t.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return X(n,r,e,"right")},C(e.options,I)),e.getFooterGroups=S(()=>[e.getHeaderGroups()],n=>[...n].reverse(),C(e.options,I)),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),C(e.options,I)),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),C(e.options,I)),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),C(e.options,I)),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,I)),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,I)),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,I)),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,I)),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),C(e.options,I)),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),C(e.options,I)),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),C(e.options,I)),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,s)=>{var i,r,o,l,u,c;return[...(i=(r=n[0])==null?void 0:r.headers)!=null?i:[],...(o=(l=t[0])==null?void 0:l.headers)!=null?o:[],...(u=(c=s[0])==null?void 0:c.headers)!=null?u:[]].map(h=>h.getLeafHeaders()).flat()},C(e.options,I))}};function X(e,n,t,s){var i,r;let o=0;const l=function(d,a){a===void 0&&(a=1),o=Math.max(o,a),d.filter(g=>g.getIsVisible()).forEach(g=>{var f;(f=g.columns)!=null&&f.length&&l(g.columns,a+1)},0)};l(e);let u=[];const c=(d,a)=>{const g={depth:a,id:[s,`${a}`].filter(Boolean).join("_"),headers:[]},f=[];d.forEach(v=>{const m=[...f].reverse()[0],w=v.column.depth===g.depth;let R,_=!1;if(w&&v.column.parent?R=v.column.parent:(R=v.column,_=!0),m&&m?.column===R)m.subHeaders.push(v);else{const y=qe(t,R,{id:[s,a,R.id,v?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${f.filter(F=>F.column===R).length}`:void 0,depth:a,index:f.length});y.subHeaders.push(v),f.push(y)}g.headers.push(v),v.headerGroup=g}),u.push(g),a>0&&c(f,a-1)},h=n.map((d,a)=>qe(t,d,{depth:o,index:a}));c(h,o-1),u.reverse();const p=d=>d.filter(g=>g.column.getIsVisible()).map(g=>{let f=0,v=0,m=[0];g.subHeaders&&g.subHeaders.length?(m=[],p(g.subHeaders).forEach(R=>{let{colSpan:_,rowSpan:y}=R;f+=_,m.push(y)})):f=1;const w=Math.min(...m);return v=v+w,g.colSpan=f,g.rowSpan=v,{colSpan:f,rowSpan:v}});return p((i=(r=u[0])==null?void 0:r.headers)!=null?i:[]),u}const se=(e,n,t,s,i,r,o)=>{let l={id:n,index:s,original:t,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return l._valuesCache[u]=c.accessorFn(l.original,s),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=c.columnDef.getUniqueValues(l.original,s),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var c;return(c=l.getValue(u))!=null?c:e.options.renderFallbackValue},subRows:r??[],getLeafRows:()=>it(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],c=l;for(;;){const h=c.getParentRow();if(!h)break;u.push(h),c=h}return u.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],u=>u.map(c=>an(e,l,c,c.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:S(()=>[l.getAllCells()],u=>u.reduce((c,h)=>(c[h.column.id]=h,c),{}),C(e.options,"debugRows"))};for(let u=0;u{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},rt=(e,n,t)=>{var s,i;const r=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((i=e.getValue(n))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(r))};rt.autoRemove=e=>V(e);const ot=(e,n,t)=>{var s;return!!(!((s=e.getValue(n))==null||(s=s.toString())==null)&&s.includes(t))};ot.autoRemove=e=>V(e);const lt=(e,n,t)=>{var s;return((s=e.getValue(n))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};lt.autoRemove=e=>V(e);const ut=(e,n,t)=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(t)};ut.autoRemove=e=>V(e)||!(e!=null&&e.length);const at=(e,n,t)=>!t.some(s=>{var i;return!((i=e.getValue(n))!=null&&i.includes(s))});at.autoRemove=e=>V(e)||!(e!=null&&e.length);const ct=(e,n,t)=>t.some(s=>{var i;return(i=e.getValue(n))==null?void 0:i.includes(s)});ct.autoRemove=e=>V(e)||!(e!=null&&e.length);const dt=(e,n,t)=>e.getValue(n)===t;dt.autoRemove=e=>V(e);const ht=(e,n,t)=>e.getValue(n)==t;ht.autoRemove=e=>V(e);const xe=(e,n,t)=>{let[s,i]=t;const r=e.getValue(n);return r>=s&&r<=i};xe.resolveFilterValue=e=>{let[n,t]=e,s=typeof n!="number"?parseFloat(n):n,i=typeof t!="number"?parseFloat(t):t,r=n===null||Number.isNaN(s)?-1/0:s,o=t===null||Number.isNaN(i)?1/0:i;if(r>o){const l=r;r=o,o=l}return[r,o]};xe.autoRemove=e=>V(e)||V(e[0])&&V(e[1]);const A={includesString:rt,includesStringSensitive:ot,equalsString:lt,arrIncludes:ut,arrIncludesAll:at,arrIncludesSome:ct,equals:dt,weakEquals:ht,inNumberRange:xe};function V(e){return e==null||e===""}const gn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:$("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?A.includesString:typeof s=="number"?A.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?A.equals:Array.isArray(s)?A.arrIncludes:A.weakEquals},e.getFilterFn=()=>{var t,s;return ne(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=n.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:A[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,i;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=n.options.enableColumnFilters)!=null?s:!0)&&((i=n.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=n.getState().columnFilters)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(s=>{const i=e.getFilterFn(),r=s?.find(h=>h.id===e.id),o=L(t,r?r.value:void 0);if(ke(i,o,e)){var l;return(l=s?.filter(h=>h.id!==e.id))!=null?l:[]}const u={id:e.id,value:o};if(r){var c;return(c=s?.map(h=>h.id===e.id?u:h))!=null?c:[]}return s!=null&&s.length?[...s,u]:[u]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),s=i=>{var r;return(r=L(n,i))==null?void 0:r.filter(o=>{const l=t.find(u=>u.id===o.id);if(l){const u=l.getFilterFn();if(ke(u,o.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=n=>{var t,s;e.setColumnFilters(n?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function ke(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const fn=(e,n,t)=>t.reduce((s,i)=>{const r=i.getValue(e);return s+(typeof r=="number"?r:0)},0),pn=(e,n,t)=>{let s;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(s>r||s===void 0&&r>=r)&&(s=r)}),s},mn=(e,n,t)=>{let s;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(s=r)&&(s=r)}),s},vn=(e,n,t)=>{let s,i;return t.forEach(r=>{const o=r.getValue(e);o!=null&&(s===void 0?o>=o&&(s=i=o):(s>o&&(s=o),i{let t=0,s=0;if(n.forEach(i=>{let r=i.getValue(e);r!=null&&(r=+r)>=r&&(++t,s+=r)}),t)return s/t},Cn=(e,n)=>{if(!n.length)return;const t=n.map(r=>r.getValue(e));if(!un(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),i=t.sort((r,o)=>r-o);return t.length%2!==0?i[s]:(i[s-1]+i[s])/2},wn=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),Rn=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,yn=(e,n)=>n.length,ie={sum:fn,min:pn,max:mn,extent:vn,mean:Sn,median:Cn,unique:wn,uniqueCount:Rn,count:yn},Fn={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:$("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=n.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return ie.sum;if(Object.prototype.toString.call(s)==="[object Date]")return ie.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return ne(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=n.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:ie[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,s;e.setGrouping(n?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=n.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,s)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=t.subRows)!=null&&i.length)}}};function _n(e,n,t){if(!(n!=null&&n.length)||!t)return e;const s=e.filter(r=>!n.includes(r.id));return t==="remove"?s:[...n.map(r=>e.find(o=>o.id===r)).filter(Boolean),...s]}const Mn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:$("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=S(t=>[B(n,t)],t=>t.findIndex(s=>s.id===e.id),C(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=B(n,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const i=B(n,t);return((s=i[i.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,s)=>i=>{let r=[];if(!(n!=null&&n.length))r=i;else{const o=[...n],l=[...i];for(;l.length&&o.length;){const u=o.shift(),c=l.findIndex(h=>h.id===u);c>-1&&r.push(l.splice(c,1)[0])}r=[...r,...l]}return _n(r,t,s)},C(e.options,"debugTable"))}},re=()=>({left:[],right:[]}),xn={getInitialState:e=>({columnPinning:re(),...e}),getDefaultOptions:e=>({onColumnPinningChange:$("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const s=e.getLeafColumns().map(i=>i.id).filter(Boolean);n.setColumnPinning(i=>{var r,o;if(t==="right"){var l,u;return{left:((l=i?.left)!=null?l:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((u=i?.right)!=null?u:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(t==="left"){var c,h;return{left:[...((c=i?.left)!=null?c:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((h=i?.right)!=null?h:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((r=i?.left)!=null?r:[]).filter(p=>!(s!=null&&s.includes(p))),right:((o=i?.right)!=null?o:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var i,r,o;return((i=s.columnDef.enablePinning)!=null?i:!0)&&((r=(o=n.options.enableColumnPinning)!=null?o:n.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(l=>l.id),{left:s,right:i}=n.getState().columnPinning,r=t.some(l=>s?.includes(l)),o=t.some(l=>i?.includes(l));return r?"left":o?"right":!1},e.getPinnedIndex=()=>{var t,s;const i=e.getIsPinned();return i?(t=(s=n.getState().columnPinning)==null||(s=s[i])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,s,i)=>{const r=[...s??[],...i??[]];return t.filter(o=>!r.includes(o.column.id))},C(n.options,"debugRows")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,s)=>(s??[]).map(r=>t.find(o=>o.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),C(n.options,"debugRows")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,s)=>(s??[]).map(r=>t.find(o=>o.column.id===r)).filter(Boolean).map(r=>({...r,position:"right"})),C(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,s;return e.setColumnPinning(n?re():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:re())},e.getIsSomeColumnsPinned=n=>{var t;const s=e.getState().columnPinning;if(!n){var i,r;return!!((i=s.left)!=null&&i.length||(r=s.right)!=null&&r.length)}return!!((t=s[n])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(s=>n.find(i=>i.id===s)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(s=>n.find(i=>i.id===s)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s)=>{const i=[...t??[],...s??[]];return n.filter(r=>!i.includes(r.id))},C(e.options,"debugColumns"))}},Y={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},oe=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),En={getDefaultColumnDef:()=>Y,getInitialState:e=>({columnSizing:{},columnSizingInfo:oe(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:$("columnSizing",e),onColumnSizingInfoChange:$("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,s,i;const r=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Y.minSize,(s=r??e.columnDef.size)!=null?s:Y.size),(i=e.columnDef.maxSize)!=null?i:Y.maxSize)},e.getStart=S(t=>[t,B(n,t),n.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((i,r)=>i+r.getSize(),0),C(n.options,"debugColumns")),e.getAfter=S(t=>[t,B(n,t),n.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((i,r)=>i+r.getSize(),0),C(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:s,...i}=t;return i})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=n.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const s=i=>{if(i.subHeaders.length)i.subHeaders.forEach(s);else{var r;t+=(r=i.column.getSize())!=null?r:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=n.getColumn(e.column.id),i=s?.getCanResize();return r=>{if(!s||!i||(r.persist==null||r.persist(),le(r)&&r.touches&&r.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[s.id,s.getSize()]],u=le(r)?Math.round(r.touches[0].clientX):r.clientX,c={},h=(m,w)=>{typeof w=="number"&&(n.setColumnSizingInfo(R=>{var _,y;const F=n.options.columnResizeDirection==="rtl"?-1:1,P=(w-((_=R?.startOffset)!=null?_:0))*F,E=Math.max(P/((y=R?.startSize)!=null?y:0),-.999999);return R.columnSizingStart.forEach(D=>{let[z,G]=D;c[z]=Math.round(Math.max(G+G*E,0)*100)/100}),{...R,deltaOffset:P,deltaPercentage:E}}),(n.options.columnResizeMode==="onChange"||m==="end")&&n.setColumnSizing(R=>({...R,...c})))},p=m=>h("move",m),d=m=>{h("end",m),n.setColumnSizingInfo(w=>({...w,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},a=t||typeof document<"u"?document:null,g={moveHandler:m=>p(m.clientX),upHandler:m=>{a?.removeEventListener("mousemove",g.moveHandler),a?.removeEventListener("mouseup",g.upHandler),d(m.clientX)}},f={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),p(m.touches[0].clientX),!1),upHandler:m=>{var w;a?.removeEventListener("touchmove",f.moveHandler),a?.removeEventListener("touchend",f.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),d((w=m.touches[0])==null?void 0:w.clientX)}},v=Pn()?{passive:!1}:!1;le(r)?(a?.addEventListener("touchmove",f.moveHandler,v),a?.addEventListener("touchend",f.upHandler,v)):(a?.addEventListener("mousemove",g.moveHandler,v),a?.addEventListener("mouseup",g.upHandler,v)),n.setColumnSizingInfo(m=>({...m,startOffset:u,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?oe():(t=e.initialState.columnSizingInfo)!=null?t:oe())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,i)=>s+i.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,i)=>s+i.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,i)=>s+i.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,i)=>s+i.getSize(),0))!=null?n:0}}};let J=null;function Pn(){if(typeof J=="boolean")return J;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return J=e,J}function le(e){return e.type==="touchstart"}const In={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:$("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const i=e.columns;return(t=i.length?i.some(r=>r.getIsVisible()):(s=n.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=n.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),C(n.options,"debugRows")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,i)=>[...t,...s,...i],C(n.options,"debugRows"))},createTable:e=>{const n=(t,s)=>S(()=>[s(),s().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),C(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,r)=>({...i,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function B(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const On={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},$n={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:$("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,s,i,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=n.options.enableGlobalFilter)!=null?s:!0)&&((i=n.options.enableFilters)!=null?i:!0)&&((r=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>A.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:s}=e.options;return ne(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[s])!=null?n:A[s]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},bn={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:$("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var s,i;if(!n){e._queue(()=>{n=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var i,r;e.setExpanded(s?{}:(i=(r=e.initialState)==null?void 0:r.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const o=r.split(".");s=Math.max(s,o.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(s=>{var i;const r=s===!0?!0:!!(s!=null&&s[e.id]);let o={};if(s===!0?Object.keys(n.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=s,t=(i=t)!=null?i:!r,!r&&t)return{...o,[e.id]:!0};if(r&&!t){const{[e.id]:l,...u}=o;return u}return s})},e.getIsExpanded=()=>{var t;const s=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,i;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((s=n.options.enableExpanding)!=null?s:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=n.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},ve=0,Se=10,ue=()=>({pageIndex:ve,pageSize:Se}),Vn={getInitialState:e=>({...e,pagination:{...ue(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:$("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var s,i;if(!n){e._queue(()=>{n=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const i=r=>L(s,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=s=>{var i;e.setPagination(s?ue():(i=e.initialState.pagination)!=null?i:ue())},e.setPageIndex=s=>{e.setPagination(i=>{let r=L(s,i.pageIndex);const o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...i,pageIndex:r}})},e.resetPageIndex=s=>{var i,r;e.setPageIndex(s?ve:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?i:ve)},e.resetPageSize=s=>{var i,r;e.setPageSize(s?Se:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?i:Se)},e.setPageSize=s=>{e.setPagination(i=>{const r=Math.max(1,L(s,i.pageSize)),o=i.pageSize*i.pageIndex,l=Math.floor(o/r);return{...i,pageIndex:l,pageSize:r}})},e.setPageCount=s=>e.setPagination(i=>{var r;let o=L(s,(r=e.options.pageCount)!=null?r:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),e.getPageOptions=S(()=>[e.getPageCount()],s=>{let i=[];return s&&s>0&&(i=[...new Array(s)].fill(null).map((r,o)=>o)),i},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:se.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},ae=()=>({top:[],bottom:[]}),Dn={getInitialState:e=>({rowPinning:ae(),...e}),getDefaultOptions:e=>({onRowPinningChange:$("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,s,i)=>{const r=s?e.getLeafRows().map(u=>{let{id:c}=u;return c}):[],o=i?e.getParentRows().map(u=>{let{id:c}=u;return c}):[],l=new Set([...o,e.id,...r]);n.setRowPinning(u=>{var c,h;if(t==="bottom"){var p,d;return{top:((p=u?.top)!=null?p:[]).filter(f=>!(l!=null&&l.has(f))),bottom:[...((d=u?.bottom)!=null?d:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)]}}if(t==="top"){var a,g;return{top:[...((a=u?.top)!=null?a:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)],bottom:((g=u?.bottom)!=null?g:[]).filter(f=>!(l!=null&&l.has(f)))}}return{top:((c=u?.top)!=null?c:[]).filter(f=>!(l!=null&&l.has(f))),bottom:((h=u?.bottom)!=null?h:[]).filter(f=>!(l!=null&&l.has(f)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:i}=n.options;return typeof s=="function"?s(e):(t=s??i)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:i}=n.getState().rowPinning,r=t.some(l=>s?.includes(l)),o=t.some(l=>i?.includes(l));return r?"top":o?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const i=e.getIsPinned();if(!i)return-1;const r=(t=i==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(o=>{let{id:l}=o;return l});return(s=r?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,s;return e.setRowPinning(n?ae():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:ae())},e.getIsSomeRowsPinned=n=>{var t;const s=e.getState().rowPinning;if(!n){var i,r;return!!((i=s.top)!=null&&i.length||(r=s.bottom)!=null&&r.length)}return!!((t=s[n])!=null&&t.length)},e._getPinnedRows=(n,t,s)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(t??[]).map(o=>{const l=e.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[]).map(o=>n.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:s}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),C(e.options,"debugRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,s)=>{const i=new Set([...t??[],...s??[]]);return n.filter(r=>!i.has(r.id))},C(e.options,"debugRows"))}},An={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:$("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const s={...t},i=e.getPreGroupedRowModel().flatRows;return n?i.forEach(r=>{r.getCanSelect()&&(s[r.id]=!0)}):i.forEach(r=>{delete s[r.id]}),s})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const s=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),i={...t};return e.getRowModel().rows.forEach(r=>{Ce(i,r.id,s,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?ce(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?ce(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?ce(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(n.length&&Object.keys(t).length);return s&&n.some(i=>i.getCanSelect()&&!t[i.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:t}=e.getState();let s=!!n.length;return s&&n.some(i=>!t[i.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,s)=>{const i=e.getIsSelected();n.setRowSelection(r=>{var o;if(t=typeof t<"u"?t:!i,e.getCanSelect()&&i===t)return r;const l={...r};return Ce(l,e.id,t,(o=s?.selectChildren)!=null?o:!0,n),l})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return Ee(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return we(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return we(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var i;t&&e.toggleSelected((i=s.target)==null?void 0:i.checked)}}}},Ce=(e,n,t,s,i)=>{var r;const o=i.getRow(n,!0);t?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[n]=!0)):delete e[n],s&&(r=o.subRows)!=null&&r.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>Ce(e,l.id,t,s,i))};function ce(e,n){const t=e.getState().rowSelection,s=[],i={},r=function(o,l){return o.map(u=>{var c;const h=Ee(u,t);if(h&&(s.push(u),i[u.id]=u),(c=u.subRows)!=null&&c.length&&(u={...u,subRows:r(u.subRows)}),h)return u}).filter(Boolean)};return{rows:r(n.rows),flatRows:s,rowsById:i}}function Ee(e,n){var t;return(t=n[e.id])!=null?t:!1}function we(e,n,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let i=!0,r=!1;return e.subRows.forEach(o=>{if(!(r&&!i)&&(o.getCanSelect()&&(Ee(o,n)?r=!0:i=!1),o.subRows&&o.subRows.length)){const l=we(o,n);l==="all"?r=!0:(l==="some"&&(r=!0),i=!1)}}),i?"all":r?"some":!1}const Re=/([0-9]+)/gm,zn=(e,n,t)=>gt(T(e.getValue(t)).toLowerCase(),T(n.getValue(t)).toLowerCase()),Ln=(e,n,t)=>gt(T(e.getValue(t)),T(n.getValue(t))),Hn=(e,n,t)=>Pe(T(e.getValue(t)).toLowerCase(),T(n.getValue(t)).toLowerCase()),Tn=(e,n,t)=>Pe(T(e.getValue(t)),T(n.getValue(t))),Gn=(e,n,t)=>{const s=e.getValue(t),i=n.getValue(t);return s>i?1:sPe(e.getValue(t),n.getValue(t));function Pe(e,n){return e===n?0:e>n?1:-1}function T(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function gt(e,n){const t=e.split(Re).filter(Boolean),s=n.split(Re).filter(Boolean);for(;t.length&&s.length;){const i=t.shift(),r=s.shift(),o=parseInt(i,10),l=parseInt(r,10),u=[o,l].sort();if(isNaN(u[0])){if(i>r)return 1;if(r>i)return-1;continue}if(isNaN(u[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return t.length-s.length}const Q={alphanumeric:zn,alphanumericCaseSensitive:Ln,text:Hn,textCaseSensitive:Tn,datetime:Gn,basic:qn},kn={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:$("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const i of t){const r=i?.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return Q.datetime;if(typeof r=="string"&&(s=!0,r.split(Re).length>1))return Q.alphanumeric}return s?Q.text:Q.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return ne(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=n.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:Q[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const i=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;n.setSorting(o=>{const l=o?.find(a=>a.id===e.id),u=o?.findIndex(a=>a.id===e.id);let c=[],h,p=r?t:i==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&s?l?h="toggle":h="add":o!=null&&o.length&&u!==o.length-1?h="replace":l?h="toggle":h="replace",h==="toggle"&&(r||i||(h="remove")),h==="add"){var d;c=[...o,{id:e.id,desc:p}],c.splice(0,c.length-((d=n.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else h==="toggle"?c=o.map(a=>a.id===e.id?{...a,desc:p}:a):h==="remove"?c=o.filter(a=>a.id!==e.id):c=[{id:e.id,desc:p}];return c})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,i;const r=e.getFirstSortDir(),o=e.getIsSorted();return o?o!==r&&((s=n.options.enableSortingRemoval)==null||s)&&(!(t&&(i=n.options.enableMultiRemove)!=null)||i)?!1:o==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=n.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=n.getState().sorting)==null?void 0:t.find(i=>i.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=n.getState().sorting)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,s;e.setSorting(n?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},jn=[dn,In,Mn,xn,hn,gn,On,$n,kn,Fn,bn,Vn,Dn,An,En];function Un(e){var n,t;const s=[...jn,...(n=e._features)!=null?n:[]];let i={_features:s};const r=i._features.reduce((d,a)=>Object.assign(d,a.getDefaultOptions==null?void 0:a.getDefaultOptions(i)),{}),o=d=>i.options.mergeOptions?i.options.mergeOptions(r,d):{...r,...d};let u={...{},...(t=e.initialState)!=null?t:{}};i._features.forEach(d=>{var a;u=(a=d.getInitialState==null?void 0:d.getInitialState(u))!=null?a:u});const c=[];let h=!1;const p={_features:s,options:{...r,...e},initialState:u,_queue:d=>{c.push(d),h||(h=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();h=!1}).catch(a=>setTimeout(()=>{throw a})))},reset:()=>{i.setState(i.initialState)},setOptions:d=>{const a=L(d,i.options);i.options=o(a)},getState:()=>i.options.state,setState:d=>{i.options.onStateChange==null||i.options.onStateChange(d)},_getRowId:(d,a,g)=>{var f;return(f=i.options.getRowId==null?void 0:i.options.getRowId(d,a,g))!=null?f:`${g?[g.id,a].join("."):a}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(d,a)=>{let g=(a?i.getPrePaginationRowModel():i.getRowModel()).rowsById[d];if(!g&&(g=i.getCoreRowModel().rowsById[d],!g))throw new Error;return g},_getDefaultColumnDef:S(()=>[i.options.defaultColumn],d=>{var a;return d=(a=d)!=null?a:{},{header:g=>{const f=g.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:g=>{var f,v;return(f=(v=g.renderValue())==null||v.toString==null?void 0:v.toString())!=null?f:null},...i._features.reduce((g,f)=>Object.assign(g,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...d}},C(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:S(()=>[i._getColumnDefs()],d=>{const a=function(g,f,v){return v===void 0&&(v=0),g.map(m=>{const w=cn(i,m,v,f),R=m;return w.columns=R.columns?a(R.columns,w,v+1):[],w})};return a(d)},C(e,"debugColumns")),getAllFlatColumns:S(()=>[i.getAllColumns()],d=>d.flatMap(a=>a.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:S(()=>[i.getAllFlatColumns()],d=>d.reduce((a,g)=>(a[g.id]=g,a),{}),C(e,"debugColumns")),getAllLeafColumns:S(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(d,a)=>{let g=d.flatMap(f=>f.getLeafColumns());return a(g)},C(e,"debugColumns")),getColumn:d=>i._getAllFlatColumnsById()[d]};Object.assign(i,p);for(let d=0;dS(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(i,r,o){r===void 0&&(r=0);const l=[];for(let c=0;ce._autoResetPageIndex()))}function ss(){return e=>S(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(n,t,s)=>!t.rows.length||n!==!0&&!Object.keys(n??{}).length||!s?t:ft(t),C(e.options,"debugTable"))}function ft(e){const n=[],t=s=>{var i;n.push(s),(i=s.subRows)!=null&&i.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function is(){return(e,n)=>S(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return;const s=t.flatRows.flatMap(o=>{var l;return(l=o.getUniqueValues(n))!=null?l:[]}).map(Number).filter(o=>!Number.isNaN(o));if(!s.length)return;let i=s[0],r=s[s.length-1];for(const o of s)or&&(r=o);return[i,r]},C(e.options,"debugTable"))}function pt(e,n,t){return t.options.filterFromLeafRows?Qn(e,n,t):Bn(e,n,t)}function Qn(e,n,t){var s;const i=[],r={},o=(s=t.options.maxLeafRowFilterDepth)!=null?s:100,l=function(u,c){c===void 0&&(c=0);const h=[];for(let d=0;dS(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,s,i)=>{if(!t.rows.length||!(s!=null&&s.length)&&!i)return t;const r=[...s.map(l=>l.id).filter(l=>l!==n),i?"__global__":void 0].filter(Boolean),o=l=>{for(let u=0;uS(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let s=new Map;for(let r=0;rS(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,s)=>{if(!n.rows.length||!(t!=null&&t.length)&&!s){for(let d=0;d{var a;const g=e.getColumn(d.id);if(!g)return;const f=g.getFilterFn();f&&i.push({id:d.id,filterFn:f,resolvedValue:(a=f.resolveFilterValue==null?void 0:f.resolveFilterValue(d.value))!=null?a:d.value})});const o=(t??[]).map(d=>d.id),l=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());s&&l&&u.length&&(o.push("__global__"),u.forEach(d=>{var a;r.push({id:d.id,filterFn:l,resolvedValue:(a=l.resolveFilterValue==null?void 0:l.resolveFilterValue(s))!=null?a:s})}));let c,h;for(let d=0;d{a.columnFiltersMeta[f]=v})}if(r.length){for(let g=0;g{a.columnFiltersMeta[f]=v})){a.columnFilters.__global__=!0;break}}a.columnFilters.__global__!==!0&&(a.columnFilters.__global__=!1)}}const p=d=>{for(let a=0;ae._autoResetPageIndex()))}function us(){return e=>S(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(n,t)=>{if(!t.rows.length||!n.length)return t.rows.forEach(u=>{u.depth=0,u.parentId=void 0}),t;const s=n.filter(u=>e.getColumn(u)),i=[],r={},o=function(u,c,h){if(c===void 0&&(c=0),c>=s.length)return u.map(g=>(g.depth=c,i.push(g),r[g.id]=g,g.subRows&&(g.subRows=o(g.subRows,c+1,g.id)),g));const p=s[c],d=Nn(u,p);return Array.from(d.entries()).map((g,f)=>{let[v,m]=g,w=`${p}:${v}`;w=h?`${h}>${w}`:w;const R=o(m,c+1,w);R.forEach(F=>{F.parentId=w});const _=c?it(m,F=>F.subRows):m,y=se(e,w,_[0].original,f,c,void 0,h);return Object.assign(y,{groupingColumnId:p,groupingValue:v,subRows:R,leafRows:_,getValue:F=>{if(s.includes(F)){if(y._valuesCache.hasOwnProperty(F))return y._valuesCache[F];if(m[0]){var P;y._valuesCache[F]=(P=m[0].getValue(F))!=null?P:void 0}return y._valuesCache[F]}if(y._groupingValuesCache.hasOwnProperty(F))return y._groupingValuesCache[F];const E=e.getColumn(F),D=E?.getAggregationFn();if(D)return y._groupingValuesCache[F]=D(F,_,m),y._groupingValuesCache[F]}}),R.forEach(F=>{i.push(F),r[F.id]=F}),y})},l=o(t.rows,0);return l.forEach(u=>{i.push(u),r[u.id]=u}),{rows:l,flatRows:i,rowsById:r}},C(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function Nn(e,n){const t=new Map;return e.reduce((s,i)=>{const r=`${i.getGroupingValue(n)}`,o=s.get(r);return o?o.push(i):s.set(r,[i]),s},t)}function as(e){return n=>S(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:i,pageIndex:r}=t;let{rows:o,flatRows:l,rowsById:u}=s;const c=i*r,h=c+i;o=o.slice(c,h);let p;n.options.paginateExpandedRows?p={rows:o,flatRows:l,rowsById:u}:p=ft({rows:o,flatRows:l,rowsById:u}),p.flatRows=[];const d=a=>{p.flatRows.push(a),a.subRows.length&&a.subRows.forEach(d)};return p.rows.forEach(d),p},C(n.options,"debugTable"))}function cs(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const s=e.getState().sorting,i=[],r=s.filter(u=>{var c;return(c=e.getColumn(u.id))==null?void 0:c.getCanSort()}),o={};r.forEach(u=>{const c=e.getColumn(u.id);c&&(o[u.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const l=u=>{const c=u.map(h=>({...h}));return c.sort((h,p)=>{for(let a=0;a{var p;i.push(h),(p=h.subRows)!=null&&p.length&&(h.subRows=l(h.subRows))}),c};return{rows:l(t.rows),flatRows:i,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function ds(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=M.useState(()=>({current:Un(n)})),[s,i]=M.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...s,...e.state},onStateChange:o=>{i(o),e.onStateChange==null||e.onStateChange(o)}})),t.current}export{Xn as Q,as as a,us as b,ls as c,os as d,rs as e,is as f,cs as g,ss as h,ns as i,se as j,ie as k,A as l,Ze as m,Zn as n,Jn as o,Wn as p,es as q,ts as r,Q as s,Yn as t,ds as u};